@saasmakers/ui 1.5.0 → 1.5.2
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 +25 -3
- package/app/components/bases/BaseProgress.vue +50 -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 +7 -0
- package/app/types/global.d.ts +1 -0
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ import type { BaseDivider } from '../../types/bases'
|
|
|
3
3
|
|
|
4
4
|
const props = withDefaults(defineProps<BaseDivider>(), {
|
|
5
5
|
borderStyle: 'solid',
|
|
6
|
+
color: 'black',
|
|
6
7
|
hideNext: false,
|
|
7
8
|
hidePrevious: false,
|
|
8
9
|
loading: false,
|
|
@@ -67,8 +68,14 @@ function onNavigate(event: MouseEvent, direction: BaseDividerNavigateDirection)
|
|
|
67
68
|
:class="{
|
|
68
69
|
'border-dashed': borderStyle === 'dashed',
|
|
69
70
|
'border-dotted': borderStyle === 'dotted',
|
|
70
|
-
'border-gray-900 dark:border-gray-300': pill,
|
|
71
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',
|
|
72
79
|
}"
|
|
73
80
|
style="height: 1px"
|
|
74
81
|
/>
|
|
@@ -76,7 +83,16 @@ function onNavigate(event: MouseEvent, direction: BaseDividerNavigateDirection)
|
|
|
76
83
|
|
|
77
84
|
<span
|
|
78
85
|
v-if="pill && title && !loading"
|
|
79
|
-
class="mx-3 rounded-full
|
|
86
|
+
class="mx-3 rounded-full px-3 py-1 text-xs font-medium tracking-wide"
|
|
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
|
+
}"
|
|
80
96
|
>{{ title }}</span>
|
|
81
97
|
|
|
82
98
|
<BaseText
|
|
@@ -92,8 +108,14 @@ function onNavigate(event: MouseEvent, direction: BaseDividerNavigateDirection)
|
|
|
92
108
|
:class="{
|
|
93
109
|
'border-dashed': borderStyle === 'dashed',
|
|
94
110
|
'border-dotted': borderStyle === 'dotted',
|
|
95
|
-
'border-gray-900 dark:border-gray-300': pill,
|
|
96
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',
|
|
97
119
|
}"
|
|
98
120
|
style="height: 1px"
|
|
99
121
|
/>
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
value: 0,
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
const percent = computed(() => {
|
|
11
|
+
if (props.max <= 0) {
|
|
12
|
+
return 0
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
return Math.min(100, Math.max(0, (props.value / props.max) * 100))
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
const label = computed(() => {
|
|
19
|
+
if (props.max === 100) {
|
|
20
|
+
return `${Math.round(percent.value)} %`
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return `${props.value}/${props.max}`
|
|
24
|
+
})
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<template>
|
|
28
|
+
<div class="w-full flex items-center gap-2">
|
|
29
|
+
<div
|
|
30
|
+
role="progressbar"
|
|
31
|
+
class="h-1 min-w-0 flex-1 overflow-hidden rounded-full bg-gray-200 dark:bg-gray-800"
|
|
32
|
+
:aria-label="label"
|
|
33
|
+
:aria-valuemax="max"
|
|
34
|
+
:aria-valuemin="0"
|
|
35
|
+
:aria-valuenow="value"
|
|
36
|
+
>
|
|
37
|
+
<div
|
|
38
|
+
class="h-full rounded-full bg-indigo-700 transition-[width] duration-300 dark:bg-indigo-300"
|
|
39
|
+
:style="{ width: `${percent}%` }"
|
|
40
|
+
/>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<BaseText
|
|
44
|
+
v-if="showLabel"
|
|
45
|
+
class="shrink-0 text-indigo-700 dark:text-indigo-300"
|
|
46
|
+
size="2xs"
|
|
47
|
+
:text="label"
|
|
48
|
+
/>
|
|
49
|
+
</div>
|
|
50
|
+
</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
|
@@ -131,6 +131,7 @@ export type BaseColor
|
|
|
131
131
|
|
|
132
132
|
export interface BaseDivider {
|
|
133
133
|
borderStyle?: BaseDividerBorderStyle
|
|
134
|
+
color?: BaseColor
|
|
134
135
|
hideNext?: boolean
|
|
135
136
|
hidePrevious?: boolean
|
|
136
137
|
loading?: boolean
|
|
@@ -280,6 +281,12 @@ export type BasePowerPower
|
|
|
280
281
|
|
|
281
282
|
export type BasePowerSize = 'base' | 'lg' | 'sm' | 'xs'
|
|
282
283
|
|
|
284
|
+
export interface BaseProgress {
|
|
285
|
+
max?: number
|
|
286
|
+
showLabel?: boolean
|
|
287
|
+
value?: number
|
|
288
|
+
}
|
|
289
|
+
|
|
283
290
|
export interface BaseQuote {
|
|
284
291
|
background?: BaseQuoteBackground
|
|
285
292
|
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
|