@ttdk-design-system/library-svelte 0.0.0-stage → 1.0.1
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/AI_GUIDE.md +6518 -0
- package/README.md +102 -2
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +2 -0
- package/dist/core/tailwind-preset.cjs +62 -0
- package/dist/core/tailwind-preset.d.cts +63 -0
- package/dist/core/tailwind-preset.d.ts +74 -0
- package/dist/core/tailwind-preset.js +79 -0
- package/dist/core/theme/tokens.css +663 -0
- package/dist/core/types.d.ts +152 -0
- package/dist/core/types.js +735 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +15 -0
- package/dist/tailwind-preset.cjs +62 -0
- package/dist/tailwind-preset.d.cts +63 -0
- package/dist/tailwind-preset.d.ts +74 -0
- package/dist/tailwind-preset.js +79 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +1 -0
- package/dist/web/accordion/AI_GUIDE.md +149 -0
- package/dist/web/accordion/accordion.css +1 -0
- package/dist/web/accordion/accordion.svelte +217 -0
- package/dist/web/accordion/accordion.svelte.d.ts +224 -0
- package/dist/web/accordion/index.d.ts +2 -0
- package/dist/web/accordion/index.js +2 -0
- package/dist/web/accordion/manifest.json +351 -0
- package/dist/web/alert/AI_GUIDE.md +139 -0
- package/dist/web/alert/alert.css +1 -0
- package/dist/web/alert/alert.svelte +175 -0
- package/dist/web/alert/alert.svelte.d.ts +165 -0
- package/dist/web/alert/index.d.ts +2 -0
- package/dist/web/alert/index.js +2 -0
- package/dist/web/alert/manifest.json +240 -0
- package/dist/web/avatar/AI_GUIDE.md +118 -0
- package/dist/web/avatar/avatar.css +1 -0
- package/dist/web/avatar/avatar.svelte +108 -0
- package/dist/web/avatar/avatar.svelte.d.ts +147 -0
- package/dist/web/avatar/index.d.ts +2 -0
- package/dist/web/avatar/index.js +2 -0
- package/dist/web/avatar/manifest.json +195 -0
- package/dist/web/badge/AI_GUIDE.md +94 -0
- package/dist/web/badge/badge.css +1 -0
- package/dist/web/badge/badge.svelte +50 -0
- package/dist/web/badge/badge.svelte.d.ts +111 -0
- package/dist/web/badge/index.d.ts +2 -0
- package/dist/web/badge/index.js +2 -0
- package/dist/web/badge/manifest.json +141 -0
- package/dist/web/banner/AI_GUIDE.md +130 -0
- package/dist/web/banner/banner.css +1 -0
- package/dist/web/banner/banner.svelte +180 -0
- package/dist/web/banner/banner.svelte.d.ts +172 -0
- package/dist/web/banner/index.d.ts +2 -0
- package/dist/web/banner/index.js +2 -0
- package/dist/web/banner/manifest.json +240 -0
- package/dist/web/breadcrumb/AI_GUIDE.md +120 -0
- package/dist/web/breadcrumb/breadcrumb.css +1 -0
- package/dist/web/breadcrumb/breadcrumb.svelte +168 -0
- package/dist/web/breadcrumb/breadcrumb.svelte.d.ts +141 -0
- package/dist/web/breadcrumb/index.d.ts +2 -0
- package/dist/web/breadcrumb/index.js +2 -0
- package/dist/web/breadcrumb/manifest.json +225 -0
- package/dist/web/button/AI_GUIDE.md +121 -0
- package/dist/web/button/button.css +1 -0
- package/dist/web/button/button.svelte +154 -0
- package/dist/web/button/button.svelte.d.ts +159 -0
- package/dist/web/button/index.d.ts +2 -0
- package/dist/web/button/index.js +2 -0
- package/dist/web/button/manifest.json +177 -0
- package/dist/web/calendar/AI_GUIDE.md +151 -0
- package/dist/web/calendar/calendar.css +1 -0
- package/dist/web/calendar/calendar.svelte +1091 -0
- package/dist/web/calendar/calendar.svelte.d.ts +268 -0
- package/dist/web/calendar/index.d.ts +2 -0
- package/dist/web/calendar/index.js +2 -0
- package/dist/web/calendar/manifest.json +470 -0
- package/dist/web/card/AI_GUIDE.md +133 -0
- package/dist/web/card/card.css +1 -0
- package/dist/web/card/card.svelte +217 -0
- package/dist/web/card/card.svelte.d.ts +242 -0
- package/dist/web/card/index.d.ts +2 -0
- package/dist/web/card/index.js +2 -0
- package/dist/web/card/manifest.json +357 -0
- package/dist/web/checkbox/AI_GUIDE.md +146 -0
- package/dist/web/checkbox/checkbox.css +1 -0
- package/dist/web/checkbox/checkbox.svelte +131 -0
- package/dist/web/checkbox/checkbox.svelte.d.ts +199 -0
- package/dist/web/checkbox/index.d.ts +2 -0
- package/dist/web/checkbox/index.js +2 -0
- package/dist/web/checkbox/manifest.json +294 -0
- package/dist/web/chip/AI_GUIDE.md +186 -0
- package/dist/web/chip/chip.css +1 -0
- package/dist/web/chip/chip.svelte +113 -0
- package/dist/web/chip/chip.svelte.d.ts +145 -0
- package/dist/web/chip/index.d.ts +2 -0
- package/dist/web/chip/index.js +2 -0
- package/dist/web/chip/manifest.json +186 -0
- package/dist/web/dropdown/AI_GUIDE.md +167 -0
- package/dist/web/dropdown/dropdown.css +1 -0
- package/dist/web/dropdown/dropdown.svelte +844 -0
- package/dist/web/dropdown/dropdown.svelte.d.ts +361 -0
- package/dist/web/dropdown/index.d.ts +2 -0
- package/dist/web/dropdown/index.js +2 -0
- package/dist/web/dropdown/manifest.json +576 -0
- package/dist/web/flex/AI_GUIDE.md +113 -0
- package/dist/web/flex/flex-item.svelte +37 -0
- package/dist/web/flex/flex-item.svelte.d.ts +96 -0
- package/dist/web/flex/flex.css +1 -0
- package/dist/web/flex/flex.svelte +39 -0
- package/dist/web/flex/flex.svelte.d.ts +104 -0
- package/dist/web/flex/index.d.ts +3 -0
- package/dist/web/flex/index.js +3 -0
- package/dist/web/flex/manifest.json +162 -0
- package/dist/web/form/index.d.ts +1 -0
- package/dist/web/form/index.js +2 -0
- package/dist/web/grid/AI_GUIDE.md +112 -0
- package/dist/web/grid/grid-item.svelte +41 -0
- package/dist/web/grid/grid-item.svelte.d.ts +112 -0
- package/dist/web/grid/grid.css +1 -0
- package/dist/web/grid/grid.svelte +37 -0
- package/dist/web/grid/grid.svelte.d.ts +96 -0
- package/dist/web/grid/index.d.ts +3 -0
- package/dist/web/grid/index.js +3 -0
- package/dist/web/grid/manifest.json +153 -0
- package/dist/web/index.d.ts +58 -0
- package/dist/web/index.js +57 -0
- package/dist/web/input/AI_GUIDE.md +159 -0
- package/dist/web/input/index.d.ts +2 -0
- package/dist/web/input/index.js +2 -0
- package/dist/web/input/input.css +1 -0
- package/dist/web/input/input.svelte +283 -0
- package/dist/web/input/input.svelte.d.ts +283 -0
- package/dist/web/input/manifest.json +465 -0
- package/dist/web/input-number/AI_GUIDE.md +164 -0
- package/dist/web/input-number/index.d.ts +2 -0
- package/dist/web/input-number/index.js +2 -0
- package/dist/web/input-number/input-number.css +1 -0
- package/dist/web/input-number/input-number.svelte +783 -0
- package/dist/web/input-number/input-number.svelte.d.ts +352 -0
- package/dist/web/input-number/manifest.json +575 -0
- package/dist/web/modal/AI_GUIDE.md +171 -0
- package/dist/web/modal/index.d.ts +2 -0
- package/dist/web/modal/index.js +2 -0
- package/dist/web/modal/manifest.json +375 -0
- package/dist/web/modal/modal.css +1 -0
- package/dist/web/modal/modal.svelte +333 -0
- package/dist/web/modal/modal.svelte.d.ts +231 -0
- package/dist/web/pagination/AI_GUIDE.md +148 -0
- package/dist/web/pagination/index.d.ts +19 -0
- package/dist/web/pagination/index.js +19 -0
- package/dist/web/pagination/manifest.json +432 -0
- package/dist/web/pagination/pagination-content.svelte +25 -0
- package/dist/web/pagination/pagination-content.svelte.d.ts +36 -0
- package/dist/web/pagination/pagination-ellipsis.svelte +38 -0
- package/dist/web/pagination/pagination-ellipsis.svelte.d.ts +35 -0
- package/dist/web/pagination/pagination-first.svelte +105 -0
- package/dist/web/pagination/pagination-first.svelte.d.ts +74 -0
- package/dist/web/pagination/pagination-item.svelte +25 -0
- package/dist/web/pagination/pagination-item.svelte.d.ts +36 -0
- package/dist/web/pagination/pagination-last.svelte +105 -0
- package/dist/web/pagination/pagination-last.svelte.d.ts +74 -0
- package/dist/web/pagination/pagination-link.svelte +67 -0
- package/dist/web/pagination/pagination-link.svelte.d.ts +69 -0
- package/dist/web/pagination/pagination-next.svelte +99 -0
- package/dist/web/pagination/pagination-next.svelte.d.ts +75 -0
- package/dist/web/pagination/pagination-previous.svelte +99 -0
- package/dist/web/pagination/pagination-previous.svelte.d.ts +75 -0
- package/dist/web/pagination/pagination.css +1 -0
- package/dist/web/pagination/pagination.svelte +471 -0
- package/dist/web/pagination/pagination.svelte.d.ts +256 -0
- package/dist/web/popover/AI_GUIDE.md +163 -0
- package/dist/web/popover/index.d.ts +3 -0
- package/dist/web/popover/index.js +3 -0
- package/dist/web/popover/manifest.json +396 -0
- package/dist/web/popover/popover.css +1 -0
- package/dist/web/popover/popover.svelte +497 -0
- package/dist/web/popover/popover.svelte.d.ts +116 -0
- package/dist/web/radio/AI_GUIDE.md +155 -0
- package/dist/web/radio/index.d.ts +2 -0
- package/dist/web/radio/index.js +2 -0
- package/dist/web/radio/manifest.json +294 -0
- package/dist/web/radio/radio.css +1 -0
- package/dist/web/radio/radio.svelte +123 -0
- package/dist/web/radio/radio.svelte.d.ts +192 -0
- package/dist/web/selectbox/AI_GUIDE.md +216 -0
- package/dist/web/selectbox/index.d.ts +2 -0
- package/dist/web/selectbox/index.js +2 -0
- package/dist/web/selectbox/manifest.json +477 -0
- package/dist/web/selectbox/selectbox.css +1 -0
- package/dist/web/selectbox/selectbox.svelte +704 -0
- package/dist/web/selectbox/selectbox.svelte.d.ts +296 -0
- package/dist/web/sonner/AI_GUIDE.md +98 -0
- package/dist/web/sonner/index.d.ts +46 -0
- package/dist/web/sonner/index.js +64 -0
- package/dist/web/sonner/manifest.json +132 -0
- package/dist/web/sonner/sonner.css +1 -0
- package/dist/web/sonner/sonner.svelte +85 -0
- package/dist/web/sonner/sonner.svelte.d.ts +105 -0
- package/dist/web/table/AI_GUIDE.md +145 -0
- package/dist/web/table/index.d.ts +21 -0
- package/dist/web/table/index.js +22 -0
- package/dist/web/table/manifest.json +168 -0
- package/dist/web/table/table-body.svelte +23 -0
- package/dist/web/table/table-body.svelte.d.ts +36 -0
- package/dist/web/table/table-caption.svelte +23 -0
- package/dist/web/table/table-caption.svelte.d.ts +36 -0
- package/dist/web/table/table-cell.svelte +35 -0
- package/dist/web/table/table-cell.svelte.d.ts +57 -0
- package/dist/web/table/table-empty.svelte +56 -0
- package/dist/web/table/table-empty.svelte.d.ts +65 -0
- package/dist/web/table/table-footer.svelte +23 -0
- package/dist/web/table/table-footer.svelte.d.ts +36 -0
- package/dist/web/table/table-head.svelte +39 -0
- package/dist/web/table/table-head.svelte.d.ts +58 -0
- package/dist/web/table/table-header.svelte +23 -0
- package/dist/web/table/table-header.svelte.d.ts +36 -0
- package/dist/web/table/table-row.svelte +33 -0
- package/dist/web/table/table-row.svelte.d.ts +52 -0
- package/dist/web/table/table.css +1 -0
- package/dist/web/table/table.svelte +178 -0
- package/dist/web/table/table.svelte.d.ts +120 -0
- package/dist/web/tabs/AI_GUIDE.md +150 -0
- package/dist/web/tabs/index.d.ts +2 -0
- package/dist/web/tabs/index.js +2 -0
- package/dist/web/tabs/manifest.json +315 -0
- package/dist/web/tabs/tabs.css +1 -0
- package/dist/web/tabs/tabs.svelte +138 -0
- package/dist/web/tabs/tabs.svelte.d.ts +204 -0
- package/dist/web/text/AI_GUIDE.md +129 -0
- package/dist/web/text/index.d.ts +2 -0
- package/dist/web/text/index.js +2 -0
- package/dist/web/text/manifest.json +195 -0
- package/dist/web/text/text.css +1 -0
- package/dist/web/text/text.svelte +515 -0
- package/dist/web/text/text.svelte.d.ts +168 -0
- package/dist/web/textarea/AI_GUIDE.md +141 -0
- package/dist/web/textarea/index.d.ts +2 -0
- package/dist/web/textarea/index.js +2 -0
- package/dist/web/textarea/manifest.json +438 -0
- package/dist/web/textarea/textarea.css +1 -0
- package/dist/web/textarea/textarea.svelte +224 -0
- package/dist/web/textarea/textarea.svelte.d.ts +274 -0
- package/dist/web/tooltip/AI_GUIDE.md +110 -0
- package/dist/web/tooltip/index.d.ts +2 -0
- package/dist/web/tooltip/index.js +2 -0
- package/dist/web/tooltip/manifest.json +222 -0
- package/dist/web/tooltip/tooltip.css +1 -0
- package/dist/web/tooltip/tooltip.svelte +292 -0
- package/dist/web/tooltip/tooltip.svelte.d.ts +140 -0
- package/dist/webview/bottomsheet/AI_GUIDE.md +141 -0
- package/dist/webview/bottomsheet/bottomsheet.css +1 -0
- package/dist/webview/bottomsheet/bottomsheet.svelte +462 -0
- package/dist/webview/bottomsheet/bottomsheet.svelte.d.ts +200 -0
- package/dist/webview/bottomsheet/index.d.ts +4 -0
- package/dist/webview/bottomsheet/index.js +3 -0
- package/dist/webview/bottomsheet/manifest.json +377 -0
- package/dist/webview/button/AI_GUIDE.md +79 -0
- package/dist/webview/button/button-ios.css +1 -0
- package/dist/webview/button/button-ios.svelte +58 -0
- package/dist/webview/button/button-ios.svelte.d.ts +114 -0
- package/dist/webview/button/button-material.css +1 -0
- package/dist/webview/button/button-material.svelte +58 -0
- package/dist/webview/button/button-material.svelte.d.ts +114 -0
- package/dist/webview/button/index.d.ts +6 -0
- package/dist/webview/button/index.js +4 -0
- package/dist/webview/button/manifest.json +148 -0
- package/dist/webview/index.d.ts +6 -0
- package/dist/webview/index.js +6 -0
- package/llms.txt +6518 -0
- package/package.json +710 -4
- package/ttdk-manifest.json +10188 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
3
|
+
<script>import {
|
|
4
|
+
buildUiStyle,
|
|
5
|
+
buildUiVars,
|
|
6
|
+
cleanUiValue,
|
|
7
|
+
UiProps
|
|
8
|
+
} from "../../core/types";
|
|
9
|
+
export let value = void 0;
|
|
10
|
+
export let defaultValue = void 0;
|
|
11
|
+
export let disabled = void 0;
|
|
12
|
+
export let multiple = void 0;
|
|
13
|
+
export let collapsible = true;
|
|
14
|
+
export let onChange = void 0;
|
|
15
|
+
export let className = void 0;
|
|
16
|
+
export let variant = void 0;
|
|
17
|
+
export let size = void 0;
|
|
18
|
+
export let iconPosition = void 0;
|
|
19
|
+
export let rounded = void 0;
|
|
20
|
+
export let ui = void 0;
|
|
21
|
+
export let items;
|
|
22
|
+
export let itemClass = void 0;
|
|
23
|
+
export let itemStyle = void 0;
|
|
24
|
+
export let triggerClass = void 0;
|
|
25
|
+
export let triggerStyle = void 0;
|
|
26
|
+
export let iconClass = void 0;
|
|
27
|
+
export let iconStyle = void 0;
|
|
28
|
+
export let icon = void 0;
|
|
29
|
+
export let titleClass = void 0;
|
|
30
|
+
export let titleStyle = void 0;
|
|
31
|
+
export let subtitleClass = void 0;
|
|
32
|
+
export let subtitleStyle = void 0;
|
|
33
|
+
export let contentClass = void 0;
|
|
34
|
+
export let contentStyle = void 0;
|
|
35
|
+
function stringifyStyles(stylesObj) {
|
|
36
|
+
let styles = "";
|
|
37
|
+
for (let key in stylesObj) {
|
|
38
|
+
const dashedKey = key.replace(/[A-Z]/g, function(match) {
|
|
39
|
+
return "-" + match.toLowerCase();
|
|
40
|
+
});
|
|
41
|
+
styles += dashedKey + ":" + stylesObj[key] + ";";
|
|
42
|
+
}
|
|
43
|
+
return styles;
|
|
44
|
+
}
|
|
45
|
+
$:
|
|
46
|
+
openList = (value !== void 0 ? Array.isArray(value) ? value : [value] : openItems) || [];
|
|
47
|
+
function getOpenList() {
|
|
48
|
+
const val = value !== void 0 ? value : openItems;
|
|
49
|
+
if (!val)
|
|
50
|
+
return [];
|
|
51
|
+
return Array.isArray(val) ? val : [val];
|
|
52
|
+
}
|
|
53
|
+
function isOpen(itemVal, list) {
|
|
54
|
+
const active = list !== void 0 ? list : openList;
|
|
55
|
+
return active.indexOf(itemVal) !== -1;
|
|
56
|
+
}
|
|
57
|
+
function handleToggle(itemVal, itemDisabled) {
|
|
58
|
+
if (disabled || itemDisabled)
|
|
59
|
+
return;
|
|
60
|
+
const list = getOpenList();
|
|
61
|
+
const isCurrentlyOpen = list.indexOf(itemVal) !== -1;
|
|
62
|
+
let next;
|
|
63
|
+
if (multiple) {
|
|
64
|
+
if (isCurrentlyOpen) {
|
|
65
|
+
next = list.filter((v) => v !== itemVal);
|
|
66
|
+
} else {
|
|
67
|
+
next = [...list, itemVal];
|
|
68
|
+
}
|
|
69
|
+
} else {
|
|
70
|
+
if (isCurrentlyOpen) {
|
|
71
|
+
if (collapsible === false) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
next = [];
|
|
75
|
+
} else {
|
|
76
|
+
next = [itemVal];
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
openItems = next;
|
|
80
|
+
if (onChange) {
|
|
81
|
+
onChange(multiple ? next : next[0] || "");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
let openItems = value !== void 0 ? Array.isArray(value) ? value : [value] : defaultValue !== void 0 ? Array.isArray(defaultValue) ? defaultValue : [defaultValue] : [];
|
|
85
|
+
</script>
|
|
86
|
+
|
|
87
|
+
<div
|
|
88
|
+
style={stringifyStyles({
|
|
89
|
+
...buildUiVars(ui),
|
|
90
|
+
})}
|
|
91
|
+
class={`ttdk-accordion ${className || ""}`.trim()}
|
|
92
|
+
data-variant={variant || "default"}
|
|
93
|
+
data-size={size || "md"}
|
|
94
|
+
data-icon-position={iconPosition || "right"}
|
|
95
|
+
data-rounded={rounded || "md"}
|
|
96
|
+
data-disabled={disabled ? "true" : "false"}
|
|
97
|
+
>
|
|
98
|
+
{#each items as item, index (item.value || index)}
|
|
99
|
+
<div
|
|
100
|
+
style={stringifyStyles({
|
|
101
|
+
...buildUiStyle(itemStyle),
|
|
102
|
+
})}
|
|
103
|
+
class={`ttdk-accordion-item ${itemClass || ""}`.trim()}
|
|
104
|
+
data-state={isOpen(item.value, openList) ? "open" : "closed"}
|
|
105
|
+
data-disabled={disabled || item.disabled ? "true" : "false"}
|
|
106
|
+
>
|
|
107
|
+
<h3 class="ttdk-accordion-header">
|
|
108
|
+
<button
|
|
109
|
+
style={stringifyStyles({
|
|
110
|
+
...buildUiStyle(triggerStyle),
|
|
111
|
+
})}
|
|
112
|
+
type="button"
|
|
113
|
+
class={`ttdk-accordion-trigger ${triggerClass || ""}`.trim()}
|
|
114
|
+
data-state={isOpen(item.value, openList) ? "open" : "closed"}
|
|
115
|
+
data-disabled={disabled || item.disabled ? "true" : "false"}
|
|
116
|
+
disabled={disabled || item.disabled}
|
|
117
|
+
aria-expanded={isOpen(item.value, openList)}
|
|
118
|
+
on:click={(event) => {
|
|
119
|
+
handleToggle(item.value, item.disabled);
|
|
120
|
+
}}
|
|
121
|
+
>
|
|
122
|
+
{#if iconPosition === "left"}
|
|
123
|
+
<span
|
|
124
|
+
style={stringifyStyles({
|
|
125
|
+
...buildUiStyle(iconStyle),
|
|
126
|
+
})}
|
|
127
|
+
aria-hidden="true"
|
|
128
|
+
class={`ttdk-accordion-arrow ttdk-accordion-arrow-left ${
|
|
129
|
+
iconClass || ""
|
|
130
|
+
}`.trim()}
|
|
131
|
+
data-state={isOpen(item.value, openList) ? "open" : "closed"}
|
|
132
|
+
>
|
|
133
|
+
{#if icon}
|
|
134
|
+
{icon}
|
|
135
|
+
{/if}
|
|
136
|
+
{#if !icon}
|
|
137
|
+
<svg
|
|
138
|
+
class="ttdk-accordion-icon"
|
|
139
|
+
viewBox="0 0 24 24"
|
|
140
|
+
fill="none"
|
|
141
|
+
stroke="currentColor"
|
|
142
|
+
><polyline points="6 9 12 15 18 9" /></svg
|
|
143
|
+
>
|
|
144
|
+
{/if}</span
|
|
145
|
+
>
|
|
146
|
+
{/if}
|
|
147
|
+
{#if item.icon}
|
|
148
|
+
<span class="ttdk-accordion-leading-icon">{item.icon}</span>
|
|
149
|
+
{/if}<span class="ttdk-accordion-label-group"
|
|
150
|
+
><span
|
|
151
|
+
style={stringifyStyles({
|
|
152
|
+
...buildUiStyle(titleStyle),
|
|
153
|
+
})}
|
|
154
|
+
class={`ttdk-accordion-title ${titleClass || ""}`.trim()}
|
|
155
|
+
>{item.title}</span
|
|
156
|
+
>
|
|
157
|
+
{#if item.subtitle}
|
|
158
|
+
<span
|
|
159
|
+
style={stringifyStyles({
|
|
160
|
+
...buildUiStyle(subtitleStyle),
|
|
161
|
+
})}
|
|
162
|
+
class={`ttdk-accordion-subtitle ${subtitleClass || ""}`.trim()}
|
|
163
|
+
>{item.subtitle}</span
|
|
164
|
+
>
|
|
165
|
+
{/if}</span
|
|
166
|
+
>
|
|
167
|
+
{#if item.badge !== undefined && item.badge !== null}
|
|
168
|
+
<span class="ttdk-accordion-badge">{item.badge}</span>
|
|
169
|
+
{/if}
|
|
170
|
+
{#if iconPosition !== "left"}
|
|
171
|
+
<span
|
|
172
|
+
style={stringifyStyles({
|
|
173
|
+
...buildUiStyle(iconStyle),
|
|
174
|
+
})}
|
|
175
|
+
aria-hidden="true"
|
|
176
|
+
class={`ttdk-accordion-arrow ttdk-accordion-arrow-right ${
|
|
177
|
+
iconClass || ""
|
|
178
|
+
}`.trim()}
|
|
179
|
+
data-state={isOpen(item.value, openList) ? "open" : "closed"}
|
|
180
|
+
>
|
|
181
|
+
{#if icon}
|
|
182
|
+
{icon}
|
|
183
|
+
{/if}
|
|
184
|
+
{#if !item.customIcon && !icon}
|
|
185
|
+
<svg
|
|
186
|
+
class="ttdk-accordion-icon"
|
|
187
|
+
viewBox="0 0 24 24"
|
|
188
|
+
fill="none"
|
|
189
|
+
stroke="currentColor"
|
|
190
|
+
><polyline points="6 9 12 15 18 9" /></svg
|
|
191
|
+
>
|
|
192
|
+
{/if}</span
|
|
193
|
+
>
|
|
194
|
+
{/if}</button
|
|
195
|
+
>
|
|
196
|
+
</h3>
|
|
197
|
+
<div
|
|
198
|
+
class="ttdk-accordion-panel"
|
|
199
|
+
role="region"
|
|
200
|
+
data-state={isOpen(item.value, openList) ? "open" : "closed"}
|
|
201
|
+
>
|
|
202
|
+
<div
|
|
203
|
+
style={stringifyStyles({
|
|
204
|
+
...buildUiStyle(contentStyle),
|
|
205
|
+
})}
|
|
206
|
+
class={`ttdk-accordion-content ${contentClass || ""}`.trim()}
|
|
207
|
+
>
|
|
208
|
+
{item.content}
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
</div>
|
|
212
|
+
{/each}
|
|
213
|
+
|
|
214
|
+
{#if $$slots.default}
|
|
215
|
+
<div class="ttdk-accordion-children"><slot /></div>
|
|
216
|
+
{/if}
|
|
217
|
+
</div>
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
export type AccordionUiProps = UiProps;
|
|
3
|
+
export interface AccordionItem {
|
|
4
|
+
/**
|
|
5
|
+
* Nilai identifikasi unik untuk item accordion.
|
|
6
|
+
*/
|
|
7
|
+
value: string;
|
|
8
|
+
/**
|
|
9
|
+
* Judul teks yang ditampilkan pada header trigger accordion.
|
|
10
|
+
*/
|
|
11
|
+
title: string;
|
|
12
|
+
/**
|
|
13
|
+
* Subtitle atau deskripsi singkat sekunder di bawah judul.
|
|
14
|
+
*/
|
|
15
|
+
subtitle?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Konten isi panel yang terbuka saat accordion di-expand.
|
|
18
|
+
*/
|
|
19
|
+
content?: any;
|
|
20
|
+
/**
|
|
21
|
+
* Ikon atau elemen visual opsional di samping judul.
|
|
22
|
+
*/
|
|
23
|
+
icon?: any;
|
|
24
|
+
/**
|
|
25
|
+
* Badge teks atau counter angka opsional (misal: '12', 'Baru', 'Wajib').
|
|
26
|
+
*/
|
|
27
|
+
badge?: string | number;
|
|
28
|
+
/**
|
|
29
|
+
* Ikon kustom untuk menggantikan ikon panah bawaan khusus item ini.
|
|
30
|
+
*/
|
|
31
|
+
customIcon?: any;
|
|
32
|
+
/**
|
|
33
|
+
* Menonaktifkan item ini dari interaksi buka/tutup.
|
|
34
|
+
* @default false
|
|
35
|
+
*/
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface AccordionProps {
|
|
39
|
+
/**
|
|
40
|
+
* Daftar item accordion yang akan dirender.
|
|
41
|
+
*/
|
|
42
|
+
items: AccordionItem[];
|
|
43
|
+
/**
|
|
44
|
+
* Nilai item yang sedang terbuka (controlled value).
|
|
45
|
+
* Bisa berupa string tunggal atau array string jika multiple={true}.
|
|
46
|
+
*/
|
|
47
|
+
value?: string | string[];
|
|
48
|
+
/**
|
|
49
|
+
* Nilai default item yang terbuka saat pertama kali dirender (uncontrolled initial value).
|
|
50
|
+
*/
|
|
51
|
+
defaultValue?: string | string[];
|
|
52
|
+
/**
|
|
53
|
+
* Mengizinkan lebih dari satu item terbuka secara bersamaan.
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
multiple?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Mengizinkan item yang terbuka untuk ditutup kembali saat diklik.
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
collapsible?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Varian tampilan visual accordion:
|
|
64
|
+
* - `'default'`: Garis pembatas (divider) minimalis antar-item.
|
|
65
|
+
* - `'bordered'`: Pembungkus border luar dengan sudut melengkung.
|
|
66
|
+
* - `'separated'`: Setiap item berupa kartu terpisah mandiri dengan jarak celah (gap).
|
|
67
|
+
* - `'ghost'`: Tampilan bersih tanpa border luar, hanya hover background lembut.
|
|
68
|
+
*
|
|
69
|
+
* @default 'default'
|
|
70
|
+
*/
|
|
71
|
+
variant?: "default" | "bordered" | "separated" | "ghost";
|
|
72
|
+
/**
|
|
73
|
+
* Skala ukuran proporsional accordion (padding, font, icon):
|
|
74
|
+
* - `'sm'`: Kompak (13px font, padding rapat).
|
|
75
|
+
* - `'md'`: Standar (14px font, padding normal).
|
|
76
|
+
* - `'lg'`: Besar (16px font, padding lapang).
|
|
77
|
+
*
|
|
78
|
+
* @default 'md'
|
|
79
|
+
*/
|
|
80
|
+
size?: "sm" | "md" | "lg";
|
|
81
|
+
/**
|
|
82
|
+
* Posisi indikator ikon panah / chevron:
|
|
83
|
+
* - `'right'`: Di ujung kanan (standar desain).
|
|
84
|
+
* - `'left'`: Di sebelah kiri sebelum judul.
|
|
85
|
+
*
|
|
86
|
+
* @default 'right'
|
|
87
|
+
*/
|
|
88
|
+
iconPosition?: "left" | "right";
|
|
89
|
+
/**
|
|
90
|
+
* Sudut kelengkungan radius (khusus untuk varian 'bordered' dan 'separated'):
|
|
91
|
+
* - `'none'`: Sudut 0px.
|
|
92
|
+
* - `'sm'`: Sudut 6px.
|
|
93
|
+
* - `'md'`: Sudut 10px.
|
|
94
|
+
* - `'lg'`: Sudut 14px.
|
|
95
|
+
* - `'full'`: Sudut 20px.
|
|
96
|
+
*
|
|
97
|
+
* @default 'md'
|
|
98
|
+
*/
|
|
99
|
+
rounded?: "none" | "sm" | "md" | "lg" | "full";
|
|
100
|
+
/**
|
|
101
|
+
* Menonaktifkan seluruh interaksi accordion.
|
|
102
|
+
* @default false
|
|
103
|
+
*/
|
|
104
|
+
disabled?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Kustomisasi visual granular root container (UiProps).
|
|
107
|
+
*/
|
|
108
|
+
ui?: UiProps;
|
|
109
|
+
/**
|
|
110
|
+
* Inline CSS style object native.
|
|
111
|
+
*/
|
|
112
|
+
style?: any;
|
|
113
|
+
/**
|
|
114
|
+
* Class CSS kustom untuk root accordion.
|
|
115
|
+
*/
|
|
116
|
+
className?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Style kustom untuk tiap elemen item accordion (UiProps).
|
|
119
|
+
*/
|
|
120
|
+
itemStyle?: UiProps;
|
|
121
|
+
/**
|
|
122
|
+
* Class CSS kustom untuk tiap elemen item accordion.
|
|
123
|
+
*/
|
|
124
|
+
itemClass?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Style kustom untuk tombol trigger accordion (UiProps).
|
|
127
|
+
*/
|
|
128
|
+
triggerStyle?: UiProps;
|
|
129
|
+
/**
|
|
130
|
+
* Class CSS kustom untuk tombol trigger accordion.
|
|
131
|
+
*/
|
|
132
|
+
triggerClass?: string;
|
|
133
|
+
/**
|
|
134
|
+
* Style kustom untuk teks judul trigger accordion (UiProps).
|
|
135
|
+
*/
|
|
136
|
+
titleStyle?: UiProps;
|
|
137
|
+
/**
|
|
138
|
+
* Class CSS kustom untuk teks judul trigger accordion.
|
|
139
|
+
*/
|
|
140
|
+
titleClass?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Style kustom untuk teks subtitle trigger accordion (UiProps).
|
|
143
|
+
*/
|
|
144
|
+
subtitleStyle?: UiProps;
|
|
145
|
+
/**
|
|
146
|
+
* Class CSS kustom untuk teks subtitle trigger accordion.
|
|
147
|
+
*/
|
|
148
|
+
subtitleClass?: string;
|
|
149
|
+
/**
|
|
150
|
+
* Style kustom untuk indikator ikon panah / chevron (UiProps).
|
|
151
|
+
*/
|
|
152
|
+
iconStyle?: UiProps;
|
|
153
|
+
/**
|
|
154
|
+
* Class CSS kustom untuk indikator ikon panah / chevron.
|
|
155
|
+
*/
|
|
156
|
+
iconClass?: string;
|
|
157
|
+
/**
|
|
158
|
+
* Ikon kustom untuk menggantikan ikon panah bawaan accordion secara global.
|
|
159
|
+
*/
|
|
160
|
+
icon?: any;
|
|
161
|
+
/**
|
|
162
|
+
* Style kustom untuk panel konten accordion (UiProps).
|
|
163
|
+
* Mengatur seluruh tampilan panel isi (background, padding, border, serta warna & tipografi teks isi).
|
|
164
|
+
*/
|
|
165
|
+
contentStyle?: UiProps;
|
|
166
|
+
/**
|
|
167
|
+
* Class CSS kustom untuk panel konten accordion.
|
|
168
|
+
*/
|
|
169
|
+
contentClass?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Callback event saat status item yang terbuka berubah.
|
|
172
|
+
* Mengembalikan string atau array string sesuai mode `multiple`.
|
|
173
|
+
*/
|
|
174
|
+
onChange?: (value: any) => void;
|
|
175
|
+
/**
|
|
176
|
+
* Konten anak atau slot kustom.
|
|
177
|
+
*/
|
|
178
|
+
children?: any;
|
|
179
|
+
}
|
|
180
|
+
import { UiProps } from "../../core/types";
|
|
181
|
+
declare const __propDef: {
|
|
182
|
+
props: {
|
|
183
|
+
value?: AccordionProps["value"];
|
|
184
|
+
defaultValue?: AccordionProps["defaultValue"];
|
|
185
|
+
disabled?: AccordionProps["disabled"];
|
|
186
|
+
multiple?: AccordionProps["multiple"];
|
|
187
|
+
collapsible?: AccordionProps["collapsible"];
|
|
188
|
+
onChange?: AccordionProps["onChange"];
|
|
189
|
+
className?: AccordionProps["className"];
|
|
190
|
+
variant?: AccordionProps["variant"];
|
|
191
|
+
size?: AccordionProps["size"];
|
|
192
|
+
iconPosition?: AccordionProps["iconPosition"];
|
|
193
|
+
rounded?: AccordionProps["rounded"];
|
|
194
|
+
ui?: AccordionProps["ui"];
|
|
195
|
+
items: AccordionProps["items"];
|
|
196
|
+
itemClass?: AccordionProps["itemClass"];
|
|
197
|
+
itemStyle?: AccordionProps["itemStyle"];
|
|
198
|
+
triggerClass?: AccordionProps["triggerClass"];
|
|
199
|
+
triggerStyle?: AccordionProps["triggerStyle"];
|
|
200
|
+
iconClass?: AccordionProps["iconClass"];
|
|
201
|
+
iconStyle?: AccordionProps["iconStyle"];
|
|
202
|
+
icon?: AccordionProps["icon"];
|
|
203
|
+
titleClass?: AccordionProps["titleClass"];
|
|
204
|
+
titleStyle?: AccordionProps["titleStyle"];
|
|
205
|
+
subtitleClass?: AccordionProps["subtitleClass"];
|
|
206
|
+
subtitleStyle?: AccordionProps["subtitleStyle"];
|
|
207
|
+
contentClass?: AccordionProps["contentClass"];
|
|
208
|
+
contentStyle?: AccordionProps["contentStyle"];
|
|
209
|
+
};
|
|
210
|
+
events: {
|
|
211
|
+
[evt: string]: CustomEvent<any>;
|
|
212
|
+
};
|
|
213
|
+
slots: {
|
|
214
|
+
default: {};
|
|
215
|
+
};
|
|
216
|
+
exports?: {} | undefined;
|
|
217
|
+
bindings?: string | undefined;
|
|
218
|
+
};
|
|
219
|
+
type AccordionProps_ = typeof __propDef.props;
|
|
220
|
+
export type AccordionEvents = typeof __propDef.events;
|
|
221
|
+
export type AccordionSlots = typeof __propDef.slots;
|
|
222
|
+
export default class Accordion extends SvelteComponent<AccordionProps_, AccordionEvents, AccordionSlots> {
|
|
223
|
+
}
|
|
224
|
+
export {};
|