cclkit4svelte 2.0.5 → 2.0.7
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/Accordion.svelte +40 -29
- package/dist/Accordion.svelte.d.ts +31 -22
- package/dist/AccordionItem.svelte +120 -87
- package/dist/AccordionItem.svelte.d.ts +43 -34
- package/dist/Alert.svelte +111 -82
- package/dist/Alert.svelte.d.ts +38 -36
- package/dist/Badge.svelte +84 -0
- package/dist/Badge.svelte.d.ts +34 -0
- package/dist/BookCard.svelte +127 -88
- package/dist/BookCard.svelte.d.ts +47 -45
- package/dist/Breadcrumb.svelte +91 -0
- package/dist/Breadcrumb.svelte.d.ts +37 -0
- package/dist/Button.svelte +72 -35
- package/dist/Button.svelte.d.ts +33 -31
- package/dist/Card.svelte +110 -75
- package/dist/Card.svelte.d.ts +38 -36
- package/dist/Carousel.svelte +91 -66
- package/dist/Carousel.svelte.d.ts +26 -24
- package/dist/ChangeHistory.svelte +188 -150
- package/dist/ChangeHistory.svelte.d.ts +29 -27
- package/dist/Checkbox.svelte +120 -89
- package/dist/Checkbox.svelte.d.ts +41 -39
- package/dist/CommonHeader.svelte +51 -24
- package/dist/CommonHeader.svelte.d.ts +38 -36
- package/dist/DatePicker.svelte +239 -188
- package/dist/DatePicker.svelte.d.ts +40 -38
- package/dist/Dialog.svelte +224 -0
- package/dist/Dialog.svelte.d.ts +50 -0
- package/dist/Drawer.svelte +158 -0
- package/dist/Drawer.svelte.d.ts +40 -0
- package/dist/Footer.svelte +32 -16
- package/dist/Footer.svelte.d.ts +21 -19
- package/dist/FormGroup.svelte +67 -43
- package/dist/FormGroup.svelte.d.ts +46 -37
- package/dist/Header.svelte +108 -98
- package/dist/Header.svelte.d.ts +25 -23
- package/dist/Input.svelte +154 -99
- package/dist/Input.svelte.d.ts +62 -60
- package/dist/Pagination.svelte +257 -0
- package/dist/Pagination.svelte.d.ts +35 -0
- package/dist/ProgressBar.svelte +49 -44
- package/dist/ProgressBar.svelte.d.ts +25 -23
- package/dist/RadioButton.svelte +92 -62
- package/dist/RadioButton.svelte.d.ts +40 -38
- package/dist/Select.svelte +94 -53
- package/dist/Select.svelte.d.ts +49 -47
- package/dist/ServiceCard.svelte +71 -64
- package/dist/ServiceCard.svelte.d.ts +27 -25
- package/dist/Skeleton.svelte +96 -0
- package/dist/Skeleton.svelte.d.ts +24 -0
- package/dist/SlideMenu.svelte +157 -0
- package/dist/SlideMenu.svelte.d.ts +42 -0
- package/dist/Spinner.svelte +25 -23
- package/dist/Spinner.svelte.d.ts +20 -18
- package/dist/TabPanel.svelte +42 -21
- package/dist/TabPanel.svelte.d.ts +40 -31
- package/dist/Table.svelte +114 -73
- package/dist/Table.svelte.d.ts +33 -31
- package/dist/Tabs.svelte +78 -72
- package/dist/Tabs.svelte.d.ts +18 -16
- package/dist/Textarea.svelte +101 -52
- package/dist/Textarea.svelte.d.ts +57 -55
- package/dist/Thumbnail.svelte +33 -15
- package/dist/Thumbnail.svelte.d.ts +34 -32
- package/dist/Toaster.svelte +144 -0
- package/dist/Toaster.svelte.d.ts +26 -0
- package/dist/Toggle.svelte +85 -61
- package/dist/Toggle.svelte.d.ts +36 -34
- package/dist/Tooltip.svelte +126 -122
- package/dist/Tooltip.svelte.d.ts +30 -21
- package/dist/const/colorMap.d.ts +5 -0
- package/dist/const/colorMap.js +21 -0
- package/dist/const/variables.css +21 -21
- package/dist/index.d.ts +9 -0
- package/dist/index.js +8 -0
- package/dist/toast.d.ts +29 -0
- package/dist/toast.js +66 -0
- package/dist/types/breadcrumb.d.ts +4 -0
- package/dist/types/breadcrumb.js +1 -0
- package/dist/types/slide-menu.d.ts +5 -0
- package/dist/types/slide-menu.js +1 -0
- package/package.json +87 -89
package/dist/Button.svelte
CHANGED
|
@@ -1,42 +1,79 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { ColorVar } from './const/config';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ボタンカラー、CCLVividColorの中から選ぶ
|
|
6
|
+
* @default --strawberry-pink
|
|
7
|
+
*/
|
|
8
|
+
export let bgColor: ColorVar = '--strawberry-pink';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* ボタンの中に表示するテキスト
|
|
12
|
+
* @default Button
|
|
13
|
+
*/
|
|
14
|
+
export let label: string = 'Button';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* クリックイベントハンドラ
|
|
18
|
+
* @default () => {}
|
|
19
|
+
*/
|
|
20
|
+
export let onClick: () => void = () => {};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* ボタンの非活性状態
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
export let disabled: boolean = false;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* ボタンの背景色を取得する関数
|
|
30
|
+
* @param bgColor - ボタンの背景色
|
|
31
|
+
* @returns 背景色
|
|
32
|
+
*/
|
|
33
|
+
import { vividFor } from './const/colorMap';
|
|
34
|
+
|
|
35
|
+
function getButtonColor(bgColor: string): string {
|
|
36
|
+
return `var(${bgColor})`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// 背景色を取得(props 変更に追従)
|
|
40
|
+
let buttonColor = getButtonColor(bgColor);
|
|
41
|
+
$: buttonColor = getButtonColor(bgColor);
|
|
42
|
+
$: buttonFg = vividFor(bgColor as string);
|
|
11
43
|
</script>
|
|
12
44
|
|
|
13
45
|
<!--汎用ボタン-->
|
|
14
|
-
<button
|
|
15
|
-
|
|
46
|
+
<button
|
|
47
|
+
class="buttonWrapper"
|
|
48
|
+
style="--bgColor: {buttonColor}; {buttonFg ? `--btn-fg: var(${buttonFg});` : ''}"
|
|
49
|
+
on:click={onClick}
|
|
50
|
+
{disabled}
|
|
51
|
+
>
|
|
52
|
+
<span class="btLabel">{label}</span>
|
|
16
53
|
</button>
|
|
17
54
|
|
|
18
55
|
<style>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
56
|
+
.buttonWrapper {
|
|
57
|
+
display: flex;
|
|
58
|
+
border-radius: 50px;
|
|
59
|
+
border: none;
|
|
60
|
+
padding: 15px 45px;
|
|
61
|
+
background: var(--bgColor);
|
|
62
|
+
}
|
|
63
|
+
.buttonWrapper:hover {
|
|
64
|
+
cursor: pointer;
|
|
65
|
+
}
|
|
66
|
+
.buttonWrapper:disabled {
|
|
67
|
+
opacity: 0.6;
|
|
68
|
+
cursor: not-allowed;
|
|
69
|
+
}
|
|
70
|
+
.btLabel {
|
|
71
|
+
flex-direction: column;
|
|
72
|
+
justify-content: center;
|
|
73
|
+
flex-shrink: 0;
|
|
74
|
+
color: var(--btn-fg, #fff);
|
|
75
|
+
text-align: center;
|
|
76
|
+
font-size: 18px;
|
|
77
|
+
line-height: normal;
|
|
78
|
+
}
|
|
42
79
|
</style>
|
package/dist/Button.svelte.d.ts
CHANGED
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import type { ColorVar } from './const/config';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* クリックイベントハンドラ
|
|
15
|
-
* @default () => {}
|
|
16
|
-
*/ onClick?: () => void;
|
|
17
|
-
/**
|
|
18
|
-
* ボタンの非活性状態
|
|
19
|
-
* @default false
|
|
20
|
-
*/ disabled?: boolean;
|
|
2
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
3
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
4
|
+
$$bindings?: Bindings;
|
|
5
|
+
} & Exports;
|
|
6
|
+
(internal: unknown, props: Props & {
|
|
7
|
+
$$events?: Events;
|
|
8
|
+
$$slots?: Slots;
|
|
9
|
+
}): Exports & {
|
|
10
|
+
$set?: any;
|
|
11
|
+
$on?: any;
|
|
21
12
|
};
|
|
22
|
-
|
|
23
|
-
[evt: string]: CustomEvent<any>;
|
|
24
|
-
};
|
|
25
|
-
slots: {};
|
|
26
|
-
exports?: {} | undefined;
|
|
27
|
-
bindings?: string | undefined;
|
|
28
|
-
};
|
|
29
|
-
export type ButtonProps = typeof __propDef.props;
|
|
30
|
-
export type ButtonEvents = typeof __propDef.events;
|
|
31
|
-
export type ButtonSlots = typeof __propDef.slots;
|
|
32
|
-
export default class Button extends SvelteComponent<ButtonProps, ButtonEvents, ButtonSlots> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
33
14
|
}
|
|
34
|
-
|
|
15
|
+
declare const Button: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
/**
|
|
17
|
+
* ボタンカラー、CCLVividColorの中から選ぶ
|
|
18
|
+
* @default --strawberry-pink
|
|
19
|
+
*/ bgColor?: ColorVar;
|
|
20
|
+
/**
|
|
21
|
+
* ボタンの中に表示するテキスト
|
|
22
|
+
* @default Button
|
|
23
|
+
*/ label?: string;
|
|
24
|
+
/**
|
|
25
|
+
* クリックイベントハンドラ
|
|
26
|
+
* @default () => {}
|
|
27
|
+
*/ onClick?: () => void;
|
|
28
|
+
/**
|
|
29
|
+
* ボタンの非活性状態
|
|
30
|
+
* @default false
|
|
31
|
+
*/ disabled?: boolean;
|
|
32
|
+
}, {
|
|
33
|
+
[evt: string]: CustomEvent<any>;
|
|
34
|
+
}, {}, {}, string>;
|
|
35
|
+
type Button = InstanceType<typeof Button>;
|
|
36
|
+
export default Button;
|
package/dist/Card.svelte
CHANGED
|
@@ -1,88 +1,123 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { CCLPastelColor, CCLVividColor } from './const/config';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 枠線の色
|
|
6
|
+
* @default --strawberry-pink
|
|
7
|
+
* @type string
|
|
8
|
+
*/
|
|
9
|
+
export let borderColor: string;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 画像ソース
|
|
13
|
+
* @type string
|
|
14
|
+
*/
|
|
15
|
+
export let src: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* alt属性に指定する値
|
|
19
|
+
* @type string
|
|
20
|
+
*/
|
|
21
|
+
export let altText: string;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* 記事の見出し
|
|
25
|
+
* @type string
|
|
26
|
+
*/
|
|
27
|
+
export let title: string;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* カードの詳細テキスト(140字程度推奨)
|
|
31
|
+
* @type string
|
|
32
|
+
*/
|
|
33
|
+
export let cardText: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 枠線の色に応じた背景色を取得する関数
|
|
37
|
+
* @param borderColor - 枠線の色
|
|
38
|
+
* @returns 背景色
|
|
39
|
+
*/
|
|
40
|
+
function getBodyColor(borderColor: string): string {
|
|
41
|
+
switch (borderColor) {
|
|
42
|
+
case CCLVividColor.STRAWBERRY_PINK:
|
|
43
|
+
return CCLPastelColor.PEACH_PINK;
|
|
44
|
+
case CCLVividColor.PINEAPPLE_YELLOW:
|
|
45
|
+
return CCLPastelColor.LEMON_YELLOW;
|
|
46
|
+
case CCLVividColor.SODA_BLUE:
|
|
47
|
+
return CCLPastelColor.SUGAR_BLUE;
|
|
48
|
+
case CCLVividColor.MELON_GREEN:
|
|
49
|
+
return CCLPastelColor.MATCHA_GREEN;
|
|
50
|
+
case CCLVividColor.GRAPE_PURPLE:
|
|
51
|
+
return CCLPastelColor.AKEBI_PURPLE;
|
|
52
|
+
case CCLVividColor.WRAP_GREY:
|
|
53
|
+
return CCLPastelColor.CLOUD_GREY;
|
|
54
|
+
default:
|
|
55
|
+
return CCLPastelColor.PEACH_PINK;
|
|
56
|
+
}
|
|
23
57
|
}
|
|
24
|
-
|
|
25
|
-
|
|
58
|
+
|
|
59
|
+
// 背景色を取得
|
|
60
|
+
$: bodyColor = getBodyColor(borderColor);
|
|
26
61
|
</script>
|
|
27
62
|
|
|
28
63
|
<div class="CardWrapper" style="--border-color: var({borderColor})">
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
64
|
+
<img class="CardImage" {src} alt={altText} />
|
|
65
|
+
<div class="CardInfo" style="--background-color: var({bodyColor});">
|
|
66
|
+
<div class="CardTextWrapper">
|
|
67
|
+
<h2 class="CardTitle">{title}</h2>
|
|
68
|
+
<span class="CardText">{cardText}</span>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
36
71
|
</div>
|
|
37
72
|
|
|
38
73
|
<style>
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
74
|
+
.CardWrapper {
|
|
75
|
+
height: 500px;
|
|
76
|
+
width: 300px;
|
|
77
|
+
position: relative;
|
|
78
|
+
box-shadow: 0 10px 10px rgba(0, 0, 0, 0.25);
|
|
79
|
+
border-radius: 25px;
|
|
80
|
+
border: 5px solid var(--border-color);
|
|
81
|
+
z-index: -1;
|
|
82
|
+
}
|
|
48
83
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
84
|
+
.CardImage {
|
|
85
|
+
height: auto;
|
|
86
|
+
max-width: 100%;
|
|
87
|
+
top: 0;
|
|
88
|
+
position: absolute;
|
|
89
|
+
border-top-left-radius: 20px;
|
|
90
|
+
border-top-right-radius: 20px;
|
|
91
|
+
}
|
|
57
92
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
93
|
+
.CardInfo {
|
|
94
|
+
height: 195px;
|
|
95
|
+
width: 300px;
|
|
96
|
+
position: absolute;
|
|
97
|
+
background: var(--background-color);
|
|
98
|
+
top: 300px;
|
|
99
|
+
border-bottom-left-radius: 20px;
|
|
100
|
+
border-bottom-right-radius: 20px;
|
|
101
|
+
border-top: 5px solid var(--border-color);
|
|
102
|
+
z-index: 1;
|
|
103
|
+
}
|
|
69
104
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
105
|
+
.CardTextWrapper {
|
|
106
|
+
height: auto;
|
|
107
|
+
max-width: 95%;
|
|
108
|
+
position: absolute;
|
|
109
|
+
top: -5%;
|
|
110
|
+
left: 5%;
|
|
111
|
+
overflow-wrap: break-word;
|
|
112
|
+
}
|
|
78
113
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
114
|
+
.CardTitle {
|
|
115
|
+
color: var(--border-color);
|
|
116
|
+
}
|
|
82
117
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
118
|
+
.CardText {
|
|
119
|
+
color: var(--wrap-grey);
|
|
120
|
+
text-overflow: ellipsis;
|
|
121
|
+
overflow: hidden;
|
|
122
|
+
}
|
|
88
123
|
</style>
|
package/dist/Card.svelte.d.ts
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* @type string
|
|
12
|
-
*/ src: string;
|
|
13
|
-
/**
|
|
14
|
-
* alt属性に指定する値
|
|
15
|
-
* @type string
|
|
16
|
-
*/ altText: string;
|
|
17
|
-
/**
|
|
18
|
-
* 記事の見出し
|
|
19
|
-
* @type string
|
|
20
|
-
*/ title: string;
|
|
21
|
-
/**
|
|
22
|
-
* カードの詳細テキスト(140字程度推奨)
|
|
23
|
-
* @type string
|
|
24
|
-
*/ cardText: string;
|
|
1
|
+
interface $$__sveltets_2_IsomorphicComponent<Props extends Record<string, any> = any, Events extends Record<string, any> = any, Slots extends Record<string, any> = any, Exports = {}, Bindings = string> {
|
|
2
|
+
new (options: import('svelte').ComponentConstructorOptions<Props>): import('svelte').SvelteComponent<Props, Events, Slots> & {
|
|
3
|
+
$$bindings?: Bindings;
|
|
4
|
+
} & Exports;
|
|
5
|
+
(internal: unknown, props: Props & {
|
|
6
|
+
$$events?: Events;
|
|
7
|
+
$$slots?: Slots;
|
|
8
|
+
}): Exports & {
|
|
9
|
+
$set?: any;
|
|
10
|
+
$on?: any;
|
|
25
11
|
};
|
|
26
|
-
|
|
27
|
-
[evt: string]: CustomEvent<any>;
|
|
28
|
-
};
|
|
29
|
-
slots: {};
|
|
30
|
-
exports?: {} | undefined;
|
|
31
|
-
bindings?: string | undefined;
|
|
32
|
-
};
|
|
33
|
-
export type CardProps = typeof __propDef.props;
|
|
34
|
-
export type CardEvents = typeof __propDef.events;
|
|
35
|
-
export type CardSlots = typeof __propDef.slots;
|
|
36
|
-
export default class Card extends SvelteComponent<CardProps, CardEvents, CardSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
37
13
|
}
|
|
38
|
-
|
|
14
|
+
declare const Card: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
/**
|
|
16
|
+
* 枠線の色
|
|
17
|
+
* @default --strawberry-pink
|
|
18
|
+
* @type string
|
|
19
|
+
*/ borderColor: string;
|
|
20
|
+
/**
|
|
21
|
+
* 画像ソース
|
|
22
|
+
* @type string
|
|
23
|
+
*/ src: string;
|
|
24
|
+
/**
|
|
25
|
+
* alt属性に指定する値
|
|
26
|
+
* @type string
|
|
27
|
+
*/ altText: string;
|
|
28
|
+
/**
|
|
29
|
+
* 記事の見出し
|
|
30
|
+
* @type string
|
|
31
|
+
*/ title: string;
|
|
32
|
+
/**
|
|
33
|
+
* カードの詳細テキスト(140字程度推奨)
|
|
34
|
+
* @type string
|
|
35
|
+
*/ cardText: string;
|
|
36
|
+
}, {
|
|
37
|
+
[evt: string]: CustomEvent<any>;
|
|
38
|
+
}, {}, {}, string>;
|
|
39
|
+
type Card = InstanceType<typeof Card>;
|
|
40
|
+
export default Card;
|
package/dist/Carousel.svelte
CHANGED
|
@@ -1,75 +1,100 @@
|
|
|
1
|
-
<script context="module"
|
|
1
|
+
<script context="module" lang="ts">
|
|
2
|
+
export interface Imgsrc {
|
|
3
|
+
src: string;
|
|
4
|
+
alt: string;
|
|
5
|
+
}
|
|
6
|
+
</script>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
/**
|
|
10
|
+
* Image data
|
|
11
|
+
* Provide an array of objects containing image URL and alt text
|
|
12
|
+
* @type Array<Imgsrc>
|
|
13
|
+
*/
|
|
14
|
+
export let src: Array<Imgsrc>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Width of the carousel component
|
|
18
|
+
* @type string
|
|
19
|
+
*/
|
|
20
|
+
export let csWidth: string;
|
|
21
|
+
|
|
22
|
+
let currentIndex = 0;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Move to the next slide
|
|
26
|
+
*/
|
|
27
|
+
const nextSlide = () => {
|
|
28
|
+
if (src.length === 0) return;
|
|
29
|
+
currentIndex = (currentIndex + 1) % src.length;
|
|
30
|
+
};
|
|
2
31
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
const prevSlide = () => {
|
|
11
|
-
if (src.length === 0) return;
|
|
12
|
-
currentIndex = (currentIndex - 1 + src.length) % src.length;
|
|
13
|
-
};
|
|
32
|
+
/**
|
|
33
|
+
* Move to the previous slide
|
|
34
|
+
*/
|
|
35
|
+
const prevSlide = () => {
|
|
36
|
+
if (src.length === 0) return;
|
|
37
|
+
currentIndex = (currentIndex - 1 + src.length) % src.length;
|
|
38
|
+
};
|
|
14
39
|
</script>
|
|
15
40
|
|
|
16
41
|
<div
|
|
17
|
-
|
|
18
|
-
|
|
42
|
+
class="carouselWrapper"
|
|
43
|
+
style="--carousel-width: {csWidth}; --translate-x: calc(-{currentIndex} * 100%)"
|
|
19
44
|
>
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
45
|
+
<div class="slides">
|
|
46
|
+
{#each src as item, index}
|
|
47
|
+
<img class="slide" src={item.src} alt={item.alt} />
|
|
48
|
+
{/each}
|
|
49
|
+
</div>
|
|
50
|
+
<div class="buttons">
|
|
51
|
+
<button on:click={prevSlide}>❮</button>
|
|
52
|
+
<button on:click={nextSlide}>❯</button>
|
|
53
|
+
</div>
|
|
29
54
|
</div>
|
|
30
55
|
|
|
31
56
|
<style>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
57
|
+
.carouselWrapper {
|
|
58
|
+
position: relative;
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
width: var(--carousel-width);
|
|
61
|
+
}
|
|
62
|
+
.slides {
|
|
63
|
+
display: flex;
|
|
64
|
+
transition: transform 0.5s ease-in-out;
|
|
65
|
+
transform: translateX(var(--translate-x));
|
|
66
|
+
}
|
|
67
|
+
.slide {
|
|
68
|
+
min-width: 100%;
|
|
69
|
+
}
|
|
70
|
+
.buttons {
|
|
71
|
+
position: absolute;
|
|
72
|
+
top: 50%;
|
|
73
|
+
transform: translateY(-50%);
|
|
74
|
+
width: 100%;
|
|
75
|
+
}
|
|
76
|
+
.buttons button:first-child {
|
|
77
|
+
position: absolute;
|
|
78
|
+
left: 20px;
|
|
79
|
+
z-index: 1;
|
|
80
|
+
}
|
|
81
|
+
.buttons button:last-child {
|
|
82
|
+
position: absolute;
|
|
83
|
+
right: 20px;
|
|
84
|
+
z-index: 1;
|
|
85
|
+
}
|
|
86
|
+
button {
|
|
87
|
+
background: white;
|
|
88
|
+
color: black;
|
|
89
|
+
border: none;
|
|
90
|
+
padding: 10px;
|
|
91
|
+
cursor: pointer;
|
|
92
|
+
border-radius: 50%;
|
|
93
|
+
width: 40px;
|
|
94
|
+
height: 40px;
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
justify-content: center;
|
|
98
|
+
box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
|
|
99
|
+
}
|
|
75
100
|
</style>
|