@ttdk-design-system/library-react 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.
Files changed (184) hide show
  1. package/AI_GUIDE.md +6518 -0
  2. package/README.md +106 -2
  3. package/llms.txt +6518 -0
  4. package/package.json +1099 -4
  5. package/src/core/index.ts +2 -0
  6. package/src/core/tailwind-preset.cjs +62 -0
  7. package/src/core/tailwind-preset.ts +85 -0
  8. package/src/core/theme/tokens.css +663 -0
  9. package/src/core/types.ts +836 -0
  10. package/src/index.ts +17 -0
  11. package/src/tailwind-preset.cjs +62 -0
  12. package/src/tailwind-preset.ts +85 -0
  13. package/src/types.ts +1 -0
  14. package/src/web/accordion/AI_GUIDE.md +149 -0
  15. package/src/web/accordion/accordion.css +1 -0
  16. package/src/web/accordion/accordion.tsx +430 -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.tsx +318 -0
  22. package/src/web/alert/index.ts +3 -0
  23. package/src/web/alert/manifest.json +240 -0
  24. package/src/web/avatar/AI_GUIDE.md +118 -0
  25. package/src/web/avatar/avatar.css +1 -0
  26. package/src/web/avatar/avatar.tsx +233 -0
  27. package/src/web/avatar/index.ts +3 -0
  28. package/src/web/avatar/manifest.json +195 -0
  29. package/src/web/badge/AI_GUIDE.md +94 -0
  30. package/src/web/badge/badge.css +1 -0
  31. package/src/web/badge/badge.tsx +140 -0
  32. package/src/web/badge/index.ts +2 -0
  33. package/src/web/badge/manifest.json +141 -0
  34. package/src/web/banner/AI_GUIDE.md +130 -0
  35. package/src/web/banner/banner.css +1 -0
  36. package/src/web/banner/banner.tsx +334 -0
  37. package/src/web/banner/index.ts +3 -0
  38. package/src/web/banner/manifest.json +240 -0
  39. package/src/web/breadcrumb/AI_GUIDE.md +120 -0
  40. package/src/web/breadcrumb/breadcrumb.css +1 -0
  41. package/src/web/breadcrumb/breadcrumb.tsx +306 -0
  42. package/src/web/breadcrumb/index.ts +3 -0
  43. package/src/web/breadcrumb/manifest.json +225 -0
  44. package/src/web/button/AI_GUIDE.md +121 -0
  45. package/src/web/button/button.css +1 -0
  46. package/src/web/button/button.tsx +287 -0
  47. package/src/web/button/index.ts +2 -0
  48. package/src/web/button/manifest.json +177 -0
  49. package/src/web/calendar/AI_GUIDE.md +151 -0
  50. package/src/web/calendar/calendar.css +1 -0
  51. package/src/web/calendar/calendar.tsx +1611 -0
  52. package/src/web/calendar/index.ts +3 -0
  53. package/src/web/calendar/manifest.json +470 -0
  54. package/src/web/card/AI_GUIDE.md +133 -0
  55. package/src/web/card/card.css +1 -0
  56. package/src/web/card/card.tsx +408 -0
  57. package/src/web/card/index.ts +4 -0
  58. package/src/web/card/manifest.json +357 -0
  59. package/src/web/checkbox/AI_GUIDE.md +146 -0
  60. package/src/web/checkbox/checkbox.css +1 -0
  61. package/src/web/checkbox/checkbox.tsx +307 -0
  62. package/src/web/checkbox/index.ts +2 -0
  63. package/src/web/checkbox/manifest.json +294 -0
  64. package/src/web/chip/AI_GUIDE.md +186 -0
  65. package/src/web/chip/chip.css +1 -0
  66. package/src/web/chip/chip.tsx +230 -0
  67. package/src/web/chip/index.ts +2 -0
  68. package/src/web/chip/manifest.json +186 -0
  69. package/src/web/dropdown/AI_GUIDE.md +167 -0
  70. package/src/web/dropdown/dropdown.css +1 -0
  71. package/src/web/dropdown/dropdown.tsx +1274 -0
  72. package/src/web/dropdown/index.ts +3 -0
  73. package/src/web/dropdown/manifest.json +576 -0
  74. package/src/web/flex/AI_GUIDE.md +113 -0
  75. package/src/web/flex/flex-item.tsx +97 -0
  76. package/src/web/flex/flex.css +1 -0
  77. package/src/web/flex/flex.tsx +108 -0
  78. package/src/web/flex/index.ts +5 -0
  79. package/src/web/flex/manifest.json +162 -0
  80. package/src/web/form/index.ts +7 -0
  81. package/src/web/grid/AI_GUIDE.md +112 -0
  82. package/src/web/grid/grid-item.tsx +112 -0
  83. package/src/web/grid/grid.css +1 -0
  84. package/src/web/grid/grid.tsx +99 -0
  85. package/src/web/grid/index.ts +5 -0
  86. package/src/web/grid/manifest.json +153 -0
  87. package/src/web/index.ts +86 -0
  88. package/src/web/input/AI_GUIDE.md +159 -0
  89. package/src/web/input/index.ts +3 -0
  90. package/src/web/input/input.css +1 -0
  91. package/src/web/input/input.tsx +537 -0
  92. package/src/web/input/manifest.json +465 -0
  93. package/src/web/input-number/AI_GUIDE.md +164 -0
  94. package/src/web/input-number/index.ts +3 -0
  95. package/src/web/input-number/input-number.css +1 -0
  96. package/src/web/input-number/input-number.tsx +1193 -0
  97. package/src/web/input-number/manifest.json +575 -0
  98. package/src/web/modal/AI_GUIDE.md +171 -0
  99. package/src/web/modal/index.ts +3 -0
  100. package/src/web/modal/manifest.json +375 -0
  101. package/src/web/modal/modal.css +1 -0
  102. package/src/web/modal/modal.tsx +571 -0
  103. package/src/web/pagination/AI_GUIDE.md +148 -0
  104. package/src/web/pagination/index.ts +21 -0
  105. package/src/web/pagination/manifest.json +432 -0
  106. package/src/web/pagination/pagination-content.tsx +45 -0
  107. package/src/web/pagination/pagination-ellipsis.tsx +54 -0
  108. package/src/web/pagination/pagination-first.tsx +155 -0
  109. package/src/web/pagination/pagination-item.tsx +45 -0
  110. package/src/web/pagination/pagination-last.tsx +155 -0
  111. package/src/web/pagination/pagination-link.tsx +121 -0
  112. package/src/web/pagination/pagination-next.tsx +158 -0
  113. package/src/web/pagination/pagination-previous.tsx +158 -0
  114. package/src/web/pagination/pagination.css +1 -0
  115. package/src/web/pagination/pagination.tsx +687 -0
  116. package/src/web/popover/AI_GUIDE.md +163 -0
  117. package/src/web/popover/index.ts +3 -0
  118. package/src/web/popover/manifest.json +396 -0
  119. package/src/web/popover/popover.css +1 -0
  120. package/src/web/popover/popover.tsx +702 -0
  121. package/src/web/radio/AI_GUIDE.md +155 -0
  122. package/src/web/radio/index.ts +2 -0
  123. package/src/web/radio/manifest.json +294 -0
  124. package/src/web/radio/radio.css +1 -0
  125. package/src/web/radio/radio.tsx +290 -0
  126. package/src/web/selectbox/AI_GUIDE.md +216 -0
  127. package/src/web/selectbox/index.ts +3 -0
  128. package/src/web/selectbox/manifest.json +477 -0
  129. package/src/web/selectbox/selectbox.css +1 -0
  130. package/src/web/selectbox/selectbox.tsx +1048 -0
  131. package/src/web/sonner/AI_GUIDE.md +98 -0
  132. package/src/web/sonner/index.ts +114 -0
  133. package/src/web/sonner/manifest.json +132 -0
  134. package/src/web/sonner/sonner.css +1 -0
  135. package/src/web/sonner/sonner.tsx +177 -0
  136. package/src/web/table/AI_GUIDE.md +145 -0
  137. package/src/web/table/index.ts +35 -0
  138. package/src/web/table/manifest.json +168 -0
  139. package/src/web/table/table-body.tsx +45 -0
  140. package/src/web/table/table-caption.tsx +45 -0
  141. package/src/web/table/table-cell.tsx +74 -0
  142. package/src/web/table/table-empty.tsx +108 -0
  143. package/src/web/table/table-footer.tsx +45 -0
  144. package/src/web/table/table-head.tsx +80 -0
  145. package/src/web/table/table-header.tsx +45 -0
  146. package/src/web/table/table-row.tsx +69 -0
  147. package/src/web/table/table.css +1 -0
  148. package/src/web/table/table.tsx +305 -0
  149. package/src/web/tabs/AI_GUIDE.md +150 -0
  150. package/src/web/tabs/index.ts +3 -0
  151. package/src/web/tabs/manifest.json +315 -0
  152. package/src/web/tabs/tabs.css +1 -0
  153. package/src/web/tabs/tabs.tsx +332 -0
  154. package/src/web/text/AI_GUIDE.md +129 -0
  155. package/src/web/text/index.ts +3 -0
  156. package/src/web/text/manifest.json +195 -0
  157. package/src/web/text/text.css +1 -0
  158. package/src/web/text/text.tsx +689 -0
  159. package/src/web/textarea/AI_GUIDE.md +141 -0
  160. package/src/web/textarea/index.ts +3 -0
  161. package/src/web/textarea/manifest.json +438 -0
  162. package/src/web/textarea/textarea.css +1 -0
  163. package/src/web/textarea/textarea.tsx +467 -0
  164. package/src/web/tooltip/AI_GUIDE.md +110 -0
  165. package/src/web/tooltip/index.ts +3 -0
  166. package/src/web/tooltip/manifest.json +222 -0
  167. package/src/web/tooltip/tooltip.css +1 -0
  168. package/src/web/tooltip/tooltip.tsx +423 -0
  169. package/src/webview/bottomsheet/AI_GUIDE.md +141 -0
  170. package/src/webview/bottomsheet/bottomsheet.css +1 -0
  171. package/src/webview/bottomsheet/bottomsheet.tsx +603 -0
  172. package/src/webview/bottomsheet/index.ts +4 -0
  173. package/src/webview/bottomsheet/manifest.json +377 -0
  174. package/src/webview/button/AI_GUIDE.md +79 -0
  175. package/src/webview/button/button-ios.css +1 -0
  176. package/src/webview/button/button-ios.tsx +138 -0
  177. package/src/webview/button/button-material.css +1 -0
  178. package/src/webview/button/button-material.tsx +138 -0
  179. package/src/webview/button/index.ts +7 -0
  180. package/src/webview/button/manifest.json +148 -0
  181. package/src/webview/index.ts +7 -0
  182. package/tailwind-preset.cjs +62 -0
  183. package/tailwind-preset.js +62 -0
  184. package/ttdk-manifest.json +10188 -0
