@toife/vue 2.2.0 → 3.0.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 (324) hide show
  1. package/README.md +171 -0
  2. package/package.json +41 -9
  3. package/src/components/action/action.composable.ts +32 -0
  4. package/src/components/action/action.html +25 -0
  5. package/src/components/action/action.scss +106 -0
  6. package/src/components/action/action.type.ts +35 -0
  7. package/src/components/action/action.vue +82 -0
  8. package/src/components/action/index.ts +9 -0
  9. package/src/components/app/app.constants.ts +1 -0
  10. package/src/components/app/app.html +24 -0
  11. package/src/components/app/app.scss +27 -0
  12. package/src/components/app/app.type.ts +21 -0
  13. package/src/components/app/app.vue +45 -0
  14. package/src/components/app/index.ts +3 -0
  15. package/src/components/avatar/avatar.html +3 -0
  16. package/src/components/avatar/avatar.scss +35 -0
  17. package/src/components/avatar/avatar.type.ts +6 -0
  18. package/src/components/avatar/avatar.vue +45 -0
  19. package/src/components/avatar/index.ts +2 -0
  20. package/src/components/button/button.html +6 -0
  21. package/src/components/button/button.scss +113 -0
  22. package/src/components/button/button.type.ts +14 -0
  23. package/src/components/button/button.vue +66 -0
  24. package/src/components/button/index.ts +2 -0
  25. package/src/components/cable/cable.constants.ts +1 -0
  26. package/src/components/cable/cable.html +3 -0
  27. package/src/components/cable/cable.scss +37 -0
  28. package/src/components/cable/cable.type.ts +11 -0
  29. package/src/components/cable/cable.vue +33 -0
  30. package/src/components/cable/index.ts +3 -0
  31. package/src/components/card/card/card.constants.ts +1 -0
  32. package/src/components/card/card/card.html +3 -0
  33. package/src/components/card/card/card.scss +34 -0
  34. package/src/components/card/card/card.type.ts +14 -0
  35. package/src/components/card/card/card.vue +62 -0
  36. package/src/components/card/card/index.ts +3 -0
  37. package/src/components/card/card-body/card-body.html +3 -0
  38. package/src/components/card/card-body/card-body.scss +23 -0
  39. package/src/components/card/card-body/card-body.vue +14 -0
  40. package/src/components/card/card-body/index.ts +1 -0
  41. package/src/components/card/card-footer/card-footer.html +3 -0
  42. package/src/components/card/card-footer/card-footer.scss +31 -0
  43. package/src/components/card/card-footer/card-footer.vue +28 -0
  44. package/src/components/card/card-footer/index.ts +1 -0
  45. package/src/components/card/card-header/card-header.html +3 -0
  46. package/src/components/card/card-header/card-header.scss +31 -0
  47. package/src/components/card/card-header/card-header.vue +28 -0
  48. package/src/components/card/card-header/index.ts +1 -0
  49. package/src/components/card/index.ts +4 -0
  50. package/src/components/checkbox/checkbox.html +13 -0
  51. package/src/components/checkbox/checkbox.scss +138 -0
  52. package/src/components/checkbox/checkbox.type.ts +17 -0
  53. package/src/components/checkbox/checkbox.vue +91 -0
  54. package/src/components/checkbox/index.ts +2 -0
  55. package/src/components/collapse/collapse.html +16 -0
  56. package/src/components/collapse/collapse.scss +59 -0
  57. package/src/components/collapse/collapse.type.ts +11 -0
  58. package/src/components/collapse/collapse.vue +131 -0
  59. package/src/components/collapse/index.ts +2 -0
  60. package/src/components/container/container.html +1 -0
  61. package/src/components/container/container.scss +10 -0
  62. package/src/components/container/container.vue +14 -0
  63. package/src/components/container/index.ts +1 -0
  64. package/src/components/decision-modal/decision-modal.composable.ts +32 -0
  65. package/src/components/decision-modal/decision-modal.html +29 -0
  66. package/src/components/decision-modal/decision-modal.scss +136 -0
  67. package/src/components/decision-modal/decision-modal.type.ts +35 -0
  68. package/src/components/decision-modal/decision-modal.vue +98 -0
  69. package/src/components/decision-modal/index.ts +9 -0
  70. package/src/components/divider/divider.html +1 -0
  71. package/src/components/divider/divider.scss +29 -0
  72. package/src/components/divider/divider.type.ts +6 -0
  73. package/src/components/divider/divider.vue +34 -0
  74. package/src/components/divider/index.ts +2 -0
  75. package/src/components/field/field.html +1 -0
  76. package/src/components/field/field.type.ts +43 -0
  77. package/src/components/field/field.vue +85 -0
  78. package/src/components/field/index.ts +2 -0
  79. package/src/components/field/outline/index.ts +1 -0
  80. package/src/components/field/outline/outline.html +32 -0
  81. package/src/components/field/outline/outline.scss +224 -0
  82. package/src/components/field/outline/outline.vue +243 -0
  83. package/src/components/form-group/form-group.html +3 -0
  84. package/src/components/form-group/form-group.scss +91 -0
  85. package/src/components/form-group/form-group.type.ts +5 -0
  86. package/src/components/form-group/form-group.vue +21 -0
  87. package/src/components/form-group/index.ts +2 -0
  88. package/src/components/gesture-indicator/gesture-indicator.html +1 -0
  89. package/src/components/gesture-indicator/gesture-indicator.scss +45 -0
  90. package/{dist/components/gesture-indicator/gesture-indicator.type.d.ts → src/components/gesture-indicator/gesture-indicator.type.ts} +2 -1
  91. package/src/components/gesture-indicator/gesture-indicator.vue +32 -0
  92. package/src/components/gesture-indicator/index.ts +1 -0
  93. package/src/components/image/image.html +1 -0
  94. package/src/components/image/image.scss +1 -0
  95. package/src/components/image/image.type.ts +5 -0
  96. package/src/components/image/image.vue +25 -0
  97. package/src/components/image/index.ts +2 -0
  98. package/src/components/index.ts +27 -0
  99. package/src/components/modal/index.ts +2 -0
  100. package/src/components/modal/modal.html +20 -0
  101. package/src/components/modal/modal.scss +78 -0
  102. package/src/components/modal/modal.type.ts +21 -0
  103. package/src/components/modal/modal.vue +186 -0
  104. package/src/components/page/index.ts +1 -0
  105. package/src/components/page/page.html +3 -0
  106. package/src/components/page/page.scss +17 -0
  107. package/src/components/page/page.vue +14 -0
  108. package/src/components/present/index.ts +3 -0
  109. package/src/components/present/present.composable.ts +21 -0
  110. package/src/components/present/present.html +9 -0
  111. package/src/components/present/present.scss +81 -0
  112. package/src/components/present/present.type.ts +26 -0
  113. package/src/components/present/present.vue +198 -0
  114. package/src/components/radio/index.ts +2 -0
  115. package/src/components/radio/radio/index.ts +2 -0
  116. package/src/components/radio/radio/radio.html +11 -0
  117. package/src/components/radio/radio/radio.scss +125 -0
  118. package/src/components/radio/radio/radio.type.ts +11 -0
  119. package/src/components/radio/radio/radio.vue +103 -0
  120. package/src/components/radio/radio-group/index.ts +7 -0
  121. package/src/components/radio/radio-group/radio-group.constants.ts +1 -0
  122. package/src/components/radio/radio-group/radio-group.html +3 -0
  123. package/src/components/radio/radio-group/radio-group.scss +16 -0
  124. package/src/components/radio/radio-group/radio-group.type.ts +28 -0
  125. package/src/components/radio/radio-group/radio-group.vue +62 -0
  126. package/src/components/refresher/index.ts +2 -0
  127. package/src/components/refresher/refresher.html +6 -0
  128. package/src/components/refresher/refresher.scss +36 -0
  129. package/src/components/refresher/refresher.type.ts +16 -0
  130. package/src/components/refresher/refresher.vue +137 -0
  131. package/src/components/route/index.ts +5 -0
  132. package/src/components/route/route-navigator/index.ts +2 -0
  133. package/src/components/route/route-navigator/route-navigator.html +19 -0
  134. package/src/components/route/route-navigator/route-navigator.scss +127 -0
  135. package/src/components/route/route-navigator/route-navigator.type.ts +12 -0
  136. package/src/components/route/route-navigator/route-navigator.vue +250 -0
  137. package/src/components/route/route-outlet/index.ts +1 -0
  138. package/src/components/route/route-outlet/route-outlet.html +1 -0
  139. package/src/components/route/route-outlet/route-outlet.vue +30 -0
  140. package/src/components/route/route-provider/index.ts +3 -0
  141. package/src/components/route/route-provider/route-provider.constant.ts +1 -0
  142. package/src/components/route/route-provider/route-provider.html +1 -0
  143. package/src/components/route/route-provider/route-provider.type.ts +10 -0
  144. package/src/components/route/route-provider/route-provider.vue +20 -0
  145. package/src/components/route/route-wrapper/index.ts +3 -0
  146. package/src/components/route/route-wrapper/route-wrapper.composable.ts +43 -0
  147. package/src/components/route/route-wrapper/route-wrapper.html +3 -0
  148. package/src/components/route/route-wrapper/route-wrapper.type.ts +3 -0
  149. package/src/components/route/route-wrapper/route-wrapper.vue +43 -0
  150. package/src/components/route/route.type.ts +7 -0
  151. package/src/components/route/route.util.ts +8 -0
  152. package/src/components/segmented-field/index.ts +7 -0
  153. package/src/components/segmented-field/segmented-field.html +17 -0
  154. package/src/components/segmented-field/segmented-field.scss +52 -0
  155. package/src/components/segmented-field/segmented-field.type.ts +29 -0
  156. package/src/components/segmented-field/segmented-field.vue +151 -0
  157. package/src/components/skeleton/index.ts +2 -0
  158. package/src/components/skeleton/skeleton.html +1 -0
  159. package/src/components/skeleton/skeleton.scss +45 -0
  160. package/src/components/skeleton/skeleton.type.ts +7 -0
  161. package/src/components/skeleton/skeleton.vue +38 -0
  162. package/src/components/switch/index.ts +2 -0
  163. package/src/components/switch/switch.html +15 -0
  164. package/src/components/switch/switch.scss +134 -0
  165. package/src/components/switch/switch.type.ts +13 -0
  166. package/src/components/switch/switch.vue +92 -0
  167. package/src/components/tabs/index.ts +2 -0
  168. package/src/components/tabs/tab/index.ts +2 -0
  169. package/src/components/tabs/tab/tab.html +5 -0
  170. package/src/components/tabs/tab/tab.type.ts +5 -0
  171. package/src/components/tabs/tab/tab.vue +38 -0
  172. package/src/components/tabs/tabs/index.ts +9 -0
  173. package/src/components/tabs/tabs/tabs.constants.ts +1 -0
  174. package/src/components/tabs/tabs/tabs.html +3 -0
  175. package/src/components/tabs/tabs/tabs.scss +272 -0
  176. package/src/components/tabs/tabs/tabs.type.ts +36 -0
  177. package/src/components/tabs/tabs/tabs.vue +159 -0
  178. package/src/components/toast/index.ts +4 -0
  179. package/src/components/toast/toast/index.ts +1 -0
  180. package/src/components/toast/toast/toast.html +9 -0
  181. package/src/components/toast/toast/toast.scss +61 -0
  182. package/src/components/toast/toast/toast.vue +34 -0
  183. package/src/components/toast/toast-content/index.ts +1 -0
  184. package/src/components/toast/toast-content/toast-content.html +1 -0
  185. package/src/components/toast/toast-content/toast-content.scss +41 -0
  186. package/src/components/toast/toast-content/toast-content.vue +59 -0
  187. package/src/components/toast/toast.composable.ts +22 -0
  188. package/src/components/toast/toast.type.ts +25 -0
  189. package/src/components/toolbar/index.ts +2 -0
  190. package/src/components/toolbar/toolbar.html +5 -0
  191. package/src/components/toolbar/toolbar.scss +79 -0
  192. package/src/components/toolbar/toolbar.type.ts +7 -0
  193. package/src/components/toolbar/toolbar.vue +47 -0
  194. package/src/env.d.ts +7 -0
  195. package/src/factory.ts +81 -0
  196. package/src/index.ts +4 -0
  197. package/{dist/type.d.ts → src/type.ts} +1 -1
  198. package/src/utils/element.ts +16 -0
  199. package/src/utils/events.ts +12 -0
  200. package/src/utils/index.ts +3 -0
  201. package/src/utils/style/index.ts +42 -0
  202. package/dist/components/action/action.type.d.ts +0 -17
  203. package/dist/components/action/action.vue.d.ts +0 -14
  204. package/dist/components/action/factory.d.ts +0 -3
  205. package/dist/components/action/index.d.ts +0 -2
  206. package/dist/components/alert/alert.type.d.ts +0 -16
  207. package/dist/components/alert/alert.vue.d.ts +0 -14
  208. package/dist/components/alert/factory.d.ts +0 -3
  209. package/dist/components/alert/index.d.ts +0 -2
  210. package/dist/components/app/app.type.d.ts +0 -1
  211. package/dist/components/app/app.vue.d.ts +0 -3
  212. package/dist/components/app/index.d.ts +0 -1
  213. package/dist/components/avatar/avatar.type.d.ts +0 -4
  214. package/dist/components/avatar/avatar.vue.d.ts +0 -6
  215. package/dist/components/avatar/index.d.ts +0 -1
  216. package/dist/components/back-button/back-button.type.d.ts +0 -4
  217. package/dist/components/back-button/back-button.vue.d.ts +0 -3
  218. package/dist/components/back-button/index.d.ts +0 -1
  219. package/dist/components/button/button.type.d.ts +0 -10
  220. package/dist/components/button/button.vue.d.ts +0 -12
  221. package/dist/components/button/index.d.ts +0 -1
  222. package/dist/components/cable/cable.type.d.ts +0 -4
  223. package/dist/components/cable/cable.vue.d.ts +0 -6
  224. package/dist/components/cable/index.d.ts +0 -1
  225. package/dist/components/card/card.type.d.ts +0 -3
  226. package/dist/components/card/card.vue.d.ts +0 -5
  227. package/dist/components/card/index.d.ts +0 -1
  228. package/dist/components/checkbox/checkbox.type.d.ts +0 -12
  229. package/dist/components/checkbox/checkbox.vue.d.ts +0 -14
  230. package/dist/components/checkbox/index.d.ts +0 -1
  231. package/dist/components/collapse/collapse.type.d.ts +0 -6
  232. package/dist/components/collapse/collapse.vue.d.ts +0 -7
  233. package/dist/components/collapse/index.d.ts +0 -1
  234. package/dist/components/content/content.type.d.ts +0 -1
  235. package/dist/components/content/content.vue.d.ts +0 -3
  236. package/dist/components/content/index.d.ts +0 -1
  237. package/dist/components/divider/divider.type.d.ts +0 -3
  238. package/dist/components/divider/divider.vue.d.ts +0 -5
  239. package/dist/components/divider/index.d.ts +0 -1
  240. package/dist/components/flex/flex.type.d.ts +0 -4
  241. package/dist/components/flex/flex.vue.d.ts +0 -6
  242. package/dist/components/flex/index.d.ts +0 -1
  243. package/dist/components/gesture-indicator/gesture-indicator.vue.d.ts +0 -5
  244. package/dist/components/gesture-indicator/index.d.ts +0 -1
  245. package/dist/components/grid/grid.type.d.ts +0 -4
  246. package/dist/components/grid/grid.vue.d.ts +0 -6
  247. package/dist/components/grid/index.d.ts +0 -1
  248. package/dist/components/icon-spinner/icon-spinner.type.d.ts +0 -4
  249. package/dist/components/icon-spinner/icon-spinner.vue.d.ts +0 -6
  250. package/dist/components/icon-spinner/index.d.ts +0 -1
  251. package/dist/components/image/image.type.d.ts +0 -4
  252. package/dist/components/image/image.vue.d.ts +0 -3
  253. package/dist/components/image/index.d.ts +0 -1
  254. package/dist/components/index.d.ts +0 -36
  255. package/dist/components/input/index.d.ts +0 -1
  256. package/dist/components/input/input.type.d.ts +0 -15
  257. package/dist/components/input/input.vue.d.ts +0 -16
  258. package/dist/components/keyboard-space/factory.d.ts +0 -3
  259. package/dist/components/keyboard-space/index.d.ts +0 -2
  260. package/dist/components/keyboard-space/keyboard-space.type.d.ts +0 -1
  261. package/dist/components/keyboard-space/keyboard-space.vue.d.ts +0 -3
  262. package/dist/components/loading/factory.d.ts +0 -4
  263. package/dist/components/loading/index.d.ts +0 -2
  264. package/dist/components/loading/loading.type.d.ts +0 -6
  265. package/dist/components/loading/loading.vue.d.ts +0 -12
  266. package/dist/components/present/factory.d.ts +0 -1
  267. package/dist/components/present/index.d.ts +0 -2
  268. package/dist/components/present/present.type.d.ts +0 -13
  269. package/dist/components/present/present.vue.d.ts +0 -17
  270. package/dist/components/refresher/index.d.ts +0 -1
  271. package/dist/components/refresher/refresher.type.d.ts +0 -11
  272. package/dist/components/refresher/refresher.vue.d.ts +0 -17
  273. package/dist/components/richtext/index.d.ts +0 -1
  274. package/dist/components/richtext/richtext.type.d.ts +0 -1
  275. package/dist/components/richtext/richtext.vue.d.ts +0 -3
  276. package/dist/components/ripple/index.d.ts +0 -1
  277. package/dist/components/ripple/ripple.type.d.ts +0 -3
  278. package/dist/components/ripple/ripple.vue.d.ts +0 -5
  279. package/dist/components/screen/index.d.ts +0 -1
  280. package/dist/components/screen/screen.type.d.ts +0 -1
  281. package/dist/components/screen/screen.vue.d.ts +0 -3
  282. package/dist/components/screen-router/factory.d.ts +0 -19
  283. package/dist/components/screen-router/index.d.ts +0 -2
  284. package/dist/components/screen-router/screen-router.type.d.ts +0 -8
  285. package/dist/components/screen-router/screen-router.vue.d.ts +0 -9
  286. package/dist/components/sheet/index.d.ts +0 -1
  287. package/dist/components/sheet/sheet.type.d.ts +0 -18
  288. package/dist/components/sheet/sheet.vue.d.ts +0 -18
  289. package/dist/components/skeleton/index.d.ts +0 -1
  290. package/dist/components/skeleton/skeleton.type.d.ts +0 -6
  291. package/dist/components/skeleton/skeleton.vue.d.ts +0 -8
  292. package/dist/components/switch/index.d.ts +0 -1
  293. package/dist/components/switch/switch.type.d.ts +0 -7
  294. package/dist/components/switch/switch.vue.d.ts +0 -9
  295. package/dist/components/tab/index.d.ts +0 -1
  296. package/dist/components/tab/tab.type.d.ts +0 -4
  297. package/dist/components/tab/tab.vue.d.ts +0 -5
  298. package/dist/components/tabs/index.d.ts +0 -1
  299. package/dist/components/tabs/tabs.type.d.ts +0 -13
  300. package/dist/components/tabs/tabs.vue.d.ts +0 -15
  301. package/dist/components/text/index.d.ts +0 -1
  302. package/dist/components/text/text.type.d.ts +0 -4
  303. package/dist/components/text/text.vue.d.ts +0 -6
  304. package/dist/components/textarea/index.d.ts +0 -1
  305. package/dist/components/textarea/textarea.type.d.ts +0 -1
  306. package/dist/components/textarea/textarea.vue.d.ts +0 -3
  307. package/dist/components/toast/factory.d.ts +0 -3
  308. package/dist/components/toast/index.d.ts +0 -2
  309. package/dist/components/toast/toast.type.d.ts +0 -11
  310. package/dist/components/toast/toast.vue.d.ts +0 -16
  311. package/dist/components/toggle-password/index.d.ts +0 -1
  312. package/dist/components/toggle-password/toggle-password.type.d.ts +0 -6
  313. package/dist/components/toggle-password/toggle-password.vue.d.ts +0 -9
  314. package/dist/components/toolbar/index.d.ts +0 -1
  315. package/dist/components/toolbar/toolbar.type.d.ts +0 -5
  316. package/dist/components/toolbar/toolbar.vue.d.ts +0 -7
  317. package/dist/factory.d.ts +0 -4
  318. package/dist/index.css +0 -1
  319. package/dist/index.d.ts +0 -4
  320. package/dist/index.es.js +0 -1836
  321. package/dist/index.umd.js +0 -1
  322. package/dist/utils/element.d.ts +0 -2
  323. package/dist/utils/events.d.ts +0 -1
  324. package/dist/utils/index.d.ts +0 -2
