@globalbrain/sefirot 0.72.0 → 2.0.0-draft.4

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 (175) hide show
  1. package/CHANGELOG.md +8 -808
  2. package/README.md +1 -1
  3. package/lib/assets/styles/bootstrap.css +1 -2
  4. package/lib/assets/styles/variables.css +14 -47
  5. package/lib/components/SAvatar.vue +9 -18
  6. package/lib/components/SButton.vue +35 -48
  7. package/lib/components/SDialog.vue +16 -34
  8. package/lib/components/SDropdown.vue +36 -55
  9. package/lib/components/SDropdownItem.vue +27 -39
  10. package/lib/components/SDropdownItemText.vue +4 -9
  11. package/lib/components/SDropdownItemUser.vue +4 -12
  12. package/lib/components/SInputBase.vue +33 -45
  13. package/lib/components/SInputCheckbox.vue +17 -37
  14. package/lib/components/SInputDropdown.vue +109 -171
  15. package/lib/components/SInputDropdownItem.vue +26 -32
  16. package/lib/components/SInputDropdownItemText.vue +6 -11
  17. package/lib/components/SInputDropdownItemTextTag.vue +10 -17
  18. package/lib/components/SInputDropdownItemUser.vue +5 -13
  19. package/lib/components/SInputDropdownItemUserTag.vue +9 -16
  20. package/lib/components/SInputFile.vue +38 -53
  21. package/lib/components/SInputHMS.vue +91 -114
  22. package/lib/components/SInputNumber.vue +27 -106
  23. package/lib/components/SInputRadio.vue +21 -34
  24. package/lib/components/SInputRadios.vue +36 -46
  25. package/lib/components/SInputText.vue +72 -628
  26. package/lib/components/SInputTextarea.vue +54 -113
  27. package/lib/components/SInputYMD.vue +94 -105
  28. package/lib/components/SLink.vue +16 -52
  29. package/lib/components/SModal.vue +39 -98
  30. package/lib/components/SPortalModals.vue +37 -54
  31. package/lib/components/SPortalSnackbars.vue +9 -24
  32. package/lib/components/SSheet.vue +73 -28
  33. package/lib/components/SSheetFooter.vue +5 -3
  34. package/lib/components/SSheetFooterAction.vue +10 -15
  35. package/lib/components/SSheetFooterActions.vue +2 -4
  36. package/lib/components/SSheetMedium.vue +14 -22
  37. package/lib/components/SSheetTitle.vue +20 -0
  38. package/lib/components/SSnackbar.vue +18 -28
  39. package/lib/composables/Dialog.ts +9 -17
  40. package/lib/composables/Dropdown.ts +2 -2
  41. package/lib/composables/{Menu.ts → Flyout.ts} +11 -4
  42. package/lib/composables/Form.ts +42 -44
  43. package/lib/composables/Modal.ts +11 -19
  44. package/lib/composables/Snackbar.ts +18 -0
  45. package/lib/composables/Validation.ts +28 -0
  46. package/lib/mixins/Sheet.ts +5 -7
  47. package/lib/store/Sefirot.ts +8 -13
  48. package/lib/store/dialog/index.ts +20 -10
  49. package/lib/store/modal/index.ts +11 -18
  50. package/lib/store/snackbars/index.ts +3 -4
  51. package/lib/support/{Util.ts → Utils.ts} +0 -2
  52. package/lib/types/Utils.ts +0 -7
  53. package/lib/types/vue-shims.d.ts +7 -0
  54. package/lib/validation/rules/checked.ts +6 -10
  55. package/lib/validation/rules/fileExtension.ts +9 -9
  56. package/lib/validation/rules/hms.ts +9 -9
  57. package/lib/validation/rules/index.ts +10 -74
  58. package/lib/validation/rules/maxLength.ts +10 -9
  59. package/lib/validation/rules/minLength.ts +12 -0
  60. package/lib/validation/rules/required.ts +2 -10
  61. package/lib/validation/rules/requiredHms.ts +11 -0
  62. package/lib/validation/rules/requiredIf.ts +3 -11
  63. package/lib/validation/rules/requiredYmd.ts +11 -0
  64. package/lib/validation/rules/ymd.ts +11 -0
  65. package/lib/validation/validators/checked.ts +1 -1
  66. package/lib/validation/validators/fileExtension.ts +1 -1
  67. package/lib/validation/validators/hms.ts +5 -5
  68. package/lib/validation/validators/requiredHms.ts +17 -0
  69. package/lib/validation/validators/requiredYmd.ts +7 -0
  70. package/lib/validation/validators/ymd.ts +41 -0
  71. package/package.json +45 -50
  72. package/lib/components/SAction.vue +0 -37
  73. package/lib/components/SActionAvatar.vue +0 -25
  74. package/lib/components/SActionButton.vue +0 -40
  75. package/lib/components/SActionPill.vue +0 -35
  76. package/lib/components/SActionSwitch.vue +0 -37
  77. package/lib/components/SAlert.vue +0 -145
  78. package/lib/components/SButtonGroup.vue +0 -160
  79. package/lib/components/SCard.vue +0 -111
  80. package/lib/components/SCardFooter.vue +0 -74
  81. package/lib/components/SCardHeader.vue +0 -213
  82. package/lib/components/SGrid.vue +0 -237
  83. package/lib/components/SGridActionLink.vue +0 -53
  84. package/lib/components/SGridActionMulti.vue +0 -139
  85. package/lib/components/SGridActionSingle.vue +0 -64
  86. package/lib/components/SHeader.vue +0 -180
  87. package/lib/components/SInputCheckboxes.vue +0 -87
  88. package/lib/components/SInputDate.vue +0 -192
  89. package/lib/components/SInputDay.vue +0 -87
  90. package/lib/components/SInputMonth.vue +0 -86
  91. package/lib/components/SInputSelect.vue +0 -298
  92. package/lib/components/SInputSwitch.vue +0 -212
  93. package/lib/components/SInputSwitches.vue +0 -108
  94. package/lib/components/SInputTime.vue +0 -255
  95. package/lib/components/SInputYear.vue +0 -60
  96. package/lib/components/SMarkdown.vue +0 -56
  97. package/lib/components/SPlaceholderBlank.vue +0 -113
  98. package/lib/components/SPlaceholderImage.vue +0 -83
  99. package/lib/components/SPortalScreens.vue +0 -62
  100. package/lib/components/SProgressBar.vue +0 -89
  101. package/lib/components/SResponsive.vue +0 -46
  102. package/lib/components/SScreen.vue +0 -81
  103. package/lib/components/SSheetHeader.vue +0 -75
  104. package/lib/components/SSheetHeaderTitle.vue +0 -17
  105. package/lib/components/SStep.vue +0 -107
  106. package/lib/components/SSteps.vue +0 -75
  107. package/lib/components/STag.vue +0 -67
  108. package/lib/components/STooltip.vue +0 -134
  109. package/lib/components/SWindow.vue +0 -158
  110. package/lib/components/icons/SIconCopy.vue +0 -6
  111. package/lib/composables/Action.ts +0 -141
  112. package/lib/composables/Alert.ts +0 -50
  113. package/lib/composables/Card.ts +0 -46
  114. package/lib/composables/FormValidation.ts +0 -150
  115. package/lib/composables/Header.ts +0 -72
  116. package/lib/composables/InputDropdown.ts +0 -6
  117. package/lib/composables/Markdown.ts +0 -138
  118. package/lib/composables/Router.ts +0 -20
  119. package/lib/composables/Step.ts +0 -7
  120. package/lib/composables/Store.ts +0 -9
  121. package/lib/composables/Tag.ts +0 -32
  122. package/lib/composables/Tooltip.ts +0 -91
  123. package/lib/composables/Utils.ts +0 -115
  124. package/lib/composables/markdown/LinkPlugin.ts +0 -45
  125. package/lib/compositions/useForm.ts +0 -17
  126. package/lib/compositions/useResizeObserver.ts +0 -25
  127. package/lib/compositions/useTime.ts +0 -26
  128. package/lib/store/alert/index.ts +0 -32
  129. package/lib/store/screen/index.ts +0 -46
  130. package/lib/types/v-calendar.d.ts +0 -5
  131. package/lib/validation/Validation.ts +0 -151
  132. package/lib/validation/rules/day.ts +0 -11
  133. package/lib/validation/rules/email.ts +0 -11
  134. package/lib/validation/rules/every.ts +0 -38
  135. package/lib/validation/rules/include.ts +0 -11
  136. package/lib/validation/rules/includeSome.ts +0 -11
  137. package/lib/validation/rules/integer.ts +0 -11
  138. package/lib/validation/rules/maxValue.ts +0 -11
  139. package/lib/validation/rules/minValue.ts +0 -11
  140. package/lib/validation/rules/month.ts +0 -11
  141. package/lib/validation/rules/not.ts +0 -10
  142. package/lib/validation/rules/regex.ts +0 -11
  143. package/lib/validation/rules/requiredHMS.ts +0 -11
  144. package/lib/validation/rules/requiredMonthDate.ts +0 -11
  145. package/lib/validation/rules/requiredYearMonth.ts +0 -11
  146. package/lib/validation/rules/requiredYearMonthDate.ts +0 -11
  147. package/lib/validation/rules/rule.ts +0 -5
  148. package/lib/validation/rules/sameAs.ts +0 -11
  149. package/lib/validation/rules/url.ts +0 -11
  150. package/lib/validation/rules/validateIf.ts +0 -27
  151. package/lib/validation/rules/year.ts +0 -11
  152. package/lib/validation/rules/yearMonth.ts +0 -11
  153. package/lib/validation/rules/yearMonthDate.ts +0 -11
  154. package/lib/validation/validators/day.ts +0 -29
  155. package/lib/validation/validators/email.ts +0 -5
  156. package/lib/validation/validators/include.ts +0 -5
  157. package/lib/validation/validators/includeSome.ts +0 -5
  158. package/lib/validation/validators/index.ts +0 -51
  159. package/lib/validation/validators/integer.ts +0 -6
  160. package/lib/validation/validators/maxLength.ts +0 -3
  161. package/lib/validation/validators/maxValue.ts +0 -3
  162. package/lib/validation/validators/minValue.ts +0 -3
  163. package/lib/validation/validators/month.ts +0 -3
  164. package/lib/validation/validators/monthDate.ts +0 -20
  165. package/lib/validation/validators/regex.ts +0 -3
  166. package/lib/validation/validators/required.ts +0 -27
  167. package/lib/validation/validators/requiredHMS.ts +0 -17
  168. package/lib/validation/validators/requiredMonthDate.ts +0 -8
  169. package/lib/validation/validators/requiredYearMonth.ts +0 -8
  170. package/lib/validation/validators/requiredYearMonthDate.ts +0 -9
  171. package/lib/validation/validators/sameAs.ts +0 -5
  172. package/lib/validation/validators/url.ts +0 -5
  173. package/lib/validation/validators/year.ts +0 -3
  174. package/lib/validation/validators/yearMonth.ts +0 -20
  175. package/lib/validation/validators/yearMonthDate.ts +0 -21
