nuxt-glorious 2.0.0-develop-32 → 2.0.0-develop-34

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/dist/module.d.mts CHANGED
@@ -1,190 +1,11 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
 
3
- type colors = 'orange' | 'blue' | 'gray' | 'red' | 'green';
4
- type sizes = 'xl' | 'lg' | 'md' | 'sm' | 'xs';
5
-
6
- interface ModuleOptions {
7
- fetch?: {
8
- baseURL?: string;
9
- credentials?: 'same-origin' | 'include';
10
- };
11
- seo?: {
12
- suffix?: string;
13
- title?: string;
14
- description?: string;
15
- };
16
- auth?: {
17
- cookie?: {
18
- name?: string;
19
- httpOnly?: boolean;
20
- };
21
- redirect?: {
22
- logout?: string;
23
- login?: string;
24
- };
25
- strategy?: {
26
- provider?: 'laravel-passport';
27
- endpoints?: {
28
- userInfo?: {
29
- url?: string;
30
- method?: 'GET' | 'POST' | 'PUT' | 'PATCH';
31
- pick?: string;
32
- };
33
- };
34
- };
35
- };
36
- components: {
37
- accordion: {
38
- props: {
39
- color?: string;
40
- };
41
- };
42
- alert: {
43
- props: {
44
- color?: string;
45
- };
46
- };
47
- avatar: {
48
- props: {
49
- size?: sizes;
50
- rounded?: string;
51
- alt?: string;
52
- };
53
- };
54
- breadcrumb: {
55
- props: {
56
- divider?: string;
57
- };
58
- };
59
- button: {
60
- props: {
61
- color?: colors;
62
- size?: sizes;
63
- disabled?: boolean;
64
- loading?: boolean;
65
- outline?: boolean;
66
- };
67
- };
68
- checkbox: {
69
- props: {
70
- color?: colors;
71
- size?: sizes;
72
- disabled?: boolean;
73
- checked?: boolean;
74
- };
75
- };
76
- drawer: {
77
- props: {
78
- position?: 'left' | 'right';
79
- };
80
- };
81
- file: {
82
- props: {
83
- color?: colors;
84
- placeholder?: string;
85
- title?: string;
86
- text?: string;
87
- size?: sizes;
88
- required?: boolean;
89
- };
90
- };
91
- icon: {
92
- props: {
93
- color?: colors;
94
- size?: number;
95
- stroke?: number;
96
- };
97
- };
98
- input: {
99
- props: {
100
- color?: colors;
101
- placeholder?: string;
102
- title?: string;
103
- displayTextKey?: string;
104
- required?: boolean;
105
- disable?: boolean;
106
- loading?: boolean;
107
- type?: string;
108
- autocomplete?: string;
109
- display?: 'price' | 'normal';
110
- inputMode?: string;
111
- mode?: 'normal' | 'tag';
112
- tagLockOption?: boolean;
113
- };
114
- };
115
- loading: {
116
- props: {
117
- color?: colors;
118
- size?: number;
119
- stroke?: number;
120
- };
121
- };
122
- modal: {
123
- props: {
124
- colorBtn?: colors;
125
- size?: sizes;
126
- };
127
- };
128
- paginate: {
129
- props: {
130
- numberSuggestPage?: number;
131
- };
132
- };
133
- radio: {
134
- props: {
135
- size?: sizes;
136
- color?: colors;
137
- checked?: boolean;
138
- name?: string;
139
- };
140
- };
141
- switch: {
142
- props: {
143
- color?: colors;
144
- checked: boolean;
145
- };
146
- };
147
- tab: {
148
- props: {
149
- color?: colors;
150
- };
151
- };
152
- table: {
153
- props: {
154
- color?: colors;
155
- loading?: boolean;
156
- loadingColor?: colors;
157
- emptyText: string;
158
- };
159
- };
160
- textarea: {
161
- props: {
162
- color?: colors;
163
- placeholder?: string;
164
- title?: string;
165
- required?: boolean;
166
- disabled?: boolean;
167
- rows?: number;
168
- };
169
- };
170
- timeline: {
171
- props: {
172
- color?: colors;
173
- };
174
- };
175
- select: {
176
- props: {
177
- color?: colors;
178
- size?: sizes;
179
- disabled?: false;
180
- required?: false;
181
- displayTextKey?: string;
182
- keyOfValue?: string;
183
- };
184
- };
3
+ interface moduleOptions {
4
+ components?: {
5
+ prefix?: string;
185
6
  };
186
7
  }
187
8
 
188
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
9
+ declare const _default: _nuxt_schema.NuxtModule<moduleOptions, moduleOptions, false>;
189
10
 
190
11
  export { _default as default };
package/dist/module.d.ts CHANGED
@@ -1,190 +1,11 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
2
 
3
- type colors = 'orange' | 'blue' | 'gray' | 'red' | 'green';
4
- type sizes = 'xl' | 'lg' | 'md' | 'sm' | 'xs';
5
-
6
- interface ModuleOptions {
7
- fetch?: {
8
- baseURL?: string;
9
- credentials?: 'same-origin' | 'include';
10
- };
11
- seo?: {
12
- suffix?: string;
13
- title?: string;
14
- description?: string;
15
- };
16
- auth?: {
17
- cookie?: {
18
- name?: string;
19
- httpOnly?: boolean;
20
- };
21
- redirect?: {
22
- logout?: string;
23
- login?: string;
24
- };
25
- strategy?: {
26
- provider?: 'laravel-passport';
27
- endpoints?: {
28
- userInfo?: {
29
- url?: string;
30
- method?: 'GET' | 'POST' | 'PUT' | 'PATCH';
31
- pick?: string;
32
- };
33
- };
34
- };
35
- };
36
- components: {
37
- accordion: {
38
- props: {
39
- color?: string;
40
- };
41
- };
42
- alert: {
43
- props: {
44
- color?: string;
45
- };
46
- };
47
- avatar: {
48
- props: {
49
- size?: sizes;
50
- rounded?: string;
51
- alt?: string;
52
- };
53
- };
54
- breadcrumb: {
55
- props: {
56
- divider?: string;
57
- };
58
- };
59
- button: {
60
- props: {
61
- color?: colors;
62
- size?: sizes;
63
- disabled?: boolean;
64
- loading?: boolean;
65
- outline?: boolean;
66
- };
67
- };
68
- checkbox: {
69
- props: {
70
- color?: colors;
71
- size?: sizes;
72
- disabled?: boolean;
73
- checked?: boolean;
74
- };
75
- };
76
- drawer: {
77
- props: {
78
- position?: 'left' | 'right';
79
- };
80
- };
81
- file: {
82
- props: {
83
- color?: colors;
84
- placeholder?: string;
85
- title?: string;
86
- text?: string;
87
- size?: sizes;
88
- required?: boolean;
89
- };
90
- };
91
- icon: {
92
- props: {
93
- color?: colors;
94
- size?: number;
95
- stroke?: number;
96
- };
97
- };
98
- input: {
99
- props: {
100
- color?: colors;
101
- placeholder?: string;
102
- title?: string;
103
- displayTextKey?: string;
104
- required?: boolean;
105
- disable?: boolean;
106
- loading?: boolean;
107
- type?: string;
108
- autocomplete?: string;
109
- display?: 'price' | 'normal';
110
- inputMode?: string;
111
- mode?: 'normal' | 'tag';
112
- tagLockOption?: boolean;
113
- };
114
- };
115
- loading: {
116
- props: {
117
- color?: colors;
118
- size?: number;
119
- stroke?: number;
120
- };
121
- };
122
- modal: {
123
- props: {
124
- colorBtn?: colors;
125
- size?: sizes;
126
- };
127
- };
128
- paginate: {
129
- props: {
130
- numberSuggestPage?: number;
131
- };
132
- };
133
- radio: {
134
- props: {
135
- size?: sizes;
136
- color?: colors;
137
- checked?: boolean;
138
- name?: string;
139
- };
140
- };
141
- switch: {
142
- props: {
143
- color?: colors;
144
- checked: boolean;
145
- };
146
- };
147
- tab: {
148
- props: {
149
- color?: colors;
150
- };
151
- };
152
- table: {
153
- props: {
154
- color?: colors;
155
- loading?: boolean;
156
- loadingColor?: colors;
157
- emptyText: string;
158
- };
159
- };
160
- textarea: {
161
- props: {
162
- color?: colors;
163
- placeholder?: string;
164
- title?: string;
165
- required?: boolean;
166
- disabled?: boolean;
167
- rows?: number;
168
- };
169
- };
170
- timeline: {
171
- props: {
172
- color?: colors;
173
- };
174
- };
175
- select: {
176
- props: {
177
- color?: colors;
178
- size?: sizes;
179
- disabled?: false;
180
- required?: false;
181
- displayTextKey?: string;
182
- keyOfValue?: string;
183
- };
184
- };
3
+ interface moduleOptions {
4
+ components?: {
5
+ prefix?: string;
185
6
  };
186
7
  }
187
8
 
188
- declare const _default: _nuxt_schema.NuxtModule<ModuleOptions, ModuleOptions, false>;
9
+ declare const _default: _nuxt_schema.NuxtModule<moduleOptions, moduleOptions, false>;
189
10
 
190
11
  export { _default as default };
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "nuxt-glorious",
3
3
  "configKey": "glorious",
4
- "version": "2.0.0-develop-32"
4
+ "version": "2.0.0-develop-34"
5
5
  }
package/dist/module.mjs CHANGED
@@ -46,11 +46,14 @@ const module = defineNuxtModule({
46
46
  addComponentsDir({
47
47
  path: resolver.resolve("runtime/components"),
48
48
  global: true,
49
+ prefix: options.components?.prefix || "G",
49
50
  watch: false
50
51
  });
51
52
  if (nuxt.options.builder === "@nuxt/vite-builder") {
52
53
  const plugin = await import('@tailwindcss/vite').then((r) => r.default);
53
54
  addVitePlugin(plugin());
55
+ } else {
56
+ nuxt.options.postcss.plugins["@tailwindcss/postcss"] = {};
54
57
  }
55
58
  nuxt.hook("nitro:config", async (nitro) => {
56
59
  nitro.publicAssets.push({
@@ -0,0 +1,65 @@
1
+ <script lang="ts" setup>
2
+ import type { colorType, sizeType } from '~/src/types/props'
3
+
4
+ interface buttonPropInterface {
5
+ color?: colorType
6
+ size?: sizeType
7
+ disabled?: boolean
8
+ raised?: boolean
9
+ rounded?: boolean
10
+ text?: boolean
11
+ outline?: boolean
12
+ loading?: boolean
13
+ ariaLabel?: string
14
+ to?: string
15
+ label?: string
16
+ icon?: string
17
+ iconColor?: string
18
+ iconPos?: 'right' | 'left'
19
+ }
20
+
21
+ const props: any = withDefaults(defineProps<buttonPropInterface>(), {
22
+ color: 'primary',
23
+ size: 'md',
24
+ disabled: false,
25
+ raised: false,
26
+ rounded: false,
27
+ outline: false,
28
+ loading: false,
29
+ ariaLabel: '',
30
+ label: '',
31
+ icon: '',
32
+ iconPos: 'right',
33
+ iconColor: '#fff',
34
+ })
35
+ </script>
36
+
37
+ <template>
38
+ <div class="glorious-button">
39
+ <button
40
+ :class="[
41
+ `color-${props.color}`,
42
+ `size-${props.size}`,
43
+ `icon-${props.iconPos}`,
44
+ props.raised ? 'raised' : '',
45
+ props.rounded ? 'rounded' : '',
46
+ props.outline ? 'outline' : '',
47
+ ]"
48
+ :disabled="props.disabled"
49
+ :aria-label="props.ariaLabel"
50
+ >
51
+ <span v-if="!props.loading">{{ props.label }}</span>
52
+ <GLoading
53
+ v-else
54
+ :size="props.size"
55
+ :color="props.outline ? props.color : 'white'"
56
+ />
57
+ <GIcon
58
+ v-if="props.icon && !props.loading"
59
+ :name="props.icon"
60
+ :size="props.size"
61
+ :color="props.iconColor"
62
+ />
63
+ </button>
64
+ </div>
65
+ </template>
@@ -0,0 +1,46 @@
1
+ <script lang="ts" setup>
2
+ import type { colorType, sizeType } from '~/src/types/props'
3
+
4
+ interface checkboxPropInterface {
5
+ color?: colorType
6
+ size?: sizeType
7
+ checked?: boolean
8
+ label?: string
9
+ disabled?: boolean
10
+ name?: string
11
+ ariaLabel?: string
12
+ }
13
+
14
+ const props: any = withDefaults(defineProps<checkboxPropInterface>(), {
15
+ color: 'primary',
16
+ size: 'md',
17
+ checked: false,
18
+ name: 'checkbox',
19
+ })
20
+
21
+ const model = defineModel()
22
+ </script>
23
+
24
+ <template>
25
+ <label
26
+ class="glorious-checkbox"
27
+ :class="[
28
+ `color-${props.color}`,
29
+ `size-${props.size}`,
30
+ props.disabled ? 'disabled' : '',
31
+ ]"
32
+ >
33
+ <span>{{ props.label }}</span>
34
+ <label :class="[`color-${props.color}`, `size-${props.size}`]">
35
+ <input
36
+ type="checkbox"
37
+ :checked="props.checked"
38
+ :disabled="props.disabled"
39
+ v-model="model"
40
+ :aria-label="props.ariaLabel"
41
+ :name="props.name"
42
+ />
43
+ <div></div>
44
+ </label>
45
+ </label>
46
+ </template>
@@ -1,8 +1,10 @@
1
1
  <script lang="ts" setup>
2
- import { GloriousStore } from '../../stores/GloriousStore'
3
- import _props from '../props/ErrorText'
4
-
5
- const props = defineProps(_props)
2
+ import { GloriousStore } from '../stores/GloriousStore'
3
+ import _props from './props/ErrorText'
4
+ interface errorTextPropInterface {
5
+ error?: string
6
+ }
7
+ const props: any = withDefaults(defineProps<errorTextPropInterface>(), {})
6
8
  const gs = GloriousStore()
7
9
  const error: any = props.error.split('|')
8
10
  const isAll = () => error.length === 1
@@ -11,7 +13,7 @@ const isAll = () => error.length === 1
11
13
  <div>
12
14
  <span
13
15
  v-if="gs.forms[error[0]]?.errors[error[1]] && !isAll()"
14
- class="validation-error-text text-red-500 text-sm"
16
+ class="validation-error-text"
15
17
  >
16
18
  {{ gs.forms[error[0]].errors[error[1]][0] }}
17
19
  </span>
@@ -1,17 +1,17 @@
1
- <script lang="ts" setup>
2
- const props = defineProps({
3
- text: {
4
- required: true,
5
- type: String,
6
- },
7
- })
8
- </script>
9
-
10
- <template>
11
- <div class="glorious-tooltip">
12
- <div class="tooltip-slot">
13
- <slot />
14
- </div>
15
- <div class="tooltip-content">{{ props.text }}</div>
16
- </div>
17
- </template>
1
+ <script lang="ts" setup>
2
+ const props = defineProps({
3
+ text: {
4
+ required: true,
5
+ type: String,
6
+ },
7
+ })
8
+ </script>
9
+
10
+ <template>
11
+ <div class="glorious-tooltip">
12
+ <div class="tooltip-slot">
13
+ <slot />
14
+ </div>
15
+ <div class="tooltip-content">{{ props.text }}</div>
16
+ </div>
17
+ </template>
@@ -1,12 +1,44 @@
1
1
  <script lang="ts" setup>
2
2
  import { ref, watch } from '#imports'
3
- import _props from '../props/Icon'
4
3
 
5
- const props = defineProps(_props)
4
+ interface iconPropInterface {
5
+ name: String
6
+ color?: String
7
+ hoverColor?: String
8
+ size?: Number
9
+ strokeWidth?: Number
10
+ }
11
+
12
+ const props: any = withDefaults(defineProps<iconPropInterface>(), {
13
+ size: 20,
14
+ color: '#000',
15
+ strokeWidth: 3,
16
+ })
17
+
6
18
  const isHover = ref(false)
7
19
  const icon = ref('')
20
+ const computeSize = (size: number | string): number => {
21
+ let result: number = 0
22
+
23
+ switch (size) {
24
+ case 'sm':
25
+ result = 14
26
+ break
27
+ case 'md':
28
+ result = 23
29
+ break
30
+ case 'lg':
31
+ result = 24
32
+ break
33
+ default:
34
+ result = <number>size
35
+ break
36
+ }
37
+
38
+ return result
39
+ }
8
40
  const computeProps = (icon: any) => {
9
- const size = props.size
41
+ const size = computeSize(props.size)
10
42
  const color = props.color
11
43
  const strokeWidth = props.stroke
12
44
  const stroke = props.color
@@ -27,7 +59,7 @@ const changeColorIcon = (color: string) => {
27
59
  .replace(/stroke="(?!none)([^"]+)"/g, `stroke="${color}"`)
28
60
  }
29
61
  const mouseover = () => {
30
- if (props.hoverColor === '') return
62
+ if (typeof props.hoverColor === 'undefined') return
31
63
 
32
64
  if (!isHover.value) {
33
65
  const color = props.hoverColor
@@ -54,17 +86,15 @@ const getIcon = async () => {
54
86
  const icon: any = await iconsImport[`/assets/icons/${props.name}.svg`]()
55
87
  rawIcon = icon.default
56
88
  } else {
57
- const staticAssets = import.meta.glob('../../assets/icons/**/**.svg', {
89
+ const staticAssets = import.meta.glob('../assets/icons/**/**.svg', {
58
90
  query: '?raw',
59
91
  eager: false,
60
92
  })
61
-
62
93
  const icon: any = await staticAssets[
63
- `../../assets/icons/${props.name}.svg`
94
+ `../assets/icons/${props.name}.svg`
64
95
  ]()
65
96
  rawIcon = icon.default
66
97
  }
67
-
68
98
  icon.value = computeProps(rawIcon)
69
99
  } catch (e) {
70
100
  console.error(
@@ -86,7 +116,7 @@ watch(
86
116
 
87
117
  <template>
88
118
  <div
89
- class="w-max h-max"
119
+ class="w-max h-max g-icon"
90
120
  @mouseover="mouseover"
91
121
  @mouseleave="mouseleave"
92
122
  v-html="icon"