@ttdk-design-system/library-vue 0.0.0-stage → 1.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.
Files changed (232) hide show
  1. package/AI_GUIDE.md +6518 -0
  2. package/llms.txt +6518 -0
  3. package/package.json +1096 -4
  4. package/src/core/index.ts +2 -0
  5. package/src/core/tailwind-preset.cjs +62 -0
  6. package/src/core/tailwind-preset.ts +85 -0
  7. package/src/core/theme/tokens.css +663 -0
  8. package/src/core/types.ts +836 -0
  9. package/src/index.ts +17 -0
  10. package/src/tailwind-preset.cjs +62 -0
  11. package/src/tailwind-preset.ts +85 -0
  12. package/src/types.ts +1 -0
  13. package/src/web/accordion/AI_GUIDE.md +149 -0
  14. package/src/web/accordion/accordion.css +1 -0
  15. package/src/web/accordion/accordion.vue +432 -0
  16. package/src/web/accordion/accordion.vue.d.ts +227 -0
  17. package/src/web/accordion/index.ts +3 -0
  18. package/src/web/accordion/manifest.json +351 -0
  19. package/src/web/alert/AI_GUIDE.md +139 -0
  20. package/src/web/alert/alert.css +1 -0
  21. package/src/web/alert/alert.vue +290 -0
  22. package/src/web/alert/alert.vue.d.ts +154 -0
  23. package/src/web/alert/index.ts +3 -0
  24. package/src/web/alert/manifest.json +240 -0
  25. package/src/web/avatar/AI_GUIDE.md +118 -0
  26. package/src/web/avatar/avatar.css +1 -0
  27. package/src/web/avatar/avatar.vue +217 -0
  28. package/src/web/avatar/avatar.vue.d.ts +135 -0
  29. package/src/web/avatar/index.ts +3 -0
  30. package/src/web/avatar/manifest.json +195 -0
  31. package/src/web/badge/AI_GUIDE.md +94 -0
  32. package/src/web/badge/badge.css +1 -0
  33. package/src/web/badge/badge.vue +135 -0
  34. package/src/web/badge/badge.vue.d.ts +108 -0
  35. package/src/web/badge/index.ts +3 -0
  36. package/src/web/badge/manifest.json +141 -0
  37. package/src/web/banner/AI_GUIDE.md +130 -0
  38. package/src/web/banner/banner.css +1 -0
  39. package/src/web/banner/banner.vue +303 -0
  40. package/src/web/banner/banner.vue.d.ts +162 -0
  41. package/src/web/banner/index.ts +3 -0
  42. package/src/web/banner/manifest.json +240 -0
  43. package/src/web/breadcrumb/AI_GUIDE.md +120 -0
  44. package/src/web/breadcrumb/breadcrumb.css +1 -0
  45. package/src/web/breadcrumb/breadcrumb.vue +313 -0
  46. package/src/web/breadcrumb/breadcrumb.vue.d.ts +139 -0
  47. package/src/web/breadcrumb/index.ts +3 -0
  48. package/src/web/breadcrumb/manifest.json +225 -0
  49. package/src/web/button/AI_GUIDE.md +121 -0
  50. package/src/web/button/button.css +1 -0
  51. package/src/web/button/button.vue +283 -0
  52. package/src/web/button/button.vue.d.ts +147 -0
  53. package/src/web/button/index.ts +3 -0
  54. package/src/web/button/manifest.json +177 -0
  55. package/src/web/calendar/AI_GUIDE.md +151 -0
  56. package/src/web/calendar/calendar.css +1 -0
  57. package/src/web/calendar/calendar.vue +1536 -0
  58. package/src/web/calendar/calendar.vue.d.ts +261 -0
  59. package/src/web/calendar/index.ts +3 -0
  60. package/src/web/calendar/manifest.json +470 -0
  61. package/src/web/card/AI_GUIDE.md +133 -0
  62. package/src/web/card/card.css +1 -0
  63. package/src/web/card/card.vue +423 -0
  64. package/src/web/card/card.vue.d.ts +232 -0
  65. package/src/web/card/index.ts +3 -0
  66. package/src/web/card/manifest.json +357 -0
  67. package/src/web/checkbox/AI_GUIDE.md +146 -0
  68. package/src/web/checkbox/checkbox.css +1 -0
  69. package/src/web/checkbox/checkbox.vue +304 -0
  70. package/src/web/checkbox/checkbox.vue.d.ts +189 -0
  71. package/src/web/checkbox/index.ts +3 -0
  72. package/src/web/checkbox/manifest.json +294 -0
  73. package/src/web/chip/AI_GUIDE.md +186 -0
  74. package/src/web/chip/chip.css +1 -0
  75. package/src/web/chip/chip.vue +220 -0
  76. package/src/web/chip/chip.vue.d.ts +140 -0
  77. package/src/web/chip/index.ts +3 -0
  78. package/src/web/chip/manifest.json +186 -0
  79. package/src/web/dropdown/AI_GUIDE.md +167 -0
  80. package/src/web/dropdown/dropdown.css +1 -0
  81. package/src/web/dropdown/dropdown.vue +1257 -0
  82. package/src/web/dropdown/dropdown.vue.d.ts +381 -0
  83. package/src/web/dropdown/index.ts +3 -0
  84. package/src/web/dropdown/manifest.json +576 -0
  85. package/src/web/flex/AI_GUIDE.md +113 -0
  86. package/src/web/flex/flex-item.vue +94 -0
  87. package/src/web/flex/flex-item.vue.d.ts +84 -0
  88. package/src/web/flex/flex.css +1 -0
  89. package/src/web/flex/flex.vue +103 -0
  90. package/src/web/flex/flex.vue.d.ts +92 -0
  91. package/src/web/flex/index.ts +5 -0
  92. package/src/web/flex/manifest.json +162 -0
  93. package/src/web/form/index.ts +7 -0
  94. package/src/web/grid/AI_GUIDE.md +112 -0
  95. package/src/web/grid/grid-item.vue +109 -0
  96. package/src/web/grid/grid-item.vue.d.ts +99 -0
  97. package/src/web/grid/grid.css +1 -0
  98. package/src/web/grid/grid.vue +94 -0
  99. package/src/web/grid/grid.vue.d.ts +84 -0
  100. package/src/web/grid/index.ts +5 -0
  101. package/src/web/grid/manifest.json +153 -0
  102. package/src/web/index.ts +86 -0
  103. package/src/web/input/AI_GUIDE.md +159 -0
  104. package/src/web/input/index.ts +3 -0
  105. package/src/web/input/input.css +1 -0
  106. package/src/web/input/input.vue +521 -0
  107. package/src/web/input/input.vue.d.ts +274 -0
  108. package/src/web/input/manifest.json +465 -0
  109. package/src/web/input-number/AI_GUIDE.md +164 -0
  110. package/src/web/input-number/index.ts +3 -0
  111. package/src/web/input-number/input-number.css +1 -0
  112. package/src/web/input-number/input-number.vue +1153 -0
  113. package/src/web/input-number/input-number.vue.d.ts +343 -0
  114. package/src/web/input-number/manifest.json +575 -0
  115. package/src/web/modal/AI_GUIDE.md +171 -0
  116. package/src/web/modal/index.ts +3 -0
  117. package/src/web/modal/manifest.json +375 -0
  118. package/src/web/modal/modal.css +1 -0
  119. package/src/web/modal/modal.vue +344 -0
  120. package/src/web/modal/modal.vue.d.ts +64 -0
  121. package/src/web/pagination/AI_GUIDE.md +148 -0
  122. package/src/web/pagination/index.ts +21 -0
  123. package/src/web/pagination/manifest.json +432 -0
  124. package/src/web/pagination/pagination-content.vue +42 -0
  125. package/src/web/pagination/pagination-content.vue.d.ts +28 -0
  126. package/src/web/pagination/pagination-ellipsis.vue +55 -0
  127. package/src/web/pagination/pagination-ellipsis.vue.d.ts +28 -0
  128. package/src/web/pagination/pagination-first.vue +161 -0
  129. package/src/web/pagination/pagination-first.vue.d.ts +67 -0
  130. package/src/web/pagination/pagination-item.vue +42 -0
  131. package/src/web/pagination/pagination-item.vue.d.ts +28 -0
  132. package/src/web/pagination/pagination-last.vue +161 -0
  133. package/src/web/pagination/pagination-last.vue.d.ts +67 -0
  134. package/src/web/pagination/pagination-link.vue +118 -0
  135. package/src/web/pagination/pagination-link.vue.d.ts +61 -0
  136. package/src/web/pagination/pagination-next.vue +160 -0
  137. package/src/web/pagination/pagination-next.vue.d.ts +68 -0
  138. package/src/web/pagination/pagination-previous.vue +160 -0
  139. package/src/web/pagination/pagination-previous.vue.d.ts +68 -0
  140. package/src/web/pagination/pagination.css +1 -0
  141. package/src/web/pagination/pagination.vue +730 -0
  142. package/src/web/pagination/pagination.vue.d.ts +247 -0
  143. package/src/web/popover/AI_GUIDE.md +163 -0
  144. package/src/web/popover/index.ts +3 -0
  145. package/src/web/popover/manifest.json +396 -0
  146. package/src/web/popover/popover.css +1 -0
  147. package/src/web/popover/popover.vue +579 -0
  148. package/src/web/popover/popover.vue.d.ts +83 -0
  149. package/src/web/radio/AI_GUIDE.md +155 -0
  150. package/src/web/radio/index.ts +3 -0
  151. package/src/web/radio/manifest.json +294 -0
  152. package/src/web/radio/radio.css +1 -0
  153. package/src/web/radio/radio.vue +288 -0
  154. package/src/web/radio/radio.vue.d.ts +182 -0
  155. package/src/web/selectbox/AI_GUIDE.md +216 -0
  156. package/src/web/selectbox/index.ts +3 -0
  157. package/src/web/selectbox/manifest.json +477 -0
  158. package/src/web/selectbox/selectbox.css +1 -0
  159. package/src/web/selectbox/selectbox.vue +1024 -0
  160. package/src/web/selectbox/selectbox.vue.d.ts +300 -0
  161. package/src/web/sonner/AI_GUIDE.md +98 -0
  162. package/src/web/sonner/index.ts +114 -0
  163. package/src/web/sonner/manifest.json +132 -0
  164. package/src/web/sonner/sonner.css +1 -0
  165. package/src/web/sonner/sonner.vue +180 -0
  166. package/src/web/sonner/sonner.vue.d.ts +113 -0
  167. package/src/web/table/AI_GUIDE.md +145 -0
  168. package/src/web/table/index.ts +34 -0
  169. package/src/web/table/manifest.json +168 -0
  170. package/src/web/table/table-body.vue +42 -0
  171. package/src/web/table/table-body.vue.d.ts +28 -0
  172. package/src/web/table/table-caption.vue +42 -0
  173. package/src/web/table/table-caption.vue.d.ts +28 -0
  174. package/src/web/table/table-cell.vue +71 -0
  175. package/src/web/table/table-cell.vue.d.ts +49 -0
  176. package/src/web/table/table-empty.vue +105 -0
  177. package/src/web/table/table-empty.vue.d.ts +57 -0
  178. package/src/web/table/table-footer.vue +42 -0
  179. package/src/web/table/table-footer.vue.d.ts +28 -0
  180. package/src/web/table/table-head.vue +78 -0
  181. package/src/web/table/table-head.vue.d.ts +50 -0
  182. package/src/web/table/table-header.vue +42 -0
  183. package/src/web/table/table-header.vue.d.ts +28 -0
  184. package/src/web/table/table-row.vue +70 -0
  185. package/src/web/table/table-row.vue.d.ts +44 -0
  186. package/src/web/table/table.css +1 -0
  187. package/src/web/table/table.vue +298 -0
  188. package/src/web/table/table.vue.d.ts +119 -0
  189. package/src/web/tabs/AI_GUIDE.md +150 -0
  190. package/src/web/tabs/index.ts +2 -0
  191. package/src/web/tabs/manifest.json +315 -0
  192. package/src/web/tabs/tabs.css +1 -0
  193. package/src/web/tabs/tabs.vue +164 -0
  194. package/src/web/tabs/tabs.vue.d.ts +60 -0
  195. package/src/web/text/AI_GUIDE.md +129 -0
  196. package/src/web/text/index.ts +2 -0
  197. package/src/web/text/manifest.json +195 -0
  198. package/src/web/text/text.css +1 -0
  199. package/src/web/text/text.vue +195 -0
  200. package/src/web/text/text.vue.d.ts +161 -0
  201. package/src/web/textarea/AI_GUIDE.md +141 -0
  202. package/src/web/textarea/index.ts +3 -0
  203. package/src/web/textarea/manifest.json +438 -0
  204. package/src/web/textarea/textarea.css +1 -0
  205. package/src/web/textarea/textarea.vue +458 -0
  206. package/src/web/textarea/textarea.vue.d.ts +265 -0
  207. package/src/web/tooltip/AI_GUIDE.md +110 -0
  208. package/src/web/tooltip/index.ts +3 -0
  209. package/src/web/tooltip/manifest.json +222 -0
  210. package/src/web/tooltip/tooltip.css +1 -0
  211. package/src/web/tooltip/tooltip.vue +417 -0
  212. package/src/web/tooltip/tooltip.vue.d.ts +150 -0
  213. package/src/webview/bottomsheet/AI_GUIDE.md +141 -0
  214. package/src/webview/bottomsheet/bottomsheet.css +1 -0
  215. package/src/webview/bottomsheet/bottomsheet.vue +441 -0
  216. package/src/webview/bottomsheet/bottomsheet.vue.d.ts +178 -0
  217. package/src/webview/bottomsheet/index.ts +4 -0
  218. package/src/webview/bottomsheet/manifest.json +377 -0
  219. package/src/webview/button/AI_GUIDE.md +79 -0
  220. package/src/webview/button/button-ios.css +1 -0
  221. package/src/webview/button/button-ios.vue +138 -0
  222. package/src/webview/button/button-ios.vue.d.ts +102 -0
  223. package/src/webview/button/button-material.css +1 -0
  224. package/src/webview/button/button-material.vue +138 -0
  225. package/src/webview/button/button-material.vue.d.ts +102 -0
  226. package/src/webview/button/index.ts +7 -0
  227. package/src/webview/button/manifest.json +148 -0
  228. package/src/webview/index.ts +7 -0
  229. package/tailwind-preset.cjs +62 -0
  230. package/tailwind-preset.js +62 -0
  231. package/ttdk-manifest.json +10188 -0
  232. package/README.md +0 -3
