@govtechsg/sgds-web-component 3.2.0-rc.0 → 3.2.0-rc.1

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 (333) hide show
  1. package/base/button.js +1 -1
  2. package/base/card-element.d.ts +14 -0
  3. package/base/card-element.js +53 -2
  4. package/base/card-element.js.map +1 -1
  5. package/base/card.js +1 -1
  6. package/components/Badge/index.umd.js +63 -44
  7. package/components/Badge/index.umd.js.map +1 -1
  8. package/components/Badge/sgds-badge.d.ts +3 -1
  9. package/components/Badge/sgds-badge.js +23 -4
  10. package/components/Badge/sgds-badge.js.map +1 -1
  11. package/components/Breadcrumb/index.umd.js +2 -2
  12. package/components/Breadcrumb/index.umd.js.map +1 -1
  13. package/components/Breadcrumb/sgds-breadcrumb.d.ts +1 -1
  14. package/components/Breadcrumb/sgds-breadcrumb.js +1 -1
  15. package/components/Breadcrumb/sgds-breadcrumb.js.map +1 -1
  16. package/components/Button/index.umd.js +1 -1
  17. package/components/Card/card.js +1 -1
  18. package/components/Card/index.umd.js +121 -69
  19. package/components/Card/index.umd.js.map +1 -1
  20. package/components/Card/sgds-card.d.ts +4 -15
  21. package/components/Card/sgds-card.js +16 -54
  22. package/components/Card/sgds-card.js.map +1 -1
  23. package/components/Card/types.d.ts +3 -0
  24. package/components/ComboBox/combo-box-item2.js +1 -1
  25. package/components/ComboBox/index.umd.js +30 -10
  26. package/components/ComboBox/index.umd.js.map +1 -1
  27. package/components/ComboBox/sgds-combo-box.js +3 -2
  28. package/components/ComboBox/sgds-combo-box.js.map +1 -1
  29. package/components/Datepicker/index.umd.js +30 -13
  30. package/components/Datepicker/index.umd.js.map +1 -1
  31. package/components/Datepicker/sgds-datepicker.d.ts +13 -3
  32. package/components/Datepicker/sgds-datepicker.js +29 -11
  33. package/components/Datepicker/sgds-datepicker.js.map +1 -1
  34. package/components/Drawer/index.umd.js +2 -2
  35. package/components/Drawer/index.umd.js.map +1 -1
  36. package/components/Dropdown/dropdown-item.js +1 -1
  37. package/components/Dropdown/dropdown.js +1 -1
  38. package/components/Dropdown/index.umd.js +2 -2
  39. package/components/FileUpload/index.umd.js +1 -1
  40. package/components/IconButton/index.umd.js +1 -1
  41. package/components/IconCard/icon-card.js +6 -0
  42. package/components/IconCard/icon-card.js.map +1 -0
  43. package/components/IconCard/index.d.ts +6 -0
  44. package/components/IconCard/index.js +4 -0
  45. package/components/IconCard/index.js.map +1 -0
  46. package/components/IconCard/index.umd.js +4760 -0
  47. package/components/IconCard/index.umd.js.map +1 -0
  48. package/components/IconCard/sgds-icon-card.d.ts +24 -0
  49. package/components/IconCard/sgds-icon-card.js +83 -0
  50. package/components/IconCard/sgds-icon-card.js.map +1 -0
  51. package/components/IconList/icon-list.js +1 -1
  52. package/components/IconList/index.umd.js +1 -1
  53. package/components/ImageCard/image-card.js +6 -0
  54. package/components/ImageCard/image-card.js.map +1 -0
  55. package/components/ImageCard/index.d.ts +6 -0
  56. package/components/ImageCard/index.js +4 -0
  57. package/components/ImageCard/index.js.map +1 -0
  58. package/components/ImageCard/index.umd.js +4774 -0
  59. package/components/ImageCard/index.umd.js.map +1 -0
  60. package/components/ImageCard/sgds-image-card.d.ts +30 -0
  61. package/components/ImageCard/sgds-image-card.js +97 -0
  62. package/components/ImageCard/sgds-image-card.js.map +1 -0
  63. package/components/Input/index.umd.js +1 -1
  64. package/components/Input/input.js +1 -1
  65. package/components/Mainnav/index.umd.js +5 -5
  66. package/components/Mainnav/index.umd.js.map +1 -1
  67. package/components/Mainnav/sgds-mainnav-item.d.ts +1 -1
  68. package/components/Mainnav/sgds-mainnav-item.js +2 -2
  69. package/components/Mainnav/sgds-mainnav-item.js.map +1 -1
  70. package/components/Modal/index.umd.js +22 -17
  71. package/components/Modal/index.umd.js.map +1 -1
  72. package/components/Modal/modal.js +1 -1
  73. package/components/Modal/sgds-modal.js +17 -14
  74. package/components/Modal/sgds-modal.js.map +1 -1
  75. package/components/OverflowMenu/index.js +5 -0
  76. package/components/OverflowMenu/index.js.map +1 -0
  77. package/components/OverflowMenu/index.umd.js +11129 -0
  78. package/components/OverflowMenu/index.umd.js.map +1 -0
  79. package/{internals → components}/OverflowMenu/sgds-overflow-menu.d.ts +3 -3
  80. package/{internals → components}/OverflowMenu/sgds-overflow-menu.js +3 -3
  81. package/components/OverflowMenu/sgds-overflow-menu.js.map +1 -0
  82. package/components/Pagination/index.umd.js +1 -1
  83. package/components/QuantityToggle/index.umd.js +2 -2
  84. package/components/Select/index.umd.js +1 -1
  85. package/components/Select/select-item2.js +1 -1
  86. package/components/Subnav/index.umd.js +79 -87
  87. package/components/Subnav/index.umd.js.map +1 -1
  88. package/components/Subnav/sgds-subnav-item.d.ts +1 -1
  89. package/components/Subnav/sgds-subnav-item.js +2 -2
  90. package/components/Subnav/sgds-subnav-item.js.map +1 -1
  91. package/components/Subnav/sgds-subnav.d.ts +5 -4
  92. package/components/Subnav/sgds-subnav.js +76 -85
  93. package/components/Subnav/sgds-subnav.js.map +1 -1
  94. package/components/Subnav/subnav-item.js +1 -1
  95. package/components/Subnav/subnav.js +1 -1
  96. package/components/Table/index.d.ts +7 -1
  97. package/components/Table/index.js +6 -0
  98. package/components/Table/index.js.map +1 -1
  99. package/components/Table/index.umd.js +182 -16
  100. package/components/Table/index.umd.js.map +1 -1
  101. package/components/Table/sgds-table-cell.d.ts +13 -0
  102. package/components/Table/sgds-table-cell.js +22 -0
  103. package/components/Table/sgds-table-cell.js.map +1 -0
  104. package/components/Table/sgds-table-head.d.ts +18 -0
  105. package/components/Table/sgds-table-head.js +43 -0
  106. package/components/Table/sgds-table-head.js.map +1 -0
  107. package/components/Table/sgds-table-row.d.ts +13 -0
  108. package/components/Table/sgds-table-row.js +22 -0
  109. package/components/Table/sgds-table-row.js.map +1 -0
  110. package/components/Table/sgds-table.d.ts +5 -2
  111. package/components/Table/sgds-table.js +18 -13
  112. package/components/Table/sgds-table.js.map +1 -1
  113. package/components/Table/table-cell.js +6 -0
  114. package/components/Table/table-cell.js.map +1 -0
  115. package/components/Table/table-head.js +6 -0
  116. package/components/Table/table-head.js.map +1 -0
  117. package/components/Table/table-row.js +6 -0
  118. package/components/Table/table-row.js.map +1 -0
  119. package/components/Table/table.js +1 -1
  120. package/components/ThumbnailCard/index.d.ts +6 -0
  121. package/components/ThumbnailCard/index.js +4 -0
  122. package/components/ThumbnailCard/index.js.map +1 -0
  123. package/components/ThumbnailCard/index.umd.js +4764 -0
  124. package/components/ThumbnailCard/index.umd.js.map +1 -0
  125. package/components/ThumbnailCard/sgds-thumbnail-card.d.ts +24 -0
  126. package/components/ThumbnailCard/sgds-thumbnail-card.js +87 -0
  127. package/components/ThumbnailCard/sgds-thumbnail-card.js.map +1 -0
  128. package/components/ThumbnailCard/thumbnail-card.js +6 -0
  129. package/components/ThumbnailCard/thumbnail-card.js.map +1 -0
  130. package/components/Toast/index.umd.js +1 -1
  131. package/components/Toast/toast.js +1 -1
  132. package/components/index.d.ts +4 -0
  133. package/components/index.js +4 -0
  134. package/components/index.js.map +1 -1
  135. package/components/index.umd.js +615 -322
  136. package/components/index.umd.js.map +1 -1
  137. package/index.d.ts +4 -0
  138. package/index.js +4 -0
  139. package/index.js.map +1 -1
  140. package/index.umd.js +703 -331
  141. package/index.umd.js.map +1 -1
  142. package/package.json +1 -1
  143. package/react/badge/index.cjs.js +3 -1
  144. package/react/badge/index.cjs.js.map +1 -1
  145. package/react/badge/index.js +3 -1
  146. package/react/badge/index.js.map +1 -1
  147. package/react/base/button.cjs.js +1 -1
  148. package/react/base/button.js +1 -1
  149. package/react/base/card-element.cjs.js +52 -1
  150. package/react/base/card-element.cjs.js.map +1 -1
  151. package/react/base/card-element.js +53 -2
  152. package/react/base/card-element.js.map +1 -1
  153. package/react/base/card.cjs.js +1 -1
  154. package/react/base/card.js +1 -1
  155. package/react/components/Badge/sgds-badge.cjs.js +23 -4
  156. package/react/components/Badge/sgds-badge.cjs.js.map +1 -1
  157. package/react/components/Badge/sgds-badge.js +23 -4
  158. package/react/components/Badge/sgds-badge.js.map +1 -1
  159. package/react/components/Breadcrumb/sgds-breadcrumb.cjs.js +1 -1
  160. package/react/components/Breadcrumb/sgds-breadcrumb.cjs.js.map +1 -1
  161. package/react/components/Breadcrumb/sgds-breadcrumb.js +1 -1
  162. package/react/components/Breadcrumb/sgds-breadcrumb.js.map +1 -1
  163. package/react/components/Card/card.cjs.js +1 -1
  164. package/react/components/Card/card.js +1 -1
  165. package/react/components/Card/sgds-card.cjs.js +15 -53
  166. package/react/components/Card/sgds-card.cjs.js.map +1 -1
  167. package/react/components/Card/sgds-card.js +16 -54
  168. package/react/components/Card/sgds-card.js.map +1 -1
  169. package/react/components/ComboBox/combo-box-item.cjs2.js +1 -1
  170. package/react/components/ComboBox/combo-box-item2.js +1 -1
  171. package/react/components/ComboBox/sgds-combo-box.cjs.js +3 -2
  172. package/react/components/ComboBox/sgds-combo-box.cjs.js.map +1 -1
  173. package/react/components/ComboBox/sgds-combo-box.js +3 -2
  174. package/react/components/ComboBox/sgds-combo-box.js.map +1 -1
  175. package/react/components/Datepicker/sgds-datepicker.cjs.js +29 -11
  176. package/react/components/Datepicker/sgds-datepicker.cjs.js.map +1 -1
  177. package/react/components/Datepicker/sgds-datepicker.js +29 -11
  178. package/react/components/Datepicker/sgds-datepicker.js.map +1 -1
  179. package/react/components/Dropdown/dropdown-item.cjs.js +1 -1
  180. package/react/components/Dropdown/dropdown-item.js +1 -1
  181. package/react/components/Dropdown/dropdown.cjs.js +1 -1
  182. package/react/components/Dropdown/dropdown.js +1 -1
  183. package/react/components/IconCard/icon-card.cjs.js +11 -0
  184. package/react/components/IconCard/icon-card.cjs.js.map +1 -0
  185. package/react/components/IconCard/icon-card.js +7 -0
  186. package/react/components/IconCard/icon-card.js.map +1 -0
  187. package/react/components/IconCard/sgds-icon-card.cjs.js +89 -0
  188. package/react/components/IconCard/sgds-icon-card.cjs.js.map +1 -0
  189. package/react/components/IconCard/sgds-icon-card.js +84 -0
  190. package/react/components/IconCard/sgds-icon-card.js.map +1 -0
  191. package/react/components/IconList/icon-list.cjs.js +1 -1
  192. package/react/components/IconList/icon-list.js +1 -1
  193. package/react/components/ImageCard/image-card.cjs.js +11 -0
  194. package/react/components/ImageCard/image-card.cjs.js.map +1 -0
  195. package/react/components/ImageCard/image-card.js +7 -0
  196. package/react/components/ImageCard/image-card.js.map +1 -0
  197. package/react/components/ImageCard/sgds-image-card.cjs.js +103 -0
  198. package/react/components/ImageCard/sgds-image-card.cjs.js.map +1 -0
  199. package/react/components/ImageCard/sgds-image-card.js +98 -0
  200. package/react/components/ImageCard/sgds-image-card.js.map +1 -0
  201. package/react/components/Input/input.cjs.js +1 -1
  202. package/react/components/Input/input.js +1 -1
  203. package/react/components/Mainnav/sgds-mainnav-item.cjs.js +2 -2
  204. package/react/components/Mainnav/sgds-mainnav-item.cjs.js.map +1 -1
  205. package/react/components/Mainnav/sgds-mainnav-item.js +2 -2
  206. package/react/components/Mainnav/sgds-mainnav-item.js.map +1 -1
  207. package/react/components/Modal/modal.cjs.js +1 -1
  208. package/react/components/Modal/modal.js +1 -1
  209. package/react/components/Modal/sgds-modal.cjs.js +17 -14
  210. package/react/components/Modal/sgds-modal.cjs.js.map +1 -1
  211. package/react/components/Modal/sgds-modal.js +17 -14
  212. package/react/components/Modal/sgds-modal.js.map +1 -1
  213. package/react/{internals → components}/OverflowMenu/sgds-overflow-menu.cjs.js +3 -3
  214. package/react/components/OverflowMenu/sgds-overflow-menu.cjs.js.map +1 -0
  215. package/react/{internals → components}/OverflowMenu/sgds-overflow-menu.js +3 -3
  216. package/react/components/OverflowMenu/sgds-overflow-menu.js.map +1 -0
  217. package/react/components/Select/select-item.cjs2.js +1 -1
  218. package/react/components/Select/select-item2.js +1 -1
  219. package/react/components/Subnav/sgds-subnav-item.cjs.js +2 -2
  220. package/react/components/Subnav/sgds-subnav-item.cjs.js.map +1 -1
  221. package/react/components/Subnav/sgds-subnav-item.js +2 -2
  222. package/react/components/Subnav/sgds-subnav-item.js.map +1 -1
  223. package/react/components/Subnav/sgds-subnav.cjs.js +74 -83
  224. package/react/components/Subnav/sgds-subnav.cjs.js.map +1 -1
  225. package/react/components/Subnav/sgds-subnav.js +76 -85
  226. package/react/components/Subnav/sgds-subnav.js.map +1 -1
  227. package/react/components/Subnav/subnav-item.cjs.js +1 -1
  228. package/react/components/Subnav/subnav-item.js +1 -1
  229. package/react/components/Subnav/subnav.cjs.js +1 -1
  230. package/react/components/Subnav/subnav.js +1 -1
  231. package/react/components/Table/sgds-table-cell.cjs.js +28 -0
  232. package/react/components/Table/sgds-table-cell.cjs.js.map +1 -0
  233. package/react/components/Table/sgds-table-cell.js +23 -0
  234. package/react/components/Table/sgds-table-cell.js.map +1 -0
  235. package/react/components/Table/sgds-table-head.cjs.js +49 -0
  236. package/react/components/Table/sgds-table-head.cjs.js.map +1 -0
  237. package/react/components/Table/sgds-table-head.js +44 -0
  238. package/react/components/Table/sgds-table-head.js.map +1 -0
  239. package/react/components/Table/sgds-table-row.cjs.js +28 -0
  240. package/react/components/Table/sgds-table-row.cjs.js.map +1 -0
  241. package/react/components/Table/sgds-table-row.js +23 -0
  242. package/react/components/Table/sgds-table-row.js.map +1 -0
  243. package/react/components/Table/sgds-table.cjs.js +17 -12
  244. package/react/components/Table/sgds-table.cjs.js.map +1 -1
  245. package/react/components/Table/sgds-table.js +18 -13
  246. package/react/components/Table/sgds-table.js.map +1 -1
  247. package/react/components/Table/table-cell.cjs.js +11 -0
  248. package/react/components/Table/table-cell.cjs.js.map +1 -0
  249. package/react/components/Table/table-cell.js +7 -0
  250. package/react/components/Table/table-cell.js.map +1 -0
  251. package/react/components/Table/table-head.cjs.js +11 -0
  252. package/react/components/Table/table-head.cjs.js.map +1 -0
  253. package/react/components/Table/table-head.js +7 -0
  254. package/react/components/Table/table-head.js.map +1 -0
  255. package/react/components/Table/table-row.cjs.js +11 -0
  256. package/react/components/Table/table-row.cjs.js.map +1 -0
  257. package/react/components/Table/table-row.js +7 -0
  258. package/react/components/Table/table-row.js.map +1 -0
  259. package/react/components/Table/table.cjs.js +1 -1
  260. package/react/components/Table/table.js +1 -1
  261. package/react/components/ThumbnailCard/sgds-thumbnail-card.cjs.js +93 -0
  262. package/react/components/ThumbnailCard/sgds-thumbnail-card.cjs.js.map +1 -0
  263. package/react/components/ThumbnailCard/sgds-thumbnail-card.js +88 -0
  264. package/react/components/ThumbnailCard/sgds-thumbnail-card.js.map +1 -0
  265. package/react/components/ThumbnailCard/thumbnail-card.cjs.js +11 -0
  266. package/react/components/ThumbnailCard/thumbnail-card.cjs.js.map +1 -0
  267. package/react/components/ThumbnailCard/thumbnail-card.js +7 -0
  268. package/react/components/ThumbnailCard/thumbnail-card.js.map +1 -0
  269. package/react/components/Toast/toast.cjs.js +1 -1
  270. package/react/components/Toast/toast.js +1 -1
  271. package/react/icon-card/index.cjs.js +40 -0
  272. package/react/icon-card/index.cjs.js.map +1 -0
  273. package/react/icon-card/index.d.ts +2 -0
  274. package/react/icon-card/index.js +16 -0
  275. package/react/icon-card/index.js.map +1 -0
  276. package/react/image-card/index.cjs.js +40 -0
  277. package/react/image-card/index.cjs.js.map +1 -0
  278. package/react/image-card/index.d.ts +2 -0
  279. package/react/image-card/index.js +16 -0
  280. package/react/image-card/index.js.map +1 -0
  281. package/react/index.cjs.js +78 -64
  282. package/react/index.cjs.js.map +1 -1
  283. package/react/index.d.ts +7 -0
  284. package/react/index.js +7 -0
  285. package/react/index.js.map +1 -1
  286. package/react/overflow-menu/index.cjs.js +40 -0
  287. package/react/overflow-menu/index.cjs.js.map +1 -0
  288. package/react/overflow-menu/index.d.ts +2 -0
  289. package/react/overflow-menu/index.js +16 -0
  290. package/react/overflow-menu/index.js.map +1 -0
  291. package/react/table-cell/index.cjs.js +40 -0
  292. package/react/table-cell/index.cjs.js.map +1 -0
  293. package/react/table-cell/index.d.ts +2 -0
  294. package/react/table-cell/index.js +16 -0
  295. package/react/table-cell/index.js.map +1 -0
  296. package/react/table-head/index.cjs.js +40 -0
  297. package/react/table-head/index.cjs.js.map +1 -0
  298. package/react/table-head/index.d.ts +2 -0
  299. package/react/table-head/index.js +16 -0
  300. package/react/table-head/index.js.map +1 -0
  301. package/react/table-row/index.cjs.js +40 -0
  302. package/react/table-row/index.cjs.js.map +1 -0
  303. package/react/table-row/index.d.ts +2 -0
  304. package/react/table-row/index.js +16 -0
  305. package/react/table-row/index.js.map +1 -0
  306. package/react/thumbnail-card/index.cjs.js +40 -0
  307. package/react/thumbnail-card/index.cjs.js.map +1 -0
  308. package/react/thumbnail-card/index.d.ts +2 -0
  309. package/react/thumbnail-card/index.js +16 -0
  310. package/react/thumbnail-card/index.js.map +1 -0
  311. package/react/utils/breakpoints.cjs.js.map +1 -1
  312. package/react/utils/breakpoints.js.map +1 -1
  313. package/react/utils/scroll.cjs.js +2 -2
  314. package/react/utils/scroll.cjs.js.map +1 -1
  315. package/react/utils/scroll.js +2 -2
  316. package/react/utils/scroll.js.map +1 -1
  317. package/themes/day.css +1 -0
  318. package/themes/night.css +1 -0
  319. package/themes/root.css +6 -0
  320. package/utils/breakpoints.d.ts +1 -0
  321. package/utils/breakpoints.js.map +1 -1
  322. package/utils/scroll.js +2 -2
  323. package/utils/scroll.js.map +1 -1
  324. package/internals/OverflowMenu/sgds-overflow-menu.js.map +0 -1
  325. package/react/internals/OverflowMenu/sgds-overflow-menu.cjs.js.map +0 -1
  326. package/react/internals/OverflowMenu/sgds-overflow-menu.js.map +0 -1
  327. /package/{internals → components}/OverflowMenu/index.d.ts +0 -0
  328. /package/{internals → components}/OverflowMenu/overflow-menu.js +0 -0
  329. /package/{internals → components}/OverflowMenu/overflow-menu.js.map +0 -0
  330. /package/react/{internals → components}/OverflowMenu/overflow-menu.cjs.js +0 -0
  331. /package/react/{internals → components}/OverflowMenu/overflow-menu.cjs.js.map +0 -0
  332. /package/react/{internals → components}/OverflowMenu/overflow-menu.js +0 -0
  333. /package/react/{internals → components}/OverflowMenu/overflow-menu.js.map +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-combo-box.js","sources":["../../../../src/components/ComboBox/sgds-combo-box.ts"],"sourcesContent":["import { html, nothing } from \"lit\";\nimport { property, queryAsync, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { ref } from \"lit/directives/ref.js\";\nimport { SelectElement, SgdsSelectItemData } from \"../../base/select-element\";\nimport { watch } from \"../../utils/watch\";\nimport { SgdsBadge } from \"../Badge/sgds-badge\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\nimport { ComboBoxItem } from \"./combo-box-item\";\nimport comboBoxStyle from \"./combo-box.css\";\n\n/**\n * Each item in the ComboBox has a label to display\n * and a value (the actual data / ID).\n */\ntype SgdsComboBoxItemData = SgdsSelectItemData;\n/**\n * @summary ComboBox component is used for users to make one or more selections from a list through user input, keyboard or mouse actions\n *\n * @slot icon - slot for form control icon to be displayed on the right of the input box.\n *\n * @event sgds-select - Emitted when the combo box's selected value changes.\n * @event sgds-input - Emitted when user input is received and its value changes.\n */\n\nexport class SgdsComboBox extends SelectElement {\n static styles = [...SelectElement.styles, comboBoxStyle];\n\n /** @internal */\n static dependencies = {\n \"sgds-combo-box-item\": ComboBoxItem,\n \"sgds-icon\": SgdsIcon,\n \"sgds-badge\": SgdsBadge\n };\n\n /** If true, renders multiple checkbox selection items. If false, single-select. */\n @property({ type: Boolean, reflect: true }) multiSelect = false;\n\n /** The function used to filter the menu list, given the user's input value. */\n @property()\n filterFunction: (inputValue: string, item: SgdsComboBoxItemData) => boolean = (inputValue, item) => {\n return item.label.toLowerCase().startsWith(inputValue.toLowerCase());\n };\n\n /** Managed menu to render depending on the activity. On input change, show filteredMenu, on selections and initial state show full menu list. */\n @state()\n private _renderedMenu: SgdsComboBoxItemData[] = [];\n\n @queryAsync(\"input#multi-select-input-tracker\") private _multiSelectInput: Promise<HTMLInputElement>;\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(\"sgds-hide\", async () => {\n const sgdsInput = await this._input;\n sgdsInput.focus();\n this._renderedMenu = this.menuList;\n });\n }\n\n async firstUpdated() {\n super.firstUpdated();\n\n this._renderedMenu = this.menuList;\n if (this.value) {\n const valueArray = this.value.split(\";\");\n const initialSelectedItem = this.menuList.filter(({ value }) => valueArray.includes(value));\n this.selectedItems = [...initialSelectedItem, ...this.selectedItems];\n\n if (!this.multiSelect) {\n this.displayValue = initialSelectedItem[0].label;\n }\n }\n this.multiSelect ? (this.input = await this._multiSelectInput) : (this.input = await this._input);\n this._mixinValidate(this.input);\n\n if (this.menuIsOpen && !this.readonly) {\n this.showMenu();\n }\n }\n\n @watch(\"value\", { waitUntilFirstUpdate: true })\n async _handleValueChange() {\n if (this.value) {\n this.emit(\"sgds-select\");\n }\n const sgdsInput = await this._input;\n this._mixinSetFormValue();\n\n if (this.multiSelect) {\n this._mixinValidate(this.input);\n } else {\n // this._mixinValidate(sgdsInput.input);\n this._mixinValidate(sgdsInput);\n }\n if (!this._isTouched && this.value === \"\") return;\n\n this.invalid = !this._mixinReportValidity();\n }\n\n // Called each time the user types in the <sgds-input>, we set .value and show the menu\n private async _handleInputChange(e: CustomEvent) {\n this.emit(\"sgds-input\");\n const input = e.target as HTMLInputElement;\n this.displayValue = input.value;\n this.filteredMenuList = this.menuList.filter(item => this.filterFunction(this.displayValue, item));\n\n // reset menu list when displayValue\n if (this.displayValue === \"\" && !this.multiSelect) {\n this.selectedItems = [];\n this.value = this.selectedItems.join(\";\");\n }\n\n this.invalid = false;\n this.showMenu();\n\n this.displayValue = (e.target as HTMLInputElement).value;\n this._renderedMenu = this.filteredMenuList;\n\n if (this.displayValue === \"\") {\n this._renderedMenu = this.menuList;\n await this.updateComplete;\n }\n }\n\n /**\n * Called whenever an <sgds-combo-box-item> dispatches sgds-select\"\n */\n protected async _handleItemSelected(e: CustomEvent) {\n const itemEl = e.target as ComboBoxItem;\n const itemLabel = itemEl.textContent?.trim() ?? \"\";\n const itemValueAttr = itemEl.getAttribute(\"value\") ?? itemLabel;\n const foundItem = this.filteredMenuList.find(i => i.value.toString() === itemValueAttr) || {\n label: itemLabel,\n value: itemValueAttr\n };\n\n if (this.multiSelect) {\n if (!this.selectedItems.some(i => i.value === foundItem.value)) {\n this.selectedItems = [...this.selectedItems, foundItem];\n setTimeout(() => (this.displayValue = \"\"));\n }\n this.hideMenu();\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n } else {\n // Single-select\n this.selectedItems = [foundItem];\n this.value = foundItem.value.toString();\n this.displayValue = this.selectedItems[0].label;\n this.hideMenu();\n }\n }\n\n private _handleItemUnselect(e: CustomEvent) {\n const itemEl = e.target as ComboBoxItem;\n\n const itemLabel = itemEl.textContent?.trim() ?? \"\";\n const itemValueAttr = itemEl.getAttribute(\"value\") ?? itemLabel;\n const foundItem = this.filteredMenuList.find(i => i.value.toString() === itemValueAttr) || {\n label: itemLabel,\n value: itemValueAttr\n };\n\n this.selectedItems = this.selectedItems.filter(i => i.value !== foundItem.value);\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n }\n\n private async _handleBadgeDismissed(item: SgdsComboBoxItemData) {\n this.selectedItems = this.selectedItems.filter(i => i.value !== item.value);\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n }\n private async _handleMultiSelectKeyDown(e: KeyboardEvent) {\n // Only do this in multi-select mode\n if (!this.multiSelect) {\n return;\n }\n\n if (e.key === \"Backspace\" && this.multiSelect) {\n if (this.displayValue.trim() === \"\" && this.selectedItems.length > 0) {\n this.selectedItems = this.selectedItems.slice(0, -1);\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n }\n }\n }\n protected async _handleInputBlur(e: Event) {\n e.preventDefault();\n if (this.multiSelect) {\n const displayValueMatchedSelectedItems = this.selectedItems.filter(({ label }) => this.displayValue === label);\n if (displayValueMatchedSelectedItems.length <= 0) {\n this.displayValue = \"\";\n }\n } else {\n // Single select\n if (this.selectedItems.length > 0) {\n this.displayValue = this.selectedItems[0].label;\n } else {\n this.displayValue = \"\";\n }\n }\n }\n\n /** For form reset */\n protected async _mixinResetFormControl() {\n this.value = this.defaultValue;\n if (!this.multiSelect) {\n const initialItem = this.menuList.filter(({ value }) => value === this.value);\n if (initialItem.length <= 0) {\n this.displayValue = \"\";\n } else {\n this.displayValue = initialItem[0].label;\n }\n this._mixinResetValidity(await this._input);\n } else {\n const valueArray = this.value.split(\";\");\n const initialItem = this.menuList.filter(({ value }) => valueArray.includes(value));\n this.selectedItems = initialItem;\n this._mixinResetValidity(await this._multiSelectInput);\n }\n }\n\n protected _renderMenu() {\n const emptyMenu = html` <div class=\"empty-menu\">No options</div> `;\n const menu = this._renderedMenu.map(item => {\n let isActive = false;\n if (this.multiSelect) {\n const selectedItemValueArray = this.selectedItems.map(i => i.value);\n isActive = selectedItemValueArray.includes(item.value);\n } else {\n isActive = item.value === this.value;\n }\n return html`\n <sgds-combo-box-item\n ?active=${isActive}\n ?checkbox=${this.multiSelect}\n value=${item.value}\n @sgds-select=${this._handleItemSelected}\n @sgds-unselect=${this._handleItemUnselect}\n >\n ${item.label}\n </sgds-combo-box-item>\n `;\n });\n return this._renderedMenu.length === 0 ? emptyMenu : menu;\n }\n\n protected _renderInput() {\n const wantFeedbackStyle = this.hasFeedback;\n return html`\n <div\n ${ref(this.myDropdown)}\n class=\"form-control-group ${classMap({\n disabled: this.disabled,\n readonly: this.readonly,\n \"is-invalid\": this.invalid && wantFeedbackStyle\n })}\"\n @click=${this._handleClick}\n >\n <div class=\"combobox-input-container\">\n ${this.multiSelect\n ? html`\n ${this.selectedItems.map(\n item =>\n html`<sgds-badge\n outlined\n variant=\"neutral\"\n show\n dismissible\n @sgds-hide=${() => this._handleBadgeDismissed(item)}\n >${item.label}</sgds-badge\n >`\n )}\n `\n : nothing}\n <input\n class=\"form-control\"\n type=\"text\"\n id=${this._controlId}\n name=${ifDefined(this.name)}\n placeholder=${ifDefined(this.placeholder)}\n aria-invalid=${this.invalid ? \"true\" : \"false\"}\n ?autofocus=${this.autofocus}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n .value=${this.displayValue}\n @input=${this._handleInputChange}\n @blur=${this._handleInputBlur}\n aria-describedby=${ifDefined(this.invalid && this.hasFeedback ? `${this._controlId}-invalid` : undefined)}\n aria-labelledby=\"${this._labelId} ${this._controlId}Help ${this.invalid && this.hasFeedback\n ? `${this._controlId}-invalid`\n : \"\"}\"\n />\n </div>\n <sgds-icon name=\"chevron-down\" size=\"md\"></sgds-icon>\n </div>\n `;\n }\n render() {\n return html`\n <div class=\"combobox\" @keydown=${this._handleMultiSelectKeyDown}>\n ${this._renderLabel()}\n <!-- The input -->\n ${this._renderInput()} ${this._renderFeedback()}\n <ul id=${this.dropdownMenuId} class=\"dropdown-menu\" part=\"menu\" tabindex=\"-1\">\n ${this._renderMenu()}\n </ul>\n </div>\n <!-- Required an input element for constraint validation -->\n ${this.multiSelect\n ? html`<input\n .value=${live(this.value)}\n id=\"multi-select-input-tracker\"\n class=\"visually-hidden\"\n ?required=${this.required}\n />`\n : nothing}\n `;\n }\n}\n\nexport default SgdsComboBox;\n"],"names":["comboBoxStyle"],"mappings":";;;;;;;;;;;;;;;AAkBA;;;;;;;AAOG;AAEG,MAAO,YAAa,SAAQ,aAAa,CAAA;AAA/C,IAAA,WAAA,GAAA;;;QAW8C,IAAW,CAAA,WAAA,GAAG,KAAK,CAAC;;AAIhE,QAAA,IAAA,CAAA,cAAc,GAAgE,CAAC,UAAU,EAAE,IAAI,KAAI;AACjG,YAAA,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC,CAAC;AACvE,SAAC,CAAC;;QAIM,IAAa,CAAA,aAAA,GAA2B,EAAE,CAAC;KA+QpD;IA3QC,iBAAiB,GAAA;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAC;AAC1B,QAAA,IAAI,CAAC,gBAAgB,CAAC,WAAW,EAAE,YAAW;AAC5C,YAAA,MAA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gBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAIM,UAAA,CAAA;AADP,IAAA,KAAK,EAAE;AAC2C,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAEK,UAAA,CAAA;IAAvD,UAAU,CAAC,kCAAkC,CAAC;AAAsD,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,mBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAiC/F,UAAA,CAAA;IADL,KAAK,CAAC,OAAO,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAiB9C,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,oBAAA,EAAA,IAAA,CAAA;;;;"}
