cclkit4svelte 2.0.6 → 3.0.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/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 +222 -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 +10 -0
- package/dist/index.js +9 -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 -87
|
@@ -1,57 +1,59 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* @default ''
|
|
12
|
-
* @type string
|
|
13
|
-
*/ value?: string;
|
|
14
|
-
/**
|
|
15
|
-
* プレースホルダーのテキスト
|
|
16
|
-
* @default ''
|
|
17
|
-
* @type string
|
|
18
|
-
*/ placeholder?: string;
|
|
19
|
-
/**
|
|
20
|
-
* 枠線の色
|
|
21
|
-
* @default --strawberry-pink
|
|
22
|
-
* @type string
|
|
23
|
-
*/ borderColor?: string;
|
|
24
|
-
/**
|
|
25
|
-
* 非活性状態にするか
|
|
26
|
-
* @default false
|
|
27
|
-
* @type boolean
|
|
28
|
-
*/ disabled?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
* コンポーネントのID
|
|
31
|
-
* @default 'ccl-textarea'
|
|
32
|
-
* @type string
|
|
33
|
-
*/ id?: string;
|
|
34
|
-
/**
|
|
35
|
-
* 行数
|
|
36
|
-
* @default 5
|
|
37
|
-
* @type number
|
|
38
|
-
*/ rows?: number;
|
|
39
|
-
/**
|
|
40
|
-
* 列数
|
|
41
|
-
* @default 20
|
|
42
|
-
* @type number
|
|
43
|
-
*/ cols?: number;
|
|
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;
|
|
44
11
|
};
|
|
45
|
-
|
|
46
|
-
[evt: string]: CustomEvent<any>;
|
|
47
|
-
};
|
|
48
|
-
slots: {};
|
|
49
|
-
exports?: {} | undefined;
|
|
50
|
-
bindings?: string | undefined;
|
|
51
|
-
};
|
|
52
|
-
export type TextareaProps = typeof __propDef.props;
|
|
53
|
-
export type TextareaEvents = typeof __propDef.events;
|
|
54
|
-
export type TextareaSlots = typeof __propDef.slots;
|
|
55
|
-
export default class Textarea extends SvelteComponent<TextareaProps, TextareaEvents, TextareaSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
56
13
|
}
|
|
57
|
-
|
|
14
|
+
declare const Textarea: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
/**
|
|
16
|
+
* ラベルのテキスト
|
|
17
|
+
* @default ''
|
|
18
|
+
* @type string
|
|
19
|
+
*/ label?: string;
|
|
20
|
+
/**
|
|
21
|
+
* 入力値
|
|
22
|
+
* @default ''
|
|
23
|
+
* @type string
|
|
24
|
+
*/ value?: string;
|
|
25
|
+
/**
|
|
26
|
+
* プレースホルダーのテキスト
|
|
27
|
+
* @default ''
|
|
28
|
+
* @type string
|
|
29
|
+
*/ placeholder?: string;
|
|
30
|
+
/**
|
|
31
|
+
* 枠線の色
|
|
32
|
+
* @default --strawberry-pink
|
|
33
|
+
* @type string
|
|
34
|
+
*/ borderColor?: string;
|
|
35
|
+
/**
|
|
36
|
+
* 非活性状態にするか
|
|
37
|
+
* @default false
|
|
38
|
+
* @type boolean
|
|
39
|
+
*/ disabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* コンポーネントのID
|
|
42
|
+
* @default 'ccl-textarea'
|
|
43
|
+
* @type string
|
|
44
|
+
*/ id?: string;
|
|
45
|
+
/**
|
|
46
|
+
* 行数
|
|
47
|
+
* @default 5
|
|
48
|
+
* @type number
|
|
49
|
+
*/ rows?: number;
|
|
50
|
+
/**
|
|
51
|
+
* 列数
|
|
52
|
+
* @default 20
|
|
53
|
+
* @type number
|
|
54
|
+
*/ cols?: number;
|
|
55
|
+
}, {
|
|
56
|
+
[evt: string]: CustomEvent<any>;
|
|
57
|
+
}, {}, {}, string>;
|
|
58
|
+
type Textarea = InstanceType<typeof Textarea>;
|
|
59
|
+
export default Textarea;
|
package/dist/Thumbnail.svelte
CHANGED
|
@@ -1,23 +1,41 @@
|
|
|
1
|
-
<script>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* サムネイル画像の大きさ
|
|
4
|
+
* @type string
|
|
5
|
+
*/
|
|
6
|
+
export let imageSize: string;
|
|
7
|
+
/**
|
|
8
|
+
* 枠線の色
|
|
9
|
+
* @default --strawberry-pink
|
|
10
|
+
* @type string
|
|
11
|
+
*/
|
|
12
|
+
export let borderColor: string;
|
|
13
|
+
/**
|
|
14
|
+
* 画像ソース
|
|
15
|
+
* @type string
|
|
16
|
+
*/
|
|
17
|
+
export let src: string;
|
|
18
|
+
/**
|
|
19
|
+
* alt属性に指定する値
|
|
20
|
+
* @type string
|
|
21
|
+
*/
|
|
22
|
+
export let altText: string;
|
|
5
23
|
</script>
|
|
6
24
|
|
|
7
25
|
<div class="ThumbnailWrapper" style="--imageSize: {imageSize}; --borderColor: var({borderColor})">
|
|
8
|
-
|
|
26
|
+
<img {src} alt={altText} class="Thumbnail" />
|
|
9
27
|
</div>
|
|
10
28
|
|
|
11
29
|
<style>
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
30
|
+
.ThumbnailWrapper {
|
|
31
|
+
height: var(--imageSize);
|
|
32
|
+
width: var(--imageSize);
|
|
33
|
+
}
|
|
16
34
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
35
|
+
.Thumbnail {
|
|
36
|
+
height: var(--imageSize);
|
|
37
|
+
width: var(--imageSize);
|
|
38
|
+
border-radius: 320px;
|
|
39
|
+
border: 5px solid var(--borderColor);
|
|
40
|
+
}
|
|
23
41
|
</style>
|
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* @type string
|
|
12
|
-
*/ borderColor: string;
|
|
13
|
-
/**
|
|
14
|
-
* 画像ソース
|
|
15
|
-
* @type string
|
|
16
|
-
*/ src: string;
|
|
17
|
-
/**
|
|
18
|
-
* alt属性に指定する値
|
|
19
|
-
* @type string
|
|
20
|
-
*/ altText: 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;
|
|
21
11
|
};
|
|
22
|
-
|
|
23
|
-
[evt: string]: CustomEvent<any>;
|
|
24
|
-
};
|
|
25
|
-
slots: {};
|
|
26
|
-
exports?: {} | undefined;
|
|
27
|
-
bindings?: string | undefined;
|
|
28
|
-
};
|
|
29
|
-
export type ThumbnailProps = typeof __propDef.props;
|
|
30
|
-
export type ThumbnailEvents = typeof __propDef.events;
|
|
31
|
-
export type ThumbnailSlots = typeof __propDef.slots;
|
|
32
|
-
export default class Thumbnail extends SvelteComponent<ThumbnailProps, ThumbnailEvents, ThumbnailSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
33
13
|
}
|
|
34
|
-
|
|
14
|
+
declare const Thumbnail: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
/**
|
|
16
|
+
* サムネイル画像の大きさ
|
|
17
|
+
* @type string
|
|
18
|
+
*/ imageSize: string;
|
|
19
|
+
/**
|
|
20
|
+
* 枠線の色
|
|
21
|
+
* @default --strawberry-pink
|
|
22
|
+
* @type string
|
|
23
|
+
*/ borderColor: string;
|
|
24
|
+
/**
|
|
25
|
+
* 画像ソース
|
|
26
|
+
* @type string
|
|
27
|
+
*/ src: string;
|
|
28
|
+
/**
|
|
29
|
+
* alt属性に指定する値
|
|
30
|
+
* @type string
|
|
31
|
+
*/ altText: string;
|
|
32
|
+
}, {
|
|
33
|
+
[evt: string]: CustomEvent<any>;
|
|
34
|
+
}, {}, {}, string>;
|
|
35
|
+
type Thumbnail = InstanceType<typeof Thumbnail>;
|
|
36
|
+
export default Thumbnail;
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
toasts,
|
|
4
|
+
dismiss,
|
|
5
|
+
variantColor,
|
|
6
|
+
show as showToast,
|
|
7
|
+
type ToastItem,
|
|
8
|
+
type ToastVariant
|
|
9
|
+
} from './toast';
|
|
10
|
+
import { vividFor } from './const/colorMap';
|
|
11
|
+
import { fly, fade } from 'svelte/transition';
|
|
12
|
+
|
|
13
|
+
export let position: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' = 'top-right';
|
|
14
|
+
export let maxVisible = 5;
|
|
15
|
+
// 閉じるボタンの表示可否
|
|
16
|
+
export let dismissible: boolean = true;
|
|
17
|
+
// message は必須(即時表示の本文): デフォルトを与えない
|
|
18
|
+
export let message: string;
|
|
19
|
+
// variant は任意(既定: 'info')
|
|
20
|
+
export let variant: ToastVariant = 'info';
|
|
21
|
+
// duration は任意(既定: undefined)
|
|
22
|
+
export let duration: number;
|
|
23
|
+
|
|
24
|
+
$: list = $toasts.slice(0, maxVisible);
|
|
25
|
+
|
|
26
|
+
function colorVars(item: ToastItem) {
|
|
27
|
+
const bgVar = variantColor[item.variant];
|
|
28
|
+
const fgVar = vividFor(bgVar) ?? undefined;
|
|
29
|
+
return `--toast-bg: var(${bgVar}); ${fgVar ? `--toast-fg: var(${fgVar});` : ''}`;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const defaultTitles: Record<ToastVariant, string> = {
|
|
33
|
+
success: 'Success',
|
|
34
|
+
error: 'Error',
|
|
35
|
+
warning: 'Warning',
|
|
36
|
+
info: 'Info'
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
function titleFor(item: ToastItem): string | undefined {
|
|
40
|
+
// If an explicit title is provided (including empty string), respect it.
|
|
41
|
+
// Otherwise, use the variant-based default.
|
|
42
|
+
return item.title ?? defaultTitles[item.variant];
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// 内部デフォルトを利用するため、特別な設定は不要
|
|
46
|
+
|
|
47
|
+
let lastSig = '';
|
|
48
|
+
// Direct props pathway (message/variant/duration)
|
|
49
|
+
$: if (message) {
|
|
50
|
+
const sig = `${message}|${variant ?? 'info'}|${duration ?? ''}`;
|
|
51
|
+
if (sig !== lastSig) {
|
|
52
|
+
showToast({ message, variant, duration });
|
|
53
|
+
lastSig = sig;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
<div class="toaster" data-pos={position} aria-live="polite" aria-atomic="false">
|
|
59
|
+
{#each list as t (t.id)}
|
|
60
|
+
<div
|
|
61
|
+
class="toast"
|
|
62
|
+
data-variant={t.variant}
|
|
63
|
+
role="status"
|
|
64
|
+
style={colorVars(t)}
|
|
65
|
+
in:fly={{ x: position.endsWith('right') ? 24 : -24, duration: 150 }}
|
|
66
|
+
out:fade={{ duration: 150 }}
|
|
67
|
+
>
|
|
68
|
+
<div class="toast-body">
|
|
69
|
+
{#if titleFor(t)}<div class="toast-title">{titleFor(t)}</div>{/if}
|
|
70
|
+
<div class="toast-message">{t.message}</div>
|
|
71
|
+
</div>
|
|
72
|
+
{#if dismissible}
|
|
73
|
+
<button
|
|
74
|
+
type="button"
|
|
75
|
+
class="toast-close"
|
|
76
|
+
aria-label="Close notification"
|
|
77
|
+
on:click={() => dismiss(t.id)}>×</button
|
|
78
|
+
>
|
|
79
|
+
{/if}
|
|
80
|
+
</div>
|
|
81
|
+
{/each}
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<style>
|
|
85
|
+
.toaster {
|
|
86
|
+
position: fixed;
|
|
87
|
+
z-index: 10050;
|
|
88
|
+
pointer-events: none;
|
|
89
|
+
}
|
|
90
|
+
.toaster[data-pos='top-right'] {
|
|
91
|
+
top: 12px;
|
|
92
|
+
right: 12px;
|
|
93
|
+
}
|
|
94
|
+
.toaster[data-pos='top-left'] {
|
|
95
|
+
top: 12px;
|
|
96
|
+
left: 12px;
|
|
97
|
+
}
|
|
98
|
+
.toaster[data-pos='bottom-right'] {
|
|
99
|
+
bottom: 12px;
|
|
100
|
+
right: 12px;
|
|
101
|
+
}
|
|
102
|
+
.toaster[data-pos='bottom-left'] {
|
|
103
|
+
bottom: 12px;
|
|
104
|
+
left: 12px;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
.toast {
|
|
108
|
+
min-width: 260px;
|
|
109
|
+
max-width: min(360px, calc(100vw - 24px));
|
|
110
|
+
background: var(--toast-bg);
|
|
111
|
+
color: var(--toast-fg, #fff);
|
|
112
|
+
border-radius: 10px;
|
|
113
|
+
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
|
|
114
|
+
display: flex;
|
|
115
|
+
align-items: flex-start;
|
|
116
|
+
gap: 8px;
|
|
117
|
+
padding: 10px 10px 10px 12px;
|
|
118
|
+
margin: 8px 0;
|
|
119
|
+
pointer-events: auto;
|
|
120
|
+
}
|
|
121
|
+
.toast-title {
|
|
122
|
+
font-weight: 700;
|
|
123
|
+
margin-bottom: 2px;
|
|
124
|
+
}
|
|
125
|
+
.toast-message {
|
|
126
|
+
font-size: 14px;
|
|
127
|
+
}
|
|
128
|
+
.toast-close {
|
|
129
|
+
border: none;
|
|
130
|
+
background: transparent;
|
|
131
|
+
color: inherit;
|
|
132
|
+
font-size: 18px;
|
|
133
|
+
line-height: 1;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
padding: 0 4px;
|
|
136
|
+
align-self: start;
|
|
137
|
+
margin-left: auto;
|
|
138
|
+
}
|
|
139
|
+
.toast-close:focus-visible {
|
|
140
|
+
outline: 2px solid currentColor;
|
|
141
|
+
outline-offset: 2px;
|
|
142
|
+
border-radius: 4px;
|
|
143
|
+
}
|
|
144
|
+
</style>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type ToastVariant } from './toast';
|
|
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;
|
|
12
|
+
};
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
14
|
+
}
|
|
15
|
+
declare const Toaster: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
position?: "top-right" | "top-left" | "bottom-right" | "bottom-left";
|
|
17
|
+
maxVisible?: number;
|
|
18
|
+
dismissible?: boolean;
|
|
19
|
+
message: string;
|
|
20
|
+
variant?: ToastVariant;
|
|
21
|
+
duration: number;
|
|
22
|
+
}, {
|
|
23
|
+
[evt: string]: CustomEvent<any>;
|
|
24
|
+
}, {}, {}, string>;
|
|
25
|
+
type Toaster = InstanceType<typeof Toaster>;
|
|
26
|
+
export default Toaster;
|
package/dist/Toggle.svelte
CHANGED
|
@@ -1,75 +1,99 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { CCLVividColor } from './const/config';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* トグルスイッチの状態
|
|
6
|
+
* @default false
|
|
7
|
+
* @type boolean
|
|
8
|
+
*/
|
|
9
|
+
export let checked: boolean = false;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* トグルスイッチの色
|
|
13
|
+
* @default CCLVividColor.SODA_BLUE
|
|
14
|
+
* @type string
|
|
15
|
+
*/
|
|
16
|
+
export let color: string = CCLVividColor.SODA_BLUE;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 非活性状態
|
|
20
|
+
* @default false
|
|
21
|
+
* @type boolean
|
|
22
|
+
*/
|
|
23
|
+
export let disabled: boolean = false;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* 状態が変更されたときのイベントハンドラ
|
|
27
|
+
* @type {() => void}
|
|
28
|
+
*/
|
|
29
|
+
export let onChange: () => void = () => {};
|
|
30
|
+
|
|
31
|
+
function handleChange(event: Event) {
|
|
32
|
+
if (disabled) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const target = event.target as HTMLInputElement;
|
|
36
|
+
checked = target.checked;
|
|
37
|
+
onChange();
|
|
10
38
|
}
|
|
11
|
-
const target = event.target;
|
|
12
|
-
checked = target.checked;
|
|
13
|
-
onChange();
|
|
14
|
-
}
|
|
15
39
|
</script>
|
|
16
40
|
|
|
17
41
|
<label class="switchWrapper" class:disabled>
|
|
18
|
-
|
|
19
|
-
|
|
42
|
+
<input type="checkbox" {checked} on:change={handleChange} {disabled} />
|
|
43
|
+
<span class="slider" style={`--bg-color: var(${color});`}></span>
|
|
20
44
|
</label>
|
|
21
45
|
|
|
22
46
|
<style>
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
47
|
+
.switchWrapper {
|
|
48
|
+
position: relative;
|
|
49
|
+
display: inline-block;
|
|
50
|
+
width: 50px;
|
|
51
|
+
height: 28px;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
.switchWrapper.disabled {
|
|
55
|
+
cursor: not-allowed;
|
|
56
|
+
opacity: 0.6;
|
|
57
|
+
}
|
|
34
58
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
59
|
+
.switchWrapper input {
|
|
60
|
+
opacity: 0;
|
|
61
|
+
width: 0;
|
|
62
|
+
height: 0;
|
|
63
|
+
}
|
|
40
64
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
65
|
+
.slider {
|
|
66
|
+
position: absolute;
|
|
67
|
+
top: 0;
|
|
68
|
+
left: 0;
|
|
69
|
+
right: 0;
|
|
70
|
+
bottom: 0;
|
|
71
|
+
background-color: #ccc;
|
|
72
|
+
transition: 0.4s;
|
|
73
|
+
border-radius: 28px;
|
|
74
|
+
}
|
|
51
75
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
76
|
+
.slider:before {
|
|
77
|
+
position: absolute;
|
|
78
|
+
content: '';
|
|
79
|
+
height: 20px;
|
|
80
|
+
width: 20px;
|
|
81
|
+
left: 4px;
|
|
82
|
+
bottom: 4px;
|
|
83
|
+
background-color: white;
|
|
84
|
+
transition: 0.4s;
|
|
85
|
+
border-radius: 50%;
|
|
86
|
+
}
|
|
63
87
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
88
|
+
input:checked + .slider {
|
|
89
|
+
background-color: var(--bg-color);
|
|
90
|
+
}
|
|
67
91
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
92
|
+
input:focus + .slider {
|
|
93
|
+
box-shadow: 0 0 1px var(--bg-color);
|
|
94
|
+
}
|
|
71
95
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
96
|
+
input:checked + .slider:before {
|
|
97
|
+
transform: translateX(22px);
|
|
98
|
+
}
|
|
75
99
|
</style>
|
package/dist/Toggle.svelte.d.ts
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* @default CCLVividColor.SODA_BLUE
|
|
12
|
-
* @type string
|
|
13
|
-
*/ color?: string;
|
|
14
|
-
/**
|
|
15
|
-
* 非活性状態
|
|
16
|
-
* @default false
|
|
17
|
-
* @type boolean
|
|
18
|
-
*/ disabled?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* 状態が変更されたときのイベントハンドラ
|
|
21
|
-
* @type {() => void}
|
|
22
|
-
*/ onChange?: () => void;
|
|
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;
|
|
23
11
|
};
|
|
24
|
-
|
|
25
|
-
[evt: string]: CustomEvent<any>;
|
|
26
|
-
};
|
|
27
|
-
slots: {};
|
|
28
|
-
exports?: {} | undefined;
|
|
29
|
-
bindings?: string | undefined;
|
|
30
|
-
};
|
|
31
|
-
export type ToggleProps = typeof __propDef.props;
|
|
32
|
-
export type ToggleEvents = typeof __propDef.events;
|
|
33
|
-
export type ToggleSlots = typeof __propDef.slots;
|
|
34
|
-
export default class Toggle extends SvelteComponent<ToggleProps, ToggleEvents, ToggleSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
35
13
|
}
|
|
36
|
-
|
|
14
|
+
declare const Toggle: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
/**
|
|
16
|
+
* トグルスイッチの状態
|
|
17
|
+
* @default false
|
|
18
|
+
* @type boolean
|
|
19
|
+
*/ checked?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* トグルスイッチの色
|
|
22
|
+
* @default CCLVividColor.SODA_BLUE
|
|
23
|
+
* @type string
|
|
24
|
+
*/ color?: string;
|
|
25
|
+
/**
|
|
26
|
+
* 非活性状態
|
|
27
|
+
* @default false
|
|
28
|
+
* @type boolean
|
|
29
|
+
*/ disabled?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 状態が変更されたときのイベントハンドラ
|
|
32
|
+
* @type {() => void}
|
|
33
|
+
*/ onChange?: () => void;
|
|
34
|
+
}, {
|
|
35
|
+
[evt: string]: CustomEvent<any>;
|
|
36
|
+
}, {}, {}, string>;
|
|
37
|
+
type Toggle = InstanceType<typeof Toggle>;
|
|
38
|
+
export default Toggle;
|