@saasmakers/ui 1.4.22 → 1.4.24
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.
|
@@ -13,7 +13,11 @@ export default {
|
|
|
13
13
|
'solid',
|
|
14
14
|
] satisfies BaseDividerBorderStyle[],
|
|
15
15
|
},
|
|
16
|
+
hideNext: { control: 'boolean' },
|
|
17
|
+
hidePrevious: { control: 'boolean' },
|
|
16
18
|
margin: { control: 'number' },
|
|
19
|
+
navigable: { control: 'boolean' },
|
|
20
|
+
loading: { control: 'boolean' },
|
|
17
21
|
size: {
|
|
18
22
|
control: 'select',
|
|
19
23
|
options: ['sm', 'base'] satisfies BaseDividerSize[],
|
|
@@ -23,3 +27,10 @@ export default {
|
|
|
23
27
|
} satisfies Meta<typeof BaseDivider>
|
|
24
28
|
|
|
25
29
|
export const Default: StoryObj<typeof BaseDivider> = { args: { title: 'Divider Title' } satisfies Partial<BaseDivider> }
|
|
30
|
+
|
|
31
|
+
export const Navigable: StoryObj<typeof BaseDivider> = {
|
|
32
|
+
args: {
|
|
33
|
+
navigable: true,
|
|
34
|
+
title: 'This week',
|
|
35
|
+
} satisfies Partial<BaseDivider>,
|
|
36
|
+
}
|
|
@@ -1,21 +1,35 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import type { BaseDivider } from '../../types/bases'
|
|
3
3
|
|
|
4
|
-
withDefaults(defineProps<BaseDivider>(), {
|
|
4
|
+
const props = withDefaults(defineProps<BaseDivider>(), {
|
|
5
5
|
borderStyle: 'solid',
|
|
6
|
+
hideNext: false,
|
|
7
|
+
hidePrevious: false,
|
|
6
8
|
margin: 6,
|
|
9
|
+
navigable: false,
|
|
10
|
+
loading: false,
|
|
7
11
|
size: 'base',
|
|
8
12
|
title: '',
|
|
9
13
|
})
|
|
14
|
+
|
|
15
|
+
const emit = defineEmits<{
|
|
16
|
+
navigate: [event: MouseEvent, direction: BaseDividerNavigateDirection]
|
|
17
|
+
}>()
|
|
18
|
+
|
|
19
|
+
const { t } = useI18n()
|
|
20
|
+
const { getIcon } = useLayerIcons()
|
|
21
|
+
|
|
22
|
+
function onNavigate(event: MouseEvent, direction: BaseDividerNavigateDirection) {
|
|
23
|
+
if (!props.loading) {
|
|
24
|
+
emit('navigate', event, direction)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
10
27
|
</script>
|
|
11
28
|
|
|
12
29
|
<template>
|
|
13
30
|
<div
|
|
14
|
-
class="relative block
|
|
31
|
+
class="relative block text-center"
|
|
15
32
|
:class="{
|
|
16
|
-
'border-dashed': borderStyle === 'dashed',
|
|
17
|
-
'border-dotted': borderStyle === 'dotted',
|
|
18
|
-
'border-solid': borderStyle === 'solid',
|
|
19
33
|
'my-3': margin === 3,
|
|
20
34
|
'my-4': margin === 4,
|
|
21
35
|
'my-5': margin === 5,
|
|
@@ -29,13 +43,115 @@ withDefaults(defineProps<BaseDivider>(), {
|
|
|
29
43
|
'mx-auto max-w-xs': size === 'sm',
|
|
30
44
|
'w-full': size === 'base',
|
|
31
45
|
}"
|
|
32
|
-
style="height: 1px"
|
|
33
46
|
>
|
|
47
|
+
<div
|
|
48
|
+
class="border-t border-gray-300 dark:border-gray-700"
|
|
49
|
+
:class="{
|
|
50
|
+
'border-dashed': borderStyle === 'dashed',
|
|
51
|
+
'border-dotted': borderStyle === 'dotted',
|
|
52
|
+
'border-solid': borderStyle === 'solid',
|
|
53
|
+
}"
|
|
54
|
+
style="height: 1px"
|
|
55
|
+
/>
|
|
56
|
+
|
|
34
57
|
<BaseText
|
|
35
|
-
v-if="title"
|
|
36
|
-
class="absolute inline-block transform whitespace-nowrap bg-gray-100 px-4 text-center
|
|
58
|
+
v-if="loading || title"
|
|
59
|
+
class="absolute left-1/2 inline-block -mt-3 -translate-x-1/2 transform whitespace-nowrap bg-gray-100 px-4 text-center dark:bg-gray-900"
|
|
37
60
|
size="sm"
|
|
38
|
-
:text="title"
|
|
61
|
+
:text="loading ? t('loading') : title"
|
|
62
|
+
/>
|
|
63
|
+
|
|
64
|
+
<BaseIcon
|
|
65
|
+
v-if="navigable && !loading && !hidePrevious"
|
|
66
|
+
class="absolute left-0 -mt-3"
|
|
67
|
+
clickable
|
|
68
|
+
:icon="getIcon('chevronLeft')"
|
|
69
|
+
size="2xs"
|
|
70
|
+
:text="t('previous')"
|
|
71
|
+
:uppercase="false"
|
|
72
|
+
@click="onNavigate($event, 'previous')"
|
|
73
|
+
/>
|
|
74
|
+
|
|
75
|
+
<BaseIcon
|
|
76
|
+
v-if="navigable && !loading && !hideNext"
|
|
77
|
+
class="absolute right-0 -mt-3"
|
|
78
|
+
clickable
|
|
79
|
+
reverse
|
|
80
|
+
:icon="getIcon('chevronRight')"
|
|
81
|
+
size="2xs"
|
|
82
|
+
:text="t('next')"
|
|
83
|
+
:uppercase="false"
|
|
84
|
+
@click="onNavigate($event, 'next')"
|
|
39
85
|
/>
|
|
40
86
|
</div>
|
|
41
87
|
</template>
|
|
88
|
+
|
|
89
|
+
<i18n lang="json">
|
|
90
|
+
{
|
|
91
|
+
"de": {
|
|
92
|
+
"loading": "Laden…",
|
|
93
|
+
"next": "Weiter",
|
|
94
|
+
"previous": "Zurück"
|
|
95
|
+
},
|
|
96
|
+
"en": {
|
|
97
|
+
"loading": "Loading…",
|
|
98
|
+
"next": "Next",
|
|
99
|
+
"previous": "Previous"
|
|
100
|
+
},
|
|
101
|
+
"es": {
|
|
102
|
+
"loading": "Cargando…",
|
|
103
|
+
"next": "Siguiente",
|
|
104
|
+
"previous": "Anterior"
|
|
105
|
+
},
|
|
106
|
+
"fr": {
|
|
107
|
+
"loading": "Chargement…",
|
|
108
|
+
"next": "Suivant",
|
|
109
|
+
"previous": "Précédent"
|
|
110
|
+
},
|
|
111
|
+
"it": {
|
|
112
|
+
"loading": "Caricamento…",
|
|
113
|
+
"next": "Successivo",
|
|
114
|
+
"previous": "Precedente"
|
|
115
|
+
},
|
|
116
|
+
"ja": {
|
|
117
|
+
"loading": "読み込み中…",
|
|
118
|
+
"next": "次へ",
|
|
119
|
+
"previous": "前へ"
|
|
120
|
+
},
|
|
121
|
+
"ko": {
|
|
122
|
+
"loading": "로딩 중…",
|
|
123
|
+
"next": "다음",
|
|
124
|
+
"previous": "이전"
|
|
125
|
+
},
|
|
126
|
+
"nl": {
|
|
127
|
+
"loading": "Laden…",
|
|
128
|
+
"next": "Volgende",
|
|
129
|
+
"previous": "Vorige"
|
|
130
|
+
},
|
|
131
|
+
"pl": {
|
|
132
|
+
"loading": "Ładowanie…",
|
|
133
|
+
"next": "Następny",
|
|
134
|
+
"previous": "Poprzedni"
|
|
135
|
+
},
|
|
136
|
+
"pt": {
|
|
137
|
+
"loading": "A carregar…",
|
|
138
|
+
"next": "Seguinte",
|
|
139
|
+
"previous": "Anterior"
|
|
140
|
+
},
|
|
141
|
+
"pt-BR": {
|
|
142
|
+
"loading": "Carregando…",
|
|
143
|
+
"next": "Próximo",
|
|
144
|
+
"previous": "Anterior"
|
|
145
|
+
},
|
|
146
|
+
"id": {
|
|
147
|
+
"loading": "Memuat…",
|
|
148
|
+
"next": "Berikutnya",
|
|
149
|
+
"previous": "Sebelumnya"
|
|
150
|
+
},
|
|
151
|
+
"vi": {
|
|
152
|
+
"loading": "Đang tải…",
|
|
153
|
+
"next": "Sau",
|
|
154
|
+
"previous": "Trước"
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
</i18n>
|
|
@@ -14,6 +14,8 @@ const icons = {
|
|
|
14
14
|
arrowUp: 'solar:alt-arrow-up-bold',
|
|
15
15
|
back: 'hugeicons:arrow-turn-backward',
|
|
16
16
|
checkCircle: 'hugeicons:checkmark-circle-02',
|
|
17
|
+
chevronLeft: 'hugeicons:arrow-left-01',
|
|
18
|
+
chevronRight: 'hugeicons:arrow-right-01',
|
|
17
19
|
clock: 'solar:alarm-linear',
|
|
18
20
|
close: 'hugeicons:cancel-01',
|
|
19
21
|
closeCircle: 'hugeicons:cancel-circle',
|
package/app/types/bases.d.ts
CHANGED
|
@@ -107,13 +107,19 @@ export type BaseColor
|
|
|
107
107
|
|
|
108
108
|
export interface BaseDivider {
|
|
109
109
|
borderStyle?: BaseDividerBorderStyle
|
|
110
|
+
hideNext?: boolean
|
|
111
|
+
hidePrevious?: boolean
|
|
110
112
|
margin?: number
|
|
113
|
+
navigable?: boolean
|
|
114
|
+
loading?: boolean
|
|
111
115
|
size?: BaseDividerSize
|
|
112
116
|
title?: string
|
|
113
117
|
}
|
|
114
118
|
|
|
115
119
|
export type BaseDividerBorderStyle = 'dashed' | 'dotted' | 'solid'
|
|
116
120
|
|
|
121
|
+
export type BaseDividerNavigateDirection = 'next' | 'previous'
|
|
122
|
+
|
|
117
123
|
export type BaseDividerSize = 'base' | 'sm'
|
|
118
124
|
|
|
119
125
|
export interface BaseEmoji {
|
package/app/types/global.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ declare global {
|
|
|
24
24
|
type BaseColor = Bases.BaseColor
|
|
25
25
|
type BaseDivider = Bases.BaseDivider
|
|
26
26
|
type BaseDividerBorderStyle = Bases.BaseDividerBorderStyle
|
|
27
|
+
type BaseDividerNavigateDirection = Bases.BaseDividerNavigateDirection
|
|
27
28
|
type BaseDividerSize = Bases.BaseDividerSize
|
|
28
29
|
type BaseEmoji = Bases.BaseEmoji
|
|
29
30
|
type BaseHeading = Bases.BaseHeading
|