@unsource/ui 1.5.6 → 1.6.0

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.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "unsource-ui",
3
3
  "configKey": "unsourceUi",
4
- "version": "1.5.6",
4
+ "version": "1.6.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -22,21 +22,32 @@ const module = defineNuxtModule({
22
22
  await installModule("@unocss/nuxt", {
23
23
  configFile: "./runtime/uno.config.{mjs,js,ts}"
24
24
  });
25
- await installModule("@nuxt/icon");
26
- await installModule("nuxt-swiper");
27
- _nuxt.options.modules.push(
28
- "@unocss/nuxt",
29
- "@nuxt/icon",
30
- "nuxt-swiper"
31
- );
32
- _nuxt.options.icon = {
25
+ await installModule("@nuxt/icon", {
33
26
  customCollections: [
34
27
  {
35
28
  prefix: "my-icon",
36
29
  dir: "./assets/icons"
37
30
  }
38
31
  ]
39
- };
32
+ });
33
+ await installModule("nuxt-swiper");
34
+ await installModule("nuxt-lodash", {
35
+ prefix: "_",
36
+ // prefixSkip: ["is"],
37
+ upperAfterPrefix: false,
38
+ exclude: [],
39
+ alias: [
40
+ // ["camelCase", "stringToCamelCase"], // => stringToCamelCase
41
+ // ["kebabCase", "stringToKebab"], // => stringToKebab
42
+ // ["isDate", "isLodashDate"], // => _isLodashDate
43
+ ]
44
+ });
45
+ _nuxt.options.modules.push(
46
+ "@unocss/nuxt",
47
+ "@nuxt/icon",
48
+ "nuxt-swiper",
49
+ "nuxt-lodash"
50
+ );
40
51
  }
41
52
  });
42
53
 
@@ -1,4 +1,4 @@
1
- export type CardCustomClass = Record<'main' | 'inside' | 'logoName' | 'name' | 'desc' | 'body' | 'logo' | 'slider' | 'sliderWrapper' | 'sliderSlides' | 'title' | 'titleText' | 'tags' | 'tag' | 'description' | 'footer' | 'image' | 'avatar', string>;
1
+ export type CardCustomClass = Record<'main' | 'inside' | 'logoName' | 'name' | 'desc' | 'body' | 'logo' | 'slider' | 'sliderWrapper' | 'sliderSlides' | 'title' | 'titleText' | 'tags' | 'tag' | 'description' | 'footer' | 'imagesItem' | 'image' | 'avatar', string>;
2
2
  export type CardItem = {
3
3
  title?: string;
4
4
  description?: string;
@@ -1,6 +1,7 @@
1
1
  <template>
2
2
  <component
3
3
  :is="to ? NuxtLink : 'div'"
4
+ name="card"
4
5
  class="flex items-stretch bg-white rounded-2xl overflow-hidden"
5
6
  :class="headerClass[direction]"
6
7
  no-prefetch
@@ -28,7 +29,11 @@
28
29
  }"
29
30
  >
30
31
  <template #default="{ item }">
31
- <div class="h-full self-stretch max-w-screen">
32
+ <div
33
+ name="imagesItem"
34
+ :class="customClass.imagesItem"
35
+ class="h-full self-stretch max-w-screen"
36
+ >
32
37
  <UnNuxtIcon
33
38
  :name="item"
34
39
  class="object-cover !w-full !h-full"
@@ -37,10 +42,12 @@
37
42
  </template>
38
43
  </UnSwiperSlider>
39
44
  <div
45
+ name="main"
40
46
  :class="customClass.main"
41
47
  class="flex flex-col items-stretch grow-2.5 basis-2.5"
42
48
  >
43
49
  <div
50
+ name="body"
44
51
  :class="customClass.body"
45
52
  class="flex gap-2 items-stretch p-3 grow"
46
53
  >
@@ -51,10 +58,12 @@
51
58
  class="!object-cover shrink-0 w-14 h-14 aspect-square rounded-full border-(2 solid primary-500)"
