@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,300 @@
1
+ /* eslint-disable */
2
+ // Auto-generated by TTDK Design System Vue Type Generator
3
+ import type { DefineComponent } from "vue";
4
+ import {
5
+ computePosition,
6
+ autoUpdate,
7
+ flip,
8
+ shift,
9
+ offset,
10
+ size as floatingSize,
11
+ } from "@floating-ui/dom";
12
+ import { buildUiVars, UiProps } from "../../core/types";
13
+
14
+ export type SelectboxUiProps = UiProps;
15
+
16
+ export interface SelectboxOption {
17
+ /**
18
+ * Teks label tampilan pilihan dropdown.
19
+ */
20
+ label: string;
21
+
22
+ /**
23
+ * Nilai unik (value) dari opsi pilihan.
24
+ */
25
+ value: string | number;
26
+
27
+ /**
28
+ * Status apakah opsi ini dinonaktifkan dari pemilihan.
29
+ * @default false
30
+ */
31
+ disabled?: boolean;
32
+ }
33
+
34
+ export interface SelectboxProps {
35
+ /**
36
+ * Teks label judul field yang ditampilkan di atas selectbox (14px Semibold, #141313).
37
+ */
38
+ label?: string;
39
+
40
+ /**
41
+ * Style kustom untuk elemen label judul field (UiProps).
42
+ */
43
+ labelStyle?: UiProps;
44
+
45
+ /**
46
+ * Class CSS kustom untuk elemen label judul field.
47
+ */
48
+ labelClass?: string;
49
+
50
+ /**
51
+ * Style kustom untuk elemen trigger kontrol selectbox (UiProps).
52
+ */
53
+ controlStyle?: UiProps;
54
+
55
+ /**
56
+ * Class CSS kustom untuk elemen trigger kontrol selectbox.
57
+ */
58
+ controlClass?: string;
59
+
60
+ /**
61
+ * Style kustom untuk elemen menu dropdown popover (UiProps).
62
+ */
63
+ menuStyle?: UiProps;
64
+
65
+ /**
66
+ * Class CSS kustom untuk elemen menu dropdown popover.
67
+ */
68
+ menuClass?: string;
69
+
70
+ /**
71
+ * Alias untuk menuStyle (konsistensi dengan Dropdown listStyle).
72
+ */
73
+ listStyle?: UiProps;
74
+
75
+ /**
76
+ * Class CSS kustom untuk opsi list dropdown (atau alias menuClass).
77
+ */
78
+ listClass?: string;
79
+
80
+ /**
81
+ * Style kustom untuk elemen pesan error validasi (UiProps).
82
+ */
83
+ errorMessageStyle?: UiProps;
84
+
85
+ /**
86
+ * Class CSS kustom untuk elemen pesan error validasi.
87
+ */
88
+ errorMessageClass?: string;
89
+
90
+ /**
91
+ * Style kustom untuk elemen helper text (UiProps).
92
+ */
93
+ helperTextStyle?: UiProps;
94
+
95
+ /**
96
+ * Class CSS kustom untuk elemen helper text.
97
+ */
98
+ helperTextClass?: string;
99
+
100
+ /**
101
+ * Menandai field sebagai opsi opsional dengan menambahkan teks '(Opsional)' (12px Regular, #9698A2).
102
+ * @default false
103
+ */
104
+ optional?: boolean;
105
+
106
+ /**
107
+ * Kustomisasi teks keterangan opsional.
108
+ * @default '(Opsional)'
109
+ */
110
+ optionalText?: string;
111
+
112
+ /**
113
+ * Teks petunjuk saat belum ada opsi yang dipilih.
114
+ * @default 'Pilih dropdown menu'
115
+ */
116
+ placeholder?: string;
117
+
118
+ /**
119
+ * Nilai terpilih saat ini (single string/number atau array nilai untuk mode multiple).
120
+ */
121
+ value?: any;
122
+
123
+ /**
124
+ * Nilai awal tidak terkontrol (uncontrolled initial value).
125
+ */
126
+ defaultValue?: any;
127
+
128
+ /**
129
+ * Daftar pilihan opsi dropdown. Dapat berupa array of object `{ label, value }` atau array of string.
130
+ */
131
+ options?: Array<SelectboxOption | string>;
132
+
133
+ /**
134
+ * Mode pemilihan jamak (multi-select) dengan tampilan chips/tag dan daftar checkbox.
135
+ * @default false
136
+ */
137
+ multiple?: boolean;
138
+
139
+ /**
140
+ * Mengaktifkan kotak pencarian (search input) di dalam menu dropdown.
141
+ * @default false
142
+ */
143
+ searchable?: boolean;
144
+
145
+ /**
146
+ * Placeholder pada kotak pencarian di dalam dropdown.
147
+ * @default 'Cari'
148
+ */
149
+ searchPlaceholder?: string;
150
+
151
+ /**
152
+ * Teks tombol terapkan pada footer multi-select.
153
+ * @default 'Terapkan'
154
+ */
155
+ applyText?: string;
156
+
157
+ /**
158
+ * Teks tombol reset pada footer multi-select.
159
+ * @default 'Reset'
160
+ */
161
+ resetText?: string;
162
+
163
+ /**
164
+ * Nama form field HTML.
165
+ */
166
+ name?: string;
167
+
168
+ /**
169
+ * Identifier unik elemen selectbox.
170
+ */
171
+ id?: string;
172
+
173
+ /**
174
+ * Status apakah selectbox sedang dalam kondisi error / tidak valid.
175
+ * @default false
176
+ */
177
+ error?: boolean;
178
+
179
+ /**
180
+ * Pesan teks penjelasan kesalahan validasi di bawah field.
181
+ */
182
+ errorMessage?: string;
183
+
184
+ /**
185
+ * Teks petunjuk atau keterangan bantuan di bawah field (12px Regular, #3C4245).
186
+ */
187
+ helperText?: string;
188
+
189
+ /**
190
+ * Posisi teks helper
191
+ */
192
+ helperTextPosition?: "top" | "bottom";
193
+
194
+ /**
195
+ * Skala ukuran selectbox.
196
+ * - `'sm'`: 36px
197
+ * - `'md'`: 48px (standar desain)
198
+ * - `'lg'`: 56px
199
+ * @default 'md'
200
+ */
201
+ size?: "sm" | "md" | "lg";
202
+
203
+ /**
204
+ * Bentuk sudut kelengkungan selectbox.
205
+ * - `'none'`: 0px
206
+ * - `'sm'`: 4px
207
+ * - `'md'`: 8px (standar desain)
208
+ * - `'lg'`: 12px
209
+ * - `'full'`: 9999px (kapsul)
210
+ * @default 'md'
211
+ */
212
+ rounded?: "none" | "sm" | "md" | "lg" | "full";
213
+
214
+ /**
215
+ * Menjadikan lebar field selectbox memenuhi kontainer penuh (full-width 100%).
216
+ * @default false
217
+ */
218
+ block?: boolean;
219
+
220
+ /**
221
+ * Status apakah selectbox dinonaktifkan (disabled).
222
+ * @default false
223
+ */
224
+ disabled?: boolean;
225
+
226
+ /**
227
+ * Menandai field sebagai input wajib diisi (menampilkan tanda bintang merah *).
228
+ * @default false
229
+ */
230
+ required?: boolean;
231
+
232
+ /**
233
+ * Ref instance elemen control selectbox untuk akses DOM langsung.
234
+ */
235
+ inputRef?: any;
236
+
237
+ /**
238
+ * Menampilkan tombol × untuk menghapus pilihan yang sudah dipilih.
239
+ * @default false
240
+ */
241
+ clearable?: boolean;
242
+
243
+ /**
244
+ * Menampilkan spinner loading dan menonaktifkan interaksi selectbox.
245
+ * @default false
246
+ */
247
+ loading?: boolean;
248
+
249
+ /**
250
+ * Menjadikan selectbox hanya-baca (tidak bisa dibuka/diubah).
251
+ * @default false
252
+ */
253
+ readOnly?: boolean;
254
+
255
+ /**
256
+ * Inline CSS style object native.
257
+ */
258
+ style?: any;
259
+
260
+ /**
261
+ * Kustomisasi visual granular root / form-item (UiProps).
262
+ */
263
+ ui?: UiProps;
264
+
265
+ /**
266
+ * Callback event saat nilai pilihan berubah.
267
+ */
268
+ onChange?: (value: any) => void;
269
+
270
+ /**
271
+ * Callback event saat pengguna mengetik di kolom pencarian.
272
+ */
273
+ onSearch?: (query: string) => void;
274
+
275
+ /**
276
+ * Callback event saat menu dropdown terbuka.
277
+ */
278
+ onOpen?: () => void;
279
+
280
+ /**
281
+ * Class CSS kustom.
282
+ */
283
+ className?: string;
284
+
285
+ /**
286
+ * Menonaktifkan middleware `shift` pada floating-ui sehingga posisi list popover
287
+ * tidak bergeser secara horizontal mengikuti tepi layar.
288
+ * Berguna saat ingin list tetap berada di tengah atau posisi placement yang ditentukan.
289
+ * @default false
290
+ */
291
+ disableShift?: boolean;
292
+
293
+ /**
294
+ * Callback event saat menu dropdown ditutup.
295
+ */
296
+ onClose?: () => void;
297
+ }
298
+
299
+ declare const component: DefineComponent<SelectboxProps>;
300
+ export default component;
@@ -0,0 +1,98 @@
1
+ # <Sonner /> — TTDK Component Reference
2
+
3
+ Komponen Sonner / Toaster untuk sistem notifikasi toast mengambang yang ringkas, kaya warna, dan responsif.
4
+
5
+ ## 1. Stylesheets & Theming (Pure CSS)
6
+ Import the corresponding stylesheet for the theme you wish to use:
7
+ - **COMMON Theme**: `import "@ttdk-design-system/library-<react|vue|svelte>/web/sonner/sonner.css";`
8
+
9
+ ## 2. Subpath Component Import
10
+ ```ts
11
+ // React
12
+ import Sonner from "@ttdk-design-system/library-react/web/sonner";
13
+
14
+ // Vue 3
15
+ import Sonner from "@ttdk-design-system/library-vue/web/sonner";
16
+
17
+ // Svelte
18
+ import Sonner from "@ttdk-design-system/library-svelte/web/sonner";
19
+ ```
20
+
21
+ ## 3. Props & API Reference
22
+
23
+ | Prop | Type | Default | Description |
24
+ | :--- | :--- | :--- | :--- |
25
+ | `position?` | `'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'` | `bottom-right` | Posisi penempatan toast pada layar. - `'top-left'`, `'top-center'`, `'top-right'` - `'bottom-left'`, `'bottom-center'`, `'bottom-right'` |
26
+ | `richColors?` | `boolean` | `true` | Menampilkan warna semantik kaya (*rich colors*) untuk jenis status (sukses hijau, error merah, info biru, warning kuning). |
27
+ | `closeButton?` | `boolean` | `true` | Menampilkan tombol silang penutup (*close button*) pada setiap kartu toast. |
28
+ | `theme?` | `'light' | 'dark' | 'system'` | `light` | Menentukan tema visual kontainer toast (`'light'`, `'dark'`, atau `'system'`). |
29
+ | `expand?` | `boolean` | `false` | Membuka semua tumpukan toast secara melebar (*expanded*) secara default saat muncul. |
30
+ | `duration?` | `number` | `4000` | Durasi tampilan toast dalam milidetik sebelum otomatis menghilang. |
31
+ | `visibleToasts?` | `number` | `3` | Jumlah maksimum kartu toast yang terlihat bertumpuk secara bersamaan di layar. |
32
+ | `gap?` | `number` | `14` | Jarak vertikal antar kartu toast dalam piksel. |
33
+ | `offset?` | `number` | `24` | Jarak offset tepi layar dalam piksel. |
34
+ | `mobileOffset?` | `number` | `16` | Jarak offset pada perangkat seluler / mobile dalam piksel. |
35
+ | `dir?` | `'ltr' | 'rtl'` | `ltr` | Arah teks layout tata letak (`'ltr'` atau `'rtl'`). |
36
+ | `className?` | `string` | `-` | Kelas CSS kustom tambahan untuk wadah toaster. |
37
+
38
+ ## 4. Usage Examples
39
+
40
+ ### React Example
41
+ ```tsx
42
+ import Sonner from "@ttdk-design-system/library-react/web/sonner";
43
+ import "@ttdk-design-system/library-react/web/sonner/sonner.css";
44
+ import toast from "sonner-js";
45
+
46
+ export function Example() {
47
+ return (
48
+ <div>
49
+ <Sonner position="bottom-right" richColors />
50
+ <button onClick={() => toast.success("Data pasien berhasil disimpan!")}>
51
+ Tampilkan Toast Sukses
52
+ </button>
53
+ </div>
54
+ );
55
+ }
56
+ ```
57
+
58
+ ### Vue 3 Example
59
+ ```vue
60
+ <script setup lang="ts">
61
+ import Sonner from "@ttdk-design-system/library-vue/web/sonner";
62
+ import "@ttdk-design-system/library-vue/web/sonner/sonner.css";
63
+ import toast from "sonner-js";
64
+
65
+ const showToast = () => {
66
+ toast.success("Data pasien berhasil disimpan!");
67
+ };
68
+ </script>
69
+
70
+ <template>
71
+ <div>
72
+ <Sonner position="bottom-right" :rich-colors="true" />
73
+ <button @click="showToast">
74
+ Tampilkan Toast Sukses
75
+ </button>
76
+ </div>
77
+ </template>
78
+ ```
79
+
80
+ ### Svelte Example
81
+ ```svelte
82
+ <script lang="ts">
83
+ import Sonner from "@ttdk-design-system/library-svelte/web/sonner";
84
+ import "@ttdk-design-system/library-svelte/web/sonner/sonner.css";
85
+ import toast from "sonner-js";
86
+
87
+ const showToast = () => {
88
+ toast.success("Data pasien berhasil disimpan!");
89
+ };
90
+ </script>
91
+
92
+ <div>
93
+ <Sonner position="bottom-right" richColors={true} />
94
+ <button on:click={showToast}>
95
+ Tampilkan Toast Sukses
96
+ </button>
97
+ </div>
98
+ ```
@@ -0,0 +1,114 @@
1
+ import sonnerJsToast from 'sonner-js';
2
+ import SonnerComponent from './sonner.vue';
3
+
4
+ export interface ToastAction {
5
+ label: string;
6
+ onClick: (event: MouseEvent) => void;
7
+ cancel?: boolean;
8
+ }
9
+
10
+ export interface ToastOptions {
11
+ position?: 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
12
+ closeButton?: boolean;
13
+ richColors?: boolean;
14
+ duration?: number;
15
+ invert?: boolean;
16
+ description?: string;
17
+ action?: ToastAction;
18
+ onDismiss?: (toast?: any) => void;
19
+ onAutoClose?: (toast?: any) => void;
20
+ [key: string]: any;
21
+ }
22
+
23
+ export interface ToastPromiseOptions<T = any> {
24
+ loading?: string;
25
+ success?: string | ((data: T) => string);
26
+ error?: string | ((err: any) => string);
27
+ description?: string | ((data: any) => string);
28
+ finally?: () => void | Promise<void>;
29
+ }
30
+
31
+ export interface ToastInterface {
32
+ (message: string, options?: ToastOptions): string | number;
33
+ /**
34
+ * Compatibility property for Vue template unref / Volar __VLS_withDotValue closure.
35
+ */
36
+ readonly value: ToastInterface;
37
+ message: (message: string, options?: ToastOptions) => string | number;
38
+ success: (message: string, options?: ToastOptions) => string | number;
39
+ error: (message: string, options?: ToastOptions) => string | number;
40
+ danger: (message: string, options?: ToastOptions) => string | number;
41
+ info: (message: string, options?: ToastOptions) => string | number;
42
+ warning: (message: string, options?: ToastOptions) => string | number;
43
+ loading: (message: string, options?: ToastOptions) => string | number;
44
+ dismiss: (id?: number | string, exitTime?: number) => void;
45
+ promise: <T = any>(promise: Promise<T> | (() => Promise<T>), data?: ToastPromiseOptions<T>) => void;
46
+ config: (userConfig: any) => void;
47
+ }
48
+
49
+ function getRawToast(): any {
50
+ const t = sonnerJsToast as any;
51
+ if (t && typeof t.default === 'function') {
52
+ return t.default;
53
+ }
54
+ if (typeof t === 'function') {
55
+ return t;
56
+ }
57
+ return t?.default || t;
58
+ }
59
+
60
+ const toastFunction = (message: string, options?: ToastOptions) => {
61
+ const raw = getRawToast();
62
+ return typeof raw === 'function' ? raw(message, options) : undefined;
63
+ };
64
+
65
+ export const toast: ToastInterface = Object.assign(toastFunction, {
66
+ message: (message: string, options?: ToastOptions) => {
67
+ const raw = getRawToast();
68
+ return raw?.message ? raw.message(message, options) : raw?.(message, options);
69
+ },
70
+ success: (message: string, options?: ToastOptions) => getRawToast()?.success?.(message, options),
71
+ error: (message: string, options?: ToastOptions) => getRawToast()?.error?.(message, options),
72
+ danger: (message: string, options?: ToastOptions) => {
73
+ const raw = getRawToast();
74
+ return (raw?.danger || raw?.error)?.(message, options);
75
+ },
76
+ info: (message: string, options?: ToastOptions) => getRawToast()?.info?.(message, options),
77
+ warning: (message: string, options?: ToastOptions) => getRawToast()?.warning?.(message, options),
78
+ loading: (message: string, options?: ToastOptions) => getRawToast()?.loading?.(message, options),
79
+ dismiss: (id?: number | string, exitTime?: number) => getRawToast()?.dismiss?.(id, exitTime),
80
+ promise: <T = any>(promise: Promise<T> | (() => Promise<T>), data?: ToastPromiseOptions<T>) => getRawToast()?.promise?.(promise, data),
81
+ config: (userConfig: any) => getRawToast()?.config?.(userConfig),
82
+ }) as ToastInterface;
83
+
84
+ try {
85
+ Object.defineProperty(toast, 'value', {
86
+ get() {
87
+ return toast;
88
+ },
89
+ enumerable: true,
90
+ configurable: true,
91
+ });
92
+ } catch (_) {}
93
+
94
+ if (typeof window !== 'undefined') {
95
+ try {
96
+ const raw = getRawToast();
97
+ if (raw && typeof raw.config === 'function') {
98
+ raw.config({
99
+ toastOptions: {
100
+ position: 'bottom-right',
101
+ closeButton: true,
102
+ richColors: true,
103
+ duration: 4000,
104
+ },
105
+ });
106
+ }
107
+ } catch (e) {
108
+ // Abaikan jika dieksekusi di lingkungan SSR / non-DOM
109
+ }
110
+ }
111
+
112
+ export { SonnerComponent as Sonner, SonnerComponent as Toaster };
113
+ export default SonnerComponent;
114
+ export type { SonnerProps, SonnerPosition, SonnerTheme } from './sonner.vue';
@@ -0,0 +1,132 @@
1
+ {
2
+ "name": "@ttdk-design-system/sonner",
3
+ "component": "Sonner",
4
+ "folder": "sonner",
5
+ "description": "Komponen Sonner / Toaster untuk sistem notifikasi toast mengambang yang ringkas, kaya warna, dan responsif.",
6
+ "stylesheets": [
7
+ {
8
+ "theme": "common",
9
+ "file": "sonner.css",
10
+ "importPath": "web/sonner/sonner.css"
11
+ }
12
+ ],
13
+ "props": {
14
+ "position": {
15
+ "name": "position",
16
+ "type": "'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'",
17
+ "optional": true,
18
+ "default": "bottom-right",
19
+ "description": "Posisi penempatan toast pada layar. - `'top-left'`, `'top-center'`, `'top-right'` - `'bottom-left'`, `'bottom-center'`, `'bottom-right'`",
20
+ "example": null,
21
+ "param": null
22
+ },
23
+ "richColors": {
24
+ "name": "richColors",
25
+ "type": "boolean",
26
+ "optional": true,
27
+ "default": "true",
28
+ "description": "Menampilkan warna semantik kaya (*rich colors*) untuk jenis status (sukses hijau, error merah, info biru, warning kuning).",
29
+ "example": null,
30
+ "param": null
31
+ },
32
+ "closeButton": {
33
+ "name": "closeButton",
34
+ "type": "boolean",
35
+ "optional": true,
36
+ "default": "true",
37
+ "description": "Menampilkan tombol silang penutup (*close button*) pada setiap kartu toast.",
38
+ "example": null,
39
+ "param": null
40
+ },
41
+ "theme": {
42
+ "name": "theme",
43
+ "type": "'light' | 'dark' | 'system'",
44
+ "optional": true,
45
+ "default": "light",
46
+ "description": "Menentukan tema visual kontainer toast (`'light'`, `'dark'`, atau `'system'`).",
47
+ "example": null,
48
+ "param": null
49
+ },
50
+ "expand": {
51
+ "name": "expand",
52
+ "type": "boolean",
53
+ "optional": true,
54
+ "default": "false",
55
+ "description": "Membuka semua tumpukan toast secara melebar (*expanded*) secara default saat muncul.",
56
+ "example": null,
57
+ "param": null
58
+ },
59
+ "duration": {
60
+ "name": "duration",
61
+ "type": "number",
62
+ "optional": true,
63
+ "default": "4000",
64
+ "description": "Durasi tampilan toast dalam milidetik sebelum otomatis menghilang.",
65
+ "example": null,
66
+ "param": null
67
+ },
68
+ "visibleToasts": {
69
+ "name": "visibleToasts",
70
+ "type": "number",
71
+ "optional": true,
72
+ "default": "3",
73
+ "description": "Jumlah maksimum kartu toast yang terlihat bertumpuk secara bersamaan di layar.",
74
+ "example": null,
75
+ "param": null
76
+ },
77
+ "gap": {
78
+ "name": "gap",
79
+ "type": "number",
80
+ "optional": true,
81
+ "default": "14",
82
+ "description": "Jarak vertikal antar kartu toast dalam piksel.",
83
+ "example": null,
84
+ "param": null
85
+ },
86
+ "offset": {
87
+ "name": "offset",
88
+ "type": "number",
89
+ "optional": true,
90
+ "default": "24",
91
+ "description": "Jarak offset tepi layar dalam piksel.",
92
+ "example": null,
93
+ "param": null
94
+ },
95
+ "mobileOffset": {
96
+ "name": "mobileOffset",
97
+ "type": "number",
98
+ "optional": true,
99
+ "default": "16",
100
+ "description": "Jarak offset pada perangkat seluler / mobile dalam piksel.",
101
+ "example": null,
102
+ "param": null
103
+ },
104
+ "dir": {
105
+ "name": "dir",
106
+ "type": "'ltr' | 'rtl'",
107
+ "optional": true,
108
+ "default": "ltr",
109
+ "description": "Arah teks layout tata letak (`'ltr'` atau `'rtl'`).",
110
+ "example": null,
111
+ "param": null
112
+ },
113
+ "className": {
114
+ "name": "className",
115
+ "type": "string",
116
+ "optional": true,
117
+ "default": null,
118
+ "description": "Kelas CSS kustom tambahan untuk wadah toaster.",
119
+ "example": null,
120
+ "param": null
121
+ }
122
+ },
123
+ "subInterfaces": {},
124
+ "supportedFrameworks": [
125
+ "react",
126
+ "vue",
127
+ "svelte"
128
+ ],
129
+ "themes": [
130
+ "tw"
131
+ ]
132
+ }
@@ -0,0 +1 @@
1
+ [data-sonner-toasters]{font-family:var(--ttdk-font-sans);-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}[data-sonner-toaster]{--width:360px;--border-radius:10px;--gap:12px;--offset:24px;--mobile-offset:16px;z-index:999999}[data-sonner-toaster][data-sonner-theme=light],:root:not(.dark) [data-sonner-toaster]{--normal-bg:var(--ttdk-bg-card);--normal-border:var(--ttdk-stroke-subtle);--normal-text:var(--ttdk-text-icon-primary);--normal-text2:var(--ttdk-text-icon-secondary);--normal-cancel-bg:var(--ttdk-bg-secondary-disabled);--success-bg:var(--ttdk-bg-status-success-subtle);--success-border:var(--ttdk-stroke-status-success);--success-text:var(--ttdk-text-icon-status-success);--info-bg:var(--ttdk-bg-status-info-subtle);--info-border:var(--ttdk-stroke-status-info);--info-text:var(--ttdk-text-icon-status-info);--warning-bg:var(--ttdk-bg-status-warning-subtle);--warning-border:var(--ttdk-stroke-status-warning);--warning-text:var(--ttdk-text-icon-status-warning);--error-bg:var(--ttdk-bg-status-error-subtle);--error-border:var(--ttdk-stroke-status-error);--error-text:var(--ttdk-text-icon-status-error)}[data-sonner-toaster][data-sonner-theme=dark],.dark [data-sonner-toaster]{--normal-bg:var(--ttdk-bg-card);--normal-border:var(--ttdk-stroke-subtle);--normal-text:var(--ttdk-text-icon-primary);--normal-text2:var(--ttdk-text-icon-secondary);--normal-cancel-bg:var(--ttdk-bg-secondary-disabled);--success-bg:var(--ttdk-color-green-900);--success-border:var(--ttdk-color-green-700);--success-text:var(--ttdk-color-green-300);--info-bg:var(--ttdk-color-blue-900);--info-border:var(--ttdk-color-blue-700);--info-text:var(--ttdk-color-blue-300);--warning-bg:var(--ttdk-color-orange-900);--warning-border:var(--ttdk-color-orange-700);--warning-text:var(--ttdk-color-orange-300);--error-bg:var(--ttdk-color-red-900);--error-border:var(--ttdk-color-red-700);--error-text:var(--ttdk-color-red-300)}[data-sonner-toast]{border-radius:var(--border-radius);border:1px solid var(--normal-border);background-color:var(--normal-bg);color:var(--normal-text);box-shadow:var(--ttdk-shadow-lg);gap:10px;padding:14px 16px;font-size:13px;line-height:1.4;transition:transform .3s cubic-bezier(.16,1,.3,1),opacity .3s cubic-bezier(.16,1,.3,1),height .3s}.dark [data-sonner-toast]{box-shadow:var(--ttdk-shadow-lg)}[data-sonner-toast] [data-content]{flex-direction:column;gap:3px;display:flex}[data-sonner-toast] [data-title]{color:inherit;letter-spacing:-.01em;font-size:13px;font-weight:600}[data-sonner-toast] [data-description]{color:var(--normal-text2);font-size:12px;font-weight:400;line-height:1.4}[data-sonner-toast] [data-button]{background:var(--normal-text);height:28px;color:var(--normal-bg);cursor:pointer;border:none;border-radius:6px;justify-content:center;align-items:center;padding:0 10px;font-family:inherit;font-size:12px;font-weight:600;transition:opacity .15s,transform .1s;display:inline-flex}[data-sonner-toast] [data-button]:hover{opacity:.9}[data-sonner-toast] [data-button]:active{transform:scale(.97)}[data-sonner-toast] [data-button][data-cancel]{background:var(--normal-cancel-bg);color:var(--normal-text)}[data-sonner-toast] [data-close-button=true]{background:var(--normal-bg);border:1px solid var(--normal-border);width:20px;height:20px;color:var(--normal-text2);cursor:pointer;border-radius:50%;justify-content:center;align-items:center;transition:background-color .15s,color .15s;display:flex}[data-sonner-toast] [data-close-button=true]:hover{background:var(--normal-cancel-bg);color:var(--normal-text)}[data-sonner-toast][data-rich-colors][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-sonner-toast][data-rich-colors][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-sonner-toast][data-rich-colors][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-sonner-toast][data-rich-colors][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}