@saasmakers/ui 0.1.65 → 0.1.67

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,7 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import type { BaseAlert } from '../../types/bases'
3
3
  import { Preferences } from '@capacitor/preferences'
4
- import { getIcon } from '../../composables/useIcons'
5
4
 
6
5
  const props = withDefaults(defineProps<BaseAlert>(), {
7
6
  closingId: '',
@@ -21,6 +20,7 @@ defineSlots<{
21
20
  }>()
22
21
 
23
22
  const { t } = useI18n()
23
+ const { getIcon } = useLayerIcons()
24
24
 
25
25
  const isClosed = ref(false)
26
26
 
@@ -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: '' })
@@ -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,
@@ -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() {
@@ -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)
@@ -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',
@@ -25,12 +24,13 @@ const props = withDefaults(defineProps<FieldSelect>(), {
25
24
  })
26
25
 
27
26
  const emit = defineEmits<{
28
- 'change': [event: MouseEvent, value?: number | string]
29
- 'click': [event: MouseEvent, value?: number | string]
30
- 'optionClick': [event: MouseEvent, value?: number | string]
31
- 'update:modelValue': [value?: number | string]
27
+ 'change': [event: MouseEvent, value: number | string]
28
+ 'click': [event: MouseEvent, value: number | string]
29
+ 'optionClick': [event: MouseEvent, value: number | string]
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)
@@ -74,7 +74,7 @@ function reset() {
74
74
  opened.value = false
75
75
  }
76
76
 
77
- function selectOption(event: MouseEvent, value?: number | string) {
77
+ function selectOption(event: MouseEvent, value: number | string) {
78
78
  emit('change', event, value)
79
79
  emit('update:modelValue', value)
80
80
 
@@ -86,10 +86,10 @@ function onClose() {
86
86
  }
87
87
 
88
88
  function onContainerClick(event: MouseEvent) {
89
- if (!props.disabled) {
89
+ if (!props.disabled && selectedOption.value) {
90
90
  opened.value = !opened.value
91
91
 
92
- emit('click', event, selectedOption.value?.value)
92
+ emit('click', event, selectedOption.value.value)
93
93
  }
94
94
  }
95
95
 
@@ -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: LayerIconIcon) => {
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,7 +40,7 @@ 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
@@ -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,3 +1,4 @@
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
 
@@ -9,13 +10,9 @@ declare module '@vue/runtime-core' {
9
10
  }
10
11
 
11
12
  declare global {
12
- // Libraries
13
- type ChartistBarChartData = import('chartist').BarChartData
14
- type ChartistLineChartData = import('chartist').LineChartData
15
- type ChartistOptions = import('chartist').Options
16
- type ChartistPieChartData = import('chartist').PieChartData
17
- type RouteLocationNamedI18n = import('vue-router').RouteLocationNamedI18n
18
- type VuelidateValidation = import('@vuelidate/core').BaseValidation
13
+ // Project
14
+ type LayerIconIcon = LayerIconIconType
15
+ type LayerIconValue = LayerIconValueType
19
16
 
20
17
  // Bases
21
18
  type BaseBackground = Bases.BaseBackground
@@ -95,6 +92,14 @@ declare global {
95
92
  type FieldTextarea = Fields.FieldTextarea
96
93
  type FieldTime = Fields.FieldTime
97
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
+
98
103
  // Navigator
99
104
  interface Navigator {
100
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.65",
4
+ "version": "0.1.67",
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
+ }