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
package/dist/Input.svelte.d.ts
CHANGED
|
@@ -1,62 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
* @default ''
|
|
12
|
-
* @type string
|
|
13
|
-
*/ label?: string;
|
|
14
|
-
/**
|
|
15
|
-
* 入力値
|
|
16
|
-
* @default ''
|
|
17
|
-
* @type string
|
|
18
|
-
*/ value?: string;
|
|
19
|
-
/**
|
|
20
|
-
* プレースホルダーのテキスト
|
|
21
|
-
* @default ''
|
|
22
|
-
* @type string
|
|
23
|
-
*/ placeholder?: string;
|
|
24
|
-
/**
|
|
25
|
-
* 枠線の色
|
|
26
|
-
* @default --strawberry-pink
|
|
27
|
-
* @type string
|
|
28
|
-
*/ borderColor?: string;
|
|
29
|
-
/**
|
|
30
|
-
* 非活性状態にするか
|
|
31
|
-
* @default false
|
|
32
|
-
* @type boolean
|
|
33
|
-
*/ disabled?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* コンポーネントのID
|
|
36
|
-
* @default 'ccl-input'
|
|
37
|
-
* @type string
|
|
38
|
-
*/ id?: string;
|
|
39
|
-
/**
|
|
40
|
-
* バリデーションメッセージ
|
|
41
|
-
* @default ''
|
|
42
|
-
* @type string
|
|
43
|
-
*/ validationMessage?: string;
|
|
44
|
-
/**
|
|
45
|
-
* バリデーションの状態
|
|
46
|
-
* @default true
|
|
47
|
-
* @type boolean
|
|
48
|
-
*/ isValid?: boolean;
|
|
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;
|
|
49
11
|
};
|
|
50
|
-
|
|
51
|
-
[evt: string]: CustomEvent<any>;
|
|
52
|
-
};
|
|
53
|
-
slots: {};
|
|
54
|
-
exports?: {} | undefined;
|
|
55
|
-
bindings?: string | undefined;
|
|
56
|
-
};
|
|
57
|
-
export type InputProps = typeof __propDef.props;
|
|
58
|
-
export type InputEvents = typeof __propDef.events;
|
|
59
|
-
export type InputSlots = typeof __propDef.slots;
|
|
60
|
-
export default class Input extends SvelteComponent<InputProps, InputEvents, InputSlots> {
|
|
12
|
+
z_$$bindings?: Bindings;
|
|
61
13
|
}
|
|
62
|
-
|
|
14
|
+
declare const Input: $$__sveltets_2_IsomorphicComponent<{
|
|
15
|
+
/**
|
|
16
|
+
* 入力フィールドのタイプ
|
|
17
|
+
* @default 'text'
|
|
18
|
+
* @type {'text' | 'password' | 'email' | 'number'}
|
|
19
|
+
*/ type?: "text" | "password" | "email" | "number";
|
|
20
|
+
/**
|
|
21
|
+
* ラベルのテキスト
|
|
22
|
+
* @default ''
|
|
23
|
+
* @type string
|
|
24
|
+
*/ label?: string;
|
|
25
|
+
/**
|
|
26
|
+
* 入力値
|
|
27
|
+
* @default ''
|
|
28
|
+
* @type string
|
|
29
|
+
*/ value?: string;
|
|
30
|
+
/**
|
|
31
|
+
* プレースホルダーのテキスト
|
|
32
|
+
* @default ''
|
|
33
|
+
* @type string
|
|
34
|
+
*/ placeholder?: string;
|
|
35
|
+
/**
|
|
36
|
+
* 枠線の色
|
|
37
|
+
* @default --strawberry-pink
|
|
38
|
+
* @type string
|
|
39
|
+
*/ borderColor?: string;
|
|
40
|
+
/**
|
|
41
|
+
* 非活性状態にするか
|
|
42
|
+
* @default false
|
|
43
|
+
* @type boolean
|
|
44
|
+
*/ disabled?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* コンポーネントのID
|
|
47
|
+
* @default 'ccl-input'
|
|
48
|
+
* @type string
|
|
49
|
+
*/ id?: string;
|
|
50
|
+
/**
|
|
51
|
+
* バリデーションメッセージ
|
|
52
|
+
* @default ''
|
|
53
|
+
* @type string
|
|
54
|
+
*/ validationMessage?: string;
|
|
55
|
+
/**
|
|
56
|
+
* バリデーションの状態
|
|
57
|
+
* @default true
|
|
58
|
+
* @type boolean
|
|
59
|
+
*/ isValid?: boolean;
|
|
60
|
+
}, {
|
|
61
|
+
[evt: string]: CustomEvent<any>;
|
|
62
|
+
}, {}, {}, string>;
|
|
63
|
+
type Input = InstanceType<typeof Input>;
|
|
64
|
+
export default Input;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createEventDispatcher, onMount } from 'svelte';
|
|
3
|
+
import type { ColorVar } from './const/config';
|
|
4
|
+
|
|
5
|
+
export let page: number = 1; // 1-based
|
|
6
|
+
export let total: number | undefined = undefined; // total items
|
|
7
|
+
export let perPage: number = 10; // items per page when using total
|
|
8
|
+
export let pageCount: number | undefined = undefined; // total pages (alternative to total)
|
|
9
|
+
export let boundaryCount: number = 1; // pages maintained at each boundary
|
|
10
|
+
export let siblingCount: number = 1; // pages around current page
|
|
11
|
+
export let showFirstLast: boolean = true;
|
|
12
|
+
export let showPrevNext: boolean = true;
|
|
13
|
+
export let disabled: boolean = false;
|
|
14
|
+
export let accentColor: ColorVar = '--soda-blue';
|
|
15
|
+
export let ariaLabel: string = 'Pagination';
|
|
16
|
+
|
|
17
|
+
const dispatch = createEventDispatcher<{ change: { page: number } }>();
|
|
18
|
+
|
|
19
|
+
// normalize and clamp helpers
|
|
20
|
+
function getPageCount(): number {
|
|
21
|
+
const count = pageCount ?? (total && perPage ? Math.ceil(total / perPage) : 1);
|
|
22
|
+
return Math.max(1, count || 1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function clampPage(p: number): number {
|
|
26
|
+
const max = getPageCount();
|
|
27
|
+
return Math.min(Math.max(1, Math.trunc(p || 1)), max);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
$: page = clampPage(page);
|
|
31
|
+
|
|
32
|
+
function goTo(p: number) {
|
|
33
|
+
if (disabled) return;
|
|
34
|
+
const next = clampPage(p);
|
|
35
|
+
if (next !== page) {
|
|
36
|
+
page = next;
|
|
37
|
+
dispatch('change', { page });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
type Item = number | 'ellipsis';
|
|
42
|
+
|
|
43
|
+
function range(start: number, end: number): number[] {
|
|
44
|
+
return Array.from({ length: end - start + 1 }, (_, i) => start + i);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function usePagination(): Item[] {
|
|
48
|
+
const totalPages = getPageCount();
|
|
49
|
+
|
|
50
|
+
// total pages small enough to show all
|
|
51
|
+
const totalNumbers = boundaryCount * 2 + siblingCount * 2 + 3; // first + last + current
|
|
52
|
+
const totalBlocks = totalNumbers + 2; // with two ellipses
|
|
53
|
+
|
|
54
|
+
if (totalPages <= totalBlocks) {
|
|
55
|
+
return range(1, totalPages);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const startPages = range(1, Math.min(boundaryCount, totalPages));
|
|
59
|
+
const endPages = range(
|
|
60
|
+
Math.max(totalPages - boundaryCount + 1, boundaryCount + 1),
|
|
61
|
+
totalPages
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const siblingsStart = Math.max(
|
|
65
|
+
Math.min(page - siblingCount, totalPages - boundaryCount - siblingCount * 2 - 1),
|
|
66
|
+
boundaryCount + 2
|
|
67
|
+
);
|
|
68
|
+
const siblingsEnd = Math.min(
|
|
69
|
+
Math.max(page + siblingCount, boundaryCount + siblingCount * 2 + 2),
|
|
70
|
+
endPages[0] - 2
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const items: Item[] = [
|
|
74
|
+
...startPages,
|
|
75
|
+
siblingsStart > boundaryCount + 2 ? 'ellipsis' : (boundaryCount + 1) as unknown as Item,
|
|
76
|
+
...range(siblingsStart, siblingsEnd),
|
|
77
|
+
siblingsEnd < totalPages - boundaryCount - 1 ? 'ellipsis' : (totalPages - boundaryCount) as unknown as Item,
|
|
78
|
+
...endPages
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
// Clean up potential duplicate numbers from the conditional fallbacks above
|
|
82
|
+
const normalized: Item[] = [];
|
|
83
|
+
let prev: Item | undefined = undefined;
|
|
84
|
+
for (const it of items) {
|
|
85
|
+
if (it === 'ellipsis') {
|
|
86
|
+
if (prev !== 'ellipsis') normalized.push('ellipsis');
|
|
87
|
+
} else {
|
|
88
|
+
if (it !== prev) normalized.push(it);
|
|
89
|
+
}
|
|
90
|
+
prev = it;
|
|
91
|
+
}
|
|
92
|
+
return normalized;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
$: items = usePagination();
|
|
96
|
+
|
|
97
|
+
onMount(() => {
|
|
98
|
+
// Ensure initial page is clamped and consumers can react if needed
|
|
99
|
+
const normalized = clampPage(page);
|
|
100
|
+
if (normalized !== page) {
|
|
101
|
+
page = normalized;
|
|
102
|
+
dispatch('change', { page });
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
</script>
|
|
106
|
+
|
|
107
|
+
<nav class="ccl-pagination" aria-label={ariaLabel} style={`--ccl-pagination-accent: var(${accentColor});`}>
|
|
108
|
+
<ul class="ccl-pagination__list" role="list">
|
|
109
|
+
{#if showFirstLast}
|
|
110
|
+
<li>
|
|
111
|
+
<button
|
|
112
|
+
class="ccl-pagination__control"
|
|
113
|
+
on:click={() => goTo(1)}
|
|
114
|
+
disabled={disabled || page === 1}
|
|
115
|
+
aria-label="go to first page"
|
|
116
|
+
type="button"
|
|
117
|
+
>«</button>
|
|
118
|
+
</li>
|
|
119
|
+
{/if}
|
|
120
|
+
{#if showPrevNext}
|
|
121
|
+
<li>
|
|
122
|
+
<button
|
|
123
|
+
class="ccl-pagination__control"
|
|
124
|
+
on:click={() => goTo(page - 1)}
|
|
125
|
+
disabled={disabled || page === 1}
|
|
126
|
+
aria-label="go to previous page"
|
|
127
|
+
type="button"
|
|
128
|
+
>‹</button>
|
|
129
|
+
</li>
|
|
130
|
+
{/if}
|
|
131
|
+
|
|
132
|
+
{#each items as it}
|
|
133
|
+
{#if it === 'ellipsis'}
|
|
134
|
+
<li class="ccl-pagination__ellipsis" aria-hidden="true">…</li>
|
|
135
|
+
{:else}
|
|
136
|
+
<li>
|
|
137
|
+
<button
|
|
138
|
+
class="ccl-pagination__page"
|
|
139
|
+
class:active={it === page}
|
|
140
|
+
aria-label={`go to page ${it}`}
|
|
141
|
+
aria-current={it === page ? 'page' : undefined}
|
|
142
|
+
disabled={disabled}
|
|
143
|
+
on:click={() => goTo(it)}
|
|
144
|
+
type="button"
|
|
145
|
+
>{it}</button>
|
|
146
|
+
</li>
|
|
147
|
+
{/if}
|
|
148
|
+
{/each}
|
|
149
|
+
|
|
150
|
+
{#if showPrevNext}
|
|
151
|
+
<li>
|
|
152
|
+
<button
|
|
153
|
+
class="ccl-pagination__control"
|
|
154
|
+
on:click={() => goTo(page + 1)}
|
|
155
|
+
disabled={disabled || page === getPageCount()}
|
|
156
|
+
aria-label="go to next page"
|
|
157
|
+
type="button"
|
|
158
|
+
>›</button>
|
|
159
|
+
</li>
|
|
160
|
+
{/if}
|
|
161
|
+
{#if showFirstLast}
|
|
162
|
+
<li>
|
|
163
|
+
<button
|
|
164
|
+
class="ccl-pagination__control"
|
|
165
|
+
on:click={() => goTo(getPageCount())}
|
|
166
|
+
disabled={disabled || page === getPageCount()}
|
|
167
|
+
aria-label="go to last page"
|
|
168
|
+
type="button"
|
|
169
|
+
>»</button>
|
|
170
|
+
</li>
|
|
171
|
+
{/if}
|
|
172
|
+
</ul>
|
|
173
|
+
</nav>
|
|
174
|
+
|
|
175
|
+
<style>
|
|
176
|
+
.ccl-pagination {
|
|
177
|
+
--ccl-pagination-accent: var(--soda-blue);
|
|
178
|
+
display: inline-block;
|
|
179
|
+
}
|
|
180
|
+
.ccl-pagination__list {
|
|
181
|
+
list-style: none;
|
|
182
|
+
display: inline-flex;
|
|
183
|
+
gap: 6px;
|
|
184
|
+
padding: 0;
|
|
185
|
+
margin: 0;
|
|
186
|
+
align-items: center;
|
|
187
|
+
}
|
|
188
|
+
.ccl-pagination__page,
|
|
189
|
+
.ccl-pagination__control {
|
|
190
|
+
appearance: none;
|
|
191
|
+
border: 1px solid var(--wrap-grey, #ccc);
|
|
192
|
+
background: white;
|
|
193
|
+
color: inherit;
|
|
194
|
+
width: 36px;
|
|
195
|
+
height: 36px;
|
|
196
|
+
padding: 0;
|
|
197
|
+
border-radius: 50%;
|
|
198
|
+
cursor: pointer;
|
|
199
|
+
font: inherit;
|
|
200
|
+
display: inline-flex;
|
|
201
|
+
align-items: center;
|
|
202
|
+
justify-content: center;
|
|
203
|
+
}
|
|
204
|
+
.ccl-pagination__page.active {
|
|
205
|
+
background: var(--ccl-pagination-accent);
|
|
206
|
+
border-color: var(--ccl-pagination-accent);
|
|
207
|
+
color: white;
|
|
208
|
+
}
|
|
209
|
+
.ccl-pagination__ellipsis {
|
|
210
|
+
padding: 0 4px;
|
|
211
|
+
color: var(--wrap-grey, #888);
|
|
212
|
+
}
|
|
213
|
+
.ccl-pagination__page:disabled,
|
|
214
|
+
.ccl-pagination__control:disabled {
|
|
215
|
+
opacity: 0.5;
|
|
216
|
+
cursor: not-allowed;
|
|
217
|
+
}
|
|
218
|
+
.ccl-pagination__page:not(:disabled):hover,
|
|
219
|
+
.ccl-pagination__control:not(:disabled):hover {
|
|
220
|
+
border-color: var(--ccl-pagination-accent);
|
|
221
|
+
}
|
|
222
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ColorVar } from './const/config';
|
|
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 Pagination: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
page?: number;
|
|
17
|
+
total?: number | undefined;
|
|
18
|
+
perPage?: number;
|
|
19
|
+
pageCount?: number | undefined;
|
|
20
|
+
boundaryCount?: number;
|
|
21
|
+
siblingCount?: number;
|
|
22
|
+
showFirstLast?: boolean;
|
|
23
|
+
showPrevNext?: boolean;
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
accentColor?: ColorVar;
|
|
26
|
+
ariaLabel?: string;
|
|
27
|
+
}, {
|
|
28
|
+
change: CustomEvent<{
|
|
29
|
+
page: number;
|
|
30
|
+
}>;
|
|
31
|
+
} & {
|
|
32
|
+
[evt: string]: CustomEvent<any>;
|
|
33
|
+
}, {}, {}, string>;
|
|
34
|
+
type Pagination = InstanceType<typeof Pagination>;
|
|
35
|
+
export default Pagination;
|
package/dist/ProgressBar.svelte
CHANGED
|
@@ -1,52 +1,57 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export let
|
|
5
|
-
export let
|
|
6
|
-
export let
|
|
7
|
-
export let
|
|
8
|
-
export let
|
|
9
|
-
export let
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { CCLVividColor, ProgressBarHeight } from './const/config';
|
|
3
|
+
|
|
4
|
+
export let value: number = 0; // 現在の進捗 (0-100)
|
|
5
|
+
export let maxValue: number = 100; // 最大値
|
|
6
|
+
export let barColor: string = CCLVividColor.SODA_BLUE; // バーの色
|
|
7
|
+
export let backgroundColor: string = '#e0e0e0'; // 背景色
|
|
8
|
+
export let height: ProgressBarHeight = ProgressBarHeight.DEFAULT; // プログレスバーの高さ
|
|
9
|
+
export let containerWidth: string = '100%'; // プログレスバー全体の幅
|
|
10
|
+
export let isSticky: boolean = false; // 上部に固定表示するか
|
|
11
|
+
export let isRounded: boolean = true; // 角を丸くするか
|
|
12
|
+
|
|
13
|
+
$: progress = (value / maxValue) * 100;
|
|
14
|
+
$: finalBarColor = barColor.startsWith('--') ? `var(${barColor})` : barColor;
|
|
15
|
+
$: finalBackgroundColor = backgroundColor.startsWith('--')
|
|
16
|
+
? `var(${backgroundColor})`
|
|
17
|
+
: backgroundColor;
|
|
13
18
|
</script>
|
|
14
19
|
|
|
15
20
|
<div
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
class="progress-bar-container"
|
|
22
|
+
class:sticky={isSticky}
|
|
23
|
+
class:rounded={isRounded}
|
|
24
|
+
style="background-color: {finalBackgroundColor}; width: {containerWidth}; height: {height};"
|
|
25
|
+
role="progressbar"
|
|
26
|
+
aria-valuenow={value}
|
|
27
|
+
aria-valuemin="0"
|
|
28
|
+
aria-valuemax={maxValue}
|
|
24
29
|
>
|
|
25
|
-
|
|
30
|
+
<div class="progress-bar" style="width: {progress}%; background-color: {finalBarColor};"></div>
|
|
26
31
|
</div>
|
|
27
32
|
|
|
28
33
|
<style>
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
34
|
+
.progress-bar-container {
|
|
35
|
+
overflow: hidden;
|
|
36
|
+
position: relative;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.progress-bar-container.sticky {
|
|
40
|
+
position: fixed;
|
|
41
|
+
top: 0;
|
|
42
|
+
left: 0;
|
|
43
|
+
z-index: 9999;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.progress-bar-container.rounded {
|
|
47
|
+
border-radius: 10px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.progress-bar {
|
|
51
|
+
height: 100%;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.progress-bar-container.rounded .progress-bar {
|
|
55
|
+
border-radius: 10px;
|
|
56
|
+
}
|
|
52
57
|
</style>
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { SvelteComponent } from "svelte";
|
|
2
1
|
import { ProgressBarHeight } from './const/config';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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;
|
|
13
12
|
};
|
|
14
|
-
|
|
15
|
-
[evt: string]: CustomEvent<any>;
|
|
16
|
-
};
|
|
17
|
-
slots: {};
|
|
18
|
-
exports?: {} | undefined;
|
|
19
|
-
bindings?: string | undefined;
|
|
20
|
-
};
|
|
21
|
-
export type ProgressBarProps = typeof __propDef.props;
|
|
22
|
-
export type ProgressBarEvents = typeof __propDef.events;
|
|
23
|
-
export type ProgressBarSlots = typeof __propDef.slots;
|
|
24
|
-
export default class ProgressBar extends SvelteComponent<ProgressBarProps, ProgressBarEvents, ProgressBarSlots> {
|
|
13
|
+
z_$$bindings?: Bindings;
|
|
25
14
|
}
|
|
26
|
-
|
|
15
|
+
declare const ProgressBar: $$__sveltets_2_IsomorphicComponent<{
|
|
16
|
+
value?: number;
|
|
17
|
+
maxValue?: number;
|
|
18
|
+
barColor?: string;
|
|
19
|
+
backgroundColor?: string;
|
|
20
|
+
height?: ProgressBarHeight;
|
|
21
|
+
containerWidth?: string;
|
|
22
|
+
isSticky?: boolean;
|
|
23
|
+
isRounded?: boolean;
|
|
24
|
+
}, {
|
|
25
|
+
[evt: string]: CustomEvent<any>;
|
|
26
|
+
}, {}, {}, string>;
|
|
27
|
+
type ProgressBar = InstanceType<typeof ProgressBar>;
|
|
28
|
+
export default ProgressBar;
|