@saasmakers/ui 0.1.105 → 0.1.107

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.
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import type { BaseAlert } from '../../types/bases'
3
2
  import { Preferences } from '@capacitor/preferences'
3
+ import type { BaseAlert } from '../../types/bases'
4
4
 
5
5
  const props = withDefaults(defineProps<BaseAlert>(), {
6
6
  closingId: '',
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import type { BaseAvatar } from '../../types/bases'
3
2
  import { NuxtLinkLocale } from '#components'
3
+ import type { BaseAvatar } from '../../types/bases'
4
4
 
5
5
  const props = withDefaults(defineProps<BaseAvatar>(), {
6
6
  bordered: true,
@@ -24,10 +24,10 @@ defineSlots<{
24
24
 
25
25
  const { createToast } = useToasts()
26
26
 
27
- const hovered = ref(false)
28
27
  const error = ref(false)
29
- const loaded = ref(false)
30
28
  const fileInput = ref<HTMLInputElement>()
29
+ const hovered = ref(false)
30
+ const loaded = ref(false)
31
31
 
32
32
  const { t } = useI18n()
33
33
 
@@ -56,6 +56,10 @@ function onError() {
56
56
  loaded.value = true
57
57
  }
58
58
 
59
+ function onLoad() {
60
+ loaded.value = true
61
+ }
62
+
59
63
  function onMouseEnter() {
60
64
  hovered.value = true
61
65
  }
@@ -63,10 +67,6 @@ function onMouseEnter() {
63
67
  function onMouseLeave() {
64
68
  hovered.value = false
65
69
  }
66
-
67
- function onLoad() {
68
- loaded.value = true
69
- }
70
70
  </script>
71
71
 
72
72
  <template>
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import type { BaseButton } from '../../types/bases'
3
2
  import { NuxtLinkLocale } from '#components'
3
+ import type { BaseButton } from '../../types/bases'
4
4
 
5
5
  const props = withDefaults(defineProps<BaseButton>(), {
6
6
  background: true,
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import type { BaseChart } from '../../types/bases'
3
2
  import { BarChart, LineChart, PieChart } from 'chartist'
3
+ import type { BaseChart } from '../../types/bases'
4
4
 
5
5
  const props = withDefaults(defineProps<BaseChart>(), {
6
6
  data: () => ({
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import type { BaseIcon } from '../../types/bases'
3
2
  import { NuxtLinkLocale } from '#components'
3
+ import type { BaseIcon } from '../../types/bases'
4
4
 
5
5
  const props = withDefaults(defineProps<BaseIcon>(), {
6
6
  bold: false,
@@ -61,6 +61,9 @@ const statusColor = computed<BaseColor | undefined>(() => {
61
61
  else if (props.status === 'warning') {
62
62
  return 'orange'
63
63
  }
64
+ else {
65
+ return undefined
66
+ }
64
67
  })
65
68
 
66
69
  const finalIcon = computed(() => {
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
- import type { BaseOverlay } from '../../types/bases'
3
2
  import { onKeyStroke } from '@vueuse/core'
4
3
  import { Motion } from 'motion-v'
4
+ import type { BaseOverlay } from '../../types/bases'
5
5
  import useMotion from '../../composables/useMotion'
6
6
 
7
7
  withDefaults(defineProps<BaseOverlay>(), {
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import type { BaseTag } from '../../types/bases'
3
2
  import { NuxtLinkLocale } from '#components'
3
+ import type { BaseTag } from '../../types/bases'
4
4
 
5
5
  const props = withDefaults(defineProps<BaseTag>(), {
6
6
  active: false,
@@ -43,7 +43,9 @@ const sortedTags = computed({
43
43
  return props.tags
44
44
  .slice()
45
45
  .filter((_tag, tagIndex) => tagIndex < props.maxTags || showingAllTags.value)
46
- .sort((tagA, tagB) => (tagA.order! < tagB.order! ? -1 : 0))
46
+ .sort((tagA, tagB) => {
47
+ return (tagA.order ?? 0) < (tagB.order ?? 0) ? -1 : 0
48
+ })
47
49
  },
48
50
 
49
51
  set(tags) {
@@ -72,6 +74,14 @@ function onGoBack(event: MouseEvent) {
72
74
  emit('back', event)
73
75
  }
74
76
 
77
+ function onRemoveTag(event: MouseEvent, tagId?: number | string) {
78
+ emit('remove', event, tagId)
79
+ }
80
+
81
+ function onShowAllTags() {
82
+ showingAllTags.value = true
83
+ }
84
+
75
85
  function onShowTagField() {
76
86
  if (!showingTagCreationField.value) {
77
87
  showingTagCreationField.value = true
@@ -85,10 +95,6 @@ function onShowTagField() {
85
95
  }
86
96
  }
87
97
 
88
- function onShowAllTags() {
89
- showingAllTags.value = true
90
- }
91
-
92
98
  function onTagClick(event: MouseEvent, tagId?: number | string) {
93
99
  if (props.selectable && tagId) {
94
100
  let value = [...modelValue.value]
@@ -119,10 +125,6 @@ function onUpdateTag(event: FocusEvent | KeyboardEvent, name: string, tagId?: nu
119
125
  keyForTagUpdate.value = Date.now()
120
126
  }
121
127
  }
122
-
123
- function onRemoveTag(event: MouseEvent, tagId?: number | string) {
124
- emit('remove', event, tagId)
125
- }
126
128
  </script>
127
129
 
128
130
  <template>
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import type { BaseText } from '../../types/bases'
3
2
  import { NuxtLinkLocale } from '#components'
3
+ import type { BaseText } from '../../types/bases'
4
4
 
5
5
  const props = withDefaults(defineProps<BaseText>(), {
6
6
  alignment: undefined,
@@ -47,7 +47,11 @@ const daysToDisplay = computed(() => {
47
47
  function onUpdateDays(event: MouseEvent, day: number) {
48
48
  const days = [...modelValue.value]
49
49
 
50
- days.includes(day) ? days.splice(days.indexOf(day), 1) : days.push(day)
50
+ if (days.includes(day)) {
51
+ days.splice(days.indexOf(day), 1)
52
+ } else {
53
+ days.push(day)
54
+ }
51
55
 
52
56
  modelValue.value = days
53
57
 
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
- import type { FieldEmojis } from '../../types/fields'
3
2
  import { emojis } from '@saasmakers/shared'
4
3
  import { refDebounced } from '@vueuse/core'
4
+ import type { FieldEmojis } from '../../types/fields'
5
5
 
6
6
  const props = withDefaults(defineProps<Omit<FieldEmojis, 'modelValue'>>(), { disabled: false })
7
7
 
@@ -111,7 +111,7 @@ const status = computed(() => {
111
111
  if (validationMessage.value && !props.hideError) {
112
112
  return 'error'
113
113
  }
114
- else if (props.description) {
114
+ else {
115
115
  return 'default'
116
116
  }
117
117
  })
@@ -1,6 +1,6 @@
1
1
  <script lang="ts" setup>
2
- import type { FieldSelect, FieldSelectOption } from '../../types/fields'
3
2
  import { vOnClickOutside } from '@vueuse/components'
3
+ import type { FieldSelect, FieldSelectOption } from '../../types/fields'
4
4
 
5
5
  const props = withDefaults(defineProps<Omit<FieldSelect, 'modelValue'>>(), {
6
6
  border: 'full',
@@ -70,17 +70,6 @@ const selectedOption = computed(() => {
70
70
  })
71
71
  })
72
72
 
73
- function reset() {
74
- opened.value = false
75
- }
76
-
77
- function selectOption(event: MouseEvent, value: string) {
78
- modelValue.value = value
79
-
80
- emit('change', event, value)
81
- reset()
82
- }
83
-
84
73
  function onClose() {
85
74
  reset()
86
75
  }
@@ -132,6 +121,17 @@ function onOptionClick(event: MouseEvent, option: FieldSelectOption) {
132
121
  emit('optionClick', event, option.value)
133
122
  }
134
123
  }
124
+
125
+ function reset() {
126
+ opened.value = false
127
+ }
128
+
129
+ function selectOption(event: MouseEvent, value: string) {
130
+ modelValue.value = value
131
+
132
+ emit('change', event, value)
133
+ reset()
134
+ }
135
135
  </script>
136
136
 
137
137
  <template>
@@ -1,8 +1,8 @@
1
1
  <script lang="ts" setup>
2
- import type { FieldTabs, FieldTabsAction } from '../../types/fields'
3
2
  import { NuxtLinkLocale } from '#components'
3
+ import type { FieldTabs, FieldTabsAction } from '../../types/fields'
4
4
 
5
- const _props = withDefaults(defineProps<Omit<FieldTabs, 'modelValue'>>(), {
5
+ withDefaults(defineProps<Omit<FieldTabs, 'modelValue'>>(), {
6
6
  disabled: false,
7
7
  minimizeOnMobile: false,
8
8
  size: 'base',
@@ -26,16 +26,16 @@ const modelValue = defineModel<FieldTime['modelValue']>({ default: '' })
26
26
 
27
27
  const inputRef = ref<HTMLInputElement>()
28
28
 
29
- function onFieldBlur(event: FocusEvent) {
30
- emit('blur', event, modelValue.value, props.name)
31
- }
32
-
33
29
  function onContainerClick() {
34
30
  if (!props.disabled && inputRef.value) {
35
31
  inputRef.value.focus()
36
32
  inputRef.value.showPicker?.()
37
33
  }
38
34
  }
35
+
36
+ function onFieldBlur(event: FocusEvent) {
37
+ emit('blur', event, modelValue.value, props.name)
38
+ }
39
39
  </script>
40
40
 
41
41
  <template>
@@ -17,7 +17,7 @@ export default function useToast() {
17
17
  }
18
18
  }
19
19
 
20
- const createToast = (message: string, status: BaseStatus = 'success', i18nParams?: { [key: string]: number | string }) => {
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
23
  id: Math.floor((1 + Math.random()) * 0x10000).toString(16),
@@ -1,3 +1,4 @@
1
+ // Global types for bases
1
2
  export type BaseAlignment = 'center' | 'left' | 'right'
2
3
 
3
4
  export type BaseBackground = 'gray' | 'white'
@@ -25,6 +26,7 @@ export type BaseSize
25
26
 
26
27
  export type BaseStatus = | 'error' | 'info' | 'success' | 'warning'
27
28
 
29
+ // Components
28
30
  export interface BaseAlert {
29
31
  closingId?: string
30
32
  isClosable?: boolean
@@ -44,6 +46,14 @@ export interface BaseAvatar {
44
46
  to?: RouteLocationNamedI18n
45
47
  }
46
48
 
49
+ export interface BaseBordered {
50
+ background?: BaseBackground
51
+ borderColor?: BaseBorderedColor
52
+ hasBorder?: boolean
53
+ shadow?: boolean
54
+ title: string
55
+ }
56
+
47
57
  export type BaseBorderedColor = 'black' | 'gray'
48
58
 
49
59
  export interface BaseButton {
@@ -85,14 +95,6 @@ export type BaseButtonSize
85
95
 
86
96
  export type BaseButtonType = 'button' | 'reset' | 'submit'
87
97
 
88
- export interface BaseBordered {
89
- background?: BaseBackground
90
- borderColor?: BaseBorderedColor
91
- hasBorder?: boolean
92
- shadow?: boolean
93
- title: string
94
- }
95
-
96
98
  export interface BaseCharacter {
97
99
  character?: BaseCharacterCharacter
98
100
  size?: BaseCharacterSize
@@ -313,8 +315,6 @@ export interface BaseTag {
313
315
  uppercase?: boolean
314
316
  }
315
317
 
316
- export type BaseTagSize = 'base' | 'sm'
317
-
318
318
  export interface BaseTags {
319
319
  active?: boolean
320
320
  clickable?: boolean
@@ -332,6 +332,8 @@ export interface BaseTags {
332
332
  wrap?: boolean
333
333
  }
334
334
 
335
+ export type BaseTagSize = 'base' | 'sm'
336
+
335
337
  export interface BaseText {
336
338
  alignment?: BaseAlignment
337
339
  background?: BaseBackground
@@ -1,3 +1,4 @@
1
+ // Global types for fields
1
2
  export type FieldBackground = 'gray' | 'white'
2
3
 
3
4
  export type FieldSize = 'base' | 'lg' | 'sm' | 'xs'
@@ -9,6 +10,7 @@ export type FieldStatus
9
10
  | 'success'
10
11
  | 'warning'
11
12
 
13
+ // Components
12
14
  export interface FieldCheckbox {
13
15
  description?: BaseTextText
14
16
  disabled?: boolean
@@ -122,11 +124,17 @@ export interface FieldSelect {
122
124
  validation?: VuelidateValidation
123
125
  }
124
126
 
127
+ export type FieldSelectBorder = 'bottom' | 'full' | 'none'
128
+
125
129
  export interface FieldSelectColumn {
126
130
  options: FieldSelectOption[]
127
131
  title?: string
128
132
  }
129
133
 
134
+ export type FieldSelectDirection = 'bottom' | 'top'
135
+
136
+ export type FieldSelectMaxHeight = 'lg' | 'md' | 'sm' | 'xs'
137
+
130
138
  export interface FieldSelectOption {
131
139
  icon?: string
132
140
  iconColor?: BaseColor
@@ -134,12 +142,6 @@ export interface FieldSelectOption {
134
142
  value: string
135
143
  }
136
144
 
137
- export type FieldSelectBorder = 'bottom' | 'full' | 'none'
138
-
139
- export type FieldSelectDirection = 'bottom' | 'top'
140
-
141
- export type FieldSelectMaxHeight = 'lg' | 'md' | 'sm' | 'xs'
142
-
143
145
  export interface FieldTabs {
144
146
  disabled?: boolean
145
147
  minimizeOnMobile?: boolean
@@ -149,6 +151,8 @@ export interface FieldTabs {
149
151
  theme?: FieldTabsTheme
150
152
  }
151
153
 
154
+ export type FieldTabsAction = 'added' | 'removed'
155
+
152
156
  export interface FieldTabsTab {
153
157
  activeColor?: BaseColor
154
158
  icon?: string
@@ -157,8 +161,6 @@ export interface FieldTabsTab {
157
161
  value: string
158
162
  }
159
163
 
160
- export type FieldTabsAction = 'added' | 'removed'
161
-
162
164
  export type FieldTabsTheme = 'border' | 'rounded'
163
165
 
164
166
  export interface FieldTextarea {
@@ -4,29 +4,24 @@ import type * as Bases from './bases'
4
4
  import type * as Fields from './fields'
5
5
 
6
6
  declare global {
7
- // Project
8
- type LayerIconIcon = LayerIconIconType
9
- type LayerIconValue = LayerIconValueType
10
-
11
7
  // Bases
12
- type BaseAlignment = Bases.BaseAlignment
13
- type BaseBackground = Bases.BaseBackground
14
- type BaseColor = Bases.BaseColor
15
- type BaseSize = Bases.BaseSize
16
- type BaseStatus = Bases.BaseStatus
17
8
  type BaseAlert = Bases.BaseAlert
9
+ type BaseAlignment = Bases.BaseAlignment
10
+
18
11
  type BaseAvatar = Bases.BaseAvatar
12
+ type BaseBackground = Bases.BaseBackground
13
+ type BaseBordered = Bases.BaseBordered
19
14
  type BaseBorderedColor = Bases.BaseBorderedColor
20
15
  type BaseButton = Bases.BaseButton
21
16
  type BaseButtonRounded = Bases.BaseButtonRounded
22
17
  type BaseButtonSize = Bases.BaseButtonSize
23
18
  type BaseButtonType = Bases.BaseButtonType
24
- type BaseBordered = Bases.BaseBordered
25
19
  type BaseCharacter = Bases.BaseCharacter
26
20
  type BaseCharacterCharacter = Bases.BaseCharacterCharacter
27
21
  type BaseCharacterSize = Bases.BaseCharacterSize
28
22
  type BaseChart = Bases.BaseChart
29
23
  type BaseChartType = Bases.BaseChartType
24
+ type BaseColor = Bases.BaseColor
30
25
  type BaseDivider = Bases.BaseDivider
31
26
  type BaseDividerBorderStyle = Bases.BaseDividerBorderStyle
32
27
  type BaseDividerSize = Bases.BaseDividerSize
@@ -53,18 +48,23 @@ declare global {
53
48
  type BaseQuote = Bases.BaseQuote
54
49
  type BaseQuoteBackground = Bases.BaseQuoteBackground
55
50
  type BaseQuoteSize = Bases.BaseQuoteSize
51
+ type BaseSize = Bases.BaseSize
56
52
  type BaseSpinner = Bases.BaseSpinner
53
+ type BaseStatus = Bases.BaseStatus
57
54
  type BaseTag = Bases.BaseTag
58
- type BaseTagSize = Bases.BaseTagSize
59
55
  type BaseTags = Bases.BaseTags
56
+ type BaseTagSize = Bases.BaseTagSize
60
57
  type BaseText = Bases.BaseText
61
58
  type BaseTextText = Bases.BaseTextText
62
59
  type BaseToast = Bases.BaseToast
60
+ // Libraries
61
+ type ChartistBarChartData = import('chartist').BarChartData
62
+ type ChartistLineChartData = import('chartist').LineChartData
63
63
 
64
+ type ChartistOptions = import('chartist').Options
65
+ type ChartistPieChartData = import('chartist').PieChartData
64
66
  // Fields
65
67
  type FieldBackground = Fields.FieldBackground
66
- type FieldSize = Fields.FieldSize
67
- type FieldStatus = Fields.FieldStatus
68
68
  type FieldCheckbox = Fields.FieldCheckbox
69
69
  type FieldDays = Fields.FieldDays
70
70
  type FieldEmojis = Fields.FieldEmojis
@@ -75,36 +75,36 @@ declare global {
75
75
  type FieldLabel = Fields.FieldLabel
76
76
  type FieldMessage = Fields.FieldMessage
77
77
  type FieldSelect = Fields.FieldSelect
78
- type FieldSelectColumn = Fields.FieldSelectColumn
79
- type FieldSelectOption = Fields.FieldSelectOption
80
78
  type FieldSelectBorder = Fields.FieldSelectBorder
79
+ type FieldSelectColumn = Fields.FieldSelectColumn
81
80
  type FieldSelectDirection = Fields.FieldSelectDirection
82
81
  type FieldSelectMaxHeight = Fields.FieldSelectMaxHeight
82
+ type FieldSelectOption = Fields.FieldSelectOption
83
+ type FieldSize = Fields.FieldSize
84
+ type FieldStatus = Fields.FieldStatus
83
85
  type FieldTabs = Fields.FieldTabs
84
- type FieldTabsTab = Fields.FieldTabsTab
85
86
  type FieldTabsAction = Fields.FieldTabsAction
87
+ type FieldTabsTab = Fields.FieldTabsTab
86
88
  type FieldTabsTheme = Fields.FieldTabsTheme
89
+
87
90
  type FieldTextarea = Fields.FieldTextarea
88
91
  type FieldTime = Fields.FieldTime
89
-
90
- // Libraries
91
- type ChartistBarChartData = import('chartist').BarChartData
92
- type ChartistLineChartData = import('chartist').LineChartData
93
- type ChartistOptions = import('chartist').Options
94
- type ChartistPieChartData = import('chartist').PieChartData
92
+ // Project
93
+ type LayerIconIcon = LayerIconIconType
94
+ type LayerIconValue = LayerIconValueType
95
95
  type Meta<T> = import('@nuxtjs/storybook').Meta<T>
96
- type RouteLocationNamedI18n = import('vue-router').RouteLocationNamedI18n
97
- type StoryObj<T> = import('@nuxtjs/storybook').StoryObj<T>
98
- type VuelidateValidation = import('@vuelidate/core').BaseValidation
99
-
100
96
  // Navigator
101
97
  interface Navigator {
102
98
  userAgentData?: {
103
- brands?: Array<{ brand: string, version: string }>
99
+ brands?: { brand: string, version: string }[]
104
100
  mobile?: boolean
105
101
  platform?: string
106
102
  }
107
103
  }
104
+ type RouteLocationNamedI18n = import('vue-router').RouteLocationNamedI18n
105
+ type StoryObj<T> = import('@nuxtjs/storybook').StoryObj<T>
106
+
107
+ type VuelidateValidation = import('@vuelidate/core').BaseValidation
108
108
  }
109
109
 
110
110
  declare module 'vue' {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
3
  "type": "module",
4
- "version": "0.1.105",
4
+ "version": "0.1.107",
5
5
  "private": false,
6
6
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
7
7
  "license": "MIT",
@@ -22,7 +22,7 @@
22
22
  "uno.config.ts"
23
23
  ],
24
24
  "peerDependencies": {
25
- "@saasmakers/shared": "^0.1.12",
25
+ "@saasmakers/shared": "^0.1.13",
26
26
  "nuxt": "4.2.2"
27
27
  },
28
28
  "dependencies": {
@@ -58,12 +58,11 @@
58
58
  "devDependencies": {
59
59
  "nuxt": "4.2.2",
60
60
  "typescript": "5.9.3",
61
- "@saasmakers/shared": "0.1.12"
61
+ "@saasmakers/shared": "0.1.13"
62
62
  },
63
63
  "scripts": {
64
- "dev": "nuxi dev",
64
+ "dev": "storybook dev -p 3103",
65
65
  "lint": "eslint .",
66
- "storybook": "storybook dev -p 6006",
67
66
  "typecheck": "nuxi typecheck"
68
67
  }
69
68
  }
package/uno.config.ts CHANGED
@@ -3,7 +3,7 @@ import { defineConfig, presetWind3 } from 'unocss'
3
3
 
4
4
  export const presets: Preset[] = [presetWind3()]
5
5
 
6
- export const rules: Array<[string, Record<string, string>]> = [
6
+ export const rules: [string, Record<string, string>][] = [
7
7
  [
8
8
  'drag-none',
9
9
  {