@saasmakers/ui 1.4.21 → 1.4.23
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.
- package/app/components/bases/BaseDivider.stories.ts +14 -0
- package/app/components/bases/BaseDivider.vue +119 -9
- package/app/components/bases/BaseHeading.vue +1 -1
- package/app/components/bases/BaseParagraph.vue +1 -1
- package/app/composables/useLayerIcons.ts +2 -0
- package/app/types/bases.d.ts +5 -0
- package/package.json +1 -1
|
@@ -13,7 +13,12 @@ export default {
|
|
|
13
13
|
'solid',
|
|
14
14
|
] satisfies BaseDividerBorderStyle[],
|
|
15
15
|
},
|
|
16
|
+
hideNext: { control: 'boolean' },
|
|
16
17
|
margin: { control: 'number' },
|
|
18
|
+
navigable: { control: 'boolean' },
|
|
19
|
+
navigationLoading: { control: 'boolean' },
|
|
20
|
+
nextLabel: { control: 'text' },
|
|
21
|
+
previousLabel: { control: 'text' },
|
|
17
22
|
size: {
|
|
18
23
|
control: 'select',
|
|
19
24
|
options: ['sm', 'base'] satisfies BaseDividerSize[],
|
|
@@ -23,3 +28,12 @@ export default {
|
|
|
23
28
|
} satisfies Meta<typeof BaseDivider>
|
|
24
29
|
|
|
25
30
|
export const Default: StoryObj<typeof BaseDivider> = { args: { title: 'Divider Title' } satisfies Partial<BaseDivider> }
|
|
31
|
+
|
|
32
|
+
export const Navigable: StoryObj<typeof BaseDivider> = {
|
|
33
|
+
args: {
|
|
34
|
+
navigable: true,
|
|
35
|
+
nextLabel: 'Next',
|
|
36
|
+
previousLabel: 'Previous',
|
|
37
|
+
title: 'This week',
|
|
38
|
+
} satisfies Partial<BaseDivider>,
|
|
39
|
+
}
|
|
@@ -1,21 +1,55 @@
|
|
|
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,
|
|
6
7
|
margin: 6,
|
|
8
|
+
navigable: false,
|
|
9
|
+
navigationLoading: false,
|
|
10
|
+
nextLabel: '',
|
|
11
|
+
previousLabel: '',
|
|
7
12
|
size: 'base',
|
|
8
13
|
title: '',
|
|
9
14
|
})
|
|
15
|
+
|
|
16
|
+
const emit = defineEmits<{
|
|
17
|
+
navigateNext: []
|
|
18
|
+
navigatePrevious: []
|
|
19
|
+
}>()
|
|
20
|
+
|
|
21
|
+
const { t } = useI18n()
|
|
22
|
+
const { getIcon } = useLayerIcons()
|
|
23
|
+
|
|
24
|
+
const displayTitle = computed(() => {
|
|
25
|
+
if (props.navigationLoading) {
|
|
26
|
+
return t('loading')
|
|
27
|
+
}
|
|
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
|
+
}
|
|
10
47
|
</script>
|
|
11
48
|
|
|
12
49
|
<template>
|
|
13
50
|
<div
|
|
14
|
-
class="relative block
|
|
51
|
+
class="relative block text-center"
|
|
15
52
|
:class="{
|
|
16
|
-
'border-dashed': borderStyle === 'dashed',
|
|
17
|
-
'border-dotted': borderStyle === 'dotted',
|
|
18
|
-
'border-solid': borderStyle === 'solid',
|
|
19
53
|
'my-3': margin === 3,
|
|
20
54
|
'my-4': margin === 4,
|
|
21
55
|
'my-5': margin === 5,
|
|
@@ -29,13 +63,89 @@ withDefaults(defineProps<BaseDivider>(), {
|
|
|
29
63
|
'mx-auto max-w-xs': size === 'sm',
|
|
30
64
|
'w-full': size === 'base',
|
|
31
65
|
}"
|
|
32
|
-
style="height: 1px"
|
|
33
66
|
>
|
|
67
|
+
<div
|
|
68
|
+
class="border-t border-gray-300 dark:border-gray-700"
|
|
69
|
+
:class="{
|
|
70
|
+
'border-dashed': borderStyle === 'dashed',
|
|
71
|
+
'border-dotted': borderStyle === 'dotted',
|
|
72
|
+
'border-solid': borderStyle === 'solid',
|
|
73
|
+
}"
|
|
74
|
+
style="height: 1px"
|
|
75
|
+
/>
|
|
76
|
+
|
|
34
77
|
<BaseText
|
|
35
|
-
v-if="
|
|
36
|
-
class="absolute inline-block transform whitespace-nowrap bg-gray-100 px-4 text-center
|
|
78
|
+
v-if="displayTitle"
|
|
79
|
+
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
80
|
size="sm"
|
|
38
|
-
:text="
|
|
81
|
+
:text="displayTitle"
|
|
82
|
+
/>
|
|
83
|
+
|
|
84
|
+
<BaseIcon
|
|
85
|
+
v-if="navigable && !navigationLoading"
|
|
86
|
+
class="absolute left-0 -mt-3"
|
|
87
|
+
clickable
|
|
88
|
+
:icon="getIcon('chevronLeft')"
|
|
89
|
+
size="2xs"
|
|
90
|
+
:text="previousLabel"
|
|
91
|
+
:uppercase="false"
|
|
92
|
+
@click="onNavigatePrevious()"
|
|
93
|
+
/>
|
|
94
|
+
|
|
95
|
+
<BaseIcon
|
|
96
|
+
v-if="navigable && !navigationLoading && !hideNext"
|
|
97
|
+
class="absolute right-0 -mt-3"
|
|
98
|
+
clickable
|
|
99
|
+
reverse
|
|
100
|
+
:icon="getIcon('chevronRight')"
|
|
101
|
+
size="2xs"
|
|
102
|
+
:text="nextLabel"
|
|
103
|
+
:uppercase="false"
|
|
104
|
+
@click="onNavigateNext()"
|
|
39
105
|
/>
|
|
40
106
|
</div>
|
|
41
107
|
</template>
|
|
108
|
+
|
|
109
|
+
<i18n lang="json">
|
|
110
|
+
{
|
|
111
|
+
"de": {
|
|
112
|
+
"loading": "Laden…"
|
|
113
|
+
},
|
|
114
|
+
"en": {
|
|
115
|
+
"loading": "Loading…"
|
|
116
|
+
},
|
|
117
|
+
"es": {
|
|
118
|
+
"loading": "Cargando…"
|
|
119
|
+
},
|
|
120
|
+
"fr": {
|
|
121
|
+
"loading": "Chargement…"
|
|
122
|
+
},
|
|
123
|
+
"it": {
|
|
124
|
+
"loading": "Caricamento…"
|
|
125
|
+
},
|
|
126
|
+
"ja": {
|
|
127
|
+
"loading": "読み込み中…"
|
|
128
|
+
},
|
|
129
|
+
"ko": {
|
|
130
|
+
"loading": "로딩 중…"
|
|
131
|
+
},
|
|
132
|
+
"nl": {
|
|
133
|
+
"loading": "Laden…"
|
|
134
|
+
},
|
|
135
|
+
"pl": {
|
|
136
|
+
"loading": "Ładowanie…"
|
|
137
|
+
},
|
|
138
|
+
"pt": {
|
|
139
|
+
"loading": "A carregar…"
|
|
140
|
+
},
|
|
141
|
+
"pt-BR": {
|
|
142
|
+
"loading": "Carregando…"
|
|
143
|
+
},
|
|
144
|
+
"id": {
|
|
145
|
+
"loading": "Memuat…"
|
|
146
|
+
},
|
|
147
|
+
"vi": {
|
|
148
|
+
"loading": "Đang tải…"
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
</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,7 +107,12 @@ export type BaseColor
|
|
|
107
107
|
|
|
108
108
|
export interface BaseDivider {
|
|
109
109
|
borderStyle?: BaseDividerBorderStyle
|
|
110
|
+
hideNext?: boolean
|
|
110
111
|
margin?: number
|
|
112
|
+
navigable?: boolean
|
|
113
|
+
navigationLoading?: boolean
|
|
114
|
+
nextLabel?: string
|
|
115
|
+
previousLabel?: string
|
|
111
116
|
size?: BaseDividerSize
|
|
112
117
|
title?: string
|
|
113
118
|
}
|