52
59
  />
53
60
  <div
61
+ name="inside"
54
62
  class="flex justify-start flex-col gap-1 grow-1"
55
63
  :class="customClass.inside"
56
64
  >
57
65
  <div
66
+ name="logoName"
58
67
  v-if="item.logo || item.name || item.desc"
59
68
  class="flex gap-2 items-center"
60
69
  :class="customClass.logoName"
@@ -65,8 +74,14 @@
65
74
  :name="item.logo"
66
75
  class="!object-cover shrink-0 w-14 h-14 aspect-square rounded-full border-(2 solid primary-500)"
67
76
  />
68
- <div v-if="item.name || item.desc" class="flex flex-col">
77
+ <div
78
+ name="nameDesc"
79
+ v-if="item.name || item.desc"
80
+ :class="customClass.nameDesc"
81
+ class="flex flex-col"
82
+ >
69
83
  <h3
84
+ name="name"
70
85
  v-if="item.name"
71
86
  :class="customClass.name"
72
87
  class="text-(lg gray-600) font-medium"
@@ -74,6 +89,7 @@
74
89
  {{ item.name }}
75
90
  </h3>
76
91
  <p
92
+ name="desc"
77
93
  v-if="item.desc"
78
94
  :class="customClass.desc"
79
95
  class="text-(base gray-500)"
@@ -87,11 +103,13 @@
87
103
  :item="item"
88
104
  />
89
105
  <div
106
+ name="title"
90
107
  v-if="$slots.title || item.title"
91
108
  class="flex justify-between"
92
109
  :class="customClass.title"
93
110
  >
94
111
  <h3
112
+ name="titleText"
95
113
  v-if="item.title"
96
114
  :class="customClass.titleText"
97
115
  class="text-(lg gray-600) font-medium"
@@ -104,6 +122,7 @@
104
122
  />
105
123
  </div>
106
124
  <p
125
+ name="description"
107
126
  v-if="item.description"
108
127
  :class="customClass.description"
109
128
  class="text-(base gray-500)"
@@ -111,11 +130,13 @@
111
130
  {{ item.description }}
112
131
  </p>
113
132
  <div
133
+ name="tags"
114
134
  v-if="item.tags?.length"
115
135
  :class="customClass.tags"
116
136
  class="flex items-center justify-start gap-2"
117
137
  >
118
138
  <UnChips
139
+ name="tag"
119
140
  v-for="(tag, index) in item.tags"
120
141
  :key="index"
121
142
  :class="customClass.tag"
@@ -137,6 +158,7 @@
137
158
  />
138
159
  </div>
139
160
  <div
161
+ name="footer"
140
162
  v-if="$slots.footerStart || $slots.footerEnd"
141
163
  :class="customClass.footer"
142
164
  class="flex justify-between items-stretch border-t-(2 dashed border) p-3"
