@toife/vue 2.1.7 → 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 (252) 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/src/components/gesture-indicator/gesture-indicator.type.ts +4 -0
  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/src/type.ts +3 -0
  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/t-action.vue.d.ts +0 -29
  203. package/dist/components/t-alert.vue.d.ts +0 -35
  204. package/dist/components/t-app.vue.d.ts +0 -17
  205. package/dist/components/t-avatar.vue.d.ts +0 -24
  206. package/dist/components/t-back-button.vue.d.ts +0 -21
  207. package/dist/components/t-button.vue.d.ts +0 -36
  208. package/dist/components/t-cable.vue.d.ts +0 -24
  209. package/dist/components/t-card.vue.d.ts +0 -22
  210. package/dist/components/t-checkbox.vue.d.ts +0 -38
  211. package/dist/components/t-collapse.vue.d.ts +0 -32
  212. package/dist/components/t-content.vue.d.ts +0 -17
  213. package/dist/components/t-divider.vue.d.ts +0 -7
  214. package/dist/components/t-flex.vue.d.ts +0 -24
  215. package/dist/components/t-gesture-indicator.vue.d.ts +0 -7
  216. package/dist/components/t-grid.vue.d.ts +0 -24
  217. package/dist/components/t-icon-spinner.vue.d.ts +0 -23
  218. package/dist/components/t-image.vue.d.ts +0 -6
  219. package/dist/components/t-input.vue.d.ts +0 -47
  220. package/dist/components/t-keyboard-space.vue.d.ts +0 -2
  221. package/dist/components/t-loading.vue.d.ts +0 -29
  222. package/dist/components/t-present.vue.d.ts +0 -47
  223. package/dist/components/t-refresher.vue.d.ts +0 -43
  224. package/dist/components/t-rich-text.vue.d.ts +0 -2
  225. package/dist/components/t-ripple.vue.d.ts +0 -7
  226. package/dist/components/t-screen-router.vue.d.ts +0 -15
  227. package/dist/components/t-screen.vue.d.ts +0 -17
  228. package/dist/components/t-sheet.vue.d.ts +0 -251
  229. package/dist/components/t-skeleton.vue.d.ts +0 -13
  230. package/dist/components/t-switch.vue.d.ts +0 -12
  231. package/dist/components/t-tab.vue.d.ts +0 -23
  232. package/dist/components/t-tabs.vue.d.ts +0 -43
  233. package/dist/components/t-text.vue.d.ts +0 -24
  234. package/dist/components/t-textarea.vue.d.ts +0 -2
  235. package/dist/components/t-toast.vue.d.ts +0 -38
  236. package/dist/components/t-toggle-password.vue.d.ts +0 -31
  237. package/dist/components/t-toolbar.vue.d.ts +0 -26
  238. package/dist/controllers/action.d.ts +0 -4
  239. package/dist/controllers/alert.d.ts +0 -4
  240. package/dist/controllers/index.d.ts +0 -8
  241. package/dist/controllers/keyboard.d.ts +0 -3
  242. package/dist/controllers/loading.d.ts +0 -5
  243. package/dist/controllers/present.d.ts +0 -4
  244. package/dist/controllers/screen.d.ts +0 -20
  245. package/dist/controllers/toast.d.ts +0 -4
  246. package/dist/index.css +0 -1
  247. package/dist/index.d.ts +0 -5
  248. package/dist/index.es.js +0 -1501
  249. package/dist/index.umd.js +0 -1
  250. package/dist/utils/defaultEvent.d.ts +0 -2
  251. package/dist/utils/element.d.ts +0 -2
  252. package/dist/utils/index.d.ts +0 -1
