@saasmakers/ui 1.4.23 → 1.4.25

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
- navigationLoading: { control: 'boolean' },
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,
8
+ loading: false,
7
9
  margin: 6,
8
10
  navigable: false,
9
- navigationLoading: false,
10
- nextLabel: '',
11
- previousLabel: '',
12
11
  size: 'base',
13
12
  title: '',
14
13
  })
15
14
 
16
15
  const emit = defineEmits<{
17
- navigateNext: []
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
- const displayTitle = computed(() => {
25
- if (props.navigationLoading) {
26
- return t('loading')
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
 
@@ -65,87 +45,130 @@ function onNavigateNext() {
65
45
  }"
66
46
  >
67
47
  <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
- />
48
+ class="flex items-center"
49
+ :class="{ 'gap-2': navigable }"
50
+ >
51
+ <BaseIcon
52
+ v-if="navigable && !loading && !hidePrevious"
53
+ class="shrink-0 hover:!no-underline"
54
+ clickable
55
+ :icon="getIcon('chevronLeft')"
56
+ size="sm"
57
+ :text="t('previous')"
58
+ :uppercase="false"
59
+ @click="onNavigate($event, 'previous')"
60
+ />
61
+
62
+ <div class="min-w-0 flex flex-1 items-center">
63
+ <div
64
+ class="flex-1 border-t border-gray-300 dark:border-gray-700"
65
+ :class="{
66
+ 'border-dashed': borderStyle === 'dashed',
67
+ 'border-dotted': borderStyle === 'dotted',
68
+ 'border-solid': borderStyle === 'solid',
69
+ }"
70
+ style="height: 1px"
71
+ />
76
72
 
77
- <BaseText
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"
80
- size="sm"
81
- :text="displayTitle"
82
- />
73
+ <BaseText
74
+ v-if="loading || title"
75
+ class="shrink-0 px-4 text-center"
76
+ size="sm"
77
+ :text="loading ? t('loading') : title"
78
+ />
83
79
 
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
- />
80
+ <div
81
+ class="flex-1 border-t border-gray-300 dark:border-gray-700"
82
+ :class="{
83
+ 'border-dashed': borderStyle === 'dashed',
84
+ 'border-dotted': borderStyle === 'dotted',
85
+ 'border-solid': borderStyle === 'solid',
86
+ }"
87
+ style="height: 1px"
88
+ />
89
+ </div>
94
90
 
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()"
105
- />
91
+ <BaseIcon
92
+ v-if="navigable && !loading && !hideNext"
93
+ class="shrink-0 hover:!no-underline"
94
+ clickable
95
+ reverse
96
+ :icon="getIcon('chevronRight')"
97
+ size="sm"
98
+ :text="t('next')"
99
+ :uppercase="false"
100
+ @click="onNavigate($event, 'next')"
101
+ />
102
+ </div>
106
103
  </div>
107
104
  </template>
108
105
 
109
106
  <i18n lang="json">
110
107
  {
111
108
  "de": {
112
- "loading": "Laden…"
109
+ "loading": "Laden…",
110
+ "next": "Weiter",
111
+ "previous": "Zurück"
113
112
  },
114
113
  "en": {
115
- "loading": "Loading…"
114
+ "loading": "Loading…",
115
+ "next": "Next",
116
+ "previous": "Previous"
116
117
  },
117
118
  "es": {
118
- "loading": "Cargando…"
119
+ "loading": "Cargando…",
120
+ "next": "Siguiente",
121
+ "previous": "Anterior"
119
122
  },
120
123
  "fr": {
121
- "loading": "Chargement…"
124
+ "loading": "Chargement…",
125
+ "next": "Suivant",
126
+ "previous": "Précédent"
122
127
  },
123
128
  "it": {
124
- "loading": "Caricamento…"
129
+ "loading": "Caricamento…",
130
+ "next": "Successivo",
131
+ "previous": "Precedente"
125
132
  },
126
133
  "ja": {
127
- "loading": "読み込み中…"
134
+ "loading": "読み込み中…",
135
+ "next": "次へ",
136
+ "previous": "前へ"
128
137
  },
129
138
  "ko": {
130
- "loading": "로딩 중…"
139
+ "loading": "로딩 중…",
140
+ "next": "다음",
141
+ "previous": "이전"
131
142
  },
132
143
  "nl": {
133
- "loading": "Laden…"
144
+ "loading": "Laden…",
145
+ "next": "Volgende",
146
+ "previous": "Vorige"
134
147
  },
135
148
  "pl": {
136
- "loading": "Ładowanie…"
149
+ "loading": "Ładowanie…",
150
+ "next": "Następny",
151
+ "previous": "Poprzedni"
137
152
  },
138
153
  "pt": {
139
- "loading": "A carregar…"
154
+ "loading": "A carregar…",
155
+ "next": "Seguinte",
156
+ "previous": "Anterior"
140
157
  },
141
158
  "pt-BR": {
142
- "loading": "Carregando…"
159
+ "loading": "Carregando…",
160
+ "next": "Próximo",
161
+ "previous": "Anterior"
143
162
  },
144
163
  "id": {
145
- "loading": "Memuat…"
164
+ "loading": "Memuat…",
165
+ "next": "Berikutnya",
166
+ "previous": "Sebelumnya"
146
167
  },
147
168
  "vi": {
148
- "loading": "Đang tải…"
169
+ "loading": "Đang tải…",
170
+ "next": "Sau",
171
+ "previous": "Trước"
149
172
  }
150
173
  }
151
174
  </i18n>
@@ -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
- navigationLoading?: boolean
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 {
@@ -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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
- "version": "1.4.23",
3
+ "version": "1.4.25",
4
4
  "private": false,
5
5
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
6
6
  "license": "MIT",