spoko-design-system 0.2.45 → 0.2.46

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/index.ts CHANGED
@@ -16,6 +16,14 @@ export { default as FeaturesList } from './src/components/FeaturesList.vue';
16
16
  export { default as ProductCodes } from './src/components/ProductCodes.vue';
17
17
  export { default as ProductEngineType } from './src/components/Product/ProductEngineType.vue';
18
18
  export { default as ProductButton } from './src/components/Product/ProductButton.vue';
19
+ export { default as ProductColors } from './src/components/Product/ProductColors.vue';
20
+ export { default as ProductDetailName } from './src/components/Product/ProductDetailName.vue';
21
+ export { default as ProductDetails } from './src/components/Product/ProductDetails.vue';
22
+ export { default as ProductDoc } from './src/components/Product/ProductDoc.vue';
23
+ export { default as ProductModel } from './src/components/Product/ProductModel.vue';
24
+ export { default as ProductModels } from './src/components/Product/ProductModels.vue';
25
+ export { default as ProductName } from './src/components/Product/ProductName.vue';
26
+ export { default as ProductPositions } from './src/components/Product/ProductPositions.vue';
19
27
 
20
28
  export { default as CategoryLink } from './src/components/Category/CategoryLink.vue';
21
29
  export { default as CategorySidebarToggler } from './src/components/Category/CategorySidebarToggler.vue';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spoko-design-system",
3
- "version": "0.2.45",
3
+ "version": "0.2.46",
4
4
  "private": false,
5
5
  "main": "./index.ts",
6
6
  "module": "./index.ts",
@@ -1,5 +1,5 @@
1
1
  ---
2
- import CategorySidebarToggler from "@components/Category/CategorySidebarToggler.vue";
2
+ import CategorySidebarToggler from '@components/Category/CategorySidebarToggler.vue';
3
3
  import { Icon } from 'astro-icon/components';
4
4
  const { category, subcategory, subtitle, subsubtitle, titleSmall, locale } = Astro.props;
5
5
  import { t } from "i18next";