1
+ {"version":3,"file":"sgds-combo-box.js","sources":["../../../../src/components/ComboBox/sgds-combo-box.ts"],"sourcesContent":["import { html, nothing } from \"lit\";\nimport { property, queryAsync, state } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { ref } from \"lit/directives/ref.js\";\nimport { SelectElement, SgdsSelectItemData } from \"../../base/select-element\";\nimport { watch } from \"../../utils/watch\";\nimport { SgdsBadge } from \"../Badge/sgds-badge\";\nimport SgdsIcon from \"../Icon/sgds-icon\";\nimport { ComboBoxItem } from \"./combo-box-item\";\nimport comboBoxStyle from \"./combo-box.css\";\n\n/**\n * Each item in the ComboBox has a label to display\n * and a value (the actual data / ID).\n */\ntype SgdsComboBoxItemData = SgdsSelectItemData;\n/**\n * @summary ComboBox component is used for users to make one or more selections from a list through user input, keyboard or mouse actions\n *\n * @slot icon - slot for form control icon to be displayed on the right of the input box.\n *\n * @event sgds-select - Emitted when the combo box's selected value changes.\n * @event sgds-input - Emitted when user input is received and its value changes.\n */\n\nexport class SgdsComboBox extends SelectElement {\n static styles = [...SelectElement.styles, comboBoxStyle];\n\n /** @internal */\n static dependencies = {\n \"sgds-combo-box-item\": ComboBoxItem,\n \"sgds-icon\": SgdsIcon,\n \"sgds-badge\": SgdsBadge\n };\n\n /** If true, renders multiple checkbox selection items. If false, single-select. */\n @property({ type: Boolean, reflect: true }) multiSelect = false;\n\n /** The function used to filter the menu list, given the user's input value. */\n @property()\n filterFunction: (inputValue: string, item: SgdsComboBoxItemData) => boolean = (inputValue, item) => {\n return item.label.toLowerCase().startsWith(inputValue.toLowerCase());\n };\n\n /** Managed menu to render depending on the activity. On input change, show filteredMenu, on selections and initial state show full menu list. */\n @state()\n private _renderedMenu: SgdsComboBoxItemData[] = [];\n\n @queryAsync(\"input#multi-select-input-tracker\") private _multiSelectInput: Promise<HTMLInputElement>;\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(\"sgds-hide\", async () => {\n const sgdsInput = await this._input;\n sgdsInput.focus();\n this._renderedMenu = this.menuList;\n });\n }\n\n async firstUpdated() {\n super.firstUpdated();\n\n this._renderedMenu = this.menuList;\n if (this.value) {\n const valueArray = this.value.split(\";\");\n const initialSelectedItem = this.menuList.filter(({ value }) => valueArray.includes(value));\n this.selectedItems = [...initialSelectedItem, ...this.selectedItems];\n\n if (!this.multiSelect) {\n this.displayValue = initialSelectedItem[0].label;\n }\n }\n this.multiSelect ? (this.input = await this._multiSelectInput) : (this.input = await this._input);\n this._mixinValidate(this.input);\n\n if (this.menuIsOpen && !this.readonly) {\n this.showMenu();\n }\n }\n\n @watch(\"value\", { waitUntilFirstUpdate: true })\n async _handleValueChange() {\n if (this.value) {\n this.emit(\"sgds-select\");\n }\n const sgdsInput = await this._input;\n this._mixinSetFormValue();\n\n if (this.multiSelect) {\n this._mixinValidate(this.input);\n } else {\n // this._mixinValidate(sgdsInput.input);\n this._mixinValidate(sgdsInput);\n }\n if (!this._isTouched && this.value === \"\") return;\n\n this.invalid = !this._mixinReportValidity();\n }\n\n // Called each time the user types in the <sgds-input>, we set .value and show the menu\n private async _handleInputChange(e: CustomEvent) {\n this.emit(\"sgds-input\");\n const input = e.target as HTMLInputElement;\n this.displayValue = input.value;\n this.filteredMenuList = this.menuList.filter(item => this.filterFunction(this.displayValue, item));\n\n // reset menu list when displayValue\n if (this.displayValue === \"\" && !this.multiSelect) {\n this.selectedItems = [];\n this.value = this.selectedItems.join(\";\");\n }\n\n this.invalid = false;\n this.showMenu();\n\n this.displayValue = (e.target as HTMLInputElement).value;\n this._renderedMenu = this.filteredMenuList;\n\n if (this.displayValue === \"\") {\n this._renderedMenu = this.menuList;\n await this.updateComplete;\n }\n }\n\n /**\n * Called whenever an <sgds-combo-box-item> dispatches sgds-select\"\n */\n protected async _handleItemSelected(e: CustomEvent) {\n const itemEl = e.target as ComboBoxItem;\n const itemLabel = itemEl.textContent?.trim() ?? \"\";\n const itemValueAttr = itemEl.getAttribute(\"value\") ?? itemLabel;\n const foundItem = this.filteredMenuList.find(i => i.value.toString() === itemValueAttr) || {\n label: itemLabel,\n value: itemValueAttr\n };\n\n if (this.multiSelect) {\n if (!this.selectedItems.some(i => i.value === foundItem.value)) {\n this.selectedItems = [...this.selectedItems, foundItem];\n setTimeout(() => (this.displayValue = \"\"));\n }\n this.hideMenu();\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n } else {\n // Single-select\n this.selectedItems = [foundItem];\n this.value = foundItem.value.toString();\n this.displayValue = this.selectedItems[0].label;\n this.hideMenu();\n }\n }\n\n private _handleItemUnselect(e: CustomEvent) {\n const itemEl = e.target as ComboBoxItem;\n\n const itemLabel = itemEl.textContent?.trim() ?? \"\";\n const itemValueAttr = itemEl.getAttribute(\"value\") ?? itemLabel;\n const foundItem = this.filteredMenuList.find(i => i.value.toString() === itemValueAttr) || {\n label: itemLabel,\n value: itemValueAttr\n };\n\n this.selectedItems = this.selectedItems.filter(i => i.value !== foundItem.value);\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n }\n\n private async _handleBadgeDismissed(e: CustomEvent, item: SgdsComboBoxItemData) {\n e.preventDefault();\n this.selectedItems = this.selectedItems.filter(i => i.value !== item.value);\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n }\n private async _handleMultiSelectKeyDown(e: KeyboardEvent) {\n // Only do this in multi-select mode\n if (!this.multiSelect) {\n return;\n }\n\n if (e.key === \"Backspace\" && this.multiSelect) {\n if (this.displayValue.trim() === \"\" && this.selectedItems.length > 0) {\n this.selectedItems = this.selectedItems.slice(0, -1);\n this.value = this.selectedItems.map(i => i.value).join(\";\");\n }\n }\n }\n protected async _handleInputBlur(e: Event) {\n e.preventDefault();\n if (this.multiSelect) {\n const displayValueMatchedSelectedItems = this.selectedItems.filter(({ label }) => this.displayValue === label);\n if (displayValueMatchedSelectedItems.length <= 0) {\n this.displayValue = \"\";\n }\n } else {\n // Single select\n if (this.selectedItems.length > 0) {\n this.displayValue = this.selectedItems[0].label;\n } else {\n this.displayValue = \"\";\n }\n }\n }\n\n /** For form reset */\n protected async _mixinResetFormControl() {\n this.value = this.defaultValue;\n if (!this.multiSelect) {\n const initialItem = this.menuList.filter(({ value }) => value === this.value);\n if (initialItem.length <= 0) {\n this.displayValue = \"\";\n } else {\n this.displayValue = initialItem[0].label;\n }\n this._mixinResetValidity(await this._input);\n } else {\n const valueArray = this.value.split(\";\");\n const initialItem = this.menuList.filter(({ value }) => valueArray.includes(value));\n this.selectedItems = initialItem;\n this._mixinResetValidity(await this._multiSelectInput);\n }\n }\n\n protected _renderMenu() {\n const emptyMenu = html` <div class=\"empty-menu\">No options</div> `;\n const menu = this._renderedMenu.map(item => {\n let isActive = false;\n if (this.multiSelect) {\n const selectedItemValueArray = this.selectedItems.map(i => i.value);\n isActive = selectedItemValueArray.includes(item.value);\n } else {\n isActive = item.value === this.value;\n }\n return html`\n <sgds-combo-box-item\n ?active=${isActive}\n ?checkbox=${this.multiSelect}\n value=${item.value}\n @sgds-select=${this._handleItemSelected}\n @sgds-unselect=${this._handleItemUnselect}\n >\n ${item.label}\n </sgds-combo-box-item>\n `;\n });\n return this._renderedMenu.length === 0 ? emptyMenu : menu;\n }\n\n protected _renderInput() {\n const wantFeedbackStyle = this.hasFeedback;\n return html`\n <div\n ${ref(this.myDropdown)}\n class=\"form-control-group ${classMap({\n disabled: this.disabled,\n readonly: this.readonly,\n \"is-invalid\": this.invalid && wantFeedbackStyle\n })}\"\n @click=${this._handleClick}\n >\n <div class=\"combobox-input-container\">\n ${this.multiSelect\n ? html`\n ${this.selectedItems.map(\n item =>\n html`<sgds-badge\n outlined\n variant=\"neutral\"\n show\n dismissible\n @sgds-hide=${e => this._handleBadgeDismissed(e, item)}\n >${item.label}</sgds-badge\n >`\n )}\n `\n : nothing}\n <input\n class=\"form-control\"\n type=\"text\"\n id=${this._controlId}\n name=${ifDefined(this.name)}\n placeholder=${ifDefined(this.placeholder)}\n aria-invalid=${this.invalid ? \"true\" : \"false\"}\n ?autofocus=${this.autofocus}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?required=${this.required}\n .value=${this.displayValue}\n @input=${this._handleInputChange}\n @blur=${this._handleInputBlur}\n aria-describedby=${ifDefined(this.invalid && this.hasFeedback ? `${this._controlId}-invalid` : undefined)}\n aria-labelledby=\"${this._labelId} ${this._controlId}Help ${this.invalid && this.hasFeedback\n ? `${this._controlId}-invalid`\n : \"\"}\"\n />\n </div>\n <sgds-icon name=\"chevron-down\" size=\"md\"></sgds-icon>\n </div>\n `;\n }\n render() {\n return html`\n <div class=\"combobox\" @keydown=${this._handleMultiSelectKeyDown}>\n ${this._renderLabel()}\n <!-- The input -->\n ${this._renderInput()} ${this._renderFeedback()}\n <ul id=${this.dropdownMenuId} class=\"dropdown-menu\" part=\"menu\" tabindex=\"-1\">\n ${this._renderMenu()}\n </ul>\n </div>\n <!-- Required an input element for constraint validation -->\n ${this.multiSelect\n ? html`<input\n .value=${live(this.value)}\n id=\"multi-select-input-tracker\"\n class=\"visually-hidden\"\n ?required=${this.required}\n />`\n : nothing}\n `;\n }\n}\n\nexport default SgdsComboBox;\n"],"names":["comboBoxStyle"],"mappings":";;;;;;;;;;;;;;;AAkBA;;;;;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B,YAAA,CAAA;AACL,cAAE,OAAO,CAAA;KACZ,CAAC;KACH;;AAnSM,YAAM,CAAA,MAAA,GAAG,CAAC,GAAG,aAAa,CAAC,MAAM,EAAEA,QAAa,CAA1C,CAA4C;AAEzD;AACO,YAAA,CAAA,YAAY,GAAG;AACpB,IAAA,qBAAqB,EAAE,YAAY;AACnC,IAAA,WAAW,EAAE,QAAQ;AACrB,IAAA,YAAY,EAAE,SAAS;AACxB,CAJkB,CAIjB;AAG0C,UAAA,CAAA;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAqB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,aAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAIhE,UAAA,CAAA;AADC,IAAA,QAAQ,EAAE;AAGT,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAIM,UAAA,CAAA;AADP,IAAA,KAAK,EAAE;AAC2C,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,eAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAEK,UAAA,CAAA;IAAvD,UAAU,CAAC,kCAAkC,CAAC;AAAsD,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,mBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAiC/F,UAAA,CAAA;IADL,KAAK,CAAC,OAAO,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAiB9C,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,oBAAA,EAAA,IAAA,CAAA;;;;"}
@@ -22,6 +22,7 @@ var sgdsIconButton = require('../IconButton/sgds-icon-button.cjs.js');
22
22
  var validatorMixin = require('../../utils/validatorMixin.cjs.js');
