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