@ttdk-design-system/library-react 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.
- package/AI_GUIDE.md +6518 -0
- package/llms.txt +6518 -0
- package/package.json +1098 -4
- package/src/core/index.ts +2 -0
- package/src/core/tailwind-preset.cjs +62 -0
- package/src/core/tailwind-preset.ts +85 -0
- package/src/core/theme/tokens.css +663 -0
- package/src/core/types.ts +836 -0
- package/src/index.ts +17 -0
- package/src/tailwind-preset.cjs +62 -0
- package/src/tailwind-preset.ts +85 -0
- package/src/types.ts +1 -0
- package/src/web/accordion/AI_GUIDE.md +149 -0
- package/src/web/accordion/accordion.css +1 -0
- package/src/web/accordion/accordion.tsx +430 -0
- package/src/web/accordion/index.ts +3 -0
- package/src/web/accordion/manifest.json +351 -0
- package/src/web/alert/AI_GUIDE.md +139 -0
- package/src/web/alert/alert.css +1 -0
- package/src/web/alert/alert.tsx +318 -0
- package/src/web/alert/index.ts +3 -0
- package/src/web/alert/manifest.json +240 -0
- package/src/web/avatar/AI_GUIDE.md +118 -0
- package/src/web/avatar/avatar.css +1 -0
- package/src/web/avatar/avatar.tsx +233 -0
- package/src/web/avatar/index.ts +3 -0
- package/src/web/avatar/manifest.json +195 -0
- package/src/web/badge/AI_GUIDE.md +94 -0
- package/src/web/badge/badge.css +1 -0
- package/src/web/badge/badge.tsx +140 -0
- package/src/web/badge/index.ts +2 -0
- package/src/web/badge/manifest.json +141 -0
- package/src/web/banner/AI_GUIDE.md +130 -0
- package/src/web/banner/banner.css +1 -0
- package/src/web/banner/banner.tsx +334 -0
- package/src/web/banner/index.ts +3 -0
- package/src/web/banner/manifest.json +240 -0
- package/src/web/breadcrumb/AI_GUIDE.md +120 -0
- package/src/web/breadcrumb/breadcrumb.css +1 -0
- package/src/web/breadcrumb/breadcrumb.tsx +306 -0
- package/src/web/breadcrumb/index.ts +3 -0
- package/src/web/breadcrumb/manifest.json +225 -0
- package/src/web/button/AI_GUIDE.md +121 -0
- package/src/web/button/button.css +1 -0
- package/src/web/button/button.tsx +287 -0
- package/src/web/button/index.ts +2 -0
- package/src/web/button/manifest.json +177 -0
- package/src/web/calendar/AI_GUIDE.md +151 -0
- package/src/web/calendar/calendar.css +1 -0
- package/src/web/calendar/calendar.tsx +1611 -0
- package/src/web/calendar/index.ts +3 -0
- package/src/web/calendar/manifest.json +470 -0
- package/src/web/card/AI_GUIDE.md +133 -0
- package/src/web/card/card.css +1 -0
- package/src/web/card/card.tsx +408 -0
- package/src/web/card/index.ts +4 -0
- package/src/web/card/manifest.json +357 -0
- package/src/web/checkbox/AI_GUIDE.md +146 -0
- package/src/web/checkbox/checkbox.css +1 -0
- package/src/web/checkbox/checkbox.tsx +307 -0
- package/src/web/checkbox/index.ts +2 -0
- package/src/web/checkbox/manifest.json +294 -0
- package/src/web/chip/AI_GUIDE.md +186 -0
- package/src/web/chip/chip.css +1 -0
- package/src/web/chip/chip.tsx +230 -0
- package/src/web/chip/index.ts +2 -0
- package/src/web/chip/manifest.json +186 -0
- package/src/web/dropdown/AI_GUIDE.md +167 -0
- package/src/web/dropdown/dropdown.css +1 -0
- package/src/web/dropdown/dropdown.tsx +1274 -0
- package/src/web/dropdown/index.ts +3 -0
- package/src/web/dropdown/manifest.json +576 -0
- package/src/web/flex/AI_GUIDE.md +113 -0
- package/src/web/flex/flex-item.tsx +97 -0
- package/src/web/flex/flex.css +1 -0
- package/src/web/flex/flex.tsx +108 -0
- package/src/web/flex/index.ts +5 -0
- package/src/web/flex/manifest.json +162 -0
- package/src/web/form/index.ts +7 -0
- package/src/web/grid/AI_GUIDE.md +112 -0
- package/src/web/grid/grid-item.tsx +112 -0
- package/src/web/grid/grid.css +1 -0
- package/src/web/grid/grid.tsx +99 -0
- package/src/web/grid/index.ts +5 -0
- package/src/web/grid/manifest.json +153 -0
- package/src/web/index.ts +86 -0
- package/src/web/input/AI_GUIDE.md +159 -0
- package/src/web/input/index.ts +3 -0
- package/src/web/input/input.css +1 -0
- package/src/web/input/input.tsx +537 -0
- package/src/web/input/manifest.json +465 -0
- package/src/web/input-number/AI_GUIDE.md +164 -0
- package/src/web/input-number/index.ts +3 -0
- package/src/web/input-number/input-number.css +1 -0
- package/src/web/input-number/input-number.tsx +1193 -0
- package/src/web/input-number/manifest.json +575 -0
- package/src/web/modal/AI_GUIDE.md +171 -0
- package/src/web/modal/index.ts +3 -0
- package/src/web/modal/manifest.json +375 -0
- package/src/web/modal/modal.css +1 -0
- package/src/web/modal/modal.tsx +571 -0
- package/src/web/pagination/AI_GUIDE.md +148 -0
- package/src/web/pagination/index.ts +21 -0
- package/src/web/pagination/manifest.json +432 -0
- package/src/web/pagination/pagination-content.tsx +45 -0
- package/src/web/pagination/pagination-ellipsis.tsx +54 -0
- package/src/web/pagination/pagination-first.tsx +155 -0
- package/src/web/pagination/pagination-item.tsx +45 -0
- package/src/web/pagination/pagination-last.tsx +155 -0
- package/src/web/pagination/pagination-link.tsx +121 -0
- package/src/web/pagination/pagination-next.tsx +158 -0
- package/src/web/pagination/pagination-previous.tsx +158 -0
- package/src/web/pagination/pagination.css +1 -0
- package/src/web/pagination/pagination.tsx +687 -0
- package/src/web/popover/AI_GUIDE.md +163 -0
- package/src/web/popover/index.ts +3 -0
- package/src/web/popover/manifest.json +396 -0
- package/src/web/popover/popover.css +1 -0
- package/src/web/popover/popover.tsx +702 -0
- package/src/web/radio/AI_GUIDE.md +155 -0
- package/src/web/radio/index.ts +2 -0
- package/src/web/radio/manifest.json +294 -0
- package/src/web/radio/radio.css +1 -0
- package/src/web/radio/radio.tsx +290 -0
- package/src/web/selectbox/AI_GUIDE.md +216 -0
- package/src/web/selectbox/index.ts +3 -0
- package/src/web/selectbox/manifest.json +477 -0
- package/src/web/selectbox/selectbox.css +1 -0
- package/src/web/selectbox/selectbox.tsx +1048 -0
- package/src/web/sonner/AI_GUIDE.md +98 -0
- package/src/web/sonner/index.ts +114 -0
- package/src/web/sonner/manifest.json +132 -0
- package/src/web/sonner/sonner.css +1 -0
- package/src/web/sonner/sonner.tsx +177 -0
- package/src/web/table/AI_GUIDE.md +145 -0
- package/src/web/table/index.ts +35 -0
- package/src/web/table/manifest.json +168 -0
- package/src/web/table/table-body.tsx +45 -0
- package/src/web/table/table-caption.tsx +45 -0
- package/src/web/table/table-cell.tsx +74 -0
- package/src/web/table/table-empty.tsx +108 -0
- package/src/web/table/table-footer.tsx +45 -0
- package/src/web/table/table-head.tsx +80 -0
- package/src/web/table/table-header.tsx +45 -0
- package/src/web/table/table-row.tsx +69 -0
- package/src/web/table/table.css +1 -0
- package/src/web/table/table.tsx +305 -0
- package/src/web/tabs/AI_GUIDE.md +150 -0
- package/src/web/tabs/index.ts +3 -0
- package/src/web/tabs/manifest.json +315 -0
- package/src/web/tabs/tabs.css +1 -0
- package/src/web/tabs/tabs.tsx +332 -0
- package/src/web/text/AI_GUIDE.md +129 -0
- package/src/web/text/index.ts +3 -0
- package/src/web/text/manifest.json +195 -0
- package/src/web/text/text.css +1 -0
- package/src/web/text/text.tsx +689 -0
- package/src/web/textarea/AI_GUIDE.md +141 -0
- package/src/web/textarea/index.ts +3 -0
- package/src/web/textarea/manifest.json +438 -0
- package/src/web/textarea/textarea.css +1 -0
- package/src/web/textarea/textarea.tsx +467 -0
- package/src/web/tooltip/AI_GUIDE.md +110 -0
- package/src/web/tooltip/index.ts +3 -0
- package/src/web/tooltip/manifest.json +222 -0
- package/src/web/tooltip/tooltip.css +1 -0
- package/src/web/tooltip/tooltip.tsx +423 -0
- package/src/webview/bottomsheet/AI_GUIDE.md +141 -0
- package/src/webview/bottomsheet/bottomsheet.css +1 -0
- package/src/webview/bottomsheet/bottomsheet.tsx +603 -0
- package/src/webview/bottomsheet/index.ts +4 -0
- package/src/webview/bottomsheet/manifest.json +377 -0
- package/src/webview/button/AI_GUIDE.md +79 -0
- package/src/webview/button/button-ios.css +1 -0
- package/src/webview/button/button-ios.tsx +138 -0
- package/src/webview/button/button-material.css +1 -0
- package/src/webview/button/button-material.tsx +138 -0
- package/src/webview/button/index.ts +7 -0
- package/src/webview/button/manifest.json +148 -0
- package/src/webview/index.ts +7 -0
- package/tailwind-preset.cjs +62 -0
- package/tailwind-preset.js +62 -0
- package/ttdk-manifest.json +10188 -0
- package/README.md +0 -3
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
|
|
4
|
+
export type CheckboxUiProps = UiProps;
|
|
5
|
+
export interface CheckboxProps {
|
|
6
|
+
/**
|
|
7
|
+
* Status apakah checkbox sedang dalam kondisi terpilih (checked).
|
|
8
|
+
*
|
|
9
|
+
* @default false
|
|
10
|
+
*/
|
|
11
|
+
checked?: boolean;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Status apakah checkbox dalam kondisi parsial / indeterminate (menampilkan tanda strip '-').
|
|
15
|
+
*
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
indeterminate?: boolean;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Teks label utama yang ditampilkan di samping kotak checkbox.
|
|
22
|
+
*/
|
|
23
|
+
label?: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Deskripsi atau teks bantuan yang ditampilkan di bawah label.
|
|
27
|
+
*/
|
|
28
|
+
description?: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Teks bantuan atau keterangan di bawah label (dapat digunakan bergantian dengan description).
|
|
32
|
+
*/
|
|
33
|
+
helperText?: string;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Status error visual atau string pesan error.
|
|
37
|
+
*/
|
|
38
|
+
error?: boolean | string;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Pesan error yang ditampilkan jika validasi form gagal.
|
|
42
|
+
*/
|
|
43
|
+
errorMessage?: string;
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Skala ukuran checkbox:
|
|
47
|
+
* - `'sm'`: Kotak 16px, font 12px.
|
|
48
|
+
* - `'md'`: Kotak 18px, font 14px (standar).
|
|
49
|
+
* - `'lg'`: Kotak 22px, font 16px.
|
|
50
|
+
*
|
|
51
|
+
* @default 'md'
|
|
52
|
+
*/
|
|
53
|
+
size?: "sm" | "md" | "lg";
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Varian warna semantik saat checkbox dicentang:
|
|
57
|
+
* - `'primary'`: Aksen toska aksi (#16b3ac, standar).
|
|
58
|
+
* - `'info'`: Aksen biru informasi (#2196f3).
|
|
59
|
+
* - `'success'`: Warna hijau sukses (#047b5d).
|
|
60
|
+
* - `'warning'`: Warna peringatan kuning/oranye (#fb8c00).
|
|
61
|
+
* - `'danger'`: Warna bahaya merah (#c50a24).
|
|
62
|
+
* - `'neutral'`: Warna abu-abu netral (#4a4f53).
|
|
63
|
+
*
|
|
64
|
+
* @default 'primary'
|
|
65
|
+
*/
|
|
66
|
+
variant?: "primary" | "info" | "success" | "warning" | "danger" | "neutral";
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Sudut kelengkungan kotak checkbox:
|
|
70
|
+
* - `'none'`: Kotak tajam 0px.
|
|
71
|
+
* - `'sm'`: Radius halus 2px.
|
|
72
|
+
* - `'md'`: Radius sedang 4px (standar).
|
|
73
|
+
* - `'full'`: Lingkaran penuh 9999px.
|
|
74
|
+
*
|
|
75
|
+
* @default 'md'
|
|
76
|
+
*/
|
|
77
|
+
rounded?: "none" | "sm" | "md" | "full";
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Menonaktifkan interaksi pada checkbox.
|
|
81
|
+
*
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
disabled?: boolean;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Menandakan bahwa field checkbox wajib diisi (required) pada formulir.
|
|
88
|
+
*
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
required?: boolean;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Name atribut untuk elemen HTML `<input type="checkbox">`.
|
|
95
|
+
*/
|
|
96
|
+
name?: string;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Value atribut untuk elemen HTML input.
|
|
100
|
+
*/
|
|
101
|
+
value?: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Identifier unik elemen checkbox (untuk kaitan dengan label form).
|
|
105
|
+
*/
|
|
106
|
+
id?: string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Kustomisasi visual granular melalui style-like object (+ support pseudo-class: hover, active).
|
|
110
|
+
*/
|
|
111
|
+
ui?: UiProps;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Inline CSS style object native.
|
|
115
|
+
*/
|
|
116
|
+
style?: React.CSSProperties;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* Style kustom untuk kotak kontrol checkbox (UiProps).
|
|
120
|
+
*/
|
|
121
|
+
controlStyle?: UiProps;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Class CSS kustom untuk kotak kontrol checkbox (Tailwind / class kustom).
|
|
125
|
+
*/
|
|
126
|
+
controlClass?: string;
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Style kustom untuk teks label checkbox (UiProps).
|
|
130
|
+
*/
|
|
131
|
+
labelStyle?: UiProps;
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Class CSS kustom untuk teks label checkbox (Tailwind / class kustom).
|
|
135
|
+
*/
|
|
136
|
+
labelClass?: string;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Style kustom untuk teks deskripsi bantuan (UiProps).
|
|
140
|
+
*/
|
|
141
|
+
descStyle?: UiProps;
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Class CSS kustom untuk teks deskripsi bantuan (Tailwind / class kustom).
|
|
145
|
+
*/
|
|
146
|
+
descClass?: string;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Style kustom untuk elemen helper text (UiProps).
|
|
150
|
+
*/
|
|
151
|
+
helperTextStyle?: UiProps;
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Class CSS kustom untuk elemen helper text.
|
|
155
|
+
*/
|
|
156
|
+
helperTextClass?: string;
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Style kustom untuk teks pesan error validasi (UiProps).
|
|
160
|
+
*/
|
|
161
|
+
errorMessageStyle?: UiProps;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Class CSS kustom untuk teks pesan error validasi (Tailwind / class kustom).
|
|
165
|
+
*/
|
|
166
|
+
errorMessageClass?: string;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Event handler yang dipanggil saat nilai checkbox berubah.
|
|
170
|
+
* Mengembalikan `(checked: boolean, event: Event)`.
|
|
171
|
+
*/
|
|
172
|
+
onChange?: (checked: boolean, event?: any) => void;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Class CSS kustom.
|
|
176
|
+
*/
|
|
177
|
+
className?: string;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Slot konten label kustom yang menggantikan prop `label`.
|
|
181
|
+
*/
|
|
182
|
+
children?: any;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
import { buildUiVars, UiProps } from "../../core/types";
|
|
186
|
+
|
|
187
|
+
function Checkbox(props: CheckboxProps) {
|
|
188
|
+
return (
|
|
189
|
+
<label
|
|
190
|
+
className={`ttdk-checkbox-wrapper ttdk-checkbox-root ${
|
|
191
|
+
props.className || ""
|
|
192
|
+
}`.trim()}
|
|
193
|
+
data-size={props.size || "md"}
|
|
194
|
+
data-variant={props.variant || "primary"}
|
|
195
|
+
data-rounded={props.rounded || "md"}
|
|
196
|
+
data-disabled={props.disabled ? "true" : "false"}
|
|
197
|
+
data-checked={props.checked ? "true" : "false"}
|
|
198
|
+
data-state={
|
|
199
|
+
props.indeterminate
|
|
200
|
+
? "indeterminate"
|
|
201
|
+
: props.checked
|
|
202
|
+
? "checked"
|
|
203
|
+
: "unchecked"
|
|
204
|
+
}
|
|
205
|
+
data-indeterminate={props.indeterminate ? "true" : "false"}
|
|
206
|
+
data-error={Boolean(props.errorMessage || props.error) ? "true" : "false"}
|
|
207
|
+
data-has-description={
|
|
208
|
+
Boolean(props.description || props.helperText) ? "true" : "false"
|
|
209
|
+
}
|
|
210
|
+
style={{
|
|
211
|
+
...buildUiVars(props.ui),
|
|
212
|
+
...((props as any)["style"] || {}),
|
|
213
|
+
...props.style,
|
|
214
|
+
}}
|
|
215
|
+
>
|
|
216
|
+
<input
|
|
217
|
+
type="checkbox"
|
|
218
|
+
className="ttdk-checkbox-native ttdk-checkbox-input"
|
|
219
|
+
id={props.id}
|
|
220
|
+
name={props.name}
|
|
221
|
+
value={props.value}
|
|
222
|
+
checked={props.checked}
|
|
223
|
+
disabled={props.disabled}
|
|
224
|
+
required={props.required}
|
|
225
|
+
onChange={(event) => {
|
|
226
|
+
props.onChange?.(event.target.checked, event);
|
|
227
|
+
}}
|
|
228
|
+
/>
|
|
229
|
+
<span
|
|
230
|
+
className={`ttdk-checkbox-control ${props.controlClass || ""}`.trim()}
|
|
231
|
+
style={{
|
|
232
|
+
...buildUiVars(props.controlStyle),
|
|
233
|
+
}}
|
|
234
|
+
>
|
|
235
|
+
{props.indeterminate ? (
|
|
236
|
+
<svg className="ttdk-checkbox-icon" viewBox="0 0 24 24">
|
|
237
|
+
<line x1="5" y1="12" x2="19" y2="12" />
|
|
238
|
+
</svg>
|
|
239
|
+
) : null}
|
|
240
|
+
{!props.indeterminate && props.checked ? (
|
|
241
|
+
<svg className="ttdk-checkbox-icon" viewBox="0 0 24 24">
|
|
242
|
+
<polyline points="20 6 9 17 4 12" />
|
|
243
|
+
</svg>
|
|
244
|
+
) : null}
|
|
245
|
+
</span>
|
|
246
|
+
{props.label ||
|
|
247
|
+
props.description ||
|
|
248
|
+
props.helperText ||
|
|
249
|
+
props.children ||
|
|
250
|
+
props.errorMessage ||
|
|
251
|
+
(typeof props.error === "string" && props.error) ? (
|
|
252
|
+
<div className="ttdk-checkbox-label-wrapper">
|
|
253
|
+
{props.label || props.children ? (
|
|
254
|
+
<span
|
|
255
|
+
className={`ttdk-checkbox-label ${props.labelClass || ""}`.trim()}
|
|
256
|
+
style={{
|
|
257
|
+
...buildUiVars(props.labelStyle),
|
|
258
|
+
}}
|
|
259
|
+
>
|
|
260
|
+
{props.label}
|
|
261
|
+
<>{props.children}</>
|
|
262
|
+
</span>
|
|
263
|
+
) : null}
|
|
264
|
+
{props.helperText || props.description ? (
|
|
265
|
+
<span
|
|
266
|
+
className={`ttdk-checkbox-desc ttdk-checkbox-helper-text ${
|
|
267
|
+
props.helperTextClass || props.descClass || ""
|
|
268
|
+
}`.trim()}
|
|
269
|
+
style={{
|
|
270
|
+
...buildUiVars(props.helperTextStyle || props.descStyle),
|
|
271
|
+
}}
|
|
272
|
+
onClick={(e) => {
|
|
273
|
+
e.preventDefault();
|
|
274
|
+
e.stopPropagation();
|
|
275
|
+
}}
|
|
276
|
+
>
|
|
277
|
+
{props.helperText || props.description}
|
|
278
|
+
</span>
|
|
279
|
+
) : null}
|
|
280
|
+
{props.errorMessage ||
|
|
281
|
+
(typeof props.error === "string" && props.error) ? (
|
|
282
|
+
<span
|
|
283
|
+
role="alert"
|
|
284
|
+
className={`ttdk-checkbox-error-msg ${
|
|
285
|
+
props.errorMessageClass || ""
|
|
286
|
+
}`.trim()}
|
|
287
|
+
style={{
|
|
288
|
+
...buildUiVars(props.errorMessageStyle),
|
|
289
|
+
}}
|
|
290
|
+
onClick={(e) => {
|
|
291
|
+
e.preventDefault();
|
|
292
|
+
e.stopPropagation();
|
|
293
|
+
}}
|
|
294
|
+
>
|
|
295
|
+
{props.errorMessage ||
|
|
296
|
+
(typeof props.error === "string" ? props.error : "")}
|
|
297
|
+
</span>
|
|
298
|
+
) : null}
|
|
299
|
+
</div>
|
|
300
|
+
) : null}
|
|
301
|
+
</label>
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export default Checkbox;
|
|
306
|
+
|
|
307
|
+
export { Checkbox };
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ttdk-design-system/checkbox",
|
|
3
|
+
"component": "Checkbox",
|
|
4
|
+
"folder": "checkbox",
|
|
5
|
+
"description": "TTDK Checkbox component with multi-theme support.",
|
|
6
|
+
"stylesheets": [
|
|
7
|
+
{
|
|
8
|
+
"theme": "common",
|
|
9
|
+
"file": "checkbox.css",
|
|
10
|
+
"importPath": "web/checkbox/checkbox.css"
|
|
11
|
+
}
|
|
12
|
+
],
|
|
13
|
+
"props": {
|
|
14
|
+
"checked": {
|
|
15
|
+
"name": "checked",
|
|
16
|
+
"type": "boolean",
|
|
17
|
+
"optional": true,
|
|
18
|
+
"default": "false",
|
|
19
|
+
"description": "Status apakah checkbox sedang dalam kondisi terpilih (checked).",
|
|
20
|
+
"example": null,
|
|
21
|
+
"param": null
|
|
22
|
+
},
|
|
23
|
+
"indeterminate": {
|
|
24
|
+
"name": "indeterminate",
|
|
25
|
+
"type": "boolean",
|
|
26
|
+
"optional": true,
|
|
27
|
+
"default": "false",
|
|
28
|
+
"description": "Status apakah checkbox dalam kondisi parsial / indeterminate (menampilkan tanda strip '-').",
|
|
29
|
+
"example": null,
|
|
30
|
+
"param": null
|
|
31
|
+
},
|
|
32
|
+
"label": {
|
|
33
|
+
"name": "label",
|
|
34
|
+
"type": "string",
|
|
35
|
+
"optional": true,
|
|
36
|
+
"default": null,
|
|
37
|
+
"description": "Teks label utama yang ditampilkan di samping kotak checkbox.",
|
|
38
|
+
"example": null,
|
|
39
|
+
"param": null
|
|
40
|
+
},
|
|
41
|
+
"description": {
|
|
42
|
+
"name": "description",
|
|
43
|
+
"type": "string",
|
|
44
|
+
"optional": true,
|
|
45
|
+
"default": null,
|
|
46
|
+
"description": "Deskripsi atau teks bantuan yang ditampilkan di bawah label.",
|
|
47
|
+
"example": null,
|
|
48
|
+
"param": null
|
|
49
|
+
},
|
|
50
|
+
"helperText": {
|
|
51
|
+
"name": "helperText",
|
|
52
|
+
"type": "string",
|
|
53
|
+
"optional": true,
|
|
54
|
+
"default": null,
|
|
55
|
+
"description": "Teks bantuan atau keterangan di bawah label (dapat digunakan bergantian dengan description).",
|
|
56
|
+
"example": null,
|
|
57
|
+
"param": null
|
|
58
|
+
},
|
|
59
|
+
"error": {
|
|
60
|
+
"name": "error",
|
|
61
|
+
"type": "boolean | string",
|
|
62
|
+
"optional": true,
|
|
63
|
+
"default": null,
|
|
64
|
+
"description": "Status error visual atau string pesan error.",
|
|
65
|
+
"example": null,
|
|
66
|
+
"param": null
|
|
67
|
+
},
|
|
68
|
+
"errorMessage": {
|
|
69
|
+
"name": "errorMessage",
|
|
70
|
+
"type": "string",
|
|
71
|
+
"optional": true,
|
|
72
|
+
"default": null,
|
|
73
|
+
"description": "Pesan error yang ditampilkan jika validasi form gagal.",
|
|
74
|
+
"example": null,
|
|
75
|
+
"param": null
|
|
76
|
+
},
|
|
77
|
+
"size": {
|
|
78
|
+
"name": "size",
|
|
79
|
+
"type": "'sm' | 'md' | 'lg'",
|
|
80
|
+
"optional": true,
|
|
81
|
+
"default": "md",
|
|
82
|
+
"description": "Skala ukuran checkbox: - `'sm'`: Kotak 16px, font 12px. - `'md'`: Kotak 18px, font 14px (standar). - `'lg'`: Kotak 22px, font 16px.",
|
|
83
|
+
"example": null,
|
|
84
|
+
"param": null
|
|
85
|
+
},
|
|
86
|
+
"variant": {
|
|
87
|
+
"name": "variant",
|
|
88
|
+
"type": "'primary' | 'info' | 'success' | 'warning' | 'danger' | 'neutral'",
|
|
89
|
+
"optional": true,
|
|
90
|
+
"default": "primary",
|
|
91
|
+
"description": "Varian warna semantik saat checkbox dicentang: - `'primary'`: Aksen toska aksi (#16b3ac, standar). - `'info'`: Aksen biru informasi (#2196f3). - `'success'`: Warna hijau sukses (#047b5d). - `'warning'`: Warna peringatan kuning/oranye (#fb8c00). - `'danger'`: Warna bahaya merah (#c50a24). - `'neutral'`: Warna abu-abu netral (#4a4f53).",
|
|
92
|
+
"example": null,
|
|
93
|
+
"param": null
|
|
94
|
+
},
|
|
95
|
+
"rounded": {
|
|
96
|
+
"name": "rounded",
|
|
97
|
+
"type": "'none' | 'sm' | 'md' | 'full'",
|
|
98
|
+
"optional": true,
|
|
99
|
+
"default": "md",
|
|
100
|
+
"description": "Sudut kelengkungan kotak checkbox: - `'none'`: Kotak tajam 0px. - `'sm'`: Radius halus 2px. - `'md'`: Radius sedang 4px (standar). - `'full'`: Lingkaran penuh 9999px.",
|
|
101
|
+
"example": null,
|
|
102
|
+
"param": null
|
|
103
|
+
},
|
|
104
|
+
"disabled": {
|
|
105
|
+
"name": "disabled",
|
|
106
|
+
"type": "boolean",
|
|
107
|
+
"optional": true,
|
|
108
|
+
"default": "false",
|
|
109
|
+
"description": "Menonaktifkan interaksi pada checkbox.",
|
|
110
|
+
"example": null,
|
|
111
|
+
"param": null
|
|
112
|
+
},
|
|
113
|
+
"required": {
|
|
114
|
+
"name": "required",
|
|
115
|
+
"type": "boolean",
|
|
116
|
+
"optional": true,
|
|
117
|
+
"default": "false",
|
|
118
|
+
"description": "Menandakan bahwa field checkbox wajib diisi (required) pada formulir.",
|
|
119
|
+
"example": null,
|
|
120
|
+
"param": null
|
|
121
|
+
},
|
|
122
|
+
"name": {
|
|
123
|
+
"name": "name",
|
|
124
|
+
"type": "string",
|
|
125
|
+
"optional": true,
|
|
126
|
+
"default": null,
|
|
127
|
+
"description": "Name atribut untuk elemen HTML `<input type=\"checkbox\">`.",
|
|
128
|
+
"example": null,
|
|
129
|
+
"param": null
|
|
130
|
+
},
|
|
131
|
+
"value": {
|
|
132
|
+
"name": "value",
|
|
133
|
+
"type": "string",
|
|
134
|
+
"optional": true,
|
|
135
|
+
"default": null,
|
|
136
|
+
"description": "Value atribut untuk elemen HTML input.",
|
|
137
|
+
"example": null,
|
|
138
|
+
"param": null
|
|
139
|
+
},
|
|
140
|
+
"id": {
|
|
141
|
+
"name": "id",
|
|
142
|
+
"type": "string",
|
|
143
|
+
"optional": true,
|
|
144
|
+
"default": null,
|
|
145
|
+
"description": "Identifier unik elemen checkbox (untuk kaitan dengan label form).",
|
|
146
|
+
"example": null,
|
|
147
|
+
"param": null
|
|
148
|
+
},
|
|
149
|
+
"ui": {
|
|
150
|
+
"name": "ui",
|
|
151
|
+
"type": "UiProps",
|
|
152
|
+
"optional": true,
|
|
153
|
+
"default": null,
|
|
154
|
+
"description": "Kustomisasi visual granular melalui style-like object (+ support pseudo-class: hover, active).",
|
|
155
|
+
"example": null,
|
|
156
|
+
"param": null
|
|
157
|
+
},
|
|
158
|
+
"style": {
|
|
159
|
+
"name": "style",
|
|
160
|
+
"type": "any",
|
|
161
|
+
"optional": true,
|
|
162
|
+
"default": null,
|
|
163
|
+
"description": "Inline CSS style object native.",
|
|
164
|
+
"example": null,
|
|
165
|
+
"param": null
|
|
166
|
+
},
|
|
167
|
+
"controlStyle": {
|
|
168
|
+
"name": "controlStyle",
|
|
169
|
+
"type": "UiProps",
|
|
170
|
+
"optional": true,
|
|
171
|
+
"default": null,
|
|
172
|
+
"description": "Style kustom untuk kotak kontrol checkbox (UiProps).",
|
|
173
|
+
"example": null,
|
|
174
|
+
"param": null
|
|
175
|
+
},
|
|
176
|
+
"controlClass": {
|
|
177
|
+
"name": "controlClass",
|
|
178
|
+
"type": "string",
|
|
179
|
+
"optional": true,
|
|
180
|
+
"default": null,
|
|
181
|
+
"description": "Class CSS kustom untuk kotak kontrol checkbox (Tailwind / class kustom).",
|
|
182
|
+
"example": null,
|
|
183
|
+
"param": null
|
|
184
|
+
},
|
|
185
|
+
"labelStyle": {
|
|
186
|
+
"name": "labelStyle",
|
|
187
|
+
"type": "UiProps",
|
|
188
|
+
"optional": true,
|
|
189
|
+
"default": null,
|
|
190
|
+
"description": "Style kustom untuk teks label checkbox (UiProps).",
|
|
191
|
+
"example": null,
|
|
192
|
+
"param": null
|
|
193
|
+
},
|
|
194
|
+
"labelClass": {
|
|
195
|
+
"name": "labelClass",
|
|
196
|
+
"type": "string",
|
|
197
|
+
"optional": true,
|
|
198
|
+
"default": null,
|
|
199
|
+
"description": "Class CSS kustom untuk teks label checkbox (Tailwind / class kustom).",
|
|
200
|
+
"example": null,
|
|
201
|
+
"param": null
|
|
202
|
+
},
|
|
203
|
+
"descStyle": {
|
|
204
|
+
"name": "descStyle",
|
|
205
|
+
"type": "UiProps",
|
|
206
|
+
"optional": true,
|
|
207
|
+
"default": null,
|
|
208
|
+
"description": "Style kustom untuk teks deskripsi bantuan (UiProps).",
|
|
209
|
+
"example": null,
|
|
210
|
+
"param": null
|
|
211
|
+
},
|
|
212
|
+
"descClass": {
|
|
213
|
+
"name": "descClass",
|
|
214
|
+
"type": "string",
|
|
215
|
+
"optional": true,
|
|
216
|
+
"default": null,
|
|
217
|
+
"description": "Class CSS kustom untuk teks deskripsi bantuan (Tailwind / class kustom).",
|
|
218
|
+
"example": null,
|
|
219
|
+
"param": null
|
|
220
|
+
},
|
|
221
|
+
"helperTextStyle": {
|
|
222
|
+
"name": "helperTextStyle",
|
|
223
|
+
"type": "UiProps",
|
|
224
|
+
"optional": true,
|
|
225
|
+
"default": null,
|
|
226
|
+
"description": "Style kustom untuk elemen helper text (UiProps).",
|
|
227
|
+
"example": null,
|
|
228
|
+
"param": null
|
|
229
|
+
},
|
|
230
|
+
"helperTextClass": {
|
|
231
|
+
"name": "helperTextClass",
|
|
232
|
+
"type": "string",
|
|
233
|
+
"optional": true,
|
|
234
|
+
"default": null,
|
|
235
|
+
"description": "Class CSS kustom untuk elemen helper text.",
|
|
236
|
+
"example": null,
|
|
237
|
+
"param": null
|
|
238
|
+
},
|
|
239
|
+
"errorMessageStyle": {
|
|
240
|
+
"name": "errorMessageStyle",
|
|
241
|
+
"type": "UiProps",
|
|
242
|
+
"optional": true,
|
|
243
|
+
"default": null,
|
|
244
|
+
"description": "Style kustom untuk teks pesan error validasi (UiProps).",
|
|
245
|
+
"example": null,
|
|
246
|
+
"param": null
|
|
247
|
+
},
|
|
248
|
+
"errorMessageClass": {
|
|
249
|
+
"name": "errorMessageClass",
|
|
250
|
+
"type": "string",
|
|
251
|
+
"optional": true,
|
|
252
|
+
"default": null,
|
|
253
|
+
"description": "Class CSS kustom untuk teks pesan error validasi (Tailwind / class kustom).",
|
|
254
|
+
"example": null,
|
|
255
|
+
"param": null
|
|
256
|
+
},
|
|
257
|
+
"onChange": {
|
|
258
|
+
"name": "onChange",
|
|
259
|
+
"type": "(checked: boolean, event?: any) => void",
|
|
260
|
+
"optional": true,
|
|
261
|
+
"default": null,
|
|
262
|
+
"description": "Event handler yang dipanggil saat nilai checkbox berubah. Mengembalikan `(checked: boolean, event: Event)`.",
|
|
263
|
+
"example": null,
|
|
264
|
+
"param": null
|
|
265
|
+
},
|
|
266
|
+
"className": {
|
|
267
|
+
"name": "className",
|
|
268
|
+
"type": "string",
|
|
269
|
+
"optional": true,
|
|
270
|
+
"default": null,
|
|
271
|
+
"description": "Class CSS kustom.",
|
|
272
|
+
"example": null,
|
|
273
|
+
"param": null
|
|
274
|
+
},
|
|
275
|
+
"children": {
|
|
276
|
+
"name": "children",
|
|
277
|
+
"type": "any",
|
|
278
|
+
"optional": true,
|
|
279
|
+
"default": null,
|
|
280
|
+
"description": "Slot konten label kustom yang menggantikan prop `label`.",
|
|
281
|
+
"example": null,
|
|
282
|
+
"param": null
|
|
283
|
+
}
|
|
284
|
+
},
|
|
285
|
+
"subInterfaces": {},
|
|
286
|
+
"supportedFrameworks": [
|
|
287
|
+
"react",
|
|
288
|
+
"vue",
|
|
289
|
+
"svelte"
|
|
290
|
+
],
|
|
291
|
+
"themes": [
|
|
292
|
+
"tw"
|
|
293
|
+
]
|
|
294
|
+
}
|