dasar-ui 1.3.0 → 1.9.0

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 (413) hide show
  1. package/.dockerignore +31 -0
  2. package/.editorconfig +17 -0
  3. package/.github/workflows/npm-publish-github-packages.yml +36 -0
  4. package/.prettierrc +12 -0
  5. package/.versionrc.json +4 -0
  6. package/.vscode/extensions.json +4 -0
  7. package/.vscode/launch.json +20 -0
  8. package/.vscode/settings.json +4 -0
  9. package/.vscode/tasks.json +42 -0
  10. package/CHANGELOG.md +92 -0
  11. package/Dockerfile +26 -0
  12. package/README.md +41 -40
  13. package/angular.json +114 -0
  14. package/docs/_config.yml +3 -0
  15. package/docs/getting-started.md +89 -0
  16. package/docs/index.md +9 -0
  17. package/docs/installation.md +46 -0
  18. package/package.json +57 -39
  19. package/projects/dasar-ui/README.md +64 -0
  20. package/projects/dasar-ui/ng-package.json +10 -0
  21. package/projects/dasar-ui/package.json +27 -0
  22. package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.html +9 -0
  23. package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.scss +352 -0
  24. package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.spec.ts +21 -0
  25. package/projects/dasar-ui/src/lib/components/dasar-button/dasar-button.ts +154 -0
  26. package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.html +1 -0
  27. package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.scss +69 -0
  28. package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.spec.ts +21 -0
  29. package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.ts +26 -0
  30. package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.html +158 -0
  31. package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.scss +371 -0
  32. package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.spec.ts +21 -0
  33. package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.ts +458 -0
  34. package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.html +80 -0
  35. package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.scss +184 -0
  36. package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.spec.ts +21 -0
  37. package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.ts +294 -0
  38. package/projects/dasar-ui/src/lib/components/dasar-chip/dasar-chip.html +42 -0
  39. package/projects/dasar-ui/src/lib/components/dasar-chip/dasar-chip.scss +38 -0
  40. package/projects/dasar-ui/src/lib/components/dasar-chip/dasar-chip.ts +205 -0
  41. package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.html +111 -0
  42. package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.scss +331 -0
  43. package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.spec.ts +93 -0
  44. package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.ts +527 -0
  45. package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.html +1 -0
  46. package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.registry.ts +5087 -0
  47. package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.scss +24 -0
  48. package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.spec.ts +21 -0
  49. package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.ts +97 -0
  50. package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.html +54 -0
  51. package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.scss +251 -0
  52. package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.spec.ts +21 -0
  53. package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.ts +319 -0
  54. package/projects/dasar-ui/src/lib/components/dasar-list/dasar-list-item.html +17 -0
  55. package/projects/dasar-ui/src/lib/components/dasar-list/dasar-list.html +25 -0
  56. package/projects/dasar-ui/src/lib/components/dasar-list/dasar-list.scss +122 -0
  57. package/projects/dasar-ui/src/lib/components/dasar-list/dasar-list.spec.ts +21 -0
  58. package/projects/dasar-ui/src/lib/components/dasar-list/dasar-list.ts +166 -0
  59. package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.html +64 -0
  60. package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.scss +229 -0
  61. package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.spec.ts +93 -0
  62. package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.ts +278 -0
  63. package/projects/dasar-ui/src/lib/components/dasar-modal/dasar-modal.html +72 -0
  64. package/projects/dasar-ui/src/lib/components/dasar-modal/dasar-modal.scss +170 -0
  65. package/projects/dasar-ui/src/lib/components/dasar-modal/dasar-modal.spec.ts +267 -0
  66. package/projects/dasar-ui/src/lib/components/dasar-modal/dasar-modal.ts +305 -0
  67. package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.html +90 -0
  68. package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.scss +353 -0
  69. package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.spec.ts +21 -0
  70. package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.ts +337 -0
  71. package/projects/dasar-ui/src/lib/components/dasar-overlay/dasar-overlay.html +11 -0
  72. package/projects/dasar-ui/src/lib/components/dasar-overlay/dasar-overlay.scss +18 -0
  73. package/projects/dasar-ui/src/lib/components/dasar-overlay/dasar-overlay.spec.ts +112 -0
  74. package/projects/dasar-ui/src/lib/components/dasar-overlay/dasar-overlay.ts +87 -0
  75. package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.html +98 -0
  76. package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.scss +51 -0
  77. package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.spec.ts +21 -0
  78. package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.ts +99 -0
  79. package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.css +0 -0
  80. package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.html +1 -0
  81. package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.spec.ts +21 -0
  82. package/projects/dasar-ui/src/lib/components/dasar-pin/dasar-pin.ts +9 -0
  83. package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.html +150 -0
  84. package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.scss +272 -0
  85. package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.ts +228 -0
  86. package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.css +0 -0
  87. package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.html +1 -0
  88. package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.spec.ts +21 -0
  89. package/projects/dasar-ui/src/lib/components/dasar-radio/dasar-radio.ts +9 -0
  90. package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.html +189 -0
  91. package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.scss +387 -0
  92. package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.spec.ts +97 -0
  93. package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.ts +540 -0
  94. package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.css +0 -0
  95. package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.html +1 -0
  96. package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.spec.ts +21 -0
  97. package/projects/dasar-ui/src/lib/components/dasar-slider/dasar-slider.ts +9 -0
  98. package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.html +162 -0
  99. package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.scss +283 -0
  100. package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.spec.ts +21 -0
  101. package/projects/dasar-ui/src/lib/components/dasar-table/dasar-table.ts +380 -0
  102. package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.html +103 -0
  103. package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.scss +238 -0
  104. package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.spec.ts +570 -0
  105. package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.ts +349 -0
  106. package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.html +43 -0
  107. package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.scss +189 -0
  108. package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.spec.ts +21 -0
  109. package/projects/dasar-ui/src/lib/components/dasar-textarea/dasar-textarea.ts +139 -0
  110. package/projects/dasar-ui/src/lib/components/dasar-theme-provider/dasar-theme-provider.spec.ts +89 -0
  111. package/projects/dasar-ui/src/lib/components/dasar-theme-provider/dasar-theme-provider.ts +294 -0
  112. package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.css +0 -0
  113. package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.html +1 -0
  114. package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.spec.ts +21 -0
  115. package/projects/dasar-ui/src/lib/components/dasar-toast/dasar-toast.ts +9 -0
  116. package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.css +0 -0
  117. package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.html +1 -0
  118. package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.spec.ts +21 -0
  119. package/projects/dasar-ui/src/lib/components/dasar-toggle/dasar-toggle.ts +9 -0
  120. package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.css +0 -0
  121. package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.html +1 -0
  122. package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.spec.ts +21 -0
  123. package/projects/dasar-ui/src/lib/components/dasar-tooltip/dasar-tooltip.ts +9 -0
  124. package/projects/dasar-ui/src/lib/models/theme.model.ts +730 -0
  125. package/projects/dasar-ui/src/lib/models/type.model.ts +11 -0
  126. package/projects/dasar-ui/src/lib/services/theme.service.spec.ts +130 -0
  127. package/projects/dasar-ui/src/lib/services/theme.service.ts +777 -0
  128. package/{styles → projects/dasar-ui/src/lib/styles}/theme.scss +47 -48
  129. package/projects/dasar-ui/src/lib/styles/theme.ts +70 -0
  130. package/projects/dasar-ui/src/lib/utils/common.ts +156 -0
  131. package/projects/dasar-ui/src/lib/utils/icon-size.spec.ts +23 -0
  132. package/projects/dasar-ui/src/lib/utils/icon-size.ts +16 -0
  133. package/projects/dasar-ui/src/lib/utils/panel-placement.spec.ts +90 -0
  134. package/projects/dasar-ui/src/lib/utils/panel-placement.ts +53 -0
  135. package/projects/dasar-ui/src/public-api.ts +24 -0
  136. package/projects/dasar-ui/tsconfig.lib.json +21 -0
  137. package/projects/dasar-ui/tsconfig.lib.prod.json +11 -0
  138. package/projects/dasar-ui/tsconfig.spec.json +18 -0
  139. package/projects/documentation/public/favicon.ico +0 -0
  140. package/projects/documentation/src/app/app.html +78 -0
  141. package/projects/documentation/src/app/app.spec.ts +23 -0
  142. package/projects/documentation/src/app/app.ts +57 -0
  143. package/projects/documentation/src/app/components/doc-customize-modal.component.ts +368 -0
  144. package/projects/documentation/src/app/components/doc-example.component.ts +195 -0
  145. package/projects/documentation/src/app/components/doc-markdown.component.ts +154 -0
  146. package/projects/documentation/src/app/config/app.config.server.ts +10 -0
  147. package/projects/documentation/src/app/config/app.config.ts +17 -0
  148. package/projects/documentation/src/app/layouts/doc.layout.ts +249 -0
  149. package/projects/documentation/src/app/pages/button/button.page.html +65 -0
  150. package/projects/documentation/src/app/pages/button/button.page.ts +139 -0
  151. package/projects/documentation/src/app/pages/button/examples/appearance/button-appearance.example.html +7 -0
  152. package/projects/documentation/src/app/pages/button/examples/appearance/button-appearance.example.ts +10 -0
  153. package/projects/documentation/src/app/pages/button/examples/icon/button-icon.example.html +19 -0
  154. package/projects/documentation/src/app/pages/button/examples/icon/button-icon.example.ts +10 -0
  155. package/projects/documentation/src/app/pages/button/examples/radius/button-radius.example.html +9 -0
  156. package/projects/documentation/src/app/pages/button/examples/radius/button-radius.example.ts +10 -0
  157. package/projects/documentation/src/app/pages/button/examples/sizes/button-sizes.example.html +7 -0
  158. package/projects/documentation/src/app/pages/button/examples/sizes/button-sizes.example.ts +10 -0
  159. package/projects/documentation/src/app/pages/button/examples/state/button-state.example.html +10 -0
  160. package/projects/documentation/src/app/pages/button/examples/state/button-state.example.ts +10 -0
  161. package/projects/documentation/src/app/pages/button/examples/variant/button-variant.example.html +9 -0
  162. package/projects/documentation/src/app/pages/button/examples/variant/button-variant.example.ts +10 -0
  163. package/projects/documentation/src/app/pages/calendar/calendar.page.html +75 -0
  164. package/projects/documentation/src/app/pages/calendar/calendar.page.ts +165 -0
  165. package/projects/documentation/src/app/pages/calendar/examples/actions/calendar-actions.example.html +21 -0
  166. package/projects/documentation/src/app/pages/calendar/examples/actions/calendar-actions.example.ts +10 -0
  167. package/projects/documentation/src/app/pages/calendar/examples/basic/calendar-basic.example.html +11 -0
  168. package/projects/documentation/src/app/pages/calendar/examples/basic/calendar-basic.example.ts +13 -0
  169. package/projects/documentation/src/app/pages/calendar/examples/custom-header/calendar-custom-header.example.html +36 -0
  170. package/projects/documentation/src/app/pages/calendar/examples/custom-header/calendar-custom-header.example.ts +11 -0
  171. package/projects/documentation/src/app/pages/calendar/examples/dropdown/calendar-dropdown.example.html +10 -0
  172. package/projects/documentation/src/app/pages/calendar/examples/dropdown/calendar-dropdown.example.ts +12 -0
  173. package/projects/documentation/src/app/pages/calendar/examples/format/calendar-format.example.html +15 -0
  174. package/projects/documentation/src/app/pages/calendar/examples/format/calendar-format.example.ts +12 -0
  175. package/projects/documentation/src/app/pages/calendar/examples/locale/calendar-locale.example.html +34 -0
  176. package/projects/documentation/src/app/pages/calendar/examples/locale/calendar-locale.example.ts +14 -0
  177. package/projects/documentation/src/app/pages/calendar/examples/more/calendar.more.example.html +20 -0
  178. package/projects/documentation/src/app/pages/calendar/examples/more/calendar.more.example.ts +37 -0
  179. package/projects/documentation/src/app/pages/calendar/examples/styles/calendar-styles.example.html +16 -0
  180. package/projects/documentation/src/app/pages/calendar/examples/styles/calendar-styles.example.ts +10 -0
  181. package/projects/documentation/src/app/pages/card/card.page.html +75 -0
  182. package/projects/documentation/src/app/pages/card/card.page.ts +182 -0
  183. package/projects/documentation/src/app/pages/card/examples/appearance/card-appearance.example.html +13 -0
  184. package/projects/documentation/src/app/pages/card/examples/appearance/card-appearance.example.ts +10 -0
  185. package/projects/documentation/src/app/pages/card/examples/closable/card-closable.example.html +30 -0
  186. package/projects/documentation/src/app/pages/card/examples/closable/card-closable.example.ts +19 -0
  187. package/projects/documentation/src/app/pages/card/examples/custom-style/card-custom-style.example.html +173 -0
  188. package/projects/documentation/src/app/pages/card/examples/custom-style/card-custom-style.example.ts +10 -0
  189. package/projects/documentation/src/app/pages/card/examples/media/card-media.example.html +27 -0
  190. package/projects/documentation/src/app/pages/card/examples/media/card-media.example.ts +10 -0
  191. package/projects/documentation/src/app/pages/card/examples/radius/card-radius.example.html +13 -0
  192. package/projects/documentation/src/app/pages/card/examples/radius/card-radius.example.ts +10 -0
  193. package/projects/documentation/src/app/pages/card/examples/slots/card-slots.example.html +20 -0
  194. package/projects/documentation/src/app/pages/card/examples/slots/card-slots.example.ts +10 -0
  195. package/projects/documentation/src/app/pages/card/examples/spacing/card-spacing.example.html +11 -0
  196. package/projects/documentation/src/app/pages/card/examples/spacing/card-spacing.example.ts +10 -0
  197. package/projects/documentation/src/app/pages/chip/chip.page.html +55 -0
  198. package/projects/documentation/src/app/pages/chip/chip.page.ts +158 -0
  199. package/projects/documentation/src/app/pages/chip/examples/appearance/chip-appearance.example.html +7 -0
  200. package/projects/documentation/src/app/pages/chip/examples/appearance/chip-appearance.example.ts +10 -0
  201. package/projects/documentation/src/app/pages/chip/examples/more/chip-more.example.html +13 -0
  202. package/projects/documentation/src/app/pages/chip/examples/more/chip-more.example.ts +17 -0
  203. package/projects/documentation/src/app/pages/chip/examples/radius/chip-radius.example.html +9 -0
  204. package/projects/documentation/src/app/pages/chip/examples/radius/chip-radius.example.ts +10 -0
  205. package/projects/documentation/src/app/pages/chip/examples/sizes/chip-sizes.example.html +6 -0
  206. package/projects/documentation/src/app/pages/chip/examples/sizes/chip-sizes.example.ts +10 -0
  207. package/projects/documentation/src/app/pages/chip/examples/variant/chip-variant.example.html +8 -0
  208. package/projects/documentation/src/app/pages/chip/examples/variant/chip-variant.example.ts +10 -0
  209. package/projects/documentation/src/app/pages/datepicker/datepicker.page.html +75 -0
  210. package/projects/documentation/src/app/pages/datepicker/datepicker.page.ts +181 -0
  211. package/projects/documentation/src/app/pages/datepicker/examples/appearance/datepicker-appearance.example.html +29 -0
  212. package/projects/documentation/src/app/pages/datepicker/examples/appearance/datepicker-appearance.example.ts +10 -0
  213. package/projects/documentation/src/app/pages/datepicker/examples/basic/datepicker-basic.example.html +12 -0
  214. package/projects/documentation/src/app/pages/datepicker/examples/basic/datepicker-basic.example.ts +12 -0
  215. package/projects/documentation/src/app/pages/datepicker/examples/footer/datepicker-footer.example.html +23 -0
  216. package/projects/documentation/src/app/pages/datepicker/examples/footer/datepicker-footer.example.ts +17 -0
  217. package/projects/documentation/src/app/pages/datepicker/examples/format/datepicker-format.example.html +30 -0
  218. package/projects/documentation/src/app/pages/datepicker/examples/format/datepicker-format.example.ts +13 -0
  219. package/projects/documentation/src/app/pages/datepicker/examples/placement/datepicker-placement.example.html +24 -0
  220. package/projects/documentation/src/app/pages/datepicker/examples/placement/datepicker-placement.example.ts +10 -0
  221. package/projects/documentation/src/app/pages/datepicker/examples/slots/datepicker-slots.example.html +19 -0
  222. package/projects/documentation/src/app/pages/datepicker/examples/slots/datepicker-slots.example.ts +10 -0
  223. package/projects/documentation/src/app/pages/datepicker/examples/states/datepicker-states.example.html +28 -0
  224. package/projects/documentation/src/app/pages/datepicker/examples/states/datepicker-states.example.ts +12 -0
  225. package/projects/documentation/src/app/pages/getting-started/getting-started.page.ts +21 -0
  226. package/projects/documentation/src/app/pages/icon/icon.page.html +15 -0
  227. package/projects/documentation/src/app/pages/icon/icon.page.ts +60 -0
  228. package/projects/documentation/src/app/pages/input/examples/appearance/input-appearance.example.html +27 -0
  229. package/projects/documentation/src/app/pages/input/examples/appearance/input-appearance.example.ts +10 -0
  230. package/projects/documentation/src/app/pages/input/examples/basic/input-basic.example.html +13 -0
  231. package/projects/documentation/src/app/pages/input/examples/basic/input-basic.example.ts +13 -0
  232. package/projects/documentation/src/app/pages/input/examples/mask/input-mask.example.html +31 -0
  233. package/projects/documentation/src/app/pages/input/examples/mask/input-mask.example.ts +19 -0
  234. package/projects/documentation/src/app/pages/input/examples/more/input-more.example.html +68 -0
  235. package/projects/documentation/src/app/pages/input/examples/more/input-more.example.ts +18 -0
  236. package/projects/documentation/src/app/pages/input/examples/slots/input-slots.example.html +52 -0
  237. package/projects/documentation/src/app/pages/input/examples/slots/input-slots.example.ts +10 -0
  238. package/projects/documentation/src/app/pages/input/examples/states/input-states.example.html +29 -0
  239. package/projects/documentation/src/app/pages/input/examples/states/input-states.example.ts +10 -0
  240. package/projects/documentation/src/app/pages/input/input.page.html +65 -0
  241. package/projects/documentation/src/app/pages/input/input.page.ts +170 -0
  242. package/projects/documentation/src/app/pages/installation/installation.page.ts +18 -0
  243. package/projects/documentation/src/app/pages/introduction/introduction.page.ts +18 -0
  244. package/projects/documentation/src/app/pages/list/examples/advanced-dynamic/list-advanced-dynamic.example.html +29 -0
  245. package/projects/documentation/src/app/pages/list/examples/advanced-dynamic/list-advanced-dynamic.example.ts +33 -0
  246. package/projects/documentation/src/app/pages/list/examples/advanced-theme/list-advanced-theme.example.html +13 -0
  247. package/projects/documentation/src/app/pages/list/examples/advanced-theme/list-advanced-theme.example.ts +30 -0
  248. package/projects/documentation/src/app/pages/list/examples/basic/list-basic.example.html +5 -0
  249. package/projects/documentation/src/app/pages/list/examples/basic/list-basic.example.ts +12 -0
  250. package/projects/documentation/src/app/pages/list/examples/bordered-divider/list-bordered-divider.example.html +20 -0
  251. package/projects/documentation/src/app/pages/list/examples/bordered-divider/list-bordered-divider.example.ts +12 -0
  252. package/projects/documentation/src/app/pages/list/examples/custom-style/list-custom-style.example.html +11 -0
  253. package/projects/documentation/src/app/pages/list/examples/custom-style/list-custom-style.example.ts +19 -0
  254. package/projects/documentation/src/app/pages/list/examples/header-footer/list-header-footer.example.html +7 -0
  255. package/projects/documentation/src/app/pages/list/examples/header-footer/list-header-footer.example.ts +12 -0
  256. package/projects/documentation/src/app/pages/list/examples/interactive/list-interactive.example.html +20 -0
  257. package/projects/documentation/src/app/pages/list/examples/interactive/list-interactive.example.ts +22 -0
  258. package/projects/documentation/src/app/pages/list/examples/prefix-suffix/list-prefix-suffix.example.html +9 -0
  259. package/projects/documentation/src/app/pages/list/examples/prefix-suffix/list-prefix-suffix.example.ts +16 -0
  260. package/projects/documentation/src/app/pages/list/examples/size/list-size.example.html +20 -0
  261. package/projects/documentation/src/app/pages/list/examples/size/list-size.example.ts +12 -0
  262. package/projects/documentation/src/app/pages/list/list.page.html +95 -0
  263. package/projects/documentation/src/app/pages/list/list.page.ts +238 -0
  264. package/projects/documentation/src/app/pages/menu/examples/basic/menu-basic.example.html +5 -0
  265. package/projects/documentation/src/app/pages/menu/examples/basic/menu-basic.example.ts +17 -0
  266. package/projects/documentation/src/app/pages/menu/examples/custom-template/menu-custom-template.example.html +35 -0
  267. package/projects/documentation/src/app/pages/menu/examples/custom-template/menu-custom-template.example.ts +57 -0
  268. package/projects/documentation/src/app/pages/menu/examples/placement/menu-placement.example.html +12 -0
  269. package/projects/documentation/src/app/pages/menu/examples/placement/menu-placement.example.ts +16 -0
  270. package/projects/documentation/src/app/pages/menu/menu.page.html +35 -0
  271. package/projects/documentation/src/app/pages/menu/menu.page.ts +149 -0
  272. package/projects/documentation/src/app/pages/modal/examples/appearance/modal-appearance.example.html +18 -0
  273. package/projects/documentation/src/app/pages/modal/examples/appearance/modal-appearance.example.ts +21 -0
  274. package/projects/documentation/src/app/pages/modal/examples/basic/modal-basic.example.html +8 -0
  275. package/projects/documentation/src/app/pages/modal/examples/basic/modal-basic.example.ts +12 -0
  276. package/projects/documentation/src/app/pages/modal/examples/close-behavior/modal-close-behavior.example.html +44 -0
  277. package/projects/documentation/src/app/pages/modal/examples/close-behavior/modal-close-behavior.example.ts +14 -0
  278. package/projects/documentation/src/app/pages/modal/examples/custom-style/modal-custom-style.example.html +36 -0
  279. package/projects/documentation/src/app/pages/modal/examples/custom-style/modal-custom-style.example.ts +12 -0
  280. package/projects/documentation/src/app/pages/modal/examples/overlay/modal-overlay.example.html +29 -0
  281. package/projects/documentation/src/app/pages/modal/examples/overlay/modal-overlay.example.ts +14 -0
  282. package/projects/documentation/src/app/pages/modal/examples/radius-spacing/modal-radius-spacing.example.html +27 -0
  283. package/projects/documentation/src/app/pages/modal/examples/radius-spacing/modal-radius-spacing.example.ts +27 -0
  284. package/projects/documentation/src/app/pages/modal/examples/scroll/modal-scroll.example.html +14 -0
  285. package/projects/documentation/src/app/pages/modal/examples/scroll/modal-scroll.example.ts +13 -0
  286. package/projects/documentation/src/app/pages/modal/examples/size/modal-size.example.html +17 -0
  287. package/projects/documentation/src/app/pages/modal/examples/size/modal-size.example.ts +21 -0
  288. package/projects/documentation/src/app/pages/modal/examples/slots/modal-slots.example.html +30 -0
  289. package/projects/documentation/src/app/pages/modal/examples/slots/modal-slots.example.ts +12 -0
  290. package/projects/documentation/src/app/pages/modal/examples/width/modal-width.example.html +23 -0
  291. package/projects/documentation/src/app/pages/modal/examples/width/modal-width.example.ts +13 -0
  292. package/projects/documentation/src/app/pages/modal/modal.page.html +105 -0
  293. package/projects/documentation/src/app/pages/modal/modal.page.ts +266 -0
  294. package/projects/documentation/src/app/pages/number-input/examples/appearance/number-input-appearance.example.html +30 -0
  295. package/projects/documentation/src/app/pages/number-input/examples/appearance/number-input-appearance.example.ts +10 -0
  296. package/projects/documentation/src/app/pages/number-input/examples/basic/number-input-basic.example.html +12 -0
  297. package/projects/documentation/src/app/pages/number-input/examples/basic/number-input-basic.example.ts +13 -0
  298. package/projects/documentation/src/app/pages/number-input/examples/limits/number-input-limits.example.html +30 -0
  299. package/projects/documentation/src/app/pages/number-input/examples/limits/number-input-limits.example.ts +14 -0
  300. package/projects/documentation/src/app/pages/number-input/examples/slots/number-input-slots.example.html +49 -0
  301. package/projects/documentation/src/app/pages/number-input/examples/slots/number-input-slots.example.ts +10 -0
  302. package/projects/documentation/src/app/pages/number-input/examples/states/number-input-states.example.html +21 -0
  303. package/projects/documentation/src/app/pages/number-input/examples/states/number-input-states.example.ts +10 -0
  304. package/projects/documentation/src/app/pages/number-input/number-input.page.html +55 -0
  305. package/projects/documentation/src/app/pages/number-input/number-input.page.ts +142 -0
  306. package/projects/documentation/src/app/pages/select/examples/appearance/select-appearance.example.html +32 -0
  307. package/projects/documentation/src/app/pages/select/examples/appearance/select-appearance.example.ts +15 -0
  308. package/projects/documentation/src/app/pages/select/examples/basic/select-basic.example.html +13 -0
  309. package/projects/documentation/src/app/pages/select/examples/basic/select-basic.example.ts +20 -0
  310. package/projects/documentation/src/app/pages/select/examples/multiple/select-multiple.example.html +24 -0
  311. package/projects/documentation/src/app/pages/select/examples/multiple/select-multiple.example.ts +59 -0
  312. package/projects/documentation/src/app/pages/select/examples/placement/select-placement.example.html +20 -0
  313. package/projects/documentation/src/app/pages/select/examples/placement/select-placement.example.ts +20 -0
  314. package/projects/documentation/src/app/pages/select/examples/search/select-search.example.html +13 -0
  315. package/projects/documentation/src/app/pages/select/examples/search/select-search.example.ts +22 -0
  316. package/projects/documentation/src/app/pages/select/examples/slots/select-slots.example.html +44 -0
  317. package/projects/documentation/src/app/pages/select/examples/slots/select-slots.example.ts +15 -0
  318. package/projects/documentation/src/app/pages/select/examples/states/select-states.example.html +31 -0
  319. package/projects/documentation/src/app/pages/select/examples/states/select-states.example.ts +12 -0
  320. package/projects/documentation/src/app/pages/select/select.page.html +75 -0
  321. package/projects/documentation/src/app/pages/select/select.page.ts +195 -0
  322. package/projects/documentation/src/app/pages/table/examples/cell-actions/table-cell-actions.example.html +14 -0
  323. package/projects/documentation/src/app/pages/table/examples/cell-actions/table-cell-actions.example.ts +25 -0
  324. package/projects/documentation/src/app/pages/table/examples/cell-badge/table-cell-badge.example.html +12 -0
  325. package/projects/documentation/src/app/pages/table/examples/cell-badge/table-cell-badge.example.ts +21 -0
  326. package/projects/documentation/src/app/pages/table/examples/cell-profile/table-cell-profile.example.html +29 -0
  327. package/projects/documentation/src/app/pages/table/examples/cell-profile/table-cell-profile.example.ts +20 -0
  328. package/projects/documentation/src/app/pages/table/examples/custom-body/table-custom-body.example.html +39 -0
  329. package/projects/documentation/src/app/pages/table/examples/custom-body/table-custom-body.example.ts +21 -0
  330. package/projects/documentation/src/app/pages/table/examples/custom-sizes/table-custom-sizes.example.html +7 -0
  331. package/projects/documentation/src/app/pages/table/examples/custom-sizes/table-custom-sizes.example.ts +21 -0
  332. package/projects/documentation/src/app/pages/table/examples/dynamic-style/table-dynamic-style.example.html +3 -0
  333. package/projects/documentation/src/app/pages/table/examples/dynamic-style/table-dynamic-style.example.ts +41 -0
  334. package/projects/documentation/src/app/pages/table/examples/empty/table-empty.example.html +43 -0
  335. package/projects/documentation/src/app/pages/table/examples/empty/table-empty.example.ts +21 -0
  336. package/projects/documentation/src/app/pages/table/examples/expanded/table-expanded.example.html +36 -0
  337. package/projects/documentation/src/app/pages/table/examples/expanded/table-expanded.example.ts +34 -0
  338. package/projects/documentation/src/app/pages/table/examples/heatmap/table-heatmap.example.html +8 -0
  339. package/projects/documentation/src/app/pages/table/examples/heatmap/table-heatmap.example.ts +52 -0
  340. package/projects/documentation/src/app/pages/table/examples/inline-edit/table-inline-edit.example.html +53 -0
  341. package/projects/documentation/src/app/pages/table/examples/inline-edit/table-inline-edit.example.ts +50 -0
  342. package/projects/documentation/src/app/pages/table/examples/nested/table-nested.example.html +23 -0
  343. package/projects/documentation/src/app/pages/table/examples/nested/table-nested.example.ts +42 -0
  344. package/projects/documentation/src/app/pages/table/examples/pagination/table-pagination.example.html +20 -0
  345. package/projects/documentation/src/app/pages/table/examples/pagination/table-pagination.example.ts +21 -0
  346. package/projects/documentation/src/app/pages/table/table.page.html +125 -0
  347. package/projects/documentation/src/app/pages/table/table.page.ts +261 -0
  348. package/projects/documentation/src/app/pages/tabs/examples/advanced-dynamic/tabs-advanced-dynamic.example.html +13 -0
  349. package/projects/documentation/src/app/pages/tabs/examples/advanced-dynamic/tabs-advanced-dynamic.example.ts +27 -0
  350. package/projects/documentation/src/app/pages/tabs/examples/advanced-form/tabs-advanced-form.example.html +27 -0
  351. package/projects/documentation/src/app/pages/tabs/examples/advanced-form/tabs-advanced-form.example.ts +36 -0
  352. package/projects/documentation/src/app/pages/tabs/examples/advanced-theme/tabs-advanced-theme.example.html +5 -0
  353. package/projects/documentation/src/app/pages/tabs/examples/advanced-theme/tabs-advanced-theme.example.ts +20 -0
  354. package/projects/documentation/src/app/pages/tabs/examples/appearance/tabs-appearance.example.html +6 -0
  355. package/projects/documentation/src/app/pages/tabs/examples/appearance/tabs-appearance.example.ts +13 -0
  356. package/projects/documentation/src/app/pages/tabs/examples/basic/tabs-basic.example.html +13 -0
  357. package/projects/documentation/src/app/pages/tabs/examples/basic/tabs-basic.example.ts +13 -0
  358. package/projects/documentation/src/app/pages/tabs/examples/custom-style/tabs-custom-style.example.html +19 -0
  359. package/projects/documentation/src/app/pages/tabs/examples/custom-style/tabs-custom-style.example.ts +12 -0
  360. package/projects/documentation/src/app/pages/tabs/examples/events/tabs-events.example.html +16 -0
  361. package/projects/documentation/src/app/pages/tabs/examples/events/tabs-events.example.ts +23 -0
  362. package/projects/documentation/src/app/pages/tabs/examples/fluid/tabs-fluid.example.html +5 -0
  363. package/projects/documentation/src/app/pages/tabs/examples/fluid/tabs-fluid.example.ts +12 -0
  364. package/projects/documentation/src/app/pages/tabs/examples/no-body/tabs-no-body.example.html +6 -0
  365. package/projects/documentation/src/app/pages/tabs/examples/no-body/tabs-no-body.example.ts +12 -0
  366. package/projects/documentation/src/app/pages/tabs/examples/radius/tabs-radius.example.html +6 -0
  367. package/projects/documentation/src/app/pages/tabs/examples/radius/tabs-radius.example.ts +13 -0
  368. package/projects/documentation/src/app/pages/tabs/examples/scroll/tabs-scroll.example.html +20 -0
  369. package/projects/documentation/src/app/pages/tabs/examples/scroll/tabs-scroll.example.ts +30 -0
  370. package/projects/documentation/src/app/pages/tabs/examples/scroll-icon/tabs-scroll-icon.example.html +16 -0
  371. package/projects/documentation/src/app/pages/tabs/examples/scroll-icon/tabs-scroll-icon.example.ts +26 -0
  372. package/projects/documentation/src/app/pages/tabs/examples/scroll-slot/tabs-scroll-slot.example.html +22 -0
  373. package/projects/documentation/src/app/pages/tabs/examples/scroll-slot/tabs-scroll-slot.example.ts +26 -0
  374. package/projects/documentation/src/app/pages/tabs/examples/size/tabs-size.example.html +6 -0
  375. package/projects/documentation/src/app/pages/tabs/examples/size/tabs-size.example.ts +13 -0
  376. package/projects/documentation/src/app/pages/tabs/examples/slots/tabs-slots.example.html +25 -0
  377. package/projects/documentation/src/app/pages/tabs/examples/slots/tabs-slots.example.ts +10 -0
  378. package/projects/documentation/src/app/pages/tabs/examples/spacing/tabs-spacing.example.html +6 -0
  379. package/projects/documentation/src/app/pages/tabs/examples/spacing/tabs-spacing.example.ts +13 -0
  380. package/projects/documentation/src/app/pages/tabs/tabs.page.html +165 -0
  381. package/projects/documentation/src/app/pages/tabs/tabs.page.ts +347 -0
  382. package/projects/documentation/src/app/pages/theming/examples/component-config/theming-component-config.example.html +13 -0
  383. package/projects/documentation/src/app/pages/theming/examples/component-config/theming-component-config.example.ts +20 -0
  384. package/projects/documentation/src/app/pages/theming/examples/css-override/theming-css-override.example.html +8 -0
  385. package/projects/documentation/src/app/pages/theming/examples/css-override/theming-css-override.example.scss +4 -0
  386. package/projects/documentation/src/app/pages/theming/examples/css-override/theming-css-override.example.ts +11 -0
  387. package/projects/documentation/src/app/pages/theming/examples/custom-tokens/theming-custom-tokens.example.html +13 -0
  388. package/projects/documentation/src/app/pages/theming/examples/custom-tokens/theming-custom-tokens.example.ts +33 -0
  389. package/projects/documentation/src/app/pages/theming/examples/global-theme/theming-global-theme.example.html +6 -0
  390. package/projects/documentation/src/app/pages/theming/examples/global-theme/theming-global-theme.example.ts +20 -0
  391. package/projects/documentation/src/app/pages/theming/examples/light-dark/theming-light-dark.example.html +15 -0
  392. package/projects/documentation/src/app/pages/theming/examples/light-dark/theming-light-dark.example.ts +31 -0
  393. package/projects/documentation/src/app/pages/theming/theming-component-config.page.ts +52 -0
  394. package/projects/documentation/src/app/pages/theming/theming-css-variables.page.ts +71 -0
  395. package/projects/documentation/src/app/pages/theming/theming-tokens.page.ts +56 -0
  396. package/projects/documentation/src/app/pages/theming/theming.data.ts +947 -0
  397. package/projects/documentation/src/app/pages/theming/theming.page.html +56 -0
  398. package/projects/documentation/src/app/pages/theming/theming.page.ts +144 -0
  399. package/projects/documentation/src/app/routes/app.routes.server.ts +8 -0
  400. package/projects/documentation/src/app/routes/app.routes.ts +135 -0
  401. package/projects/documentation/src/app/services/doc-customize.service.ts +119 -0
  402. package/projects/documentation/src/app/utils/highlight.pipe.ts +43 -0
  403. package/projects/documentation/src/index.html +13 -0
  404. package/projects/documentation/src/main.server.ts +7 -0
  405. package/projects/documentation/src/main.ts +5 -0
  406. package/projects/documentation/src/server.ts +47 -0
  407. package/projects/documentation/src/styles.scss +19 -0
  408. package/projects/documentation/tsconfig.app.json +11 -0
  409. package/projects/documentation/tsconfig.spec.json +10 -0
  410. package/tsconfig.json +40 -0
  411. package/fesm2022/dasar-ui.mjs +0 -9664
  412. package/fesm2022/dasar-ui.mjs.map +0 -1
  413. package/types/dasar-ui.d.ts +0 -2114