23
23
  var ifDefined_js = require('lit/directives/if-defined.js');
24
24
  var classMap_js = require('lit/directives/class-map.js');
25
+ var defaultvalue = require('../../utils/defaultvalue.cjs.js');
25
26
 
26
27
  /**
27
28
  * @summary The `DatePicker` Component is built using `Dropdown`, `Input` and `Button` components. By default, the Calendar points to today's date and input has no value. Users can either pick dates from the calendar or type dates through the input
@@ -39,7 +40,17 @@ class SgdsDatepicker extends validatorMixin.SgdsFormValidatorMixin(dropdownEleme
39
40
  this.required = false;
40
41
  /** When true, adds disabled attribute to input and button element */
41
42
  this.disabled = false;
42
- /** The initial value of DatePicker on first load for single & range mode as array of string. eg.'["22/12/2023"]' for single & '["22/12/2023","25/12/2023"]' for range respectively */
43
+ /** Sets the initial value of the datepicker. Replaces deprecated `initialValue`.
44
+ * Pass in dates in this format `dd/mm/yyyy` for single mode and `dd/mm/yyyy - dd/mm/yyyy` for range mode
45
+ * For example, `value="22/12/2023"` for single mode or `value="22/12/2023 - 25/12/2023"` for range mode
46
+ */
47
+ this.value = "";
48
+ /**
49
+ * @deprecated since v3.1.1 in favour of `value`.
50
+ * The initial value of DatePicker on first load for single &
51
+ * range mode as array of string. eg.'["22/12/2023"]' for single &
52
+ * '["22/12/2023","25/12/2023"]' for range respectively
53
+ * */
43
54
  this.initialValue = [];
