@type-dom/ui 0.0.2 → 0.0.3

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 (354) hide show
  1. package/README.md +40 -6
  2. package/package.json +7 -1
  3. package/src/aria.d.ts +17 -0
  4. package/src/aria.js +20 -0
  5. package/src/{basic → components/basic}/index.d.ts +12 -0
  6. package/src/components/basic/index.js +48 -0
  7. package/src/{basic → components/basic}/td-button/td-button.class.d.ts +7 -5
  8. package/src/components/basic/td-button/td-button.class.js +179 -0
  9. package/src/{basic → components/basic}/td-button/td-button.interface.d.ts +21 -21
  10. package/src/{basic → components/basic}/td-button/td-button.style.d.ts +2 -1
  11. package/src/{basic → components/basic}/td-button/td-button.style.js +34 -30
  12. package/src/components/basic/td-button-group/td-button-group.class.d.ts +11 -0
  13. package/src/components/basic/td-button-group/td-button-group.class.js +105 -0
  14. package/src/components/basic/td-button-group/td-button-group.interface.d.ts +16 -0
  15. package/src/components/basic/td-container/td-aside/td-aside.class.d.ts +6 -0
  16. package/src/{basic → components/basic}/td-container/td-aside/td-aside.class.js +4 -4
  17. package/src/components/basic/td-container/td-aside/td-aside.interface.d.ts +7 -0
  18. package/src/components/basic/td-container/td-container.class.d.ts +11 -0
  19. package/src/{basic → components/basic}/td-container/td-container.class.js +4 -4
  20. package/src/components/basic/td-container/td-container.interface.d.ts +15 -0
  21. package/src/components/basic/td-container/td-footer/td-footer.class.d.ts +8 -0
  22. package/src/components/basic/td-container/td-footer/td-footer.class.js +24 -0
  23. package/src/components/basic/td-container/td-footer/td-footer.interface.d.ts +8 -0
  24. package/src/components/basic/td-container/td-header/td-header.class.d.ts +9 -0
  25. package/src/components/basic/td-container/td-header/td-header.class.js +25 -0
  26. package/src/components/basic/td-container/td-header/td-header.interface.d.ts +8 -0
  27. package/src/{basic → components/basic}/td-container/td-main/td-main.class.d.ts +2 -2
  28. package/src/{basic → components/basic}/td-container/td-main/td-main.class.js +5 -8
  29. package/src/components/basic/td-container/td-main/td-main.interface.d.ts +7 -0
  30. package/src/{basic → components/basic}/td-icon/td-icon.class.d.ts +7 -3
  31. package/src/{basic → components/basic}/td-icon/td-icon.class.js +37 -11
  32. package/src/components/basic/td-icon/td-icon.interface.d.ts +13 -0
  33. package/src/{basic → components/basic}/td-icon/td-icon.style.d.ts +1 -0
  34. package/src/{basic → components/basic}/td-icon/td-icon.style.js +4 -3
  35. package/src/components/basic/td-layout/td-col/td-col.class.d.ts +13 -0
  36. package/src/components/basic/td-layout/td-col/td-col.class.js +128 -0
  37. package/src/components/basic/td-layout/td-col/td-col.interface.d.ts +46 -0
  38. package/src/components/basic/td-layout/td-row/td-row.class.d.ts +10 -0
  39. package/src/components/basic/td-layout/td-row/td-row.class.js +101 -0
  40. package/src/components/basic/td-layout/td-row/td-row.interface.d.ts +18 -0
  41. package/src/components/basic/td-layout/td-row/td-row.interface.js +12 -0
  42. package/src/components/basic/td-layout/td-row/td-row.style.d.ts +1 -0
  43. package/src/components/basic/td-layout/td-row/td-row.style.js +8 -0
  44. package/src/components/basic/td-link/td-link.class.d.ts +11 -0
  45. package/src/components/basic/td-link/td-link.class.js +105 -0
  46. package/src/components/basic/td-link/td-link.interface.d.ts +33 -0
  47. package/src/components/basic/td-link/td-link.style.d.ts +5 -0
  48. package/src/components/basic/td-link/td-link.style.js +45 -0
  49. package/src/components/basic/td-scrollbar/bar/bar.class.d.ts +8 -0
  50. package/src/components/basic/td-scrollbar/bar/bar.class.js +31 -0
  51. package/src/components/basic/td-scrollbar/bar/bar.interface.d.ts +8 -0
  52. package/src/components/basic/td-scrollbar/td-scrollbar.class.d.ts +9 -0
  53. package/src/components/basic/td-scrollbar/td-scrollbar.class.js +51 -0
  54. package/src/components/basic/td-scrollbar/td-scrollbar.interface.d.ts +63 -0
  55. package/src/components/basic/td-scrollbar/td-scrollbar.interface.js +5 -0
  56. package/src/components/basic/td-scrollbar/thumb/thumb.class.d.ts +7 -0
  57. package/src/components/basic/td-scrollbar/thumb/thumb.class.js +45 -0
  58. package/src/components/basic/td-scrollbar/thumb/thumb.interface.d.ts +11 -0
  59. package/src/components/basic/td-space/td-space.class.d.ts +12 -0
  60. package/src/components/basic/td-space/td-space.class.js +92 -0
  61. package/src/components/basic/td-space/td-space.const.d.ts +3 -0
  62. package/src/components/basic/td-space/td-space.const.js +8 -0
  63. package/src/components/basic/td-space/td-space.interface.d.ts +39 -0
  64. package/src/components/basic/td-text/td-text.class.d.ts +10 -0
  65. package/src/components/basic/td-text/td-text.class.js +47 -0
  66. package/src/components/basic/td-text/td-text.interface.d.ts +21 -0
  67. package/src/components/basic/td-text/td-text.style.d.ts +6 -0
  68. package/src/components/basic/td-text/td-text.style.js +59 -0
  69. package/src/{feedback/dialog/dialog.d.ts → components/feedback/dialog/dialog.class.d.ts} +2 -3
  70. package/src/{feedback/dialog/dialog.js → components/feedback/dialog/dialog.class.js} +9 -2
  71. package/src/components/feedback/dialog/dialog.interface.d.ts +5 -0
  72. package/src/{feedback → components/feedback}/index.d.ts +1 -1
  73. package/src/{feedback → components/feedback}/index.js +2 -2
  74. package/src/{feedback → components/feedback}/message-box/message-box.d.ts +2 -3
  75. package/src/components/feedback/message-box/message-box.interface.d.ts +4 -0
  76. package/src/{feedback → components/feedback}/message-box/message-box.js +11 -2
  77. package/src/{feedback → components/feedback}/overlay/container/body/body.js +7 -9
  78. package/src/{feedback → components/feedback}/overlay/container/container.js +12 -14
  79. package/src/{feedback → components/feedback}/overlay/container/footer/cancel-button/cancel-button.js +2 -2
  80. package/src/{feedback → components/feedback}/overlay/container/footer/confirm-button/confirm-button.js +9 -11
  81. package/src/{feedback → components/feedback}/overlay/container/footer/footer.js +4 -4
  82. package/src/{feedback → components/feedback}/overlay/container/header/close-button/close-button.js +15 -17
  83. package/src/{feedback → components/feedback}/overlay/container/header/header.js +2 -2
  84. package/src/{feedback → components/feedback}/overlay/container/header/title/title.d.ts +1 -1
  85. package/src/{feedback → components/feedback}/overlay/container/header/title/title.js +9 -11
  86. package/src/{feedback → components/feedback}/overlay/overlay.abstract.d.ts +0 -3
  87. package/src/{feedback → components/feedback}/overlay/overlay.abstract.js +5 -11
  88. package/src/components/feedback/td-focus-trap/td-focus-trap.class.d.ts +8 -0
  89. package/src/components/feedback/td-focus-trap/td-focus-trap.class.js +81 -0
  90. package/src/components/feedback/td-focus-trap/td-focus-trap.interface.d.ts +10 -0
  91. package/src/components/feedback/td-focus-trap/tokens.d.ts +7 -0
  92. package/src/components/feedback/td-focus-trap/tokens.js +23 -0
  93. package/src/components/feedback/td-focus-trap/utils.d.ts +25 -0
  94. package/src/components/feedback/td-focus-trap/utils.js +153 -0
  95. package/src/components/feedback/td-popper/arrow/arrow.class.d.ts +6 -0
  96. package/src/components/feedback/td-popper/arrow/arrow.class.js +32 -0
  97. package/src/components/feedback/td-popper/arrow/arrow.interface.d.ts +11 -0
  98. package/src/components/feedback/td-popper/arrow/arrow.interface.js +2 -0
  99. package/src/components/feedback/td-popper/content/content.class.d.ts +7 -0
  100. package/src/components/feedback/td-popper/content/content.class.js +25 -0
  101. package/src/components/feedback/td-popper/content/content.interface.d.ts +37 -0
  102. package/src/components/feedback/td-popper/content/content.interface.js +2 -0
  103. package/src/components/feedback/td-popper/td-popper.class.d.ts +6 -0
  104. package/src/components/feedback/td-popper/td-popper.class.js +12 -0
  105. package/src/components/feedback/td-popper/td-popper.interface.d.ts +12 -0
  106. package/src/components/feedback/td-popper/td-popper.interface.js +13 -0
  107. package/src/components/feedback/td-popper/trigger/trigger.class.d.ts +6 -0
  108. package/src/components/feedback/td-popper/trigger/trigger.class.js +11 -0
  109. package/src/components/feedback/td-popper/trigger/trigger.interface.d.ts +8 -0
  110. package/src/components/feedback/td-popper/trigger/trigger.interface.js +2 -0
  111. package/src/components/feedback/td-tooltip/content/content.class.d.ts +6 -0
  112. package/src/components/feedback/td-tooltip/content/content.class.js +12 -0
  113. package/src/components/feedback/td-tooltip/content/content.interface.d.ts +42 -0
  114. package/src/components/feedback/td-tooltip/content/content.interface.js +2 -0
  115. package/src/components/feedback/td-tooltip/td-tooltip.class.d.ts +8 -0
  116. package/src/components/feedback/td-tooltip/td-tooltip.class.js +30 -0
  117. package/src/components/feedback/td-tooltip/td-tooltip.interface.d.ts +10 -0
  118. package/src/components/feedback/td-tooltip/td-tooltip.interface.js +2 -0
  119. package/src/components/feedback/td-tooltip/trigger/trigger.class.d.ts +6 -0
  120. package/src/components/feedback/td-tooltip/trigger/trigger.class.js +12 -0
  121. package/src/components/feedback/td-tooltip/trigger/trigger.interface.d.ts +16 -0
  122. package/src/components/feedback/td-tooltip/trigger/trigger.interface.js +2 -0
  123. package/src/{form → components/form}/checkbox-group/checkbox-group.class.d.ts +2 -3
  124. package/src/{form → components/form}/checkbox-group/checkbox-group.class.js +2 -2
  125. package/src/components/form/checkbox-group/checkbox-group.interface.js +2 -0
  126. package/src/{form → components/form}/checkbox-group/checkbox-option/checkbox-option.class.d.ts +2 -2
  127. package/src/{form → components/form}/checkbox-group/checkbox-option/checkbox-option.class.js +7 -7
  128. package/src/{form → components/form}/checkbox-group/checkbox-option/checkbox-option.interface.d.ts +0 -5
  129. package/src/components/form/checkbox-group/checkbox-option/checkbox-option.interface.js +2 -0
  130. package/src/components/form/field-item/cascade/field-cascade.abstract.d.ts +22 -0
  131. package/src/{form → components/form}/field-item/cascade/field-cascade.abstract.js +38 -42
  132. package/src/components/form/field-item/field-item.abstract.d.ts +10 -0
  133. package/src/{form → components/form}/field-item/field-item.abstract.js +5 -10
  134. package/src/components/form/field-item/field-item.interface.d.ts +5 -0
  135. package/src/components/form/field-item/field-item.interface.js +2 -0
  136. package/src/{form → components/form}/field-item/field-item.style.d.ts +1 -1
  137. package/src/{form → components/form}/field-item/field-item.style.js +2 -2
  138. package/src/{form → components/form}/field-item/input/field-input.abstract.js +6 -8
  139. package/src/components/form/field-item/options/field-options.abstract.d.ts +21 -0
  140. package/src/{form → components/form}/field-item/options/field-options.abstract.js +55 -55
  141. package/src/{form → components/form}/field-item/radio/field-radio.abstract.d.ts +6 -7
  142. package/src/{form → components/form}/field-item/radio/field-radio.abstract.js +10 -10
  143. package/src/{form → components/form}/field-item/select/field-select.abstract.js +7 -9
  144. package/src/{form → components/form}/field-item/span/field-span.abstract.d.ts +1 -1
  145. package/src/components/form/field-item/span/field-span.abstract.js +52 -0
  146. package/src/{form → components/form}/field-item/textarea/field-textarea.abstract.js +8 -8
  147. package/src/components/form/field-select/field-select.class.d.ts +12 -0
  148. package/src/{basic/td-select/td-select.class.js → components/form/field-select/field-select.class.js} +7 -7
  149. package/src/{basic/td-select/td-select.interface.d.ts → components/form/field-select/field-select.interface.d.ts} +2 -2
  150. package/src/components/form/field-select/field-select.interface.js +2 -0
  151. package/src/{basic/td-select → components/form/field-select}/option/option.class.d.ts +3 -5
  152. package/src/{basic/td-select → components/form/field-select}/option/option.class.js +3 -5
  153. package/src/components/form/field-select/option/option.interface.js +2 -0
  154. package/src/components/form/index.d.ts +26 -0
  155. package/src/{form → components/form}/index.js +17 -1
  156. package/src/{form → components/form}/radio-group/radio-group.class.d.ts +5 -6
  157. package/src/{form → components/form}/radio-group/radio-group.class.js +11 -4
  158. package/src/components/form/radio-group/radio-group.interface.d.ts +11 -0
  159. package/src/components/form/radio-group/radio-group.interface.js +2 -0
  160. package/src/{form → components/form}/radio-group/radio-option/radio-option.class.d.ts +5 -4
  161. package/src/components/form/radio-group/radio-option/radio-option.class.js +46 -0
  162. package/src/components/form/radio-group/radio-option/radio-option.interface.d.ts +10 -0
  163. package/src/components/form/radio-group/radio-option/radio-option.interface.js +2 -0
  164. package/src/{form → components/form}/select/select.class.d.ts +4 -5
  165. package/src/{form → components/form}/select/select.class.js +5 -5
  166. package/src/components/form/select/select.interface.d.ts +4 -0
  167. package/src/components/form/select/select.interface.js +2 -0
  168. package/src/components/form/td-checkbox/td-checkbox.class.d.ts +7 -0
  169. package/src/components/form/td-checkbox/td-checkbox.class.js +104 -0
  170. package/src/components/form/td-checkbox/td-checkbox.interface.d.ts +78 -0
  171. package/src/components/form/td-checkbox/td-checkbox.interface.js +2 -0
  172. package/src/components/form/td-checkbox/td-checkbox.style.d.ts +14 -0
  173. package/src/components/form/td-checkbox/td-checkbox.style.js +18 -0
  174. package/src/components/form/td-checkbox-button/td-checkbox-button.class.d.ts +7 -0
  175. package/src/components/form/td-checkbox-button/td-checkbox-button.class.js +15 -0
  176. package/src/components/form/td-checkbox-button/td-checkbox-button.interface.d.ts +6 -0
  177. package/src/components/form/td-checkbox-button/td-checkbox-button.interface.js +2 -0
  178. package/src/components/form/td-checkbox-group/td-checkbox-group.class.d.ts +7 -0
  179. package/src/components/form/td-checkbox-group/td-checkbox-group.class.js +20 -0
  180. package/src/components/form/td-checkbox-group/td-checkbox-group.interface.d.ts +50 -0
  181. package/src/components/form/td-checkbox-group/td-checkbox-group.interface.js +2 -0
  182. package/src/components/form/td-form/td-form.class.d.ts +22 -0
  183. package/src/components/form/td-form/td-form.class.js +52 -0
  184. package/src/components/form/td-form/td-form.interface.d.ts +92 -0
  185. package/src/components/form/td-form/td-form.interface.js +2 -0
  186. package/src/components/form/td-form/td-form.style.d.ts +4 -0
  187. package/src/components/form/td-form/td-form.style.js +8 -0
  188. package/src/components/form/td-form-item/td-form-item.class.d.ts +17 -0
  189. package/src/components/form/td-form-item/td-form-item.class.js +145 -0
  190. package/src/components/form/td-form-item/td-form-item.interface.d.ts +57 -0
  191. package/src/components/form/td-form-item/td-form-item.interface.js +9 -0
  192. package/src/components/form/td-form-item/td-form-item.style.d.ts +29 -0
  193. package/src/components/form/td-form-item/td-form-item.style.js +34 -0
  194. package/src/components/form/td-input/td-input-field.class.d.ts +7 -0
  195. package/src/{form/td-input/td-input.class.js → components/form/td-input/td-input-field.class.js} +8 -8
  196. package/src/{form/td-input/td-input.interface.d.ts → components/form/td-input/td-input-field.interface.d.ts} +3 -3
  197. package/src/components/form/td-input/td-input-field.interface.js +2 -0
  198. package/src/components/form/td-input/td-input.class.d.ts +21 -0
  199. package/src/components/form/td-input/td-input.class.js +177 -0
  200. package/src/components/form/td-input/td-input.interface.d.ts +133 -0
  201. package/src/components/form/td-input/td-input.interface.js +2 -0
  202. package/src/components/form/td-input/td-input.style.d.ts +53 -0
  203. package/src/components/form/td-input/td-input.style.js +66 -0
  204. package/src/components/form/td-input/widget/prefix.d.ts +10 -0
  205. package/src/components/form/td-input/widget/prefix.js +63 -0
  206. package/src/components/form/td-input/widget/suffix.d.ts +13 -0
  207. package/src/components/form/td-input/widget/suffix.js +120 -0
  208. package/src/components/form/td-input/widget/td-input-wrapper.class.d.ts +33 -0
  209. package/src/components/form/td-input/widget/td-input-wrapper.class.js +286 -0
  210. package/src/components/form/td-input/widget/td-input-wrapper.interface.d.ts +4 -0
  211. package/src/components/form/td-input/widget/td-input-wrapper.interface.js +2 -0
  212. package/src/components/form/td-input/widget/td-textarea-wrapper.d.ts +13 -0
  213. package/src/components/form/td-input/widget/td-textarea-wrapper.js +123 -0
  214. package/src/components/form/td-input/widget/utils.d.ts +6 -0
  215. package/src/components/form/td-input/widget/utils.js +81 -0
  216. package/src/components/form/td-radio/td-radio.class.d.ts +17 -0
  217. package/src/components/form/td-radio/td-radio.class.js +232 -0
  218. package/src/components/form/td-radio/td-radio.interface.d.ts +38 -0
  219. package/src/components/form/td-radio/td-radio.interface.js +2 -0
  220. package/src/components/form/td-radio-button/td-radio-button.class.d.ts +15 -0
  221. package/src/components/form/td-radio-button/td-radio-button.class.js +195 -0
  222. package/src/components/form/td-radio-button/td-radio-button.interface.d.ts +34 -0
  223. package/src/components/form/td-radio-button/td-radio-button.interface.js +2 -0
  224. package/src/components/form/td-radio-button/td-radio-button.style.d.ts +1 -0
  225. package/src/components/form/td-radio-button/td-radio-button.style.js +9 -0
  226. package/src/components/form/td-radio-group/td-radio-group.class.d.ts +16 -0
  227. package/src/components/form/td-radio-group/td-radio-group.class.js +105 -0
  228. package/src/components/form/td-radio-group/td-radio-group.interface.d.ts +47 -0
  229. package/src/components/form/td-radio-group/td-radio-group.interface.js +2 -0
  230. package/src/components/form/td-select/dropdown/dropdown.class.d.ts +9 -0
  231. package/src/components/form/td-select/dropdown/dropdown.class.js +48 -0
  232. package/src/components/form/td-select/dropdown/dropdown.interface.d.ts +9 -0
  233. package/src/components/form/td-select/dropdown/dropdown.interface.js +2 -0
  234. package/src/components/form/td-select/option/option.class.d.ts +6 -0
  235. package/src/components/form/td-select/option/option.class.js +36 -0
  236. package/src/components/form/td-select/option/option.interface.d.ts +20 -0
  237. package/src/components/form/td-select/option/option.interface.js +2 -0
  238. package/src/components/form/td-select/option-group/option-group.class.d.ts +6 -0
  239. package/src/components/form/td-select/option-group/option-group.class.js +50 -0
  240. package/src/components/form/td-select/option-group/option-group.interface.d.ts +14 -0
  241. package/src/components/form/td-select/option-group/option-group.interface.js +2 -0
  242. package/src/components/form/td-select/td-select.class.d.ts +6 -0
  243. package/src/components/form/td-select/td-select.class.js +32 -0
  244. package/src/components/form/td-select/td-select.interface.d.ts +172 -0
  245. package/src/components/form/td-select/td-select.interface.js +2 -0
  246. package/src/components/form/td-select/td-select.style.d.ts +53 -0
  247. package/src/components/form/td-select/td-select.style.js +76 -0
  248. package/src/components/form/td-switch/td-switch.class.d.ts +20 -0
  249. package/src/components/form/td-switch/td-switch.class.js +225 -0
  250. package/src/components/form/td-switch/td-switch.interface.d.ts +97 -0
  251. package/src/components/form/td-switch/td-switch.interface.js +2 -0
  252. package/src/components/form/td-switch/td-switch.style.d.ts +47 -0
  253. package/src/components/form/td-switch/td-switch.style.js +57 -0
  254. package/src/components/form/td-switch/widget/td-switch-core.d.ts +17 -0
  255. package/src/components/form/td-switch/widget/td-switch-core.js +212 -0
  256. package/src/components/form/td-switch/widget/td-switch-left.d.ts +7 -0
  257. package/src/components/form/td-switch/widget/td-switch-left.js +26 -0
  258. package/src/components/form/td-switch/widget/td-switch-right.d.ts +7 -0
  259. package/src/components/form/td-switch/widget/td-switch-right.js +25 -0
  260. package/src/components/navigation/index.d.ts +2 -0
  261. package/src/components/navigation/index.js +5 -0
  262. package/src/components/navigation/td-menu/td-menu.class.d.ts +7 -0
  263. package/src/components/navigation/td-menu/td-menu.class.js +42 -0
  264. package/src/components/navigation/td-menu/td-menu.interface.d.ts +23 -0
  265. package/src/components/navigation/td-menu/td-menu.interface.js +2 -0
  266. package/src/{others → components/others}/collapsible-box/collapsible-box.js +10 -11
  267. package/src/{others → components/others}/collapsible-box/contents/contents.js +9 -11
  268. package/src/{others → components/others}/collapsible-box/heading/expand-heading.js +28 -26
  269. package/src/{others → components/others}/index.d.ts +2 -0
  270. package/src/{others → components/others}/index.js +3 -1
  271. package/src/components/others/td-divider/td-divider.class.d.ts +6 -0
  272. package/src/components/others/td-divider/td-divider.class.js +80 -0
  273. package/src/components/others/td-divider/td-divider.interface.d.ts +18 -0
  274. package/src/components/others/td-divider/td-divider.interface.js +2 -0
  275. package/src/index.d.ts +6 -4
  276. package/src/index.js +7 -5
  277. package/src/styles/color-scheme.js +12 -12
  278. package/src/styles/index.d.ts +1 -0
  279. package/src/styles/index.js +4 -0
  280. package/src/styles/size.d.ts +7 -0
  281. package/src/styles/size.js +9 -0
  282. package/src/styles/var.d.ts +28 -10
  283. package/src/styles/var.js +59 -28
  284. package/src/ui/ui.abstract.d.ts +8 -0
  285. package/src/ui/ui.abstract.js +22 -0
  286. package/src/ui/ui.interface.d.ts +8 -0
  287. package/src/ui/ui.interface.js +2 -0
  288. package/src/basic/index.js +0 -19
  289. package/src/basic/td-button/td-button.class.js +0 -149
  290. package/src/basic/td-container/td-aside/td-aside.class.d.ts +0 -6
  291. package/src/basic/td-container/td-aside/td-aside.interface.d.ts +0 -8
  292. package/src/basic/td-container/td-container.class.d.ts +0 -10
  293. package/src/basic/td-container/td-container.interface.d.ts +0 -14
  294. package/src/basic/td-container/td-footer/td-footer.class.d.ts +0 -6
  295. package/src/basic/td-container/td-footer/td-footer.class.js +0 -30
  296. package/src/basic/td-container/td-footer/td-footer.interface.d.ts +0 -11
  297. package/src/basic/td-container/td-header/td-header.class.d.ts +0 -9
  298. package/src/basic/td-container/td-header/td-header.class.js +0 -23
  299. package/src/basic/td-container/td-header/td-header.interface.d.ts +0 -10
  300. package/src/basic/td-container/td-main/td-main.interface.d.ts +0 -7
  301. package/src/basic/td-icon/td-icon.interface.d.ts +0 -12
  302. package/src/basic/td-select/td-select.class.d.ts +0 -14
  303. package/src/form/field-item/cascade/field-cascade.abstract.d.ts +0 -22
  304. package/src/form/field-item/field-item.abstract.d.ts +0 -11
  305. package/src/form/field-item/field-item.interface.d.ts +0 -12
  306. package/src/form/field-item/options/field-options.abstract.d.ts +0 -22
  307. package/src/form/field-item/span/field-span.abstract.js +0 -54
  308. package/src/form/index.d.ts +0 -11
  309. package/src/form/input-number/td-input-number.class.d.ts +0 -9
  310. package/src/form/input-number/td-input-number.class.js +0 -55
  311. package/src/form/input-number/td-input-number.interface.d.ts +0 -9
  312. package/src/form/radio-group/radio-group.interface.d.ts +0 -6
  313. package/src/form/radio-group/radio-option/radio-option.class.js +0 -33
  314. package/src/form/radio-group/radio-option/radio-option.interface.d.ts +0 -5
  315. package/src/form/select/select.interface.d.ts +0 -10
  316. package/src/form/td-input/td-input.class.d.ts +0 -9
  317. /package/src/{basic/td-container/td-aside/td-aside.interface.js → components/basic/td-button/td-button.interface.js} +0 -0
  318. /package/src/{basic/td-button/td-button.interface.js → components/basic/td-button-group/td-button-group.interface.js} +0 -0
  319. /package/src/{basic/td-container/td-container.interface.js → components/basic/td-container/td-aside/td-aside.interface.js} +0 -0
  320. /package/src/{basic → components/basic}/td-container/td-container.d.ts +0 -0
  321. /package/src/{basic/td-container/td-footer/td-footer.interface.js → components/basic/td-container/td-container.interface.js} +0 -0
  322. /package/src/{basic → components/basic}/td-container/td-container.js +0 -0
  323. /package/src/{basic/td-container/td-header/td-header.interface.js → components/basic/td-container/td-footer/td-footer.interface.js} +0 -0
  324. /package/src/{basic/td-container/td-main/td-main.interface.js → components/basic/td-container/td-header/td-header.interface.js} +0 -0
  325. /package/src/{basic/td-icon/td-icon.interface.js → components/basic/td-container/td-main/td-main.interface.js} +0 -0
  326. /package/src/{basic/td-select/option/option.interface.js → components/basic/td-icon/td-icon.interface.js} +0 -0
  327. /package/src/{basic/td-select/td-select.interface.js → components/basic/td-layout/td-col/td-col.interface.js} +0 -0
  328. /package/src/{form/checkbox-group/checkbox-group.interface.js → components/basic/td-link/td-link.interface.js} +0 -0
  329. /package/src/{form/checkbox-group/checkbox-option/checkbox-option.interface.js → components/basic/td-scrollbar/bar/bar.interface.js} +0 -0
  330. /package/src/{form/field-item/field-item.interface.js → components/basic/td-scrollbar/thumb/thumb.interface.js} +0 -0
  331. /package/src/{form/input-number/td-input-number.interface.js → components/basic/td-space/td-space.interface.js} +0 -0
  332. /package/src/{form/radio-group/radio-group.interface.js → components/basic/td-text/td-text.interface.js} +0 -0
  333. /package/src/{data → components/data}/index.d.ts +0 -0
  334. /package/src/{data → components/data}/index.js +0 -0
  335. /package/src/{form/radio-group/radio-option/radio-option.interface.js → components/feedback/dialog/dialog.interface.js} +0 -0
  336. /package/src/{form/select/select.interface.js → components/feedback/message-box/message-box.interface.js} +0 -0
  337. /package/src/{feedback → components/feedback}/overlay/container/body/body.d.ts +0 -0
  338. /package/src/{feedback → components/feedback}/overlay/container/container.d.ts +0 -0
  339. /package/src/{feedback → components/feedback}/overlay/container/footer/cancel-button/cancel-button.d.ts +0 -0
  340. /package/src/{feedback → components/feedback}/overlay/container/footer/confirm-button/confirm-button.d.ts +0 -0
  341. /package/src/{feedback → components/feedback}/overlay/container/footer/footer.d.ts +0 -0
  342. /package/src/{feedback → components/feedback}/overlay/container/header/close-button/close-button.d.ts +0 -0
  343. /package/src/{feedback → components/feedback}/overlay/container/header/header.d.ts +0 -0
  344. /package/src/{form/td-input/td-input.interface.js → components/feedback/td-focus-trap/td-focus-trap.interface.js} +0 -0
  345. /package/src/{form → components/form}/checkbox-group/checkbox-group.interface.d.ts +0 -0
  346. /package/src/{form → components/form}/field-item/input/field-input.abstract.d.ts +0 -0
  347. /package/src/{form → components/form}/field-item/select/field-select.abstract.d.ts +0 -0
  348. /package/src/{form → components/form}/field-item/textarea/field-textarea.abstract.d.ts +0 -0
  349. /package/src/{basic/td-select → components/form/field-select}/option/option.interface.d.ts +0 -0
  350. /package/src/{navigation/index.d.ts → components/navigation/td-menu/td-menu.style.d.ts} +0 -0
  351. /package/src/{navigation/index.js → components/navigation/td-menu/td-menu.style.js} +0 -0
  352. /package/src/{others → components/others}/collapsible-box/collapsible-box.d.ts +0 -0
  353. /package/src/{others → components/others}/collapsible-box/contents/contents.d.ts +0 -0
  354. /package/src/{others → components/others}/collapsible-box/heading/expand-heading.d.ts +0 -0