@@ -0,0 +1,93 @@
1
+ import { Component, signal } from '@angular/core';
2
+ import { ComponentFixture, TestBed } from '@angular/core/testing';
3
+ import { DasarDatepicker, DasarDatepickerComponent } from './dasar-datepicker';
4
+
5
+ @Component({
6
+ standalone: true,
7
+ imports: [DasarDatepickerComponent],
8
+ template: `
9
+ <dasar-datepicker
10
+ [size]="size()"
11
+ [radius]="radius()"
12
+ [placement]="placement()"
13
+ [value]="value()"
14
+ clearable
15
+ placeholder="Pick a date"
16
+ />
17
+ `,
18
+ })
19
+ class DatepickerHost {
20
+ size = signal<'sm' | 'md' | 'lg'>('sm');
21
+ radius = signal<'none' | 'md' | 'lg' | 'full'>('lg');
22
+ placement = signal<'bottom-start' | 'top-start'>('bottom-start');
23
+ value = signal<string | null>(null);
24
+ }
25
+
26
+ describe('DasarDatepicker', () => {
27
+ let component: DasarDatepicker;
28
+ let fixture: ComponentFixture<DatepickerHost>;
29
+ let host: DatepickerHost;
30
+
31
+ const trigger = () =>
32
+ fixture.nativeElement.querySelector('.dasar-datepicker-trigger') as HTMLElement;
33
+ const dropdown = () =>
34
+ fixture.nativeElement.querySelector('.dasar-datepicker-dropdown') as HTMLElement;
35
+ const open = async () => {
36
+ trigger().click();
37
+ await fixture.whenStable();
38
+ };
39
+
40
+ beforeEach(async () => {
41
+ await TestBed.configureTestingModule({
42
+ imports: [DatepickerHost],
43
+ }).compileComponents();
44
+
45
+ fixture = TestBed.createComponent(DatepickerHost);
46
+ host = fixture.componentInstance;
47
+ component = fixture.debugElement.children[0].componentInstance;
48
+ fixture.detectChanges();
49
+ });
50
+
51
+ it('should create', () => {
52
+ expect(component).toBeTruthy();
53
+ });
54
+
55
+ it('calendar icon fits the trigger size', () => {
56
+ const svg = trigger().querySelector('.calendar-icon svg') as SVGElement;
57
+ expect(svg.getAttribute('width')).toBe('14');
58
+ });
59
+
60
+ it('clear icon fits the trigger size when there is a value', () => {
61
+ host.value.set('2026-01-05');
62
+ fixture.detectChanges();
63
+ const svg = trigger().querySelector('.clear-icon svg') as SVGElement;
64
+ expect(svg.getAttribute('width')).toBe('14');
65
+ });
66
+
67
+ it('dropdown follows the trigger size and radius', async () => {
68
+ await open();
69
+
70
+ expect(dropdown()).toBeTruthy();
71
+ expect(dropdown().classList).toContain('size-sm');
72
+ expect(dropdown().classList).toContain('radius-lg');
73
+ expect(dropdown().classList).toContain('placement-bottom-start');
74
+ });
75
+
76
+ it('dropdown starts at the requested placement', async () => {
77
+ host.placement.set('top-start');
78
+ await open();
79
+
80
+ expect(dropdown().classList).toContain('placement-top-start');
81
+ });
82
+
83
+ it('never writes the flipped placement back to the placement input', async () => {
84
+ await open();
85
+
86
+ expect(component.placement).toBe('bottom-start');
87
+ expect(component.currentPlacement).toBe('bottom-start');
88
+ });
89
+
90
+ it('renders no dropdown while closed', () => {
91
+ expect(dropdown()).toBeNull();
92
+ });
93
+ });
@@ -0,0 +1,527 @@
1
+ import {
2
+ Component,
3
+ Input,
4
+ Output,
5
+ EventEmitter,
6
+ booleanAttribute,
7
+ ElementRef,
8
+ HostListener,
9
+ OnInit,
10
+ forwardRef,
11
+ inject,
12
+ ChangeDetectorRef,
13
+ ViewEncapsulation,
14
+ Directive,
15
+ ContentChild,
16
+ HostBinding,
17
+ ViewChild,
18
+ } from '@angular/core';
19
+ import { ControlValueAccessor, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
20
+ import { DASAR_THEME_PROVIDER } from '../dasar-theme-provider/dasar-theme-provider';
21
+ import { ClassType, StyleType, ScaleAttributeType } from '../../models/type.model';
22
+ import { DasarCalendarComponent } from '../dasar-calendar/dasar-calendar';
23
+ import { resolveThemeDefault, safeFormat } from '../../utils/common';
24
+ import { computeSmartPlacement, DasarPanelPlacement } from '../../utils/panel-placement';
25
+ import { fieldIconSize } from '../../utils/icon-size';
26
+ import { DasarButtonComponent } from '../dasar-button/dasar-button';
27
+ import { DasarThemeService } from '../../services/theme.service';
28
+ import { DasarIconComponent } from '../dasar-icon/dasar-icon';
29
+ import { CommonModule } from '@angular/common';
30
+
31
+ export type DasarDatepickerPlacement = DasarPanelPlacement;
32
+ export type DasarDatepickerSize = Extract<ScaleAttributeType, 'sm' | 'md' | 'lg'>;
33
+ export type DasarDatepickerAppearance = 'outline' | 'filled' | 'subtle';
34
+ export type DasarDatepickerRadius = ScaleAttributeType;
35
+ export type DasarDatepickerType = 'date';
36
+
37
+ export interface DasarDatepickerConfig {
38
+ fullWidth?: boolean;
39
+ clearable?: boolean;
40
+ disabled?: boolean;
41
+ fluid?: boolean;
42
+ error?: boolean;
43
+ displayFormat?: string;
44
+ valueFormat?: string;
45
+ placement?: DasarDatepickerPlacement;
46
+ appearance?: DasarDatepickerAppearance;
47
+ extraLabel?: string;
48
+ placeholder?: string;
49
+ radius?: DasarDatepickerRadius;
50
+ type?: DasarDatepickerType;
51
+ size?: DasarDatepickerSize;
52
+ locale?: string;
53
+ label?: string;
54
+ hint?: string;
55
+ containerClass?: ClassType;
56
+ wrapperClass?: ClassType;
57
+ triggerClass?: ClassType;
58
+ dropdownClass?: ClassType;
59
+ labelWrapperClass?: ClassType;
60
+ hintWrapperClass?: ClassType;
61
+ wrapperStyle?: StyleType;
62
+ triggerStyle?: StyleType;
63
+ labelWrapperStyle?: StyleType;
64
+ hintWrapperStyle?: StyleType;
65
+ containerStyle?: StyleType;
66
+ dropdownStyle?: StyleType;
67
+ }
68
+
69
+ @Directive({ selector: '[prefix-slot]', standalone: true })
70
+ export class DasarDatepickerPrefixSlot {}
71
+ @Directive({ selector: '[label-slot]', standalone: true })
72
+ export class DasarDatepickerLabelSlot {}
73
+ @Directive({ selector: '[extra-label-slot]', standalone: true })
74
+ export class DasarDatepickerExtraLabelSlot {}
75
+ @Directive({ selector: '[extra-header-slot]', standalone: true })
76
+ export class DasarDatepickerExtraHeaderSlot {}
77
+ @Directive({ selector: '[extra-footer-slot]', standalone: true })
78
+ export class DasarDatepickerExtraFooterSlot {}
79
+ @Directive({ selector: '[hint-slot]', standalone: true })
80
+ export class DasarDatepickerHintSlot {}
81
+
82
+ @Component({
83
+ selector: 'dasar-datepicker',
84
+ standalone: true,
85
+ imports: [
86
+ CommonModule,
87
+ FormsModule,
88
+ DasarCalendarComponent,
89
+ DasarIconComponent,
90
+ DasarButtonComponent,
91
+ ],
92
+ templateUrl: './dasar-datepicker.html',
93
+ styleUrls: ['./dasar-datepicker.scss'],
94
+ encapsulation: ViewEncapsulation.None,
95
+ providers: [
96
+ {
97
+ provide: NG_VALUE_ACCESSOR,
98
+ useExisting: forwardRef(() => DasarDatepicker),
99
+ multi: true,
100
+ },
101
+ ],
102
+ })
103
+ export class DasarDatepicker implements OnInit, ControlValueAccessor {
104
+ private themeProvider = inject(DASAR_THEME_PROVIDER, { optional: true });
105
+ private themeService = inject(DasarThemeService, { optional: true });
106
+ private cdr = inject(ChangeDetectorRef);
107
+ private elementRef = inject(ElementRef);
108
+
109
+ @ContentChild(DasarDatepickerExtraHeaderSlot) extraHeaderSlot?: DasarDatepickerExtraHeaderSlot;
110
+ @ContentChild(DasarDatepickerExtraFooterSlot) extraFooterSlot?: DasarDatepickerExtraFooterSlot;
111
+ @ContentChild(DasarDatepickerExtraLabelSlot) extraLabelSlot?: DasarDatepickerExtraLabelSlot;
112
+ @ContentChild(DasarDatepickerLabelSlot) labelSlot?: DasarDatepickerLabelSlot;
113
+ @ContentChild(DasarDatepickerHintSlot) hintSlot?: DasarDatepickerHintSlot;
114
+ @ContentChild(DasarDatepickerPrefixSlot) prefixSlot?: DasarDatepickerPrefixSlot;
115
+
116
+ @ViewChild('triggerElement') triggerEl?: ElementRef<HTMLElement>;
117
+ @ViewChild('dropdownElement') dropdownEl?: ElementRef<HTMLElement>;
118
+
119
+ @Input({ alias: 'display-format' }) displayFormat = resolveThemeDefault(
120
+ 'datepicker',
121
+ 'displayFormat',
122
+ 'DD-MM-YYYY',
123
+ this.themeProvider,
124
+ this.themeService,
125
+ );
126
+ @Input({ alias: 'value-format' }) valueFormat = resolveThemeDefault(
127
+ 'datepicker',
128
+ 'valueFormat',
129
+ 'yyyy-MM-dd',
130
+ this.themeProvider,
131
+ this.themeService,
132
+ );
133
+ @Input() locale = resolveThemeDefault(
134
+ 'datepicker',
135
+ 'locale',
136
+ 'en-US',
137
+ this.themeProvider,
138
+ this.themeService,
139
+ );
140
+ private _placement: DasarDatepickerPlacement = resolveThemeDefault(
141
+ 'datepicker',
142
+ 'placement',
143
+ 'bottom-start',
144
+ this.themeProvider,
145
+ this.themeService,
146
+ );
147
+ @Input()
148
+ set placement(value: DasarDatepickerPlacement) {
149
+ this._placement = value;
150
+ this.currentPlacement = value;
151
+ }
152
+ get placement(): DasarDatepickerPlacement {
153
+ return this._placement;
154
+ }
155
+ currentPlacement: DasarDatepickerPlacement = this._placement;
156
+ @Input() appearance = resolveThemeDefault(
157
+ 'datepicker',
158
+ 'appearance',
159
+ 'outline',
160
+ this.themeProvider,
161
+ this.themeService,
162
+ );
163
+ @Input() radius = resolveThemeDefault(
164
+ 'datepicker',
165
+ 'radius',
166
+ 'md',
167
+ this.themeProvider,
168
+ this.themeService,
169
+ );
170
+ @Input() type = resolveThemeDefault(
171
+ 'datepicker',
172
+ 'type',
173
+ 'date',
174
+ this.themeProvider,
175
+ this.themeService,
176
+ );
177
+ @Input() size = resolveThemeDefault(
178
+ 'datepicker',
179
+ 'size',
180
+ 'md',
181
+ this.themeProvider,
182
+ this.themeService,
183
+ );
184
+ @Input() placeholder = resolveThemeDefault(
185
+ 'datepicker',
186
+ 'placeholder',
187
+ 'Select date',
188
+ this.themeProvider,
189
+ this.themeService,
190
+ );
191
+ @Input() label = resolveThemeDefault(
192
+ 'datepicker',
193
+ 'label',
194
+ undefined,
195
+ this.themeProvider,
196
+ this.themeService,
197
+ );
198
+ @Input({ alias: 'extra-label' }) extraLabel = resolveThemeDefault(
199
+ 'datepicker',
200
+ 'extraLabel',
201
+ undefined,
202
+ this.themeProvider,
203
+ this.themeService,
204
+ );
205
+ @Input() hint = resolveThemeDefault(
206
+ 'datepicker',
207
+ 'hint',
208
+ undefined,
209
+ this.themeProvider,
210
+ this.themeService,
211
+ );
212
+ @Input({ alias: 'container-class' }) containerClass = resolveThemeDefault(
213
+ 'datepicker',
214
+ 'containerClass',
215
+ null,
216
+ this.themeProvider,
217
+ this.themeService,
218
+ );
219
+ @Input({ alias: 'wrapper-class' }) wrapperClass = resolveThemeDefault(
220
+ 'datepicker',
221
+ 'wrapperClass',
222
+ null,
223
+ this.themeProvider,
224
+ this.themeService,
225
+ );
226
+ @Input({ alias: 'trigger-class' }) triggerClass = resolveThemeDefault(
227
+ 'datepicker',
228
+ 'triggerClass',
229
+ null,
230
+ this.themeProvider,
231
+ this.themeService,
232
+ );
233
+ @Input({ alias: 'dropdown-class' }) dropdownClass = resolveThemeDefault(
234
+ 'datepicker',
235
+ 'dropdownClass',
236
+ null,
237
+ this.themeProvider,
238
+ this.themeService,
239
+ );
240
+ @Input({ alias: 'label-wrapper-class' }) labelWrapperClass = resolveThemeDefault(
241
+ 'datepicker',
242
+ 'labelWrapperClass',
243
+ null,
244
+ this.themeProvider,
245
+ this.themeService,
246
+ );
247
+ @Input({ alias: 'hint-wrapper-class' }) hintWrapperClass = resolveThemeDefault(
248
+ 'datepicker',
249
+ 'hintWrapperClass',
250
+ null,
251
+ this.themeProvider,
252
+ this.themeService,
253
+ );
254
+ @Input({ alias: 'container-style' }) containerStyle = resolveThemeDefault(
255
+ 'datepicker',
256
+ 'containerStyle',
257
+ null,
258
+ this.themeProvider,
259
+ this.themeService,
260
+ );
261
+ @Input({ alias: 'wrapper-style' }) wrapperStyle = resolveThemeDefault(
262
+ 'datepicker',
263
+ 'wrapperStyle',
264
+ null,
265
+ this.themeProvider,
266
+ this.themeService,
267
+ );
268
+ @Input({ alias: 'trigger-style' }) triggerStyle = resolveThemeDefault(
269
+ 'datepicker',
270
+ 'triggerStyle',
271
+ null,
272
+ this.themeProvider,
273
+ this.themeService,
274
+ );
275
+ @Input({ alias: 'dropdown-style' }) dropdownStyle = resolveThemeDefault(
276
+ 'datepicker',
277
+ 'dropdownStyle',
278
+ null,
279
+ this.themeProvider,
280
+ this.themeService,
281
+ );
282
+ @Input({ alias: 'label-wrapper-style' }) labelWrapperStyle = resolveThemeDefault(
283
+ 'datepicker',
284
+ 'labelWrapperStyle',
285
+ null,
286
+ this.themeProvider,
287
+ this.themeService,
288
+ );
289
+ @Input({ alias: 'hint-wrapper-style' }) hintWrapperStyle = resolveThemeDefault(
290
+ 'datepicker',
291
+ 'hintWrapperStyle',
292
+ null,
293
+ this.themeProvider,
294
+ this.themeService,
295
+ );
296
+ @Input({ alias: 'full-width', transform: booleanAttribute }) fullWidth = resolveThemeDefault(
297
+ 'datepicker',
298
+ 'fullWidth',
299
+ false,
300
+ this.themeProvider,
301
+ this.themeService,
302
+ );
303
+ @Input({ transform: booleanAttribute }) clearable = resolveThemeDefault(
304
+ 'datepicker',
305
+ 'clearable',
306
+ false,
307
+ this.themeProvider,
308
+ this.themeService,
309
+ );
310
+ @Input({ transform: booleanAttribute }) disabled = resolveThemeDefault(
311
+ 'datepicker',
312
+ 'disabled',
313
+ false,
314
+ this.themeProvider,
315
+ this.themeService,
316
+ );
317
+ @Input({ transform: booleanAttribute }) fluid = resolveThemeDefault(
318
+ 'datepicker',
319
+ 'fluid',
320
+ false,
321
+ this.themeProvider,
322
+ this.themeService,
323
+ );
324
+ @Input({ transform: booleanAttribute }) error = resolveThemeDefault(
325
+ 'datepicker',
326
+ 'error',
327
+ false,
328
+ this.themeProvider,
329
+ this.themeService,
330
+ );
331
+
332
+ @Output() valueChange = new EventEmitter<any>();
333
+ @Output() onDateSelected = new EventEmitter<any>();
334
+ @Output() onInitialized = new EventEmitter<void>();
335
+ @Output() onClickIn = new EventEmitter<Event>();
336
+ @Output() onClickOut = new EventEmitter<Event>();
337
+
338
+ @Output() onNextMonthClick = new EventEmitter<void>();
339
+ @Output() onPrevMonthClick = new EventEmitter<void>();
340
+ @Output() onNextYearClick = new EventEmitter<void>();
341
+ @Output() onPrevYearClick = new EventEmitter<void>();
342
+
343
+ @Output() onCleared = new EventEmitter<void>();
344
+ @Output() onCouched = new EventEmitter<void>();
345
+ @Output() onFocus = new EventEmitter<Event | void>();
346
+ @Output() onBlur = new EventEmitter<Event | void>();
347
+
348
+ @HostBinding('class.dasar-datepicker') readonly baseClass = true;
349
+ @HostBinding('class.full-width') get hasFullWidth(): boolean {
350
+ return this.fullWidth;
351
+ }
352
+ @HostBinding('class.disabled') get isDisabled(): boolean {
353
+ return this.disabled;
354
+ }
355
+
356
+ private _value: any = null;
357
+ internalDate: Date | null = null;
358
+ isOpen: boolean = false;
359
+ private isFocused: boolean = false;
360
+
361
+ @Input()
362
+ get value(): any {
363
+ return this._value;
364
+ }
365
+ set value(val: any) {
366
+ if (this._value !== val) {
367
+ this._value = val ?? null;
368
+ this.syncInternalDate();
369
+ this.cdr.markForCheck();
370
+ }
371
+ }
372
+
373
+ onTouched: any = () => {};
374
+ onChange: any = () => {};
375
+
376
+ ngOnInit() {
377
+ this.syncInternalDate();
378
+ this.onInitialized.emit();
379
+ }
380
+
381
+ get hasLabelRow(): boolean {
382
+ return !!(this.label || this.labelSlot || this.extraLabel || this.extraLabelSlot);
383
+ }
384
+ get hasHintRow(): boolean {
385
+ return !!(this.hint || this.hintSlot);
386
+ }
387
+ get formattedDisplay(): string {
388
+ if (!this.internalDate || isNaN(this.internalDate.getTime())) return '';
389
+ try {
390
+ const formatToUse = () => {
391
+ return this.displayFormat;
392
+ };
393
+ return safeFormat(this.internalDate, formatToUse(), this.locale);
394
+ } catch {
395
+ return this.internalDate.toDateString();
396
+ }
397
+ }
398
+
399
+ writeValue(value: any): void {
400
+ if (this._value === value) return;
401
+ this._value = value ?? null;
402
+ this.syncInternalDate();
403
+ this.cdr.markForCheck();
404
+ }
405
+ registerOnChange(fn: any): void {
406
+ this.onChange = fn;
407
+ }
408
+ registerOnTouched(fn: any): void {
409
+ this.onTouched = fn;
410
+ }
411
+ setDisabledState(isDisabled: boolean): void {
412
+ this.disabled = isDisabled;
413
+ this.cdr.detectChanges();
414
+ }
415
+
416
+ @HostListener('document:click', ['$event'])
417
+ onClickOutside(event: Event) {
418
+ if (this.isOpen && !this.elementRef.nativeElement.contains(event.target)) {
419
+ this.isOpen = false;
420
+ this.onClickOut.emit(event);
421
+ this.setFocus(false, event);
422
+ }
423
+ }
424
+ private syncInternalDate() {
425
+ if (!this._value) {
426
+ this.internalDate = null;
427
+ return;
428
+ }
429
+ this.internalDate = new Date(this._value);
430
+ }
431
+ private setFocus(state: boolean, event?: Event) {
432
+ if (this.disabled) return;
433
+ if (state !== this.isFocused) {
434
+ this.isFocused = state;
435
+ if (state) {
436
+ this.onFocus.emit(event);
437
+ } else {
438
+ this.onBlur.emit(event);
439
+ this.onTouched();
440
+ this.onTouched.emit();
441
+ }
442
+ }
443
+ }
444
+ get iconSize(): number {
445
+ return fieldIconSize(this.size);
446
+ }
447
+
448
+ toggleDropdown(event: Event) {
449
+ if (this.disabled) return;
450
+ this.isOpen = !this.isOpen;
451
+
452
+ if (this.isOpen) {
453
+ this.onClickIn.emit(event);
454
+ this.setFocus(true, event);
455
+ this.currentPlacement = this.placement;
456
+ setTimeout(() => this.calculateSmartPlacement(), 0);
457
+ } else {
458
+ this.onClickOut.emit(event);
459
+ this.setFocus(false, event);
460
+ }
461
+ }
462
+ @HostListener('window:resize')
463
+ @HostListener('window:scroll')
464
+ onViewportChange() {
465
+ if (this.isOpen) this.calculateSmartPlacement();
466
+ }
467
+ clearValue(event: Event) {
468
+ event.stopPropagation();
469
+ if (this.disabled) return;
470
+ this._value = null;
471
+ this.internalDate = null;
472
+ this.onChange(null);
473
+ this.valueChange.emit(null);
474
+ this.onCleared.emit();
475
+ this.setFocus(true, event);
476
+ this.cdr.markForCheck();
477
+ }
478
+ onCalendarSelect(date: Date | null) {
479
+ if (!date) return;
480
+ this.internalDate = date;
481
+
482
+ const returnValue = this.formatReturnValue(date);
483
+ this._value = returnValue;
484
+
485
+ this.onChange(returnValue);
486
+ this.valueChange.emit(returnValue);
487
+ this.onDateSelected.emit(returnValue);
488
+
489
+ if (this.type === 'date') {
490
+ this.isOpen = false;
491
+ this.setFocus(false);
492
+ }
493
+ this.cdr.detectChanges();
494
+ }
495
+ private formatReturnValue(date: Date): any {
496
+ if (!this.valueFormat) return date;
497
+ if (this.valueFormat === 'timestamp') return date.getTime();
498
+ if (this.valueFormat === 'iso') return date.toISOString();
499
+ try {
500
+ return safeFormat(date, this.valueFormat, this.locale);
501
+ } catch {
502
+ return date;
503
+ }
504
+ }
505
+ private calculateSmartPlacement() {
506
+ if (!this.triggerEl?.nativeElement || !this.dropdownEl?.nativeElement) return;
507
+ const newPlacement = computeSmartPlacement(
508
+ this.triggerEl.nativeElement,
509
+ this.dropdownEl.nativeElement,
510
+ this.placement,
511
+ );
512
+ if (this.currentPlacement !== newPlacement) {
513
+ this.currentPlacement = newPlacement;
514
+ this.cdr.detectChanges();
515
+ }
516
+ }
517
+ }
518
+
519
+ export const DasarDatepickerComponent = [
520
+ DasarDatepicker,
521
+ DasarDatepickerLabelSlot,
522
+ DasarDatepickerExtraLabelSlot,
523
+ DasarDatepickerExtraHeaderSlot,
524
+ DasarDatepickerExtraFooterSlot,
525
+ DasarDatepickerHintSlot,
526
+ DasarDatepickerPrefixSlot,
527
+ ] as const;
@@ -0,0 +1 @@
1
+ <span class="dasar-icon" [class.fluid]="fluid" [innerHTML]="svgContent"></span>