@@ -0,0 +1,432 @@
1
+ <template>
2
+ <div
3
+ :class="`ttdk-accordion ${className || ''}`.trim()"
4
+ :data-variant="variant || 'default'"
5
+ :data-size="size || 'md'"
6
+ :data-icon-position="iconPosition || 'right'"
7
+ :data-rounded="rounded || 'md'"
8
+ :data-disabled="disabled ? 'true' : 'false'"
9
+ :style="{
10
+ ...buildUiVars(ui),
11
+ ...(typeof style === 'object' ? style : {}),
12
+ }"
13
+ >
14
+ <template :key="item.value || index" v-for="(item, index) in items">
15
+ <div
16
+ :class="`ttdk-accordion-item ${itemClass || ''}`.trim()"
17
+ :data-state="isOpen(item.value) ? 'open' : 'closed'"
18
+ :data-disabled="disabled || item.disabled ? 'true' : 'false'"
19
+ :style="{
20
+ ...buildUiStyle(itemStyle),
21
+ }"
22
+ >
23
+ <h3 class="ttdk-accordion-header">
24
+ <button
25
+ type="button"
26
+ :class="`ttdk-accordion-trigger ${triggerClass || ''}`.trim()"
27
+ :data-state="isOpen(item.value) ? 'open' : 'closed'"
28
+ :data-disabled="disabled || item.disabled ? 'true' : 'false'"
29
+ :disabled="disabled || item.disabled"
30
+ :aria-expanded="isOpen(item.value)"
31
+ @click="async (event) => handleToggle(item.value, item.disabled)"
32
+ :style="{
33
+ ...buildUiStyle(triggerStyle),
34
+ }"
35
+ >
36
+ <template v-if="iconPosition === 'left'">
37
+ <span
38
+ aria-hidden="true"
39
+ :class="
40
+ `ttdk-accordion-arrow ttdk-accordion-arrow-left ${
41
+ iconClass || ''
42
+ }`.trim()
43
+ "
44
+ :data-state="isOpen(item.value) ? 'open' : 'closed'"
45
+ :style="{
46
+ ...buildUiStyle(iconStyle),
47
+ }"
48
+ >
49
+ <template v-if="icon">
50
+ {{ icon }}
51
+ </template>
52
+
53
+ <template v-if="!icon">
54
+ <svg
55
+ class="ttdk-accordion-icon"
56
+ viewBox="0 0 24 24"
57
+ fill="none"
58
+ stroke="currentColor"
59
+ >
60
+ <polyline points="6 9 12 15 18 9"></polyline>
61
+ </svg>
62
+ </template>
63
+ </span>
64
+ </template>
65
+
66
+ <template v-if="item.icon">
67
+ <span class="ttdk-accordion-leading-icon">{{ item.icon }}</span>
68
+ </template>
69
+
70
+ <span class="ttdk-accordion-label-group"
71
+ ><span
72
+ :class="`ttdk-accordion-title ${titleClass || ''}`.trim()"
73
+ :style="{
74
+ ...buildUiStyle(titleStyle),
75
+ }"
76
+ >{{ item.title }}</span
77
+ >
78
+ <template v-if="item.subtitle">
79
+ <span
80
+ :class="
81
+ `ttdk-accordion-subtitle ${subtitleClass || ''}`.trim()
82
+ "
83
+ :style="{
84
+ ...buildUiStyle(subtitleStyle),
85
+ }"
86
+ >{{ item.subtitle }}</span
87
+ >
88
+ </template>
89
+ </span>
90
+ <template v-if="item.badge !== undefined && item.badge !== null">
91
+ <span class="ttdk-accordion-badge">{{ item.badge }}</span>
92
+ </template>
93
+
94
+ <template v-if="iconPosition !== 'left'">
95
+ <span
96
+ aria-hidden="true"
97
+ :class="
98
+ `ttdk-accordion-arrow ttdk-accordion-arrow-right ${
99
+ iconClass || ''
100
+ }`.trim()
101
+ "
102
+ :data-state="isOpen(item.value) ? 'open' : 'closed'"
103
+ :style="{
104
+ ...buildUiStyle(iconStyle),
105
+ }"
106
+ >
107
+ <template v-if="icon">
108
+ {{ icon }}
109
+ </template>
110
+
111
+ <template v-if="!item.customIcon && !icon">
112
+ <svg
113
+ class="ttdk-accordion-icon"
114
+ viewBox="0 0 24 24"
115
+ fill="none"
116
+ stroke="currentColor"
117
+ >
118
+ <polyline points="6 9 12 15 18 9"></polyline>
119
+ </svg>
120
+ </template>
121
+ </span>
122
+ </template>
123
+ </button>
124
+ </h3>
125
+ <div
126
+ class="ttdk-accordion-panel"
127
+ role="region"
128
+ :data-state="isOpen(item.value) ? 'open' : 'closed'"
129
+ >
130
+ <div
131
+ :class="`ttdk-accordion-content ${contentClass || ''}`.trim()"
132
+ :style="{
133
+ ...buildUiStyle(contentStyle),
134
+ }"
135
+ >
136
+ {{ item.content }}
137
+ </div>
138
+ </div>
139
+ </div>
140
+ </template>
141
+ <template v-if="$slots.default">
142
+ <div class="ttdk-accordion-children"><slot /></div>
143
+ </template>
144
+ </div>
145
+ </template>
146
+
147
+ <script setup lang="ts">
148
+ import { ref } from "vue";
149
+
150
+ import {
151
+ buildUiStyle,
152
+ buildUiVars,
153
+ cleanUiValue,
154
+ UiProps,
155
+ } from "../../core/types";
156
+
157
+ export type AccordionUiProps = UiProps;
158
+ export interface AccordionItem {
159
+ /**
160
+ * Nilai identifikasi unik untuk item accordion.
161
+ */
162
+ value: string;
163
+
164
+ /**
165
+ * Judul teks yang ditampilkan pada header trigger accordion.
166
+ */
167
+ title: string;
168
+
169
+ /**
170
+ * Subtitle atau deskripsi singkat sekunder di bawah judul.
171
+ */
172
+ subtitle?: string;
173
+
174
+ /**
175
+ * Konten isi panel yang terbuka saat accordion di-expand.
176
+ */
177
+ content?: any;
178
+
179
+ /**
180
+ * Ikon atau elemen visual opsional di samping judul.
181
+ */
182
+ icon?: any;
183
+
184
+ /**
185
+ * Badge teks atau counter angka opsional (misal: '12', 'Baru', 'Wajib').
186
+ */
187
+ badge?: string | number;
188
+
189
+ /**
190
+ * Ikon kustom untuk menggantikan ikon panah bawaan khusus item ini.
191
+ */
192
+ customIcon?: any;
193
+
194
+ /**
195
+ * Menonaktifkan item ini dari interaksi buka/tutup.
196
+ * @default false
197
+ */
198
+ disabled?: boolean;
199
+ }
200
+ export interface AccordionProps {
201
+ /**
202
+ * Daftar item accordion yang akan dirender.
203
+ */
204
+ items: AccordionItem[];
205
+
206
+ /**
207
+ * Nilai item yang sedang terbuka (controlled value).
208
+ * Bisa berupa string tunggal atau array string jika multiple={true}.
209
+ */
210
+ value?: string | string[];
211
+
212
+ /**
213
+ * Nilai default item yang terbuka saat pertama kali dirender (uncontrolled initial value).
214
+ */
215
+ defaultValue?: string | string[];
216
+
217
+ /**
218
+ * Mengizinkan lebih dari satu item terbuka secara bersamaan.
219
+ * @default false
220
+ */
221
+ multiple?: boolean;
222
+
223
+ /**
224
+ * Mengizinkan item yang terbuka untuk ditutup kembali saat diklik.
225
+ * @default true
226
+ */
227
+ collapsible?: boolean;
228
+
229
+ /**
230
+ * Varian tampilan visual accordion:
231
+ * - `'default'`: Garis pembatas (divider) minimalis antar-item.
232
+ * - `'bordered'`: Pembungkus border luar dengan sudut melengkung.
233
+ * - `'separated'`: Setiap item berupa kartu terpisah mandiri dengan jarak celah (gap).
234
+ * - `'ghost'`: Tampilan bersih tanpa border luar, hanya hover background lembut.
235
+ *
236
+ * @default 'default'
237
+ */
238
+ variant?: "default" | "bordered" | "separated" | "ghost";
239
+
240
+ /**
241
+ * Skala ukuran proporsional accordion (padding, font, icon):
242
+ * - `'sm'`: Kompak (13px font, padding rapat).
243
+ * - `'md'`: Standar (14px font, padding normal).
244
+ * - `'lg'`: Besar (16px font, padding lapang).
245
+ *
246
+ * @default 'md'
247
+ */
248
+ size?: "sm" | "md" | "lg";
249
+
250
+ /**
251
+ * Posisi indikator ikon panah / chevron:
252
+ * - `'right'`: Di ujung kanan (standar desain).
253
+ * - `'left'`: Di sebelah kiri sebelum judul.
254
+ *
255
+ * @default 'right'
256
+ */
257
+ iconPosition?: "left" | "right";
258
+
259
+ /**
260
+ * Sudut kelengkungan radius (khusus untuk varian 'bordered' dan 'separated'):
261
+ * - `'none'`: Sudut 0px.
262
+ * - `'sm'`: Sudut 6px.
263
+ * - `'md'`: Sudut 10px.
264
+ * - `'lg'`: Sudut 14px.
265
+ * - `'full'`: Sudut 20px.
266
+ *
267
+ * @default 'md'
268
+ */
269
+ rounded?: "none" | "sm" | "md" | "lg" | "full";
270
+
271
+ /**
272
+ * Menonaktifkan seluruh interaksi accordion.
273
+ * @default false
274
+ */
275
+ disabled?: boolean;
276
+
277
+ /**
278
+ * Kustomisasi visual granular root container (UiProps).
279
+ */
280
+ ui?: UiProps;
281
+
282
+ /**
283
+ * Inline CSS style object native.
284
+ */
285
+ style?: any;
286
+
287
+ /**
288
+ * Class CSS kustom untuk root accordion.
289
+ */
290
+ className?: string;
291
+
292
+ /**
293
+ * Style kustom untuk tiap elemen item accordion (UiProps).
294
+ */
295
+ itemStyle?: UiProps;
296
+
297
+ /**
298
+ * Class CSS kustom untuk tiap elemen item accordion.
299
+ */
300
+ itemClass?: string;
301
+
302
+ /**
303
+ * Style kustom untuk tombol trigger accordion (UiProps).
304
+ */
305
+ triggerStyle?: UiProps;
306
+
307
+ /**
308
+ * Class CSS kustom untuk tombol trigger accordion.
309
+ */
310
+ triggerClass?: string;
311
+
312
+ /**
313
+ * Style kustom untuk teks judul trigger accordion (UiProps).
314
+ */
315
+ titleStyle?: UiProps;
316
+
317
+ /**
318
+ * Class CSS kustom untuk teks judul trigger accordion.
319
+ */
320
+ titleClass?: string;
321
+
322
+ /**
323
+ * Style kustom untuk teks subtitle trigger accordion (UiProps).
324
+ */
325
+ subtitleStyle?: UiProps;
326
+
327
+ /**
328
+ * Class CSS kustom untuk teks subtitle trigger accordion.
329
+ */
330
+ subtitleClass?: string;
331
+
332
+ /**
333
+ * Style kustom untuk indikator ikon panah / chevron (UiProps).
334
+ */
335
+ iconStyle?: UiProps;
336
+
337
+ /**
338
+ * Class CSS kustom untuk indikator ikon panah / chevron.
339
+ */
340
+ iconClass?: string;
341
+
342
+ /**
343
+ * Ikon kustom untuk menggantikan ikon panah bawaan accordion secara global.
344
+ */
345
+ icon?: any;
346
+
347
+ /**
348
+ * Style kustom untuk panel konten accordion (UiProps).
349
+ * Mengatur seluruh tampilan panel isi (background, padding, border, serta warna & tipografi teks isi).
350
+ */
351
+ contentStyle?: UiProps;
352
+
353
+ /**
354
+ * Class CSS kustom untuk panel konten accordion.
355
+ */
356
+ contentClass?: string;
357
+
358
+ /**
359
+ * Callback event saat status item yang terbuka berubah.
360
+ * Mengembalikan string atau array string sesuai mode `multiple`.
361
+ */
362
+ onChange?: (value: any) => void;
363
+
364
+ /**
365
+ * Konten anak atau slot kustom.
366
+ */
367
+ children?: any;
368
+ }
369
+
370
+ /**
371
+ * Komponen Accordion untuk menyusun informasi berlapis yang dapat dibuka-tutup (collapse/expand)
372
+ * dengan dukungan multiple open, berbagai varian visual (default, bordered, separated, ghost),
373
+ * serta animasi transisi grid CSS yang sangat halus.
374
+ */
375
+
376
+ const props = withDefaults(defineProps<AccordionProps>(), {
377
+ collapsible: true,
378
+ multiple: false,
379
+ variant: "default",
380
+ size: "md",
381
+ iconPosition: "right",
382
+ rounded: "md",
383
+ disabled: false,
384
+ });
385
+ const openItems = ref(
386
+ props.value !== undefined
387
+ ? Array.isArray(props.value)
388
+ ? props.value
389
+ : [props.value]
390
+ : props.defaultValue !== undefined
391
+ ? Array.isArray(props.defaultValue)
392
+ ? props.defaultValue
393
+ : [props.defaultValue]
394
+ : ([] as string[])
395
+ );
396
+
397
+ function getOpenList() {
398
+ const val = props.value !== undefined ? props.value : openItems.value;
399
+ if (!val) return [] as string[];
400
+ return Array.isArray(val) ? val : [val];
401
+ }
402
+ function isOpen(itemVal: string) {
403
+ const list = getOpenList();
404
+ return list.indexOf(itemVal) !== -1;
405
+ }
406
+ function handleToggle(itemVal: string, itemDisabled?: boolean) {
407
+ if (props.disabled || itemDisabled) return;
408
+ const list = getOpenList();
409
+ const isCurrentlyOpen = list.indexOf(itemVal) !== -1;
410
+ let next: string[];
411
+ if (props.multiple) {
412
+ if (isCurrentlyOpen) {
413
+ next = list.filter((v: string) => v !== itemVal);
414
+ } else {
415
+ next = [...list, itemVal];
416
+ }
417
+ } else {
418
+ if (isCurrentlyOpen) {
419
+ if (props.collapsible === false) {
420
+ return;
421
+ }
422
+ next = [];
423
+ } else {
424
+ next = [itemVal];
425
+ }
426
+ }
427
+ openItems.value = next;
428
+ if (props.onChange) {
429
+ props.onChange(props.multiple ? next : next[0] || "");
430
+ }
431
+ }
432
+ </script>
@@ -0,0 +1,227 @@
1
+ /* eslint-disable */
2
+ // Auto-generated by TTDK Design System Vue Type Generator
3
+ import type { DefineComponent } from "vue";
4
+ import {
5
+ buildUiStyle,
6
+ buildUiVars,
7
+ cleanUiValue,
8
+ UiProps,
9
+ } from "../../core/types";
10
+
11
+ export type AccordionUiProps = UiProps;
12
+
13
+ export interface AccordionItem {
14
+ /**
15
+ * Nilai identifikasi unik untuk item accordion.
16
+ */
17
+ value: string;
18
+
19
+ /**
20
+ * Judul teks yang ditampilkan pada header trigger accordion.
21
+ */
22
+ title: string;
23
+
24
+ /**
25
+ * Subtitle atau deskripsi singkat sekunder di bawah judul.
26
+ */
27
+ subtitle?: string;
28
+
29
+ /**
30
+ * Konten isi panel yang terbuka saat accordion di-expand.
31
+ */
32
+ content?: any;
33
+
34
+ /**
35
+ * Ikon atau elemen visual opsional di samping judul.
36
+ */
37
+ icon?: any;
38
+
39
+ /**
40
+ * Badge teks atau counter angka opsional (misal: '12', 'Baru', 'Wajib').
41
+ */
42
+ badge?: string | number;
43
+
44
+ /**
45
+ * Ikon kustom untuk menggantikan ikon panah bawaan khusus item ini.
46
+ */
47
+ customIcon?: any;
48
+
49
+ /**
50
+ * Menonaktifkan item ini dari interaksi buka/tutup.
51
+ * @default false
52
+ */
53
+ disabled?: boolean;
54
+ }
55
+
56
+ export interface AccordionProps {
57
+ /**
58
+ * Daftar item accordion yang akan dirender.
59
+ */
60
+ items: AccordionItem[];
61
+
62
+ /**
63
+ * Nilai item yang sedang terbuka (controlled value).
64
+ * Bisa berupa string tunggal atau array string jika multiple={true}.
65
+ */
66
+ value?: string | string[];
67
+
68
+ /**
69
+ * Nilai default item yang terbuka saat pertama kali dirender (uncontrolled initial value).
70
+ */
71
+ defaultValue?: string | string[];
72
+
73
+ /**
74
+ * Mengizinkan lebih dari satu item terbuka secara bersamaan.
75
+ * @default false
76
+ */
77
+ multiple?: boolean;
78
+
79
+ /**
80
+ * Mengizinkan item yang terbuka untuk ditutup kembali saat diklik.
81
+ * @default true
82
+ */
83
+ collapsible?: boolean;
84
+
85
+ /**
86
+ * Varian tampilan visual accordion:
87
+ * - `'default'`: Garis pembatas (divider) minimalis antar-item.
88
+ * - `'bordered'`: Pembungkus border luar dengan sudut melengkung.
89
+ * - `'separated'`: Setiap item berupa kartu terpisah mandiri dengan jarak celah (gap).
90
+ * - `'ghost'`: Tampilan bersih tanpa border luar, hanya hover background lembut.
91
+ *
92
+ * @default 'default'
93
+ */
94
+ variant?: "default" | "bordered" | "separated" | "ghost";
95
+
96
+ /**
97
+ * Skala ukuran proporsional accordion (padding, font, icon):
98
+ * - `'sm'`: Kompak (13px font, padding rapat).
99
+ * - `'md'`: Standar (14px font, padding normal).
100
+ * - `'lg'`: Besar (16px font, padding lapang).
101
+ *
102
+ * @default 'md'
103
+ */
104
+ size?: "sm" | "md" | "lg";
105
+
106
+ /**
107
+ * Posisi indikator ikon panah / chevron:
108
+ * - `'right'`: Di ujung kanan (standar desain).
109
+ * - `'left'`: Di sebelah kiri sebelum judul.
110
+ *
111
+ * @default 'right'
112
+ */
113
+ iconPosition?: "left" | "right";
114
+
115
+ /**
116
+ * Sudut kelengkungan radius (khusus untuk varian 'bordered' dan 'separated'):
117
+ * - `'none'`: Sudut 0px.
118
+ * - `'sm'`: Sudut 6px.
119
+ * - `'md'`: Sudut 10px.
120
+ * - `'lg'`: Sudut 14px.
121
+ * - `'full'`: Sudut 20px.
122
+ *
123
+ * @default 'md'
124
+ */
125
+ rounded?: "none" | "sm" | "md" | "lg" | "full";
126
+
127
+ /**
128
+ * Menonaktifkan seluruh interaksi accordion.
129
+ * @default false
130
+ */
131
+ disabled?: boolean;
132
+
133
+ /**
134
+ * Kustomisasi visual granular root container (UiProps).
135
+ */
136
+ ui?: UiProps;
137
+
138
+ /**
139
+ * Inline CSS style object native.
140
+ */
141
+ style?: any;
142
+
143
+ /**
144
+ * Class CSS kustom untuk root accordion.
145
+ */
146
+ className?: string;
147
+
148
+ /**
149
+ * Style kustom untuk tiap elemen item accordion (UiProps).
150
+ */
151
+ itemStyle?: UiProps;
152
+
153
+ /**
154
+ * Class CSS kustom untuk tiap elemen item accordion.
155
+ */
156
+ itemClass?: string;
157
+
158
+ /**
159
+ * Style kustom untuk tombol trigger accordion (UiProps).
160
+ */
161
+ triggerStyle?: UiProps;
162
+
163
+ /**
164
+ * Class CSS kustom untuk tombol trigger accordion.
165
+ */
166
+ triggerClass?: string;
167
+
168
+ /**
169
+ * Style kustom untuk teks judul trigger accordion (UiProps).
170
+ */
171
+ titleStyle?: UiProps;
172
+
173
+ /**
174
+ * Class CSS kustom untuk teks judul trigger accordion.
175
+ */
176
+ titleClass?: string;
177
+
178
+ /**
179
+ * Style kustom untuk teks subtitle trigger accordion (UiProps).
180
+ */
181
+ subtitleStyle?: UiProps;
182
+
183
+ /**
184
+ * Class CSS kustom untuk teks subtitle trigger accordion.
185
+ */
186
+ subtitleClass?: string;
187
+
188
+ /**
189
+ * Style kustom untuk indikator ikon panah / chevron (UiProps).
190
+ */
191
+ iconStyle?: UiProps;
192
+
193
+ /**
194
+ * Class CSS kustom untuk indikator ikon panah / chevron.
195
+ */
196
+ iconClass?: string;
197
+
198
+ /**
199
+ * Ikon kustom untuk menggantikan ikon panah bawaan accordion secara global.
200
+ */
201
+ icon?: any;
202
+
203
+ /**
204
+ * Style kustom untuk panel konten accordion (UiProps).
205
+ * Mengatur seluruh tampilan panel isi (background, padding, border, serta warna & tipografi teks isi).
206
+ */
207
+ contentStyle?: UiProps;
208
+
209
+ /**
210
+ * Class CSS kustom untuk panel konten accordion.
211
+ */
212
+ contentClass?: string;
213
+
214
+ /**
215
+ * Callback event saat status item yang terbuka berubah.
216
+ * Mengembalikan string atau array string sesuai mode `multiple`.
217
+ */
218
+ onChange?: (value: any) => void;
219
+
220
+ /**
221
+ * Konten anak atau slot kustom.
222
+ */
223
+ children?: any;
224
+ }
225
+
226
+ declare const component: DefineComponent<AccordionProps>;
227
+ export default component;
@@ -0,0 +1,3 @@
1
+ export { default } from './accordion.vue';
2
+ export { default as Accordion } from './accordion.vue';
3
+ export * from './accordion.vue';