@@ -0,0 +1,318 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ import { useState } from "react";
4
+
5
+ export type AlertUiProps = UiProps;
6
+ export interface AlertProps {
7
+ /**
8
+ * Inline CSS style kustom.
9
+ */
10
+ style?: React.CSSProperties;
11
+ /**
12
+ * Judul utama alert.
13
+ */
14
+ title?: string;
15
+
16
+ /**
17
+ * Deskripsi atau pesan teks penjelasan alert.
18
+ */
19
+ description?: string;
20
+
21
+ /**
22
+ * Varian warna semantik alert:
23
+ * - `'neutral'`: Netral (border hitam/putih, background base).
24
+ * - `'info'`: Biru informasi (#2196F3).
25
+ * - `'success'`: Hijau konfirmasi keberhasilan (#04B761).
26
+ * - `'warning'`: Kuning / amber peringatan (#F88000).
27
+ * - `'danger'`: Merah kesalahan / bahaya (#D0021B).
28
+ *
29
+ * @default 'neutral'
30
+ */
31
+ variant?: "neutral" | "info" | "success" | "warning" | "danger";
32
+
33
+ /**
34
+ * Gaya tampilan visual alert:
35
+ * - `'soft'`: Latar belakang warna transparan lembut (standar).
36
+ * - `'solid'`: Latar belakang warna solid pekat dengan teks putih.
37
+ * - `'outline'`: Garis tepi dengan latar belakang transparan.
38
+ * - `'subtle'`: Latar belakang abu netral dengan aksen border tipis.
39
+ *
40
+ * @default 'soft'
41
+ */
42
+ appearance?: "soft" | "solid" | "outline" | "subtle";
43
+
44
+ /**
45
+ * Sudut kelengkungan alert:
46
+ * - `'none'`: Sudut tajam 0px.
47
+ * - `'sm'`: Radius halus 4px.
48
+ * - `'md'`: Radius sedang 8px (standar).
49
+ * - `'lg'`: Radius melengkung 12px.
50
+ * - `'full'`: Lingkaran penuh 9999px.
51
+ *
52
+ * @default 'md'
53
+ */
54
+ rounded?: "none" | "sm" | "md" | "lg" | "full";
55
+
56
+ /**
57
+ * Ikon SVG kustom yang menggantikan ikon bawaan, atau boolean untuk menampilkan/menyembunyikan ikon.
58
+ * @default true
59
+ */
60
+ icon?: any;
61
+
62
+ /**
63
+ * Warna ikon kustom secara langsung.
64
+ */
65
+ iconColor?: string;
66
+
67
+ /**
68
+ * Ukuran ikon kustom secara langsung (misal: '20px', '1.5rem').
69
+ */
70
+ iconSize?: string;
71
+
72
+ /**
73
+ * Menyembunyikan ikon pada alert.
74
+ * @default false
75
+ */
76
+ hideIcon?: boolean;
77
+
78
+ /**
79
+ * Menampilkan tombol tutup (silang) untuk menutup alert secara interaktif.
80
+ * @default false
81
+ */
82
+ closable?: boolean;
83
+
84
+ /**
85
+ * Callback saat tombol tutup diklik.
86
+ */
87
+ onClose?: (event: any) => void;
88
+
89
+ /**
90
+ * Membuat alert memenuhi lebar kontainer (100%).
91
+ * @default false
92
+ */
93
+ block?: boolean;
94
+
95
+ /**
96
+ * Style kustom untuk judul alert (UiProps / style object + pseudo support).
97
+ */
98
+ titleStyle?: UiProps;
99
+
100
+ /**
101
+ * Class CSS kustom untuk judul alert.
102
+ */
103
+ titleClass?: string;
104
+
105
+ /**
106
+ * Style kustom untuk deskripsi alert (UiProps / style object + pseudo support).
107
+ */
108
+ descStyle?: UiProps;
109
+
110
+ /**
111
+ * Class CSS kustom untuk deskripsi alert.
112
+ */
113
+ descClass?: string;
114
+
115
+ /**
116
+ * Style kustom untuk ikon alert (UiProps / style object + pseudo support).
117
+ */
118
+ iconStyle?: UiProps;
119
+
120
+ /**
121
+ * Class CSS kustom untuk ikon alert.
122
+ */
123
+ iconClass?: string;
124
+
125
+ /**
126
+ * Style kustom untuk tombol tutup alert (UiProps / style object + pseudo support).
127
+ */
128
+ closableStyle?: UiProps;
129
+
130
+ /**
131
+ * Class CSS kustom untuk tombol tutup alert.
132
+ */
133
+ closableClass?: string;
134
+
135
+ /**
136
+ * Kustomisasi visual granular melalui style-like object (+ support pseudo-class: hover, active).
137
+ */
138
+ ui?: UiProps;
139
+
140
+ /**
141
+ * Class CSS kustom.
142
+ */
143
+ className?: string;
144
+
145
+ /**
146
+ * Konten kustom tambahan di dalam alert.
147
+ */
148
+ children?: any;
149
+ }
150
+
151
+ /**
152
+ * Komponen Alert untuk menampilkan pesan umpan balik kontekstual statis, instruksi peringatan, atau status penting pada halaman.
153
+ */
154
+
155
+ import { buildUiVars, UiProps } from "../../core/types";
156
+
157
+ function Alert(props: AlertProps) {
158
+ const [isVisible, setIsVisible] = useState(() => true);
159
+
160
+ function handleDismiss(event: any) {
161
+ setIsVisible(false);
162
+ if (props.onClose) {
163
+ props.onClose(event);
164
+ }
165
+ }
166
+
167
+ return (
168
+ <>
169
+ {isVisible ? (
170
+ <>
171
+ <div
172
+ role="alert"
173
+ className={`ttdk-alert ${props.className || ""}`.trim()}
174
+ data-variant={props.variant || "neutral"}
175
+ data-appearance={props.appearance || "soft"}
176
+ data-rounded={props.rounded || "md"}
177
+ data-block={props.block ? "true" : "false"}
178
+ style={{
179
+ ...buildUiVars(props.ui),
180
+ ...(props.iconColor
181
+ ? {
182
+ "--ttdk-ui-icon-color": props.iconColor,
183
+ }
184
+ : {}),
185
+ ...(props.iconSize
186
+ ? {
187
+ "--ttdk-ui-icon-size": props.iconSize,
188
+ }
189
+ : {}),
190
+ ...((props as any)["style"] || {}),
191
+ ...props.style,
192
+ }}
193
+ >
194
+ {!props.hideIcon && props.icon !== false ? (
195
+ <div
196
+ className={`ttdk-alert-icon-wrapper ${
197
+ props.iconClass || ""
198
+ }`.trim()}
199
+ style={{
200
+ ...buildUiVars(props.iconStyle),
201
+ }}
202
+ >
203
+ {props.icon && typeof props.icon !== "boolean" ? (
204
+ <span className="ttdk-alert-icon">{props.icon}</span>
205
+ ) : null}
206
+ {!props.icon || props.icon === true ? (
207
+ <>
208
+ {props.variant === "success" ? (
209
+ <svg
210
+ className="ttdk-alert-icon"
211
+ viewBox="0 0 24 24"
212
+ fill="none"
213
+ >
214
+ <circle cx="12" cy="12" r="10" />
215
+ <polyline points="9 12 11 14 15 10" />
216
+ </svg>
217
+ ) : null}
218
+ {props.variant === "warning" ? (
219
+ <svg
220
+ className="ttdk-alert-icon"
221
+ viewBox="0 0 24 24"
222
+ fill="none"
223
+ >
224
+ <path d="m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z" />
225
+ <line x1="12" y1="9" x2="12" y2="13" />
226
+ <line x1="12" y1="17" x2="12.01" y2="17" />
227
+ </svg>
228
+ ) : null}
229
+ {props.variant === "danger" ? (
230
+ <svg
231
+ className="ttdk-alert-icon"
232
+ viewBox="0 0 24 24"
233
+ fill="none"
234
+ >
235
+ <circle cx="12" cy="12" r="10" />
236
+ <line x1="12" y1="8" x2="12" y2="12" />
237
+ <line x1="12" y1="16" x2="12.01" y2="16" />
238
+ </svg>
239
+ ) : null}
240
+ {props.variant === "info" ? (
241
+ <svg
242
+ className="ttdk-alert-icon"
243
+ viewBox="0 0 24 24"
244
+ fill="none"
245
+ >
246
+ <circle cx="12" cy="12" r="10" />
247
+ <line x1="12" y1="16" x2="12" y2="12" />
248
+ <line x1="12" y1="8" x2="12.01" y2="8" />
249
+ </svg>
250
+ ) : null}
251
+ {!props.variant || props.variant === "neutral" ? (
252
+ <svg
253
+ className="ttdk-alert-icon"
254
+ viewBox="0 0 24 24"
255
+ fill="none"
256
+ >
257
+ <path d="M12 2L2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5" />
258
+ </svg>
259
+ ) : null}
260
+ </>
261
+ ) : null}
262
+ </div>
263
+ ) : null}
264
+ <div className="ttdk-alert-content">
265
+ {props.title ? (
266
+ <div
267
+ className={`ttdk-alert-title ${
268
+ props.titleClass || ""
269
+ }`.trim()}
270
+ style={{
271
+ ...buildUiVars(props.titleStyle),
272
+ }}
273
+ >
274
+ {props.title}
275
+ </div>
276
+ ) : null}
277
+ {props.description ? (
278
+ <div
279
+ className={`ttdk-alert-description ${
280
+ props.descClass || ""
281
+ }`.trim()}
282
+ style={{
283
+ ...buildUiVars(props.descStyle),
284
+ }}
285
+ >
286
+ {props.description}
287
+ </div>
288
+ ) : null}
289
+ <>{props.children}</>
290
+ </div>
291
+ {props.closable ? (
292
+ <button
293
+ type="button"
294
+ aria-label="Tutup notifikasi"
295
+ className={`ttdk-alert-close-btn ${
296
+ props.closableClass || ""
297
+ }`.trim()}
298
+ style={{
299
+ ...buildUiVars(props.closableStyle),
300
+ }}
301
+ onClick={(event) => handleDismiss(event)}
302
+ >
303
+ <svg viewBox="0 0 24 24" fill="none">
304
+ <line x1="18" y1="6" x2="6" y2="18" />
305
+ <line x1="6" y1="6" x2="18" y2="18" />
306
+ </svg>
307
+ </button>
308
+ ) : null}
309
+ </div>
310
+ </>
311
+ ) : null}
312
+ </>
313
+ );
314
+ }
315
+
316
+ export default Alert;
317
+
318
+ export { Alert };
@@ -0,0 +1,3 @@
1
+ export { default as Alert } from './alert';
2
+ export { default } from './alert';
3
+ export type { AlertProps, AlertUiProps } from './alert'
@@ -0,0 +1,240 @@
1
+ {
2
+ "name": "@ttdk-design-system/alert",
3
+ "component": "Alert",
4
+ "folder": "alert",
5
+ "description": "Komponen Alert untuk menampilkan pesan umpan balik kontekstual statis, instruksi peringatan, atau status penting pada halaman.",
6
+ "stylesheets": [
7
+ {
8
+ "theme": "common",
9
+ "file": "alert.css",
10
+ "importPath": "web/alert/alert.css"
11
+ }
12
+ ],
13
+ "props": {
14
+ "style": {
15
+ "name": "style",
16
+ "type": "any",
17
+ "optional": true,
18
+ "default": null,
19
+ "description": "Inline CSS style kustom.",
20
+ "example": null,
21
+ "param": null
22
+ },
23
+ "title": {
24
+ "name": "title",
25
+ "type": "string",
26
+ "optional": true,
27
+ "default": null,
28
+ "description": "Judul utama alert.",
29
+ "example": null,
30
+ "param": null
31
+ },
32
+ "description": {
33
+ "name": "description",
34
+ "type": "string",
35
+ "optional": true,
36
+ "default": null,
37
+ "description": "Deskripsi atau pesan teks penjelasan alert.",
38
+ "example": null,
39
+ "param": null
40
+ },
41
+ "variant": {
42
+ "name": "variant",
43
+ "type": "| 'neutral'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger'",
44
+ "optional": true,
45
+ "default": "neutral",
46
+ "description": "Varian warna semantik alert: - `'neutral'`: Netral (border hitam/putih, background base). - `'info'`: Biru informasi (#2196F3). - `'success'`: Hijau konfirmasi keberhasilan (#04B761). - `'warning'`: Kuning / amber peringatan (#F88000). - `'danger'`: Merah kesalahan / bahaya (#D0021B).",
47
+ "example": null,
48
+ "param": null
49
+ },
50
+ "appearance": {
51
+ "name": "appearance",
52
+ "type": "'soft' | 'solid' | 'outline' | 'subtle'",
53
+ "optional": true,
54
+ "default": "soft",
55
+ "description": "Gaya tampilan visual alert: - `'soft'`: Latar belakang warna transparan lembut (standar). - `'solid'`: Latar belakang warna solid pekat dengan teks putih. - `'outline'`: Garis tepi dengan latar belakang transparan. - `'subtle'`: Latar belakang abu netral dengan aksen border tipis.",
56
+ "example": null,
57
+ "param": null
58
+ },
59
+ "rounded": {
60
+ "name": "rounded",
61
+ "type": "'none' | 'sm' | 'md' | 'lg' | 'full'",
62
+ "optional": true,
63
+ "default": "md",
64
+ "description": "Sudut kelengkungan alert: - `'none'`: Sudut tajam 0px. - `'sm'`: Radius halus 4px. - `'md'`: Radius sedang 8px (standar). - `'lg'`: Radius melengkung 12px. - `'full'`: Lingkaran penuh 9999px.",
65
+ "example": null,
66
+ "param": null
67
+ },
68
+ "icon": {
69
+ "name": "icon",
70
+ "type": "any",
71
+ "optional": true,
72
+ "default": "true",
73
+ "description": "Ikon SVG kustom yang menggantikan ikon bawaan, atau boolean untuk menampilkan/menyembunyikan ikon.",
74
+ "example": null,
75
+ "param": null
76
+ },
77
+ "iconColor": {
78
+ "name": "iconColor",
79
+ "type": "string",
80
+ "optional": true,
81
+ "default": null,
82
+ "description": "Warna ikon kustom secara langsung.",
83
+ "example": null,
84
+ "param": null
85
+ },
86
+ "iconSize": {
87
+ "name": "iconSize",
88
+ "type": "string",
89
+ "optional": true,
90
+ "default": null,
91
+ "description": "Ukuran ikon kustom secara langsung (misal: '20px', '1.5rem').",
92
+ "example": null,
93
+ "param": null
94
+ },
95
+ "hideIcon": {
96
+ "name": "hideIcon",
97
+ "type": "boolean",
98
+ "optional": true,
99
+ "default": "false",
100
+ "description": "Menyembunyikan ikon pada alert.",
101
+ "example": null,
102
+ "param": null
103
+ },
104
+ "closable": {
105
+ "name": "closable",
106
+ "type": "boolean",
107
+ "optional": true,
108
+ "default": "false",
109
+ "description": "Menampilkan tombol tutup (silang) untuk menutup alert secara interaktif.",
110
+ "example": null,
111
+ "param": null
112
+ },
113
+ "onClose": {
114
+ "name": "onClose",
115
+ "type": "(event: any) => void",
116
+ "optional": true,
117
+ "default": null,
118
+ "description": "Callback saat tombol tutup diklik.",
119
+ "example": null,
120
+ "param": null
121
+ },
122
+ "block": {
123
+ "name": "block",
124
+ "type": "boolean",
125
+ "optional": true,
126
+ "default": "false",
127
+ "description": "Membuat alert memenuhi lebar kontainer (100%).",
128
+ "example": null,
129
+ "param": null
130
+ },
131
+ "titleStyle": {
132
+ "name": "titleStyle",
133
+ "type": "UiProps",
134
+ "optional": true,
135
+ "default": null,
136
+ "description": "Style kustom untuk judul alert (UiProps / style object + pseudo support).",
137
+ "example": null,
138
+ "param": null
139
+ },
140
+ "titleClass": {
141
+ "name": "titleClass",
142
+ "type": "string",
143
+ "optional": true,
144
+ "default": null,
145
+ "description": "Class CSS kustom untuk judul alert.",
146
+ "example": null,
147
+ "param": null
148
+ },
149
+ "descStyle": {
150
+ "name": "descStyle",
151
+ "type": "UiProps",
152
+ "optional": true,
153
+ "default": null,
154
+ "description": "Style kustom untuk deskripsi alert (UiProps / style object + pseudo support).",
155
+ "example": null,
156
+ "param": null
157
+ },
158
+ "descClass": {
159
+ "name": "descClass",
160
+ "type": "string",
161
+ "optional": true,
162
+ "default": null,
163
+ "description": "Class CSS kustom untuk deskripsi alert.",
164
+ "example": null,
165
+ "param": null
166
+ },
167
+ "iconStyle": {
168
+ "name": "iconStyle",
169
+ "type": "UiProps",
170
+ "optional": true,
171
+ "default": null,
172
+ "description": "Style kustom untuk ikon alert (UiProps / style object + pseudo support).",
173
+ "example": null,
174
+ "param": null
175
+ },
176
+ "iconClass": {
177
+ "name": "iconClass",
178
+ "type": "string",
179
+ "optional": true,
180
+ "default": null,
181
+ "description": "Class CSS kustom untuk ikon alert.",
182
+ "example": null,
183
+ "param": null
184
+ },
185
+ "closableStyle": {
186
+ "name": "closableStyle",
187
+ "type": "UiProps",
188
+ "optional": true,
189
+ "default": null,
190
+ "description": "Style kustom untuk tombol tutup alert (UiProps / style object + pseudo support).",
191
+ "example": null,
192
+ "param": null
193
+ },
194
+ "closableClass": {
195
+ "name": "closableClass",
196
+ "type": "string",
197
+ "optional": true,
198
+ "default": null,
199
+ "description": "Class CSS kustom untuk tombol tutup alert.",
200
+ "example": null,
201
+ "param": null
202
+ },
203
+ "ui": {
204
+ "name": "ui",
205
+ "type": "UiProps",
206
+ "optional": true,
207
+ "default": null,
208
+ "description": "Kustomisasi visual granular melalui style-like object (+ support pseudo-class: hover, active).",
209
+ "example": null,
210
+ "param": null
211
+ },
212
+ "className": {
213
+ "name": "className",
214
+ "type": "string",
215
+ "optional": true,
216
+ "default": null,
217
+ "description": "Class CSS kustom.",
218
+ "example": null,
219
+ "param": null
220
+ },
221
+ "children": {
222
+ "name": "children",
223
+ "type": "any",
224
+ "optional": true,
225
+ "default": null,
226
+ "description": "Konten kustom tambahan di dalam alert.",
227
+ "example": null,
228
+ "param": null
229
+ }
230
+ },
231
+ "subInterfaces": {},
232
+ "supportedFrameworks": [
233
+ "react",
234
+ "vue",
235
+ "svelte"
236
+ ],
237
+ "themes": [
238
+ "tw"
239
+ ]
240
+ }
@@ -0,0 +1,118 @@
1
+ # <Avatar /> — TTDK Component Reference
2
+
3
+ Komponen Avatar untuk menampilkan foto profil, inisial nama, atau ikon pengguna.
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/avatar/avatar.css";`
8
+
9
+ ## 2. Subpath Component Import
10
+ ```ts
11
+ // React
12
+ import Avatar from "@ttdk-design-system/library-react/web/avatar";
13
+
14
+ // Vue 3
15
+ import Avatar from "@ttdk-design-system/library-vue/web/avatar";
16
+
17
+ // Svelte
18
+ import Avatar from "@ttdk-design-system/library-svelte/web/avatar";
19
+ ```
20
+
21
+ ## 3. Props & API Reference
22
+
23
+ | Prop | Type | Default | Description |
24
+ | :--- | :--- | :--- | :--- |
25
+ | `src?` | `string` | `-` | URL gambar profil avatar. Jika kosong atau gagal dimuat, tampilan otomatis beralih ke `initials` atau ikon pengguna bawaan. |
26
+ | `alt?` | `string` | `-` | Teks alternatif (alt) untuk elemen gambar avatar. |
27
+ | `initials?` | `string` | `-` | Teks inisial pengguna yang ditampilkan di dalam lingkaran avatar (misal: "NA", "SR"). Ditampilkan apabila `src` tidak tersedia atau gagal dimuat. |
28
+ | `size?` | `'xs' | 'sm' | 'md' | 'lg' | 'xl'` | `md` | Skala ukuran avatar: - `'xs'`: Lingkaran 28px. - `'sm'`: Lingkaran 32px. - `'md'`: Lingkaran 40px (standar). - `'lg'`: Lingkaran 48px. - `'xl'`: Lingkaran 56px. |
29
+ | `variant?` | `'info' | 'primary' | 'success' | 'warning' | 'danger' | 'neutral'` | `info` | Varian warna semantik untuk latar & teks/ikon fallback avatar: - `'info'`: Biru informasi sesuai standar profil (default). - `'primary'`: Brand Teal utama. - `'success'`: Hijau sukses. - `'warning'`: Kuning / amber peringatan. - `'danger'`: Merah bahaya. - `'neutral'`: Abu-abu netral. |
30
+ | `rounded?` | `'none' | 'sm' | 'md' | 'lg' | 'full'` | `full` | Sudut kelengkungan lingkaran avatar: - `'full'`: Lingkaran penuh 9999px (default). - `'lg'`: Radius membulat 12px. - `'md'`: Radius sedang 8px. - `'sm'`: Radius halus 4px. - `'none'`: Persegi tajam 0px. |
31
+ | `status?` | `'online' | 'offline' | 'verified'` | `-` | Indikator status kehadiran atau verifikasi di pojok kanan bawah lingkaran avatar: - `'online'`: Titik hijau status aktif. - `'offline'`: Titik abu-abu status luring. - `'verified'`: Lencana perisai biru terverifikasi. |
32
+ | `icon?` | `any` | `-` | Ikon kustom untuk menggantikan ikon pengguna bawaan saat `src` dan `initials` tidak diisi. |
33
+ | `iconColor?` | `string` | `-` | Warna kustom untuk ikon di dalam avatar. |
34
+ | `interactive?` | `boolean` | `false` | Menjadikan komponen avatar interaktif (memiliki efek hover & fokus keyboard). |
35
+ | `disabled?` | `boolean` | `false` | Menonaktifkan interaksi klik pada avatar. |
36
+ | `onClick?` | `(event?: any) => void` | `-` | Event handler saat komponen avatar diklik. |
37
+ | `onImageError?` | `(event?: any) => void` | `-` | Event handler saat gambar `src` gagal dimuat. |
38
+ | `ui?` | `UiProps` | `-` | Kustomisasi visual granular pada elemen root melalui style-like object (+ support pseudo-class: hover, active). |
39
+ | `style?` | `any` | `-` | Inline CSS style object native pada elemen root. |
40
+ | `imageStyle?` | `UiProps` | `-` | Style kustom untuk elemen gambar `<img>` di dalam avatar (UiProps). |
41
+ | `imageClass?` | `string` | `-` | Class CSS kustom untuk elemen gambar `<img>`. |
42
+ | `className?` | `string` | `-` | Class CSS kustom pada elemen root. |
43
+ | `children?` | `any` | `-` | Slot konten tambahan atau pengganti ikon di dalam avatar. |
44
+
45
+ ## 4. Usage Examples
46
+
47
+ ### React Example
48
+ ```tsx
49
+ import Avatar from "@ttdk-design-system/library-react/web/avatar";
50
+ import "@ttdk-design-system/library-react/web/avatar/avatar.css";
51
+
52
+ export function Example() {
53
+ return (
54
+ <div style={{ display: 'flex', gap: '16px', alignItems: 'center' }}>
55
+ <Avatar
56
+ src="https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=160&h=160&fit=crop&crop=faces"
57
+ alt="Olivia"
58
+ size="md"
59
+ />
60
+ <Avatar
61
+ size="md"
62
+ />
63
+ <Avatar
64
+ initials="NA"
65
+ size="md"
66
+ />
67
+ </div>
68
+ );
69
+ }
70
+ ```
71
+
72
+ ### Vue 3 Example
73
+ ```vue
74
+ <script setup lang="ts">
75
+ import Avatar from "@ttdk-design-system/library-vue/web/avatar";
76
+ import "@ttdk-design-system/library-vue/web/avatar/avatar.css";
77
+ </script>
78
+
79
+ <template>
80
+ <div style="display: flex; gap: 16px; align-items: center;">
81
+ <Avatar
82
+ src="https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=160&h=160&fit=crop&crop=faces"
83
+ alt="Olivia"
84
+ size="md"
85
+ />
86
+ <Avatar
87
+ size="md"
88
+ />
89
+ <Avatar
90
+ initials="NA"
91
+ size="md"
92
+ />
93
+ </div>
94
+ </template>
95
+ ```
96
+
97
+ ### Svelte Example
98
+ ```svelte
99
+ <script lang="ts">
100
+ import Avatar from "@ttdk-design-system/library-svelte/web/avatar";
101
+ import "@ttdk-design-system/library-svelte/web/avatar/avatar.css";
102
+ </script>
103
+
104
+ <div style="display: flex; gap: 16px; align-items: center;">
105
+ <Avatar
106
+ src="https://images.unsplash.com/photo-1534528741775-53994a69daeb?w=160&h=160&fit=crop&crop=faces"
107
+ alt="Olivia"
108
+ size="md"
109
+ />
110
+ <Avatar
111
+ size="md"
112
+ />
113
+ <Avatar
114
+ initials="NA"
115
+ size="md"
116
+ />
117
+ </div>
118
+ ```