@globalbrain/sefirot 2.0.0-draft.8 → 2.1.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 (182) hide show
  1. package/README.md +6 -6
  2. package/lib/components/SAvatar.vue +17 -17
  3. package/lib/components/SButton.vue +520 -276
  4. package/lib/components/SButtonGroup.vue +149 -0
  5. package/lib/components/SDropdown.vue +26 -150
  6. package/lib/components/SDropdownSection.vue +48 -0
  7. package/lib/components/SDropdownSectionFilter.vue +190 -0
  8. package/lib/components/SDropdownSectionFilterItem.vue +21 -0
  9. package/lib/components/SDropdownSectionFilterItemAvatar.vue +31 -0
  10. package/lib/components/SDropdownSectionFilterItemText.vue +20 -0
  11. package/lib/components/SDropdownSectionMenu.vue +39 -0
  12. package/lib/components/SIcon.vue +13 -0
  13. package/lib/components/SInputBase.vue +31 -31
  14. package/lib/components/SInputCheckbox.vue +4 -3
  15. package/lib/components/SInputCheckboxes.vue +74 -0
  16. package/lib/components/SInputDate.vue +182 -0
  17. package/lib/components/SInputDropdown.vue +159 -157
  18. package/lib/components/SInputDropdownItem.vue +46 -48
  19. package/lib/components/SInputDropdownItemAvatar.vue +99 -0
  20. package/lib/components/SInputDropdownItemText.vue +79 -16
  21. package/lib/components/SInputFile.vue +56 -60
  22. package/lib/components/SInputHMS.vue +120 -110
  23. package/lib/components/SInputNumber.vue +38 -9
  24. package/lib/components/SInputRadio.vue +39 -36
  25. package/lib/components/SInputRadios.vue +40 -53
  26. package/lib/components/SInputSelect.vue +7 -6
  27. package/lib/components/SInputSwitch.vue +193 -0
  28. package/lib/components/SInputSwitches.vue +88 -0
  29. package/lib/components/SInputText.vue +207 -62
  30. package/lib/components/SInputTextarea.vue +46 -32
  31. package/lib/components/SInputYMD.vue +123 -126
  32. package/lib/components/SMarkdown.vue +52 -0
  33. package/lib/components/SModal.vue +33 -57
  34. package/lib/components/SMount.vue +19 -0
  35. package/lib/components/SSheet.vue +50 -55
  36. package/lib/components/SSheetFooter.vue +1 -1
  37. package/lib/components/SSheetFooterAction.vue +24 -17
  38. package/lib/components/SSheetFooterActions.vue +1 -4
  39. package/lib/components/SSheetForm.vue +15 -0
  40. package/lib/components/SSheetMedium.vue +8 -10
  41. package/lib/components/SSheetTitle.vue +7 -14
  42. package/lib/components/SSnackbar.vue +58 -47
  43. package/lib/components/{SPortalSnackbars.vue → SSnackbars.vue} +17 -20
  44. package/lib/components/{icons/SIconPreloader.vue → SSpinner.vue} +5 -4
  45. package/lib/components/SStep.vue +107 -0
  46. package/lib/components/SSteps.vue +59 -0
  47. package/lib/components/STable.vue +242 -0
  48. package/lib/components/STableCell.vue +82 -0
  49. package/lib/components/STableCellAvatar.vue +69 -0
  50. package/lib/components/STableCellAvatars.vue +93 -0
  51. package/lib/components/STableCellDay.vue +40 -0
  52. package/lib/components/STableCellPill.vue +84 -0
  53. package/lib/components/STableCellText.vue +103 -0
  54. package/lib/components/STableColumn.vue +255 -0
  55. package/lib/components/STableFooter.vue +115 -0
  56. package/lib/components/STableHeader.vue +74 -0
  57. package/lib/components/STableItem.vue +38 -0
  58. package/lib/components/STooltip.vue +112 -0
  59. package/lib/composables/Dropdown.ts +40 -99
  60. package/lib/composables/Form.ts +21 -18
  61. package/lib/composables/Grid.ts +117 -0
  62. package/lib/composables/Markdown.ts +138 -0
  63. package/lib/composables/Step.ts +7 -0
  64. package/lib/composables/Table.ts +103 -0
  65. package/lib/composables/Tooltip.ts +91 -0
  66. package/lib/composables/Validation.ts +5 -9
  67. package/lib/composables/markdown/LinkPlugin.ts +45 -0
  68. package/lib/mixins/Sheet.ts +5 -3
  69. package/lib/stores/Snackbars.ts +48 -0
  70. package/lib/{assets/styles → styles}/base.css +0 -0
  71. package/lib/{assets/styles → styles}/bootstrap.css +1 -0
  72. package/lib/{assets/styles → styles}/variables.css +55 -48
  73. package/lib/support/Day.ts +8 -0
  74. package/lib/support/Num.ts +3 -0
  75. package/lib/support/Time.ts +5 -2
  76. package/lib/support/Utils.ts +4 -3
  77. package/lib/types/shims.d.ts +3 -0
  78. package/lib/validation/validators/requiredYmd.ts +1 -1
  79. package/lib/validation/validators/ymd.ts +4 -4
  80. package/package.json +59 -37
  81. package/CHANGELOG.md +0 -47
  82. package/lib/.DS_Store +0 -0
  83. package/lib/components/.DS_Store +0 -0
  84. package/lib/components/SDialog.vue +0 -140
  85. package/lib/components/SDropdownItem.vue +0 -78
  86. package/lib/components/SDropdownItemText.vue +0 -22
  87. package/lib/components/SDropdownItemUser.vue +0 -40
  88. package/lib/components/SInputDropdownItemTextTag.vue +0 -94
  89. package/lib/components/SInputDropdownItemUser.vue +0 -41
  90. package/lib/components/SInputDropdownItemUserTag.vue +0 -100
  91. package/lib/components/SPortalModals.vue +0 -74
  92. package/lib/components/icons/.DS_Store +0 -0
  93. package/lib/components/icons/SIconActivity.vue +0 -5
  94. package/lib/components/icons/SIconArrowDown.vue +0 -5
  95. package/lib/components/icons/SIconArrowLeft.vue +0 -5
  96. package/lib/components/icons/SIconArrowRight.vue +0 -5
  97. package/lib/components/icons/SIconArrowUp.vue +0 -5
  98. package/lib/components/icons/SIconBarChart.vue +0 -7
  99. package/lib/components/icons/SIconBriefcase.vue +0 -5
  100. package/lib/components/icons/SIconBuilding.vue +0 -5
  101. package/lib/components/icons/SIconCalendar.vue +0 -5
  102. package/lib/components/icons/SIconCheck.vue +0 -5
  103. package/lib/components/icons/SIconCheckCircle.vue +0 -6
  104. package/lib/components/icons/SIconCheckCircleThin.vue +0 -6
  105. package/lib/components/icons/SIconCheckSquare.vue +0 -6
  106. package/lib/components/icons/SIconChevronDown.vue +0 -5
  107. package/lib/components/icons/SIconChevronLeft.vue +0 -5
  108. package/lib/components/icons/SIconChevronRight.vue +0 -5
  109. package/lib/components/icons/SIconChevronUp.vue +0 -5
  110. package/lib/components/icons/SIconClock.vue +0 -6
  111. package/lib/components/icons/SIconCode.vue +0 -6
  112. package/lib/components/icons/SIconDatabase.vue +0 -5
  113. package/lib/components/icons/SIconDollarSign.vue +0 -5
  114. package/lib/components/icons/SIconDownload.vue +0 -6
  115. package/lib/components/icons/SIconDownloadCloud.vue +0 -6
  116. package/lib/components/icons/SIconEdit.vue +0 -6
  117. package/lib/components/icons/SIconEdit2.vue +0 -5
  118. package/lib/components/icons/SIconEdit3.vue +0 -6
  119. package/lib/components/icons/SIconEdit3Off.vue +0 -6
  120. package/lib/components/icons/SIconExternalLink.vue +0 -6
  121. package/lib/components/icons/SIconEye.vue +0 -6
  122. package/lib/components/icons/SIconFile.vue +0 -5
  123. package/lib/components/icons/SIconFilePlus.vue +0 -6
  124. package/lib/components/icons/SIconFileText.vue +0 -8
  125. package/lib/components/icons/SIconFlag.vue +0 -5
  126. package/lib/components/icons/SIconGitBranch.vue +0 -5
  127. package/lib/components/icons/SIconGitCommit.vue +0 -5
  128. package/lib/components/icons/SIconGitPullRequest.vue +0 -6
  129. package/lib/components/icons/SIconGlobe.vue +0 -5
  130. package/lib/components/icons/SIconGrab.vue +0 -10
  131. package/lib/components/icons/SIconGrid.vue +0 -8
  132. package/lib/components/icons/SIconHome.vue +0 -5
  133. package/lib/components/icons/SIconImage.vue +0 -6
  134. package/lib/components/icons/SIconInbox.vue +0 -5
  135. package/lib/components/icons/SIconInfo.vue +0 -7
  136. package/lib/components/icons/SIconLayout.vue +0 -5
  137. package/lib/components/icons/SIconList.vue +0 -10
  138. package/lib/components/icons/SIconLock.vue +0 -5
  139. package/lib/components/icons/SIconLogout.vue +0 -6
  140. package/lib/components/icons/SIconMail.vue +0 -6
  141. package/lib/components/icons/SIconMapPin.vue +0 -6
  142. package/lib/components/icons/SIconMoon.vue +0 -5
  143. package/lib/components/icons/SIconMoreHorizontal.vue +0 -7
  144. package/lib/components/icons/SIconMoreVertical.vue +0 -7
  145. package/lib/components/icons/SIconPauseFill.vue +0 -6
  146. package/lib/components/icons/SIconPlayCircle.vue +0 -6
  147. package/lib/components/icons/SIconPlayFill.vue +0 -5
  148. package/lib/components/icons/SIconPlus.vue +0 -5
  149. package/lib/components/icons/SIconPlusCircle.vue +0 -8
  150. package/lib/components/icons/SIconPlusOff.vue +0 -7
  151. package/lib/components/icons/SIconPreloaderDark.vue +0 -52
  152. package/lib/components/icons/SIconPreloaderLight.vue +0 -52
  153. package/lib/components/icons/SIconProgress.vue +0 -5
  154. package/lib/components/icons/SIconRadio.vue +0 -6
  155. package/lib/components/icons/SIconSave.vue +0 -5
  156. package/lib/components/icons/SIconSearch.vue +0 -5
  157. package/lib/components/icons/SIconSend.vue +0 -5
  158. package/lib/components/icons/SIconSettings.vue +0 -6
  159. package/lib/components/icons/SIconShare2.vue +0 -5
  160. package/lib/components/icons/SIconSkipBackFill.vue +0 -6
  161. package/lib/components/icons/SIconSliders.vue +0 -12
  162. package/lib/components/icons/SIconSun.vue +0 -13
  163. package/lib/components/icons/SIconTelescope.vue +0 -5
  164. package/lib/components/icons/SIconTrash.vue +0 -5
  165. package/lib/components/icons/SIconTrash2.vue +0 -7
  166. package/lib/components/icons/SIconTrash2Off.vue +0 -6
  167. package/lib/components/icons/SIconTrello.vue +0 -7
  168. package/lib/components/icons/SIconUser.vue +0 -6
  169. package/lib/components/icons/SIconUsers.vue +0 -8
  170. package/lib/components/icons/SIconWarning.vue +0 -7
  171. package/lib/components/icons/SIconX.vue +0 -5
  172. package/lib/components/icons/SIconXCircle.vue +0 -6
  173. package/lib/components/icons/SIconXCircleThin.vue +0 -6
  174. package/lib/components/icons/SIconXSquare.vue +0 -6
  175. package/lib/components/icons/SIconZap.vue +0 -5
  176. package/lib/composables/Dialog.ts +0 -38
  177. package/lib/composables/Modal.ts +0 -34
  178. package/lib/composables/Snackbar.ts +0 -18
  179. package/lib/store/Sefirot.ts +0 -17
  180. package/lib/store/dialog/index.ts +0 -42
  181. package/lib/store/modal/index.ts +0 -61
  182. package/lib/store/snackbars/index.ts +0 -70
