srcdev-nuxt-components 6.1.29 → 6.1.31

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.
@@ -65,6 +65,28 @@
65
65
  </section>
66
66
  </template>
67
67
 
68
+ <script lang="ts">
69
+ export interface CarouselBasicItem {
70
+ id: number | string
71
+ url: string
72
+ alt: string
73
+ }
74
+
75
+ export interface CarouselModifiedItem {
76
+ id: number | string
77
+ url: string
78
+ alt: string
79
+ order: number
80
+ }
81
+
82
+ export interface ICarouselBasic {
83
+ items: CarouselBasicItem[] | CarouselModifiedItem[]
84
+ total: number
85
+ skip: number
86
+ limit: number
87
+ }
88
+ </script>
89
+
68
90
  <script setup lang="ts">
69
91
  import { useEventListener, useResizeObserver, useSwipe } from "@vueuse/core"
70
92
 
@@ -24,17 +24,8 @@
24
24
  </component>
25
25
  </template>
26
26
 
27
- <script lang="ts">
28
- interface ResponsiveHeaderNavItem {
29
- name: string
30
- path?: string
31
- isExternal?: boolean
32
- childLinks?: ResponsiveHeaderNavItem[]
33
- childLinksTitle?: string
34
- }
35
- </script>
36
-
37
27
  <script setup lang="ts">