@@ -0,0 +1,2 @@
1
+ export { default as Tab } from "./tab.vue";
2
+ export type { TabProps } from "./tab.type";
@@ -0,0 +1,5 @@
1
+ <li v-bind="tabAttrs">
2
+ <CustomButton block :role="role" :shape="shape" @click="handleClick">
3
+ <slot />
4
+ </CustomButton>
5
+ </li>
@@ -0,0 +1,5 @@
1
+ // Define
2
+ export type TabProps = {
3
+ value?: string;
4
+ disabled?: boolean;
5
+ };
@@ -0,0 +1,38 @@
1
+ <template src="./tab.html"></template>
2
+ <script lang="ts" setup>
3
+ import { computed, inject } from "vue";
4
+ import { Button as CustomButton } from "../../button";
5
+ import { type TabProps } from "./tab.type";
6
+ import { withPrefix } from "../../../utils";
7
+ import { type TabsProviderState, TABS_PROVIDER_STATE_KEY } from "../tabs";
8
+
9
+ /// Define
10
+ /// ------------------------------------------------------------
11
+ const props = withDefaults(defineProps<TabProps>(), {
12
+ disabled: false,
13
+ });
14
+ const tabsState = inject<TabsProviderState>(TABS_PROVIDER_STATE_KEY);
15
+
16
+ /// Computed
17
+ /// ------------------------------------------------------------
18
+ const role = computed(() => tabsState?.role.value || "");
19
+ const shape = computed(() => tabsState?.shape.value || "");
20
+ const isActive = computed(() => tabsState?.activeValue.value === props.value);
21
+ const tabAttrs = computed(() => {
22
+ return {
23
+ class: [
24
+ withPrefix("tab"),
25
+ {
26
+ active: isActive.value,
27
+ },
28
+ ],
29
+ };
30
+ });
31
+
32
+ /// Methods
33
+ /// ------------------------------------------------------------
34
+ const handleClick = () => {
35
+ if (props.disabled) return;
36
+ tabsState?.setValue(props.value || "");
37
+ };
38
+ </script>
@@ -0,0 +1,9 @@
1
+ export { default as Tabs } from "./tabs.vue";
2
+ export type {
3
+ TabsProps,
4
+ TabsEmit,
5
+ TabsProviderState,
6
+ TabsVariant,
7
+ TabsPlacement,
8
+ } from "./tabs.type";
9
+ export { TABS_PROVIDER_STATE_KEY } from "./tabs.constants";
@@ -0,0 +1 @@
1
+ export const TABS_PROVIDER_STATE_KEY = "tabs-state";
@@ -0,0 +1,3 @@
1
+ <ul ref="container" v-bind="tabsAttrs">
2
+ <slot />
3
+ </ul>
@@ -0,0 +1,272 @@
1
+ @use "@toife/sass-layer-generator" as sass;
2
+
3
+ // Class name
4
+ $tabs: sass.fn-naming-prefix("tabs");
5
+ $tab: sass.fn-naming-prefix("tab");
6
+ $button: sass.fn-naming-prefix("button");
7
+
8
+ // Property name
9
+ $space-x: sass.fn-naming-var("spacing", "x");
10
+ $space-y: sass.fn-naming-var("spacing", "y");
11
+
12
+ // layer: item
13
+ $button-color: sass.fn-naming-var("item", "color");
14
+ $border-radius: sass.fn-naming-var("border-radius");
15
+ $border-width: sass.fn-naming-var("stroke", "width");
16
+ $border-color: sass.fn-naming-var("surface", "border-color");
17
+
18
+ $transition-duration: sass.fn-naming-var("motion", "duration");
19
+ $background-color: sass.fn-naming-var("item", "background-color");
20
+ $color: sass.fn-naming-var("item", "color");
21
+ $color-base: sass.fn-naming-var("base", "color");
22
+
23
+ $highlight-top: sass.fn-naming-var("highlight", "top");
24
+ $highlight-left: sass.fn-naming-var("highlight", "left");
25
+ $highlight-width: sass.fn-naming-var("highlight", "width");
26
+ $highlight-height: sass.fn-naming-var("highlight", "height");
27
+ $highlight-space-x: sass.fn-naming-var("highlight", "space-x");
28
+ $highlight-space-y: sass.fn-naming-var("highlight", "space-y");
29
+
30
+ .#{$tabs} {
31
+ display: flex;
32
+ align-items: center;
33
+ position: relative;
34
+ margin: 0;
35
+ list-style: none;
36
+ border: #{$border-width} solid transparent;
37
+ transition:
38
+ box-shadow #{$transition-duration} ease,
39
+ border-color #{$transition-duration} ease,
40
+ background-color #{$transition-duration} ease,
41
+ color #{$transition-duration} ease,
42
+ border-radius #{$transition-duration} ease;
43
+
44
+ > * {
45
+ z-index: 1;
46
+ }
47
+
48
+ &::before {
49
+ content: "";
50
+ z-index: 1;
51
+ display: block;
52
+ position: absolute;
53
+ top: 0;
54
+ left: 0;
55
+ width: #{$highlight-width};
56
+ height: #{$highlight-height};
57
+ transform: translate(#{$highlight-left}, #{$highlight-top});
58
+ box-sizing: border-box;
59
+ background-color: rgb(#{$background-color});
60
+ border-radius: #{$border-radius};
61
+ }
62
+
63
+ &.top-start,
64
+ &.bottom-start,
65
+ &.left-start,
66
+ &.right-start {
67
+ justify-content: flex-start;
68
+ }
69
+
70
+ &.top-end,
71
+ &.bottom-end,
72
+ &.left-end,
73
+ &.right-end {
74
+ justify-content: flex-end;
75
+ }
76
+
77
+ &.top-center,
78
+ &.bottom-center,
79
+ &.left-center,
80
+ &.right-center {
81
+ justify-content: center;
82
+ }
83
+
84
+ // Direction
85
+ &.top-start,
86
+ &.top-center,
87
+ &.top-end,
88
+ &.bottom-start,
89
+ &.bottom-center,
90
+ &.bottom-end {
91
+ flex-direction: row;
92
+ height: fit-content;
93
+ width: 100%;
94
+
95
+ > * {
96
+ height: 100%;
97
+ }
98
+ }
99
+
100
+ &.left-start,
101
+ &.left-center,
102
+ &.left-end,
103
+ &.right-start,
104
+ &.right-center,
105
+ &.right-end {
106
+ flex-direction: column;
107
+ width: fit-content;
108
+ height: 100%;
109
+
110
+ > * {
111
+ width: 100%;
112
+ }
113
+ }
114
+
115
+ &.divider {
116
+ &.top-start,
117
+ &.top-center,
118
+ &.top-end {
119
+ border-bottom-color: rgb(#{$border-color});
120
+ }
121
+
122
+ &.bottom-start,
123
+ &.bottom-center,
124
+ &.bottom-end {
125
+ border-top-color: rgb(#{$border-color});
126
+ }
127
+
128
+ &.left-start,
129
+ &.left-center,
130
+ &.left-end {
131
+ border-right-color: rgb(#{$border-color});
132
+ }
133
+
134
+ &.right-start,
135
+ &.right-center,
136
+ &.right-end {
137
+ border-left-color: rgb(#{$border-color});
138
+ }
139
+ }
140
+
141
+ &.underline {
142
+ &.top-start,
143
+ &.top-center,
144
+ &.top-end,
145
+ &.bottom-start,
146
+ &.bottom-center,
147
+ &.bottom-end {
148
+ padding-top: #{$highlight-space-y};
149
+ padding-bottom: #{$highlight-space-y};
150
+ }
151
+
152
+ &.left-start,
153
+ &.left-center,
154
+ &.left-end,
155
+ &.right-start,
156
+ &.right-center,
157
+ &.right-end {
158
+ padding-left: #{$highlight-space-x};
159
+ padding-right: #{$highlight-space-x};
160
+ }
161
+ }
162
+
163
+ &.fill {
164
+ :deep(.#{$tab}) {
165
+ &.active {
166
+ .#{$button} {
167
+ color: rgb(#{$button-color}) !important;
168
+ }
169
+ }
170
+ }
171
+
172
+ &.top-start,
173
+ &.top-center,
174
+ &.top-end,
175
+ &.bottom-start,
176
+ &.bottom-center,
177
+ &.bottom-end {
178
+ padding-top: calc(#{$highlight-space-y} + #{$space-y});
179
+ padding-bottom: calc(#{$highlight-space-y} + #{$space-y});
180
+ }
181
+
182
+ &.left-start,
183
+ &.left-center,
184
+ &.left-end,
185
+ &.right-start,
186
+ &.right-center,
187
+ &.right-end {
188
+ padding-left: calc(#{$highlight-space-x} + #{$space-x});
189
+ padding-right: calc(#{$highlight-space-x} + #{$space-x});
190
+ }
191
+ }
192
+
193
+ &.text {
194
+ &::before {
195
+ display: none;
196
+ }
197
+
198
+ :deep(.#{$tab}) {
199
+ &.active {
200
+ .#{$button} {
201
+ color: rgb(#{$background-color});
202
+ text-shadow: 0 0 rgb(#{$background-color});
203
+ }
204
+ }
205
+ }
206
+
207
+ &.top-start,
208
+ &.top-center,
209
+ &.top-end,
210
+ &.bottom-start,
211
+ &.bottom-center,
212
+ &.bottom-end {
213
+ padding-top: calc(#{$highlight-space-y} + #{$space-y});
214
+ padding-bottom: calc(#{$highlight-space-y} + #{$space-y});
215
+ }
216
+
217
+ &.left-start,
218
+ &.left-center,
219
+ &.left-end,
220
+ &.right-start,
221
+ &.right-center,
222
+ &.right-end {
223
+ padding-left: calc(#{$highlight-space-x} + #{$space-x});
224
+ padding-right: calc(#{$highlight-space-x} + #{$space-x});
225
+ }
226
+ }
227
+
228
+ &.transition {
229
+ &::before {
230
+ transition:
231
+ background-color #{$transition-duration} ease,
232
+ color #{$transition-duration} ease,
233
+ border-color #{$transition-duration} ease,
234
+ border-radius #{$transition-duration} ease,
235
+ transform #{$transition-duration} ease,
236
+ width #{$transition-duration} ease,
237
+ height #{$transition-duration} ease;
238
+ }
239
+
240
+ :deep(.#{$tab}) {
241
+ display: flex;
242
+ justify-content: center;
243
+ align-items: center;
244
+
245
+ .#{$button} {
246
+ transition:
247
+ box-shadow #{$transition-duration} ease,
248
+ border-color #{$transition-duration} ease,
249
+ background-color #{$transition-duration} ease,
250
+ color #{$transition-duration} ease,
251
+ border-radius #{$transition-duration} ease;
252
+ }
253
+ }
254
+ }
255
+
256
+ :deep(.#{$tab}) {
257
+ display: flex;
258
+ justify-content: center;
259
+ align-items: center;
260
+
261
+ .#{$button} {
262
+ padding: #{$space-y} calc(#{$space-x} * 4);
263
+ color: unset;
264
+ cursor: pointer;
265
+ background-color: transparent !important;
266
+ border: none !important;
267
+ box-shadow: none !important;
268
+ border-radius: 0 !important;
269
+ transition: none;
270
+ }
271
+ }
272
+ }
@@ -0,0 +1,36 @@
1
+ import { ComputedRef } from "vue";
2
+
3
+ export type TabsVariant = "fill" | "underline" | "text";
4
+ export type TabsPlacement =
5
+ | "top-start"
6
+ | "top-end"
7
+ | "bottom-start"
8
+ | "bottom-end"
9
+ | "left-start"
10
+ | "left-end"
11
+ | "right-start"
12
+ | "right-end";
13
+
14
+ // Define
15
+ export type TabsProps = {
16
+ placement?: TabsPlacement;
17
+ variant?: TabsVariant;
18
+ role?: string;
19
+ modelValue?: string;
20
+ border?: number;
21
+ margin?: number[];
22
+ shape?: string;
23
+ divider?: boolean;
24
+ transition?: boolean;
25
+ };
26
+
27
+ export type TabsEmit = {
28
+ (e: "update:modelValue", value: string): void;
29
+ };
30
+
31
+ export type TabsProviderState = {
32
+ activeValue: ComputedRef<string>;
33
+ role: ComputedRef<string>;
34
+ shape: ComputedRef<string>;
35
+ setValue: (val: string) => void;
36
+ };
@@ -0,0 +1,159 @@
1
+ <style lang="scss" src="./tabs.scss" scoped></style>
2
+ <template src="./tabs.html"></template>
3
+ <script lang="ts" setup>
4
+ import { computed, inject, nextTick, onMounted, onUnmounted, provide, ref, watch } from "vue";
5
+ import { type TabsProps, type TabsEmit, type TabsProviderState } from "./tabs.type";
6
+ import { property, withPrefix } from "../../../utils";
7
+ import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../../app";
8
+ import { TABS_PROVIDER_STATE_KEY } from "./tabs.constants";
9
+
10
+ /// Define
11
+ /// ------------------------------------------------------------
12
+ const props = withDefaults(defineProps<TabsProps>(), {
13
+ placement: "top-start",
14
+ margin: () => [0, 0],
15
+ border: 2,
16
+ divider: undefined,
17
+ transition: true,
18
+ });
19
+ const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
20
+ const emit = defineEmits<TabsEmit>();
21
+
22
+ /// State
23
+ /// ------------------------------------------------------------
24
+ const width = ref(0);
25
+ const height = ref(0);
26
+ const top = ref(0);
27
+ const left = ref(0);
28
+ const container = ref();
29
+
30
+ /// Computed
31
+ /// ------------------------------------------------------------
32
+ const role = computed(() => {
33
+ return props.role || appState?.role.value || "";
34
+ });
35
+
36
+ const shape = computed(() => {
37
+ return props.shape || appState?.shape.value || "";
38
+ });
39
+
40
+ const activeValue = computed(() => {
41
+ return props.modelValue || "";
42
+ });
43
+
44
+ const divider = computed(() => {
45
+ return (props.divider !== undefined ? props.divider : appState?.divider.value || false) ?? false;
46
+ });
47
+
48
+ const tabsAttrs = computed(() => {
49
+ let l = left.value;
50
+ let t = top.value;
51
+ let w = width.value;
52
+ let h = height.value;
53
+
54
+ t = t - props.margin[0];
55
+ l = l - props.margin[1];
56
+ h = h + props.margin[0] * 2;
57
+ w = w + props.margin[1] * 2;
58
+
59
+ if (props.variant === "underline") {
60
+ /// Top, Bottom
61
+ if (props.placement.startsWith("top-")) {
62
+ t = h - props.border;
63
+ }
64
+
65
+ if (props.placement.startsWith("bottom-")) {
66
+ t = 0;
67
+ }
68
+
69
+ if (props.placement.startsWith("top-") || props.placement.startsWith("bottom-")) {
70
+ h = props.border + 0.5;
71
+ }
72
+
73
+ // Left, Right
74
+ if (props.placement.startsWith("left-")) {
75
+ l = w - props.border;
76
+ }
77
+
78
+ if (props.placement.startsWith("right-")) {
79
+ l = 0;
80
+ }
81
+
82
+ if (props.placement.startsWith("left-") || props.placement.startsWith("right-")) {
83
+ w = props.border;
84
+ }
85
+ }
86
+
87
+ return {
88
+ class: [
89
+ withPrefix(["layer", "item"]),
90
+ withPrefix(["role", role.value]),
91
+ withPrefix(["shape", shape.value]),
92
+ withPrefix("tabs"),
93
+ props.variant,
94
+ props.placement,
95
+ {
96
+ divider: divider.value,
97
+ transition: props.transition,
98
+ },
99
+ ],
100
+ style: {
101
+ [property("highlight-top")]: typeof t === "string" ? t : t + "px",
102
+ [property("highlight-left")]: typeof l === "string" ? l : l + "px",
103
+ [property("highlight-width")]: typeof w === "string" ? w : w + "px",
104
+ [property("highlight-height")]: typeof h === "string" ? h : h + "px",
105
+ [property("highlight-space-x")]: (props.margin[1] > 0 ? props.margin[1] : 0) + "px",
106
+ [property("highlight-space-y")]: (props.margin[0] > 0 ? props.margin[0] : 0) + "px",
107
+ },
108
+ };
109
+ });
110
+
111
+ /// Methods
112
+ /// ------------------------------------------------------------
113
+ const calcPosition = () => {
114
+ let active = container.value.querySelector(".active");
115
+ if (active) {
116
+ width.value = active.offsetWidth;
117
+ height.value = active.offsetHeight;
118
+ left.value =
119
+ active.getBoundingClientRect().left -
120
+ container.value.getBoundingClientRect().left +
121
+ container.value.scrollLeft;
122
+ top.value =
123
+ active.getBoundingClientRect().top -
124
+ container.value.getBoundingClientRect().top +
125
+ container.value.scrollTop;
126
+ }
127
+ };
128
+
129
+ // Lifecycle
130
+ /// ------------------------------------------------------------
131
+ watch(
132
+ () => props.modelValue,
133
+ async () => {
134
+ await nextTick();
135
+ calcPosition();
136
+ }
137
+ );
138
+
139
+ onMounted(async () => {
140
+ await nextTick();
141
+ calcPosition();
142
+ window.addEventListener("resize", calcPosition);
143
+ });
144
+
145
+ onUnmounted(() => {
146
+ window.removeEventListener("resize", calcPosition);
147
+ });
148
+
149
+ // Export, Expose
150
+ /// ------------------------------------------------------------
151
+ provide<TabsProviderState>(TABS_PROVIDER_STATE_KEY, {
152
+ activeValue,
153
+ role,
154
+ shape,
155
+ setValue: (val: unknown) => {
156
+ emit("update:modelValue", val as string);
157
+ },
158
+ });
159
+ </script>
@@ -0,0 +1,4 @@
1
+ export * from "./toast";
2
+ export * from "./toast-content";
3
+ export * from "./toast.composable";
4
+ export * from "./toast.type";
@@ -0,0 +1 @@
1
+ export { default as Toast } from "./toast.vue";
@@ -0,0 +1,9 @@
1
+ <div v-bind="toastAttrs" v-if="toastMessages.length > 0">
2
+ <slot name="content">
3
+ <ToastContent
4
+ v-for="(msg, index) in toastMessages"
5
+ v-bind="msg"
6
+ @close="dismiss(msg.id)"
7
+ ></ToastContent>
8
+ </slot>
9
+ </div>
@@ -0,0 +1,61 @@
1
+ @use "@toife/sass-layer-generator" as sass;
2
+
3
+ // Class name
4
+ $toast: sass.fn-naming-prefix("toast");
5
+ $toastContent: sass.fn-naming-prefix("toast-content");
6
+
7
+ // Properties
8
+ $max-width: sass.fn-naming-var("overlay", "max-width");
9
+ $space-x: sass.fn-naming-var("spacing", "x");
10
+ $safe-area-right: sass.fn-naming-var("safe-area", "right");
11
+ $safe-area-left: sass.fn-naming-var("safe-area", "left");
12
+ $safe-area-bottom: sass.fn-naming-var("safe-area", "bottom");
13
+ $safe-area-top: sass.fn-naming-var("safe-area", "top");
14
+
15
+ .#{$toast} {
16
+ width: fit-content;
17
+ height: fit-content;
18
+ max-width: #{$max-width};
19
+ position: absolute;
20
+ z-index: 999;
21
+ font-size: 0.8em;
22
+ line-height: 0.8em;
23
+ display: flex;
24
+ flex-direction: column;
25
+ gap: #{$space-x};
26
+
27
+ &.bottom-start {
28
+ bottom: calc(#{$safe-area-bottom} + #{$space-x} * 4);
29
+ left: calc(#{$space-x} * 4);
30
+ }
31
+
32
+ &.bottom-center {
33
+ bottom: calc(#{$safe-area-bottom} + #{$space-x} * 4);
34
+ left: 50%;
35
+ transform: translateX(-50%);
36
+ }
37
+
38
+ &.bottom-end {
39
+ bottom: calc(#{$safe-area-bottom} + #{$space-x} * 4);
40
+ right: calc(#{$space-x} * 4);
41
+ }
42
+
43
+ &.top-start {
44
+ top: calc(#{$safe-area-top} + #{$space-x} * 4);
45
+ left: calc(#{$space-x} * 4);
46
+ flex-direction: column-reverse;
47
+ }
48
+
49
+ &.top-center {
50
+ top: calc(#{$safe-area-top} + #{$space-x} * 4);
51
+ left: 50%;
52
+ transform: translateX(-50%);
53
+ flex-direction: column-reverse;
54
+ }
55
+
56
+ &.top-end {
57
+ top: calc(#{$safe-area-top} + #{$space-x} * 4);
58
+ right: calc(#{$space-x} * 4);
59
+ flex-direction: column-reverse;
60
+ }
61
+ }
@@ -0,0 +1,34 @@
1
+ <style lang="scss" src="./toast.scss" scoped></style>
2
+ <template src="./toast.html"></template>
3
+ <script lang="ts" setup>
4
+ import { computed } from "vue";
5
+ import { type ToastProps } from "../toast.type";
6
+ import { withPrefix } from "../../../utils";
7
+ import { useToast } from "../toast.composable";
8
+ import { ToastContent } from "../toast-content";
9
+
10
+ /// Define
11
+ /// ------------------------------------------------------------
12
+ const props = withDefaults(defineProps<ToastProps>(), {
13
+ placement: "bottom-end",
14
+ });
15
+ const toast = useToast();
16
+
17
+ /// Computed
18
+ /// ------------------------------------------------------------
19
+ const toastAttrs = computed(() => {
20
+ return {
21
+ class: [withPrefix("toast"), props.placement],
22
+ };
23
+ });
24
+
25
+ const toastMessages = computed(() => {
26
+ return toast.messages.value.filter((item) => item.placement == props.placement);
27
+ });
28
+
29
+ /// Methods
30
+ /// ------------------------------------------------------------
31
+ const dismiss = (id: number) => {
32
+ toast.close(id);
33
+ };
34
+ </script>
@@ -0,0 +1 @@
1
+ export { default as ToastContent } from "./toast-content.vue";
@@ -0,0 +1 @@
1
+ <div v-bind="contentAttrs">{{ props.message }}</div>