@@ -1,46 +0,0 @@
1
- <template>
2
- <div ref="target" class="SResponsive" :class="el.classes">
3
- <slot :el="el" />
4
- </div>
5
- </template>
6
-
7
- <script lang="ts">
8
- import { defineComponent, ref, reactive, computed, PropType } from '@vue/composition-api'
9
- import useResizeObserver, { EL as BaseEL } from '../compositions/useResizeObserver'
10
-
11
- export interface EL extends BaseEL {
12
- is: Record<string, boolean>
13
- }
14
-
15
- export interface BP {
16
- [name: string]: (el: EL) => boolean
17
- }
18
-
19
- export default defineComponent({
20
- props: {
21
- bp: { type: Object as PropType<BP>, default: () => ({}) }
22
- },
23
-
24
- setup(props) {
25
- const target = ref<HTMLElement | null>(null)
26
-
27
- const { el: baseEl } = useResizeObserver(target)
28
-
29
- const el = reactive({
30
- ...baseEl,
31
- is: computed(() => {
32
- const classes: Record<string, boolean> = {}
33
- for (const name in props.bp) {
34
- classes[name] = props.bp[name](el)
35
- }
36
- return classes
37
- })
38
- })
39
-
40
- return {
41
- target,
42
- el
43
- }
44
- }
45
- })
46
- </script>
@@ -1,81 +0,0 @@
1
- <template>
2
- <portal to="screen">
3
- <transition name="screen">
4
- <VueSimplebar v-if="show" :key="screenName" class="SScreen">
5
- <div v-if="title" class="header">
6
- <p class="header-title">{{ title }}</p>
7
- </div>
8
-
9
- <div class="content">
10
- <slot />
11
- </div>
12
- </VueSimplebar>
13
- </transition>
14
- </portal>
15
- </template>
16
-
17
- <script lang="ts">
18
- import { computed, defineComponent } from '@vue/composition-api'
19
- import VueSimplebar from 'simplebar-vue'
20
- import { useStore } from '../composables/Store'
21
-
22
- export default defineComponent({
23
- components: {
24
- VueSimplebar
25
- },
26
-
27
- props: {
28
- name: { type: String, required: true },
29
- title: { type: String, default: null }
30
- },
31
-
32
- setup(props) {
33
- const store = useStore()
34
-
35
- const screenName = computed(() => store.state.screen.name)
36
- const show = computed(() => props.name === screenName.value)
37
-
38
- return {
39
- screenName,
40
- show
41
- }
42
- }
43
- })
44
- </script>
45
-
46
- <style lang="postcss" scoped>
47
- @import "@/assets/styles/variables";
48
-
49
- .SScreen {
50
- position: fixed;
51
- top: 0;
52
- right: 0;
53
- bottom: 0;
54
- left: 0;
55
- z-index: var(--z-index-screen);
56
- width: 100%;
57
- height: 100%;
58
- background-color: rgba(255, 255, 255, .5);
59
- transition: opacity .25s;
60
- }
61
-
62
- .SScreen.screen-enter,
63
- .SScreen.screen-leave-to {
64
- opacity: 0;
65
-
66
- .header {
67
- opacity: 0;
68
- transform: translateY(8px);
69
- }
70
- }
71
-
72
- .header {
73
- padding: 64px 64px 0;
74
- transition: opacity .25s, transform .25s;
75
- }
76
-
77
- .header-title {
78
- text-align: center;
79
- font-size: 20px;
80
- }
81
- </style>
@@ -1,75 +0,0 @@
1
- <template>
2
- <header class="SSheetHeader">
3
- <slot />
4
-
5
- <div v-if="closable" class="close">
6
- <button class="close-button" @click="close">
7
- <SIconX class="close-icon" />
8
- </button>
9
- </div>
10
- </header>
11
- </template>
12
-
13
- <script lang="ts">
14
- import { defineComponent } from '@vue/composition-api'
15
- import { useStore } from '../composables/Store'
16
- import SIconX from './icons/SIconX.vue'
17
-
18
- export default defineComponent({
19
- components: {
20
- SIconX
21
- },
22
-
23
- props: {
24
- closable: { type: Boolean, default: true }
25
- },
26
-
27
- setup() {
28
- const store = useStore()
29
-
30
- function close() {
31
- store.dispatch('modal/close')
32
- }
33
-
34
- return {
35
- close
36
- }
37
- }
38
- })
39
- </script>
40
-
41
- <style lang="postcss" scoped>
42
- @import "@/assets/styles/variables";
43
-
44
- .SSheetHeader {
45
- display: flex;
46
- justify-content: space-between;
47
- border-bottom: 1px solid var(--c-divider-light);
48
- min-height: 48px;
49
- background-color: var(--c-bg-soft);
50
- }
51
-
52
- .close {
53
- margin: 0 0 0 auto;
54
- }
55
-
56
- .close-button {
57
- display: flex;
58
- justify-content: center;
59
- align-items: center;
60
- width: 48px;
61
- height: 47px;
62
- color: var(--c-text-3);
63
- transition: color .25s;
64
-
65
- &:hover {
66
- color: var(--c-text-1);
67
- }
68
- }
69
-
70
- .close-icon {
71
- width: 20px;
72
- height: 20px;
73
- fill: currentColor;
74
- }
75
- </style>
@@ -1,17 +0,0 @@
1
- <template>
2
- <h1 class="SSheetHeaderTitle">
3
- <slot />
4
- </h1>
5
- </template>
6
-
7
- <style lang="postcss" scoped>
8
- @import "@/assets/styles/variables";
9
-
10
- .SSheetHeaderTitle {
11
- margin: 0;
12
- padding: 14px 16px 10px;
13
- line-height: 20px;
14
- font-size: 14px;
15
- font-weight: 500;
16
- }
17
- </style>
@@ -1,107 +0,0 @@
1
- <template>
2
- <div class="SStep" :class="[status]">
3
- <div class="indicator">
4
- <div class="bar" :class="[barLeft]" />
5
- <div class="point">
6
- <div v-if="status === 'active'" class="inner-dot" />
7
- <SIconCheck v-else-if="status === 'done'" class="icon" />
8
- <SIconX v-else-if="status === 'failed'" class="icon" />
9
- </div>
10
- <div class="bar" :class="[barRight]" />
11
- </div>
12
-
13
- <p v-if="text" class="text">{{ text }}</p>
14
- </div>
15
- </template>
16
-
17
- <script lang="ts">
18
- import { PropType, defineComponent } from '@vue/composition-api'
19
- import { StepStatus, BarMode } from '../composables/Step'
20
- import SIconCheck from './icons/SIconCheck.vue'
21
- import SIconX from './icons/SIconX.vue'
22
-
23
- export default defineComponent({
24
- components: {
25
- SIconCheck,
26
- SIconX
27
- },
28
-
29
- props: {
30
- status: { type: String as PropType<StepStatus>, required: true },
31
- barLeft: { type: String as PropType<BarMode>, default: null },
32
- barRight: { type: String as PropType<BarMode>, default: null },
33
- text: { type: String, default: null }
34
- }
35
- })
36
- </script>
37
-
38
- <style lang="postcss" scoped>
39
- @import "@/assets/styles/variables";
40
-
41
- .SStep.upcoming {
42
- .point { border-color: var(--c-divider); }
43
- .text { color: var(--c-text-2); }
44
- }
45
-
46
- .SStep.active {
47
- .point { border-color: var(--c-success); }
48
- .text { color: var(--c-success); }
49
- }
50
-
51
- .SStep.done {
52
- .point { border-color: var(--c-success); background-color: var(--c-success); }
53
- .text { color: var(--c-text-1); }
54
- }
55
-
56
- .SStep.failed {
57
- .point { border-color: var(--c-danger); background-color: var(--c-danger); }
58
- .text { color: var(--c-danger); }
59
- }
60
-
61
- .indicator {
62
- display: flex;
63
- align-items: center;
64
- width: 100%;
65
- }
66
-
67
- .point {
68
- display: flex;
69
- justify-content: center;
70
- align-items: center;
71
- border: 1px solid transparent;
72
- border-radius: 50%;
73
- width: 16px;
74
- height: 16px;
75
- }
76
-
77
- .inner-dot {
78
- border-radius: 50%;
79
- width: 6px;
80
- height: 6px;
81
- background-color: var(--c-success);
82
- }
83
-
84
- .icon {
85
- width: 10px;
86
- height: 10px;
87
- fill: var(--c-white);
88
- }
89
-
90
- .bar {
91
- width: calc(50% - 8px);
92
- height: 2px;
93
- }
94
-
95
- .bar.mute { background-color: var(--c-divider-light); }
96
- .bar.active { background-color: var(--c-success); }
97
- .bar.failed { background-color: var(--c-danger); }
98
-
99
- .text {
100
- margin: 0;
101
- padding: 8px 8px 0;
102
- text-align: center;
103
- line-height: 16px;
104
- font-size: 12px;
105
- font-weight: 500;
106
- }
107
- </style>
@@ -1,75 +0,0 @@
1
- <template>
2
- <div class="SSteps">
3
- <SStep
4
- v-for="(step, index) in steps"
5
- :key="index"
6
- class="item"
7
- :style="{ width }"
8
- :bar-left="getBarLeftMode(index)"
9
- :bar-right="getBarRightMode(index)"
10
- v-bind="step"
11
- />
12
- </div>
13
- </template>
14
-
15
- <script lang="ts">
16
- import { PropType, defineComponent, computed } from '@vue/composition-api'
17
- import { Step, BarMode } from '../composables/Step'
18
- import SStep from './SStep.vue'
19
-
20
- export default defineComponent({
21
- components: {
22
- SStep
23
- },
24
-
25
- props: {
26
- steps: { type: Array as PropType<Step[]>, required: true }
27
- },
28
-
29
- setup(props) {
30
- const width = computed(() => {
31
- return `calc(100% / ${props.steps.length})`
32
- })
33
-
34
- function getBarLeftMode(index: number): BarMode | null {
35
- if (index === 0) {
36
- return null
37
- }
38
-
39
- const current = props.steps[index]
40
- const prev = props.steps[index - 1]
41
-
42
- return isActive(prev) && isActive(current) ? 'active' : 'mute'
43
- }
44
-
45
- function getBarRightMode(index: number): BarMode | null {
46
- if (index === props.steps.length - 1) {
47
- return null
48
- }
49
-
50
- const current = props.steps[index]
51
- const next = props.steps[index + 1]
52
-
53
- return isActive(current) && isActive(next) ? 'active' : 'mute'
54
- }
55
-
56
- function isActive(step: Step): boolean {
57
- return step.status === 'active' || step.status === 'done'
58
- }
59
-
60
- return {
61
- width,
62
- getBarLeftMode,
63
- getBarRightMode
64
- }
65
- }
66
- })
67
- </script>
68
-
69
- <style lang="postcss" scoped>
70
- @import "@/assets/styles/variables";
71
-
72
- .SSteps {
73
- display: flex;
74
- }
75
- </style>
@@ -1,67 +0,0 @@
1
- <template>
2
- <div class="STag" :class="[size, mode]">
3
- <SLink class="text" :href="link">
4
- <component :is="icon" class="icon" /> {{ text }}
5
- </SLink>
6
- </div>
7
- </template>
8
-
9
- <script lang="ts">
10
- import { PropType, defineComponent } from '@vue/composition-api'
11
- import { Size, Mode } from '../composables/Tag'
12
- import SLink from './SLink.vue'
13
-
14
- export default defineComponent({
15
- components: {
16
- SLink
17
- },
18
-
19
- props: {
20
- size: { type: String as PropType<Size>, default: 'small' },
21
- mode: { type: String as PropType<Mode>, default: 'neutral' },
22
- icon: { type: Object, default: null },
23
- text: { type: String, default: null },
24
- link: { type: String, default: null }
25
- }
26
- })
27
- </script>
28
-
29
- <style lang="postcss" scoped>
30
- @import "@/assets/styles/variables";
31
-
32
- .STag.small {
33
- .text {
34
- line-height: 20px;
35
- font-size: 12px;
36
- font-weight: 500;
37
- }
38
-
39
- .icon {
40
- margin-right: 6px;
41
- width: 12px;
42
- height: 12px;
43
- }
44
- }
45
-
46
- .STag.info .text { color: var(--c-info); }
47
- .STag.success .text { color: var(--c-success); }
48
- .STag.warning .text { color: var(--c-warning); }
49
- .STag.danger .text { color: var(--c-danger); }
50
- .STag.mute .text { color: var(--c-text-2); }
51
-
52
- .STag.info .text.link:hover { color: var(--c-info-dark); }
53
- .STag.success .text.link:hover { color: var(--c-success-dark); }
54
- .STag.warning .text.link:hover { color: var(--c-warning-dark); }
55
- .STag.danger .text.link:hover { color: var(--c-danger-dark); }
56
- .STag.mute .text.link:hover { color: var(--c-info); }
57
-
58
- .text {
59
- display: flex;
60
- align-items: center;
61
- transition: color .25s;
62
- }
63
-
64
- .icon {
65
- fill: currentColor;
66
- }
67
- </style>
@@ -1,134 +0,0 @@
1
- <template>
2
- <component :is="tag" class="STooltip" @mouseenter="show" @mouseleave="hide">
3
- <template v-if="text">
4
- <span ref="content" class="STooltip-content">
5
- <slot />
6
- </span>
7
-
8
- <transition name="fade">
9
- <span v-show="on" ref="tip" class="STooltip-container" :class="classes">
10
- <SMarkdown class="STooltip-tip" :content="text" inline />
11
- </span>
12
- </transition>
13
- </template>
14
-
15
- <template v-else>
16
- <span class="STooltip-content">
17
- <slot />
18
- </span>
19
- </template>
20
- </component>
21
- </template>
22
-
23
- <script lang="ts">
24
- import { PropType, defineComponent, ref, computed } from '@vue/composition-api'
25
- import { Position, useTooltip } from '../composables/Tooltip'
26
- import SMarkdown from './SMarkdown.vue'
27
-
28
- export default defineComponent({
29
- components: {
30
- SMarkdown
31
- },
32
-
33
- props: {
34
- tag: { type: String, default: 'span' },
35
- text: { type: String, default: null },
36
- position: { type: String as PropType<Position>, default: 'top' }
37
- },
38
-
39
- setup(props) {
40
- const tip = ref<HTMLElement | null>(null)
41
- const content = ref<HTMLElement | null>(null)
42
-
43
- const classes = computed(() => [props.position])
44
-
45
- const { on, show, hide } = useTooltip(content, tip, props.position)
46
-
47
- return {
48
- tip,
49
- content,
50
- classes,
51
- on,
52
- show,
53
- hide
54
- }
55
- }
56
- })
57
- </script>
58
-
59
- <style lang="postcss" scoped>
60
- @import "@/assets/styles/variables";
61
-
62
- .STooltip {
63
- position: relative;
64
- }
65
-
66
- .STooltip-container {
67
- position: absolute;
68
- display: block;
69
- transition: opacity .25s;
70
- z-index: var(--z-index-tooltip);
71
- }
72
-
73
- .STooltip-container.fade-enter,
74
- .STooltip-container.fade-leave-to {
75
- opacity: 0;
76
-
77
- &.top .STooltip-tip { transform: translateY(8px); }
78
- &.right .STooltip-tip { transform: translateX(-8px); }
79
- &.bottom .STooltip-tip { transform: translateY(-8px); }
80
- &.left .STooltip-tip { transform: translateX(8px); }
81
- }
82
-
83
- .STooltip-container.top {
84
- top: 0;
85
- left: 50%;
86
- padding-bottom: 8px;
87
- transform: translate(-50%, -100%);
88
- }
89
-
90
- .STooltip-container.right {
91
- top: 50%;
92
- left: 100%;
93
- transform: translate(8px, -50%);
94
- }
95
-
96
- .STooltip-container.bottom {
97
- bottom: 0;
98
- left: 50%;
99
- padding-top: 8px;
100
- transform: translate(-50%, 100%);
101
- }
102
-
103
- .STooltip-container.left {
104
- top: 50%;
105
- right: 100%;
106
- transform: translate(-8px, -50%);
107
- }
108
-
109
- .STooltip-tip {
110
- display: block;
111
- border-radius: 4px;
112
- padding: 12px;
113
- width: max-content;
114
- max-width: 288px;
115
- line-height: 18px;
116
- font-size: 12px;
117
- font-weight: 500;
118
- color: var(--c-text-dark-1);
119
- background-color: rgba(0, 0, 0, .9);
120
- transition: transform .25s;
121
- }
122
-
123
- .STooltip-tip >>> a {
124
- color: var(--c-info);
125
-
126
- &:hover {
127
- color: var(--c-info-dark);
128
- }
129
- }
130
-
131
- .STooltip-content {
132
- white-space: nowrap;
133
- }
134
- </style>