@saasmakers/ui 0.1.64 → 0.1.66

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.
@@ -20,6 +20,7 @@ defineSlots<{
20
20
  }>()
21
21
 
22
22
  const { t } = useI18n()
23
+ const { getIcon } = useLayerIcons()
23
24
 
24
25
  const isClosed = ref(false)
25
26
 
@@ -127,7 +127,6 @@ function onClick(event: MouseEvent) {
127
127
  class="flex-initial"
128
128
  :color="iconColor"
129
129
  :icon="confirming ? undefined : icon"
130
- :light="light"
131
130
  :reverse="reverse"
132
131
  :size="size"
133
132
  :text="confirming ? t('confirm') : text"
@@ -1,7 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import type { BaseIcon } from '../../types/bases'
3
3
  import { NuxtLinkLocale } from '#components'
4
- import { getIcon } from '../../composables/useIcons'
5
4
 
6
5
  const props = withDefaults(defineProps<BaseIcon>(), {
7
6
  bold: false,
@@ -28,6 +27,7 @@ const emit = defineEmits<{
28
27
  const confirming = ref(false)
29
28
 
30
29
  const { t } = useI18n()
30
+ const { getIcon } = useLayerIcons()
31
31
 
32
32
  const statusIcon = computed<string | undefined>(() => {
33
33
  switch (props.status) {
@@ -1,6 +1,5 @@
1
1
  <script lang="ts" setup>
2
2
  import type { BaseMetric } from '../../types/bases'
3
- import { getIcon } from '../../composables/useIcons'
4
3
 
5
4
  const props = withDefaults(defineProps<BaseMetric>(), {
6
5
  alignment: 'left',
@@ -11,6 +10,8 @@ const props = withDefaults(defineProps<BaseMetric>(), {
11
10
  value: undefined,
12
11
  })
13
12
 
13
+ const { getIcon } = useLayerIcons()
14
+
14
15
  const performanceIcon = computed<string | undefined>(() => {
15
16
  switch (props.performance) {
16
17
  case 'down':
@@ -1,7 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import type { BaseOverlay } from '../../types/bases'
3
3
  import { Motion } from 'motion-v'
4
- import { getIcon } from '../../composables/useIcons'
5
4
  import useMotion from '../../composables/useMotion'
6
5
 
7
6
  withDefaults(defineProps<BaseOverlay>(), {
@@ -22,6 +21,7 @@ defineSlots<{
22
21
  default?: () => VNode[]
23
22
  }>()
24
23
 
24
+ const { getIcon } = useLayerIcons()
25
25
  const { fadeIn } = useMotion()
26
26
 
27
27
  function onClick(event: MouseEvent) {
@@ -1,6 +1,5 @@
1
1
  <script lang="ts" setup>
2
2
  import type { BaseQuote } from '../../types/bases'
3
- import { getIcon } from '../../composables/useIcons'
4
3
 
5
4
  const props = withDefaults(defineProps<BaseQuote>(), {
6
5
  background: 'white',
@@ -29,8 +28,8 @@ defineSlots<{
29
28
  }>()
30
29
 
31
30
  const { locale, t } = useI18n()
32
- const slots = useSlots()
33
- const { translatedContent } = useTranslation(slots, locale)
31
+ const { translatedContent } = useTranslation(useSlots(), locale)
32
+ const { getIcon } = useLayerIcons()
34
33
 
35
34
  const closed = ref(false)
36
35
 
@@ -1,7 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import type { BaseTag } from '../../types/bases'
3
3
  import { NuxtLinkLocale } from '#components'
4
- import { getIcon } from '../../composables/useIcons'
5
4
 
6
5
  const props = withDefaults(defineProps<BaseTag>(), {
7
6
  active: false,
@@ -37,6 +36,8 @@ defineSlots<{
37
36
  default?: () => VNode[]
38
37
  }>()
39
38
 
39
+ const { getIcon } = useLayerIcons()
40
+
40
41
  const hovered = ref(false)
41
42
 
42
43
  const form = reactive({ name: '' })
@@ -136,7 +137,6 @@ function onRemove(event: MouseEvent) {
136
137
  <BaseAvatar
137
138
  v-if="avatar"
138
139
  class="h-full w-full"
139
- rounded="sm"
140
140
  :shadow="false"
141
141
  :src="avatar"
142
142
  />
@@ -1,6 +1,5 @@
1
1
  <script lang="ts" setup>
2
2
  import type { BaseTags } from '../../types/bases'
3
- import { getIcon } from '../../composables/useIcons'
4
3
 
5
4
  const props = withDefaults(defineProps<BaseTags>(), {
6
5
  active: false,
@@ -23,10 +22,10 @@ const emit = defineEmits<{
23
22
  'attach': [event: MouseEvent, tagId?: number | string]
24
23
  'back': [event: MouseEvent]
25
24
  'click': [event: MouseEvent]
26
- 'create': [event: MouseEvent, name: string]
25
+ 'create': [event: FocusEvent | KeyboardEvent, name: string]
27
26
  'detach': [event: MouseEvent, tagId?: number | string]
28
27
  'remove': [event: MouseEvent, tagId?: number | string]
29
- 'update': [event: MouseEvent, name: string, tagId?: number | string]
28
+ 'update': [event: FocusEvent | KeyboardEvent, name: string, tagId?: number | string]
30
29
  'update:modelValue': [value: (number | string)[]]
31
30
  }>()
32
31
 
@@ -37,6 +36,7 @@ const showingAllTags = ref(false)
37
36
  const showingTagCreationField = ref(false)
38
37
 
39
38
  const { t } = useI18n()
39
+ const { getIcon } = useLayerIcons()
40
40
 
41
41
  const sortedTags = computed({
42
42
  get() {
@@ -61,7 +61,7 @@ const sortedTags = computed({
61
61
  },
62
62
  })
63
63
 
64
- function onCreateTag(event: MouseEvent, name: string) {
64
+ function onCreateTag(event: FocusEvent | KeyboardEvent, name: string) {
65
65
  showingTagCreationField.value = false
66
66
  keyForTagCreation.value = Date.now()
67
67
 
@@ -110,7 +110,7 @@ function onTagClick(event: MouseEvent, tagId?: number | string) {
110
110
  }
111
111
  }
112
112
 
113
- function onUpdateTag(event: MouseEvent, name: string, tagId?: number | string) {
113
+ function onUpdateTag(event: FocusEvent | KeyboardEvent, name: string, tagId?: number | string) {
114
114
  if (name) {
115
115
  emit('update', event, name, tagId)
116
116
  }
@@ -166,8 +166,8 @@ function onRemoveTag(event: MouseEvent, tagId?: number | string) {
166
166
  :size="size"
167
167
  :text="showingTagCreationField ? '' : t('newTag')"
168
168
  @click="onShowTagField"
169
- @input:blur="onCreateTag"
170
- @input:submit="onCreateTag"
169
+ @input-blur="onCreateTag"
170
+ @input-submit="onCreateTag"
171
171
  />
172
172
 
173
173
  <div class="flex items-center">
@@ -199,8 +199,8 @@ function onRemoveTag(event: MouseEvent, tagId?: number | string) {
199
199
  :text="tag.text"
200
200
  :to="tag.to"
201
201
  @click="onTagClick"
202
- @input:blur="onUpdateTag"
203
- @input:submit="onUpdateTag"
202
+ @input-blur="onUpdateTag"
203
+ @input-submit="onUpdateTag"
204
204
  @remove="onRemoveTag"
205
205
  />
206
206
  </template>
@@ -74,7 +74,7 @@ function onShowMore() {
74
74
  </script>
75
75
 
76
76
  <template>
77
- <Component
77
+ <component
78
78
  :is="to ? NuxtLinkLocale : 'div'"
79
79
  :class="{
80
80
  'font-bold': bold,
@@ -156,7 +156,7 @@ function onShowMore() {
156
156
  />
157
157
 
158
158
  <slot />
159
- </Component>
159
+ </component>
160
160
  </template>
161
161
 
162
162
  <i18n lang="json">
@@ -1,6 +1,5 @@
1
1
  <script lang="ts" setup>
2
2
  import type { BaseToast } from '../../types/bases'
3
- import { getIcon } from '../../composables/useIcons'
4
3
 
5
4
  const props = withDefaults(defineProps<BaseToast>(), {
6
5
  hasClose: true,
@@ -13,6 +12,8 @@ const emit = defineEmits<{
13
12
  close: [event: MouseEvent, toast: BaseToast]
14
13
  }>()
15
14
 
15
+ const { getIcon } = useLayerIcons()
16
+
16
17
  function onClose(event: MouseEvent) {
17
18
  if (props.hasClose) {
18
19
  emit('close', event, props)
@@ -30,9 +30,9 @@ const props = withDefaults(defineProps<FieldInput>(), {
30
30
  const emit = defineEmits<{
31
31
  'blur': [event: FocusEvent]
32
32
  'focus': [event: FocusEvent]
33
- 'keyup': [event: KeyboardEvent, value: number | string ]
34
- 'submit': [event: KeyboardEvent, value: number | string ]
35
- 'update:modelValue': [value: number | string ]
33
+ 'keyup': [event: KeyboardEvent, value: string ]
34
+ 'submit': [event: KeyboardEvent, value: string ]
35
+ 'update:modelValue': [value: string ]
36
36
  }>()
37
37
 
38
38
  defineSlots<{
@@ -82,10 +82,10 @@ function onFieldFocus(event: FocusEvent) {
82
82
  }
83
83
 
84
84
  function onFieldInput(event: Event) {
85
- let value: number | string = (event.target as HTMLInputElement).value
85
+ let value = (event.target as HTMLInputElement).value
86
86
 
87
87
  if (props.type === 'number' && props.max && Number.parseInt(value) > props.max) {
88
- value = props.max
88
+ value = props.max.toString()
89
89
  }
90
90
 
91
91
  if (props.lowercaseOnly) {
@@ -1,7 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import type { FieldSelect, FieldSelectOption } from '../../types/fields'
3
3
  import { vOnClickOutside } from '@vueuse/components'
4
- import { getIcon } from '../../composables/useIcons'
5
4
 
6
5
  const props = withDefaults(defineProps<FieldSelect>(), {
7
6
  border: 'full',
@@ -31,6 +30,7 @@ const emit = defineEmits<{
31
30
  'update:modelValue': [value?: number | string]
32
31
  }>()
33
32
 
33
+ const { getIcon } = useLayerIcons()
34
34
  const { fadeIn } = useMotion()
35
35
 
36
36
  const opened = ref(false)
@@ -87,6 +87,7 @@ function onFieldInput() {
87
87
  :id="uuid"
88
88
  ref="textarea"
89
89
  v-model="value"
90
+ v-bind="{ 'data-enable-grammarly': 'false' }"
90
91
  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 focus:placeholder-gray-900 hover:placeholder-gray-900 dark:focus:placeholder-gray-100 dark:hover:placeholder-gray-100"
91
92
  :class="{
92
93
  'p-2.5': padding,
@@ -104,7 +105,6 @@ function onFieldInput() {
104
105
  'text-base': size === 'base',
105
106
  'text-lg': size === 'lg',
106
107
  }"
107
- data-enable-grammarly="false"
108
108
  :placeholder="placeholder"
109
109
  :rows="rows"
110
110
  spellcheck="false"
@@ -24,6 +24,19 @@ const icons = {
24
24
  tags: 'hugeicons:tags',
25
25
  } as const
26
26
 
27
- export function getIcon(attribute: keyof typeof icons) {
28
- return icons[attribute] || icons.default
27
+ export type LayerIconIcon = keyof typeof icons
28
+
29
+ export type LayerIconValue = typeof icons[LayerIconIcon]
30
+
31
+ export default function useicons() {
32
+ const iconsNames = Object.keys(icons)
33
+
34
+ const getIcon = (attribute: keyof typeof icons) => {
35
+ return icons[attribute] || icons.default
36
+ }
37
+
38
+ return {
39
+ getIcon,
40
+ iconsNames,
41
+ }
29
42
  }
@@ -270,7 +270,7 @@ export interface BaseTag {
270
270
  color?: BaseColor
271
271
  draggable?: boolean
272
272
  editable?: boolean
273
- icon?: BaseIconValue
273
+ icon?: string
274
274
  iconSize?: number
275
275
  id?: number
276
276
  isCreation?: boolean
@@ -10,7 +10,7 @@ export interface FieldCheckbox {
10
10
  fullWidth?: boolean
11
11
  hideError?: boolean
12
12
  label?: BaseTextText
13
- labelIcon?: BaseIconValue
13
+ labelIcon?: string
14
14
  lineThrough?: boolean
15
15
  loading?: boolean
16
16
  modelValue?: boolean
@@ -40,13 +40,13 @@ export interface FieldInput {
40
40
  fullWidth?: boolean
41
41
  hideError?: boolean
42
42
  label?: BaseTextText
43
- labelIcon?: BaseIconValue
43
+ labelIcon?: string
44
44
  lineThrough?: boolean
45
45
  loading?: boolean
46
46
  lowercaseOnly?: boolean
47
47
  max?: number
48
48
  min?: number
49
- modelValue?: number | string
49
+ modelValue?: string
50
50
  placeholder?: string
51
51
  required?: boolean
52
52
  size?: FieldSize
@@ -66,7 +66,7 @@ export interface FieldLabel {
66
66
  forField?: string
67
67
  hasMarginBottom?: boolean
68
68
  hasMarginLeft?: boolean
69
- icon?: BaseIconValue
69
+ icon?: string
70
70
  label: BaseTextText
71
71
  lineThrough?: boolean
72
72
  loading?: boolean
@@ -91,7 +91,7 @@ export interface FieldSelect {
91
91
  disabled?: boolean
92
92
  hideError?: boolean
93
93
  label?: BaseTextText
94
- labelIcon?: BaseIconValue
94
+ labelIcon?: string
95
95
  maxHeight?: FieldSelectMaxHeight
96
96
  modelValue?: number | string
97
97
  openOnHover?: boolean
@@ -109,7 +109,7 @@ export interface FieldSelectColumn {
109
109
  }
110
110
 
111
111
  export interface FieldSelectOption {
112
- icon?: BaseIconValue
112
+ icon?: string
113
113
  text: string
114
114
  value: number | string
115
115
  }
@@ -131,7 +131,7 @@ export interface FieldTabs {
131
131
 
132
132
  export interface FieldTabsTab {
133
133
  activeColor?: BaseColor
134
- icon?: BaseIconValue
134
+ icon?: string
135
135
  label: string
136
136
  to?: RouteLocationNamedI18n
137
137
  value: number | string
@@ -150,7 +150,7 @@ export interface FieldTextarea {
150
150
  fullWidth?: boolean
151
151
  hideError?: boolean
152
152
  label?: BaseTextText
153
- labelIcon?: BaseIconValue
153
+ labelIcon?: string
154
154
  loading?: boolean
155
155
  modelValue?: string
156
156
  padding?: boolean
@@ -167,10 +167,10 @@ export interface FieldTime {
167
167
  description?: BaseTextText
168
168
  disabled?: boolean
169
169
  hideError?: boolean
170
- icon?: BaseIconValue
170
+ icon?: string
171
171
  id: number | string
172
172
  label?: BaseTextText
173
- labelIcon?: BaseIconValue
173
+ labelIcon?: string
174
174
  modelValue?: string
175
175
  name?: string
176
176
  required?: boolean
@@ -1,14 +1,18 @@
1
+ import type { LayerIconIcon as LayerIconIconType, LayerIconValue as LayerIconValueType } from '../composables/useLayerIcons'
1
2
  import type * as Bases from './bases'
2
3
  import type * as Fields from './fields'
3
4
 
5
+ declare module '@vue/runtime-core' {
6
+ interface ComponentCustomProperties {
7
+ vHotkey?: Record<string, (event?: KeyboardEvent | MouseEvent) => void>
8
+ vTooltip?: Record<string, any> | string
9
+ }
10
+ }
11
+
4
12
  declare global {
5
- // Libraries
6
- type ChartistBarChartData = import('chartist').BarChartData
7
- type ChartistLineChartData = import('chartist').LineChartData
8
- type ChartistOptions = import('chartist').Options
9
- type ChartistPieChartData = import('chartist').PieChartData
10
- type RouteLocationNamedI18n = import('vue-router').RouteLocationNamedI18n
11
- type VuelidateValidation = import('@vuelidate/core').BaseValidation
13
+ // Project
14
+ type LayerIconIcon = LayerIconIconType
15
+ type LayerIconValue = LayerIconValueType
12
16
 
13
17
  // Bases
14
18
  type BaseBackground = Bases.BaseBackground
@@ -88,6 +92,14 @@ declare global {
88
92
  type FieldTextarea = Fields.FieldTextarea
89
93
  type FieldTime = Fields.FieldTime
90
94
 
95
+ // Libraries
96
+ type ChartistBarChartData = import('chartist').BarChartData
97
+ type ChartistLineChartData = import('chartist').LineChartData
98
+ type ChartistOptions = import('chartist').Options
99
+ type ChartistPieChartData = import('chartist').PieChartData
100
+ type RouteLocationNamedI18n = import('vue-router').RouteLocationNamedI18n
101
+ type VuelidateValidation = import('@vuelidate/core').BaseValidation
102
+
91
103
  // Navigator
92
104
  interface Navigator {
93
105
  userAgentData?: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@saasmakers/ui",
3
3
  "type": "module",
4
- "version": "0.1.64",
4
+ "version": "0.1.66",
5
5
  "private": false,
6
6
  "description": "Reusable Nuxt UI components for SaaS Makers projects",
7
7
  "license": "MIT",
@@ -21,12 +21,6 @@
21
21
  "public",
22
22
  "uno.config.ts"
23
23
  ],
24
- "scripts": {
25
- "dev": "nuxi dev",
26
- "lint": "eslint .",
27
- "prepare": "nuxi prepare",
28
- "typecheck": "nuxi typecheck"
29
- },
30
24
  "peerDependencies": {
31
25
  "@saasmakers/shared": "^0.1.0",
32
26
  "nuxt": "4.2.1"
@@ -58,8 +52,13 @@
58
52
  "vue-router": "4.6.3"
59
53
  },
60
54
  "devDependencies": {
61
- "@saasmakers/shared": "workspace:*",
62
55
  "nuxt": "4.2.1",
63
- "typescript": "5.9.3"
56
+ "typescript": "5.9.3",
57
+ "@saasmakers/shared": "0.1.3"
58
+ },
59
+ "scripts": {
60
+ "dev": "nuxi dev",
61
+ "lint": "eslint .",
62
+ "typecheck": "nuxi typecheck"
64
63
  }
65
- }
64
+ }