44
55
  this.dateFormat = "DD/MM/YYYY";
45
56
  /** ISO date string to set the lowest allowable date value. e.g. "2016-05-19T12:00:00.000Z" */
@@ -58,8 +69,8 @@ class SgdsDatepicker extends validatorMixin.SgdsFormValidatorMixin(dropdownEleme
58
69
  this.noFlip = false;
59
70
  /** The drop position of menu relative to the toggle button */
60
71
  this.drop = "down";
61
- /**@internal */
62
- this.value = "";
72
+ /**Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
73
+ this.defaultValue = "";
63
74
  /**@internal */
64
75
  this.invalid = false;
65
76
  this.view = "days";
@@ -145,6 +156,7 @@ class SgdsDatepicker extends validatorMixin.SgdsFormValidatorMixin(dropdownEleme
145
156
  this.addEventListener("sgds-hide", this._handleCloseMenu);
146
157
  this.addEventListener("sgds-show", this._handleOpenMenu);
147
158
  this.addEventListener("blur", this._mixinCheckValidity);
159
+ this.initialValue = this.value ? this.value.split(" - ").map(v => v.trim()) : this.initialValue;
148
160
  this.initialDisplayDate = this.displayDate || new Date();
149
161
  if (this.initialValue && this.initialValue.length > 0) {
150
162
  // Validate initialValue against the dateFormat regex
@@ -271,19 +283,22 @@ class SgdsDatepicker extends validatorMixin.SgdsFormValidatorMixin(dropdownEleme
271
283
  this._manageInternalsBadInput();
272
284
  }
273
285
  async _handleEmptyInput() {
274
- this._manageEmptyInput();
286
+ if (this.required) {
287
+ this._manageEmptyInput();
288
+ }
289
+ return;
275
290
  }
276
- async _resetDatepicker() {
291
+ async _resetDatepicker(resetValue = "") {
277
292
  this.displayDate = this.initialDisplayDate;
278
293
  this.selectedDateRange = [];
279
- this.value = "";
294
+ this.value = resetValue;
280
295
  this.view = "days";
281
296
  const input = await this.datepickerInputAsync;
282
297
  input.setInvalid(false);
283
298
  input.destroyInputMask();
284
299
  await input.applyInputMask();
285
300
  this._mixinResetValidity(input);
286
- if (this.isValueEmpty() && this.required) {
301
+ if (this.isValueEmpty()) {
287
302
  this._handleEmptyInput();
288
303
  }
289
304
  }
@@ -317,7 +332,7 @@ class SgdsDatepicker extends validatorMixin.SgdsFormValidatorMixin(dropdownEleme
317
332
  * Handles the form "reset" event
318
333
  */
319
334
  async _mixinResetFormControl() {
320
- this._resetDatepicker();
335
+ this._resetDatepicker(this.defaultValue);
321
336
  }
322
337
  async _handleInputMaskChange(e) {
323
338
  this.value = e.detail;
@@ -411,6 +426,9 @@ tslib.__decorate([
411
426
  tslib.__decorate([
412
427
  decorators_js.property({ type: Boolean, reflect: true })
413
428
  ], SgdsDatepicker.prototype, "disabled", void 0);
429
+ tslib.__decorate([
430
+ decorators_js.property({ type: String, reflect: true })
431
+ ], SgdsDatepicker.prototype, "value", void 0);
414
432
  tslib.__decorate([
415
433
  decorators_js.property({ type: Array, reflect: true })
416
434
  ], SgdsDatepicker.prototype, "initialValue", void 0);
@@ -445,8 +463,8 @@ tslib.__decorate([
445
463
  decorators_js.property({ attribute: false })
446
464
  ], SgdsDatepicker.prototype, "displayDate", void 0);
447
465
  tslib.__decorate([
448
- decorators_js.state()
449
- ], SgdsDatepicker.prototype, "value", void 0);
466
+ defaultvalue.defaultValue()
467
+ ], SgdsDatepicker.prototype, "defaultValue", void 0);
450
468
  tslib.__decorate([
451
469
  decorators_js.state()
452
470
  ], SgdsDatepicker.prototype, "invalid", void 0);
@@ -472,7 +490,7 @@ tslib.__decorate([
472
490
  decorators_js.query("sgds-datepicker-input")
473
491
  ], SgdsDatepicker.prototype, "datepickerInput", void 0);
474
492
  tslib.__decorate([
475
- watch.watch("value")
493
+ watch.watch("value", { waitUntilFirstUpdate: true })
476
494
  ], SgdsDatepicker.prototype, "_handleValueChange", null);
477
495
 
478
496
  exports.SgdsDatepicker = SgdsDatepicker;
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-datepicker.cjs.js","sources":["../../../../src/components/Datepicker/sgds-datepicker.ts"],"sourcesContent":["import { format, parse } from \"date-fns\";\nimport { html } from \"lit\";\nimport { property, query, queryAsync, state } from \"lit/decorators.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { ref } from \"lit/directives/ref.js\";\nimport { DropdownElement } from \"../../base/dropdown-element\";\nimport { type SgdsFormControl } from \"../../utils/formSubmitController\";\nimport { DATE_PATTERNS, setTimeToNoon } from \"../../utils/time\";\nimport { watch } from \"../../utils/watch\";\nimport { SgdsButton } from \"../Button/sgds-button\";\nimport dropdownMenuStyle from \"../Dropdown/dropdown-menu.css\";\nimport { DatepickerCalendar } from \"./datepicker-calendar\";\nimport { DatepickerHeader } from \"./datepicker-header\";\nimport DatepickerInput from \"./datepicker-input\";\nimport datepickerStyle from \"./datepicker.css\";\nimport { ViewEnum } from \"./types\";\nimport SgdsIconButton from \"../IconButton/sgds-icon-button\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\n\nexport type DateFormat = \"MM/DD/YYYY\" | \"DD/MM/YYYY\" | \"YYYY/MM/DD\";\n\n/**\n * @summary The `DatePicker` Component is built using `Dropdown`, `Input` and `Button` components. By default, the Calendar points to today's date and input has no value. Users can either pick dates from the calendar or type dates through the input\n *\n * @event sgds-change-date - Emitted when the state of datepicker's input changes during first load, close button reset click & date click. Date values can be accessed via event.target.value\n *\n * @description displayDate sets the month, year views of the calendar while focusedDate follows the focus which also directly changes\n * displayDate on certain occasions. Example, when keyboard moves up to the next month, it updates displayDate which then affect the current\n * date view of the calendar\n */\nexport class SgdsDatepicker extends SgdsFormValidatorMixin(DropdownElement) implements SgdsFormControl {\n static styles = [...DropdownElement.styles, dropdownMenuStyle, datepickerStyle];\n /**@internal */\n static dependencies = {\n \"sgds-datepicker-input\": DatepickerInput,\n \"sgds-datepicker-calendar\": DatepickerCalendar,\n \"sgds-datepicker-header\": DatepickerHeader,\n \"sgds-button\": SgdsButton,\n \"sgds-icon-button\": SgdsIconButton\n };\n\n /** When true, adds required attribute to input element */\n @property({ type: Boolean, reflect: true }) required = false;\n /**The datepicker input's name attribute */\n @property({ reflect: true }) name: string;\n /** When true, adds disabled attribute to input and button element */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** The initial value of DatePicker on first load for single & range mode as array of string. eg.'[\"22/12/2023\"]' for single & '[\"22/12/2023\",\"25/12/2023\"]' for range respectively */\n @property({ type: Array, reflect: true }) initialValue: string[] = [];\n\n private dateFormat = \"DD/MM/YYYY\";\n\n /** ISO date string to set the lowest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) minDate = \"\";\n\n /** ISO date string to set the highest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) maxDate = \"\";\n\n /** Changes DatePicker to single date selection or range date selection */\n @property({ type: String, reflect: true }) mode: \"single\" | \"range\" = \"single\";\n\n /**Feedback text for error state when date input is invalid */\n @property({ type: String, reflect: true }) invalidFeedback: string;\n\n /** Allows invalidFeedback and invalid styles to be visible with the input */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /** The datepicker input's label */\n @property({ reflect: true }) label = \"\";\n\n /** The datepicker input's hint text below the label */\n @property({ reflect: true }) hintText = \"\";\n\n /** Controls auto-flipping of menu */\n @property({ type: Boolean, reflect: true, state: false })\n noFlip = false;\n\n /** The drop position of menu relative to the toggle button */\n @property({ type: String, reflect: true, state: false })\n drop: \"up\" | \"down\" = \"down\";\n\n /** Provides the date context for Calendar to present the appropriate view. Defaults to today's date */\n @property({ attribute: false }) displayDate: Date;\n /**@internal */\n @state() value = \"\";\n /**@internal */\n @state() invalid = false;\n\n @state()\n private view: ViewEnum = \"days\";\n\n @state() private selectedDateRange: Date[] = [];\n\n @state() private focusedDate: Date;\n\n @state() private focusedTabIndex = 3;\n\n private isValueEmpty() {\n return this.value === \"\" || this.value === \"DD/MM/YYYY\" || this.value === \"DD/MM/YYYY - DD/MM/YYYY\";\n }\n\n private initialDisplayDate: Date = new Date();\n\n @queryAsync(\"sgds-datepicker-calendar\")\n private calendar: Promise<DatepickerCalendar>;\n\n @queryAsync(\"sgds-datepicker-input\")\n private datepickerInputAsync: Promise<DatepickerInput>;\n\n @query(\"sgds-datepicker-input\")\n private datepickerInput: DatepickerInput;\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage() {\n return this._mixinGetValidationMessage();\n }\n\n async connectedCallback() {\n super.connectedCallback();\n this.modifierOpt = [\n {\n name: \"offset\",\n options: {\n offset: [0, 8]\n }\n }\n ];\n this.addEventListener(\"sgds-view\", this._handleViewChanged);\n this.addEventListener(\"sgds-change-calendar\", this._handleDateChanged);\n this.addEventListener(\"sgds-update-focus\", this._handleFocusDateChanged);\n this.addEventListener(\"sgds-selectmonth\", this._handleSelectMonth);\n this.addEventListener(\"sgds-selectyear\", this._handleSelectYear);\n this.addEventListener(\"sgds-selectdates\", this._handleSelectDatesAndClose);\n this.addEventListener(\"sgds-selectdates-input\", this._handleSelectDatesInput);\n this.addEventListener(\"sgds-empty-input\", this._handleEmptyInput);\n this.addEventListener(\"keydown\", this._handleTab);\n this.addEventListener(\"sgds-hide\", this._handleCloseMenu);\n this.addEventListener(\"sgds-show\", this._handleOpenMenu);\n this.addEventListener(\"blur\", this._mixinCheckValidity);\n this.initialDisplayDate = this.displayDate || new Date();\n if (this.initialValue && this.initialValue.length > 0) {\n // Validate initialValue against the dateFormat regex\n const dateFormatRegex = new RegExp(this._getDateFormatRegex());\n // const startDateString = this.initialValue[0];\n const invalidDates = this.initialValue.filter(v => !dateFormatRegex.test(v));\n if (invalidDates.length > 0) {\n return console.error(\"Invalid date format in initialValue:\", invalidDates);\n } else {\n const initialSelectedDates = this.initialValue.map(v =>\n setTimeToNoon(parse(v, DATE_PATTERNS[this.dateFormat].fnsPattern, new Date()))\n );\n this._handleSelectDates(initialSelectedDates);\n }\n } else {\n this.displayDate = this.initialDisplayDate;\n }\n }\n\n async firstUpdated() {\n super.firstUpdated();\n if (this.menuIsOpen) {\n const input = await this.datepickerInputAsync;\n this.showMenu();\n const cal = await this.calendar;\n cal.focusOnCalendar(input);\n }\n }\n\n /** @internal */\n private _getDateFormatRegex(): string {\n // validate date strings and adhere to the specified date format\n return (\n this.dateFormat\n // Replace any special characters with their escaped version using \"\\\\$&\"\n .replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n // Replace 'MM' with '\\\\d{2}', which matches two digits representing the month (e.g., 01, 12)\n .replace(\"MM\", \"\\\\d{2}\")\n // Replace 'DD' with '\\\\d{2}', which matches two digits representing the day (e.g., 01, 31)\n .replace(\"DD\", \"\\\\d{2}\")\n // Replace 'YYYY' with '\\\\d{4}', which matches four digits representing the year (e.g., 2021)\n .replace(\"YYYY\", \"\\\\d{4}\")\n // Replace '/' with '\\\\/', which matches the forward slash character\n .replace(\"/\", \"\\\\/\")\n );\n }\n private _handleTab(event: KeyboardEvent) {\n if (!this.menuIsOpen) {\n return;\n }\n const tabIndexArray = Array(4);\n if (event.shiftKey && event.key === \"Tab\") {\n event.preventDefault();\n this.focusedTabIndex = (this.focusedTabIndex - 1 + tabIndexArray.length) % tabIndexArray.length;\n } else if (event.key === \"Tab\") {\n event.preventDefault();\n this.focusedTabIndex = (this.focusedTabIndex + 1 + tabIndexArray.length) % tabIndexArray.length;\n }\n }\n\n @watch(\"value\")\n _handleValueChange() {\n this.emit(\"sgds-change-date\");\n }\n\n private async _handleCloseMenu() {\n //return focus to input when menu closes\n const input = await this.datepickerInputAsync;\n input.focus();\n\n if (this.selectedDateRange.length === 0) {\n this.displayDate = this.initialDisplayDate;\n } else {\n const selectedDatesLength = this.selectedDateRange.length;\n this.displayDate = this.selectedDateRange[selectedDatesLength - 1];\n const calendar = await this.calendar;\n calendar._updateFocusedDate();\n }\n }\n private async _handleOpenMenu() {\n const cal = await this.calendar;\n const input = await this.datepickerInputAsync;\n cal.focusOnCalendar(input);\n }\n\n private _makeInputValueString = (startDate: Date, endDate: Date, dateFormat: string) => {\n if (!startDate && !endDate) return this.value;\n const formatDate = (date: Date) => format(date, DATE_PATTERNS[dateFormat].fnsPattern);\n switch (this.mode) {\n case \"single\": {\n if (startDate) {\n this.value = formatDate(startDate);\n }\n break;\n }\n case \"range\": {\n if (startDate && endDate) {\n this.value = `${formatDate(startDate)} - ${formatDate(endDate)}`;\n }\n if (startDate && !endDate) {\n this.value = `${formatDate(startDate)} - ${this.dateFormat}`;\n }\n break;\n }\n }\n return this.value;\n };\n private _handleSelectDatesInput(event: CustomEvent<Date[]>) {\n this._handleSelectDates(event.detail);\n }\n private async _handleSelectDates(newSelectedDates: Date[]) {\n newSelectedDates.sort((a: Date, b: Date) => a.getTime() - b.getTime());\n this.displayDate = newSelectedDates[0];\n this.focusedDate = newSelectedDates[0];\n this.selectedDateRange = newSelectedDates;\n // Get the formattedDate value for the selected dates\n const formattedDate = this._makeInputValueString(\n this.selectedDateRange[0],\n this.selectedDateRange[1],\n this.dateFormat\n );\n\n // Set formattedDate value as the new value for sgds-input\n this.value = formattedDate;\n const input = await this.datepickerInputAsync;\n input.updateMaskValue();\n this._manageInternalsValid();\n }\n\n private async _handleSelectDatesAndClose(event: CustomEvent<Date[]>) {\n await this._handleSelectDates(event.detail);\n\n if (this.mode === \"range\" && this.selectedDateRange.length === 2) {\n this.hideMenu();\n } else if (this.mode === \"single\" && this.selectedDateRange.length === 1) {\n this.hideMenu();\n }\n }\n\n /** update latest view state from datepicker-header */\n private _handleViewChanged(event: CustomEvent<string>) {\n this.view = event.detail as ViewEnum;\n }\n\n private _handleDateChanged(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n private _handleFocusDateChanged(event: CustomEvent<Date>) {\n this.focusedDate = event.detail;\n }\n\n private _handleSelectMonth(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n\n private _handleSelectYear(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n private async _handleInvalidInput() {\n this.selectedDateRange = [];\n this.displayDate = this.initialDisplayDate;\n this.invalid = true;\n this._manageInternalsBadInput();\n }\n private async _handleEmptyInput() {\n this._manageEmptyInput();\n }\n private async _resetDatepicker() {\n this.displayDate = this.initialDisplayDate;\n this.selectedDateRange = [];\n this.value = \"\";\n this.view = \"days\";\n const input = await this.datepickerInputAsync;\n input.setInvalid(false);\n input.destroyInputMask();\n await input.applyInputMask();\n\n this._mixinResetValidity(input);\n if (this.isValueEmpty() && this.required) {\n this._handleEmptyInput();\n }\n }\n\n private _manageInternalsBadInput() {\n this._mixinSetValidity(\n {\n badInput: true\n },\n \"Invalid date input\",\n this.datepickerInput\n );\n }\n /**\n * Even though element internals handles the required constraint validation. This custom one is still needed as\n * datepicker input has a special case where the default input mask \"DD/MM/YYYY\" means an empty input.\n * However, the required constraint validation sees \"DD/MM/YYYY\" as a non-empty input.\n */\n private _manageEmptyInput() {\n this._mixinSetValidity(\n {\n valueMissing: true\n },\n \"Please fill in this field\",\n this.datepickerInput\n );\n }\n\n /**\n * Called when a valid date is entered via input or selected by calendar\n * 1. sets validity state to valid\n * 2. updates invalid prop\n * 3. sets the form value of datepicker\n */\n private _manageInternalsValid() {\n this._mixinSetValidity({});\n this.invalid = this.datepickerInput.invalid = false;\n this._mixinSetFormValue();\n }\n\n /**\n * Handles the form \"reset\" event\n */\n private async _mixinResetFormControl() {\n this._resetDatepicker();\n }\n private async _handleInputMaskChange(e: CustomEvent) {\n this.value = e.detail;\n\n if (this.isValueEmpty()) {\n this._resetDatepicker();\n }\n }\n\n private _dialogAriaLabels = {\n days: \"Choose date\",\n months: \"Choose month\",\n years: \"Choose year\"\n };\n\n render() {\n return html`\n <div class=\"datepicker-container\">\n <sgds-datepicker-input\n .value=${live(this.value)}\n ?required=${this.required}\n ?disabled=${this.disabled}\n placeholder=${this.mode === \"single\" ? \"DD/MM/YYYY\" : \"DD/MM/YYYY - DD/MM/YYYY\"}\n mode=${this.mode}\n invalidFeedback=${ifDefined(this.invalidFeedback ? this.invalidFeedback : this._mixinGetValidationMessage())}\n @sgds-mask-input-change=${this._handleInputMaskChange}\n @sgds-invalid-input=${this._handleInvalidInput}\n minDate=${this.minDate}\n maxDate=${this.maxDate}\n label=${this.label}\n hintText=${this.hintText}\n name=${this.name}\n ?invalid=${this.invalid}\n hasFeedback=${ifDefined(this.hasFeedback ? \"both\" : undefined)}\n >\n </sgds-datepicker-input>\n <sgds-icon-button\n ${ref(this.myDropdown)}\n role=\"button\"\n class=${classMap({\n \"calendar-btn\": true,\n \"with-hint-text\": this.hintText || this.invalid,\n \"with-label\": this.label\n })}\n aria-expanded=\"${this.menuIsOpen}\"\n aria-haspopup=\"dialog\"\n aria-controls=${this.dropdownMenuId}\n @click=${() => this.toggleMenu()}\n ariaLabel=${this.menuIsOpen ? \"Close Calendar\" : \"Open Calendar\"}\n ?disabled=${this.disabled}\n variant=\"outline\"\n name=\"calendar\"\n >\n </sgds-icon-button>\n <ul\n id=${this.dropdownMenuId}\n class=\"sgds datepicker dropdown-menu\"\n role=\"dialog\"\n aria-label=${this._dialogAriaLabels[this.view]}\n @click=${(event: MouseEvent) => event.stopPropagation()}\n >\n <sgds-datepicker-header\n .view=${this.view}\n .displayDate=${this.displayDate}\n .focusedDate=${this.focusedDate}\n .selectedDate=${this.selectedDateRange}\n .focusedTabIndex=${this.focusedTabIndex}\n ></sgds-datepicker-header>\n <sgds-datepicker-calendar\n .show=${this.menuIsOpen}\n .view=${this.view}\n .displayDate=${this.displayDate}\n .mode=${this.mode}\n minDate=${this.minDate}\n maxDate=${this.maxDate}\n .selectedDate=${this.selectedDateRange}\n .focusedTabIndex=${this.focusedTabIndex}\n ></sgds-datepicker-calendar>\n </ul>\n </div>\n `;\n }\n}\n\nexport default SgdsDatepicker;\n"],"names":["SgdsFormValidatorMixin","DropdownElement","format","DATE_PATTERNS","setTimeToNoon","parse","html","live","ifDefined","ref","classMap","dropdownMenuStyle","datepickerStyle","DatepickerInput","DatepickerCalendar","DatepickerHeader","SgdsButton","SgdsIconButton","__decorate","property","state","queryAsync","query","watch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAuBA;;;;;;;;AAQG;MACU,cAAe,SAAQA,qCAAsB,CAACC,+BAAe,CAAC,CAAA;AAA3E,IAAA,WAAA,GAAA;;;QAY8C,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAIjB,IAAQ,CAAA,QAAA,GAAG,KAAK,CAAC;;QAGnB,IAAY,CAAA,YAAA,GAAa,EAAE,CAAC;QAE9D,IAAU,CAAA,UAAA,GAAG,YAAY,CAAC;;QAGN,IAAO,CAAA,OAAA,GAAG,EAAE,CAAC;;QAGb,I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AA;IADPI,mBAAK,CAAC,uBAAuB,CAAC;AACU,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AA+GzCJ,gBAAA,CAAA;IADCK,WAAK,CAAC,OAAO,CAAC;AAGd,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,oBAAA,EAAA,IAAA,CAAA;;;;;"}
1
+ {"version":3,"file":"sgds-datepicker.cjs.js","sources":["../../../../src/components/Datepicker/sgds-datepicker.ts"],"sourcesContent":["import { format, parse } from \"date-fns\";\nimport { html } from \"lit\";\nimport { property, query, queryAsync, state } from \"lit/decorators.js\";\nimport { live } from \"lit/directives/live.js\";\nimport { ref } from \"lit/directives/ref.js\";\nimport { DropdownElement } from \"../../base/dropdown-element\";\nimport { type SgdsFormControl } from \"../../utils/formSubmitController\";\nimport { DATE_PATTERNS, setTimeToNoon } from \"../../utils/time\";\nimport { watch } from \"../../utils/watch\";\nimport { SgdsButton } from \"../Button/sgds-button\";\nimport dropdownMenuStyle from \"../Dropdown/dropdown-menu.css\";\nimport { DatepickerCalendar } from \"./datepicker-calendar\";\nimport { DatepickerHeader } from \"./datepicker-header\";\nimport DatepickerInput from \"./datepicker-input\";\nimport datepickerStyle from \"./datepicker.css\";\nimport { ViewEnum } from \"./types\";\nimport SgdsIconButton from \"../IconButton/sgds-icon-button\";\nimport { SgdsFormValidatorMixin } from \"../../utils/validatorMixin\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { defaultValue } from \"../../utils/defaultvalue\";\n\nexport type DateFormat = \"MM/DD/YYYY\" | \"DD/MM/YYYY\" | \"YYYY/MM/DD\";\n\n/**\n * @summary The `DatePicker` Component is built using `Dropdown`, `Input` and `Button` components. By default, the Calendar points to today's date and input has no value. Users can either pick dates from the calendar or type dates through the input\n *\n * @event sgds-change-date - Emitted when the state of datepicker's input changes during first load, close button reset click & date click. Date values can be accessed via event.target.value\n *\n * @description displayDate sets the month, year views of the calendar while focusedDate follows the focus which also directly changes\n * displayDate on certain occasions. Example, when keyboard moves up to the next month, it updates displayDate which then affect the current\n * date view of the calendar\n */\nexport class SgdsDatepicker extends SgdsFormValidatorMixin(DropdownElement) implements SgdsFormControl {\n static styles = [...DropdownElement.styles, dropdownMenuStyle, datepickerStyle];\n /**@internal */\n static dependencies = {\n \"sgds-datepicker-input\": DatepickerInput,\n \"sgds-datepicker-calendar\": DatepickerCalendar,\n \"sgds-datepicker-header\": DatepickerHeader,\n \"sgds-button\": SgdsButton,\n \"sgds-icon-button\": SgdsIconButton\n };\n\n /** When true, adds required attribute to input element */\n @property({ type: Boolean, reflect: true }) required = false;\n /**The datepicker input's name attribute */\n @property({ reflect: true }) name: string;\n /** When true, adds disabled attribute to input and button element */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Sets the initial value of the datepicker. Replaces deprecated `initialValue`.\n * Pass in dates in this format `dd/mm/yyyy` for single mode and `dd/mm/yyyy - dd/mm/yyyy` for range mode\n * For example, `value=\"22/12/2023\"` for single mode or `value=\"22/12/2023 - 25/12/2023\"` for range mode\n */\n @property({ type: String, reflect: true }) value = \"\";\n\n /**\n * @deprecated since v3.1.1 in favour of `value`.\n * The initial value of DatePicker on first load for single &\n * range mode as array of string. eg.'[\"22/12/2023\"]' for single &\n * '[\"22/12/2023\",\"25/12/2023\"]' for range respectively\n * */\n @property({ type: Array, reflect: true }) initialValue: string[] = [];\n\n private dateFormat = \"DD/MM/YYYY\";\n\n /** ISO date string to set the lowest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) minDate = \"\";\n\n /** ISO date string to set the highest allowable date value. e.g. \"2016-05-19T12:00:00.000Z\" */\n @property({ type: String }) maxDate = \"\";\n\n /** Changes DatePicker to single date selection or range date selection */\n @property({ type: String, reflect: true }) mode: \"single\" | \"range\" = \"single\";\n\n /**Feedback text for error state when date input is invalid */\n @property({ type: String, reflect: true }) invalidFeedback: string;\n\n /** Allows invalidFeedback and invalid styles to be visible with the input */\n @property({ type: Boolean, reflect: true }) hasFeedback = false;\n\n /** The datepicker input's label */\n @property({ reflect: true }) label = \"\";\n\n /** The datepicker input's hint text below the label */\n @property({ reflect: true }) hintText = \"\";\n\n /** Controls auto-flipping of menu */\n @property({ type: Boolean, reflect: true, state: false })\n noFlip = false;\n\n /** The drop position of menu relative to the toggle button */\n @property({ type: String, reflect: true, state: false })\n drop: \"up\" | \"down\" = \"down\";\n\n /** Provides the date context for Calendar to present the appropriate view. Defaults to today's date */\n @property({ attribute: false }) displayDate: Date;\n\n /**Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */\n @defaultValue()\n defaultValue = \"\";\n\n /**@internal */\n @state() invalid = false;\n\n @state()\n private view: ViewEnum = \"days\";\n\n @state() private selectedDateRange: Date[] = [];\n\n @state() private focusedDate: Date;\n\n @state() private focusedTabIndex = 3;\n\n private isValueEmpty() {\n return this.value === \"\" || this.value === \"DD/MM/YYYY\" || this.value === \"DD/MM/YYYY - DD/MM/YYYY\";\n }\n\n private initialDisplayDate: Date = new Date();\n\n @queryAsync(\"sgds-datepicker-calendar\")\n private calendar: Promise<DatepickerCalendar>;\n\n @queryAsync(\"sgds-datepicker-input\")\n private datepickerInputAsync: Promise<DatepickerInput>;\n\n @query(\"sgds-datepicker-input\")\n private datepickerInput: DatepickerInput;\n /**\n * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state\n * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput\n */\n public reportValidity(): boolean {\n return this._mixinReportValidity();\n }\n /**\n * Checks for validity without any native error popup message\n */\n public checkValidity(): boolean {\n return this._mixinCheckValidity();\n }\n\n /**\n * Returns the ValidityState object\n */\n public get validity(): ValidityState {\n return this._mixinGetValidity();\n }\n /**\n * Returns the validation message based on the ValidityState\n */\n public get validationMessage() {\n return this._mixinGetValidationMessage();\n }\n\n async connectedCallback() {\n super.connectedCallback();\n this.modifierOpt = [\n {\n name: \"offset\",\n options: {\n offset: [0, 8]\n }\n }\n ];\n this.addEventListener(\"sgds-view\", this._handleViewChanged);\n this.addEventListener(\"sgds-change-calendar\", this._handleDateChanged);\n this.addEventListener(\"sgds-update-focus\", this._handleFocusDateChanged);\n this.addEventListener(\"sgds-selectmonth\", this._handleSelectMonth);\n this.addEventListener(\"sgds-selectyear\", this._handleSelectYear);\n this.addEventListener(\"sgds-selectdates\", this._handleSelectDatesAndClose);\n this.addEventListener(\"sgds-selectdates-input\", this._handleSelectDatesInput);\n this.addEventListener(\"sgds-empty-input\", this._handleEmptyInput);\n this.addEventListener(\"keydown\", this._handleTab);\n this.addEventListener(\"sgds-hide\", this._handleCloseMenu);\n this.addEventListener(\"sgds-show\", this._handleOpenMenu);\n this.addEventListener(\"blur\", this._mixinCheckValidity);\n\n this.initialValue = this.value ? this.value.split(\" - \").map(v => v.trim()) : this.initialValue;\n this.initialDisplayDate = this.displayDate || new Date();\n if (this.initialValue && this.initialValue.length > 0) {\n // Validate initialValue against the dateFormat regex\n const dateFormatRegex = new RegExp(this._getDateFormatRegex());\n // const startDateString = this.initialValue[0];\n const invalidDates = this.initialValue.filter(v => !dateFormatRegex.test(v));\n if (invalidDates.length > 0) {\n return console.error(\"Invalid date format in initialValue:\", invalidDates);\n } else {\n const initialSelectedDates = this.initialValue.map(v =>\n setTimeToNoon(parse(v, DATE_PATTERNS[this.dateFormat].fnsPattern, new Date()))\n );\n this._handleSelectDates(initialSelectedDates);\n }\n } else {\n this.displayDate = this.initialDisplayDate;\n }\n }\n\n async firstUpdated() {\n super.firstUpdated();\n if (this.menuIsOpen) {\n const input = await this.datepickerInputAsync;\n this.showMenu();\n const cal = await this.calendar;\n cal.focusOnCalendar(input);\n }\n }\n\n /** @internal */\n private _getDateFormatRegex(): string {\n // validate date strings and adhere to the specified date format\n return (\n this.dateFormat\n // Replace any special characters with their escaped version using \"\\\\$&\"\n .replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\")\n // Replace 'MM' with '\\\\d{2}', which matches two digits representing the month (e.g., 01, 12)\n .replace(\"MM\", \"\\\\d{2}\")\n // Replace 'DD' with '\\\\d{2}', which matches two digits representing the day (e.g., 01, 31)\n .replace(\"DD\", \"\\\\d{2}\")\n // Replace 'YYYY' with '\\\\d{4}', which matches four digits representing the year (e.g., 2021)\n .replace(\"YYYY\", \"\\\\d{4}\")\n // Replace '/' with '\\\\/', which matches the forward slash character\n .replace(\"/\", \"\\\\/\")\n );\n }\n private _handleTab(event: KeyboardEvent) {\n if (!this.menuIsOpen) {\n return;\n }\n const tabIndexArray = Array(4);\n if (event.shiftKey && event.key === \"Tab\") {\n event.preventDefault();\n this.focusedTabIndex = (this.focusedTabIndex - 1 + tabIndexArray.length) % tabIndexArray.length;\n } else if (event.key === \"Tab\") {\n event.preventDefault();\n this.focusedTabIndex = (this.focusedTabIndex + 1 + tabIndexArray.length) % tabIndexArray.length;\n }\n }\n\n @watch(\"value\", { waitUntilFirstUpdate: true })\n _handleValueChange() {\n this.emit(\"sgds-change-date\");\n }\n\n private async _handleCloseMenu() {\n //return focus to input when menu closes\n const input = await this.datepickerInputAsync;\n input.focus();\n\n if (this.selectedDateRange.length === 0) {\n this.displayDate = this.initialDisplayDate;\n } else {\n const selectedDatesLength = this.selectedDateRange.length;\n this.displayDate = this.selectedDateRange[selectedDatesLength - 1];\n const calendar = await this.calendar;\n calendar._updateFocusedDate();\n }\n }\n private async _handleOpenMenu() {\n const cal = await this.calendar;\n const input = await this.datepickerInputAsync;\n cal.focusOnCalendar(input);\n }\n\n private _makeInputValueString = (startDate: Date, endDate: Date, dateFormat: string) => {\n if (!startDate && !endDate) return this.value;\n const formatDate = (date: Date) => format(date, DATE_PATTERNS[dateFormat].fnsPattern);\n switch (this.mode) {\n case \"single\": {\n if (startDate) {\n this.value = formatDate(startDate);\n }\n break;\n }\n case \"range\": {\n if (startDate && endDate) {\n this.value = `${formatDate(startDate)} - ${formatDate(endDate)}`;\n }\n if (startDate && !endDate) {\n this.value = `${formatDate(startDate)} - ${this.dateFormat}`;\n }\n break;\n }\n }\n return this.value;\n };\n private _handleSelectDatesInput(event: CustomEvent<Date[]>) {\n this._handleSelectDates(event.detail);\n }\n private async _handleSelectDates(newSelectedDates: Date[]) {\n newSelectedDates.sort((a: Date, b: Date) => a.getTime() - b.getTime());\n this.displayDate = newSelectedDates[0];\n this.focusedDate = newSelectedDates[0];\n this.selectedDateRange = newSelectedDates;\n // Get the formattedDate value for the selected dates\n const formattedDate = this._makeInputValueString(\n this.selectedDateRange[0],\n this.selectedDateRange[1],\n this.dateFormat\n );\n\n // Set formattedDate value as the new value for sgds-input\n this.value = formattedDate;\n const input = await this.datepickerInputAsync;\n input.updateMaskValue();\n this._manageInternalsValid();\n }\n\n private async _handleSelectDatesAndClose(event: CustomEvent<Date[]>) {\n await this._handleSelectDates(event.detail);\n\n if (this.mode === \"range\" && this.selectedDateRange.length === 2) {\n this.hideMenu();\n } else if (this.mode === \"single\" && this.selectedDateRange.length === 1) {\n this.hideMenu();\n }\n }\n\n /** update latest view state from datepicker-header */\n private _handleViewChanged(event: CustomEvent<string>) {\n this.view = event.detail as ViewEnum;\n }\n\n private _handleDateChanged(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n private _handleFocusDateChanged(event: CustomEvent<Date>) {\n this.focusedDate = event.detail;\n }\n\n private _handleSelectMonth(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n\n private _handleSelectYear(event: CustomEvent<Date>) {\n this.displayDate = event.detail;\n }\n private async _handleInvalidInput() {\n this.selectedDateRange = [];\n this.displayDate = this.initialDisplayDate;\n this.invalid = true;\n this._manageInternalsBadInput();\n }\n private async _handleEmptyInput() {\n if (this.required) {\n this._manageEmptyInput();\n }\n return;\n }\n private async _resetDatepicker(resetValue = \"\") {\n this.displayDate = this.initialDisplayDate;\n this.selectedDateRange = [];\n this.value = resetValue;\n this.view = \"days\";\n const input = await this.datepickerInputAsync;\n input.setInvalid(false);\n input.destroyInputMask();\n await input.applyInputMask();\n\n this._mixinResetValidity(input);\n if (this.isValueEmpty()) {\n this._handleEmptyInput();\n }\n }\n\n private _manageInternalsBadInput() {\n this._mixinSetValidity(\n {\n badInput: true\n },\n \"Invalid date input\",\n this.datepickerInput\n );\n }\n /**\n * Even though element internals handles the required constraint validation. This custom one is still needed as\n * datepicker input has a special case where the default input mask \"DD/MM/YYYY\" means an empty input.\n * However, the required constraint validation sees \"DD/MM/YYYY\" as a non-empty input.\n */\n private _manageEmptyInput() {\n this._mixinSetValidity(\n {\n valueMissing: true\n },\n \"Please fill in this field\",\n this.datepickerInput\n );\n }\n\n /**\n * Called when a valid date is entered via input or selected by calendar\n * 1. sets validity state to valid\n * 2. updates invalid prop\n * 3. sets the form value of datepicker\n */\n private _manageInternalsValid() {\n this._mixinSetValidity({});\n this.invalid = this.datepickerInput.invalid = false;\n this._mixinSetFormValue();\n }\n\n /**\n * Handles the form \"reset\" event\n */\n private async _mixinResetFormControl() {\n this._resetDatepicker(this.defaultValue);\n }\n private async _handleInputMaskChange(e: CustomEvent) {\n this.value = e.detail;\n\n if (this.isValueEmpty()) {\n this._resetDatepicker();\n }\n }\n\n private _dialogAriaLabels = {\n days: \"Choose date\",\n months: \"Choose month\",\n years: \"Choose year\"\n };\n\n render() {\n return html`\n <div class=\"datepicker-container\">\n <sgds-datepicker-input\n .value=${live(this.value)}\n ?required=${this.required}\n ?disabled=${this.disabled}\n placeholder=${this.mode === \"single\" ? \"DD/MM/YYYY\" : \"DD/MM/YYYY - DD/MM/YYYY\"}\n mode=${this.mode}\n invalidFeedback=${ifDefined(this.invalidFeedback ? this.invalidFeedback : this._mixinGetValidationMessage())}\n @sgds-mask-input-change=${this._handleInputMaskChange}\n @sgds-invalid-input=${this._handleInvalidInput}\n minDate=${this.minDate}\n maxDate=${this.maxDate}\n label=${this.label}\n hintText=${this.hintText}\n name=${this.name}\n ?invalid=${this.invalid}\n hasFeedback=${ifDefined(this.hasFeedback ? \"both\" : undefined)}\n >\n </sgds-datepicker-input>\n <sgds-icon-button\n ${ref(this.myDropdown)}\n role=\"button\"\n class=${classMap({\n \"calendar-btn\": true,\n \"with-hint-text\": this.hintText || this.invalid,\n \"with-label\": this.label\n })}\n aria-expanded=\"${this.menuIsOpen}\"\n aria-haspopup=\"dialog\"\n aria-controls=${this.dropdownMenuId}\n @click=${() => this.toggleMenu()}\n ariaLabel=${this.menuIsOpen ? \"Close Calendar\" : \"Open Calendar\"}\n ?disabled=${this.disabled}\n variant=\"outline\"\n name=\"calendar\"\n >\n </sgds-icon-button>\n <ul\n id=${this.dropdownMenuId}\n class=\"sgds datepicker dropdown-menu\"\n role=\"dialog\"\n aria-label=${this._dialogAriaLabels[this.view]}\n @click=${(event: MouseEvent) => event.stopPropagation()}\n >\n <sgds-datepicker-header\n .view=${this.view}\n .displayDate=${this.displayDate}\n .focusedDate=${this.focusedDate}\n .selectedDate=${this.selectedDateRange}\n .focusedTabIndex=${this.focusedTabIndex}\n ></sgds-datepicker-header>\n <sgds-datepicker-calendar\n .show=${this.menuIsOpen}\n .view=${this.view}\n .displayDate=${this.displayDate}\n .mode=${this.mode}\n minDate=${this.minDate}\n maxDate=${this.maxDate}\n .selectedDate=${this.selectedDateRange}\n .focusedTabIndex=${this.focusedTabIndex}\n ></sgds-datepicker-calendar>\n </ul>\n </div>\n `;\n }\n}\n\nexport default SgdsDatepicker;\n"],"names":["SgdsFormValidatorMixin","DropdownElement","format","DATE_PATTERNS","setTimeToNoon","parse","html","live","ifDefined","ref","classMap","dropdownMenuStyle","datepickerStyle","DatepickerInput","DatepickerCalendar","DatepickerHeader","SgdsButton","SgdsIconButton","__decorate","property","defaultValue","state","queryAsync","query","watch"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA;;;;;;;;AAQG;MACU,cAAe,SAAQA,qCAAsB,CAACC,+BAAe,CAAC,CAAA;AAA3E,IAAA,WAAA,GAAA;;;QAY8C,IAAQ,CAAA,QAAA,GAAG,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CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,MAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAEfH,gBAAA,CAAA;AAAhB,IAAAG,mBAAK,EAAE;AAAwC,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,mBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAE/BH,gBAAA,CAAA;AAAhB,IAAAG,mBAAK,EAAE;AAA2B,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,aAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAElBH,gBAAA,CAAA;AAAhB,IAAAG,mBAAK,EAAE;AAA6B,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAS7BH,gBAAA,CAAA;IADPI,wBAAU,CAAC,0BAA0B,CAAC;AACO,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,UAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGtCJ,gBAAA,CAAA;IADPI,wBAAU,CAAC,uBAAuB,CAAC;AACmB,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,sBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAG/CJ,gBAAA,CAAA;IADPK,mBAAK,CAAC,uBAAuB,CAAC;AACU,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAiHzCL,gBAAA,CAAA;IADCM,WAAK,CAAC,OAAO,EAAE,EAAE,oBAAoB,EAAE,IAAI,EAAE,CAAC;AAG9C,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,oBAAA,EAAA,IAAA,CAAA;;;;;"}
@@ -18,6 +18,7 @@ import { SgdsIconButton } from '../IconButton/sgds-icon-button.js';
18
18
  import { SgdsFormValidatorMixin } from '../../utils/validatorMixin.js';
19
19
  import { ifDefined } from 'lit/directives/if-defined.js';
20
20
  import { classMap } from 'lit/directives/class-map.js';
21
+ import { defaultValue } from '../../utils/defaultvalue.js';
21
22
 
22
23
  /**
23
24
  * @summary The `DatePicker` Component is built using `Dropdown`, `Input` and `Button` components. By default, the Calendar points to today's date and input has no value. Users can either pick dates from the calendar or type dates through the input
@@ -35,7 +36,17 @@ class SgdsDatepicker extends SgdsFormValidatorMixin(DropdownElement) {
35
36
  this.required = false;
36
37
  /** When true, adds disabled attribute to input and button element */
37
38
  this.disabled = false;
38
- /** The initial value of DatePicker on first load for single & range mode as array of string. eg.'["22/12/2023"]' for single & '["22/12/2023","25/12/2023"]' for range respectively */
39
+ /** Sets the initial value of the datepicker. Replaces deprecated `initialValue`.
40
+ * Pass in dates in this format `dd/mm/yyyy` for single mode and `dd/mm/yyyy - dd/mm/yyyy` for range mode
41
+ * For example, `value="22/12/2023"` for single mode or `value="22/12/2023 - 25/12/2023"` for range mode
42
+ */
43
+ this.value = "";
44
+ /**
45
+ * @deprecated since v3.1.1 in favour of `value`.
46
+ * The initial value of DatePicker on first load for single &
47
+ * range mode as array of string. eg.'["22/12/2023"]' for single &
48
+ * '["22/12/2023","25/12/2023"]' for range respectively
49
+ * */
39
50
  this.initialValue = [];
40
51
  this.dateFormat = "DD/MM/YYYY";
41
52
  /** ISO date string to set the lowest allowable date value. e.g. "2016-05-19T12:00:00.000Z" */
@@ -54,8 +65,8 @@ class SgdsDatepicker extends SgdsFormValidatorMixin(DropdownElement) {
54
65
  this.noFlip = false;
55
66
  /** The drop position of menu relative to the toggle button */
56
67
  this.drop = "down";
57
- /**@internal */
58
- this.value = "";
68
+ /**Gets or sets the default value used to reset this element. The initial value corresponds to the one originally specified in the HTML that created this element. */
69
+ this.defaultValue = "";
59
70
  /**@internal */
60
71
  this.invalid = false;
61
72
  this.view = "days";
@@ -141,6 +152,7 @@ class SgdsDatepicker extends SgdsFormValidatorMixin(DropdownElement) {
141
152
  this.addEventListener("sgds-hide", this._handleCloseMenu);
142
153
  this.addEventListener("sgds-show", this._handleOpenMenu);
143
154
  this.addEventListener("blur", this._mixinCheckValidity);
155
+ this.initialValue = this.value ? this.value.split(" - ").map(v => v.trim()) : this.initialValue;
144
156
  this.initialDisplayDate = this.displayDate || new Date();
145
157
  if (this.initialValue && this.initialValue.length > 0) {
146
158
  // Validate initialValue against the dateFormat regex
@@ -267,19 +279,22 @@ class SgdsDatepicker extends SgdsFormValidatorMixin(DropdownElement) {
267
279
  this._manageInternalsBadInput();
268
280
  }
269
281
  async _handleEmptyInput() {
270
- this._manageEmptyInput();
282
+ if (this.required) {
283
+ this._manageEmptyInput();
284
+ }
285
+ return;
271
286
  }
272
- async _resetDatepicker() {
287
+ async _resetDatepicker(resetValue = "") {
273
288
  this.displayDate = this.initialDisplayDate;
274
289
  this.selectedDateRange = [];
275
- this.value = "";
290
+ this.value = resetValue;
276
291
  this.view = "days";
277
292
  const input = await this.datepickerInputAsync;
278
293
  input.setInvalid(false);
279
294
  input.destroyInputMask();
280
295
  await input.applyInputMask();
281
296
  this._mixinResetValidity(input);
282
- if (this.isValueEmpty() && this.required) {
297
+ if (this.isValueEmpty()) {
283
298
  this._handleEmptyInput();
284
299
  }
285
300
  }
@@ -313,7 +328,7 @@ class SgdsDatepicker extends SgdsFormValidatorMixin(DropdownElement) {
313
328
  * Handles the form "reset" event
314
329
  */
315
330
  async _mixinResetFormControl() {
316
- this._resetDatepicker();
331
+ this._resetDatepicker(this.defaultValue);
317
332
  }
318
333
  async _handleInputMaskChange(e) {
319
334
  this.value = e.detail;
@@ -407,6 +422,9 @@ __decorate([
407
422
  __decorate([
408
423
  property({ type: Boolean, reflect: true })
409
424
  ], SgdsDatepicker.prototype, "disabled", void 0);
425
+ __decorate([
426
+ property({ type: String, reflect: true })
427
+ ], SgdsDatepicker.prototype, "value", void 0);
410
428
  __decorate([
411
429
  property({ type: Array, reflect: true })
412
430
  ], SgdsDatepicker.prototype, "initialValue", void 0);
@@ -441,8 +459,8 @@ __decorate([
441
459
  property({ attribute: false })
442
460
  ], SgdsDatepicker.prototype, "displayDate", void 0);
443
461
  __decorate([
444
- state()
445
- ], SgdsDatepicker.prototype, "value", void 0);
462
+ defaultValue()
463
+ ], SgdsDatepicker.prototype, "defaultValue", void 0);
446
464
  __decorate([
447
465
  state()
448
466
  ], SgdsDatepicker.prototype, "invalid", void 0);
@@ -468,7 +486,7 @@ __decorate([
468
486
  query("sgds-datepicker-input")
469
487
  ], SgdsDatepicker.prototype, "datepickerInput", void 0);
470
488
  __decorate([
471
- watch("value")
489
+ watch("value", { waitUntilFirstUpdate: true })
472
490
  ], SgdsDatepicker.prototype, "_handleValueChange", null);
473
491
 
474
492
  export { SgdsDatepicker, SgdsDatepicker as default };