dasar-ui 1.1.0 → 1.5.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 (294) hide show
  1. package/.dockerignore +31 -0
  2. package/.github/workflows/npm-publish-github-packages.yml +36 -0
  3. package/.versionrc.json +4 -0
  4. package/CHANGELOG.md +30 -0
  5. package/Dockerfile +26 -0
  6. package/angular.json +77 -0
  7. package/package.json +38 -24
  8. package/projects/dasar-ui/package.json +1 -1
  9. package/projects/dasar-ui/src/lib/components/dasar-button-group/dasar-button-group.ts +3 -7
  10. package/projects/dasar-ui/src/lib/components/dasar-calendar/dasar-calendar.ts +1 -1
  11. package/projects/dasar-ui/src/lib/components/dasar-card/dasar-card.ts +2 -2
  12. package/projects/dasar-ui/src/lib/components/dasar-chip/dasar-chip.ts +0 -2
  13. package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.html +11 -2
  14. package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.scss +30 -0
  15. package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.spec.ts +78 -6
  16. package/projects/dasar-ui/src/lib/components/dasar-datepicker/dasar-datepicker.ts +32 -32
  17. package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.registry.ts +0 -2
  18. package/projects/dasar-ui/src/lib/components/dasar-icon/dasar-icon.ts +1 -1
  19. package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.scss +0 -30
  20. package/projects/dasar-ui/src/lib/components/dasar-input/dasar-input.ts +0 -4
  21. package/projects/dasar-ui/src/lib/components/dasar-list/dasar-list-item.html +17 -0
  22. package/projects/dasar-ui/src/lib/components/dasar-list/dasar-list.html +25 -0
  23. package/projects/dasar-ui/src/lib/components/dasar-list/dasar-list.scss +122 -0
  24. package/projects/dasar-ui/src/lib/components/dasar-list/dasar-list.spec.ts +21 -0
  25. package/projects/dasar-ui/src/lib/components/dasar-list/dasar-list.ts +166 -0
  26. package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.html +6 -5
  27. package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.scss +39 -5
  28. package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.spec.ts +78 -6
  29. package/projects/dasar-ui/src/lib/components/dasar-menu/dasar-menu.ts +41 -3
  30. package/projects/dasar-ui/src/lib/components/dasar-modal/dasar-modal.html +72 -0
  31. package/projects/dasar-ui/src/lib/components/dasar-modal/dasar-modal.scss +170 -0
  32. package/projects/dasar-ui/src/lib/components/dasar-modal/dasar-modal.spec.ts +267 -0
  33. package/projects/dasar-ui/src/lib/components/dasar-modal/dasar-modal.ts +305 -0
  34. package/projects/dasar-ui/src/lib/components/dasar-number-input/dasar-number-input.scss +2 -7
  35. package/projects/dasar-ui/src/lib/components/dasar-overlay/dasar-overlay.html +11 -0
  36. package/projects/dasar-ui/src/lib/components/dasar-overlay/dasar-overlay.scss +18 -0
  37. package/projects/dasar-ui/src/lib/components/dasar-overlay/dasar-overlay.spec.ts +104 -0
  38. package/projects/dasar-ui/src/lib/components/dasar-overlay/dasar-overlay.ts +87 -0
  39. package/projects/dasar-ui/src/lib/components/dasar-pagination/dasar-pagination.ts +1 -1
  40. package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.html +1 -14
  41. package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.scss +0 -11
  42. package/projects/dasar-ui/src/lib/components/dasar-pivot-table/dasar-pivot-table.ts +0 -2
  43. package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.html +9 -5
  44. package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.scss +62 -22
  45. package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.spec.ts +82 -6
  46. package/projects/dasar-ui/src/lib/components/dasar-select/dasar-select.ts +47 -4
  47. package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.html +92 -30
  48. package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.scss +137 -25
  49. package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.spec.ts +554 -5
  50. package/projects/dasar-ui/src/lib/components/dasar-tabs/dasar-tabs.ts +312 -35
  51. package/projects/dasar-ui/src/lib/components/dasar-theme-provider/dasar-theme-provider.ts +6 -21
  52. package/projects/dasar-ui/src/lib/models/theme.model.ts +35 -12
  53. package/projects/dasar-ui/src/lib/services/theme.service.spec.ts +65 -0
  54. package/projects/dasar-ui/src/lib/services/theme.service.ts +68 -4
  55. package/projects/dasar-ui/src/lib/styles/theme.scss +47 -48
  56. package/projects/dasar-ui/src/lib/utils/common.ts +5 -24
  57. package/projects/dasar-ui/src/lib/utils/icon-size.spec.ts +23 -0
  58. package/projects/dasar-ui/src/lib/utils/icon-size.ts +16 -0
  59. package/projects/dasar-ui/src/lib/utils/panel-placement.spec.ts +90 -0
  60. package/projects/dasar-ui/src/lib/utils/panel-placement.ts +53 -0
  61. package/projects/dasar-ui/src/public-api.ts +4 -4
  62. package/projects/dasar-ui/tsconfig.spec.json +8 -1
  63. package/projects/documentation/public/favicon.ico +0 -0
  64. package/projects/documentation/src/app/app.html +51 -0
  65. package/projects/documentation/src/app/app.spec.ts +23 -0
  66. package/projects/documentation/src/app/app.ts +23 -0
  67. package/projects/documentation/src/app/components/doc-customize-modal.component.ts +314 -0
  68. package/projects/documentation/src/app/components/doc-example.component.ts +195 -0
  69. package/projects/documentation/src/app/config/app.config.server.ts +10 -0
  70. package/projects/documentation/src/app/config/app.config.ts +17 -0
  71. package/projects/documentation/src/app/layouts/doc.layout.ts +229 -0
  72. package/projects/documentation/src/app/pages/button/button.page.html +65 -0
  73. package/projects/documentation/src/app/pages/button/button.page.ts +139 -0
  74. package/projects/documentation/src/app/pages/button/examples/appearance/button-appearance.example.html +7 -0
  75. package/projects/documentation/src/app/pages/button/examples/appearance/button-appearance.example.ts +10 -0
  76. package/projects/documentation/src/app/pages/button/examples/icon/button-icon.example.html +19 -0
  77. package/projects/documentation/src/app/pages/button/examples/icon/button-icon.example.ts +10 -0
  78. package/projects/documentation/src/app/pages/button/examples/radius/button-radius.example.html +9 -0
  79. package/projects/documentation/src/app/pages/button/examples/radius/button-radius.example.ts +10 -0
  80. package/projects/documentation/src/app/pages/button/examples/sizes/button-sizes.example.html +7 -0
  81. package/projects/documentation/src/app/pages/button/examples/sizes/button-sizes.example.ts +10 -0
  82. package/projects/documentation/src/app/pages/button/examples/state/button-state.example.html +10 -0
  83. package/projects/documentation/src/app/pages/button/examples/state/button-state.example.ts +10 -0
  84. package/projects/documentation/src/app/pages/button/examples/variant/button-variant.example.html +9 -0
  85. package/projects/documentation/src/app/pages/button/examples/variant/button-variant.example.ts +10 -0
  86. package/projects/documentation/src/app/pages/calendar/calendar.page.html +75 -0
  87. package/projects/documentation/src/app/pages/calendar/calendar.page.ts +165 -0
  88. package/projects/documentation/src/app/pages/calendar/examples/actions/calendar-actions.example.html +21 -0
  89. package/projects/documentation/src/app/pages/calendar/examples/actions/calendar-actions.example.ts +10 -0
  90. package/projects/documentation/src/app/pages/calendar/examples/basic/calendar-basic.example.html +11 -0
  91. package/projects/documentation/src/app/pages/calendar/examples/basic/calendar-basic.example.ts +13 -0
  92. package/projects/documentation/src/app/pages/calendar/examples/custom-header/calendar-custom-header.example.html +36 -0
  93. package/projects/documentation/src/app/pages/calendar/examples/custom-header/calendar-custom-header.example.ts +11 -0
  94. package/projects/documentation/src/app/pages/calendar/examples/dropdown/calendar-dropdown.example.html +10 -0
  95. package/projects/documentation/src/app/pages/calendar/examples/dropdown/calendar-dropdown.example.ts +12 -0
  96. package/projects/documentation/src/app/pages/calendar/examples/format/calendar-format.example.html +15 -0
  97. package/projects/documentation/src/app/pages/calendar/examples/format/calendar-format.example.ts +12 -0
  98. package/projects/documentation/src/app/pages/calendar/examples/locale/calendar-locale.example.html +34 -0
  99. package/projects/documentation/src/app/pages/calendar/examples/locale/calendar-locale.example.ts +14 -0
  100. package/projects/documentation/src/app/pages/calendar/examples/more/calendar.more.example.html +20 -0
  101. package/projects/documentation/src/app/pages/calendar/examples/more/calendar.more.example.ts +37 -0
  102. package/projects/documentation/src/app/pages/calendar/examples/styles/calendar-styles.example.html +16 -0
  103. package/projects/documentation/src/app/pages/calendar/examples/styles/calendar-styles.example.ts +10 -0
  104. package/projects/documentation/src/app/pages/card/card.page.html +75 -0
  105. package/projects/documentation/src/app/pages/card/card.page.ts +182 -0
  106. package/projects/documentation/src/app/pages/card/examples/appearance/card-appearance.example.html +13 -0
  107. package/projects/documentation/src/app/pages/card/examples/appearance/card-appearance.example.ts +10 -0
  108. package/projects/documentation/src/app/pages/card/examples/closable/card-closable.example.html +30 -0
  109. package/projects/documentation/src/app/pages/card/examples/closable/card-closable.example.ts +19 -0
  110. package/projects/documentation/src/app/pages/card/examples/custom-style/card-custom-style.example.html +173 -0
  111. package/projects/documentation/src/app/pages/card/examples/custom-style/card-custom-style.example.ts +10 -0
  112. package/projects/documentation/src/app/pages/card/examples/media/card-media.example.html +27 -0
  113. package/projects/documentation/src/app/pages/card/examples/media/card-media.example.ts +10 -0
  114. package/projects/documentation/src/app/pages/card/examples/radius/card-radius.example.html +13 -0
  115. package/projects/documentation/src/app/pages/card/examples/radius/card-radius.example.ts +10 -0
  116. package/projects/documentation/src/app/pages/card/examples/slots/card-slots.example.html +20 -0
  117. package/projects/documentation/src/app/pages/card/examples/slots/card-slots.example.ts +10 -0
  118. package/projects/documentation/src/app/pages/card/examples/spacing/card-spacing.example.html +11 -0
  119. package/projects/documentation/src/app/pages/card/examples/spacing/card-spacing.example.ts +10 -0
  120. package/projects/documentation/src/app/pages/chip/chip.page.html +55 -0
  121. package/projects/documentation/src/app/pages/chip/chip.page.ts +158 -0
  122. package/projects/documentation/src/app/pages/chip/examples/appearance/chip-appearance.example.html +7 -0
  123. package/projects/documentation/src/app/pages/chip/examples/appearance/chip-appearance.example.ts +10 -0
  124. package/projects/documentation/src/app/pages/chip/examples/more/chip-more.example.html +13 -0
  125. package/projects/documentation/src/app/pages/chip/examples/more/chip-more.example.ts +17 -0
  126. package/projects/documentation/src/app/pages/chip/examples/radius/chip-radius.example.html +9 -0
  127. package/projects/documentation/src/app/pages/chip/examples/radius/chip-radius.example.ts +10 -0
  128. package/projects/documentation/src/app/pages/chip/examples/sizes/chip-sizes.example.html +6 -0
  129. package/projects/documentation/src/app/pages/chip/examples/sizes/chip-sizes.example.ts +10 -0
  130. package/projects/documentation/src/app/pages/chip/examples/variant/chip-variant.example.html +8 -0
  131. package/projects/documentation/src/app/pages/chip/examples/variant/chip-variant.example.ts +10 -0
  132. package/projects/documentation/src/app/pages/datepicker/datepicker.page.html +75 -0
  133. package/projects/documentation/src/app/pages/datepicker/datepicker.page.ts +181 -0
  134. package/projects/documentation/src/app/pages/datepicker/examples/appearance/datepicker-appearance.example.html +29 -0
  135. package/projects/documentation/src/app/pages/datepicker/examples/appearance/datepicker-appearance.example.ts +10 -0
  136. package/projects/documentation/src/app/pages/datepicker/examples/basic/datepicker-basic.example.html +12 -0
  137. package/projects/documentation/src/app/pages/datepicker/examples/basic/datepicker-basic.example.ts +12 -0
  138. package/projects/documentation/src/app/pages/datepicker/examples/footer/datepicker-footer.example.html +23 -0
  139. package/projects/documentation/src/app/pages/datepicker/examples/footer/datepicker-footer.example.ts +17 -0
  140. package/projects/documentation/src/app/pages/datepicker/examples/format/datepicker-format.example.html +30 -0
  141. package/projects/documentation/src/app/pages/datepicker/examples/format/datepicker-format.example.ts +13 -0
  142. package/projects/documentation/src/app/pages/datepicker/examples/placement/datepicker-placement.example.html +24 -0
  143. package/projects/documentation/src/app/pages/datepicker/examples/placement/datepicker-placement.example.ts +10 -0
  144. package/projects/documentation/src/app/pages/datepicker/examples/slots/datepicker-slots.example.html +19 -0
  145. package/projects/documentation/src/app/pages/datepicker/examples/slots/datepicker-slots.example.ts +10 -0
  146. package/projects/documentation/src/app/pages/datepicker/examples/states/datepicker-states.example.html +28 -0
  147. package/projects/documentation/src/app/pages/datepicker/examples/states/datepicker-states.example.ts +12 -0
  148. package/projects/documentation/src/app/pages/icon/icon.page.html +15 -0
  149. package/projects/documentation/src/app/pages/icon/icon.page.ts +60 -0
  150. package/projects/documentation/src/app/pages/input/examples/appearance/input-appearance.example.html +27 -0
  151. package/projects/documentation/src/app/pages/input/examples/appearance/input-appearance.example.ts +10 -0
  152. package/projects/documentation/src/app/pages/input/examples/basic/input-basic.example.html +13 -0
  153. package/projects/documentation/src/app/pages/input/examples/basic/input-basic.example.ts +13 -0
  154. package/projects/documentation/src/app/pages/input/examples/mask/input-mask.example.html +31 -0
  155. package/projects/documentation/src/app/pages/input/examples/mask/input-mask.example.ts +19 -0
  156. package/projects/documentation/src/app/pages/input/examples/more/input-more.example.html +68 -0
  157. package/projects/documentation/src/app/pages/input/examples/more/input-more.example.ts +18 -0
  158. package/projects/documentation/src/app/pages/input/examples/slots/input-slots.example.html +52 -0
  159. package/projects/documentation/src/app/pages/input/examples/slots/input-slots.example.ts +10 -0
  160. package/projects/documentation/src/app/pages/input/examples/states/input-states.example.html +29 -0
  161. package/projects/documentation/src/app/pages/input/examples/states/input-states.example.ts +10 -0
  162. package/projects/documentation/src/app/pages/input/input.page.html +65 -0
  163. package/projects/documentation/src/app/pages/input/input.page.ts +170 -0
  164. package/projects/documentation/src/app/pages/menu/examples/basic/menu-basic.example.html +5 -0
  165. package/projects/documentation/src/app/pages/menu/examples/basic/menu-basic.example.ts +17 -0
  166. package/projects/documentation/src/app/pages/menu/examples/custom-template/menu-custom-template.example.html +35 -0
  167. package/projects/documentation/src/app/pages/menu/examples/custom-template/menu-custom-template.example.ts +57 -0
  168. package/projects/documentation/src/app/pages/menu/examples/placement/menu-placement.example.html +12 -0
  169. package/projects/documentation/src/app/pages/menu/examples/placement/menu-placement.example.ts +16 -0
  170. package/projects/documentation/src/app/pages/menu/menu.page.html +35 -0
  171. package/projects/documentation/src/app/pages/menu/menu.page.ts +149 -0
  172. package/projects/documentation/src/app/pages/modal/examples/appearance/modal-appearance.example.html +18 -0
  173. package/projects/documentation/src/app/pages/modal/examples/appearance/modal-appearance.example.ts +21 -0
  174. package/projects/documentation/src/app/pages/modal/examples/basic/modal-basic.example.html +8 -0
  175. package/projects/documentation/src/app/pages/modal/examples/basic/modal-basic.example.ts +12 -0
  176. package/projects/documentation/src/app/pages/modal/examples/close-behavior/modal-close-behavior.example.html +44 -0
  177. package/projects/documentation/src/app/pages/modal/examples/close-behavior/modal-close-behavior.example.ts +14 -0
  178. package/projects/documentation/src/app/pages/modal/examples/custom-style/modal-custom-style.example.html +36 -0
  179. package/projects/documentation/src/app/pages/modal/examples/custom-style/modal-custom-style.example.ts +12 -0
  180. package/projects/documentation/src/app/pages/modal/examples/overlay/modal-overlay.example.html +29 -0
  181. package/projects/documentation/src/app/pages/modal/examples/overlay/modal-overlay.example.ts +14 -0
  182. package/projects/documentation/src/app/pages/modal/examples/radius-spacing/modal-radius-spacing.example.html +27 -0
  183. package/projects/documentation/src/app/pages/modal/examples/radius-spacing/modal-radius-spacing.example.ts +27 -0
  184. package/projects/documentation/src/app/pages/modal/examples/scroll/modal-scroll.example.html +14 -0
  185. package/projects/documentation/src/app/pages/modal/examples/scroll/modal-scroll.example.ts +13 -0
  186. package/projects/documentation/src/app/pages/modal/examples/size/modal-size.example.html +17 -0
  187. package/projects/documentation/src/app/pages/modal/examples/size/modal-size.example.ts +21 -0
  188. package/projects/documentation/src/app/pages/modal/examples/slots/modal-slots.example.html +30 -0
  189. package/projects/documentation/src/app/pages/modal/examples/slots/modal-slots.example.ts +12 -0
  190. package/projects/documentation/src/app/pages/modal/examples/width/modal-width.example.html +23 -0
  191. package/projects/documentation/src/app/pages/modal/examples/width/modal-width.example.ts +13 -0
  192. package/projects/documentation/src/app/pages/modal/modal.page.html +105 -0
  193. package/projects/documentation/src/app/pages/modal/modal.page.ts +257 -0
  194. package/projects/documentation/src/app/pages/number-input/examples/appearance/number-input-appearance.example.html +30 -0
  195. package/projects/documentation/src/app/pages/number-input/examples/appearance/number-input-appearance.example.ts +10 -0
  196. package/projects/documentation/src/app/pages/number-input/examples/basic/number-input-basic.example.html +12 -0
  197. package/projects/documentation/src/app/pages/number-input/examples/basic/number-input-basic.example.ts +13 -0
  198. package/projects/documentation/src/app/pages/number-input/examples/limits/number-input-limits.example.html +30 -0
  199. package/projects/documentation/src/app/pages/number-input/examples/limits/number-input-limits.example.ts +14 -0
  200. package/projects/documentation/src/app/pages/number-input/examples/slots/number-input-slots.example.html +49 -0
  201. package/projects/documentation/src/app/pages/number-input/examples/slots/number-input-slots.example.ts +10 -0
  202. package/projects/documentation/src/app/pages/number-input/examples/states/number-input-states.example.html +21 -0
  203. package/projects/documentation/src/app/pages/number-input/examples/states/number-input-states.example.ts +10 -0
  204. package/projects/documentation/src/app/pages/number-input/number-input.page.html +55 -0
  205. package/projects/documentation/src/app/pages/number-input/number-input.page.ts +142 -0
  206. package/projects/documentation/src/app/pages/select/examples/appearance/select-appearance.example.html +32 -0
  207. package/projects/documentation/src/app/pages/select/examples/appearance/select-appearance.example.ts +15 -0
  208. package/projects/documentation/src/app/pages/select/examples/basic/select-basic.example.html +13 -0
  209. package/projects/documentation/src/app/pages/select/examples/basic/select-basic.example.ts +20 -0
  210. package/projects/documentation/src/app/pages/select/examples/multiple/select-multiple.example.html +24 -0
  211. package/projects/documentation/src/app/pages/select/examples/multiple/select-multiple.example.ts +59 -0
  212. package/projects/documentation/src/app/pages/select/examples/placement/select-placement.example.html +20 -0
  213. package/projects/documentation/src/app/pages/select/examples/placement/select-placement.example.ts +20 -0
  214. package/projects/documentation/src/app/pages/select/examples/search/select-search.example.html +13 -0
  215. package/projects/documentation/src/app/pages/select/examples/search/select-search.example.ts +22 -0
  216. package/projects/documentation/src/app/pages/select/examples/slots/select-slots.example.html +44 -0
  217. package/projects/documentation/src/app/pages/select/examples/slots/select-slots.example.ts +15 -0
  218. package/projects/documentation/src/app/pages/select/examples/states/select-states.example.html +31 -0
  219. package/projects/documentation/src/app/pages/select/examples/states/select-states.example.ts +12 -0
  220. package/projects/documentation/src/app/pages/select/select.page.html +75 -0
  221. package/projects/documentation/src/app/pages/select/select.page.ts +195 -0
  222. package/projects/documentation/src/app/pages/table/examples/cell-actions/table-cell-actions.example.html +14 -0
  223. package/projects/documentation/src/app/pages/table/examples/cell-actions/table-cell-actions.example.ts +25 -0
  224. package/projects/documentation/src/app/pages/table/examples/cell-badge/table-cell-badge.example.html +12 -0
  225. package/projects/documentation/src/app/pages/table/examples/cell-badge/table-cell-badge.example.ts +21 -0
  226. package/projects/documentation/src/app/pages/table/examples/cell-profile/table-cell-profile.example.html +29 -0
  227. package/projects/documentation/src/app/pages/table/examples/cell-profile/table-cell-profile.example.ts +20 -0
  228. package/projects/documentation/src/app/pages/table/examples/custom-body/table-custom-body.example.html +39 -0
  229. package/projects/documentation/src/app/pages/table/examples/custom-body/table-custom-body.example.ts +21 -0
  230. package/projects/documentation/src/app/pages/table/examples/custom-sizes/table-custom-sizes.example.html +7 -0
  231. package/projects/documentation/src/app/pages/table/examples/custom-sizes/table-custom-sizes.example.ts +21 -0
  232. package/projects/documentation/src/app/pages/table/examples/dynamic-style/table-dynamic-style.example.html +3 -0
  233. package/projects/documentation/src/app/pages/table/examples/dynamic-style/table-dynamic-style.example.ts +41 -0
  234. package/projects/documentation/src/app/pages/table/examples/empty/table-empty.example.html +43 -0
  235. package/projects/documentation/src/app/pages/table/examples/empty/table-empty.example.ts +21 -0
  236. package/projects/documentation/src/app/pages/table/examples/expanded/table-expanded.example.html +36 -0
  237. package/projects/documentation/src/app/pages/table/examples/expanded/table-expanded.example.ts +34 -0
  238. package/projects/documentation/src/app/pages/table/examples/heatmap/table-heatmap.example.html +8 -0
  239. package/projects/documentation/src/app/pages/table/examples/heatmap/table-heatmap.example.ts +52 -0
  240. package/projects/documentation/src/app/pages/table/examples/inline-edit/table-inline-edit.example.html +53 -0
  241. package/projects/documentation/src/app/pages/table/examples/inline-edit/table-inline-edit.example.ts +50 -0
  242. package/projects/documentation/src/app/pages/table/examples/nested/table-nested.example.html +23 -0
  243. package/projects/documentation/src/app/pages/table/examples/nested/table-nested.example.ts +42 -0
  244. package/projects/documentation/src/app/pages/table/examples/pagination/table-pagination.example.html +20 -0
  245. package/projects/documentation/src/app/pages/table/examples/pagination/table-pagination.example.ts +21 -0
  246. package/projects/documentation/src/app/pages/table/table.page.html +125 -0
  247. package/projects/documentation/src/app/pages/table/table.page.ts +261 -0
  248. package/projects/documentation/src/app/pages/tabs/examples/advanced-dynamic/tabs-advanced-dynamic.example.html +13 -0
  249. package/projects/documentation/src/app/pages/tabs/examples/advanced-dynamic/tabs-advanced-dynamic.example.ts +27 -0
  250. package/projects/documentation/src/app/pages/tabs/examples/advanced-form/tabs-advanced-form.example.html +27 -0
  251. package/projects/documentation/src/app/pages/tabs/examples/advanced-form/tabs-advanced-form.example.ts +36 -0
  252. package/projects/documentation/src/app/pages/tabs/examples/advanced-theme/tabs-advanced-theme.example.html +5 -0
  253. package/projects/documentation/src/app/pages/tabs/examples/advanced-theme/tabs-advanced-theme.example.ts +20 -0
  254. package/projects/documentation/src/app/pages/tabs/examples/appearance/tabs-appearance.example.html +6 -0
  255. package/projects/documentation/src/app/pages/tabs/examples/appearance/tabs-appearance.example.ts +13 -0
  256. package/projects/documentation/src/app/pages/tabs/examples/basic/tabs-basic.example.html +13 -0
  257. package/projects/documentation/src/app/pages/tabs/examples/basic/tabs-basic.example.ts +13 -0
  258. package/projects/documentation/src/app/pages/tabs/examples/custom-style/tabs-custom-style.example.html +19 -0
  259. package/projects/documentation/src/app/pages/tabs/examples/custom-style/tabs-custom-style.example.ts +12 -0
  260. package/projects/documentation/src/app/pages/tabs/examples/events/tabs-events.example.html +16 -0
  261. package/projects/documentation/src/app/pages/tabs/examples/events/tabs-events.example.ts +23 -0
  262. package/projects/documentation/src/app/pages/tabs/examples/fluid/tabs-fluid.example.html +5 -0
  263. package/projects/documentation/src/app/pages/tabs/examples/fluid/tabs-fluid.example.ts +12 -0
  264. package/projects/documentation/src/app/pages/tabs/examples/no-body/tabs-no-body.example.html +6 -0
  265. package/projects/documentation/src/app/pages/tabs/examples/no-body/tabs-no-body.example.ts +12 -0
  266. package/projects/documentation/src/app/pages/tabs/examples/radius/tabs-radius.example.html +6 -0
  267. package/projects/documentation/src/app/pages/tabs/examples/radius/tabs-radius.example.ts +13 -0
  268. package/projects/documentation/src/app/pages/tabs/examples/scroll/tabs-scroll.example.html +20 -0
  269. package/projects/documentation/src/app/pages/tabs/examples/scroll/tabs-scroll.example.ts +30 -0
  270. package/projects/documentation/src/app/pages/tabs/examples/scroll-icon/tabs-scroll-icon.example.html +16 -0
  271. package/projects/documentation/src/app/pages/tabs/examples/scroll-icon/tabs-scroll-icon.example.ts +26 -0
  272. package/projects/documentation/src/app/pages/tabs/examples/scroll-slot/tabs-scroll-slot.example.html +22 -0
  273. package/projects/documentation/src/app/pages/tabs/examples/scroll-slot/tabs-scroll-slot.example.ts +26 -0
  274. package/projects/documentation/src/app/pages/tabs/examples/size/tabs-size.example.html +6 -0
  275. package/projects/documentation/src/app/pages/tabs/examples/size/tabs-size.example.ts +13 -0
  276. package/projects/documentation/src/app/pages/tabs/examples/slots/tabs-slots.example.html +25 -0
  277. package/projects/documentation/src/app/pages/tabs/examples/slots/tabs-slots.example.ts +10 -0
  278. package/projects/documentation/src/app/pages/tabs/examples/spacing/tabs-spacing.example.html +6 -0
  279. package/projects/documentation/src/app/pages/tabs/examples/spacing/tabs-spacing.example.ts +13 -0
  280. package/projects/documentation/src/app/pages/tabs/tabs.page.html +165 -0
  281. package/projects/documentation/src/app/pages/tabs/tabs.page.ts +340 -0
  282. package/projects/documentation/src/app/routes/app.routes.server.ts +8 -0
  283. package/projects/documentation/src/app/routes/app.routes.ts +87 -0
  284. package/projects/documentation/src/app/services/doc-customize.service.ts +107 -0
  285. package/projects/documentation/src/app/utils/highlight.pipe.ts +43 -0
  286. package/projects/documentation/src/index.html +13 -0
  287. package/projects/documentation/src/main.server.ts +7 -0
  288. package/projects/documentation/src/main.ts +5 -0
  289. package/projects/documentation/src/server.ts +47 -0
  290. package/projects/documentation/src/styles.scss +7 -0
  291. package/projects/documentation/tsconfig.app.json +11 -0
  292. package/projects/documentation/tsconfig.spec.json +10 -0
  293. package/tsconfig.json +6 -3
  294. package/.nvmrc +0 -1