@@ -0,0 +1,35 @@
1
+ @use "@toife/sass-layer-generator" as sass;
2
+
3
+ // Class
4
+ $avatar: sass.fn-naming-prefix("avatar");
5
+ $shape-pill: sass.fn-naming-prefix("shape-pill");
6
+
7
+ // Property - layer: surface
8
+ $border-radius: sass.fn-naming-var("border-radius");
9
+ $background-color: sass.fn-naming-var("surface", "background-color");
10
+ $width: sass.fn-naming-var("width");
11
+ $transition-duration: sass.fn-naming-var("motion", "duration");
12
+
13
+ // Avatar default is circle
14
+ // With props square then is square
15
+ .#{$avatar} {
16
+ position: relative;
17
+ overflow: hidden;
18
+ background-color: rgb(#{$background-color});
19
+ width: #{$width};
20
+ aspect-ratio: 1/1;
21
+ border-radius: #{$border-radius};
22
+ background-repeat: no-repeat;
23
+ background-size: cover;
24
+ transition:
25
+ background-color #{$transition-duration} ease,
26
+ color #{$transition-duration} ease,
27
+ border-color #{$transition-duration} ease,
28
+ box-shadow #{$transition-duration} ease,
29
+ border-radius #{$transition-duration} ease;
30
+ display: inline-block;
31
+
32
+ &.#{$shape-pill} {
33
+ border-radius: 50%;
34
+ }
35
+ }
@@ -0,0 +1,6 @@
1
+ // Define
2
+ export type AvatarProps = {
3
+ shape?: string;
4
+ size?: string | number;
5
+ src?: string;
6
+ };
@@ -0,0 +1,45 @@
1
+ <style lang="scss" src="./avatar.scss" scoped></style>
2
+ <template src="./avatar.html"></template>
3
+ <script lang="ts" setup>
4
+ import { computed, inject } from "vue";
5
+ import { type AvatarProps } from "./avatar.type";
6
+ import { property, withPrefix } from "../../utils";
7
+ import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
8
+
9
+ /// Define
10
+ /// ------------------------------------------------------------
11
+ const props = withDefaults(defineProps<AvatarProps>(), {
12
+ size: "22px",
13
+ src: "",
14
+ });
15
+ const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
16
+
17
+ /// Computed
18
+ /// ------------------------------------------------------------
19
+ const avatarAttrs = computed(() => {
20
+ const shape = props?.shape || appState?.shape.value || "";
21
+ const role = appState?.role.value || "";
22
+
23
+ return {
24
+ class: [
25
+ withPrefix(["layer", "surface"]),
26
+ withPrefix(["role", role]),
27
+ withPrefix(["shape", shape]),
28
+ withPrefix("avatar"),
29
+ ],
30
+ style: {
31
+ [property("width")]: props.size + (typeof props.size === "number" ? "px" : ""),
32
+ backgroundImage: `url(${props.src})`,
33
+ },
34
+ };
35
+ });
36
+
37
+ /// Methods
38
+ /// ------------------------------------------------------------
39
+
40
+ // Lifecycle
41
+ /// ------------------------------------------------------------
42
+
43
+ // Export, Expose
44
+ /// ------------------------------------------------------------
45
+ </script>
@@ -0,0 +1,2 @@
1
+ export { default as Avatar } from "./avatar.vue";
2
+ export * from "./avatar.type";
@@ -0,0 +1,6 @@
1
+ <button v-bind="buttonAttrs" @focus="onFocus" @blur="onBlur">
2
+ <span v-show="!props.loading"><slot></slot></span>
3
+ <template v-if="props.loading">
4
+ <span v-bind="loaderAttrs"><slot name="loading"></slot></span>
5
+ </template>
6
+ </button>
@@ -0,0 +1,113 @@
1
+ @use "@toife/sass-layer-generator" as sass;
2
+
3
+ // Class name
4
+ $button: sass.fn-naming-prefix("button");
5
+ $loader: sass.fn-naming-prefix("loader");
6
+
7
+ // Property name
8
+ $border-radius: sass.fn-naming-var("border-radius");
9
+ $border-width: sass.fn-naming-var("stroke", "width");
10
+ $transition-duration: sass.fn-naming-var("motion", "duration");
11
+ $spacing-x: sass.fn-naming-var("spacing", "x");
12
+ $spacing-y: sass.fn-naming-var("spacing", "y");
13
+
14
+ $color: sass.fn-naming-var("item", "color");
15
+
16
+ $border-color: sass.fn-naming-var("item", "border-color");
17
+ $border-color-hover: sass.fn-naming-var("item", "border-color", "strong");
18
+ $border-color-focus: sass.fn-naming-var("item", "border-color", "heavy");
19
+ $border-color-active: sass.fn-naming-var("item", "border-color", "heavy");
20
+ $border-color-disabled: sass.fn-naming-var("item", "border-color");
21
+ $border-color-inactive: sass.fn-naming-var("item", "border-color", "soft");
22
+
23
+ $size-font-size: sass.fn-naming-var("font-size");
24
+ $size-height: sass.fn-naming-var("height");
25
+ $size-coefficient-x: sass.fn-naming-var("coefficient-x");
26
+ $size-coefficient-y: sass.fn-naming-var("coefficient-y");
27
+ $size-line-height: sass.fn-naming-var("line-height");
28
+
29
+ $background-color: sass.fn-naming-var("item", "background-color");
30
+ $background-color-hover: sass.fn-naming-var("item", "background-color", "strong");
31
+ $background-color-focus: sass.fn-naming-var("item", "background-color", "heavy");
32
+ $background-color-active: sass.fn-naming-var("item", "background-color", "heavy");
33
+ $background-color-disabled: sass.fn-naming-var("item", "background-color");
34
+ $background-color-inactive: sass.fn-naming-var("item", "background-color", "soft");
35
+
36
+ .#{$button} {
37
+ display: inline-flex;
38
+ justify-content: center;
39
+ align-items: center;
40
+ position: relative;
41
+ overflow: hidden;
42
+ color: rgb(#{$color});
43
+ background: rgb(#{$background-color});
44
+ border-color: rgb(#{$border-color});
45
+ border-style: solid;
46
+ border-width: #{$border-width};
47
+ white-space: nowrap;
48
+ border-radius: #{$border-radius};
49
+ cursor: pointer;
50
+ transition:
51
+ color #{$transition-duration} ease,
52
+ background-color #{$transition-duration} ease,
53
+ border-color #{$transition-duration} ease,
54
+ border-radius #{$transition-duration} ease,
55
+ box-shadow #{$transition-duration} ease;
56
+ box-shadow: none;
57
+
58
+ padding: calc(#{$spacing-y} * #{$size-coefficient-y}) calc(#{$spacing-x} * #{$size-coefficient-x});
59
+ font-size: #{$size-font-size};
60
+ height: #{$size-height};
61
+ line-height: #{$size-line-height};
62
+
63
+ &:hover {
64
+ border-color: rgb(#{$border-color-hover});
65
+ background-color: rgb(#{$background-color-hover});
66
+ }
67
+
68
+ &.focus,
69
+ &:focus {
70
+ border-color: rgb(#{$border-color-focus});
71
+ background-color: rgb(#{$background-color-focus});
72
+
73
+ &.shadow {
74
+ box-shadow: 0 0 0 0.25rem rgb(#{$border-color}, 0.25);
75
+ }
76
+ }
77
+
78
+ &:active,
79
+ &.active {
80
+ border-color: rgb(#{$border-color-active});
81
+ background-color: rgb(#{$background-color-active});
82
+ }
83
+
84
+ &:disabled,
85
+ &.disabled {
86
+ border-color: rgba(#{$border-color-disabled}, 0.5);
87
+ background-color: rgba(#{$background-color-disabled}, 0.5);
88
+ cursor: not-allowed;
89
+ }
90
+
91
+ // Case is block, then display full width
92
+ &.block {
93
+ width: 100%;
94
+ }
95
+
96
+ // Style for loading icon
97
+ .#{$loader} {
98
+ position: absolute;
99
+ top: 0;
100
+ left: 0;
101
+ width: 100%;
102
+ height: 100%;
103
+ }
104
+
105
+ // Style for content of button
106
+ > span {
107
+ display: flex;
108
+ justify-content: center;
109
+ align-items: center;
110
+ font-size: inherit;
111
+ line-height: inherit;
112
+ }
113
+ }
@@ -0,0 +1,14 @@
1
+ // Define
2
+ export type ButtonVariant = "fill" | "outline" | "text" | "link";
3
+
4
+ export type ButtonSize = "small" | "standard" | "large";
5
+
6
+ export type ButtonProps = {
7
+ role?: string;
8
+ size?: ButtonSize;
9
+ shape?: string;
10
+ block?: boolean;
11
+ loading?: boolean;
12
+ variant?: ButtonVariant;
13
+ shadow?: boolean;
14
+ };
@@ -0,0 +1,66 @@
1
+ <style lang="scss" src="./button.scss" scoped></style>
2
+ <template src="./button.html"></template>
3
+ <script lang="ts" setup>
4
+ import { computed, inject, ref } from "vue";
5
+ import { type ButtonProps } from "./button.type";
6
+ import { withPrefix } from "../../utils";
7
+ import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../app";
8
+
9
+ /// Define
10
+ /// ------------------------------------------------------------
11
+ const props = withDefaults(defineProps<ButtonProps>(), {
12
+ size: "standard",
13
+ block: false,
14
+ loading: false,
15
+ variant: "fill",
16
+ shadow: undefined,
17
+ });
18
+ const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
19
+
20
+ /// State
21
+ /// ------------------------------------------------------------
22
+ const isFocused = ref(false);
23
+
24
+ /// Computed
25
+ /// ------------------------------------------------------------
26
+ const shadow = computed(() => {
27
+ return (props?.shadow !== undefined ? props.shadow : appState?.shadow.value) ?? false;
28
+ });
29
+
30
+ const buttonAttrs = computed(() => {
31
+ const shape = props.shape || appState?.shape.value || "";
32
+ const role = props.role || appState?.role.value || "";
33
+
34
+ return {
35
+ class: [
36
+ withPrefix(["layer", "item"]),
37
+ withPrefix(["role", role]),
38
+ withPrefix(["shape", shape]),
39
+ withPrefix("button"),
40
+ withPrefix(["size", props.size]),
41
+ props.variant,
42
+ {
43
+ block: props.block,
44
+ shadow: shadow.value,
45
+ focus: isFocused.value,
46
+ },
47
+ ],
48
+ };
49
+ });
50
+
51
+ const loaderAttrs = computed(() => {
52
+ return {
53
+ class: [withPrefix("loader")],
54
+ };
55
+ });
56
+
57
+ /// Methods
58
+ /// ------------------------------------------------------------
59
+ const onFocus = () => {
60
+ isFocused.value = true;
61
+ };
62
+
63
+ const onBlur = () => {
64
+ isFocused.value = false;
65
+ };
66
+ </script>
@@ -0,0 +1,2 @@
1
+ export { default as Button } from "./button.vue";
2
+ export type { ButtonProps } from "./button.type";
@@ -0,0 +1 @@
1
+ export const CABLE_PROVIDER_STATE_KEY = "cable-state";
@@ -0,0 +1,3 @@
1
+ <div v-bind="cableAttrs">
2
+ <slot />
3
+ </div>
@@ -0,0 +1,37 @@
1
+ @use "@toife/sass-layer-generator" as sass;
2
+
3
+ // Class name
4
+ $cable: sass.fn-naming-prefix("cable");
5
+
6
+ .#{$cable} {
7
+ position: absolute;
8
+ z-index: 10;
9
+
10
+ &.bottom {
11
+ bottom: 0;
12
+ left: 0;
13
+ height: auto;
14
+ width: 100%;
15
+ }
16
+
17
+ &.top {
18
+ left: 0;
19
+ top: 0;
20
+ height: auto;
21
+ width: 100%;
22
+ }
23
+
24
+ &.left {
25
+ left: 0;
26
+ top: 0;
27
+ height: 100%;
28
+ width: auto;
29
+ }
30
+
31
+ &.right {
32
+ right: 0;
33
+ top: 0;
34
+ height: 100%;
35
+ width: auto;
36
+ }
37
+ }
@@ -0,0 +1,11 @@
1
+ import type { Ref } from "vue";
2
+
3
+ // Define
4
+ export type CableProps = {
5
+ keyboard?: boolean;
6
+ placement?: string;
7
+ };
8
+
9
+ export type CableProviderState = {
10
+ placement: Ref<string>;
11
+ };
@@ -0,0 +1,33 @@
1
+ <style lang="scss" src="./cable.scss" scoped></style>
2
+ <template src="./cable.html"></template>
3
+ <script lang="ts" setup>
4
+ import { computed, provide, toRefs } from "vue";
5
+ import { type CableProviderState, type CableProps } from "./cable.type";
6
+ import { withPrefix } from "../../utils";
7
+ import { CABLE_PROVIDER_STATE_KEY } from "./cable.constants";
8
+
9
+ /// Define
10
+ /// ------------------------------------------------------------
11
+ const props = withDefaults(defineProps<CableProps>(), {
12
+ keyboard: false,
13
+ placement: "bottom",
14
+ });
15
+
16
+ /// State
17
+ /// ------------------------------------------------------------
18
+ const { placement } = toRefs(props);
19
+
20
+ /// Computed
21
+ /// ------------------------------------------------------------
22
+ const cableAttrs = computed(() => {
23
+ return {
24
+ class: [withPrefix(["layer", "base"]), withPrefix("cable"), placement.value],
25
+ };
26
+ });
27
+
28
+ // Export, Expose
29
+ /// ------------------------------------------------------------
30
+ provide<CableProviderState>(CABLE_PROVIDER_STATE_KEY, {
31
+ placement,
32
+ });
33
+ </script>
@@ -0,0 +1,3 @@
1
+ export { default as Cable } from "./cable.vue";
2
+ export type { CableProps } from "./cable.type";
3
+ export { CABLE_PROVIDER_STATE_KEY } from "./cable.constants";
@@ -0,0 +1 @@
1
+ export const CARD_PROVIDER_STATE_KEY = "card-state";
@@ -0,0 +1,3 @@
1
+ <div v-bind="cardAttrs">
2
+ <slot />
3
+ </div>
@@ -0,0 +1,34 @@
1
+ @use "@toife/sass-layer-generator" as sass;
2
+
3
+ // Class name
4
+ $card: sass.fn-naming-prefix("card");
5
+
6
+ // Property name - layer: surface
7
+ $background-color: sass.fn-naming-var("surface", "background-color");
8
+ $color: sass.fn-naming-var("surface", "color");
9
+ $border-radius: sass.fn-naming-var("border-radius");
10
+ $transition-duration: sass.fn-naming-var("motion", "duration");
11
+
12
+ .#{$card} {
13
+ background-color: rgb(#{$background-color});
14
+ color: rgb(#{$color});
15
+ border-radius: #{$border-radius};
16
+ transition:
17
+ box-shadow #{$transition-duration} ease,
18
+ border-color #{$transition-duration} ease,
19
+ background-color #{$transition-duration} ease,
20
+ color #{$transition-duration} ease,
21
+ border-radius #{$transition-duration} ease;
22
+
23
+ > div {
24
+ &:first-child {
25
+ border-top-left-radius: #{$border-radius};
26
+ border-top-right-radius: #{$border-radius};
27
+ }
28
+
29
+ &:last-child {
30
+ border-bottom-left-radius: #{$border-radius};
31
+ border-bottom-right-radius: #{$border-radius};
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,14 @@
1
+ import { ComputedRef, Ref } from "vue";
2
+
3
+ // Define
4
+ export type CardProps = {
5
+ role?: string;
6
+ shape?: string;
7
+ divider?: boolean;
8
+ };
9
+
10
+ export type CardProviderState = {
11
+ role: ComputedRef<string>;
12
+ shape: ComputedRef<string>;
13
+ divider: ComputedRef<boolean>;
14
+ };
@@ -0,0 +1,62 @@
1
+ <style lang="scss" src="./card.scss"></style>
2
+ <template src="./card.html"></template>
3
+ <script lang="ts" setup>
4
+ import { computed, inject, provide } from "vue";
5
+ import { type CardProps, type CardProviderState } from "./card.type";
6
+ import { withPrefix } from "../../../utils";
7
+ import { type AppProviderState, APP_PROVIDER_STATE_KEY } from "../../app";
8
+ import { CARD_PROVIDER_STATE_KEY } from "./card.constants";
9
+
10
+ /// Define
11
+ /// ------------------------------------------------------------
12
+ const props = withDefaults(defineProps<CardProps>(), {
13
+ divider: undefined,
14
+ shape: undefined,
15
+ role: undefined,
16
+ });
17
+ const appState = inject<AppProviderState>(APP_PROVIDER_STATE_KEY);
18
+
19
+ /// Computed
20
+ /// ------------------------------------------------------------
21
+ const divider = computed(() => {
22
+ return (props?.divider !== undefined ? props.divider : appState?.divider.value) ?? false;
23
+ });
24
+
25
+ const shape = computed(() => {
26
+ return props?.shape || appState?.shape.value || "";
27
+ });
28
+
29
+ const role = computed(() => {
30
+ return props.role || appState?.role.value || "";
31
+ });
32
+
33
+ const cardAttrs = computed(() => {
34
+ return {
35
+ class: [
36
+ withPrefix(["layer", "surface"]),
37
+ withPrefix(["role", role.value]),
38
+ withPrefix(["shape", shape.value]),
39
+ withPrefix("card"),
40
+ {
41
+ divider: divider.value,
42
+ },
43
+ ],
44
+ };
45
+ });
46
+
47
+ const cardProviderState = computed(() => {
48
+ return {
49
+ role: props.role,
50
+ shape: shape.value,
51
+ divider: divider.value,
52
+ };
53
+ });
54
+
55
+ /// Export, Expose
56
+ /// ------------------------------------------------------------
57
+ provide<CardProviderState>(CARD_PROVIDER_STATE_KEY, {
58
+ role,
59
+ shape,
60
+ divider,
61
+ });
62
+ </script>
@@ -0,0 +1,3 @@
1
+ export { default as Card } from "./card.vue";
2
+ export * from "./card.type";
3
+ export { CARD_PROVIDER_STATE_KEY } from "./card.constants";
@@ -0,0 +1,3 @@
1
+ <div v-bind="cardBodyAttrs">
2
+ <slot />
3
+ </div>
@@ -0,0 +1,23 @@
1
+ @use "@toife/sass-layer-generator" as sass;
2
+
3
+ // Class name
4
+ $card-body: sass.fn-naming-prefix("card-body");
5
+
6
+ // Property name - layer: surface (card)
7
+ $background-color: sass.fn-naming-var("surface", "background-color");
8
+ $color: sass.fn-naming-var("surface", "color");
9
+ $padding-y: sass.fn-naming-var("spacing", "y");
10
+ $padding-x: sass.fn-naming-var("spacing", "x");
11
+ $transition-duration: sass.fn-naming-var("motion", "duration");
12
+
13
+ .#{$card-body} {
14
+ background-color: rgb(#{$background-color});
15
+ color: rgb(#{$color});
16
+ padding: calc(#{$padding-y} * 4) calc(#{$padding-x} * 4);
17
+ transition:
18
+ box-shadow #{$transition-duration} ease,
19
+ border-color #{$transition-duration} ease,
20
+ background-color #{$transition-duration} ease,
21
+ color #{$transition-duration} ease,
22
+ border-radius #{$transition-duration} ease;
23
+ }
@@ -0,0 +1,14 @@
1
+ <style lang="scss" src="./card-body.scss"></style>
2
+ <template src="./card-body.html"></template>
3
+ <script lang="ts" setup>
4
+ import { computed } from "vue";
5
+ import { withPrefix } from "../../../utils";
6
+
7
+ /// Computed
8
+ /// ------------------------------------------------------------
9
+ const cardBodyAttrs = computed(() => {
10
+ return {
11
+ class: [withPrefix("card-body")],
12
+ };
13
+ });
14
+ </script>
@@ -0,0 +1 @@
1
+ export { default as CardBody } from "./card-body.vue";
@@ -0,0 +1,3 @@
1
+ <div v-bind="cardFooterAttrs">
2
+ <slot />
3
+ </div>
@@ -0,0 +1,31 @@
1
+ @use "@toife/sass-layer-generator" as sass;
2
+
3
+ // Class name
4
+ $card-footer: sass.fn-naming-prefix("card-footer");
5
+
6
+ // Property name - layer: surface (card)
7
+ $background-color: sass.fn-naming-var("surface", "background-color");
8
+ $color: sass.fn-naming-var("surface", "color");
9
+ $padding-y: sass.fn-naming-var("spacing", "y");
10
+ $padding-x: sass.fn-naming-var("spacing", "x");
11
+ $border-color: sass.fn-naming-var("surface", "border-color");
12
+ $border-width: sass.fn-naming-var("stroke", "width");
13
+ $border: #{$border-width} solid transparent;
14
+ $transition-duration: sass.fn-naming-var("motion", "duration");
15
+
16
+ .#{$card-footer} {
17
+ background-color: rgb(#{$background-color});
18
+ color: rgb(#{$color});
19
+ padding: calc(#{$padding-y} * 4) calc(#{$padding-x} * 4);
20
+ border-top: #{$border};
21
+ transition:
22
+ box-shadow #{$transition-duration} ease,
23
+ border-color #{$transition-duration} ease,
24
+ background-color #{$transition-duration} ease,
25
+ color #{$transition-duration} ease,
26
+ border-radius #{$transition-duration} ease;
27
+
28
+ &.divider {
29
+ border-color: rgb(#{$border-color});
30
+ }
31
+ }
@@ -0,0 +1,28 @@
1
+ <style lang="scss" src="./card-footer.scss"></style>
2
+ <template src="./card-footer.html"></template>
3
+ <script lang="ts" setup>
4
+ import { computed, inject } from "vue";
5
+ import { withPrefix } from "../../../utils";
6
+ import { type CardProviderState, CARD_PROVIDER_STATE_KEY } from "../card";
7
+
8
+ /// Define
9
+ /// ------------------------------------------------------------
10
+ const cardProviderState = inject<CardProviderState>(CARD_PROVIDER_STATE_KEY);
11
+
12
+ /// Computed
13
+ /// ------------------------------------------------------------
14
+ const divider = computed(() => {
15
+ return cardProviderState?.divider.value ?? false;
16
+ });
17
+
18
+ const cardFooterAttrs = computed(() => {
19
+ return {
20
+ class: [
21
+ withPrefix("card-footer"),
22
+ {
23
+ divider: divider.value,
24
+ },
25
+ ],
26
+ };
27
+ });
28
+ </script>
@@ -0,0 +1 @@
1
+ export { default as CardFooter } from "./card-footer.vue";
@@ -0,0 +1,3 @@
1
+ <div v-bind="cardHeaderAttrs">
2
+ <slot />
3
+ </div>