@saasmakers/ui 0.1.116 → 0.2.0
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/BaseHeading.stories.ts +1 -1
- package/app/components/bases/BaseIcon.vue +2 -2
- package/app/components/bases/BaseMetric.vue +1 -1
- package/app/components/bases/BaseParagraph.stories.ts +1 -1
- package/app/components/bases/BaseQuote.stories.ts +1 -1
- package/app/components/bases/BaseTags.vue +1 -1
- package/app/components/fields/FieldEmojis.vue +8 -3
- package/app/components/fields/FieldMessage.vue +2 -0
- package/app/components/fields/FieldSelect.vue +8 -8
- package/app/composables/useChartist.ts +9 -10
- package/app/composables/useDevice.ts +0 -1
- package/app/composables/useLayerUtils.ts +9 -9
- package/app/composables/useToasts.ts +0 -1
- package/app/types/bases.d.ts +32 -29
- package/app/types/fields.d.ts +9 -9
- package/app/types/global.d.ts +4 -1
- package/package.json +5 -10
- package/uno.config.ts +1 -6
|
@@ -48,7 +48,7 @@ const statusIcon = computed<string | undefined>(() => {
|
|
|
48
48
|
return getIcon('exclamationCircle')
|
|
49
49
|
}
|
|
50
50
|
default: {
|
|
51
|
-
return
|
|
51
|
+
return undefined
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
})
|
|
@@ -68,7 +68,7 @@ const statusColor = computed<BaseColor | undefined>(() => {
|
|
|
68
68
|
return 'orange'
|
|
69
69
|
}
|
|
70
70
|
default: {
|
|
71
|
-
return
|
|
71
|
+
return undefined
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
})
|
|
@@ -18,7 +18,8 @@ const searchRaw = ref('')
|
|
|
18
18
|
const searchQuery = refDebounced(searchRaw, 250)
|
|
19
19
|
|
|
20
20
|
const emojisFiltered = computed(() => {
|
|
21
|
-
const
|
|
21
|
+
const searchQueryRaw = searchQuery.value.trim()
|
|
22
|
+
const searchQueryCleaned = normalizeText(searchQueryRaw)
|
|
22
23
|
|
|
23
24
|
if (!searchQueryCleaned) {
|
|
24
25
|
return emojis
|
|
@@ -27,11 +28,15 @@ const emojisFiltered = computed(() => {
|
|
|
27
28
|
return emojis
|
|
28
29
|
.map((category) => {
|
|
29
30
|
const filtered = category.emojis.filter((emoji) => {
|
|
31
|
+
if (emoji.character === searchQueryRaw) {
|
|
32
|
+
return true
|
|
33
|
+
}
|
|
34
|
+
|
|
30
35
|
const localizedKeywords = (emoji.keywords[locale.value] ?? [])
|
|
31
36
|
const englishKeywords = (emoji.keywords.en ?? [])
|
|
32
37
|
const allKeywords = [...localizedKeywords, ...englishKeywords]
|
|
33
38
|
|
|
34
|
-
return allKeywords.some(
|
|
39
|
+
return allKeywords.some(keyword => normalizeText(keyword).includes(searchQueryCleaned))
|
|
35
40
|
})
|
|
36
41
|
|
|
37
42
|
return {
|
|
@@ -39,7 +44,7 @@ const emojisFiltered = computed(() => {
|
|
|
39
44
|
emojis: filtered,
|
|
40
45
|
}
|
|
41
46
|
})
|
|
42
|
-
.filter(
|
|
47
|
+
.filter(category => category.emojis.length > 0)
|
|
43
48
|
})
|
|
44
49
|
|
|
45
50
|
function onEmojiClick(event: MouseEvent, emoji?: string) {
|
|
@@ -36,14 +36,6 @@ const modelValue = defineModel<FieldSelect['modelValue']>({ default: '' })
|
|
|
36
36
|
|
|
37
37
|
const opened = ref(false)
|
|
38
38
|
|
|
39
|
-
const computedColumns = computed(() => {
|
|
40
|
-
if (props.columns.length > 0) {
|
|
41
|
-
return props.columns
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return [{ options: computedOptions.value }]
|
|
45
|
-
})
|
|
46
|
-
|
|
47
39
|
const computedOptions = computed(() => {
|
|
48
40
|
const options: FieldSelectOption[] = []
|
|
49
41
|
|
|
@@ -64,6 +56,14 @@ const computedOptions = computed(() => {
|
|
|
64
56
|
return options
|
|
65
57
|
})
|
|
66
58
|
|
|
59
|
+
const computedColumns = computed(() => {
|
|
60
|
+
if (props.columns.length > 0) {
|
|
61
|
+
return props.columns
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
return [{ options: computedOptions.value }]
|
|
65
|
+
})
|
|
66
|
+
|
|
67
67
|
const selectedOption = computed(() => {
|
|
68
68
|
return computedOptions.value.find((option) => {
|
|
69
69
|
return option.value === modelValue.value
|
|
@@ -11,13 +11,11 @@ export default function useChartist() {
|
|
|
11
11
|
easing?: EasingType
|
|
12
12
|
stagger?: number
|
|
13
13
|
} = {}) => {
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
stagger = 0,
|
|
20
|
-
} = params
|
|
14
|
+
const animateArea = params.animateArea ?? true
|
|
15
|
+
const delay = params.delay ?? 0
|
|
16
|
+
const duration = params.duration ?? 500
|
|
17
|
+
const easing = params.easing ?? easings.easeOutQuart
|
|
18
|
+
const stagger = params.stagger ?? 0
|
|
21
19
|
|
|
22
20
|
return (chart: BaseChart) => {
|
|
23
21
|
chart.on('draw', (ctx: DrawEvent) => {
|
|
@@ -50,7 +48,6 @@ export default function useChartist() {
|
|
|
50
48
|
// Clean up the dash attributes after it finishes
|
|
51
49
|
const total = delay + duration + (stagger ? stagger * (lineCtx.seriesIndex ?? 0) : 0)
|
|
52
50
|
|
|
53
|
-
// eslint-disable-next-line sonarjs/no-nested-functions
|
|
54
51
|
globalThis.setTimeout(() => {
|
|
55
52
|
lineCtx.element.attr({
|
|
56
53
|
'stroke-dasharray': undefined,
|
|
@@ -64,7 +61,7 @@ export default function useChartist() {
|
|
|
64
61
|
const areaCtx = ctx as AreaDrawEvent
|
|
65
62
|
|
|
66
63
|
areaCtx.element.animate({
|
|
67
|
-
|
|
64
|
+
|
|
68
65
|
d: {
|
|
69
66
|
begin,
|
|
70
67
|
dur: duration,
|
|
@@ -84,7 +81,9 @@ export default function useChartist() {
|
|
|
84
81
|
if (ctx.type === 'bar') {
|
|
85
82
|
const barCtx = ctx as BarDrawEvent
|
|
86
83
|
// Access private options property via type assertion
|
|
87
|
-
const chartOptions = (chart as unknown as {
|
|
84
|
+
const chartOptions = (chart as unknown as {
|
|
85
|
+
options?: Options & Partial<BarChartOptions>
|
|
86
|
+
}).options
|
|
88
87
|
const horizontal = !!(chartOptions as BarChartOptions | undefined)?.horizontalBars
|
|
89
88
|
|
|
90
89
|
// For vertical bars, y1 is baseline, y2 is top. For horizontal, x1 is baseline, x2 is end.
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import numbroLib from 'numbro'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export default function useLayerUtils() {
|
|
4
|
+
return {
|
|
5
|
+
normalizeText,
|
|
6
|
+
numbro,
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function normalizeText(text: string) {
|
|
4
11
|
return text
|
|
5
12
|
.toLowerCase()
|
|
6
13
|
.normalize('NFD')
|
|
7
14
|
.replaceAll(/[\u0300-\u036F]/g, '')
|
|
8
15
|
}
|
|
9
16
|
|
|
10
|
-
|
|
17
|
+
function numbro(number: '∞' | number | undefined, format?: string) {
|
|
11
18
|
if (!number && number !== 0) {
|
|
12
19
|
return ''
|
|
13
20
|
}
|
|
@@ -17,10 +24,3 @@ const numbro = (number: '∞' | number | undefined, format?: string) => {
|
|
|
17
24
|
|
|
18
25
|
return numbroLib(number).format(format || '0,0')
|
|
19
26
|
}
|
|
20
|
-
|
|
21
|
-
export default function useLayerUtils() {
|
|
22
|
-
return {
|
|
23
|
-
normalizeText,
|
|
24
|
-
numbro,
|
|
25
|
-
}
|
|
26
|
-
}
|
|
@@ -20,7 +20,6 @@ export default function useToast() {
|
|
|
20
20
|
const createToast = (message: string, status: BaseStatus = 'success', i18nParams?: Record<string, number | string>) => {
|
|
21
21
|
if (import.meta.client) {
|
|
22
22
|
const toast: BaseToast = {
|
|
23
|
-
// eslint-disable-next-line n/no-unsupported-features/node-builtins
|
|
24
23
|
id: crypto.randomUUID(),
|
|
25
24
|
status: status || 'success',
|
|
26
25
|
text: message.includes(' ') ? message : nuxtApp.$i18n.t(`toasts.${message}`, i18nParams || {}),
|
package/app/types/bases.d.ts
CHANGED
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
// Global types for bases
|
|
2
|
-
export type BaseAlignment = 'center' | 'left' | 'right'
|
|
3
|
-
|
|
4
|
-
export type BaseBackground = 'gray' | 'white'
|
|
5
|
-
|
|
6
|
-
export type BaseColor
|
|
7
|
-
= | 'black'
|
|
8
|
-
| 'gray'
|
|
9
|
-
| 'green'
|
|
10
|
-
| 'indigo'
|
|
11
|
-
| 'orange'
|
|
12
|
-
| 'red'
|
|
13
|
-
| 'white'
|
|
14
|
-
|
|
15
|
-
export type BaseSize
|
|
16
|
-
= | '2xl'
|
|
17
|
-
| '2xs'
|
|
18
|
-
| '3xl'
|
|
19
|
-
| '3xs'
|
|
20
|
-
| '4xl'
|
|
21
|
-
| 'base'
|
|
22
|
-
| 'lg'
|
|
23
|
-
| 'sm'
|
|
24
|
-
| 'xl'
|
|
25
|
-
| 'xs'
|
|
26
|
-
|
|
27
|
-
export type BaseStatus = | 'error' | 'info' | 'success' | 'warning'
|
|
28
|
-
|
|
29
1
|
// Components
|
|
30
2
|
export interface BaseAlert {
|
|
31
3
|
closingId?: string
|
|
@@ -35,6 +7,9 @@ export interface BaseAlert {
|
|
|
35
7
|
text?: BaseTextText
|
|
36
8
|
}
|
|
37
9
|
|
|
10
|
+
// Global types for bases
|
|
11
|
+
export type BaseAlignment = 'center' | 'left' | 'right'
|
|
12
|
+
|
|
38
13
|
export interface BaseAvatar {
|
|
39
14
|
bordered?: boolean
|
|
40
15
|
borderWidth?: number
|
|
@@ -46,6 +21,8 @@ export interface BaseAvatar {
|
|
|
46
21
|
to?: RouteLocationNamedI18n
|
|
47
22
|
}
|
|
48
23
|
|
|
24
|
+
export type BaseBackground = 'gray' | 'white'
|
|
25
|
+
|
|
49
26
|
export interface BaseBordered {
|
|
50
27
|
background?: BaseBackground
|
|
51
28
|
borderColor?: BaseBorderedColor
|
|
@@ -119,6 +96,15 @@ export interface BaseChart {
|
|
|
119
96
|
|
|
120
97
|
export type BaseChartType = 'bar' | 'line' | 'pie'
|
|
121
98
|
|
|
99
|
+
export type BaseColor
|
|
100
|
+
= | 'black'
|
|
101
|
+
| 'gray'
|
|
102
|
+
| 'green'
|
|
103
|
+
| 'indigo'
|
|
104
|
+
| 'orange'
|
|
105
|
+
| 'red'
|
|
106
|
+
| 'white'
|
|
107
|
+
|
|
122
108
|
export interface BaseDivider {
|
|
123
109
|
borderStyle?: BaseDividerBorderStyle
|
|
124
110
|
margin?: number
|
|
@@ -283,6 +269,18 @@ export type BaseQuoteBackground = 'gray' | 'gray-light' | 'white'
|
|
|
283
269
|
|
|
284
270
|
export type BaseQuoteSize = 'base' | 'sm' | 'xs'
|
|
285
271
|
|
|
272
|
+
export type BaseSize
|
|
273
|
+
= | '2xl'
|
|
274
|
+
| '2xs'
|
|
275
|
+
| '3xl'
|
|
276
|
+
| '3xs'
|
|
277
|
+
| '4xl'
|
|
278
|
+
| 'base'
|
|
279
|
+
| 'lg'
|
|
280
|
+
| 'sm'
|
|
281
|
+
| 'xl'
|
|
282
|
+
| 'xs'
|
|
283
|
+
|
|
286
284
|
export interface BaseSpinner {
|
|
287
285
|
clickable?: boolean
|
|
288
286
|
color?: BaseColor
|
|
@@ -293,6 +291,8 @@ export interface BaseSpinner {
|
|
|
293
291
|
uppercase?: boolean
|
|
294
292
|
}
|
|
295
293
|
|
|
294
|
+
export type BaseStatus = | 'error' | 'info' | 'success' | 'warning'
|
|
295
|
+
|
|
296
296
|
export interface BaseTag {
|
|
297
297
|
active?: boolean
|
|
298
298
|
avatar?: string
|
|
@@ -352,7 +352,10 @@ export interface BaseText {
|
|
|
352
352
|
uppercase?: boolean
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
export type BaseTextText = string | {
|
|
355
|
+
export type BaseTextText = string | {
|
|
356
|
+
base: string
|
|
357
|
+
sm: string
|
|
358
|
+
}
|
|
356
359
|
|
|
357
360
|
export interface BaseToast {
|
|
358
361
|
hasClose?: boolean
|
package/app/types/fields.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
// Global types for fields
|
|
2
2
|
export type FieldBackground = 'gray' | 'white'
|
|
3
3
|
|
|
4
|
-
export type FieldSize = 'base' | 'lg' | 'sm' | 'xs'
|
|
5
|
-
|
|
6
|
-
export type FieldStatus
|
|
7
|
-
= | 'default'
|
|
8
|
-
| 'error'
|
|
9
|
-
| 'info'
|
|
10
|
-
| 'success'
|
|
11
|
-
| 'warning'
|
|
12
|
-
|
|
13
4
|
// Components
|
|
14
5
|
export interface FieldCheckbox {
|
|
15
6
|
description?: BaseTextText
|
|
@@ -142,6 +133,15 @@ export interface FieldSelectOption {
|
|
|
142
133
|
value: string
|
|
143
134
|
}
|
|
144
135
|
|
|
136
|
+
export type FieldSize = 'base' | 'lg' | 'sm' | 'xs'
|
|
137
|
+
|
|
138
|
+
export type FieldStatus
|
|
139
|
+
= | 'default'
|
|
140
|
+
| 'error'
|
|
141
|
+
| 'info'
|
|
142
|
+
| 'success'
|
|
143
|
+
| 'warning'
|
|
144
|
+
|
|
145
145
|
export interface FieldTabs {
|
|
146
146
|
disabled?: boolean
|
|
147
147
|
minimizeOnMobile?: boolean
|
package/app/types/global.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saasmakers/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Reusable Nuxt UI components for SaaS Makers projects",
|
|
6
|
-
"repository": {
|
|
7
|
-
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/saasmakers/saasmakers-turborepo.git",
|
|
9
|
-
"directory": "packages/ui"
|
|
10
|
-
},
|
|
11
6
|
"license": "MIT",
|
|
12
7
|
"author": "SaaS Makers",
|
|
13
8
|
"sideEffects": false,
|
|
@@ -54,18 +49,18 @@
|
|
|
54
49
|
"devDependencies": {
|
|
55
50
|
"nuxt": "4.2.2",
|
|
56
51
|
"typescript": "5.9.3",
|
|
57
|
-
"@saasmakers/shared": "0.1.
|
|
52
|
+
"@saasmakers/shared": "0.1.17"
|
|
58
53
|
},
|
|
59
54
|
"peerDependencies": {
|
|
60
|
-
"@saasmakers/shared": "^0.1.
|
|
55
|
+
"@saasmakers/shared": "^0.1.17",
|
|
61
56
|
"nuxt": "4.2.2"
|
|
62
57
|
},
|
|
63
58
|
"publishConfig": {
|
|
64
59
|
"access": "public"
|
|
65
60
|
},
|
|
66
61
|
"scripts": {
|
|
67
|
-
"dev": "storybook dev -p
|
|
68
|
-
"lint": "eslint .",
|
|
62
|
+
"dev": "storybook dev -p 3104 --no-open",
|
|
63
|
+
"lint": "eslint . --max-warnings=0",
|
|
69
64
|
"typecheck": "nuxi typecheck"
|
|
70
65
|
}
|
|
71
66
|
}
|
package/uno.config.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable perfectionist/sort-objects */
|
|
1
2
|
import type { Preset } from 'unocss'
|
|
2
3
|
import { defineConfig, presetWind3 } from 'unocss'
|
|
3
4
|
|
|
@@ -24,7 +25,6 @@ export const rules: [string, Record<string, string>][] = [
|
|
|
24
25
|
export const shortcuts: Record<string, string> = { 'field-disabled': 'opacity-50 cursor-not-allowed' }
|
|
25
26
|
|
|
26
27
|
export const theme = {
|
|
27
|
-
/* eslint-disable perfectionist/sort-objects */
|
|
28
28
|
container: {
|
|
29
29
|
center: true,
|
|
30
30
|
|
|
@@ -42,7 +42,6 @@ export const theme = {
|
|
|
42
42
|
'xl': '1280px',
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
|
-
/* eslint-enable perfectionist/sort-objects */
|
|
46
45
|
|
|
47
46
|
colors: {
|
|
48
47
|
black: '#000000',
|
|
@@ -171,7 +170,6 @@ export const theme = {
|
|
|
171
170
|
},
|
|
172
171
|
},
|
|
173
172
|
|
|
174
|
-
/* eslint-disable perfectionist/sort-objects */
|
|
175
173
|
fontSize: {
|
|
176
174
|
'3xs': ['0.5rem', '0.875rem'],
|
|
177
175
|
'2xs': ['0.625rem', '1rem'],
|
|
@@ -184,14 +182,11 @@ export const theme = {
|
|
|
184
182
|
'3xl': ['1.875rem', '2.5rem'],
|
|
185
183
|
'4xl': ['2.25rem', '3rem'],
|
|
186
184
|
},
|
|
187
|
-
/* eslint-enable perfectionist/sort-objects */
|
|
188
185
|
}
|
|
189
186
|
|
|
190
|
-
/* eslint-disable nuxt/nuxt-config-keys-order */
|
|
191
187
|
export default defineConfig({
|
|
192
188
|
presets,
|
|
193
189
|
rules,
|
|
194
190
|
shortcuts,
|
|
195
191
|
theme,
|
|
196
192
|
})
|
|
197
|
-
/* eslint-enable nuxt/nuxt-config-keys-order */
|