@@ -0,0 +1,255 @@
1
+ <script setup lang="ts">
2
+ import IconDotsThree from '@iconify-icons/ph/dots-three'
3
+ import { ref, computed, unref, watch, nextTick } from 'vue'
4
+ import { DropdownSection } from '../composables/Dropdown'
5
+ import { useFlyout } from '../composables/Flyout'
6
+ import { isArray } from '../support/Utils'
7
+ import SDropdown from './SDropdown.vue'
8
+ import SIcon from './SIcon.vue'
9
+
10
+ const props = defineProps<{
11
+ name: string
12
+ label: string
13
+ className?: string
14
+ dropdown?: DropdownSection[]
15
+ }>()
16
+
17
+ const emit = defineEmits<{
18
+ (e: 'resize', value: string): void
19
+ }>()
20
+
21
+ const { container, isOpen, toggle } = useFlyout()
22
+
23
+ let startWidth = 0
24
+ let startPoint = 0
25
+
26
+ const column = ref<HTMLElement | null>(null)
27
+ const dialog = ref<HTMLElement | null>(null)
28
+ const top = ref('')
29
+ const left = ref('')
30
+
31
+ const active = computed(() => {
32
+ return props.dropdown?.some((item) => {
33
+ if (item.type !== 'filter') {
34
+ return false
35
+ }
36
+
37
+ const selected = unref(item.selected)
38
+
39
+ if (!isArray(selected)) {
40
+ return selected !== null
41
+ }
42
+
43
+ if (!selected.length) {
44
+ return false
45
+ }
46
+
47
+ return item.options.some((option) => {
48
+ return selected.includes(option.value)
49
+ })
50
+ })
51
+ })
52
+
53
+ const buttonActive = computed(() => {
54
+ return isOpen.value || active.value
55
+ })
56
+
57
+ watch(isOpen, (value) => {
58
+ value ? adjustDialogPosition() : stopDialogPositionListener()
59
+ })
60
+
61
+ function grip(e: any) {
62
+ startWidth = column.value?.offsetWidth ?? 0
63
+ startPoint = e.pageX
64
+
65
+ document.addEventListener('mousemove', resize)
66
+ document.addEventListener('mouseup', stopResizeListener)
67
+ }
68
+
69
+ function resize(e: MouseEvent) {
70
+ const movedWidth = e.pageX - startPoint
71
+ const resized = startWidth + movedWidth
72
+
73
+ emit('resize', resized > -1 ? `${resized}px` : 'var(--table-col-width)')
74
+ }
75
+
76
+ function stopResizeListener() {
77
+ document.removeEventListener('mousemove', resize)
78
+ document.removeEventListener('mouseup', stopResizeListener)
79
+ }
80
+
81
+ async function adjustDialogPosition() {
82
+ if (!props.dropdown || !isOpen.value) {
83
+ return
84
+ }
85
+
86
+ startDialogPositionListener()
87
+
88
+ const rect = container.value.getBoundingClientRect()
89
+
90
+ await nextTick()
91
+
92
+ const dialogWidth = dialog.value?.offsetWidth ?? 0
93
+ const position = (window.innerWidth - rect.right) > dialogWidth ? 'right' : 'left'
94
+
95
+ top.value = `${rect.top + rect.height - 8}px`
96
+ left.value = position === 'right' ? `${rect.left - 4}px` : `${rect.right - dialogWidth - 4}px`
97
+ }
98
+
99
+ function startDialogPositionListener() {
100
+ window.addEventListener('scroll', adjustDialogPosition)
101
+ window.addEventListener('resize', adjustDialogPosition)
102
+ }
103
+
104
+ function stopDialogPositionListener() {
105
+ window.removeEventListener('scroll', adjustDialogPosition)
106
+ window.removeEventListener('resize', adjustDialogPosition)
107
+ }
108
+ </script>
109
+
110
+ <template>
111
+ <div class="STableColumn STableCell" :class="[{ active }, className ?? `col-${name}`]" ref="column">
112
+ <div class="container">
113
+ <p class="label">{{ label }}</p>
114
+
115
+ <div v-if="dropdown" class="action" ref="container">
116
+ <button class="button" :class="{ active: buttonActive }" @click="toggle">
117
+ <SIcon :icon="IconDotsThree" class="icon" />
118
+ </button>
119
+
120
+ <transition name="fade">
121
+ <div v-if="isOpen" class="dialog" :style="{ top, left }" ref="dialog">
122
+ <SDropdown :sections="dropdown" />
123
+ </div>
124
+ </transition>
125
+ </div>
126
+
127
+ <div class="grip" @mousedown="grip" />
128
+ </div>
129
+ </div>
130
+ </template>
131
+
132
+ <style scoped lang="postcss">
133
+ .STableColumn {
134
+ border-top: 1px solid var(--c-divider-light);
135
+ background-color: var(--c-bg-soft);
136
+
137
+ .STableItem:first-child & {
138
+ padding-left: var(--table-padding-left);
139
+ }
140
+
141
+ .STableItem:last-child & {
142
+ border-right: 0;
143
+ padding-right: var(--table-padding-right);
144
+ }
145
+ }
146
+
147
+ .container {
148
+ display: flex;
149
+ justify-content: space-between;
150
+ padding-left: 16px;
151
+ }
152
+
153
+ .label {
154
+ flex-grow: 1;
155
+ line-height: 40px;
156
+ text-align: left;
157
+ font-size: 12px;
158
+ font-weight: 600;
159
+ color: var(--c-text-2);
160
+ white-space: nowrap;
161
+ overflow: hidden;
162
+ text-overflow: ellipsis;
163
+ transition: color 0.25s;
164
+
165
+ .STableColumn.active & {
166
+ color: var(--c-info);
167
+ }
168
+ }
169
+
170
+ .action {
171
+ position: relative;
172
+ padding-right: 6px;
173
+ }
174
+
175
+ .button {
176
+ display: flex;
177
+ justify-content: center;
178
+ align-items: center;
179
+ flex-shrink: 0;
180
+ margin: 6px 0;
181
+ border-radius: 8px;
182
+ width: 28px;
183
+ height: 28px;
184
+ color: var(--c-text-2);
185
+ transition: background-color 0.25s, color 0.25s;
186
+
187
+ &:hover {
188
+ color: var(--c-text-1);
189
+ background-color: var(--c-bg-mute);
190
+ }
191
+
192
+ &.active {
193
+ color: var(--c-info);
194
+ }
195
+
196
+ .dark &:hover {
197
+ background-color: var(--c-bg);
198
+ }
199
+ }
200
+
201
+ .icon {
202
+ width: 20px;
203
+ height: 20px;
204
+ }
205
+
206
+ .dialog {
207
+ position: fixed;
208
+ z-index: var(--z-index-dropdown);
209
+ border-radius: 12px;
210
+ width: 256px;
211
+ box-shadow: var(--shadow-depth-3);
212
+ transition: opacity 0.25s, transform 0.25s;
213
+ }
214
+
215
+ .dialog.fade-enter-from,
216
+ .dialog.fade-leave-to {
217
+ opacity: 0;
218
+ transform: translateY(-4px);
219
+ }
220
+
221
+ .grip {
222
+ position: relative;
223
+ right: -8px;
224
+ top: 0px;
225
+ bottom: 0px;
226
+ width: 16px;
227
+ z-index: 1;
228
+ position: absolute;
229
+ cursor: col-resize;
230
+
231
+ &::before {
232
+ position: absolute;
233
+ top: 0;
234
+ bottom: 0;
235
+ left: 7px;
236
+ width: 3px;
237
+ content: "";
238
+ transition: background-color 0.25s;
239
+ }
240
+
241
+ &:hover::before {
242
+ background-color: var(--c-info);
243
+ }
244
+
245
+ .STableItem:last-child .STableColumn & {
246
+ right: 0;
247
+ width: 8px;
248
+ }
249
+
250
+ .STableItem:last-child .STableColumn &::before {
251
+ left: 6px;
252
+ width: 2px;
253
+ }
254
+ }
255
+ </style>
@@ -0,0 +1,115 @@
1
+ <script setup lang="ts">
2
+ import IconCaretLeft from '@iconify-icons/ph/caret-left-bold'
3
+ import IconCaretRight from '@iconify-icons/ph/caret-right-bold'
4
+ import { computed } from 'vue'
5
+ import { format } from '../support/Num'
6
+ import SIcon from './SIcon.vue'
7
+
8
+ const props = defineProps<{
9
+ total?: number
10
+ page?: number
11
+ perPage?: number
12
+ borderless?: boolean
13
+ onPrev?(): void
14
+ onNext?(): void
15
+ }>()
16
+
17
+ const _total = computed(() => props.total ?? 0)
18
+ const _page = computed(() => props.page ?? 0)
19
+ const _perPage = computed(() => props.perPage ?? 0)
20
+
21
+ const from = computed(() => {
22
+ return _page.value === 1 ? 1 : (_page.value - 1) * _perPage.value + 1
23
+ })
24
+
25
+ const to = computed(() => {
26
+ const value = _page.value * _perPage.value
27
+
28
+ return value > _total.value ? _total.value : value
29
+ })
30
+
31
+ const hasPrev = computed(() => {
32
+ return _page.value > 1
33
+ })
34
+
35
+ const hasNext = computed(() => {
36
+ return to.value < _total.value
37
+ })
38
+ </script>
39
+
40
+ <template>
41
+ <div class="STableFooter" :class="{ borderless }">
42
+ <div class="container">
43
+ <p class="info">{{ format(from) }}–{{ format(to) }} of {{ format(_total) }}</p>
44
+
45
+ <div class="actions">
46
+ <button class="button prev" :class="{ active: hasPrev }" @click="onPrev">
47
+ <SIcon :icon="IconCaretLeft" class="icon" />
48
+ </button>
49
+ <button class="button next" :class="{ active: hasNext }" @click="onNext">
50
+ <SIcon :icon="IconCaretRight" class="icon" />
51
+ </button>
52
+ </div>
53
+ </div>
54
+ </div>
55
+ </template>
56
+
57
+ <style scoped lang="postcss">
58
+ .STableFooter {
59
+ border-radius: 0 0 6px 6px;
60
+ padding-top: 8px;
61
+ padding-right: var(--table-padding-right);
62
+ padding-bottom: 8px;
63
+ padding-left: var(--table-padding-left);
64
+ background-color: var(--c-bg-elv-up);
65
+
66
+ &.borderless {
67
+ border-radius: 0;
68
+ }
69
+ }
70
+
71
+ .container {
72
+ display: flex;
73
+ justify-content: flex-end;
74
+ }
75
+
76
+ .info {
77
+ padding-right: 8px;
78
+ padding-top: 4px;
79
+ line-height: 24px;
80
+ font-size: 12px;
81
+ font-weight: 500;
82
+ color: var(--c-text-2);
83
+ }
84
+
85
+ .actions {
86
+ display: flex;
87
+ padding-right: 8px;
88
+ }
89
+
90
+ .button {
91
+ display: flex;
92
+ justify-content: center;
93
+ align-items: center;
94
+ border-radius: 6px;
95
+ width: 32px;
96
+ height: 32px;
97
+ color: var(--c-text-3);
98
+ cursor: not-allowed;
99
+ transition: color 0.25s, background-color 0.25s;
100
+
101
+ &.active {
102
+ color: var(--c-text-2);
103
+ cursor: pointer;
104
+ }
105
+
106
+ &.active:hover {
107
+ background-color: var(--c-bg-elv-down);
108
+ }
109
+ }
110
+
111
+ .icon {
112
+ width: 16px;
113
+ height: 16px;
114
+ }
115
+ </style>
@@ -0,0 +1,74 @@
1
+ <script setup lang="ts">
2
+ import { format } from '../support/Num'
3
+
4
+ defineProps<{
5
+ total?: number
6
+ reset?: boolean
7
+ borderless?: boolean
8
+ onReset?(): void
9
+ }>()
10
+ </script>
11
+
12
+ <template>
13
+ <div class="STableHeader" :class="{ borderless }">
14
+ <div class="container">
15
+ <p class="total">
16
+ {{ format(total ?? 0) }} {{ (total ?? 0) > 1 ? 'records' : 'record' }}
17
+ </p>
18
+
19
+ <div v-if="reset" class="reset">
20
+ <button class="button" @click="onReset">
21
+ Reset filters
22
+ </button>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </template>
27
+
28
+ <style scoped lang="postcss">
29
+ .STableHeader {
30
+ padding-right: var(--table-padding-right);
31
+ padding-left: var(--table-padding-left);
32
+ }
33
+
34
+ .container {
35
+ display: flex;
36
+ padding: 0 16px;
37
+ }
38
+
39
+ .total {
40
+ padding: 13px 0 11px;
41
+ line-height: 24px;
42
+ font-size: 12px;
43
+ font-weight: 500;
44
+ color: var(--c-text-2);
45
+ }
46
+
47
+ .reset {
48
+ position: relative;
49
+ margin-left: 16px;
50
+
51
+ &::before {
52
+ display: inline-block;
53
+ margin-right: 16px;
54
+ width: 1px;
55
+ height: 16px;
56
+ background-color: var(--c-divider-light);
57
+ content: "";
58
+ transform: translateY(4px);
59
+ }
60
+ }
61
+
62
+ .button {
63
+ padding: 13px 0 11px;
64
+ line-height: 24px;
65
+ font-size: 12px;
66
+ font-weight: 500;
67
+ color: var(--c-info);
68
+ transition: color 0.25s;
69
+
70
+ &:hover {
71
+ color: var(--c-info-dark);
72
+ }
73
+ }
74
+ </style>
@@ -0,0 +1,38 @@
1
+ <script setup lang="ts">
2
+ defineProps<{
3
+ name: string
4
+ width?: string
5
+ }>()
6
+ </script>
7
+
8
+ <template>
9
+ <div
10
+ class="STableItem"
11
+ :class="[`col-${name}`, { adjusted: width }]"
12
+ >
13
+ <slot />
14
+ </div>
15
+ </template>
16
+
17
+ <style scoped lang="postcss">
18
+ .STableItem {
19
+ position: var(--table-col-position, relative);
20
+ left: 0;
21
+ z-index: var(--table-col-z-index, auto);
22
+ flex-shrink: 0;
23
+ flex-grow: 1;
24
+ border-right: 1px solid var(--c-divider-light);
25
+ min-width: var(--table-col-width);
26
+ max-width: var(--table-col-max-width, var(--table-col-width));
27
+
28
+ &:last-child {
29
+ border-right: 0;
30
+ }
31
+
32
+ &.adjusted {
33
+ width: v-bind(width) !important;
34
+ min-width: v-bind(width) !important;
35
+ max-width: v-bind(width) !important;
36
+ }
37
+ }
38
+ </style>
@@ -0,0 +1,112 @@
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 setup lang="ts">
24
+ import { computed, PropType, ref } from 'vue'
25
+ import { Position, useTooltip } from '../composables/Tooltip'
26
+ import SMarkdown from './SMarkdown.vue'
27
+
28
+ const props = defineProps({
29
+ tag: { type: String, default: 'span' },
30
+ text: { type: String, default: null },
31
+ position: { type: String as PropType<Position>, default: 'top' }
32
+ })
33
+
34
+ const tip = ref<HTMLElement | null>(null)
35
+ const content = ref<HTMLElement | null>(null)
36
+ const classes = computed(() => [props.position])
37
+ const { on, show, hide } = useTooltip(content, tip, props.position)
38
+ </script>
39
+
40
+ <style lang="postcss" scoped>
41
+ .STooltip {
42
+ position: relative;
43
+ }
44
+
45
+ .STooltip-container {
46
+ position: absolute;
47
+ display: block;
48
+ transition: opacity .25s;
49
+ z-index: var(--z-index-tooltip);
50
+ }
51
+
52
+ .STooltip-container.fade-enter,
53
+ .STooltip-container.fade-leave-to {
54
+ opacity: 0;
55
+ &.top .STooltip-tip { transform: translateY(8px); }
56
+ &.right .STooltip-tip { transform: translateX(-8px); }
57
+ &.bottom .STooltip-tip { transform: translateY(-8px); }
58
+ &.left .STooltip-tip { transform: translateX(8px); }
59
+ }
60
+
61
+ .STooltip-container.top {
62
+ top: 0;
63
+ left: 50%;
64
+ padding-bottom: 8px;
65
+ transform: translate(-50%, -100%);
66
+ }
67
+
68
+ .STooltip-container.right {
69
+ top: 50%;
70
+ left: 100%;
71
+ transform: translate(8px, -50%);
72
+ }
73
+
74
+ .STooltip-container.bottom {
75
+ bottom: 0;
76
+ left: 50%;
77
+ padding-top: 8px;
78
+ transform: translate(-50%, 100%);
79
+ }
80
+
81
+ .STooltip-container.left {
82
+ top: 50%;
83
+ right: 100%;
84
+ transform: translate(-8px, -50%);
85
+ }
86
+
87
+ .STooltip-tip {
88
+ display: block;
89
+ border-radius: 4px;
90
+ padding: 12px;
91
+ width: max-content;
92
+ max-width: 288px;
93
+ line-height: 18px;
94
+ font-size: 12px;
95
+ font-weight: 500;
96
+ color: var(--c-text-dark-1);
97
+ background-color: rgba(0, 0, 0, .9);
98
+ transition: transform .25s;
99
+ }
100
+
101
+ .STooltip-tip :deep(a) {
102
+ color: var(--c-info);
103
+
104
+ &:hover {
105
+ color: var(--c-info-dark);
106
+ }
107
+ }
108
+
109
+ .STooltip-content {
110
+ white-space: nowrap;
111
+ }
112
+ </style>