mertani-web-toolkit 0.1.40 → 0.1.41
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/components/Table/Table.svelte +46 -4
- package/dist/components/Table/Table.svelte.d.ts +1 -0
- package/dist/components/Table/table.css +85 -0
- package/dist/components/inputs/Toggle/Toggle.css +74 -0
- package/dist/components/inputs/Toggle/Toggle.svelte +201 -0
- package/dist/components/inputs/Toggle/Toggle.svelte.d.ts +29 -0
- package/dist/icons/Asap.svelte +11 -0
- package/dist/icons/Asap.svelte.d.ts +26 -0
- package/dist/icons/Berawan.svelte +6 -0
- package/dist/icons/Berawan.svelte.d.ts +26 -0
- package/dist/icons/BerawanTebal.svelte +7 -0
- package/dist/icons/BerawanTebal.svelte.d.ts +26 -0
- package/dist/icons/BsArrowDown.svelte +15 -0
- package/dist/icons/BsArrowDown.svelte.d.ts +26 -0
- package/dist/icons/BsArrowUp.svelte +15 -0
- package/dist/icons/BsArrowUp.svelte.d.ts +26 -0
- package/dist/icons/BsCrosshair.svelte +10 -0
- package/dist/icons/BsCrosshair.svelte.d.ts +26 -0
- package/dist/icons/BsGrid1x2.svelte +19 -0
- package/dist/icons/BsGrid1x2.svelte.d.ts +26 -0
- package/dist/icons/BsMoon.svelte +13 -0
- package/dist/icons/BsMoon.svelte.d.ts +26 -0
- package/dist/icons/BsPauseCircleFill.svelte +19 -0
- package/dist/icons/BsPauseCircleFill.svelte.d.ts +26 -0
- package/dist/icons/BsPlayCircleFill.svelte +19 -0
- package/dist/icons/BsPlayCircleFill.svelte.d.ts +26 -0
- package/dist/icons/BsSun.svelte +10 -0
- package/dist/icons/BsSun.svelte.d.ts +26 -0
- package/dist/icons/BsTable.svelte +10 -0
- package/dist/icons/BsTable.svelte.d.ts +26 -0
- package/dist/icons/Cerah.svelte +11 -0
- package/dist/icons/Cerah.svelte.d.ts +26 -0
- package/dist/icons/CerahBerawan.svelte +13 -0
- package/dist/icons/CerahBerawan.svelte.d.ts +26 -0
- package/dist/icons/Fe2Layers.svelte +3 -0
- package/dist/icons/Fe2Layers.svelte.d.ts +26 -0
- package/dist/icons/FeMaximize.svelte +9 -0
- package/dist/icons/FeMaximize.svelte.d.ts +26 -0
- package/dist/icons/HujanLebat.svelte +19 -0
- package/dist/icons/HujanLebat.svelte.d.ts +26 -0
- package/dist/icons/HujanLokal.svelte +21 -0
- package/dist/icons/HujanLokal.svelte.d.ts +26 -0
- package/dist/icons/HujanPetirExtreme.svelte +20 -0
- package/dist/icons/HujanPetirExtreme.svelte.d.ts +26 -0
- package/dist/icons/HujanRingan.svelte +9 -0
- package/dist/icons/HujanRingan.svelte.d.ts +26 -0
- package/dist/icons/HujanSangatLebat.svelte +17 -0
- package/dist/icons/HujanSangatLebat.svelte.d.ts +26 -0
- package/dist/icons/HujanSedang.svelte +19 -0
- package/dist/icons/HujanSedang.svelte.d.ts +26 -0
- package/dist/icons/Kabut.svelte +15 -0
- package/dist/icons/Kabut.svelte.d.ts +26 -0
- package/dist/icons/MsAir.svelte +25 -0
- package/dist/icons/MsAir.svelte.d.ts +26 -0
- package/dist/icons/MsEyeTracking.svelte +25 -0
- package/dist/icons/MsEyeTracking.svelte.d.ts +26 -0
- package/dist/icons/MsHumidityPercentage.svelte +25 -0
- package/dist/icons/MsHumidityPercentage.svelte.d.ts +26 -0
- package/dist/icons/MsOpenWith.svelte +25 -0
- package/dist/icons/MsOpenWith.svelte.d.ts +26 -0
- package/dist/icons/MsThermostat.svelte +25 -0
- package/dist/icons/MsThermostat.svelte.d.ts +26 -0
- package/dist/icons/UdaraKabut.svelte +8 -0
- package/dist/icons/UdaraKabut.svelte.d.ts +26 -0
- package/dist/icons/index.js +59 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/package.json +1 -1
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
onPageChange,
|
|
24
24
|
onItemsPerPageChange,
|
|
25
25
|
defaultBadgeStatusMappings,
|
|
26
|
-
emptyMessage = 'Tidak ada data'
|
|
26
|
+
emptyMessage = 'Tidak ada data',
|
|
27
|
+
showCellHover = false
|
|
27
28
|
}: {
|
|
28
29
|
columns?: Column[];
|
|
29
30
|
data?: any[];
|
|
@@ -40,11 +41,13 @@
|
|
|
40
41
|
onItemsPerPageChange?: (itemsPerPage: number) => void;
|
|
41
42
|
defaultBadgeStatusMappings?: BadgeStatusMapping[];
|
|
42
43
|
emptyMessage?: string;
|
|
44
|
+
showCellHover?: boolean;
|
|
43
45
|
} = $props();
|
|
44
46
|
|
|
45
47
|
let scrollContainer: HTMLElement | null = $state(null);
|
|
46
48
|
let internalHasHorizontalScroll = $state(false);
|
|
47
49
|
let isMobile = $state(false);
|
|
50
|
+
let hoveredColumnIndex: number | null = $state(null);
|
|
48
51
|
|
|
49
52
|
$effect(() => {
|
|
50
53
|
if (typeof window === 'undefined') return;
|
|
@@ -127,6 +130,41 @@
|
|
|
127
130
|
const flatColumns = $derived(flattenColumns(columns, false));
|
|
128
131
|
const totalColumnCount = $derived(getTotalColumnCount(columns));
|
|
129
132
|
|
|
133
|
+
// ========== COLUMN HOVER UTILITIES ==========
|
|
134
|
+
function getFlatColumnIndex(parentIndex: number, childIndex: number, columns: Column[]): number {
|
|
135
|
+
let flatIndex = 0;
|
|
136
|
+
for (let i = 0; i < parentIndex; i++) {
|
|
137
|
+
const col = columns[i];
|
|
138
|
+
if (col && col.children && col.children.length > 0) {
|
|
139
|
+
flatIndex += col.children.length;
|
|
140
|
+
} else {
|
|
141
|
+
flatIndex += 1;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return flatIndex + childIndex;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
function handleColumnHoverEnter(columnIndex: number) {
|
|
148
|
+
if (showCellHover) {
|
|
149
|
+
hoveredColumnIndex = columnIndex;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
function handleColumnHoverLeave() {
|
|
154
|
+
if (showCellHover) {
|
|
155
|
+
hoveredColumnIndex = null;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function getCellHoverClasses(columnIndex: number): string {
|
|
160
|
+
if (!showCellHover) return '';
|
|
161
|
+
const classes = ['cell-hover'];
|
|
162
|
+
if (hoveredColumnIndex === columnIndex) {
|
|
163
|
+
classes.push('column-hovered');
|
|
164
|
+
}
|
|
165
|
+
return classes.join(' ');
|
|
166
|
+
}
|
|
167
|
+
|
|
130
168
|
// ========== STICKY COLUMN UTILITIES ==========
|
|
131
169
|
function parseWidth(width: string | undefined): number {
|
|
132
170
|
if (!width) return 160;
|
|
@@ -281,7 +319,7 @@
|
|
|
281
319
|
style="margin: 0 1rem; overflow-x: auto; overflow-y: auto; height: {height}; min-height: {minHeight};"
|
|
282
320
|
bind:this={scrollContainer}
|
|
283
321
|
>
|
|
284
|
-
<table style="width: 100%; border-collapse: collapse;">
|
|
322
|
+
<table class:cell-hover-enabled={showCellHover} style="width: 100%; border-collapse: collapse;">
|
|
285
323
|
<thead style="position: sticky; top: 0; z-index: 30;">
|
|
286
324
|
{#if hasNestedColumns}
|
|
287
325
|
<!-- Parent header row -->
|
|
@@ -308,7 +346,7 @@
|
|
|
308
346
|
</tr>
|
|
309
347
|
<!-- Sub-header row -->
|
|
310
348
|
<tr>
|
|
311
|
-
{#each columns as column}
|
|
349
|
+
{#each columns as column, parentIndex}
|
|
312
350
|
{#if column.children && column.children.length > 0}
|
|
313
351
|
{#each column.children as childColumn, childIndex}
|
|
314
352
|
{@const isLastChild = childIndex === column.children.length - 1}
|
|
@@ -378,8 +416,12 @@
|
|
|
378
416
|
>
|
|
379
417
|
{#each flatColumns as column, colIndex}
|
|
380
418
|
<td
|
|
381
|
-
class={column.cellClass || ''}
|
|
419
|
+
class="table-cell {column.cellClass || ''} {getCellHoverClasses(colIndex)}"
|
|
382
420
|
data-shadow={getCellShadow(column)}
|
|
421
|
+
data-cell-hover={showCellHover}
|
|
422
|
+
data-column-index={colIndex}
|
|
423
|
+
onmouseenter={() => handleColumnHoverEnter(colIndex)}
|
|
424
|
+
onmouseleave={() => handleColumnHoverLeave()}
|
|
383
425
|
style="{getCellStyle(column)} {getColumnStyles(column)} {getStickyStyle(
|
|
384
426
|
column,
|
|
385
427
|
colIndex,
|
|
@@ -16,6 +16,7 @@ type $$ComponentProps = {
|
|
|
16
16
|
onItemsPerPageChange?: (itemsPerPage: number) => void;
|
|
17
17
|
defaultBadgeStatusMappings?: BadgeStatusMapping[];
|
|
18
18
|
emptyMessage?: string;
|
|
19
|
+
showCellHover?: boolean;
|
|
19
20
|
};
|
|
20
21
|
declare const Table: import("svelte").Component<$$ComponentProps, {
|
|
21
22
|
Column: typeof Column;
|
|
@@ -52,6 +52,91 @@
|
|
|
52
52
|
background-color: var(--color-bg-surface-subtle) !important;
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
+
/* ========== TABLE CELL HOVER ========== */
|
|
56
|
+
/* CSS Variables for hover styles */
|
|
57
|
+
:root {
|
|
58
|
+
--table-cell-hover-bg: var(--color-bg-surface-subtle);
|
|
59
|
+
--table-cell-hover-column-bg: var(--color-bg-surface-subtle);
|
|
60
|
+
--table-cell-hover-border-color: var(--color-bg-surface-subtle);
|
|
61
|
+
--table-cell-hover-border-width: 3px;
|
|
62
|
+
--table-cell-hover-transition: background-color 0.15s ease;
|
|
63
|
+
--table-cell-hover-z-index: 5;
|
|
64
|
+
--table-cell-hover-z-index-column: 4;
|
|
65
|
+
--table-cell-hover-z-index-border: 7;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* Base cell hover styles */
|
|
69
|
+
[data-cell-hover="true"].table-cell,
|
|
70
|
+
.cell-hover-enabled .table-cell.cell-hover,
|
|
71
|
+
.table-cell.cell-hover {
|
|
72
|
+
position: relative;
|
|
73
|
+
transition: var(--table-cell-hover-transition);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/* Individual cell hover */
|
|
77
|
+
[data-cell-hover="true"].table-cell:hover,
|
|
78
|
+
.cell-hover-enabled .table-cell.cell-hover:hover,
|
|
79
|
+
.table-cell.cell-hover:hover {
|
|
80
|
+
background-color: var(--table-cell-hover-bg) !important;
|
|
81
|
+
z-index: var(--table-cell-hover-z-index);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* Vertical column hover - all cells in same column */
|
|
85
|
+
[data-cell-hover="true"].table-cell.column-hovered,
|
|
86
|
+
.cell-hover-enabled .table-cell.cell-hover.column-hovered,
|
|
87
|
+
.table-cell.cell-hover.column-hovered {
|
|
88
|
+
background-color: var(--table-cell-hover-column-bg) !important;
|
|
89
|
+
z-index: var(--table-cell-hover-z-index-column);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/* Horizontal border indicators (top & bottom) */
|
|
93
|
+
[data-cell-hover="true"].table-cell:hover::before,
|
|
94
|
+
.cell-hover-enabled .table-cell.cell-hover:hover::before,
|
|
95
|
+
.table-cell.cell-hover:hover::before,
|
|
96
|
+
[data-cell-hover="true"].table-cell.column-hovered::before,
|
|
97
|
+
.cell-hover-enabled .table-cell.cell-hover.column-hovered::before,
|
|
98
|
+
.table-cell.cell-hover.column-hovered::before {
|
|
99
|
+
content: "";
|
|
100
|
+
position: absolute;
|
|
101
|
+
top: 0;
|
|
102
|
+
left: 0;
|
|
103
|
+
right: 0;
|
|
104
|
+
height: var(--table-cell-hover-border-width);
|
|
105
|
+
background-color: var(--table-cell-hover-border-color);
|
|
106
|
+
z-index: var(--table-cell-hover-z-index-border);
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
[data-cell-hover="true"].table-cell:hover::after,
|
|
111
|
+
.cell-hover-enabled .table-cell.cell-hover:hover::after,
|
|
112
|
+
.table-cell.cell-hover:hover::after,
|
|
113
|
+
[data-cell-hover="true"].table-cell.column-hovered::after,
|
|
114
|
+
.cell-hover-enabled .table-cell.cell-hover.column-hovered::after,
|
|
115
|
+
.table-cell.cell-hover.column-hovered::after {
|
|
116
|
+
content: "";
|
|
117
|
+
position: absolute;
|
|
118
|
+
bottom: 0;
|
|
119
|
+
left: 0;
|
|
120
|
+
right: 0;
|
|
121
|
+
height: var(--table-cell-hover-border-width);
|
|
122
|
+
background-color: var(--table-cell-hover-border-color);
|
|
123
|
+
z-index: var(--table-cell-hover-z-index-border);
|
|
124
|
+
pointer-events: none;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Row hover interactions */
|
|
128
|
+
[data-cell-hover="true"].table-row:hover .table-cell:hover,
|
|
129
|
+
.cell-hover-enabled .table-row:hover .table-cell.cell-hover:hover,
|
|
130
|
+
.table-row:hover .table-cell.cell-hover:hover {
|
|
131
|
+
background-color: var(--table-cell-hover-bg) !important;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
[data-cell-hover="true"].table-row .table-cell.column-hovered,
|
|
135
|
+
.cell-hover-enabled .table-row .table-cell.cell-hover.column-hovered,
|
|
136
|
+
.table-row .table-cell.cell-hover.column-hovered {
|
|
137
|
+
background-color: var(--color-bg-surface-subtle) !important;
|
|
138
|
+
}
|
|
139
|
+
|
|
55
140
|
/* ========== SHIMMER SKELETON ========== */
|
|
56
141
|
.shimmer-skeleton {
|
|
57
142
|
position: relative;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
.toggle-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
width: 100%;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.toggle-container.toggle-side {
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: 12px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.toggle-container.toggle-side .toggle-label {
|
|
14
|
+
margin-bottom: 0;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.toggle-label {
|
|
18
|
+
font-size: 14px;
|
|
19
|
+
font-weight: 400;
|
|
20
|
+
color: var(--color-text-primary);
|
|
21
|
+
margin-bottom: 4px;
|
|
22
|
+
display: block;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.label-subLabel {
|
|
26
|
+
font-weight: 400;
|
|
27
|
+
color: var(--color-text-tertiary);
|
|
28
|
+
margin-left: 4px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.label-required {
|
|
32
|
+
color: var(--color-text-error-ti);
|
|
33
|
+
margin-left: 4px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.toggle-switch {
|
|
37
|
+
position: relative;
|
|
38
|
+
width: 48px;
|
|
39
|
+
height: 24px;
|
|
40
|
+
background-color: var(--color-bg-disabled);
|
|
41
|
+
border-radius: 12px;
|
|
42
|
+
border: none;
|
|
43
|
+
cursor: pointer;
|
|
44
|
+
padding: 2px;
|
|
45
|
+
transition: background-color 0.2s;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.toggle-switch.enabled {
|
|
49
|
+
background-color: var(--color-bg-act-primary);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.toggle-switch.disabled {
|
|
53
|
+
cursor: not-allowed;
|
|
54
|
+
opacity: 0.5;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.toggle-handle {
|
|
58
|
+
width: 20px;
|
|
59
|
+
height: 20px;
|
|
60
|
+
background-color: var(--color-bg-surface);
|
|
61
|
+
border-radius: 50%;
|
|
62
|
+
transition: transform 0.2s;
|
|
63
|
+
transform: translateX(0);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.toggle-switch.enabled .toggle-handle {
|
|
67
|
+
transform: translateX(24px);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.error-message {
|
|
71
|
+
margin-top: 4px;
|
|
72
|
+
font-size: 12px;
|
|
73
|
+
color: var(--color-text-error-ti);
|
|
74
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
3
|
+
import './Toggle.css';
|
|
4
|
+
|
|
5
|
+
interface Props extends Omit<HTMLButtonAttributes, 'value' | 'onchange'> {
|
|
6
|
+
// ===Styles===
|
|
7
|
+
// Label
|
|
8
|
+
labelColor?: string;
|
|
9
|
+
aligment?: 'side' | 'top';
|
|
10
|
+
position?: 'left' | 'right';
|
|
11
|
+
|
|
12
|
+
// Toggle
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
enabledBackgroundColor?: string;
|
|
15
|
+
handleColor?: string;
|
|
16
|
+
errorColor?: string;
|
|
17
|
+
|
|
18
|
+
// ===Properties===
|
|
19
|
+
// Data
|
|
20
|
+
id?: string;
|
|
21
|
+
label?: string;
|
|
22
|
+
subLabel?: string;
|
|
23
|
+
value?: boolean;
|
|
24
|
+
ariaLabel?: string;
|
|
25
|
+
|
|
26
|
+
// Events
|
|
27
|
+
onclick?: (event: MouseEvent) => void;
|
|
28
|
+
onchange?: (value: boolean) => void;
|
|
29
|
+
|
|
30
|
+
// Validation
|
|
31
|
+
isMandatory?: boolean;
|
|
32
|
+
customValidation?: (value: boolean) => string | null;
|
|
33
|
+
|
|
34
|
+
// Additional Actions
|
|
35
|
+
isLoading?: boolean;
|
|
36
|
+
isShow?: boolean;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
tooltip?: string;
|
|
39
|
+
|
|
40
|
+
// Any
|
|
41
|
+
class?: string;
|
|
42
|
+
style?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const {
|
|
46
|
+
// ===Styles===
|
|
47
|
+
// Label
|
|
48
|
+
labelColor = 'var(--color-text-primary)',
|
|
49
|
+
aligment = 'top',
|
|
50
|
+
position = 'left',
|
|
51
|
+
|
|
52
|
+
// Toggle
|
|
53
|
+
backgroundColor = 'var(--color-bg-disabled)',
|
|
54
|
+
enabledBackgroundColor = 'var(--color-bg-act-primary)',
|
|
55
|
+
handleColor = 'var(--color-bg-surface)',
|
|
56
|
+
errorColor = 'var(--color-text-error-ti)',
|
|
57
|
+
|
|
58
|
+
// ===Properties===
|
|
59
|
+
// Data
|
|
60
|
+
id = '',
|
|
61
|
+
label = '',
|
|
62
|
+
subLabel = '',
|
|
63
|
+
value = false,
|
|
64
|
+
ariaLabel = 'Toggle',
|
|
65
|
+
|
|
66
|
+
// Events
|
|
67
|
+
onclick,
|
|
68
|
+
onchange,
|
|
69
|
+
|
|
70
|
+
// Validation
|
|
71
|
+
isMandatory = false,
|
|
72
|
+
customValidation,
|
|
73
|
+
|
|
74
|
+
// Additional Actions
|
|
75
|
+
isLoading = false,
|
|
76
|
+
isShow = true,
|
|
77
|
+
disabled = false,
|
|
78
|
+
tooltip = '',
|
|
79
|
+
|
|
80
|
+
class: className = '',
|
|
81
|
+
style: customStyle = '',
|
|
82
|
+
...props
|
|
83
|
+
}: Props = $props();
|
|
84
|
+
|
|
85
|
+
// ===== State =====
|
|
86
|
+
let toggleValue = $state(value);
|
|
87
|
+
let errorMessage = $state('');
|
|
88
|
+
|
|
89
|
+
// Update toggleValue when value prop changes
|
|
90
|
+
$effect(() => {
|
|
91
|
+
toggleValue = value;
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
// ===== Validation =====
|
|
95
|
+
function validateInput(val: boolean): string {
|
|
96
|
+
if (customValidation) {
|
|
97
|
+
const customError = customValidation(val);
|
|
98
|
+
if (customError) return customError;
|
|
99
|
+
}
|
|
100
|
+
if (isMandatory && !val) {
|
|
101
|
+
return 'Field ini wajib diisi';
|
|
102
|
+
}
|
|
103
|
+
return '';
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Validate on value changes
|
|
107
|
+
$effect(() => {
|
|
108
|
+
errorMessage = validateInput(toggleValue);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
// ===== Event Handlers =====
|
|
112
|
+
function handleToggle(event: MouseEvent) {
|
|
113
|
+
if (disabled || isLoading) return;
|
|
114
|
+
|
|
115
|
+
toggleValue = !toggleValue;
|
|
116
|
+
errorMessage = validateInput(toggleValue);
|
|
117
|
+
onchange?.(toggleValue);
|
|
118
|
+
onclick?.(event);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ===== Styles =====
|
|
122
|
+
const labelStyles = $derived(() => {
|
|
123
|
+
const styles: string[] = [];
|
|
124
|
+
styles.push(`font-size: 14px;`);
|
|
125
|
+
if (labelColor) styles.push(`color: ${labelColor};`);
|
|
126
|
+
return styles.join(' ');
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
const toggleStyles = $derived(() => {
|
|
130
|
+
const styles: string[] = [];
|
|
131
|
+
if (toggleValue && enabledBackgroundColor) {
|
|
132
|
+
styles.push(`background-color: ${enabledBackgroundColor};`);
|
|
133
|
+
} else if (!toggleValue && backgroundColor) {
|
|
134
|
+
styles.push(`background-color: ${backgroundColor};`);
|
|
135
|
+
}
|
|
136
|
+
if (customStyle) {
|
|
137
|
+
styles.push(customStyle);
|
|
138
|
+
}
|
|
139
|
+
return styles.join(' ');
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
const containerClasses = $derived(() => {
|
|
143
|
+
let classes = 'toggle-container';
|
|
144
|
+
if (aligment === 'side') {
|
|
145
|
+
classes += ' toggle-side';
|
|
146
|
+
}
|
|
147
|
+
if (className) {
|
|
148
|
+
classes += ` ${className}`;
|
|
149
|
+
}
|
|
150
|
+
return classes;
|
|
151
|
+
});
|
|
152
|
+
</script>
|
|
153
|
+
|
|
154
|
+
{#if isShow}
|
|
155
|
+
<div class={containerClasses()}>
|
|
156
|
+
{#if label && !(aligment === 'side' && position === 'right')}
|
|
157
|
+
<label for={id} class="toggle-label" style={labelStyles()}>
|
|
158
|
+
{label}
|
|
159
|
+
{#if subLabel}
|
|
160
|
+
<span class="label-subLabel">{subLabel}</span>
|
|
161
|
+
{/if}
|
|
162
|
+
{#if isMandatory}
|
|
163
|
+
<span class="label-required">*</span>
|
|
164
|
+
{/if}
|
|
165
|
+
</label>
|
|
166
|
+
{/if}
|
|
167
|
+
<button
|
|
168
|
+
{id}
|
|
169
|
+
class="toggle-switch"
|
|
170
|
+
class:enabled={toggleValue}
|
|
171
|
+
class:disabled={disabled || isLoading}
|
|
172
|
+
style={toggleStyles()}
|
|
173
|
+
onclick={handleToggle}
|
|
174
|
+
aria-label={ariaLabel}
|
|
175
|
+
disabled={disabled || isLoading}
|
|
176
|
+
title={tooltip || ''}
|
|
177
|
+
{...props}
|
|
178
|
+
>
|
|
179
|
+
<div
|
|
180
|
+
class="toggle-handle"
|
|
181
|
+
style={handleColor ? `background-color: ${handleColor};` : ''}
|
|
182
|
+
></div>
|
|
183
|
+
</button>
|
|
184
|
+
{#if label && aligment === 'side' && position === 'right'}
|
|
185
|
+
<label for={id} class="toggle-label" style={labelStyles()}>
|
|
186
|
+
{label}
|
|
187
|
+
{#if subLabel}
|
|
188
|
+
<span class="label-subLabel">{subLabel}</span>
|
|
189
|
+
{/if}
|
|
190
|
+
{#if isMandatory}
|
|
191
|
+
<span class="label-required">*</span>
|
|
192
|
+
{/if}
|
|
193
|
+
</label>
|
|
194
|
+
{/if}
|
|
195
|
+
{#if errorMessage}
|
|
196
|
+
<p class="error-message" style={errorColor ? `color: ${errorColor};` : ''}>
|
|
197
|
+
{errorMessage}
|
|
198
|
+
</p>
|
|
199
|
+
{/if}
|
|
200
|
+
</div>
|
|
201
|
+
{/if}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { HTMLButtonAttributes } from 'svelte/elements';
|
|
2
|
+
import './Toggle.css';
|
|
3
|
+
interface Props extends Omit<HTMLButtonAttributes, 'value' | 'onchange'> {
|
|
4
|
+
labelColor?: string;
|
|
5
|
+
aligment?: 'side' | 'top';
|
|
6
|
+
position?: 'left' | 'right';
|
|
7
|
+
backgroundColor?: string;
|
|
8
|
+
enabledBackgroundColor?: string;
|
|
9
|
+
handleColor?: string;
|
|
10
|
+
errorColor?: string;
|
|
11
|
+
id?: string;
|
|
12
|
+
label?: string;
|
|
13
|
+
subLabel?: string;
|
|
14
|
+
value?: boolean;
|
|
15
|
+
ariaLabel?: string;
|
|
16
|
+
onclick?: (event: MouseEvent) => void;
|
|
17
|
+
onchange?: (value: boolean) => void;
|
|
18
|
+
isMandatory?: boolean;
|
|
19
|
+
customValidation?: (value: boolean) => string | null;
|
|
20
|
+
isLoading?: boolean;
|
|
21
|
+
isShow?: boolean;
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
tooltip?: string;
|
|
24
|
+
class?: string;
|
|
25
|
+
style?: string;
|
|
26
|
+
}
|
|
27
|
+
declare const Toggle: import("svelte").Component<Props, {}, "">;
|
|
28
|
+
type Toggle = ReturnType<typeof Toggle>;
|
|
29
|
+
export default Toggle;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<circle cx="24.5" cy="11.2585" r="8" fill="#57534D"/>
|
|
3
|
+
<circle cx="8" cy="16.2585" r="8" fill="#57534D"/>
|
|
4
|
+
<circle cx="32" cy="17.2585" r="8" fill="#57534D"/>
|
|
5
|
+
<rect y="13.2585" width="34" height="16" rx="8" fill="#A6A09B"/>
|
|
6
|
+
<circle cx="19" cy="14.7585" r="8" fill="#A6A09B"/>
|
|
7
|
+
<path d="M7.94672 25.6331C7.13079 28.4567 6.3302 32.0928 7.89008 35.0022C8.05293 35.3243 8.2285 35.615 8.42817 35.9124C8.35108 35.5626 8.29746 35.2342 8.25336 34.8899C7.83807 31.812 9.03604 29.1794 9.87543 26.1614C10.7838 23.2038 10.8201 19.4588 9.02973 16.7786C8.83973 16.4714 8.64609 16.1998 8.42817 15.9124C8.52685 16.2593 8.60226 16.5794 8.67719 16.9221C9.37366 19.9704 8.78333 22.7323 7.94672 25.6331Z" fill="#57534D"/>
|
|
8
|
+
<path d="M13.9467 25.6331C13.1308 28.4567 12.3302 32.0928 13.8901 35.0022C14.0529 35.3243 14.2285 35.615 14.4282 35.9124C14.3511 35.5626 14.2975 35.2342 14.2534 34.8899C13.8381 31.812 15.036 29.1794 15.8754 26.1614C16.7838 23.2038 16.8201 19.4588 15.0297 16.7786C14.8397 16.4714 14.6461 16.1998 14.4282 15.9124C14.5269 16.2593 14.6023 16.5794 14.6772 16.9221C15.3737 19.9704 14.7833 22.7323 13.9467 25.6331Z" fill="#57534D"/>
|
|
9
|
+
<path d="M19.9467 25.6331C19.1308 28.4567 18.3302 32.0928 19.8901 35.0022C20.0529 35.3243 20.2285 35.615 20.4282 35.9124C20.3511 35.5626 20.2975 35.2342 20.2534 34.8899C19.8381 31.812 21.036 29.1794 21.8754 26.1614C22.7838 23.2038 22.8201 19.4588 21.0297 16.7786C20.8397 16.4714 20.6461 16.1998 20.4282 15.9124C20.5269 16.2593 20.6023 16.5794 20.6772 16.9221C21.3737 19.9704 20.7833 22.7323 19.9467 25.6331Z" fill="#57534D"/>
|
|
10
|
+
<path d="M25.9467 25.6331C25.1308 28.4567 24.3302 32.0928 25.8901 35.0022C26.0529 35.3243 26.2285 35.615 26.4282 35.9124C26.3511 35.5626 26.2975 35.2342 26.2534 34.8899C25.8381 31.812 27.036 29.1794 27.8754 26.1614C28.7838 23.2038 28.8201 19.4588 27.0297 16.7786C26.8397 16.4714 26.6461 16.1998 26.4282 15.9124C26.5269 16.2593 26.6023 16.5794 26.6772 16.9221C27.3737 19.9704 26.7833 22.7323 25.9467 25.6331Z" fill="#57534D"/>
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Asap;
|
|
2
|
+
type Asap = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Asap: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
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> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<ellipse cx="24.4998" cy="15.0001" rx="8.00007" ry="8.00007" fill="#74D4FF"/>
|
|
3
|
+
<ellipse cx="31.9998" cy="21.0001" rx="8.00007" ry="8.00007" fill="#74D4FF"/>
|
|
4
|
+
<rect x="-0.00012207" y="16.9999" width="34.0003" height="16.0001" rx="8.00007" fill="#DFF2FE"/>
|
|
5
|
+
<ellipse cx="19.0001" cy="18.4998" rx="8.00007" ry="8.00007" fill="#DFF2FE"/>
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default Berawan;
|
|
2
|
+
type Berawan = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const Berawan: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
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> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<ellipse cx="24.4998" cy="15" rx="8.00007" ry="8.00007" fill="#74D4FF"/>
|
|
3
|
+
<circle cx="9.49988" cy="18.1579" r="9.5" fill="#74D4FF"/>
|
|
4
|
+
<ellipse cx="31.9998" cy="20.9999" rx="8.00007" ry="8.00007" fill="#74D4FF"/>
|
|
5
|
+
<rect x="-0.00012207" y="16.9999" width="34.0003" height="16.0001" rx="8.00007" fill="#DFF2FE"/>
|
|
6
|
+
<ellipse cx="19.0001" cy="18.4998" rx="8.00007" ry="8.00007" fill="#DFF2FE"/>
|
|
7
|
+
</svg>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default BerawanTebal;
|
|
2
|
+
type BerawanTebal = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const BerawanTebal: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
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> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
width="24"
|
|
3
|
+
height="24"
|
|
4
|
+
viewBox="0 0 24 24"
|
|
5
|
+
fill="currentColor"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
>
|
|
8
|
+
<path
|
|
9
|
+
d="M12 5V19M12 19L19 12M12 19L5 12"
|
|
10
|
+
stroke="currentColor"
|
|
11
|
+
stroke-width="2"
|
|
12
|
+
stroke-linecap="round"
|
|
13
|
+
stroke-linejoin="round"
|
|
14
|
+
/>
|
|
15
|
+
</svg>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export default BsArrowDown;
|
|
2
|
+
type BsArrowDown = SvelteComponent<{
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
[evt: string]: CustomEvent<any>;
|
|
6
|
+
}, {}> & {
|
|
7
|
+
$$bindings?: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
declare const BsArrowDown: $$__sveltets_2_IsomorphicComponent<{
|
|
10
|
+
[x: string]: never;
|
|
11
|
+
}, {
|
|
12
|
+
[evt: string]: CustomEvent<any>;
|
|
13
|
+
}, {}, {}, string>;
|
|
14
|
+
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> {
|
|
15
|
+
new (options: import("svelte").ComponentConstructorOptions<Props>): import("svelte").SvelteComponent<Props, Events, Slots> & {
|
|
16
|
+
$$bindings?: Bindings;
|
|
17
|
+
} & Exports;
|
|
18
|
+
(internal: unknown, props: {
|
|
19
|
+
$$events?: Events;
|
|
20
|
+
$$slots?: Slots;
|
|
21
|
+
}): Exports & {
|
|
22
|
+
$set?: any;
|
|
23
|
+
$on?: any;
|
|
24
|
+
};
|
|
25
|
+
z_$$bindings?: Bindings;
|
|
26
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<svg
|
|
2
|
+
width="24"
|
|
3
|
+
height="24"
|
|
4
|
+
viewBox="0 0 24 24"
|
|
5
|
+
fill="currentColor"
|
|
6
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
7
|
+
>
|
|
8
|
+
<path
|
|
9
|
+
d="M12 19V5M12 5L5 12M12 5L19 12"
|
|
10
|
+
stroke="currentColor"
|
|
11
|
+
stroke-width="2"
|
|
12
|
+
stroke-linecap="round"
|
|
13
|
+
stroke-linejoin="round"
|
|
14
|
+
/>
|
|
15
|
+
</svg>
|