@saasmakers/ui 1.5.1 → 1.5.3
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.vue +33 -44
- package/app/components/bases/BaseProgress.vue +55 -0
- package/app/components/fields/FieldAvatar.vue +1 -1
- package/app/components/fields/FieldInput.vue +1 -1
- package/app/components/fields/FieldTextarea.vue +1 -1
- package/app/types/bases.d.ts +9 -1
- package/app/types/global.d.ts +1 -0
- package/package.json +1 -1
|
@@ -6,7 +6,6 @@ const props = withDefaults(defineProps<BaseDivider>(), {
|
|
|
6
6
|
color: 'black',
|
|
7
7
|
hideNext: false,
|
|
8
8
|
hidePrevious: false,
|
|
9
|
-
light: false,
|
|
10
9
|
loading: false,
|
|
11
10
|
navigable: false,
|
|
12
11
|
pill: false,
|
|
@@ -14,34 +13,6 @@ const props = withDefaults(defineProps<BaseDivider>(), {
|
|
|
14
13
|
title: '',
|
|
15
14
|
})
|
|
16
15
|
|
|
17
|
-
const pillLineBorderClasses = computed(() => {
|
|
18
|
-
if (!props.pill) {
|
|
19
|
-
return 'border-gray-300 dark:border-gray-700'
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
if (props.color === 'indigo' && !props.light) {
|
|
23
|
-
return 'border-indigo-700 dark:border-indigo-300'
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
if (props.color === 'gray' && props.light) {
|
|
27
|
-
return 'border-gray-300 dark:border-gray-700'
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return 'border-gray-900 dark:border-gray-300'
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
const pillClasses = computed(() => {
|
|
34
|
-
if (props.color === 'indigo' && !props.light) {
|
|
35
|
-
return 'bg-indigo-800 dark:bg-indigo-200 text-white dark:text-black'
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
if (props.color === 'gray' && props.light) {
|
|
39
|
-
return 'bg-gray-100 dark:bg-gray-900 text-gray-600 dark:text-gray-400'
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return 'bg-gray-900 text-white dark:bg-gray-100 dark:text-gray-900'
|
|
43
|
-
})
|
|
44
|
-
|
|
45
16
|
const emit = defineEmits<{
|
|
46
17
|
navigate: [event: MouseEvent, direction: BaseDividerNavigateDirection]
|
|
47
18
|
}>()
|
|
@@ -94,13 +65,18 @@ function onNavigate(event: MouseEvent, direction: BaseDividerNavigateDirection)
|
|
|
94
65
|
|
|
95
66
|
<div
|
|
96
67
|
class="flex-1 border-t"
|
|
97
|
-
:class="
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
68
|
+
:class="{
|
|
69
|
+
'border-dashed': borderStyle === 'dashed',
|
|
70
|
+
'border-dotted': borderStyle === 'dotted',
|
|
71
|
+
'border-gray-300 dark:border-gray-700': !pill,
|
|
72
|
+
'border-gray-900 dark:border-gray-100': pill && color === 'black',
|
|
73
|
+
'border-gray-700 dark:border-gray-300': pill && color === 'gray',
|
|
74
|
+
'border-green-700 dark:border-green-300': pill && color === 'green',
|
|
75
|
+
'border-indigo-700 dark:border-indigo-300': pill && color === 'indigo',
|
|
76
|
+
'border-orange-700 dark:border-orange-300': pill && color === 'orange',
|
|
77
|
+
'border-red-700 dark:border-red-300': pill && color === 'red',
|
|
78
|
+
'border-white dark:border-gray-900': pill && color === 'white',
|
|
79
|
+
}"
|
|
104
80
|
style="height: 1px"
|
|
105
81
|
/>
|
|
106
82
|
</div>
|
|
@@ -108,7 +84,15 @@ function onNavigate(event: MouseEvent, direction: BaseDividerNavigateDirection)
|
|
|
108
84
|
<span
|
|
109
85
|
v-if="pill && title && !loading"
|
|
110
86
|
class="mx-3 rounded-full px-3 py-1 text-xs font-medium tracking-wide"
|
|
111
|
-
:class="
|
|
87
|
+
:class="{
|
|
88
|
+
'bg-gray-900 text-white dark:bg-gray-100 dark:text-gray-900': color === 'black',
|
|
89
|
+
'bg-gray-700 text-white dark:bg-gray-300 dark:text-gray-800': color === 'gray',
|
|
90
|
+
'bg-green-700 text-white dark:bg-green-300 dark:text-black': color === 'green',
|
|
91
|
+
'bg-indigo-700 text-white dark:bg-indigo-300 dark:text-black': color === 'indigo',
|
|
92
|
+
'bg-orange-700 text-white dark:bg-orange-300 dark:text-black': color === 'orange',
|
|
93
|
+
'bg-red-700 text-white dark:bg-red-300 dark:text-black': color === 'red',
|
|
94
|
+
'bg-white text-gray-900 dark:bg-gray-900 dark:text-gray-100': color === 'white',
|
|
95
|
+
}"
|
|
112
96
|
>{{ title }}</span>
|
|
113
97
|
|
|
114
98
|
<BaseText
|
|
@@ -121,13 +105,18 @@ function onNavigate(event: MouseEvent, direction: BaseDividerNavigateDirection)
|
|
|
121
105
|
<div class="flex items-center">
|
|
122
106
|
<div
|
|
123
107
|
class="flex-1 border-t"
|
|
124
|
-
:class="
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
108
|
+
:class="{
|
|
109
|
+
'border-dashed': borderStyle === 'dashed',
|
|
110
|
+
'border-dotted': borderStyle === 'dotted',
|
|
111
|
+
'border-gray-300 dark:border-gray-700': !pill,
|
|
112
|
+
'border-gray-900 dark:border-gray-100': pill && color === 'black',
|
|
113
|
+
'border-gray-700 dark:border-gray-300': pill && color === 'gray',
|
|
114
|
+
'border-green-700 dark:border-green-300': pill && color === 'green',
|
|
115
|
+
'border-indigo-700 dark:border-indigo-300': pill && color === 'indigo',
|
|
116
|
+
'border-orange-700 dark:border-orange-300': pill && color === 'orange',
|
|
117
|
+
'border-red-700 dark:border-red-300': pill && color === 'red',
|
|
118
|
+
'border-white dark:border-gray-900': pill && color === 'white',
|
|
119
|
+
}"
|
|
131
120
|
style="height: 1px"
|
|
132
121
|
/>
|
|
133
122
|
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import type { BaseProgress } from '../../types/bases'
|
|
3
|
+
|
|
4
|
+
const props = withDefaults(defineProps<BaseProgress>(), {
|
|
5
|
+
max: 100,
|
|
6
|
+
showLabel: false,
|
|
7
|
+
size: 'base',
|
|
8
|
+
value: 0,
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
const percent = computed(() => {
|
|
12
|
+
if (props.max <= 0) {
|
|
13
|
+
return 0
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return Math.min(100, Math.max(0, (props.value / props.max) * 100))
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
const label = computed(() => {
|
|
20
|
+
if (props.max === 100) {
|
|
21
|
+
return `${Math.round(percent.value)} %`
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return `${props.value} / ${props.max}`
|
|
25
|
+
})
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<div
|
|
30
|
+
class="flex items-center"
|
|
31
|
+
:class="size === 'base' ? 'gap-2.5' : 'gap-2'"
|
|
32
|
+
>
|
|
33
|
+
<div
|
|
34
|
+
role="progressbar"
|
|
35
|
+
class="min-w-0 flex-1 overflow-hidden rounded-full bg-gray-200 dark:bg-gray-800"
|
|
36
|
+
:class="size === 'base' ? 'h-1.5' : 'h-1'"
|
|
37
|
+
:aria-label="label"
|
|
38
|
+
:aria-valuemax="max"
|
|
39
|
+
:aria-valuemin="0"
|
|
40
|
+
:aria-valuenow="value"
|
|
41
|
+
>
|
|
42
|
+
<div
|
|
43
|
+
class="h-full rounded-full bg-indigo-700 transition-[width] duration-300 dark:bg-indigo-300"
|
|
44
|
+
:style="{ width: `${percent}%` }"
|
|
45
|
+
/>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
<BaseText
|
|
49
|
+
v-if="showLabel"
|
|
50
|
+
class="shrink-0 text-indigo-700 dark:text-indigo-300"
|
|
51
|
+
:size="size === 'base' ? 'xs' : '2xs'"
|
|
52
|
+
:text="label"
|
|
53
|
+
/>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
@@ -75,7 +75,7 @@ function onOpenFilePicker() {
|
|
|
75
75
|
|
|
76
76
|
<div
|
|
77
77
|
:aria-label="loading ? t('actionLoading') : (typeof action === 'string' ? action : (action?.base || t('action')))"
|
|
78
|
-
class="w-full flex items-center gap-2 px-3
|
|
78
|
+
class="w-full flex items-center gap-2 px-3 uppercase outline-none"
|
|
79
79
|
:class="{
|
|
80
80
|
'cursor-pointer': !disabled && !loading,
|
|
81
81
|
'field-disabled': disabled,
|
|
@@ -178,7 +178,7 @@ defineExpose({ focus })
|
|
|
178
178
|
:id="id"
|
|
179
179
|
ref="input"
|
|
180
180
|
:autocomplete="autocomplete ? 'on' : 'off'"
|
|
181
|
-
class="h-full w-full appearance-none items-center rounded-lg font-medium tracking-tight
|
|
181
|
+
class="h-full w-full appearance-none items-center rounded-lg font-medium tracking-tight uppercase outline-none placeholder-gray-600 dark:placeholder-gray-400"
|
|
182
182
|
:class="{
|
|
183
183
|
'field-disabled': disabled,
|
|
184
184
|
'focus:placeholder-gray-900 hover:placeholder-gray-900 dark:focus:placeholder-gray-100 dark:hover:placeholder-gray-100': !disabled,
|
|
@@ -67,7 +67,7 @@ function onFieldClick(event: MouseEvent) {
|
|
|
67
67
|
ref="textarea"
|
|
68
68
|
v-model="modelValue"
|
|
69
69
|
v-bind="{ 'data-enable-grammarly': 'false' }"
|
|
70
|
-
class="w-full flex-1 appearance-none rounded-lg text-gray-900 font-medium tracking-tight
|
|
70
|
+
class="w-full flex-1 appearance-none rounded-lg text-gray-900 font-medium tracking-tight uppercase outline-none dark:text-gray-100 placeholder-gray-600 dark:placeholder-gray-400"
|
|
71
71
|
:class="{
|
|
72
72
|
'field-disabled': disabled,
|
|
73
73
|
'focus:placeholder-gray-900 hover:placeholder-gray-900 dark:focus:placeholder-gray-100 dark:hover:placeholder-gray-100': !disabled,
|
package/app/types/bases.d.ts
CHANGED
|
@@ -134,7 +134,6 @@ export interface BaseDivider {
|
|
|
134
134
|
color?: BaseColor
|
|
135
135
|
hideNext?: boolean
|
|
136
136
|
hidePrevious?: boolean
|
|
137
|
-
light?: boolean
|
|
138
137
|
loading?: boolean
|
|
139
138
|
navigable?: boolean
|
|
140
139
|
pill?: boolean
|
|
@@ -282,6 +281,15 @@ export type BasePowerPower
|
|
|
282
281
|
|
|
283
282
|
export type BasePowerSize = 'base' | 'lg' | 'sm' | 'xs'
|
|
284
283
|
|
|
284
|
+
export interface BaseProgress {
|
|
285
|
+
max?: number
|
|
286
|
+
showLabel?: boolean
|
|
287
|
+
size?: BaseProgressSize
|
|
288
|
+
value?: number
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
export type BaseProgressSize = 'base' | 'sm'
|
|
292
|
+
|
|
285
293
|
export interface BaseQuote {
|
|
286
294
|
background?: BaseQuoteBackground
|
|
287
295
|
character?: BaseCharacterCharacter
|
package/app/types/global.d.ts
CHANGED
|
@@ -45,6 +45,7 @@ declare global {
|
|
|
45
45
|
type BasePower = import('./bases').BasePower
|
|
46
46
|
type BasePowerPower = import('./bases').BasePowerPower
|
|
47
47
|
type BasePowerSize = import('./bases').BasePowerSize
|
|
48
|
+
type BaseProgress = import('./bases').BaseProgress
|
|
48
49
|
type BaseQuote = import('./bases').BaseQuote
|
|
49
50
|
type BaseQuoteBackground = import('./bases').BaseQuoteBackground
|
|
50
51
|
type BaseQuoteSize = import('./bases').BaseQuoteSize
|