@@ -1,4 +1,4 @@
1
- export type CardCustomClass = Record<'main' | 'inside' | 'logoName' | 'name' | 'desc' | 'body' | 'logo' | 'slider' | 'sliderWrapper' | 'sliderSlides' | 'title' | 'titleText' | 'tags' | 'tag' | 'description' | 'footer' | 'image' | 'avatar', string>;
1
+ export type CardCustomClass = Record<'main' | 'inside' | 'logoName' | 'name' | 'desc' | 'body' | 'logo' | 'slider' | 'sliderWrapper' | 'sliderSlides' | 'title' | 'titleText' | 'tags' | 'tag' | 'description' | 'footer' | 'imagesItem' | 'image' | 'avatar', string>;
2
2
  export type CardItem = {
3
3
  title?: string;
4
4
  description?: string;
@@ -2,15 +2,26 @@ import type { CardCustomClass, CardItem } from './UnCard.vue.js';
2
2
  type __VLS_Props = {
3
3
  title?: string;
4
4
  items?: CardItem[];
5
- customClass?: Record<'main' | 'title' | 'header' | 'items', unknown> & {
5
+ customClass?: Record<'main' | 'title' | 'header' | 'items' | 'collapsibleIcon', unknown> & {
6
6
  item?: CardCustomClass;
7
7
  };
8
+ collapsible?: boolean;
9
+ collapsibleIcon?: string;
10
+ noRotate?: boolean;
8
11
  };
9
- declare var __VLS_1: {};
12
+ type __VLS_ModelProps = {
13
+ 'show'?: boolean;
14
+ };
15
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
16
+ declare var __VLS_6: {};
10
17
  type __VLS_Slots = {} & {
11
- default?: (props: typeof __VLS_1) => any;
18
+ default?: (props: typeof __VLS_6) => any;
12
19
  };
13
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
+ "update:show": (value: boolean | undefined) => any;
22
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
+ "onUpdate:show"?: ((value: boolean | undefined) => any) | undefined;
24
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
25
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
26
  declare const _default: typeof __VLS_export;
16
27
  export default _default;
@@ -4,8 +4,12 @@
4
4
  class="flex flex-col p-3 bg-white rounded-2xl gap-4"
5
5
  >
6
6
  <div
7
- :class="customClass?.header"
7
+ :class="[
8
+ customClass?.header,
9
+ { 'cursor-pointer': collapsible }
10
+ ]"
8
11
  class="flex items-center justify-between"
12
+ @click="collapsible ? show = !show : ''"
9
13
  >
10
14
  <p
11
15
  v-if="title"
@@ -14,22 +18,36 @@
14
18
  >
15
19
  {{ title }}
16
20
  </p>
21
+ <UnNuxtIcon
22
+ v-if="collapsible"
23
+ :class="customClass?.collapsibleIcon"
24
+ :name="collapsibleIcon || 'solar:alt-arrow-down-bold-duotone'"
25
+ class="transition-all duration-300"
26
+ :style="{ rotate: show && !noRotate ? '180deg' : '0deg' }"
27
+ />
17
28
  <slot />
18
29
  </div>
19
- <UnCard
20
- v-for="(item, index) in items"
21
- :key="index"
22
- :class="customClass.items"
23
- :custom-class="customClass.item"
24
- :item="item"
25
- />
30
+ <template v-if="show">
31
+ <UnCard
32
+ v-for="(item, index) in items"
33
+ :key="index"
34
+ :class="customClass.items"
35
+ :custom-class="customClass.item"
36
+ :item="item"
37
+ />
38
+ </template>
26
39
  </div>
27
40
  </template>
28
41
 
29
42
  <script setup>
30
- const { customClass = {} } = defineProps({
43
+ const { customClass = {}, collapsible = false } = defineProps({
31
44
  title: { type: String, required: false },
32
45
  items: { type: Array, required: false },
33
- customClass: { type: Object, required: false }
46
+ customClass: { type: Object, required: false },
47
+ collapsible: { type: Boolean, required: false },
48
+ collapsibleIcon: { type: String, required: false },
49
+ noRotate: { type: Boolean, required: false }
34
50
  });
51
+ const show = defineModel("show", { type: Boolean });
52
+ show.value ||= !collapsible;
35
53
  </script>
@@ -2,15 +2,26 @@ import type { CardCustomClass, CardItem } from './UnCard.vue.js';
2
2
  type __VLS_Props = {
3
3
  title?: string;
4
4
  items?: CardItem[];
5
- customClass?: Record<'main' | 'title' | 'header' | 'items', unknown> & {
5
+ customClass?: Record<'main' | 'title' | 'header' | 'items' | 'collapsibleIcon', unknown> & {
6
6
  item?: CardCustomClass;
7
7
  };
8
+ collapsible?: boolean;
9
+ collapsibleIcon?: string;
10
+ noRotate?: boolean;
8
11
  };
9
- declare var __VLS_1: {};
12
+ type __VLS_ModelProps = {
13
+ 'show'?: boolean;
14
+ };
15
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
16
+ declare var __VLS_6: {};
10
17
  type __VLS_Slots = {} & {
11
- default?: (props: typeof __VLS_1) => any;
18
+ default?: (props: typeof __VLS_6) => any;
12
19
  };
13
- declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
20
+ declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
21
+ "update:show": (value: boolean | undefined) => any;
22
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
23
+ "onUpdate:show"?: ((value: boolean | undefined) => any) | undefined;
24
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
25
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
15
26
  declare const _default: typeof __VLS_export;
16
27
  export default _default;
@@ -0,0 +1,25 @@
1
+ export type TabItem = {
2
+ icon?: string;
3
+ value: string;
4
+ title?: string;
5
+ to?: Record<string, unknown>;
6
+ };
7
+ type __VLS_Props = {
8
+ items: TabItem[];
9
+ mini?: boolean;
10
+ routable?: boolean;
11
+ routeTarget?: 'query' | 'hash' | 'name' | 'params';
12
+ label?: string;
13
+ customClass?: Partial<Record<'label' | 'selectedLabel' | 'normalLabel' | 'title' | 'icon', string>>;
14
+ };
15
+ type __VLS_ModelProps = {
16
+ modelValue?: string | number;
17
+ };
18
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
19
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ "update:modelValue": (value: string | number | undefined) => any;
21
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
+ "onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
23
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const _default: typeof __VLS_export;
25
+ export default _default;
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <div class="flex items-stretch text-(base gray-600) font-semibold bg-transparent h-13">
3
+ <label
4
+ v-for="item in items"
5
+ :key="item.value"
6
+ :class="[customClass.label, item?.value === value ? customClass.selectedLabel : customClass.normalLabel, item?.value === value ? 'text-primary cursor-default border-b-(2 primary)' : 'border-b-(1 border)', mini ? 'px-3' : ' px-4']"
7
+ class="flex gap-2 justify-center items-center flex-grow basis-1 border-b-(solid) cursor-pointer p-3 text-sm"
8
+ @click="addToQuery(item)"
9
+ >
10
+ <input
11
+ v-model="value"
12
+ type="radio"
13
+ :value="item.value"
14
+ hidden
15
+ >
16
+ <UnNuxtIcon
17
+ :class="customClass.icon"
18
+ :name="item.icon"
19
+ />
20
+ <span
21
+ :class="customClass.title"
22
+ class="whitespace-nowrap"
23
+ >
24
+ {{ item.title || item.value }}
25
+ </span>
26
+ </label>
27
+ </div>
28
+ </template>
29
+
30
+ <script setup>
31
+ import { _merge, useRoute, useRouter } from "#imports";
32
+ const { customClass = {}, label, routeTarget, routable } = defineProps({
33
+ items: { type: Array, required: true },
34
+ mini: { type: Boolean, required: false },
35
+ routable: { type: Boolean, required: false },
36
+ routeTarget: { type: String, required: false },
37
+ label: { type: String, required: false },
38
+ customClass: { type: Object, required: false }
39
+ });
40
+ const value = defineModel({ type: [String, Number] });
41
+ const route = useRoute();
42
+ const router = useRouter();
43
+ const addToQuery = (i) => {
44
+ value.value = i.value;
45
+ if (routable) {
46
+ if (i.to) {
47
+ router.replace(i.to);
48
+ } else if (routeTarget) {
49
+ const q = _merge(route, {
50
+ [routeTarget]: label ? { [label]: i.value } : `${routeTarget === "hash" ? "#" : ""}${i.value}`
51
+ });
52
+ router.replace(q);
53
+ }
54
+ }
55
+ };
56
+ </script>
@@ -0,0 +1,25 @@
1
+ export type TabItem = {
2
+ icon?: string;
3
+ value: string;
4
+ title?: string;
5
+ to?: Record<string, unknown>;
6
+ };
7
+ type __VLS_Props = {
8
+ items: TabItem[];
9
+ mini?: boolean;
10
+ routable?: boolean;
11
+ routeTarget?: 'query' | 'hash' | 'name' | 'params';
12
+ label?: string;
13
+ customClass?: Partial<Record<'label' | 'selectedLabel' | 'normalLabel' | 'title' | 'icon', string>>;
14
+ };
15
+ type __VLS_ModelProps = {
16
+ modelValue?: string | number;
17
+ };
18
+ type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
19
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
20
+ "update:modelValue": (value: string | number | undefined) => any;
21
+ }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
22
+ "onUpdate:modelValue"?: ((value: string | number | undefined) => any) | undefined;
23
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ declare const _default: typeof __VLS_export;
25
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unsource/ui",
3
- "version": "1.5.6",
3
+ "version": "1.6.0",
4
4
  "private": false,
5
5
  "description": "nuxt ui kit for unsource env",
6
6
  "repository": "https://github.com/alisa2142/unsource-ui",
@@ -37,6 +37,7 @@
37
37
  "dependencies": {
38
38
  "@neshan-maps-platform/vue3-openlayers": "^2.0.1",
39
39
  "@nuxt/kit": "^4.1.3",
40
+ "nuxt-lodash": "^2.5.3",
40
41
  "nuxt-swiper": "^1.2.2",
41
42
  "swiper": "^11.2.10",
42
43
  "unocss-preset-scrollbar": "^3.2.0"
@@ -1,15 +0,0 @@
1
- declare const _default: typeof __VLS_export;
2
- export default _default;
3
- declare const __VLS_export: import("vue").DefineComponent<{}, {
4
- $props: Partial<typeof props>;
5
- mini: boolean;
6
- items: unknown[];
7
- routable: boolean;
8
- label?: string | undefined;
9
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
10
- declare const props: {
11
- readonly mini: boolean;
12
- readonly items: unknown[];
13
- readonly routable: boolean;
14
- readonly label?: string | undefined;
15
- };
@@ -1,47 +0,0 @@
1
- <template>
2
- <div class="flex items-stretch text-(base gray-600) font-semibold bg-transparent p-1 h-13">
3
- <label v-for="item in items"
4
- :class="[[item?.value === ( value ) ? 'text-primary-500 cursor-default border-primary-500 border-2' : 'border-1 border-gray-400' ] , [mini ? 'px-3' : ' px-4']]"
5
- class="flex justify-center items-center flex-grow basis-1 border-b-(solid) cursor-pointer p-3 text-sm"
6
- @click="addToQuery(item.key , item.value)">
7
- <input v-model="value" type="radio" :value="item.value" hidden>
8
- <span class="whitespace-nowrap">
9
- {{ item.label }}
10
- </span>
11
- </label>
12
- </div>
13
- </template>
14
-
15
- <script setup>
16
- const props = defineProps({
17
- items: {
18
- type: Array,
19
- required: true
20
- },
21
- mini: {
22
- type: Boolean,
23
- default: false
24
- },
25
- routable: {
26
- type: Boolean,
27
- default: true
28
- },
29
- label: {
30
- type: String
31
- }
32
- });
33
- const value = defineModel();
34
- const route = useRoute();
35
- const router = useRouter();
36
- const addToQuery = (key, v) => {
37
- value.value = v;
38
- if (props.routable) {
39
- router.replace({
40
- query: {
41
- ...route.query,
42
- [props.label]: v
43
- }
44
- });
45
- }
46
- };
47
- </script>
@@ -1,15 +0,0 @@
1
- declare const _default: typeof __VLS_export;
2
- export default _default;
3
- declare const __VLS_export: import("vue").DefineComponent<{}, {
4
- $props: Partial<typeof props>;
5
- mini: boolean;
6
- items: unknown[];
7
- routable: boolean;
8
- label?: string | undefined;
9
- }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
10
- declare const props: {
11
- readonly mini: boolean;
12
- readonly items: unknown[];
13
- readonly routable: boolean;
14
- readonly label?: string | undefined;
15
- };