nuxt-glorious 2.0.0-develop-20 → 2.0.0-develop-22

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,5 +1,8 @@
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
+
3
6
  interface ModuleOptions {
4
7
  fetch?: {
5
8
  baseURL?: string;
@@ -20,7 +23,7 @@ interface ModuleOptions {
20
23
  login?: string;
21
24
  };
22
25
  strategy?: {
23
- provider?: 'laravel-passport' | '';
26
+ provider?: 'laravel-passport';
24
27
  endpoints?: {
25
28
  userInfo?: {
26
29
  url?: string;
@@ -36,14 +39,142 @@ interface ModuleOptions {
36
39
  color?: string;
37
40
  };
38
41
  };
42
+ avatar: {
43
+ props: {
44
+ size?: sizes;
45
+ rounded?: string;
46
+ alt?: string;
47
+ };
48
+ };
49
+ breadcrumb: {
50
+ props: {
51
+ divider?: string;
52
+ };
53
+ };
54
+ button: {
55
+ props: {
56
+ color?: colors;
57
+ size?: sizes;
58
+ disabled?: boolean;
59
+ loading?: boolean;
60
+ outline?: boolean;
61
+ };
62
+ };
63
+ checkbox: {
64
+ props: {
65
+ color?: colors;
66
+ size?: sizes;
67
+ disabled?: boolean;
68
+ checked?: boolean;
69
+ };
70
+ };
71
+ drawer: {
72
+ props: {
73
+ position?: 'left' | 'right';
74
+ };
75
+ };
76
+ file: {
77
+ props: {
78
+ color?: colors;
79
+ placeholder?: string;
80
+ title?: string;
81
+ text?: string;
82
+ size?: sizes;
83
+ required?: boolean;
84
+ };
85
+ };
86
+ icon: {
87
+ props: {
88
+ color?: colors;
89
+ size?: number;
90
+ stroke?: number;
91
+ };
92
+ };
93
+ input: {
94
+ props: {
95
+ color?: colors;
96
+ placeholder?: string;
97
+ title?: string;
98
+ displayTextKey?: string;
99
+ required?: boolean;
100
+ disable?: boolean;
101
+ loading?: boolean;
102
+ type?: string;
103
+ autocomplete?: string;
104
+ display?: 'price' | 'normal';
105
+ inputMode?: string;
106
+ mode?: 'normal' | 'tag';
107
+ tagLockOption?: boolean;
108
+ };
109
+ };
110
+ loading: {
111
+ props: {
112
+ color?: colors;
113
+ size?: number;
114
+ stroke?: number;
115
+ };
116
+ };
117
+ modal: {
118
+ props: {
119
+ colorBtn?: colors;
120
+ size?: sizes;
121
+ };
122
+ };
123
+ paginate: {
124
+ props: {
125
+ numberSuggestPage?: number;
126
+ };
127
+ };
128
+ radio: {
129
+ props: {
130
+ size?: sizes;
131
+ color?: colors;
132
+ checked?: boolean;
133
+ name?: string;
134
+ };
135
+ };
136
+ switch: {
137
+ props: {
138
+ color?: colors;
139
+ checked: boolean;
140
+ };
141
+ };
142
+ tab: {
143
+ props: {
144
+ color?: colors;
145
+ };
146
+ };
147
+ table: {
148
+ props: {
149
+ color?: colors;
150
+ loading?: boolean;
151
+ loadingColor?: colors;
152
+ emptyText: string;
153
+ };
154
+ };
155
+ textarea: {
156
+ props: {
157
+ color?: colors;
158
+ placeholder?: string;
159
+ title?: string;
160
+ required?: boolean;
161
+ disabled?: boolean;
162
+ rows?: number;
163
+ };
164
+ };
165
+ timeline: {
166
+ props: {
167
+ color?: colors;
168
+ };
169
+ };
39
170
  select: {
40
171
  props: {
41
- color?: string;
42
- size?: 'md';
172
+ color?: colors;
173
+ size?: sizes;
43
174
  disabled?: false;
44
175
  required?: false;
45
- displayTextKey?: 'text';
46
- keyOfValue?: 'value';
176
+ displayTextKey?: string;
177
+ keyOfValue?: string;
47
178
  };
48
179
  };
49
180
  };
package/dist/module.d.ts CHANGED
@@ -1,5 +1,8 @@
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
+
3
6
  interface ModuleOptions {
4
7
  fetch?: {
5
8
  baseURL?: string;
@@ -20,7 +23,7 @@ interface ModuleOptions {
20
23
  login?: string;
21
24
  };
22
25
  strategy?: {
23
- provider?: 'laravel-passport' | '';
26
+ provider?: 'laravel-passport';
24
27
  endpoints?: {
25
28
  userInfo?: {
26
29
  url?: string;
@@ -36,14 +39,142 @@ interface ModuleOptions {
36
39
  color?: string;
37
40
  };
38
41
  };
42
+ avatar: {
43
+ props: {
44
+ size?: sizes;
45
+ rounded?: string;
46
+ alt?: string;
47
+ };
48
+ };
49
+ breadcrumb: {
50
+ props: {
51
+ divider?: string;
52
+ };
53
+ };
54
+ button: {
55
+ props: {
56
+ color?: colors;
57
+ size?: sizes;
58
+ disabled?: boolean;
59
+ loading?: boolean;
60
+ outline?: boolean;
61
+ };
62
+ };
63
+ checkbox: {
64
+ props: {
65
+ color?: colors;
66
+ size?: sizes;
67
+ disabled?: boolean;
68
+ checked?: boolean;
69
+ };
70
+ };
71
+ drawer: {
72
+ props: {
73
+ position?: 'left' | 'right';
74
+ };
75
+ };
76
+ file: {
77
+ props: {
78
+ color?: colors;
79
+ placeholder?: string;
80
+ title?: string;
81
+ text?: string;
82
+ size?: sizes;
83
+ required?: boolean;
84
+ };
85
+ };
86
+ icon: {
87
+ props: {
88
+ color?: colors;
89
+ size?: number;
90
+ stroke?: number;
91
+ };
92
+ };
93
+ input: {
94
+ props: {
95
+ color?: colors;
96
+ placeholder?: string;
97
+ title?: string;
98
+ displayTextKey?: string;
99
+ required?: boolean;
100
+ disable?: boolean;
101
+ loading?: boolean;
102
+ type?: string;
103
+ autocomplete?: string;
104
+ display?: 'price' | 'normal';
105
+ inputMode?: string;
106
+ mode?: 'normal' | 'tag';
107
+ tagLockOption?: boolean;
108
+ };
109
+ };
110
+ loading: {
111
+ props: {
112
+ color?: colors;
113
+ size?: number;
114
+ stroke?: number;
115
+ };
116
+ };
117
+ modal: {
118
+ props: {
119
+ colorBtn?: colors;
120
+ size?: sizes;
121
+ };
122
+ };
123
+ paginate: {
124
+ props: {
125
+ numberSuggestPage?: number;
126
+ };
127
+ };
128
+ radio: {
129
+ props: {
130
+ size?: sizes;
131
+ color?: colors;
132
+ checked?: boolean;
133
+ name?: string;
134
+ };
135
+ };
136
+ switch: {
137
+ props: {
138
+ color?: colors;
139
+ checked: boolean;
140
+ };
141
+ };
142
+ tab: {
143
+ props: {
144
+ color?: colors;
145
+ };
146
+ };
147
+ table: {
148
+ props: {
149
+ color?: colors;
150
+ loading?: boolean;
151
+ loadingColor?: colors;
152
+ emptyText: string;
153
+ };
154
+ };
155
+ textarea: {
156
+ props: {
157
+ color?: colors;
158
+ placeholder?: string;
159
+ title?: string;
160
+ required?: boolean;
161
+ disabled?: boolean;
162
+ rows?: number;
163
+ };
164
+ };
165
+ timeline: {
166
+ props: {
167
+ color?: colors;
168
+ };
169
+ };
39
170
  select: {
40
171
  props: {
41
- color?: string;
42
- size?: 'md';
172
+ color?: colors;
173
+ size?: sizes;
43
174
  disabled?: false;
44
175
  required?: false;
45
- displayTextKey?: 'text';
46
- keyOfValue?: 'value';
176
+ displayTextKey?: string;
177
+ keyOfValue?: string;
47
178
  };
48
179
  };
49
180
  };
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-20"
4
+ "version": "2.0.0-develop-22"
5
5
  }
@@ -8,7 +8,10 @@ const props = defineProps(_props)
8
8
  <template>
9
9
  <div
10
10
  class="glorious-alert"
11
- :class="[`color-${getAttribute(props.color, 'alert', 'color')}`]"
11
+ :class="[
12
+ `color-${getAttribute(props.color, 'alert', 'color')}`,
13
+ getAttribute(props.color, 'alert', 'color'),
14
+ ]"
12
15
  >
13
16
  <slot />
14
17
  </div>
@@ -15,7 +15,7 @@ const props: any = defineProps(_props)
15
15
  >
16
16
  <nuxt-img
17
17
  :src="props.src"
18
- :alt="getAttribute(props.rounded, 'avatar', 'rounded')"
18
+ :alt="getAttribute(props.rounded, 'avatar', 'alt')"
19
19
  />
20
20
  </div>
21
21
  </template>
@@ -45,5 +45,3 @@ onMounted(() => {
45
45
  </div>
46
46
  </div>
47
47
  </template>
48
-
49
- <style lang="scss" src="../../style/components/dropdown.scss" />
@@ -1,16 +1,15 @@
1
1
  <script lang="ts" setup>
2
2
  import { ref, watch } from '#imports'
3
3
  import _props from '../props/Icon'
4
- import { getAttribute } from '../helper'
5
4
 
6
5
  const props = defineProps(_props)
7
6
  const isHover = ref(false)
8
7
  const icon = ref('')
9
8
  const computeProps = (icon: any) => {
10
- const size = getAttribute(props.size, 'icon', 'size')
11
- const color = getAttribute(props.color, 'icon', 'color')
12
- const strokeWidth = getAttribute(props.stroke, 'icon', 'stroke')
13
- const stroke = getAttribute(props.color, 'icon', 'color')
9
+ const size = props.size
10
+ const color = props.color
11
+ const strokeWidth = props.stroke
12
+ const stroke = props.color
14
13
 
15
14
  return icon
16
15
  .replace(
@@ -31,7 +30,7 @@ const mouseover = () => {
31
30
  if (props.hoverColor === '') return
32
31
 
33
32
  if (!isHover.value) {
34
- const color = getAttribute(props.hoverColor, 'icon', 'hoverColor')
33
+ const color = props.hoverColor
35
34
 
36
35
  changeColorIcon(color)
37
36
  }
@@ -40,7 +39,7 @@ const mouseover = () => {
40
39
  }
41
40
  const mouseleave = () => {
42
41
  isHover.value = false
43
- const color = getAttribute(props.color, 'icon', 'color')
42
+ const color = props.color
44
43
  changeColorIcon(color)
45
44
  }
46
45
  const getIcon = async () => {
@@ -1,5 +1,5 @@
1
1
  <script lang="ts" setup>
2
- import { watch, onMounted } from '#imports'
2
+ import { watch } from '#imports'
3
3
  import { createBlurDom, removeBlurDom, getAttribute } from '../helper'
4
4
  import _props from '../props/Modal'
5
5
 
@@ -8,7 +8,7 @@ const modelValue = defineModel()
8
8
  const emits = defineEmits(['change'])
9
9
 
10
10
  const emit = (item: any) => {
11
- if (getAttribute(props.currentPage, 'paginate', 'currentPage') !== item) {
11
+ if (props.currentPage !== item) {
12
12
  modelValue.value = item
13
13
  emits('change', { page: item })
14
14
  }
@@ -19,56 +19,41 @@ const listPage = ref<Array<Number>>([])
19
19
  const computeListPage = () => {
20
20
  listPage.value = []
21
21
  let firstPage =
22
- getAttribute(props.currentPage, 'paginate', 'currentPage') -
22
+ props.currentPage -
23
23
  getAttribute(props.numberSuggestPage, 'paginate', 'numberSuggestPage')
24
24
  const endPage =
25
- getAttribute(props.currentPage, 'paginate', 'currentPage') +
25
+ props.currentPage +
26
26
  (getAttribute(props.numberSuggestPage, 'paginate', 'numberSuggestPage') + 1)
27
27
 
28
28
  while (firstPage <= endPage) {
29
- if (
30
- firstPage > 0 &&
31
- firstPage <= getAttribute(props.lastPage, 'paginate', 'lastPage')
32
- )
29
+ if (firstPage > 0 && firstPage <= props.lastPage)
33
30
  listPage.value.push(firstPage)
34
31
  firstPage++
35
32
  }
36
33
  }
37
34
  computeListPage()
38
35
  watch(
39
- () => getAttribute(props.currentPage, 'paginate', 'currentPage'),
36
+ () => props.currentPage,
40
37
  () => computeListPage()
41
38
  )
42
39
 
43
40
  const arrowPrevious = () => {
44
- if (getAttribute(props.currentPage, 'paginate', 'currentPage') !== 1)
45
- emit(getAttribute(props.currentPage, 'paginate', 'currentPage') - 1)
41
+ if (props.currentPage !== 1) emit(props.currentPage - 1)
46
42
  }
47
43
  const arrowNext = () => {
48
- if (
49
- getAttribute(props.currentPage, 'paginate', 'currentPage') !==
50
- getAttribute(props.lastPage, 'paginate', 'lastPage')
51
- )
52
- emit(getAttribute(props.currentPage, 'paginate', 'currentPage') + 1)
44
+ if (props.currentPage !== props.lastPage) emit(props.currentPage + 1)
53
45
  }
54
46
  </script>
55
47
 
56
48
  <template>
57
49
  <div
58
- v-if="
59
- getAttribute(props.currentPage, 'paginate', 'currentPage') &&
60
- getAttribute(props.lastPage, 'paginate', 'lastPage') !== 1
61
- "
50
+ v-if="props.currentPage && props.lastPage !== 1"
62
51
  class="w-max glorious-paginate"
63
52
  :class="[`color-${getAttribute(props.color, 'paginate', 'color')}`]"
64
53
  >
65
54
  <div>
66
55
  <GIcon
67
- :color="
68
- getAttribute(props.currentPage, 'paginate', 'currentPage') !== 1
69
- ? '#000'
70
- : '#cbd5e1'
71
- "
56
+ :color="props.currentPage !== 1 ? '#000' : '#cbd5e1'"
72
57
  class="ml-2 cursor-pointer"
73
58
  name="glorious-arrow"
74
59
  :size="15"
@@ -79,23 +64,14 @@ const arrowNext = () => {
79
64
  v-for="(item, index) in listPage"
80
65
  :key="index"
81
66
  class="w-6 h-6 rounded-lg flex items-center justify-center paginate font-bold"
82
- :class="[
83
- getAttribute(props.currentPage, 'paginate', 'currentPage') === item
84
- ? 'active'
85
- : 'cursor-pointer',
86
- ]"
67
+ :class="[props.currentPage === item ? 'active' : 'cursor-pointer']"
87
68
  @click="emit(item)"
88
69
  >
89
70
  {{ item }}
90
71
  </div>
91
72
 
92
73
  <GIcon
93
- :color="
94
- getAttribute(props.currentPage, 'paginate', 'currentPage') !==
95
- getAttribute(props.lastPage, 'paginate', 'lastPage')
96
- ? '#000'
97
- : '#cbd5e1'
98
- "
74
+ :color="props.currentPage !== props.lastPage ? '#000' : '#cbd5e1'"
99
75
  name="glorious-arrow"
100
76
  class="mr-2 cursor-pointer"
101
77
  :size="15"
@@ -1,5 +1,6 @@
1
1
  <script lang="ts" setup>
2
2
  import _props from '../props/Switch'
3
+ import { getAttribute } from '../helper'
3
4
 
4
5
  const props = defineProps(_props)
5
6
  const modelValue = defineModel()
@@ -13,7 +14,7 @@ const input = (e: Event) => {
13
14
  <div>
14
15
  <label
15
16
  class="switch"
16
- :class="[`color-${props.color}`]"
17
+ :class="[`color-${getAttribute(props.color, 'switch', 'color')}`]"
17
18
  >
18
19
  <input
19
20
  type="checkbox"
@@ -26,10 +26,6 @@ export const hasValidationError = (errorProp) => {
26
26
  return condition;
27
27
  };
28
28
  export const getAttribute = (propsValue, componentName, prop) => {
29
- let mount = propsValue;
30
- if (import.meta.client) {
31
- const config = useRuntimeConfig();
32
- mount = config.public?.glorious?.components?.[componentName]?.props?.[prop] || propsValue;
33
- }
34
- return mount;
29
+ const config = useRuntimeConfig();
30
+ return config.public?.glorious?.components?.[componentName]?.props?.[prop] || propsValue;
35
31
  };
@@ -5,7 +5,8 @@ import {
5
5
  loading,
6
6
  loadingColor,
7
7
  to,
8
- ariaLabel
8
+ ariaLabel,
9
+ outline
9
10
  } from "./common/index.mjs";
10
11
  export default {
11
12
  ...color(),
@@ -15,9 +16,5 @@ export default {
15
16
  ...loadingColor,
16
17
  ...to,
17
18
  ...ariaLabel,
18
- outline: {
19
- required: false,
20
- default: false,
21
- type: Boolean
22
- }
19
+ ...outline()
23
20
  };
@@ -1,11 +1,8 @@
1
- import { name, hashColor, intSize, stroke } from "./common/index.mjs";
1
+ import { name, hashColor, intSize, stroke, hoverColor } from "./common/index.mjs";
2
2
  export default {
3
3
  ...name,
4
4
  ...hashColor,
5
5
  ...intSize(),
6
6
  ...stroke(),
7
- hoverColor: {
8
- required: false,
9
- default: ""
10
- }
7
+ ...hoverColor()
11
8
  };
@@ -81,6 +81,11 @@ declare const _default: {
81
81
  default: string;
82
82
  type: StringConstructor;
83
83
  };
84
+ keyOfValue: {
85
+ required: boolean;
86
+ default: string;
87
+ type: StringConstructor;
88
+ };
84
89
  required: {
85
90
  required: boolean;
86
91
  default: boolean;
@@ -9,6 +9,7 @@ import {
9
9
  options,
10
10
  required,
11
11
  displayTextKey,
12
+ keyOfValue,
12
13
  loading
13
14
  } from "./common/index.mjs";
14
15
  export default {
@@ -18,6 +19,7 @@ export default {
18
19
  ...size(),
19
20
  ...displayTextKey(),
20
21
  ...required(),
22
+ ...keyOfValue(),
21
23
  ...error,
22
24
  ...icon,
23
25
  ...disabled,
@@ -14,11 +14,6 @@ declare const _default: {
14
14
  default: string;
15
15
  type: StringConstructor;
16
16
  };
17
- rtl: {
18
- required: boolean;
19
- default: string;
20
- type: () => "rtl" | "ltr";
21
- };
22
17
  blur: {
23
18
  required: boolean;
24
19
  default: boolean;
@@ -17,11 +17,6 @@ export default {
17
17
  default: "",
18
18
  type: String
19
19
  },
20
- rtl: {
21
- required: false,
22
- default: "rtl",
23
- type: String
24
- },
25
20
  blur: {
26
21
  required: false,
27
22
  default: true,
@@ -1,11 +1,4 @@
1
- import {
2
- color,
3
- placeholder,
4
- title,
5
- error,
6
- disabled,
7
- required
8
- } from "./common/index.mjs";
1
+ import { color, placeholder, title, error, disabled, required } from "./common/index.mjs";
9
2
  export default {
10
3
  ...color(),
11
4
  ...placeholder(),
@@ -199,3 +199,16 @@ export declare const src: () => {
199
199
  type: StringConstructor;
200
200
  };
201
201
  };
202
+ export declare const hoverColor: () => {
203
+ hoverColor: {
204
+ required: boolean;
205
+ default: string;
206
+ };
207
+ };
208
+ export declare const outline: () => {
209
+ outline: {
210
+ required: boolean;
211
+ default: boolean;
212
+ type: BooleanConstructor;
213
+ };
214
+ };
@@ -185,3 +185,16 @@ export const src = () => ({
185
185
  type: String
186
186
  }
187
187
  });
188
+ export const hoverColor = () => ({
189
+ hoverColor: {
190
+ required: false,
191
+ default: ""
192
+ }
193
+ });
194
+ export const outline = () => ({
195
+ outline: {
196
+ required: false,
197
+ default: false,
198
+ type: Boolean
199
+ }
200
+ });
@@ -103,7 +103,7 @@ button:focus-visible {
103
103
  }
104
104
 
105
105
  .glorious-button {
106
- @apply rounded-md text-white px-3 relative;
106
+ @apply rounded-md text-white px-3 relative cursor-pointer;
107
107
  }
108
108
  .glorious-button div > loading {
109
109
  @apply flex justify-center items-center;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.0-develop-20",
2
+ "version": "2.0.0-develop-22",
3
3
  "name": "nuxt-glorious",
4
4
  "description": "This package provides many things needed by a project, including server requests and authentication, SEO and other requirements of a project.",
5
5
  "repository": "sajadhzj/nuxt-glorious",