@@ -0,0 +1,225 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TdSwitch = void 0;
4
+ const utils_1 = require("@type-dom/utils");
5
+ const framework_1 = require("@type-dom/framework");
6
+ const ui_abstract_1 = require("../../../ui/ui.abstract");
7
+ const var_1 = require("../../../styles/var");
8
+ const td_switch_style_1 = require("./td-switch.style");
9
+ const td_switch_core_1 = require("./widget/td-switch-core");
10
+ const td_switch_left_1 = require("./widget/td-switch-left");
11
+ const td_switch_right_1 = require("./widget/td-switch-right");
12
+ class TdSwitch extends ui_abstract_1.UI {
13
+ constructor(config) {
14
+ var _a, _b, _c;
15
+ super();
16
+ this.className = 'TdSwitch';
17
+ this.config = config;
18
+ this.addStyleObj({
19
+ display: 'inline-flex',
20
+ alignItems: 'center',
21
+ position: 'relative',
22
+ verticalAlign: 'middle',
23
+ fontSize: td_switch_style_1.$switchFontSize[(config === null || config === void 0 ? void 0 : config.size) || 'default'],
24
+ lineHeight: td_switch_style_1.$switchCoreHeight[(config === null || config === void 0 ? void 0 : config.size) || 'default'],
25
+ height: td_switch_style_1.$switchHeight[(config === null || config === void 0 ? void 0 : config.size) || 'default']
26
+ });
27
+ this.modelValue = (_a = config === null || config === void 0 ? void 0 : config.modelValue) !== null && _a !== void 0 ? _a : false;
28
+ this.activeValue = (_b = config === null || config === void 0 ? void 0 : config.activeValue) !== null && _b !== void 0 ? _b : true;
29
+ this.inactiveValue = (_c = config === null || config === void 0 ? void 0 : config.inactiveValue) !== null && _c !== void 0 ? _c : false;
30
+ this.input = new framework_1.Input({
31
+ attrObj: {
32
+ type: 'checkbox',
33
+ role: 'switch'
34
+ },
35
+ styleObj: {
36
+ display: 'none'
37
+ }
38
+ });
39
+ this.addChild(this.input);
40
+ if (!(config === null || config === void 0 ? void 0 : config.inlinePrompt) && ((config === null || config === void 0 ? void 0 : config.inactiveIcon) || (config === null || config === void 0 ? void 0 : config.inactiveText))) {
41
+ this.left = new td_switch_left_1.TdSwitchLeft(config);
42
+ this.addChild(this.left);
43
+ }
44
+ this.core = new td_switch_core_1.TdSwitchCore(Object.assign({}, config, {
45
+ modelValue: this.modelValue,
46
+ activeValue: this.activeValue,
47
+ inactiveValue: this.inactiveValue
48
+ }));
49
+ this.addChild(this.core);
50
+ if (!(config === null || config === void 0 ? void 0 : config.inlinePrompt) && ((config === null || config === void 0 ? void 0 : config.activeIcon) || (config === null || config === void 0 ? void 0 : config.activeText))) {
51
+ console.log('td-switch right .');
52
+ this.right = new td_switch_right_1.TdSwitchRight(config);
53
+ this.addChild(this.right);
54
+ }
55
+ this.setChecked(this.modelValue === this.activeValue);
56
+ this.setConfig(config);
57
+ }
58
+ setConfig(config) {
59
+ super.setConfig(config);
60
+ // todo
61
+ console.log('td-switch setConfig . ');
62
+ if (config === null || config === void 0 ? void 0 : config.disabled) {
63
+ this.setDisabled(config === null || config === void 0 ? void 0 : config.disabled);
64
+ }
65
+ }
66
+ initEvents() {
67
+ this.addEvents({
68
+ click: (evt) => {
69
+ // changeValue
70
+ evt === null || evt === void 0 ? void 0 : evt.preventDefault();
71
+ this.switchValue();
72
+ }
73
+ });
74
+ }
75
+ handleChange() {
76
+ console.log('handleChange . ');
77
+ const config = this.config;
78
+ const checked = this.modelValue === this.activeValue;
79
+ // this.modelValue = !this.modelValue;
80
+ this.modelValue = checked ? this.inactiveValue : this.activeValue;
81
+ const val = checked ? this.inactiveValue : this.activeValue;
82
+ // emit(UPDATE_MODEL_EVENT, val)
83
+ // emit(CHANGE_EVENT, val)
84
+ // emit(INPUT_EVENT, val)
85
+ (0, framework_1.nextTick)(() => {
86
+ this.input.dom.checked = !checked;
87
+ console.log('handleChange . this.input.dom.checked is ', checked);
88
+ // this.input.setValue(val);
89
+ this.setChecked(!checked);
90
+ });
91
+ }
92
+ setDisabled(disabled) {
93
+ var _a, _b;
94
+ if (disabled) {
95
+ this.addStyleObj({
96
+ opacity: 0.6
97
+ });
98
+ this.input.addAttrObj({
99
+ disabled: true,
100
+ ariaDisabled: true
101
+ });
102
+ (_a = this.left) === null || _a === void 0 ? void 0 : _a.setStyleObj({
103
+ cursor: framework_1.StyleCursor.notAllowed
104
+ });
105
+ this.core.setStyleObj({
106
+ cursor: framework_1.StyleCursor.notAllowed
107
+ });
108
+ }
109
+ else {
110
+ this.addStyleObj({
111
+ opacity: 1
112
+ });
113
+ this.input.addAttrObj({
114
+ disabled: false,
115
+ ariaDisabled: false
116
+ });
117
+ (_b = this.left) === null || _b === void 0 ? void 0 : _b.setStyleObj({
118
+ cursor: framework_1.StyleCursor.auto
119
+ });
120
+ this.core.setStyleObj({
121
+ cursor: framework_1.StyleCursor.auto
122
+ });
123
+ }
124
+ }
125
+ setChecked(checked) {
126
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
127
+ if (checked) {
128
+ this.core.setStyleObj({
129
+ backgroundColor: (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.switchOnColor) !== null && _b !== void 0 ? _b : td_switch_style_1.$switchOnColor
130
+ });
131
+ this.core.action.setStyleObj({
132
+ color: td_switch_style_1.$switchOnColor,
133
+ // left: calc(100% - #{map.get($switch-button-size, 'default') + 1px});
134
+ left: 'calc(100% - ' + td_switch_style_1.$switchButtonSize[((_c = this.config) === null || _c === void 0 ? void 0 : _c.size) || 'default'] + ' - 1px)'
135
+ });
136
+ if (this.right) {
137
+ this.right.setStyleObj({
138
+ color: var_1.$colors.primary.base
139
+ });
140
+ }
141
+ if (this.left) {
142
+ this.left.setStyleObj({
143
+ color: var_1.$colors.default.base
144
+ });
145
+ }
146
+ if ((_d = this.config) === null || _d === void 0 ? void 0 : _d.inlinePrompt) {
147
+ this.core.setInnerChecked(true);
148
+ }
149
+ if ((_e = this.config) === null || _e === void 0 ? void 0 : _e.activeActionIcon) {
150
+ (_f = this.core.actionIcon) === null || _f === void 0 ? void 0 : _f.replaceSvg(this.config.activeActionIcon);
151
+ }
152
+ else if ((_g = this.config) === null || _g === void 0 ? void 0 : _g.activeActionText) {
153
+ (_j = (_h = this.core.actionSpan) === null || _h === void 0 ? void 0 : _h.textNode) === null || _j === void 0 ? void 0 : _j.setText(this.config.activeActionText);
154
+ }
155
+ }
156
+ else {
157
+ this.core.setStyleObj({
158
+ backgroundColor: (_l = (_k = this.config) === null || _k === void 0 ? void 0 : _k.switchOffColor) !== null && _l !== void 0 ? _l : td_switch_style_1.$switchOffColor
159
+ });
160
+ this.core.action.setStyleObj({
161
+ left: '1px',
162
+ color: td_switch_style_1.$switchOffColor
163
+ });
164
+ if (this.left) {
165
+ this.left.setStyleObj({
166
+ color: var_1.$colors.primary.base
167
+ });
168
+ }
169
+ if (this.right) {
170
+ this.right.setStyleObj({
171
+ color: var_1.$colors.default.base
172
+ });
173
+ }
174
+ if ((_m = this.config) === null || _m === void 0 ? void 0 : _m.inlinePrompt) {
175
+ this.core.setInnerChecked(false);
176
+ }
177
+ if ((_o = this.config) === null || _o === void 0 ? void 0 : _o.inactiveActionIcon) {
178
+ (_p = this.core.actionIcon) === null || _p === void 0 ? void 0 : _p.replaceSvg(this.config.inactiveActionIcon);
179
+ }
180
+ else if ((_q = this.config) === null || _q === void 0 ? void 0 : _q.inactiveActionText) {
181
+ (_s = (_r = this.core.actionSpan) === null || _r === void 0 ? void 0 : _r.textNode) === null || _s === void 0 ? void 0 : _s.setText(this.config.inactiveActionText);
182
+ }
183
+ }
184
+ }
185
+ switchValue() {
186
+ console.log('switchValue . ');
187
+ const config = this.config;
188
+ if ((config === null || config === void 0 ? void 0 : config.loading) || (config === null || config === void 0 ? void 0 : config.disabled)) {
189
+ return;
190
+ }
191
+ const beforeChange = config === null || config === void 0 ? void 0 : config.beforeChange;
192
+ if (!beforeChange) {
193
+ this.handleChange();
194
+ return;
195
+ }
196
+ const shouldChange = beforeChange();
197
+ const isPromiseOrBool = [
198
+ (0, utils_1.isPromise)(shouldChange),
199
+ (0, utils_1.isBoolean)(shouldChange)
200
+ ].includes(true);
201
+ if (!isPromiseOrBool) {
202
+ // throwError(
203
+ // COMPONENT_NAME,
204
+ // 'beforeChange must return type `Promise<boolean>` or `boolean`'
205
+ // )
206
+ console.error('beforeChange must return type `Promise<boolean>` or `boolean`');
207
+ }
208
+ if ((0, utils_1.isPromise)(shouldChange)) {
209
+ shouldChange
210
+ .then((result) => {
211
+ if (result) {
212
+ this.handleChange();
213
+ }
214
+ })
215
+ .catch((e) => {
216
+ // debugWarn(COMPONENT_NAME, `some error occurred: ${e}`)
217
+ console.error(`some error occurred: ${e}`);
218
+ });
219
+ }
220
+ else if (shouldChange) {
221
+ this.handleChange();
222
+ }
223
+ }
224
+ }
225
+ exports.TdSwitch = TdSwitch;
@@ -0,0 +1,97 @@
1
+ import { IUI, IUIConfig } from '../../../ui/ui.interface';
2
+ import { TypeSvgSvg } from '@type-dom/framework';
3
+ export interface ITdSwitch extends IUI {
4
+ className: 'TdSwitch';
5
+ }
6
+ export interface ITdSwitchConfig extends IUIConfig {
7
+ /**
8
+ * @description binding value, it should be equivalent to either `active-value` or `inactive-value`, by default it's `boolean` type
9
+ * default: false
10
+ */
11
+ modelValue?: boolean | number | string;
12
+ /**
13
+ * @description whether Switch is disabled
14
+ * default false
15
+ */
16
+ disabled?: boolean;
17
+ /**
18
+ * @description whether Switch is in loading state
19
+ * default false
20
+ */
21
+ loading?: boolean;
22
+ /**
23
+ * @description size of Switch
24
+ */
25
+ size?: 'large' | 'default' | 'small';
26
+ /**
27
+ * @description width of Switch
28
+ */
29
+ width?: number | string;
30
+ /**
31
+ * @description whether icon or text is displayed inside dot, only the first character will be rendered for text
32
+ * default false
33
+ */
34
+ inlinePrompt?: boolean;
35
+ /**
36
+ * @description component of the icon displayed in action when in `off` state
37
+ */
38
+ inactiveActionIcon?: TypeSvgSvg;
39
+ /**
40
+ * @description component of the icon displayed in action when in `on` state
41
+ */
42
+ activeActionIcon?: TypeSvgSvg;
43
+ /**
44
+ * @description component of the icon displayed when in `on` state, overrides `active-text`
45
+ */
46
+ activeIcon?: TypeSvgSvg;
47
+ /**
48
+ * @description component of the icon displayed when in `off` state, overrides `inactive-text`
49
+ */
50
+ inactiveIcon?: TypeSvgSvg;
51
+ /**
52
+ * @description text displayed when in `on` state
53
+ */
54
+ activeText?: string;
55
+ /**
56
+ * @description text displayed when in `off` state
57
+ */
58
+ inactiveText?: string;
59
+ /**
60
+ * @description switch value when in `on` state
61
+ * default true
62
+ */
63
+ activeValue?: boolean | string | number;
64
+ /**
65
+ * @description switch value when in `off` state
66
+ */
67
+ inactiveValue?: boolean | string | number;
68
+ /**
69
+ * @description input name of Switch
70
+ */
71
+ name?: string;
72
+ /**
73
+ * @description whether to trigger form validation
74
+ * default: true
75
+ */
76
+ validateEvent?: boolean;
77
+ /**
78
+ * @description before-change hook before the switch state changes. If `false` is returned or a `Promise` is returned and then is rejected, will stop switching
79
+ */
80
+ /**
81
+ * @description id for input
82
+ */
83
+ id?: string;
84
+ /**
85
+ * @description tabindex for input
86
+ */
87
+ tabindex?: string | number;
88
+ /**
89
+ * @description native input aria-label
90
+ */
91
+ label?: string;
92
+ switchOnColor?: string;
93
+ switchOffColor?: string;
94
+ activeActionText?: string;
95
+ inactiveActionText?: string;
96
+ beforeChange?: () => boolean;
97
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,47 @@
1
+ import { StyleCursor } from '@type-dom/framework';
2
+ export declare const $switchOnColor: string;
3
+ export declare const $switchOffColor: string;
4
+ export declare const $switchBorderColor: string;
5
+ export declare const $switchHeight: {
6
+ large: string;
7
+ default: string;
8
+ small: string;
9
+ };
10
+ export declare const $switchFontSize: {
11
+ large: string;
12
+ default: string;
13
+ small: string;
14
+ };
15
+ export declare const $switchCoreBorderRadius: {
16
+ large: string;
17
+ default: string;
18
+ small: string;
19
+ };
20
+ export declare const $switchCoreWidth: {
21
+ large: string;
22
+ default: string;
23
+ small: string;
24
+ };
25
+ export declare const $switchCoreHeight: {
26
+ large: string;
27
+ default: string;
28
+ small: string;
29
+ };
30
+ export declare const $switchButtonSize: {
31
+ large: string;
32
+ default: string;
33
+ small: string;
34
+ };
35
+ export declare const $switchContentPadding: {
36
+ large: string;
37
+ default: string;
38
+ small: string;
39
+ };
40
+ export declare const $switchLabel: {
41
+ transition: string;
42
+ display: string;
43
+ fontWeight: string;
44
+ cursor: StyleCursor;
45
+ verticalAlign: string;
46
+ color: string;
47
+ };
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.$switchLabel = exports.$switchContentPadding = exports.$switchButtonSize = exports.$switchCoreHeight = exports.$switchCoreWidth = exports.$switchCoreBorderRadius = exports.$switchFontSize = exports.$switchHeight = exports.$switchBorderColor = exports.$switchOffColor = exports.$switchOnColor = void 0;
4
+ const var_1 = require("../../../styles/var");
5
+ const framework_1 = require("@type-dom/framework");
6
+ exports.$switchOnColor = var_1.$colors.primary.base;
7
+ // -switch-on-color: var(--el-color-primary);
8
+ exports.$switchOffColor = var_1.$borderColor.base;
9
+ // --el-switch-off-color: var(--el-border-color);
10
+ exports.$switchBorderColor = var_1.$borderColor.base;
11
+ exports.$switchHeight = {
12
+ large: '40px',
13
+ default: '32px',
14
+ small: '24px'
15
+ };
16
+ exports.$switchFontSize = {
17
+ large: '14px',
18
+ default: '14px',
19
+ small: '12px'
20
+ };
21
+ exports.$switchCoreBorderRadius = {
22
+ large: '12px',
23
+ default: '10px',
24
+ small: '8px'
25
+ };
26
+ exports.$switchCoreWidth = {
27
+ large: '50px',
28
+ default: '40px',
29
+ small: '30px'
30
+ };
31
+ exports.$switchCoreHeight = {
32
+ large: '24px',
33
+ default: '20px',
34
+ small: '16px'
35
+ };
36
+ exports.$switchButtonSize = {
37
+ large: '20px',
38
+ default: '16px',
39
+ small: '12px'
40
+ };
41
+ exports.$switchContentPadding = {
42
+ large: '6px',
43
+ default: '4px',
44
+ small: '2px'
45
+ };
46
+ exports.$switchLabel = {
47
+ // transition: getCssVar('transition-duration-fast'),
48
+ transition: var_1.$transitionDurationFast,
49
+ // height: map.get($switch-core-height, 'default'),
50
+ display: 'inline-flex',
51
+ // font-size: map.get($switch-font-size, 'default'),
52
+ fontWeight: exports.$switchFontSize['default'],
53
+ cursor: framework_1.StyleCursor.pointer,
54
+ verticalAlign: 'middle',
55
+ // color: getCssVar('text-color', 'primary'),
56
+ color: var_1.$textColor.primary
57
+ };
@@ -0,0 +1,17 @@
1
+ import { Div, Span, TypeSpan } from '@type-dom/framework';
2
+ import { TdIcon } from '../../../basic/td-icon/td-icon.class';
3
+ import { ITdSwitchConfig } from '../td-switch.interface';
4
+ import { TdSwitch } from '../td-switch.class';
5
+ export declare class TdSwitchCore extends TypeSpan {
6
+ className: 'TdSwitchCore';
7
+ action: Div;
8
+ parent?: TdSwitch;
9
+ config?: ITdSwitchConfig;
10
+ inner?: Div;
11
+ private innerText?;
12
+ private innerIcon?;
13
+ actionIcon?: TdIcon;
14
+ actionSpan?: Span;
15
+ constructor(config?: ITdSwitchConfig);
16
+ setInnerChecked(checked: boolean): void;
17
+ }
@@ -0,0 +1,212 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TdSwitchCore = void 0;
4
+ const framework_1 = require("@type-dom/framework");
5
+ const svgs_1 = require("@type-dom/svgs");
6
+ const var_1 = require("../../../../styles/var");
7
+ const td_icon_class_1 = require("../../../basic/td-icon/td-icon.class");
8
+ const td_switch_style_1 = require("../td-switch.style");
9
+ class TdSwitchCore extends framework_1.TypeSpan {
10
+ constructor(config) {
11
+ super();
12
+ this.config = config;
13
+ this.className = 'TdSwitchCore';
14
+ this.addAttrObj({
15
+ name: 'switch-core'
16
+ });
17
+ this.addStyleObj({
18
+ display: 'inline-flex',
19
+ position: 'relative',
20
+ alignItems: 'center',
21
+ // border: '1px solid var(--el-switch-border-color, var(--el-switch-off-color))',
22
+ border: '1px solid ' + td_switch_style_1.$switchBorderColor,
23
+ outline: 'none',
24
+ borderRadius: '10px',
25
+ boxSizing: 'border-box',
26
+ background: td_switch_style_1.$switchOffColor, // 'var(--el-switch-off-color)',
27
+ // backgroundColor: $switchOnColor,
28
+ cursor: framework_1.StyleCursor.pointer,
29
+ // transition: border-color var(--el-transition-duration), background-color var(--el-transition-duration);
30
+ transition: var_1.$borderColor.base + ' ' + var_1.$transitionDuration + ', background-color ' + var_1.$transitionDuration,
31
+ // minWidth: map.get($switch-core-width, 'default');
32
+ minWidth: td_switch_style_1.$switchCoreWidth[(config === null || config === void 0 ? void 0 : config.size) || 'default'],
33
+ // height: map.get($switch-core-height, 'default');
34
+ height: td_switch_style_1.$switchCoreHeight[(config === null || config === void 0 ? void 0 : config.size) || 'default']
35
+ });
36
+ if (config === null || config === void 0 ? void 0 : config.inlinePrompt) {
37
+ this.inner = new framework_1.Div({
38
+ attrObj: {
39
+ name: 'switch-inner'
40
+ },
41
+ styleObj: {
42
+ width: '100%',
43
+ // transition: all getCssVar('transition-duration'),
44
+ transition: 'all ' + var_1.$transitionDuration,
45
+ // height: map.get($switch-button-size, 'default'),
46
+ height: td_switch_style_1.$switchButtonSize[(config === null || config === void 0 ? void 0 : config.size) || 'default'],
47
+ display: 'flex',
48
+ justifyContent: 'center',
49
+ alignItems: 'center',
50
+ overflow: 'hidden',
51
+ // padding: 0 #{map.get($switch-content-padding, 'default')} 0 calc(#{map.get(
52
+ // $switch-button-size,
53
+ // 'default'
54
+ // )} + 2px);
55
+ padding: '0 ' + td_switch_style_1.$switchContentPadding[(config === null || config === void 0 ? void 0 : config.size) || 'default'] + ' 0 calc(' + td_switch_style_1.$switchButtonSize[(config === null || config === void 0 ? void 0 : config.size) || 'default'] + ' + 2px)'
56
+ }
57
+ });
58
+ this.addChild(this.inner);
59
+ if ((config === null || config === void 0 ? void 0 : config.activeIcon) || (config === null || config === void 0 ? void 0 : config.inactiveIcon)) {
60
+ this.innerIcon = new td_icon_class_1.TdIcon({
61
+ svgObj: (config === null || config === void 0 ? void 0 : config.modelValue) === (config === null || config === void 0 ? void 0 : config.activeValue) ? config === null || config === void 0 ? void 0 : config.activeIcon : config === null || config === void 0 ? void 0 : config.inactiveIcon,
62
+ attrObj: {
63
+ name: 'switch-inner-icon'
64
+ },
65
+ styleObj: {
66
+ fontSize: '12px', // $fontSizes.base,
67
+ // color: var(--el-color-white),
68
+ color: var_1.$colorWhite,
69
+ userSelect: 'none',
70
+ overflow: 'hidden',
71
+ textOverflow: 'ellipsis',
72
+ whiteSpace: 'nowrap'
73
+ }
74
+ });
75
+ this.inner.addChild(this.innerIcon);
76
+ }
77
+ else if ((config === null || config === void 0 ? void 0 : config.activeText) || (config === null || config === void 0 ? void 0 : config.inactiveText)) {
78
+ this.innerText = new framework_1.Span({
79
+ text: (config === null || config === void 0 ? void 0 : config.modelValue) === (config === null || config === void 0 ? void 0 : config.activeValue) ? config === null || config === void 0 ? void 0 : config.activeText : config === null || config === void 0 ? void 0 : config.inactiveText,
80
+ attrObj: {
81
+ name: 'switch-inner-text'
82
+ },
83
+ styleObj: {
84
+ // fontSize: $switchFontSize[config?.size || 'default'],
85
+ fontSize: '12px', // $fontSizes.base,
86
+ // color: var(--el-color-white),
87
+ color: var_1.$colorWhite,
88
+ userSelect: 'none',
89
+ overflow: 'hidden',
90
+ textOverflow: 'ellipsis',
91
+ whiteSpace: 'nowrap'
92
+ }
93
+ });
94
+ this.inner.addChild(this.innerText);
95
+ }
96
+ }
97
+ this.action = new framework_1.Div({
98
+ attrObj: {
99
+ name: 'switch-action'
100
+ },
101
+ styleObj: {
102
+ position: 'absolute',
103
+ left: '1px',
104
+ // left: 'calc(100% - 17px)',
105
+ // borderRadius: var(--el-border-radius-circle),
106
+ borderRadius: var_1.$borderRadius.circle,
107
+ // transition: all var(--el-transition-duration),
108
+ transition: 'all ' + var_1.$transitionDuration,
109
+ width: td_switch_style_1.$switchButtonSize[(config === null || config === void 0 ? void 0 : config.size) || 'default'],
110
+ // width: map.get($switch-button-size, 'default');
111
+ height: td_switch_style_1.$switchButtonSize[(config === null || config === void 0 ? void 0 : config.size) || 'default'],
112
+ // height: map.get($switch-button-size, 'default');
113
+ // backgroundColor: var(--el-color-white),
114
+ backgroundColor: var_1.$colorWhite,
115
+ display: 'flex',
116
+ justifyContent: 'center',
117
+ alignItems: 'center',
118
+ // color: var(--el-switch-off-color),
119
+ color: td_switch_style_1.$switchOffColor
120
+ }
121
+ });
122
+ if (config === null || config === void 0 ? void 0 : config.loading) {
123
+ const loadingIcon = new td_icon_class_1.TdIcon({
124
+ svgObj: new svgs_1.ElLoadingSvg(),
125
+ attrObj: {
126
+ name: 'switch-loading-icon'
127
+ },
128
+ loading: true
129
+ });
130
+ this.action.addChild(loadingIcon);
131
+ }
132
+ else if ((config === null || config === void 0 ? void 0 : config.modelValue) === (config === null || config === void 0 ? void 0 : config.activeValue)) {
133
+ this.action.addStyleObj({
134
+ color: td_switch_style_1.$switchOnColor
135
+ });
136
+ if (config === null || config === void 0 ? void 0 : config.activeActionIcon) {
137
+ this.actionIcon = new td_icon_class_1.TdIcon({
138
+ svgObj: config.activeActionIcon,
139
+ attrObj: {
140
+ name: 'switch-action-icon'
141
+ }
142
+ });
143
+ this.action.addChild(this.actionIcon);
144
+ }
145
+ else if (config === null || config === void 0 ? void 0 : config.activeActionText) {
146
+ this.actionSpan = new framework_1.Span({
147
+ text: config.activeActionText,
148
+ attrObj: {
149
+ name: 'switch-action-text'
150
+ }
151
+ });
152
+ this.action.addChild(this.actionSpan);
153
+ }
154
+ }
155
+ else if ((config === null || config === void 0 ? void 0 : config.modelValue) !== (config === null || config === void 0 ? void 0 : config.activeValue)) {
156
+ if (config === null || config === void 0 ? void 0 : config.inactiveActionIcon) {
157
+ this.actionIcon = new td_icon_class_1.TdIcon({
158
+ svgObj: config.inactiveActionIcon,
159
+ attrObj: {
160
+ name: 'switch-action-icon'
161
+ }
162
+ });
163
+ this.action.addChild(this.actionIcon);
164
+ }
165
+ else if (config === null || config === void 0 ? void 0 : config.inactiveActionText) {
166
+ this.actionSpan = new framework_1.Span({
167
+ text: config.inactiveActionText,
168
+ attrObj: {
169
+ name: 'switch-action-text'
170
+ }
171
+ });
172
+ this.action.addChild(this.actionSpan);
173
+ }
174
+ }
175
+ this.addChild(this.action);
176
+ }
177
+ setInnerChecked(checked) {
178
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
179
+ if (checked) {
180
+ (_a = this.inner) === null || _a === void 0 ? void 0 : _a.setStyleObj({
181
+ // padding: 0 calc(#{map.get($switch-button-size, 'default')} + 2px) 0 #{map.get(
182
+ // $switch-content-padding,
183
+ // 'default'
184
+ // )};
185
+ padding: '0 ' + 'calc(' + td_switch_style_1.$switchButtonSize[((_b = this.config) === null || _b === void 0 ? void 0 : _b.size) || 'default'] + ' + 2px)' + '0 ' +
186
+ td_switch_style_1.$switchContentPadding[((_c = this.config) === null || _c === void 0 ? void 0 : _c.size) || 'default']
187
+ });
188
+ if (((_d = this.config) === null || _d === void 0 ? void 0 : _d.activeIcon) || ((_e = this.config) === null || _e === void 0 ? void 0 : _e.inactiveIcon)) {
189
+ (_f = this.innerIcon) === null || _f === void 0 ? void 0 : _f.replaceSvg(this.config.activeIcon);
190
+ }
191
+ else if (((_g = this.config) === null || _g === void 0 ? void 0 : _g.activeText) || ((_h = this.config) === null || _h === void 0 ? void 0 : _h.inactiveText)) {
192
+ (_k = (_j = this.innerText) === null || _j === void 0 ? void 0 : _j.textNode) === null || _k === void 0 ? void 0 : _k.setText(((_l = this.config) === null || _l === void 0 ? void 0 : _l.activeText) || '');
193
+ }
194
+ }
195
+ else {
196
+ (_m = this.inner) === null || _m === void 0 ? void 0 : _m.setStyleObj({
197
+ // padding: 0 #{map.get($switch-content-padding, 'default')} 0 calc(#{map.get(
198
+ // $switch-button-size,
199
+ // 'default'
200
+ // )} + 2px);
201
+ padding: '0 ' + td_switch_style_1.$switchContentPadding[((_o = this.config) === null || _o === void 0 ? void 0 : _o.size) || 'default'] + ' 0 calc(' + td_switch_style_1.$switchButtonSize[((_p = this.config) === null || _p === void 0 ? void 0 : _p.size) || 'default'] + ' + 2px)'
202
+ });
203
+ if (((_q = this.config) === null || _q === void 0 ? void 0 : _q.activeIcon) || ((_r = this.config) === null || _r === void 0 ? void 0 : _r.inactiveIcon)) {
204
+ (_s = this.innerIcon) === null || _s === void 0 ? void 0 : _s.replaceSvg(this.config.inactiveIcon);
205
+ }
206
+ else if (((_t = this.config) === null || _t === void 0 ? void 0 : _t.activeText) || ((_u = this.config) === null || _u === void 0 ? void 0 : _u.inactiveText)) {
207
+ (_w = (_v = this.innerText) === null || _v === void 0 ? void 0 : _v.textNode) === null || _w === void 0 ? void 0 : _w.setText(((_x = this.config) === null || _x === void 0 ? void 0 : _x.inactiveText) || '');
208
+ }
209
+ }
210
+ }
211
+ }
212
+ exports.TdSwitchCore = TdSwitchCore;
@@ -0,0 +1,7 @@
1
+ import { TypeSpan } from '@type-dom/framework';
2
+ import { ITdSwitchConfig } from '../td-switch.interface';
3
+ export declare class TdSwitchLeft extends TypeSpan {
4
+ className: 'TdSwitchLeft';
5
+ config?: ITdSwitchConfig;
6
+ constructor(config?: ITdSwitchConfig);
7
+ }