@@ -10,8 +10,14 @@ import {
10
10
  DasarThemeSelect,
11
11
  DasarThemeCommon,
12
12
  DasarThemeMenu,
13
+ DasarThemeMode,
13
14
  } from '@models/theme.model';
14
- import { DASAR_THEME_PROVIDER } from '../components/dasar-theme-provider/dasar-theme-provider';
15
+ import {
16
+ DASAR_THEME_PROVIDER,
17
+ defaultDarkCommonTokens,
18
+ defaultLightCommonTokens,
19
+ } from '../components/dasar-theme-provider/dasar-theme-provider';
20
+ import { dasarVariables } from '../styles/theme';
15
21
  import {
16
22
  DOCUMENT,
17
23
  inject,
@@ -540,6 +546,59 @@ export const tableMap: Record<string, string> = {
540
546
  paginationBorder: '--table-pagination-border',
541
547
  paginationBackground: '--table-pagination-background',
542
548
  };
549
+ export const listMap: Record<string, string> = {
550
+ background: '--list-background',
551
+ color: '--list-color',
552
+ radius: '--list-radius',
553
+ border: '--list-border',
554
+ fontSizeSm: '--list-font-size-sm',
555
+ fontSizeMd: '--list-font-size-md',
556
+ fontSizeLg: '--list-font-size-lg',
557
+ divider: '--list-divider',
558
+ hoverBackground: '--list-hover-background',
559
+ activeBackground: '--list-active-background',
560
+ headerPadding: '--list-header-padding',
561
+ headerFontWeight: '--list-header-font-weight',
562
+ headerBorder: '--list-header-border',
563
+ headerBackground: '--list-header-background',
564
+ footerPadding: '--list-footer-padding',
565
+ footerFontSize: '--list-footer-font-size',
566
+ footerColor: '--list-footer-color',
567
+ footerBorder: '--list-footer-border',
568
+ footerBackground: '--list-footer-background',
569
+ itemPadding: '--list-item-padding',
570
+ prefixColor: '--list-prefix-color',
571
+ suffixColor: '--list-suffix-color',
572
+ };
573
+ function isPlainObject(value: unknown): value is Record<string, unknown> {
574
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
575
+ }
576
+
577
+ function deepMerge<T>(base: T, override: unknown): T {
578
+ if (!isPlainObject(base) || !isPlainObject(override)) {
579
+ return (override === undefined ? base : override) as T;
580
+ }
581
+ const result: Record<string, unknown> = { ...base };
582
+ for (const [key, value] of Object.entries(override)) {
583
+ if (value === undefined) continue;
584
+ const current = result[key];
585
+ result[key] =
586
+ isPlainObject(current) && isPlainObject(value) ? deepMerge(current, value) : value;
587
+ }
588
+ return result as T;
589
+ }
590
+
591
+ function buildDefaultThemeConfig(mode: DasarThemeMode = 'light'): DasarThemeConfig {
592
+ return {
593
+ mode,
594
+ colors: structuredClone(dasarVariables.colors) as DasarThemeColors,
595
+ components: {},
596
+ tokens: {
597
+ light: { common: { ...defaultLightCommonTokens } },
598
+ dark: { common: { ...defaultDarkCommonTokens } },
599
+ },
600
+ };
601
+ }
543
602
 
544
603
  @Injectable({
545
604
  providedIn: 'root',
@@ -556,14 +615,12 @@ export class DasarThemeService {
556
615
 
557
616
  constructor(rendererFactory: RendererFactory2) {
558
617
  this.renderer = rendererFactory.createRenderer(null, null);
559
- // Apply initial component configuration if provided via provider
560
618
  if (this.initialConfig) {
561
619
  this.setGlobalTheme(this.initialConfig);
562
620
  }
563
621
  }
564
622
 
565
623
  public setGlobalTheme(config: DasarThemeConfig, targetElement?: HTMLElement) {
566
- // Guard against SSR crashes when document is undefined on the server
567
624
  if (!isPlatformBrowser(this.platformId)) {
568
625
  this.themeState.next(config);
569
626
  return;
@@ -607,11 +664,18 @@ export class DasarThemeService {
607
664
  if (config.tokens?.[config.mode]?.table) {
608
665
  this.injectMappedTokens(root, config.tokens?.[config.mode]?.table, tableMap);
609
666
  }
610
- // Update TS State
667
+ if (config.tokens?.[config.mode]?.list) {
668
+ this.injectMappedTokens(root, config.tokens?.[config.mode]?.list, listMap);
669
+ }
611
670
  this.themeState.next(config);
612
671
  }
613
672
 
614
673
  public themeVariable(): DasarThemeConfig {
674
+ const raw = this.themeState.getValue();
675
+ return deepMerge(buildDefaultThemeConfig(raw.mode ?? 'light'), raw);
676
+ }
677
+
678
+ public rawThemeVariable(): DasarThemeConfig {
615
679
  return this.themeState.getValue();
616
680
  }
617
681
 
@@ -1,62 +1,61 @@
1
- // Fonts
2
1
  $dasar-font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
3
2
  $dasar-font-hero: 'Space Grotesk', sans-serif;
4
- // Font Weight
3
+
5
4
  $dasar-font-weight-thin: 300;
6
5
  $dasar-font-weight-regular: 400;
7
6
  $dasar-font-weight-medium: 500;
8
7
  $dasar-font-weight-semibold: 600;
9
8
  $dasar-font-weight-bold: 700;
10
- // Text
11
- $dasar-text-xss: 0.5rem; // 8px
12
- $dasar-text-xs: 0.625rem; // 10px
13
- $dasar-text-sm: 0.75rem; // 12px
14
- $dasar-text-base: 0.875rem; // 14px
15
- $dasar-text-lg: 1rem; // 16px
16
- $dasar-text-xl: 1.125rem; // 18px
9
+
10
+ $dasar-text-xss: 0.5rem;
11
+ $dasar-text-xs: 0.625rem;
12
+ $dasar-text-sm: 0.75rem;
13
+ $dasar-text-base: 0.875rem;
14
+ $dasar-text-lg: 1rem;
15
+ $dasar-text-xl: 1.125rem;
17
16
  $dasar-line-height-normal: 1.5;
18
17
  $dasar-line-height-tight: 1.25;
19
- // Breakpoints
20
- $breakpoint-sm: 40em; // 640px
21
- $breakpoint-md: 48em; // 768px
22
- $breakpoint-lg: 64em; // 1024px
23
- $breakpoint-xl: 75em; // 1200px
24
- // Border Radius (Using em to scale with component font-size)
18
+
19
+ $breakpoint-sm: 40em;
20
+ $breakpoint-md: 48em;
21
+ $breakpoint-lg: 64em;
22
+ $breakpoint-xl: 75em;
23
+
25
24
  $dasar-radius-none: 0;
26
- $dasar-radius-xxs: 0.125em; // 2px
27
- $dasar-radius-xs: 0.25em; // 4px
28
- $dasar-radius-sm: 0.375em; // 6px
29
- $dasar-radius-md: 0.5em; // 8px
30
- $dasar-radius-lg: 0.625em; // 10px
31
- $dasar-radius-xl: 0.75em; // 12px
32
- $dasar-radius-2xl: 1em; // 16px
33
- $dasar-radius-3xl: 1.25em; // 20px
34
- $dasar-radius-4xl: 1.5em; // 24px
35
- $dasar-radius-full: 9999px; // Pill shape
36
- // Spacing (Using em to scale with component font-size)
25
+ $dasar-radius-xxs: 0.125em;
26
+ $dasar-radius-xs: 0.25em;
27
+ $dasar-radius-sm: 0.375em;
28
+ $dasar-radius-md: 0.5em;
29
+ $dasar-radius-lg: 0.625em;
30
+ $dasar-radius-xl: 0.75em;
31
+ $dasar-radius-2xl: 1em;
32
+ $dasar-radius-3xl: 1.25em;
33
+ $dasar-radius-4xl: 1.5em;
34
+ $dasar-radius-full: 9999px;
35
+
37
36
  $dasar-space-0: 0;
38
- $dasar-space-0-5: 0.125em; // 2px
39
- $dasar-space-1: 0.25em; // 4px
40
- $dasar-space-base: 0.5em; // 8px
41
- $dasar-space-3: 0.75em; // 12px
42
- $dasar-space-4: 1em; // 16px
43
- $dasar-space-5: 1.25em; // 20px
44
- $dasar-space-6: 1.5em; // 24px
45
- $dasar-space-8: 2em; // 32px
46
- $dasar-space-10: 2.5em; // 40px
47
- $dasar-space-12: 3em; // 48px
48
- $dasar-space-16: 4em; // 64px
49
- $dasar-space-18: 5em; // 80px
50
- $dasar-space-24: 6em; // 96px
51
- $dasar-space-32: 8em; // 128px
52
- $dasar-space-40: 10em; // 160px
53
- $dasar-space-48: 12em; // 192px
54
- $dasar-space-56: 14em; // 224px
55
- $dasar-space-64: 16em; // 256px
56
- $dasar-space-80: 20em; // 320px
57
- $dasar-space-96: 24em; // 384px
58
- $dasar-space-120: 30em; // 480px
59
- // Colors
37
+ $dasar-space-0-5: 0.125em;
38
+ $dasar-space-1: 0.25em;
39
+ $dasar-space-base: 0.5em;
40
+ $dasar-space-3: 0.75em;
41
+ $dasar-space-4: 1em;
42
+ $dasar-space-5: 1.25em;
43
+ $dasar-space-6: 1.5em;
44
+ $dasar-space-8: 2em;
45
+ $dasar-space-10: 2.5em;
46
+ $dasar-space-12: 3em;
47
+ $dasar-space-16: 4em;
48
+ $dasar-space-18: 5em;
49
+ $dasar-space-24: 6em;
50
+ $dasar-space-32: 8em;
51
+ $dasar-space-40: 10em;
52
+ $dasar-space-48: 12em;
53
+ $dasar-space-56: 14em;
54
+ $dasar-space-64: 16em;
55
+ $dasar-space-80: 20em;
56
+ $dasar-space-96: 24em;
57
+ $dasar-space-120: 30em;
58
+
60
59
  $dasar-primary-900: #071727;
61
60
  $dasar-primary-800: #0d253f;
62
61
  $dasar-primary-700: #12345a;
@@ -7,24 +7,20 @@ export function parseClassesToArray(classes: ClassType): string[] {
7
7
  if (!classes) {
8
8
  return [];
9
9
  }
10
- // Handle String ("class1 class2")
11
10
  if (typeof classes === 'string') {
12
11
  return classes.split(/\s+/).filter(Boolean);
13
12
  }
14
- // Handle Array (["class1", "class2 class3"])
15
13
  if (Array.isArray(classes)) {
16
14
  return classes.flatMap((c) => c.split(/\s+/).filter(Boolean));
17
15
  }
18
- // Handle Set (new Set(["class1", "class2"]))
19
16
  if (classes instanceof Set) {
20
17
  return Array.from(classes).flatMap((c) => c.split(/\s+/).filter(Boolean));
21
18
  }
22
- // Handle Object/Dictionary ({ 'class1': true, 'class2': false })
23
19
  if (typeof classes === 'object') {
24
20
  return Object.entries(classes)
25
- .filter(([_, condition]) => Boolean(condition)) // Keep only truthy values
21
+ .filter(([_, condition]) => Boolean(condition))
26
22
  .map(([className]) => className)
27
- .flatMap((c) => c.split(/\s+/).filter(Boolean)); // Handle keys with spaces like { 'a b': true }
23
+ .flatMap((c) => c.split(/\s+/).filter(Boolean));
28
24
  }
29
25
  return [];
30
26
  }
@@ -41,7 +37,6 @@ export function safeFormat(date: Date, format: string, locale: string): string {
41
37
 
42
38
  const pad = (num: number) => num.toString().padStart(2, '0');
43
39
 
44
- // Helper to safely grab localized names (months, weekdays)
45
40
  const getIntl = (opts: Intl.DateTimeFormatOptions) => {
46
41
  try {
47
42
  return new Intl.DateTimeFormat(locale, opts).format(date);
@@ -51,35 +46,29 @@ export function safeFormat(date: Date, format: string, locale: string): string {
51
46
  };
52
47
 
53
48
  const tokens: Record<string, string> = {
54
- // Year
55
49
  YYYY: year,
56
50
  yyyy: year,
57
51
  YY: year.slice(-2),
58
52
  yy: year.slice(-2),
59
53
 
60
- // Localized Month
61
54
  MMMM: getIntl({ month: 'long' }),
62
- LLLL: getIntl({ month: 'long' }), // Preserved from your original logic
55
+ LLLL: getIntl({ month: 'long' }),
63
56
  MMM: getIntl({ month: 'short' }),
64
57
 
65
- // Numeric Month
66
58
  MM: pad(month),
67
59
  M: month.toString(),
68
60
 
69
- // Numeric Day
70
61
  DD: pad(day),
71
62
  dd: pad(day),
72
63
  D: day.toString(),
73
64
  d: day.toString(),
74
65
 
75
- // Localized Weekday
76
66
  dddd: getIntl({ weekday: 'long' }),
77
67
  ddd: getIntl({ weekday: 'short' }),
78
68
  EEEE: getIntl({ weekday: 'long' }),
79
69
  EEE: getIntl({ weekday: 'short' }),
80
70
  EEEEE: getIntl({ weekday: 'narrow' }),
81
71
 
82
- // Time
83
72
  HH: pad(hours),
84
73
  H: hours.toString(),
85
74
  hh: pad(hours % 12 || 12),
@@ -89,12 +78,10 @@ export function safeFormat(date: Date, format: string, locale: string): string {
89
78
  ss: pad(seconds),
90
79
  s: seconds.toString(),
91
80
 
92
- // AM/PM
93
81
  A: hours >= 12 ? 'PM' : 'AM',
94
82
  a: hours >= 12 ? 'pm' : 'am',
95
83
  };
96
84
 
97
- // Sort by length descending to match longest tokens first (e.g. MMMM before MM)
98
85
  const regex = new RegExp(
99
86
  Object.keys(tokens)
100
87
  .sort((a, b) => b.length - a.length)
@@ -102,16 +89,13 @@ export function safeFormat(date: Date, format: string, locale: string): string {
102
89
  'g',
103
90
  );
104
91
 
105
- // Replace all tokens in one pass
106
92
  return format.replace(regex, (match) => tokens[match] || match);
107
93
  } catch (e) {
108
- // Fallback if anything crashes
109
94
  return new Intl.DateTimeFormat(locale || 'en-US').format(date);
110
95
  }
111
96
  }
112
97
  export function parseFormattedStringIntoDate(value: string, format: string): Date | null {
113
98
  try {
114
- // Convert format string (e.g., dd-MM-yyyy) into a Regex with named groups
115
99
  let regexStr = format
116
100
  .replace('yyyy', '(?<year>\\d{4})')
117
101
  .replace('MM', '(?<month>\\d{2})')
@@ -124,7 +108,7 @@ export function parseFormattedStringIntoDate(value: string, format: string): Dat
124
108
 
125
109
  if (match && match.groups) {
126
110
  const year = parseInt(match.groups['year'], 10);
127
- const month = parseInt(match.groups['month'], 10) - 1; // JS Months are 0-11
111
+ const month = parseInt(match.groups['month'], 10) - 1;
128
112
  const day = parseInt(match.groups['day'], 10);
129
113
 
130
114
  const hour = match.groups['hour'] ? parseInt(match.groups['hour'], 10) : 0;
@@ -151,9 +135,8 @@ export function resolveThemeDefault<
151
135
  service: DasarThemeService | null,
152
136
  ): NonNullable<NonNullable<DasarComponentConfig[C]>[K]> | T {
153
137
  const providerConfig = provider?.componentConfig as any;
154
- const serviceConfig = service?.themeVariable()?.components as any;
138
+ const serviceConfig = service?.rawThemeVariable()?.components as any;
155
139
 
156
- // Component-Specific Config (First)
157
140
  if (providerConfig?.[componentKey]?.[propKey] !== undefined) {
158
141
  return providerConfig[componentKey]![propKey] as any;
159
142
  }
@@ -161,7 +144,6 @@ export function resolveThemeDefault<
161
144
  return serviceConfig[componentKey]![propKey] as any;
162
145
  }
163
146
 
164
- // Common Config (Applies to all components if the property exists)
165
147
  const commonKey = propKey as unknown as keyof DasarComponentCommonConfig;
166
148
  if (providerConfig?.common?.[commonKey] !== undefined) {
167
149
  return providerConfig.common[commonKey] as any;
@@ -170,6 +152,5 @@ export function resolveThemeDefault<
170
152
  return serviceConfig.common[commonKey] as any;
171
153
  }
172
154
 
173
- // Component Default Value
174
155
  return fallback;
175
156
  }
@@ -0,0 +1,23 @@
1
+ import { fieldIconSize } from './icon-size';
2
+
3
+ describe('fieldIconSize', () => {
4
+ it('scales down for small controls', () => {
5
+ expect(fieldIconSize('xs')).toBe(12);
6
+ expect(fieldIconSize('sm')).toBe(14);
7
+ });
8
+
9
+ it('uses the field friendly default for md', () => {
10
+ expect(fieldIconSize('md')).toBe(16);
11
+ expect(fieldIconSize(undefined)).toBe(16);
12
+ expect(fieldIconSize(null)).toBe(16);
13
+ });
14
+
15
+ it('scales up for large controls', () => {
16
+ expect(fieldIconSize('lg')).toBe(20);
17
+ expect(fieldIconSize('xl')).toBe(24);
18
+ });
19
+
20
+ it('passes a numeric size through', () => {
21
+ expect(fieldIconSize(18)).toBe(18);
22
+ });
23
+ });
@@ -0,0 +1,16 @@
1
+ export function fieldIconSize(size: string | number | null | undefined): number {
2
+ switch (size) {
3
+ case 'xs':
4
+ return 12;
5
+ case 'sm':
6
+ return 14;
7
+ case 'lg':
8
+ return 20;
9
+ case 'xl':
10
+ return 24;
11
+ case 'md':
12
+ return 16;
13
+ default:
14
+ return typeof size === 'number' ? size : 16;
15
+ }
16
+ }
@@ -0,0 +1,90 @@
1
+ import { computeSmartPlacement, DasarPanelPlacement } from './panel-placement';
2
+
3
+ interface FakeRect {
4
+ top: number;
5
+ bottom: number;
6
+ left: number;
7
+ right: number;
8
+ width: number;
9
+ height: number;
10
+ }
11
+
12
+ function rect(partial: Partial<FakeRect>): { getBoundingClientRect: () => FakeRect } {
13
+ const value: FakeRect = {
14
+ top: 0,
15
+ bottom: 0,
16
+ left: 0,
17
+ right: 0,
18
+ width: 0,
19
+ height: 0,
20
+ ...partial,
21
+ };
22
+ return { getBoundingClientRect: () => value };
23
+ }
24
+
25
+ describe('computeSmartPlacement', () => {
26
+ const originalInnerHeight = window.innerHeight;
27
+ const originalInnerWidth = window.innerWidth;
28
+
29
+ afterAll(() => {
30
+ Object.defineProperty(window, 'innerHeight', {
31
+ value: originalInnerHeight,
32
+ configurable: true,
33
+ });
34
+ Object.defineProperty(window, 'innerWidth', { value: originalInnerWidth, configurable: true });
35
+ });
36
+
37
+ function setViewport(width: number, height: number) {
38
+ Object.defineProperty(window, 'innerHeight', { value: height, configurable: true });
39
+ Object.defineProperty(window, 'innerWidth', { value: width, configurable: true });
40
+ }
41
+
42
+ it('keeps the preferred placement when there is room below', () => {
43
+ setViewport(1024, 800);
44
+ const trigger = rect({ top: 100, bottom: 132, left: 100, right: 300 });
45
+ const panel = rect({ width: 200, height: 240 });
46
+
47
+ expect(computeSmartPlacement(trigger, panel, 'bottom-start')).toBe('bottom-start');
48
+ });
49
+
50
+ it('flips to top when there is not enough room below', () => {
51
+ setViewport(1024, 300);
52
+ const trigger = rect({ top: 240, bottom: 272, left: 100, right: 300 });
53
+ const panel = rect({ width: 200, height: 240 });
54
+
55
+ expect(computeSmartPlacement(trigger, panel, 'bottom-start')).toBe('top-start');
56
+ });
57
+
58
+ it('flips to bottom when there is not enough room above', () => {
59
+ setViewport(1024, 800);
60
+ const trigger = rect({ top: 4, bottom: 36, left: 100, right: 300 });
61
+ const panel = rect({ width: 200, height: 240 });
62
+
63
+ expect(computeSmartPlacement(trigger, panel, 'top-start')).toBe('bottom-start');
64
+ });
65
+
66
+ it('flips horizontally when the preferred side is too narrow', () => {
67
+ setViewport(1024, 800);
68
+ const trigger = rect({ top: 100, bottom: 132, left: 900, right: 1000 });
69
+ const panel = rect({ width: 300, height: 200 });
70
+
71
+ expect(computeSmartPlacement(trigger, panel, 'bottom-start')).toBe('bottom-end');
72
+ });
73
+
74
+ it('flips vertically and horizontally at the same time', () => {
75
+ setViewport(800, 300);
76
+ const trigger = rect({ top: 250, bottom: 282, left: 700, right: 790 });
77
+ const panel = rect({ width: 300, height: 240 });
78
+
79
+ expect(computeSmartPlacement(trigger, panel, 'bottom-start')).toBe('top-end');
80
+ });
81
+
82
+ it('keeps the preferred placement when neither side has room', () => {
83
+ setViewport(1024, 400);
84
+ const trigger = rect({ top: 184, bottom: 216, left: 400, right: 600 });
85
+ const panel = rect({ width: 200, height: 300 });
86
+
87
+ const result: DasarPanelPlacement = computeSmartPlacement(trigger, panel, 'bottom-start');
88
+ expect(result).toBe('bottom-start');
89
+ });
90
+ });
@@ -0,0 +1,53 @@
1
+ export type DasarPanelPlacement = 'bottom-start' | 'bottom-end' | 'top-start' | 'top-end';
2
+
3
+ export type DasarPlacementRect = Pick<
4
+ DOMRect,
5
+ 'top' | 'bottom' | 'left' | 'right' | 'width' | 'height'
6
+ >;
7
+
8
+ export interface DasarPlacementTarget {
9
+ getBoundingClientRect(): DasarPlacementRect;
10
+ }
11
+
12
+ export function computeSmartPlacement(
13
+ trigger: DasarPlacementTarget,
14
+ panel: DasarPlacementTarget,
15
+ preferred: DasarPanelPlacement,
16
+ margin = 8,
17
+ ): DasarPanelPlacement {
18
+ if (typeof window === 'undefined') {
19
+ return preferred;
20
+ }
21
+
22
+ const triggerRect = trigger.getBoundingClientRect();
23
+ const panelRect = panel.getBoundingClientRect();
24
+ const [preferredVertical, preferredHorizontal] = preferred.split('-') as [
25
+ 'bottom' | 'top',
26
+ 'start' | 'end',
27
+ ];
28
+
29
+ let vertical = preferredVertical;
30
+ let horizontal = preferredHorizontal;
31
+
32
+ const spaceBelow = window.innerHeight - triggerRect.bottom;
33
+ const spaceAbove = triggerRect.top;
34
+ const requiredVertical = panelRect.height + margin;
35
+
36
+ if (vertical === 'bottom' && spaceBelow < requiredVertical && spaceAbove > spaceBelow) {
37
+ vertical = 'top';
38
+ } else if (vertical === 'top' && spaceAbove < requiredVertical && spaceBelow > spaceAbove) {
39
+ vertical = 'bottom';
40
+ }
41
+
42
+ const spaceRight = window.innerWidth - triggerRect.left;
43
+ const spaceLeft = triggerRect.right;
44
+ const requiredHorizontal = panelRect.width + margin;
45
+
46
+ if (horizontal === 'start' && spaceRight < requiredHorizontal && spaceLeft > spaceRight) {
47
+ horizontal = 'end';
48
+ } else if (horizontal === 'end' && spaceLeft < requiredHorizontal && spaceRight > spaceLeft) {
49
+ horizontal = 'start';
50
+ }
51
+
52
+ return `${vertical}-${horizontal}` as DasarPanelPlacement;
53
+ }
@@ -1,4 +1,3 @@
1
- // components
2
1
  export * from './lib/components/dasar-button-group/dasar-button-group';
3
2
  export * from './lib/components/dasar-number-input/dasar-number-input';
4
3
  export * from './lib/components/dasar-pagination/dasar-pagination';
@@ -14,10 +13,11 @@ export * from './lib/components/dasar-icon/dasar-icon';
14
13
  export * from './lib/components/dasar-card/dasar-card';
15
14
  export * from './lib/components/dasar-chip/dasar-chip';
16
15
  export * from './lib/components/dasar-input/dasar-input';
17
- // adjusted
16
+ export * from './lib/components/dasar-modal/dasar-modal';
17
+ export * from './lib/components/dasar-overlay/dasar-overlay';
18
18
  export * from './lib/components/dasar-theme-provider/dasar-theme-provider';
19
19
  export * from './lib/components/dasar-button/dasar-button';
20
- // services
21
20
  export * from './lib/services/theme.service';
22
- // models
21
+ export * from './lib/utils/panel-placement';
22
+ export * from './lib/utils/icon-size';
23
23
  export * from './lib/models/theme.model';
@@ -5,7 +5,14 @@
5
5
  "compilerOptions": {
6
6
  "outDir": "../../out-tsc/spec",
7
7
  "types": ["vitest/globals"],
8
- "rootDir": "./src"
8
+ "rootDir": "./src",
9
+ "paths": {
10
+ "@components/*": ["./src/lib/components/*"],
11
+ "@services/*": ["./src/lib/services/*"],
12
+ "@models/*": ["./src/lib/models/*"],
13
+ "@styles/*": ["./src/lib/styles/*"],
14
+ "dasar-ui": ["./src/public-api.ts"]
15
+ }
9
16
  },
10
17
  "include": ["src/**/*.d.ts", "src/**/*.spec.ts"]
11
18
  }
@@ -0,0 +1,51 @@
1
+ <main>
2
+ <dasar-theme-provider
3
+ [componentConfig]="customize.componentConfig()"
4
+ [tokenConfig]="customize.tokenConfig()"
5
+ [mode]="customize.mode()"
6
+ [ngStyle]="{ height: '100vh', overflow: 'hidden' }"
7
+ >
8
+ <dasar-card
9
+ appearance="borderless"
10
+ radius="none"
11
+ [container-style]="{
12
+ padding: '0 var(--space-base)',
13
+ 'border-bottom': '1px solid var(--theme-border-subtle-color)',
14
+ 'justify-content': 'center',
15
+ 'align-items': 'center',
16
+ display: 'flex',
17
+ height: '50px',
18
+ }"
19
+ [body-style]="{
20
+ 'justify-content': 'space-between',
21
+ 'align-items': 'center',
22
+ display: 'flex',
23
+ width: '100%',
24
+ }"
25
+ >
26
+ <span style="font-weight: 800; font-family: var(--font-hero)">Dasar UI Library</span>
27
+ <div style="display: flex; gap: 8px; align-items: center">
28
+ <dasar-button
29
+ size="md"
30
+ radius="md"
31
+ appearance="outline"
32
+ variant="secondary"
33
+ (click)="customizeOpen.set(true)"
34
+ >Customize</dasar-button
35
+ >
36
+ <dasar-button size="md" radius="md" appearance="solid" (click)="customize.toggleMode()">
37
+ <span [ngStyle]="{ 'text-transform': 'capitalize' }">Theme: {{ customize.mode() }}</span>
38
+ </dasar-button>
39
+ </div>
40
+ </dasar-card>
41
+ <div [ngStyle]="{ height: 'calc(100vh - 50px)' }">
42
+ @for (key of [customize.renderKey()]; track key) {
43
+ <router-outlet></router-outlet>
44
+ }
45
+ </div>
46
+ <doc-customize-modal
47
+ [open]="customizeOpen()"
48
+ (closed)="customizeOpen.set(false)"
49
+ ></doc-customize-modal>
50
+ </dasar-theme-provider>
51
+ </main>
@@ -0,0 +1,23 @@
1
+ import { TestBed } from '@angular/core/testing';
2
+ import { App } from './app';
3
+
4
+ describe('App', () => {
5
+ beforeEach(async () => {
6
+ await TestBed.configureTestingModule({
7
+ imports: [App],
8
+ }).compileComponents();
9
+ });
10
+
11
+ it('should create the app', () => {
12
+ const fixture = TestBed.createComponent(App);
13
+ const app = fixture.componentInstance;
14
+ expect(app).toBeTruthy();
15
+ });
16
+
17
+ it('should render title', async () => {
18
+ const fixture = TestBed.createComponent(App);
19
+ await fixture.whenStable();
20
+ const compiled = fixture.nativeElement as HTMLElement;
21
+ expect(compiled.querySelector('h1')?.textContent).toContain('Hello, dasar-ui-documentation');
22
+ });
23
+ });
@@ -0,0 +1,23 @@
1
+ import { DasarThemeProviderComponent, DasarButtonComponent, DasarCardComponent } from 'dasar-ui';
2
+ import { Component, inject, signal } from '@angular/core';
3
+ import { RouterOutlet } from '@angular/router';
4
+ import { CommonModule } from '@angular/common';
5
+ import { DocCustomizeService } from './services/doc-customize.service';
6
+ import { DocCustomizeModalComponent } from './components/doc-customize-modal.component';
7
+
8
+ @Component({
9
+ imports: [
10
+ CommonModule,
11
+ RouterOutlet,
12
+ DasarThemeProviderComponent,
13
+ DasarButtonComponent,
14
+ DasarCardComponent,
15
+ DocCustomizeModalComponent,
16
+ ],
17
+ templateUrl: './app.html',
18
+ selector: 'app-root',
19
+ })
20
+ export class App {
21
+ protected readonly customize = inject(DocCustomizeService);
22
+ protected readonly customizeOpen = signal(false);
23
+ }