@@ -0,0 +1,42 @@
1
+ <script lang="ts" setup>
2
+ import type { PropType } from 'vue'
3
+
4
+ const props = defineProps({
5
+ colors: {
6
+ type: Object as PropType<{id: number, slug: string, name: string}[]>,
7
+ default: null,
8
+ required: true,
9
+ },
10
+ small: {
11
+ type: Boolean,
12
+ required: false,
13
+ },
14
+ isPdp: {
15
+ type: Boolean,
16
+ required: false,
17
+ default: false,
18
+ },
19
+ filterName: {
20
+ type: String,
21
+ required: false,
22
+ default: 'Color'
23
+ }
24
+ })
25
+
26
+ </script>
27
+
28
+ <template>
29
+ <span v-for="(color, index) in colors" :key="index" class="product-color" :data-pagefind-filter="filterName">
30
+ {{ color.name }}
31
+ </span>
32
+ </template>
33
+
34
+ <style lang="scss">
35
+ .product-color:not(:last-child) {
36
+ @apply mr-1;
37
+
38
+ &:after {
39
+ content: ','
40
+ }
41
+ }
42
+ </style>
@@ -0,0 +1,22 @@
1
+ <script lang="ts" setup>
2
+ const props = defineProps({
3
+ text: {
4
+ type: String,
5
+ default: '',
6
+ required: true,
7
+ },
8
+ styles: {
9
+ type: String,
10
+ default: '',
11
+ required: false,
12
+ }
13
+ })
14
+ </script>
15
+
16
+ <template>
17
+ <div class="font-bold detail-name w-full sm:w-50 flex">
18
+ <span class="colon-after" :class="styles && styles.length ? styles : 'mt-auto'">
19
+ {{ props.text }}
20
+ </span>
21
+ </div>
22
+ </template>
@@ -0,0 +1,99 @@
1
+ <script lang="ts" setup>
2
+ import type { PropType } from 'vue'
3
+ import type { DetailList, DetailObject } from '../../types/index'
4
+ import ProductDetailName from './ProductDetailName.vue'
5
+ import {getTranslation} from "@utils/text"
6
+ // import ProductColors from "@components/Product/ProductColors.vue"
7
+
8
+ const props = defineProps({
9
+ details: {
10
+ type: Array as PropType<DetailList[]> | null,
11
+ default: null,
12
+ required: false,
13
+ },
14
+ small: {
15
+ type: Boolean,
16
+ required: false,
17
+ },
18
+ colors: {
19
+ type: Array as PropType<string[] | null>,
20
+ default: null,
21
+ required: false,
22
+ },
23
+ locale: {
24
+ type: String,
25
+ default: 'en',
26
+ required: false,
27
+ },
28
+ })
29
+
30
+ </script>
31
+
32
+ <template>
33
+ <template v-for="(detail, index) in details" :key="index" class="" v-if="details && details.length">
34
+ <!-- PDP PAGE - PRODUCT ROW -->
35
+ <!-- <pre>{{ JSON.stringify(details) }}</pre> -->
36
+ <li v-if="props.small" class="text-xs md:text-sm text-gray-900 dark:text-gray-300 leading-tight font-textlight md:font-textregular">
37
+
38
+ <span v-if="detail.id" class="inline-block mr-1 items--0">
39
+ {{ getTranslation(`detail.${detail.id}`) }}:
40
+ </span>
41
+
42
+ <span v-if="detail.translated" :class="detail.id ? 'font-semibold' : ''" class="items--1">
43
+ {{ detail.value }}
44
+ </span>
45
+
46
+ <div v-else-if="detail.value !== undefined && detail.id === 'color' && detail.isArrayValue" class="items--2 inline-block">
47
+ <span class="comma" v-for="(color, indexColor) in detail.value" :key="indexColor">
48
+ {{ color['name'] }}
49
+ </span>
50
+ </div>
51
+
52
+ <span v-else-if="detail.id !== 'paint-marks' && !detail.isArrayValue" class="items--3">
53
+ {{ locale === 'en' ? String(detail.value).replace(/,/g, '.') : String(detail.value) }}
54
+ </span>
55
+
56
+ <span v-else-if="detail.id && detail.id === 'paint-marks'" class="items items--4">
57
+ {{ detail.value }}
58
+ <!-- <span v-for="(mark, index2) in JSON.parse(String(detail.value))" :key="index2" class="item">
59
+ {{ mark[0] }} x <span>{{ getTranslation(`color.${mark[1]}`) }}</span>
60
+ </span> -->
61
+ </span>
62
+
63
+ </li>
64
+
65
+ <div v-else class="text-sm mt-1 md:mt-4 mb-4 grid grid-cols-2
66
+ sm:(grid-cols-details-desktop grid-flow-col auto-cols-max) gap-4">
67
+ <!-- PRODUCT CARD -->
68
+ <ProductDetailName v-if="detail.id" :text="getTranslation(`detail.${detail.id}`)" />
69
+ <div v-if="detail.value"
70
+ class="leading-4 flex items-end">
71
+
72
+ <span v-if="detail.translated && !detail.isArrayValue" :class="detail.id === 'light-function' ? 'whitespace-pre-line' : ''">
73
+ {{ getTranslation(`detail.value.${detail.value}`) }}
74
+ </span>
75
+
76
+ <span v-else-if="detail.id !== 'paint-marks' && !detail.isArrayValue" class="">
77
+ {{ detail.value }}
78
+ </span>
79
+
80
+ <span v-else-if="detail.value !== undefined && detail.id === 'for-exterior-colour' && detail.isArrayValue" class="">
81
+ <div v-for="(color, indexColor) in JSON.parse(String(detail.value))" :key="indexColor">
82
+ <span class="font-mono">{{ color }}</span> - {{ getTranslation(`colorCodes.${color}`) }}
83
+ </div>
84
+ </span>
85
+
86
+ <span v-else-if="detail.id && detail.id === 'paint-marks'" class="items">
87
+ <span v-for="(mark, index) in JSON.parse(String(detail.value))" :key="index" class="item">
88
+ {{ mark[0] }} x <span>{{ getTranslation(`color.${mark[1]}`) }}</span>
89
+ </span>
90
+ </span>
91
+ <ul v-else-if="detail.id && detail.isArrayValue" class="items">
92
+ <li v-for="(d, index3) in JSON.parse(String(detail.value))" :key="index3" class="item">
93
+ · {{ d }}
94
+ </li>
95
+ </ul>
96
+ </div>
97
+ </div>
98
+ </template>
99
+ </template>
@@ -0,0 +1,25 @@
1
+ <script lang="ts" setup>
2
+ const props = defineProps({
3
+ file: {
4
+ type: Object,
5
+ default: null,
6
+ required: true,
7
+ },
8
+ locale: {
9
+ type: String,
10
+ default: 'en',
11
+ required: false
12
+ }
13
+ })
14
+ </script>
15
+
16
+ <template>
17
+ <li v-if="props.file">
18
+ <a :href="`${locale !== 'en' ? `/${locale}` : ''}/docs/${props.file.name}/`"
19
+ :title="props.file.path"
20
+ class="flex items-center hover:underline underline-offset-2 hover:underline-1"
21
+ >
22
+ <div i-system-uicons-document-justified class="text-blue-500 dark:text-lightBlue-500" /> <span>{{ props.file.name }}</span>
23
+ </a>
24
+ </li>
25
+ </template>
@@ -0,0 +1,24 @@
1
+ <script lang="ts" setup>
2
+ import type { Model } from 'types/index';
3
+ import type { PropType } from 'vue';
4
+
5
+ const props = defineProps({
6
+ carModel: {
7
+ type: Object as PropType<Model>,
8
+ required: true,
9
+ },
10
+ })
11
+
12
+ </script>
13
+ <template>
14
+ <strong class="product-model" :data-pagefind-filter="`model:${props.carModel.name}`">{{ props.carModel.name }}</strong>
15
+ </template>
16
+ <style lang="scss">
17
+ .product-model:not(:last-child) {
18
+ @apply mr-1;
19
+
20
+ &:after {
21
+ content: ','
22
+ }
23
+ }
24
+ </style>
@@ -0,0 +1,31 @@
1
+ <script lang="ts" setup>
2
+ const props = defineProps({
3
+ modelIds: {
4
+ type: Array,
5
+ default: null,
6
+ required: true,
7
+ },
8
+ })
9
+
10
+ </script>
11
+
12
+ <template>
13
+ <div inline-flex flex-wrap max-w-max>
14
+ <span v-for="(modelId, index) in modelIds"
15
+ :key="index"
16
+ class="product-model block"
17
+ >
18
+ <ProductModel :id="modelId" />
19
+ </span>
20
+ </div>
21
+ </template>
22
+
23
+ <style lang="scss">
24
+ .product-model:not(:last-child) {
25
+ @apply mr-1;
26
+
27
+ &:after {
28
+ content: ','
29
+ }
30
+ }
31
+ </style>
@@ -0,0 +1,15 @@
1
+ <script lang="ts" setup>
2
+ const props = defineProps({
3
+ name: {
4
+ type: String,
5
+ default: '',
6
+ required: true,
7
+ },
8
+ })
9
+ </script>
10
+
11
+ <template>
12
+ <h1 class="pdp-headline select-all">
13
+ {{ props.name }}
14
+ </h1>
15
+ </template>
@@ -0,0 +1,35 @@
1
+ <script lang="ts" setup>
2
+
3
+ import type { Position } from 'types/index'
4
+ import type { PropType } from 'vue';
5
+ const props = defineProps({
6
+ positions: {
7
+ type: Object as PropType<Position[]>,
8
+ default: null,
9
+ required: true,
10
+ },
11
+ locale: {
12
+ type: String,
13
+ default: null,
14
+ required: false,
15
+ }
16
+ })
17
+
18
+ </script>
19
+
20
+ <template>
21
+ <span v-for="(position) in positions" :key="position.sort" class="product-position">
22
+ {{ position.name }}
23
+ </span>
24
+ </template>
25
+
26
+ <style lang="scss">
27
+ .product-position:not(:last-child) {
28
+ // @apply mr-1;
29
+ margin-right: 0.25rem;
30
+
31
+ &:after {
32
+ content: ','
33
+ }
34
+ }
35
+ </style>
package/tsconfig.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "moduleResolution": "node",
19
19
  "jsx": "preserve",
20
20
  "allowJs": true,
21
- "types": ["vitest, vite/client", "@astrojs/ts","unplugin-vue-macros/macros-global", "unplugin-icons/types/astro", "src/types/astro.d.ts", "@astrojs/ts-plugin"],
21
+ "types": ["vite/client", "vitest", "@vue/runtime-dom", "@astrojs/ts", "@astrojs/ts-plugin", "unplugin-vue-macros/macros-global", "unplugin-icons/types/astro"],
22
22
  "paths": {
23
23
  "@components/*": ["components/*"],
24
24
  "@utils/*": ["utils/*"],