28
+ import type { ResponsiveHeaderNavItem } from "../../types"
38
29
  const props = defineProps({
39
30
  tag: {
40
31
  type: String,
@@ -0,0 +1,123 @@
1
+ <template>
2
+ <component
3
+ :is="props.chip ? DisplayChip : as"
4
+ tag="div"
5
+ v-bind="props.chip ? (typeof props.chip === 'object' ? { config: props.chip } : { config: chipDefaultConfig }) : {}"
6
+ class="display-avatar"
7
+ :class="[size, elementClasses]"
8
+ :style-class-passthrough="elementClasses"
9
+ >
10
+ <slot name="default">
11
+ <NuxtImg v-if="src" :src :alt="alt || 'Avatar'" width="100%" height="100%" class="avatar-image" />
12
+ <span v-else>{{ fallback }}</span>
13
+ </slot>
14
+ <slot name="icon"></slot>
15
+ </component>
16
+ </template>
17
+
18
+ <script lang="ts">
19
+ import DisplayChip from "../display-chip/DisplayChip.vue"
20
+ import type { DisplayChipProps, DisplayChipConfig } from "../../types"
21
+ export interface AvatarProps {
22
+ as?: any
23
+ src?: string
24
+ alt?: string
25
+ text?: string
26
+ size?: "xs" | "s" | "md" | "lg" | "xl" | string
27
+ chip?: boolean | DisplayChipProps
28
+ class?: any
29
+ style?: any
30
+ styleClassPassthrough?: string | string[]
31
+ }
32
+
33
+ export interface AvatarSlots {
34
+ default(props?: {}): any
35
+ icon(props?: {}): any
36
+ }
37
+ </script>
38
+
39
+ <script setup lang="ts">
40
+ const props = withDefaults(defineProps<AvatarProps>(), {
41
+ as: "span",
42
+ size: "md",
43
+ styleClassPassthrough: () => [],
44
+ })
45
+ defineSlots<AvatarSlots>()
46
+
47
+ const { elementClasses, resetElementClasses, updateElementClasses } = useStyleClassPassthrough(
48
+ props.styleClassPassthrough
49
+ )
50
+
51
+ if (props.chip && typeof props.chip === "object" && !("styleClassPassthrough" in props.chip)) {
52
+ updateElementClasses(["display-avatar", props.size])
53
+ }
54
+
55
+ const fallback = computed(
56
+ () =>
57
+ props.text ||
58
+ (props.alt || "")
59
+ .split(" ")
60
+ .map((word) => word.charAt(0))
61
+ .join("")
62
+ .substring(0, 2)
63
+ )
64
+
65
+ const chipDefaultConfig = {
66
+ size: "12px",
67
+ maskWidth: "4px",
68
+ offset: "0px",
69
+ angle: "90deg",
70
+ }
71
+
72
+ watch(
73
+ () => props.styleClassPassthrough,
74
+ () => {
75
+ resetElementClasses(props.styleClassPassthrough)
76
+ }
77
+ )
78
+ </script>
79
+
80
+ <style lang="css">
81
+ .display-avatar {
82
+ display: flex;
83
+ align-items: center;
84
+ justify-content: center;
85
+ border-radius: 50%;
86
+ color: var(--gray-3);
87
+ border: 1px solid light-dark(var(--gray-7), var(--gray-3));
88
+
89
+ isolation: isolate;
90
+
91
+ &.xs {
92
+ width: 24px;
93
+ height: 24px;
94
+ font-size: 0.75rem;
95
+ }
96
+ &.s {
97
+ width: 32px;
98
+ height: 32px;
99
+ font-size: 0.875rem;
100
+ }
101
+ &.md {
102
+ width: 40px;
103
+ height: 40px;
104
+ font-size: 1rem;
105
+ }
106
+ &.lg {
107
+ width: 48px;
108
+ height: 48px;
109
+ font-size: 1.125rem;
110
+ }
111
+ &.xl {
112
+ width: 56px;
113
+ height: 56px;
114
+ font-size: 1.25rem;
115
+ }
116
+
117
+ .avatar-image {
118
+ width: 100%;
119
+ border-radius: 50%;
120
+ object-fit: cover;
121
+ }
122
+ }
123
+ </style>
@@ -4,56 +4,64 @@
4
4
  </component>
5
5
  </template>
6
6
 
7
- <script setup lang="ts">
8
- const props = defineProps({
9
- tag: {
10
- type: String,
11
- default: "span",
12
- validator(value: string) {
13
- return ["div", "span"].includes(value)
14
- },
15
- },
16
- shape: {
17
- type: String as PropType<"circle" | "square">,
18
- default: "circle",
19
- validator(value: string) {
20
- return ["circle", "square"].includes(value)
21
- },
22
- },
23
- styleClassPassthrough: {
24
- type: [String, Array] as PropType<string | string[]>,
25
- default: () => [],
26
- },
27
- })
28
-
29
- const chipConfig = defineModel<{
7
+ <script lang="ts">
8
+ export interface DisplayChipConfig {
30
9
  size: string
31
10
  maskWidth: string
32
11
  offset: string
33
12
  angle: string
34
- }>({
35
- type: Object as PropType<{
36
- size: string
37
- maskWidth: string
38
- offset: string
39
- angle: string
40
- }>,
41
- default: () => ({
13
+ }
14
+
15
+ export interface DisplayChipProps {
16
+ tag?: "div" | "span"
17
+ shape?: "circle" | "square"
18
+ config?: DisplayChipConfig
19
+ styleClassPassthrough?: string | string[]
20
+ }
21
+
22
+ export interface ChipSlots {
23
+ default(props?: {}): any
24
+ content(props?: {}): any
25
+ }
26
+ </script>
27
+
28
+ <script setup lang="ts">
29
+ const props = withDefaults(defineProps<DisplayChipProps>(), {
30
+ tag: "div",
31
+ shape: "circle",
32
+ config: () => ({
42
33
  size: "12px",
43
34
  maskWidth: "4px",
44
35
  offset: "0px",
45
36
  angle: "90deg",
46
37
  }),
47
- required: false,
38
+ styleClassPassthrough: () => [],
48
39
  })
40
+ defineSlots<ChipSlots>()
41
+
42
+ // const chipConfig = defineModel<DisplayChipConfig>({
43
+ // type: Object as PropType<{
44
+ // size: string
45
+ // maskWidth: string
46
+ // offset: string
47
+ // angle: string
48
+ // }>,
49
+ // default: () => ({
50
+ // size: "12px",
51
+ // maskWidth: "4px",
52
+ // offset: "0px",
53
+ // angle: "90deg",
54
+ // }),
55
+ // required: false,
56
+ // })
49
57
 
50
58
  const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough)
51
59
 
52
60
  const chipStyles = computed(() => ({
53
- "--chip-size": chipConfig.value.size,
54
- "--chip-mask-width": chipConfig.value.maskWidth,
55
- "--chip-offset": chipConfig.value.offset,
56
- "--chip-angle": chipConfig.value.angle,
61
+ "--chip-size": props.config?.size,
62
+ "--chip-mask-width": props.config?.maskWidth,
63
+ "--chip-offset": props.config?.offset,
64
+ "--chip-angle": props.config?.angle,
57
65
  }))
58
66
  </script>
59
67
 
@@ -53,9 +53,23 @@
53
53
  </div>
54
54
  </template>
55
55
 
56
- <script setup lang="ts">
57
- import { type IGalleryData } from "@/types/gallery-data"
56
+ <script lang="ts">
57
+ export interface IGalleryData {
58
+ src: string
59
+ alt: string
60
+ stylist?: string
61
+ title?: string
62
+ category?: string
63
+ description?: string
64
+ thumbnail?: {
65
+ title: string
66
+ description: string
67
+ }
68
+ textBrightness: "light" | "dark"
69
+ }
70
+ </script>
58
71
 
72
+ <script setup lang="ts">
59
73
  const props = defineProps({
60
74
  autoRun: {
61
75
  type: Boolean,
@@ -116,9 +116,46 @@
116
116
  </div>
117
117
  </template>
118
118
 
119
+ <script lang="ts">
120
+ export interface ResponsiveHeaderNavItem {
121
+ name: string
122
+ path?: string
123
+ isExternal?: boolean
124
+ childLinks?: ResponsiveHeaderNavItem[]
125
+ childLinksTitle?: string
126
+ iconName?: string
127
+ config?: ResponsiveHeaderItemRects
128
+ }
129
+
130
+ export interface ResponsiveHeaderProp {
131
+ [key: string]: ResponsiveHeaderNavItem[]
132
+ }
133
+
134
+ export interface IFlooredRect {
135
+ left: number
136
+ right: number
137
+ top: number
138
+ bottom: number
139
+ width: number
140
+ height: number
141
+ }
142
+
143
+ export interface ResponsiveHeaderItemRects {
144
+ left: number
145
+ right: number
146
+ width?: number
147
+ visible: boolean
148
+ }
149
+
150
+ export interface ResponsiveHeaderState {
151
+ hasSecondNav: boolean
152
+ navListVisibility: Record<string, boolean>
153
+ clonedNavLinks?: ResponsiveHeaderProp
154
+ }
155
+ </script>
156
+
119
157
  <script setup lang="ts">
120
158
  import { useResizeObserver, onClickOutside } from "@vueuse/core"
121
- import type { ResponsiveHeaderProp, ResponsiveHeaderState, IFlooredRect } from "@/types/responsiveHeader"
122
159
 
123
160
  const props = defineProps({
124
161
  responsiveNavLinks: {
@@ -0,0 +1,4 @@
1
+ export * from "../components/responsive-header/ResponsiveHeader.vue"
2
+ export * from "../components/display-chip/DisplayChip.vue"
3
+ export * from "../components/carousel-basic/CarouselBasic.vue"
4
+ export * from "../components/image-galleries/SliderGallery.vue"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-components",
3
3
  "type": "module",
4
- "version": "6.1.29",
4
+ "version": "6.1.31",
5
5
  "main": "nuxt.config.ts",
6
6
  "scripts": {
7
7
  "clean": "rm -rf .nuxt && rm -rf .output && rm -rf .playground/.nuxt && rm -rf .playground/.output",
@@ -1,6 +0,0 @@
1
- export interface IToastConfig {
2
- showToast: boolean
3
- variant: string
4
- duration: number
5
- toastDisplayText: string
6
- }
@@ -1,13 +0,0 @@
1
- export interface IGalleryData {
2
- src: string;
3
- alt: string;
4
- stylist?: string;
5
- title?: string;
6
- category?: string;
7
- description?: string;
8
- thumbnail?: {
9
- title: string;
10
- description: string;
11
- };
12
- textBrightness: 'light' | 'dark';
13
- }
@@ -1,38 +0,0 @@
1
- export interface ResponsiveHeaderNavItem {
2
- name: string;
3
- path?: string;
4
- iconName?: string;
5
- imageSrc?: string;
6
- imageAlt?: string;
7
- description?: string;
8
- isActive?: boolean;
9
- isExternal?: boolean;
10
- childLinksTitle?: string;
11
- childLinks?: ResponsiveHeaderNavItem[];
12
- config?: ResponsiveHeaderItemRects;
13
- }
14
-
15
- export interface ResponsiveHeaderProp {
16
- [key: string]: ResponsiveHeaderNavItem[];
17
- }
18
-
19
- export interface IFlooredRect {
20
- left: number;
21
- right: number;
22
- top: number;
23
- bottom: number;
24
- width: number;
25
- height: number;
26
- }
27
-
28
- export interface ResponsiveHeaderItemRects {
29
- left: number;
30
- right: number;
31
- width?: number;
32
- visible: boolean;
33
- }
34
-
35
- export interface ResponsiveHeaderState {
36
- navListVisibility: Record<string, boolean>;
37
- clonedNavLinks?: ResponsiveHeaderProp;
38
- }
@@ -1,19 +0,0 @@
1
- export interface CarouselBasicItem {
2
- id: number | string;
3
- url: string;
4
- alt: string;
5
- }
6
-
7
- export interface CarouselModifiedItem {
8
- id: number | string;
9
- url: string;
10
- alt: string;
11
- order: number;
12
- }
13
-
14
- export interface ICarouselBasic {
15
- items: CarouselBasicItem[] | CarouselModifiedItem[];
16
- total: number;
17
- skip: number;
18
- limit: number;
19
- }