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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.0-develop-32",
2
+ "version": "2.0.0-develop-34",
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",
@@ -21,14 +21,15 @@
21
21
  "dist"
22
22
  ],
23
23
  "scripts": {
24
- "prepack": "bash load-style.sh && nuxt-module-build build",
24
+ "prepack": "nuxt-module-build build",
25
25
  "dev": "nuxi dev --port=3001 playground",
26
26
  "dev:build": "nuxi build playground",
27
27
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
28
28
  "release": "npm run prepack && npm publish",
29
29
  "lint": "eslint .",
30
30
  "test": "vitest run",
31
- "test:watch": "vitest watch"
31
+ "test:watch": "vitest watch",
32
+ "style": "sass src/styles/glorious.scss playground/assets/css/glorious.css --watch"
32
33
  },
33
34
  "dependencies": {
34
35
  "@nuxt/image": "^1.8.1",
@@ -1,43 +0,0 @@
1
- <script lang="ts" setup>
2
- import _props from '../props/Button'
3
- import { getAttribute } from '../helper'
4
-
5
- const props: any = defineProps(_props)
6
- </script>
7
-
8
- <template>
9
- <button
10
- v-if="props.to === ''"
11
- :aria-label="props.ariaLabel"
12
- :class="[
13
- `glorious-button`,
14
- `button-color-${getAttribute(props.color, 'button', 'color')}`,
15
- `size-${getAttribute(props.size, 'button', 'size')}`,
16
- getAttribute(props.outline, 'button', 'outline') ? 'outline' : '',
17
- ]"
18
- :disabled="getAttribute(props.disabled, 'button', 'disable')"
19
- >
20
- <div
21
- v-if="getAttribute(props.loading, 'button', 'loading')"
22
- class="loading flex justify-center"
23
- >
24
- <GLoading
25
- :color="getAttribute(props.loadingColor, 'button', 'loadingColor')"
26
- />
27
- </div>
28
- <slot v-else />
29
- </button>
30
- <NuxtLink
31
- v-else
32
- :to="props.to"
33
- :class="[
34
- `glorious-button`,
35
- `button-color-${getAttribute(props.color, 'button', 'color')}`,
36
- `size-${getAttribute(props.size, 'button', 'size')}`,
37
- getAttribute(props.outline, 'button', 'outline') ? 'outline' : '',
38
- ]"
39
- :disabled="getAttribute(props.disabled, 'button', 'disable')"
40
- >
41
- <slot />
42
- </NuxtLink>
43
- </template>
@@ -1,28 +0,0 @@
1
- <script lang="ts" setup>
2
- import _props from '../props/CheckBox'
3
- import { getAttribute } from '../helper'
4
-
5
- const props: any = defineProps(_props)
6
- const model = defineModel()
7
- const inputFunction = (event: any) => (model.value = event.target.checked)
8
-
9
- model.value = props.checked
10
- </script>
11
-
12
- <template>
13
- <label
14
- class="glorious-checkbox"
15
- :class="[
16
- `color-${getAttribute(props.color, 'checkbox', 'color')}`,
17
- `size-${getAttribute(props.size, 'checkbox', 'size')}`,
18
- ]"
19
- >
20
- <input
21
- type="checkbox"
22
- :checked="getAttribute(props.checked, 'checkbox', 'checked')"
23
- :disabled="getAttribute(props.disabled, 'checkbox', 'disable')"
24
- @input="inputFunction($event)"
25
- />
26
- <div></div>
27
- </label>
28
- </template>
@@ -1,280 +0,0 @@
1
- <script setup lang="ts">
2
- import { computed, ref, watch, useGloriousCore } from '#imports'
3
- import { hasValidationError, getAttribute } from '../helper'
4
- import _props from '../props/Input'
5
-
6
- const props: any = defineProps(_props)
7
- const modelValue: any = defineModel()
8
- const { numbersWithSeparateSamePrice } = useGloriousCore()
9
- modelValue.value = ''
10
- const inputValue: any = ref(null)
11
-
12
- watch(
13
- () => inputValue.value,
14
- () => {
15
- if (getAttribute(props.mode, 'input', 'mode') === 'tag') return
16
-
17
- switch (getAttribute(props.display, 'input', 'display')) {
18
- case 'price':
19
- inputValue.value = numbersWithSeparateSamePrice(inputValue.value)
20
- modelValue.value = inputValue.value.toString().replaceAll(',', '')
21
- break
22
- default:
23
- modelValue.value = inputValue.value
24
- break
25
- }
26
- }
27
- )
28
-
29
- const computeIconSize = computed(() => {
30
- let iconSize = 0
31
-
32
- switch (props.size) {
33
- case 'xl':
34
- iconSize = 30
35
- break
36
- case 'lg':
37
- iconSize = 27
38
- break
39
- case 'md':
40
- iconSize = 25
41
- break
42
- case 'sm':
43
- iconSize = 23
44
- break
45
- case 'xs':
46
- iconSize = 20
47
- break
48
- default:
49
- iconSize = 30
50
- break
51
- }
52
-
53
- return iconSize
54
- })
55
-
56
- // ------------------------------------------------------------------------------------------------ TAG
57
- const tags: any = ref([])
58
-
59
- const addTag = (event: any) => {
60
- if (getAttribute(props.tagLockOption, 'input', 'tagLockOption')) return
61
-
62
- if (tags.value.length === 0) tags.value = []
63
-
64
- if (getAttribute(props.mode, 'input', 'mode') !== 'tag') return
65
- const value: any = event.target.value
66
- tags.value.push(value)
67
- modelValue.value = tags.value
68
- inputValue.value = ''
69
- }
70
-
71
- const isSelected = (value: any): boolean => {
72
- if (typeof tags.value !== 'object' && typeof modelValue.value !== 'object')
73
- return false
74
-
75
- return (
76
- tags.value.some((item: any) => item[props.keyOfValue] === value) ||
77
- (typeof modelValue.value === 'object' &&
78
- modelValue.value.some((item: any) => item[props.keyOfValue] === value))
79
- )
80
- }
81
- const addTagViaOption = (option: any, event: any) => {
82
- if (event.currentTarget.classList.contains('disabled')) {
83
- event.stopPropagation()
84
- }
85
- // event.stopPropagation() if want not close with window
86
- if (
87
- typeof tags.value === 'string' ||
88
- typeof tags.value === 'undefined' ||
89
- tags.value.length === 0
90
- )
91
- tags.value = []
92
-
93
- if (!isSelected(option.value)) {
94
- const value: any = option
95
- tags.value.push(value)
96
- modelValue.value = tags.value
97
- inputValue.value = ''
98
- }
99
- }
100
-
101
- const removeTag = (tag: string) => {
102
- tags.value = tags.value.filter((item: any) => item !== tag)
103
- modelValue.value = tags.value
104
- }
105
-
106
- // -------------------------------------- init value
107
- const initValue = () => {
108
- if (getAttribute(props.mode, 'input', 'mode') === 'tag') {
109
- tags.value = modelValue.value
110
- return
111
- }
112
-
113
- inputValue.value = modelValue.value
114
- }
115
- initValue()
116
- watch(
117
- () => modelValue.value,
118
- () => initValue()
119
- )
120
-
121
- const typeInput = ref(getAttribute(props.type, 'input', 'type'))
122
-
123
- const inputClicked = (event: any) => {
124
- if (getAttribute(props.mode, 'input', 'mode') === 'tag' && props.options) {
125
- const gio = document.querySelectorAll('.glorious-input-options')
126
- gio.forEach((element: any) => element.classList.add('hidden'))
127
-
128
- const optionsElement = event.currentTarget.parentElement.children[1]
129
- if (
130
- typeof optionsElement !== 'undefined' &&
131
- optionsElement.classList.contains('hidden')
132
- )
133
- optionsElement.classList.remove('hidden')
134
- }
135
- }
136
- </script>
137
-
138
- <template>
139
- <div class="flex flex-col">
140
- <span class="glorious-title text-sm font-medium text-gray-500">
141
- {{ getAttribute(props.title, 'input', 'title') }}
142
- <span
143
- v-if="getAttribute(props.required, 'input', 'required')"
144
- class="text-red-500"
145
- >
146
- *
147
- </span>
148
- </span>
149
-
150
- <div
151
- class="glorious-input"
152
- :class="[
153
- props.icon !== '' ? `icon-${props.size}` : '',
154
- hasValidationError(props.error) ? 'validation-error' : '',
155
- ]"
156
- >
157
- <div class="relative">
158
- <input
159
- v-model="inputValue"
160
- :inputmode="getAttribute(props.inputMode, 'input', 'inputMode')"
161
- :autocomplete="
162
- getAttribute(props.autocomplete, 'input', 'autocomplete')
163
- "
164
- class="w-full glorious-input-field"
165
- :class="[
166
- `size-${props.size}`,
167
- `glorious-input-${getAttribute(props.color, 'input', 'color')}`,
168
- getAttribute(props.type, 'input', 'type') === 'password'
169
- ? 'pl-[30px] pr-3'
170
- : 'px-3',
171
- `mode-${getAttribute(props.mode, 'input', 'mode')}`,
172
- ]"
173
- :placeholder="getAttribute(props.placeholder, 'input', 'placeholder')"
174
- :disabled="getAttribute(props.disable, 'input', 'disable')"
175
- :type="typeInput"
176
- @keyup.enter="addTag($event)"
177
- @click="inputClicked($event)"
178
- />
179
- <GIcon
180
- v-if="
181
- getAttribute(props.type, 'input', 'type') === 'password' &&
182
- typeInput === 'password'
183
- "
184
- class="absolute left-0 top-0 bottom-0 my-auto ml-1 cursor-pointer"
185
- :size="23"
186
- name="glorious-eye-fill"
187
- @click="typeInput = 'text'"
188
- ></GIcon>
189
- <GIcon
190
- v-if="
191
- getAttribute(props.type, 'input', 'type') === 'password' &&
192
- typeInput === 'text'
193
- "
194
- class="absolute left-0 top-0 bottom-0 my-auto ml-1 cursor-pointer"
195
- :size="23"
196
- name="glorious-eye-off-fill"
197
- @click="typeInput = 'password'"
198
- ></GIcon>
199
-
200
- <div
201
- class="glorious-input-options hidden"
202
- :class="[`size-${props.size}`]"
203
- >
204
- <div
205
- v-if="getAttribute(props.loading, 'input', 'loading')"
206
- class="flex justify-center"
207
- >
208
- <GLoading color="green" />
209
- </div>
210
- <div v-else>
211
- <div
212
- v-if="props.options.length === 0"
213
- class="text-center"
214
- >
215
- {{ props.noItemsFound }}
216
- </div>
217
- <div
218
- v-for="(option, index) in props.options"
219
- :key="index"
220
- @click="addTagViaOption(option, $event)"
221
- :class="[isSelected(option[props.keyOfValue]) ? 'disabled' : '']"
222
- >
223
- <slot
224
- name="option"
225
- :item="option"
226
- ></slot>
227
- {{
228
- option[
229
- getAttribute(props.displayTextKey, 'input', 'displayTextKey')
230
- ]
231
- }}
232
- </div>
233
- </div>
234
- </div>
235
- </div>
236
- <div
237
- v-if="tags?.length !== 0"
238
- class="glorious-input-tag"
239
- >
240
- <div
241
- v-for="(item, index) in tags"
242
- :key="index"
243
- >
244
- <slot
245
- name="option"
246
- :item="item"
247
- ></slot>
248
- {{
249
- typeof item === 'object'
250
- ? item[
251
- getAttribute(props.displayTextKey, 'input', 'displayTextKey')
252
- ]
253
- : item
254
- }}
255
- <div class="glorious-input-tag-delete-option">
256
- <GIcon
257
- name="glorious-x"
258
- :size="10"
259
- color="#ff0000"
260
- @click="removeTag(item)"
261
- />
262
- </div>
263
- </div>
264
- </div>
265
- <GIcon
266
- v-if="props.icon !== ''"
267
- class="glorious-input-icon"
268
- :name="props.icon"
269
- :size="computeIconSize"
270
- />
271
- <div
272
- v-if="getAttribute(props.loading, 'input', 'loading')"
273
- class="absolute top-1 bottom-0 my-auto left-1"
274
- >
275
- <GLoading color="green" />
276
- </div>
277
- </div>
278
- <GErrorText :error="props.error" />
279
- </div>
280
- </template>
@@ -1,22 +0,0 @@
1
- <script setup lang="ts">
2
- import _props from '../props/Loading'
3
- import { getAttribute } from '../helper'
4
-
5
- const props: any = defineProps(_props)
6
- </script>
7
-
8
- <template>
9
- <div class="inline">
10
- <div
11
- class="glorious-loading"
12
- :style="{
13
- width: `${getAttribute(props.size, 'loading', 'size')}px`,
14
- border: `${getAttribute(
15
- props.stroke,
16
- 'icon',
17
- 'stroke'
18
- )}px solid ${getAttribute(props.color, 'loading', 'color')}`,
19
- }"
20
- />
21
- </div>
22
- </template>
@@ -1,52 +0,0 @@
1
- declare const _default: {
2
- outline: {
3
- required: boolean;
4
- default: boolean;
5
- type: BooleanConstructor;
6
- };
7
- ariaLabel: {
8
- required: boolean;
9
- default: string;
10
- type: StringConstructor;
11
- };
12
- to: {
13
- required: boolean;
14
- default: string;
15
- type: StringConstructor;
16
- };
17
- loadingColor: {
18
- required: boolean;
19
- default: string;
20
- type: () => import("../../../types").colors | string;
21
- };
22
- loading: {
23
- required: boolean;
24
- default: boolean;
25
- type: BooleanConstructor;
26
- };
27
- loadingOption: {
28
- required: boolean;
29
- default: {
30
- color: string;
31
- };
32
- type: {
33
- color: StringConstructor;
34
- };
35
- };
36
- disabled: {
37
- required: boolean;
38
- default: boolean;
39
- type: BooleanConstructor;
40
- };
41
- size: {
42
- required: boolean;
43
- default: import("../../../types").sizes;
44
- type: () => import("../../../types").sizes;
45
- };
46
- color: {
47
- required: boolean;
48
- default: string;
49
- type: () => import("../../../types").colors | string;
50
- };
51
- };
52
- export default _default;
@@ -1,20 +0,0 @@
1
- import {
2
- color,
3
- size,
4
- disabled,
5
- loading,
6
- loadingColor,
7
- to,
8
- ariaLabel,
9
- outline
10
- } from "./common/index.mjs";
11
- export default {
12
- ...color(),
13
- ...size(),
14
- ...disabled,
15
- ...loading,
16
- ...loadingColor,
17
- ...to,
18
- ...ariaLabel,
19
- ...outline()
20
- };
@@ -1,125 +0,0 @@
1
- declare const _default: {
2
- type: {
3
- required: boolean;
4
- default: string;
5
- type: () => "button" | "checkbox" | "color" | "date" | "email" | "file" | "hidden" | "password" | "radio" | "range" | "tel" | "text" | "url" | "number";
6
- };
7
- autocomplete: {
8
- required: boolean;
9
- default: string;
10
- type: () => "off" | "on" | "new-password";
11
- };
12
- display: {
13
- required: boolean;
14
- default: string;
15
- type: () => "price";
16
- };
17
- inputMode: {
18
- required: boolean;
19
- default: string;
20
- type: () => "text" | "none" | "decimal" | "numeric" | "tel" | "search" | "email" | "url";
21
- };
22
- mode: {
23
- required: boolean;
24
- default: string;
25
- type: () => "normal" | "tag";
26
- };
27
- tagLockOption: {
28
- required: boolean;
29
- default: boolean;
30
- type: BooleanConstructor;
31
- };
32
- noItemsFound: {
33
- required: boolean;
34
- default: string;
35
- type: StringConstructor;
36
- };
37
- loading: {
38
- required: boolean;
39
- default: boolean;
40
- type: BooleanConstructor;
41
- };
42
- loadingOption: {
43
- required: boolean;
44
- default: {
45
- color: string;
46
- };
47
- type: {
48
- color: StringConstructor;
49
- };
50
- };
51
- options: {
52
- required: boolean;
53
- default: never[];
54
- type: {
55
- (arrayLength: number): object[];
56
- (...items: object[]): object[];
57
- new (arrayLength: number): object[];
58
- new (...items: object[]): object[];
59
- isArray(arg: any): arg is any[];
60
- readonly prototype: any[];
61
- from<T>(arrayLike: ArrayLike<T>): T[];
62
- from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
63
- from<T>(iterable: Iterable<T> | ArrayLike<T>): T[];
64
- from<T, U>(iterable: Iterable<T> | ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): U[];
65
- of<T>(...items: T[]): T[];
66
- readonly [Symbol.species]: ArrayConstructor;
67
- };
68
- };
69
- loadingOptions: {
70
- required: boolean;
71
- default: boolean;
72
- type: BooleanConstructor;
73
- };
74
- disabled: {
75
- required: boolean;
76
- default: boolean;
77
- type: BooleanConstructor;
78
- };
79
- icon: {
80
- required: boolean;
81
- default: string;
82
- type: StringConstructor;
83
- };
84
- error: {
85
- required: boolean;
86
- default: string;
87
- type: StringConstructor;
88
- };
89
- keyOfValue: {
90
- required: boolean;
91
- default: string;
92
- type: StringConstructor;
93
- };
94
- required: {
95
- required: boolean;
96
- default: boolean;
97
- type: BooleanConstructor;
98
- };
99
- displayTextKey: {
100
- required: boolean;
101
- default: string;
102
- type: StringConstructor;
103
- };
104
- size: {
105
- required: boolean;
106
- default: import("../../../types").sizes;
107
- type: () => import("../../../types").sizes;
108
- };
109
- title: {
110
- required: boolean;
111
- default: string;
112
- type: StringConstructor;
113
- };
114
- placeholder: {
115
- required: boolean;
116
- default: string;
117
- type: StringConstructor;
118
- };
119
- color: {
120
- required: boolean;
121
- default: string;
122
- type: () => import("../../../types").colors | string;
123
- };
124
- };
125
- export default _default;
@@ -1,60 +0,0 @@
1
- import {
2
- color,
3
- placeholder,
4
- title,
5
- size,
6
- error,
7
- icon,
8
- disabled,
9
- options,
10
- required,
11
- displayTextKey,
12
- keyOfValue,
13
- loading,
14
- noItemsFound
15
- } from "./common/index.mjs";
16
- export default {
17
- ...color(),
18
- ...placeholder(),
19
- ...title(),
20
- ...size(),
21
- ...displayTextKey(),
22
- ...required(),
23
- ...keyOfValue(),
24
- ...error,
25
- ...icon,
26
- ...disabled,
27
- ...options,
28
- ...loading,
29
- ...noItemsFound(),
30
- type: {
31
- required: false,
32
- default: "text",
33
- type: String
34
- },
35
- autocomplete: {
36
- required: false,
37
- default: "off",
38
- type: String
39
- },
40
- display: {
41
- required: false,
42
- default: "",
43
- type: String
44
- },
45
- inputMode: {
46
- required: false,
47
- default: "text",
48
- type: String
49
- },
50
- mode: {
51
- required: false,
52
- default: "normal",
53
- type: String
54
- },
55
- tagLockOption: {
56
- required: false,
57
- default: false,
58
- type: Boolean
59
- }
60
- };