@ttdk-design-system/library-svelte 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/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +2 -0
- package/dist/core/tailwind-preset.cjs +62 -0
- package/dist/core/tailwind-preset.d.cts +63 -0
- package/dist/core/tailwind-preset.d.ts +74 -0
- package/dist/core/tailwind-preset.js +79 -0
- package/dist/core/theme/tokens.css +663 -0
- package/dist/core/types.d.ts +152 -0
- package/dist/core/types.js +735 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +15 -0
- package/dist/tailwind-preset.cjs +62 -0
- package/dist/tailwind-preset.d.cts +63 -0
- package/dist/tailwind-preset.d.ts +74 -0
- package/dist/tailwind-preset.js +79 -0
- package/dist/types.d.ts +1 -0
- package/dist/types.js +1 -0
- package/dist/web/accordion/AI_GUIDE.md +149 -0
- package/dist/web/accordion/accordion.css +1 -0
- package/dist/web/accordion/accordion.svelte +217 -0
- package/dist/web/accordion/accordion.svelte.d.ts +224 -0
- package/dist/web/accordion/index.d.ts +2 -0
- package/dist/web/accordion/index.js +2 -0
- package/dist/web/accordion/manifest.json +351 -0
- package/dist/web/alert/AI_GUIDE.md +139 -0
- package/dist/web/alert/alert.css +1 -0
- package/dist/web/alert/alert.svelte +175 -0
- package/dist/web/alert/alert.svelte.d.ts +165 -0
- package/dist/web/alert/index.d.ts +2 -0
- package/dist/web/alert/index.js +2 -0
- package/dist/web/alert/manifest.json +240 -0
- package/dist/web/avatar/AI_GUIDE.md +118 -0
- package/dist/web/avatar/avatar.css +1 -0
- package/dist/web/avatar/avatar.svelte +108 -0
- package/dist/web/avatar/avatar.svelte.d.ts +147 -0
- package/dist/web/avatar/index.d.ts +2 -0
- package/dist/web/avatar/index.js +2 -0
- package/dist/web/avatar/manifest.json +195 -0
- package/dist/web/badge/AI_GUIDE.md +94 -0
- package/dist/web/badge/badge.css +1 -0
- package/dist/web/badge/badge.svelte +50 -0
- package/dist/web/badge/badge.svelte.d.ts +111 -0
- package/dist/web/badge/index.d.ts +2 -0
- package/dist/web/badge/index.js +2 -0
- package/dist/web/badge/manifest.json +141 -0
- package/dist/web/banner/AI_GUIDE.md +130 -0
- package/dist/web/banner/banner.css +1 -0
- package/dist/web/banner/banner.svelte +180 -0
- package/dist/web/banner/banner.svelte.d.ts +172 -0
- package/dist/web/banner/index.d.ts +2 -0
- package/dist/web/banner/index.js +2 -0
- package/dist/web/banner/manifest.json +240 -0
- package/dist/web/breadcrumb/AI_GUIDE.md +120 -0
- package/dist/web/breadcrumb/breadcrumb.css +1 -0
- package/dist/web/breadcrumb/breadcrumb.svelte +168 -0
- package/dist/web/breadcrumb/breadcrumb.svelte.d.ts +141 -0
- package/dist/web/breadcrumb/index.d.ts +2 -0
- package/dist/web/breadcrumb/index.js +2 -0
- package/dist/web/breadcrumb/manifest.json +225 -0
- package/dist/web/button/AI_GUIDE.md +121 -0
- package/dist/web/button/button.css +1 -0
- package/dist/web/button/button.svelte +154 -0
- package/dist/web/button/button.svelte.d.ts +159 -0
- package/dist/web/button/index.d.ts +2 -0
- package/dist/web/button/index.js +2 -0
- package/dist/web/button/manifest.json +177 -0
- package/dist/web/calendar/AI_GUIDE.md +151 -0
- package/dist/web/calendar/calendar.css +1 -0
- package/dist/web/calendar/calendar.svelte +1091 -0
- package/dist/web/calendar/calendar.svelte.d.ts +268 -0
- package/dist/web/calendar/index.d.ts +2 -0
- package/dist/web/calendar/index.js +2 -0
- package/dist/web/calendar/manifest.json +470 -0
- package/dist/web/card/AI_GUIDE.md +133 -0
- package/dist/web/card/card.css +1 -0
- package/dist/web/card/card.svelte +217 -0
- package/dist/web/card/card.svelte.d.ts +242 -0
- package/dist/web/card/index.d.ts +2 -0
- package/dist/web/card/index.js +2 -0
- package/dist/web/card/manifest.json +357 -0
- package/dist/web/checkbox/AI_GUIDE.md +146 -0
- package/dist/web/checkbox/checkbox.css +1 -0
- package/dist/web/checkbox/checkbox.svelte +131 -0
- package/dist/web/checkbox/checkbox.svelte.d.ts +199 -0
- package/dist/web/checkbox/index.d.ts +2 -0
- package/dist/web/checkbox/index.js +2 -0
- package/dist/web/checkbox/manifest.json +294 -0
- package/dist/web/chip/AI_GUIDE.md +186 -0
- package/dist/web/chip/chip.css +1 -0
- package/dist/web/chip/chip.svelte +113 -0
- package/dist/web/chip/chip.svelte.d.ts +145 -0
- package/dist/web/chip/index.d.ts +2 -0
- package/dist/web/chip/index.js +2 -0
- package/dist/web/chip/manifest.json +186 -0
- package/dist/web/dropdown/AI_GUIDE.md +167 -0
- package/dist/web/dropdown/dropdown.css +1 -0
- package/dist/web/dropdown/dropdown.svelte +844 -0
- package/dist/web/dropdown/dropdown.svelte.d.ts +361 -0
- package/dist/web/dropdown/index.d.ts +2 -0
- package/dist/web/dropdown/index.js +2 -0
- package/dist/web/dropdown/manifest.json +576 -0
- package/dist/web/flex/AI_GUIDE.md +113 -0
- package/dist/web/flex/flex-item.svelte +37 -0
- package/dist/web/flex/flex-item.svelte.d.ts +96 -0
- package/dist/web/flex/flex.css +1 -0
- package/dist/web/flex/flex.svelte +39 -0
- package/dist/web/flex/flex.svelte.d.ts +104 -0
- package/dist/web/flex/index.d.ts +3 -0
- package/dist/web/flex/index.js +3 -0
- package/dist/web/flex/manifest.json +162 -0
- package/dist/web/form/index.d.ts +1 -0
- package/dist/web/form/index.js +2 -0
- package/dist/web/grid/AI_GUIDE.md +112 -0
- package/dist/web/grid/grid-item.svelte +41 -0
- package/dist/web/grid/grid-item.svelte.d.ts +112 -0
- package/dist/web/grid/grid.css +1 -0
- package/dist/web/grid/grid.svelte +37 -0
- package/dist/web/grid/grid.svelte.d.ts +96 -0
- package/dist/web/grid/index.d.ts +3 -0
- package/dist/web/grid/index.js +3 -0
- package/dist/web/grid/manifest.json +153 -0
- package/dist/web/index.d.ts +58 -0
- package/dist/web/index.js +57 -0
- package/dist/web/input/AI_GUIDE.md +159 -0
- package/dist/web/input/index.d.ts +2 -0
- package/dist/web/input/index.js +2 -0
- package/dist/web/input/input.css +1 -0
- package/dist/web/input/input.svelte +283 -0
- package/dist/web/input/input.svelte.d.ts +283 -0
- package/dist/web/input/manifest.json +465 -0
- package/dist/web/input-number/AI_GUIDE.md +164 -0
- package/dist/web/input-number/index.d.ts +2 -0
- package/dist/web/input-number/index.js +2 -0
- package/dist/web/input-number/input-number.css +1 -0
- package/dist/web/input-number/input-number.svelte +783 -0
- package/dist/web/input-number/input-number.svelte.d.ts +352 -0
- package/dist/web/input-number/manifest.json +575 -0
- package/dist/web/modal/AI_GUIDE.md +171 -0
- package/dist/web/modal/index.d.ts +2 -0
- package/dist/web/modal/index.js +2 -0
- package/dist/web/modal/manifest.json +375 -0
- package/dist/web/modal/modal.css +1 -0
- package/dist/web/modal/modal.svelte +333 -0
- package/dist/web/modal/modal.svelte.d.ts +231 -0
- package/dist/web/pagination/AI_GUIDE.md +148 -0
- package/dist/web/pagination/index.d.ts +19 -0
- package/dist/web/pagination/index.js +19 -0
- package/dist/web/pagination/manifest.json +432 -0
- package/dist/web/pagination/pagination-content.svelte +25 -0
- package/dist/web/pagination/pagination-content.svelte.d.ts +36 -0
- package/dist/web/pagination/pagination-ellipsis.svelte +38 -0
- package/dist/web/pagination/pagination-ellipsis.svelte.d.ts +35 -0
- package/dist/web/pagination/pagination-first.svelte +105 -0
- package/dist/web/pagination/pagination-first.svelte.d.ts +74 -0
- package/dist/web/pagination/pagination-item.svelte +25 -0
- package/dist/web/pagination/pagination-item.svelte.d.ts +36 -0
- package/dist/web/pagination/pagination-last.svelte +105 -0
- package/dist/web/pagination/pagination-last.svelte.d.ts +74 -0
- package/dist/web/pagination/pagination-link.svelte +67 -0
- package/dist/web/pagination/pagination-link.svelte.d.ts +69 -0
- package/dist/web/pagination/pagination-next.svelte +99 -0
- package/dist/web/pagination/pagination-next.svelte.d.ts +75 -0
- package/dist/web/pagination/pagination-previous.svelte +99 -0
- package/dist/web/pagination/pagination-previous.svelte.d.ts +75 -0
- package/dist/web/pagination/pagination.css +1 -0
- package/dist/web/pagination/pagination.svelte +471 -0
- package/dist/web/pagination/pagination.svelte.d.ts +256 -0
- package/dist/web/popover/AI_GUIDE.md +163 -0
- package/dist/web/popover/index.d.ts +3 -0
- package/dist/web/popover/index.js +3 -0
- package/dist/web/popover/manifest.json +396 -0
- package/dist/web/popover/popover.css +1 -0
- package/dist/web/popover/popover.svelte +497 -0
- package/dist/web/popover/popover.svelte.d.ts +116 -0
- package/dist/web/radio/AI_GUIDE.md +155 -0
- package/dist/web/radio/index.d.ts +2 -0
- package/dist/web/radio/index.js +2 -0
- package/dist/web/radio/manifest.json +294 -0
- package/dist/web/radio/radio.css +1 -0
- package/dist/web/radio/radio.svelte +123 -0
- package/dist/web/radio/radio.svelte.d.ts +192 -0
- package/dist/web/selectbox/AI_GUIDE.md +216 -0
- package/dist/web/selectbox/index.d.ts +2 -0
- package/dist/web/selectbox/index.js +2 -0
- package/dist/web/selectbox/manifest.json +477 -0
- package/dist/web/selectbox/selectbox.css +1 -0
- package/dist/web/selectbox/selectbox.svelte +704 -0
- package/dist/web/selectbox/selectbox.svelte.d.ts +296 -0
- package/dist/web/sonner/AI_GUIDE.md +98 -0
- package/dist/web/sonner/index.d.ts +46 -0
- package/dist/web/sonner/index.js +64 -0
- package/dist/web/sonner/manifest.json +132 -0
- package/dist/web/sonner/sonner.css +1 -0
- package/dist/web/sonner/sonner.svelte +85 -0
- package/dist/web/sonner/sonner.svelte.d.ts +105 -0
- package/dist/web/table/AI_GUIDE.md +145 -0
- package/dist/web/table/index.d.ts +21 -0
- package/dist/web/table/index.js +22 -0
- package/dist/web/table/manifest.json +168 -0
- package/dist/web/table/table-body.svelte +23 -0
- package/dist/web/table/table-body.svelte.d.ts +36 -0
- package/dist/web/table/table-caption.svelte +23 -0
- package/dist/web/table/table-caption.svelte.d.ts +36 -0
- package/dist/web/table/table-cell.svelte +35 -0
- package/dist/web/table/table-cell.svelte.d.ts +57 -0
- package/dist/web/table/table-empty.svelte +56 -0
- package/dist/web/table/table-empty.svelte.d.ts +65 -0
- package/dist/web/table/table-footer.svelte +23 -0
- package/dist/web/table/table-footer.svelte.d.ts +36 -0
- package/dist/web/table/table-head.svelte +39 -0
- package/dist/web/table/table-head.svelte.d.ts +58 -0
- package/dist/web/table/table-header.svelte +23 -0
- package/dist/web/table/table-header.svelte.d.ts +36 -0
- package/dist/web/table/table-row.svelte +33 -0
- package/dist/web/table/table-row.svelte.d.ts +52 -0
- package/dist/web/table/table.css +1 -0
- package/dist/web/table/table.svelte +178 -0
- package/dist/web/table/table.svelte.d.ts +120 -0
- package/dist/web/tabs/AI_GUIDE.md +150 -0
- package/dist/web/tabs/index.d.ts +2 -0
- package/dist/web/tabs/index.js +2 -0
- package/dist/web/tabs/manifest.json +315 -0
- package/dist/web/tabs/tabs.css +1 -0
- package/dist/web/tabs/tabs.svelte +138 -0
- package/dist/web/tabs/tabs.svelte.d.ts +204 -0
- package/dist/web/text/AI_GUIDE.md +129 -0
- package/dist/web/text/index.d.ts +2 -0
- package/dist/web/text/index.js +2 -0
- package/dist/web/text/manifest.json +195 -0
- package/dist/web/text/text.css +1 -0
- package/dist/web/text/text.svelte +515 -0
- package/dist/web/text/text.svelte.d.ts +168 -0
- package/dist/web/textarea/AI_GUIDE.md +141 -0
- package/dist/web/textarea/index.d.ts +2 -0
- package/dist/web/textarea/index.js +2 -0
- package/dist/web/textarea/manifest.json +438 -0
- package/dist/web/textarea/textarea.css +1 -0
- package/dist/web/textarea/textarea.svelte +224 -0
- package/dist/web/textarea/textarea.svelte.d.ts +274 -0
- package/dist/web/tooltip/AI_GUIDE.md +110 -0
- package/dist/web/tooltip/index.d.ts +2 -0
- package/dist/web/tooltip/index.js +2 -0
- package/dist/web/tooltip/manifest.json +222 -0
- package/dist/web/tooltip/tooltip.css +1 -0
- package/dist/web/tooltip/tooltip.svelte +292 -0
- package/dist/web/tooltip/tooltip.svelte.d.ts +140 -0
- package/dist/webview/bottomsheet/AI_GUIDE.md +141 -0
- package/dist/webview/bottomsheet/bottomsheet.css +1 -0
- package/dist/webview/bottomsheet/bottomsheet.svelte +462 -0
- package/dist/webview/bottomsheet/bottomsheet.svelte.d.ts +200 -0
- package/dist/webview/bottomsheet/index.d.ts +4 -0
- package/dist/webview/bottomsheet/index.js +3 -0
- package/dist/webview/bottomsheet/manifest.json +377 -0
- package/dist/webview/button/AI_GUIDE.md +79 -0
- package/dist/webview/button/button-ios.css +1 -0
- package/dist/webview/button/button-ios.svelte +58 -0
- package/dist/webview/button/button-ios.svelte.d.ts +114 -0
- package/dist/webview/button/button-material.css +1 -0
- package/dist/webview/button/button-material.svelte +58 -0
- package/dist/webview/button/button-material.svelte.d.ts +114 -0
- package/dist/webview/button/index.d.ts +6 -0
- package/dist/webview/button/index.js +4 -0
- package/dist/webview/button/manifest.json +148 -0
- package/dist/webview/index.d.ts +6 -0
- package/dist/webview/index.js +6 -0
- package/llms.txt +6518 -0
- package/package.json +709 -4
- package/ttdk-manifest.json +10188 -0
- package/README.md +0 -3
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# <Input /> — TTDK Component Reference
|
|
2
|
+
|
|
3
|
+
Komponen Input TTDK sesuai spesifikasi Anatomy Desain: 1. Field title (14px Semibold, #141313) 2. (Opsional) label (12px Regular, #9698A2) 3. Border radius 8px 4. Icon left / right (24px) 5. Field content (14px Regular, #141313, placeholder #9698A2) 6. Additional information / Helper text (12px Regular, #3C4245)
|
|
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/input/input.css";`
|
|
8
|
+
|
|
9
|
+
## 2. Subpath Component Import
|
|
10
|
+
```ts
|
|
11
|
+
// React
|
|
12
|
+
import Input from "@ttdk-design-system/library-react/web/input";
|
|
13
|
+
|
|
14
|
+
// Vue 3
|
|
15
|
+
import Input from "@ttdk-design-system/library-vue/web/input";
|
|
16
|
+
|
|
17
|
+
// Svelte
|
|
18
|
+
import Input from "@ttdk-design-system/library-svelte/web/input";
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## 3. Props & API Reference
|
|
22
|
+
|
|
23
|
+
| Prop | Type | Default | Description |
|
|
24
|
+
| :--- | :--- | :--- | :--- |
|
|
25
|
+
| `label?` | `string` | `-` | Teks label judul field yang ditampilkan di atas input (14px Semibold, #141313). |
|
|
26
|
+
| `labelStyle?` | `UiProps` | `-` | Style kustom untuk elemen label judul field (UiProps). |
|
|
27
|
+
| `labelClass?` | `string` | `-` | Class CSS kustom untuk elemen label judul field. |
|
|
28
|
+
| `wrapperStyle?` | `UiProps` | `-` | Style kustom untuk elemen kontainer input wrapper (UiProps). |
|
|
29
|
+
| `wrapperClass?` | `string` | `-` | Class CSS kustom untuk elemen kontainer input wrapper. |
|
|
30
|
+
| `inputStyle?` | `UiProps` | `-` | Style kustom untuk elemen input control HTML (UiProps). |
|
|
31
|
+
| `inputClass?` | `string` | `-` | Class CSS kustom untuk elemen input control HTML. |
|
|
32
|
+
| `errorMessageStyle?` | `UiProps` | `-` | Style kustom untuk elemen pesan error validasi (UiProps). |
|
|
33
|
+
| `errorMessageClass?` | `string` | `-` | Class CSS kustom untuk elemen pesan error validasi. |
|
|
34
|
+
| `helperTextStyle?` | `UiProps` | `-` | Style kustom untuk elemen helper text (UiProps). |
|
|
35
|
+
| `helperTextClass?` | `string` | `-` | Class CSS kustom untuk elemen helper text. |
|
|
36
|
+
| `optional?` | `boolean` | `-` | Menandai field sebagai opsi opsional dengan menambahkan teks '(Opsional)' (12px Regular, #9698A2). |
|
|
37
|
+
| `optionalText?` | `string` | `(Opsional)` | Kustomisasi teks keterangan opsional. |
|
|
38
|
+
| `placeholder?` | `string` | `-` | Nilai teks placeholder saat input kosong (#9698A2). |
|
|
39
|
+
| `value?` | `string | number` | `-` | Nilai terkontrol (controlled value) pada input. |
|
|
40
|
+
| `defaultValue?` | `string | number` | `-` | Nilai awal tidak terkontrol (uncontrolled initial value). |
|
|
41
|
+
| `type?` | `string` | `text` | Tipe field input HTML standar. |
|
|
42
|
+
| `name?` | `string` | `-` | Nama form field HTML untuk integrasi formulir. |
|
|
43
|
+
| `id?` | `string` | `-` | Identifier unik elemen input. |
|
|
44
|
+
| `error?` | `boolean` | `false` | Status apakah input sedang dalam kondisi error / tidak valid. |
|
|
45
|
+
| `errorMessage?` | `string` | `-` | Pesan teks penjelasan kesalahan validasi di bawah field. |
|
|
46
|
+
| `helperText?` | `string` | `-` | Teks petunjuk atau keterangan bantuan di bawah field (12px Regular, #3C4245). |
|
|
47
|
+
| `helperTextPosition?` | `'top' | 'bottom'` | `-` | Posisi teks helper |
|
|
48
|
+
| `size?` | `'sm' | 'md' | 'lg'` | `md` | Skala ukuran input field. - `'sm'`: 36px - `'md'`: 48px (standar) - `'lg'`: 56px |
|
|
49
|
+
| `rounded?` | `'none' | 'sm' | 'md' | 'lg' | 'full'` | `md` | Bentuk sudut kelengkungan input. - `'none'`: 0px - `'sm'`: 4px - `'md'`: 8px (standar desain) - `'lg'`: 12px - `'full'`: 9999px (kapsul) |
|
|
50
|
+
| `block?` | `boolean` | `false` | Menjadikan lebar field input memenuhi kontainer penuh (full-width 100%). |
|
|
51
|
+
| `disabled?` | `boolean` | `false` | Status apakah field dinonaktifkan (disabled). |
|
|
52
|
+
| `readOnly?` | `boolean` | `false` | Status apakah field bersifat hanya-baca (readonly). |
|
|
53
|
+
| `required?` | `boolean` | `false` | Menandai field sebagai input wajib diisi (menampilkan tanda bintang merah *). |
|
|
54
|
+
| `iconLeft?` | `any` | `-` | Ikon di sebelah kiri dalam input (ukuran 20-24px, misal: Calendar, Search, User). |
|
|
55
|
+
| `iconRight?` | `any` | `-` | Ikon di sebelah kanan dalam input (ukuran 20-24px, misal: Chevron-down, Eye, Close). |
|
|
56
|
+
| `addonLeft?` | `string | any` | `-` | Addon / teks prefix di sebelah kiri luar input (misal: 'Text', '+62 (IDN)'). |
|
|
57
|
+
| `addonRight?` | `string | any` | `-` | Addon / teks suffix di sebelah kanan luar input (misal: 'Text', '.com', 'kg'). |
|
|
58
|
+
| `autoComplete?` | `string` | `-` | Konfigurasi atribut autocomplete HTML. |
|
|
59
|
+
| `maxLength?` | `number` | `-` | Batas maksimum panjang karakter. |
|
|
60
|
+
| `minLength?` | `number` | `-` | Batas minimum panjang karakter. |
|
|
61
|
+
| `min?` | `number | string` | `-` | Nilai minimum untuk input bertipe number atau date. |
|
|
62
|
+
| `max?` | `number | string` | `-` | Nilai maksimum untuk input bertipe number atau date. |
|
|
63
|
+
| `style?` | `any` | `-` | Inline CSS style object native. |
|
|
64
|
+
| `ui?` | `UiProps` | `-` | Kustomisasi visual granular root / form-item (UiProps). |
|
|
65
|
+
| `onChange?` | `(event: any) => void` | `-` | Callback event saat nilai input berubah. |
|
|
66
|
+
| `onInput?` | `(event: any) => void` | `-` | Callback event saat pengguna mengetik (input event). |
|
|
67
|
+
| `onBlur?` | `(event: any) => void` | `-` | Callback event saat field input kehilangan fokus. |
|
|
68
|
+
| `onFocus?` | `(event: any) => void` | `-` | Callback event saat field input mendapatkan fokus. |
|
|
69
|
+
| `inputRef?` | `any` | `-` | Ref instance elemen input HTML untuk akses kontrol DOM langsung (focus, blur, select). |
|
|
70
|
+
| `className?` | `string` | `-` | Class CSS kustom. |
|
|
71
|
+
| `onKeyDown?` | `(event: any) => void` | `-` | Callback event tombol keyboard ditekan. |
|
|
72
|
+
| `onKeyUp?` | `(event: any) => void` | `-` | Callback event tombol keyboard dilepaskan. |
|
|
73
|
+
| `loading?` | `boolean` | `false` | Menampilkan spinner dan menonaktifkan interaksi field sementara menunggu proses async. |
|
|
74
|
+
|
|
75
|
+
## 4. Usage Examples
|
|
76
|
+
|
|
77
|
+
### React Example
|
|
78
|
+
```tsx
|
|
79
|
+
import { useState } from "react";
|
|
80
|
+
import Input from "@ttdk-design-system/library-react/web/input";
|
|
81
|
+
import "@ttdk-design-system/library-react/web/input/input.css";
|
|
82
|
+
|
|
83
|
+
export function Example() {
|
|
84
|
+
const [email, setEmail] = useState("");
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<div style={{ display: 'flex', flexDirection: 'column', gap: '16px', maxWidth: '400px' }}>
|
|
88
|
+
<Input
|
|
89
|
+
label="Alamat Email"
|
|
90
|
+
placeholder="nama@kemkes.go.id"
|
|
91
|
+
value={email}
|
|
92
|
+
required
|
|
93
|
+
helperText="Gunakan email kedinasan terdaftar."
|
|
94
|
+
onChange={(e) => setEmail(e.target.value)}
|
|
95
|
+
/>
|
|
96
|
+
<Input
|
|
97
|
+
label="Nomor STR"
|
|
98
|
+
placeholder="Masukkan nomor STR tenaga kesehatan"
|
|
99
|
+
optional
|
|
100
|
+
/>
|
|
101
|
+
</div>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Vue 3 Example
|
|
107
|
+
```vue
|
|
108
|
+
<script setup lang="ts">
|
|
109
|
+
import { ref } from "vue";
|
|
110
|
+
import Input from "@ttdk-design-system/library-vue/web/input";
|
|
111
|
+
import "@ttdk-design-system/library-vue/web/input/input.css";
|
|
112
|
+
|
|
113
|
+
const email = ref("");
|
|
114
|
+
</script>
|
|
115
|
+
|
|
116
|
+
<template>
|
|
117
|
+
<div style="display: flex; flex-direction: column; gap: 16px; max-width: 400px;">
|
|
118
|
+
<Input
|
|
119
|
+
label="Alamat Email"
|
|
120
|
+
placeholder="nama@kemkes.go.id"
|
|
121
|
+
:value="email"
|
|
122
|
+
:required="true"
|
|
123
|
+
helper-text="Gunakan email kedinasan terdaftar."
|
|
124
|
+
@input="(e: any) => (email = e.target.value)"
|
|
125
|
+
/>
|
|
126
|
+
<Input
|
|
127
|
+
label="Nomor STR"
|
|
128
|
+
placeholder="Masukkan nomor STR tenaga kesehatan"
|
|
129
|
+
:optional="true"
|
|
130
|
+
/>
|
|
131
|
+
</div>
|
|
132
|
+
</template>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Svelte Example
|
|
136
|
+
```svelte
|
|
137
|
+
<script lang="ts">
|
|
138
|
+
import Input from "@ttdk-design-system/library-svelte/web/input";
|
|
139
|
+
import "@ttdk-design-system/library-svelte/web/input/input.css";
|
|
140
|
+
|
|
141
|
+
let email = "";
|
|
142
|
+
</script>
|
|
143
|
+
|
|
144
|
+
<div style="display: flex; flex-direction: column; gap: 16px; max-width: 400px;">
|
|
145
|
+
<Input
|
|
146
|
+
label="Alamat Email"
|
|
147
|
+
placeholder="nama@kemkes.go.id"
|
|
148
|
+
value={email}
|
|
149
|
+
required={true}
|
|
150
|
+
helperText="Gunakan email kedinasan terdaftar."
|
|
151
|
+
on:input={(e) => (email = e.target.value)}
|
|
152
|
+
/>
|
|
153
|
+
<Input
|
|
154
|
+
label="Nomor STR"
|
|
155
|
+
placeholder="Masukkan nomor STR tenaga kesehatan"
|
|
156
|
+
optional={true}
|
|
157
|
+
/>
|
|
158
|
+
</div>
|
|
159
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ttdk-form-item{gap:var(--ttdk-spacing-xxs);box-sizing:border-box;width:100%;font-family:var(--ttdk-font-sans);flex-direction:column;display:flex}.ttdk-form-item[data-block=true]{width:100%}.ttdk-form-label{font-size:var(--ttdk-font-size-14);font-weight:var(--ttdk-font-weight-semibold);line-height:var(--ttdk-font-size-20);color:var(--ttdk-ui-color,var(--ttdk-text-icon-primary));align-items:center;gap:var(--ttdk-spacing-xxs);user-select:none;display:flex}.dark .ttdk-form-label{color:var(--ttdk-ui-color,var(--ttdk-text-icon-primary))}.ttdk-form-required{color:var(--ttdk-stroke-status-error);font-weight:var(--ttdk-font-weight-bold)}.dark .ttdk-form-required{color:var(--ttdk-stroke-status-error)}.ttdk-form-optional{font-size:var(--ttdk-font-size-12);font-weight:var(--ttdk-font-weight-regular);line-height:var(--ttdk-font-size-18);color:var(--ttdk-text-icon-disabled);margin-left:var(--ttdk-spacing-none)}.dark .ttdk-form-optional{color:var(--ttdk-text-icon-disabled)}.ttdk-input-wrapper{background:var(--ttdk-bg-base-primary);border:var(--ttdk-stroke-width-thin) solid var(--ttdk-stroke-subtle);border-radius:var(--ttdk-radius-input-lg);box-sizing:border-box;align-items:stretch;width:100%;height:48px;transition:border-color .15s,box-shadow .15s,background-color .15s;display:flex;overflow:hidden}.dark .ttdk-input-wrapper{background:var(--ttdk-bg-base-primary);border-color:var(--ttdk-stroke-subtle)}.ttdk-input-wrapper[data-filled=true],.dark .ttdk-input-wrapper[data-filled=true]{border-color:var(--ttdk-stroke-strong)}.ttdk-input-wrapper:focus-within{box-shadow:0 0 0 3px color-mix(in srgb, var(--ttdk-stroke-border-focus) 15%, transparent);border-color:var(--ttdk-stroke-border-focus)!important}.dark .ttdk-input-wrapper:focus-within{box-shadow:0 0 0 3px color-mix(in srgb, var(--ttdk-stroke-border-focus) 25%, transparent);border-color:var(--ttdk-stroke-border-focus)!important}.ttdk-input-wrapper[data-error=true]{border-color:var(--ttdk-stroke-status-error)!important}.ttdk-input-wrapper[data-error=true]:focus-within{box-shadow:0 0 0 3px color-mix(in srgb, var(--ttdk-stroke-status-error) 15%, transparent);border-color:var(--ttdk-stroke-status-error)!important}.dark .ttdk-input-wrapper[data-error=true]{border-color:var(--ttdk-stroke-status-error)!important}.ttdk-form-item[data-error=true] .ttdk-form-label,.dark .ttdk-form-item[data-error=true] .ttdk-form-label{color:var(--ttdk-text-icon-status-error)}.ttdk-input-wrapper[data-disabled=true],.ttdk-form-item[data-disabled=true] .ttdk-input-wrapper{cursor:not-allowed;opacity:.85;background:var(--ttdk-bg-secondary-disabled)!important;border-color:var(--ttdk-stroke-subtle)!important}.dark .ttdk-input-wrapper[data-disabled=true],.dark .ttdk-form-item[data-disabled=true] .ttdk-input-wrapper{opacity:.75;background:var(--ttdk-bg-secondary-disabled)!important;border-color:var(--ttdk-stroke-subtle)!important}.ttdk-input-inner{align-items:center;gap:var(--ttdk-spacing-sm);min-width:0;height:100%;padding:0 var(--ttdk-spacing-sm);flex:1;display:flex;position:relative}.ttdk-input-icon{width:var(--ttdk-font-size-24);height:var(--ttdk-font-size-24);color:var(--ttdk-text-icon-disabled);user-select:none;flex-shrink:0;justify-content:center;align-items:center;display:inline-flex}.dark .ttdk-input-icon{color:var(--ttdk-text-icon-disabled)}.ttdk-input-icon svg{width:var(--ttdk-font-size-24);height:var(--ttdk-font-size-24)}.ttdk-input-icon-left{margin-left:var(--ttdk-spacing-none);margin-right:var(--ttdk-spacing-none)}.ttdk-input-icon-right{margin-right:var(--ttdk-spacing-none);margin-left:var(--ttdk-spacing-none)}.ttdk-input-spinner{flex-shrink:0;justify-content:center;align-items:center;display:inline-flex}.ttdk-input-spinner svg{fill:none;stroke:currentColor;stroke-width:2.2px;stroke-linecap:round;width:20px;height:20px;animation:1.2s steps(12,end) infinite ttdk-input-spin}@keyframes ttdk-input-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.ttdk-input-control{width:100%;min-width:0;font-size:var(--ttdk-font-size-14);font-weight:var(--ttdk-font-weight-regular);line-height:var(--ttdk-line-height-body);height:100%;color:var(--ttdk-ui-color,var(--ttdk-text-icon-primary));box-sizing:border-box;font-family:var(--ttdk-font-sans);background:0 0;border:none;outline:none;flex:1;padding:0}.dark .ttdk-input-control{color:var(--ttdk-ui-color,var(--ttdk-text-icon-primary))}.ttdk-input-control::placeholder{color:var(--ttdk-text-icon-disabled);opacity:1}.dark .ttdk-input-control::placeholder{color:var(--ttdk-text-icon-disabled)}.ttdk-input-control:disabled{cursor:not-allowed;color:var(--ttdk-text-icon-disabled)}.dark .ttdk-input-control:disabled{color:var(--ttdk-text-icon-disabled)}.ttdk-input-wrapper[data-size=sm]{height:36px}.ttdk-input-wrapper[data-size=sm] .ttdk-input-control{font-size:var(--ttdk-font-size-12)}.ttdk-input-wrapper[data-size=sm] .ttdk-input-icon,.ttdk-input-wrapper[data-size=sm] .ttdk-input-icon svg{width:var(--ttdk-font-size-20);height:var(--ttdk-font-size-20)}.ttdk-input-wrapper[data-size=sm] .ttdk-input-icon.ttdk-input-spinner,.ttdk-input-wrapper[data-size=sm] .ttdk-input-icon.ttdk-input-spinner svg,.ttdk-input-wrapper[data-size=sm] .ttdk-input-spinner,.ttdk-input-wrapper[data-size=sm] .ttdk-input-spinner svg{width:16px;height:16px}.ttdk-input-wrapper[data-size=sm] .ttdk-input-addon{padding:0 var(--ttdk-spacing-sm);font-size:var(--ttdk-font-size-12)}.ttdk-input-wrapper[data-size=md]{height:48px}.ttdk-input-wrapper[data-size=md] .ttdk-input-control{font-size:var(--ttdk-font-size-14)}.ttdk-input-wrapper[data-size=md] .ttdk-input-icon.ttdk-input-spinner,.ttdk-input-wrapper[data-size=md] .ttdk-input-icon.ttdk-input-spinner svg,.ttdk-input-wrapper[data-size=md] .ttdk-input-spinner,.ttdk-input-wrapper[data-size=md] .ttdk-input-spinner svg{width:20px;height:20px}.ttdk-input-wrapper[data-size=lg]{height:56px}.ttdk-input-wrapper[data-size=lg] .ttdk-input-control{font-size:var(--ttdk-font-size-16)}.ttdk-input-wrapper[data-size=lg] .ttdk-input-icon.ttdk-input-spinner,.ttdk-input-wrapper[data-size=lg] .ttdk-input-icon.ttdk-input-spinner svg,.ttdk-input-wrapper[data-size=lg] .ttdk-input-spinner,.ttdk-input-wrapper[data-size=lg] .ttdk-input-spinner svg{width:24px;height:24px}.ttdk-input-wrapper[data-rounded=none]{border-radius:var(--ttdk-radius-input-none)}.ttdk-input-wrapper[data-rounded=xs]{border-radius:var(--ttdk-radius-input-xs)}.ttdk-input-wrapper[data-rounded=sm]{border-radius:var(--ttdk-radius-input-sm)}.ttdk-input-wrapper[data-rounded=md]{border-radius:var(--ttdk-radius-input-md)}.ttdk-input-wrapper[data-rounded=lg]{border-radius:var(--ttdk-radius-input-lg)}.ttdk-input-wrapper[data-rounded=xl]{border-radius:var(--ttdk-radius-input-xl)}.ttdk-input-wrapper[data-rounded=full]{border-radius:var(--ttdk-radius-input-full)}.ttdk-input-addon{padding:0 var(--ttdk-spacing-md);font-size:var(--ttdk-font-size-14);font-weight:var(--ttdk-font-weight-medium);color:var(--ttdk-text-icon-secondary);background:var(--ttdk-bg-secondary-disabled);border-color:var(--ttdk-stroke-subtle);user-select:none;white-space:nowrap;box-sizing:border-box;justify-content:center;align-items:center;display:flex}.dark .ttdk-input-addon{background:var(--ttdk-bg-secondary-disabled);color:var(--ttdk-text-icon-secondary);border-color:var(--ttdk-stroke-subtle)}.ttdk-input-addon-left{border-right:var(--ttdk-stroke-width-thin) solid var(--ttdk-stroke-subtle)}.dark .ttdk-input-addon-left{border-right-color:var(--ttdk-stroke-subtle)}.ttdk-input-addon-right{border-left:var(--ttdk-stroke-width-thin) solid var(--ttdk-stroke-subtle)}.dark .ttdk-input-addon-right{border-left-color:var(--ttdk-stroke-subtle)}.ttdk-input-wrapper[data-disabled=true] .ttdk-input-addon,.dark .ttdk-input-wrapper[data-disabled=true] .ttdk-input-addon{background:var(--ttdk-bg-secondary-disabled);color:var(--ttdk-text-icon-disabled)}.ttdk-input-addon-btn,.ttdk-input-addon-select{align-items:center;gap:var(--ttdk-spacing-xs);font-family:inherit;font-size:var(--ttdk-font-size-14);font-weight:var(--ttdk-font-weight-medium);color:var(--ttdk-text-icon-primary);cursor:pointer;user-select:none;background:0 0;border:none;outline:none;height:100%;margin:0;padding:0;display:inline-flex}.dark .ttdk-input-addon-btn,.dark .ttdk-input-addon-select{color:var(--ttdk-text-icon-primary)}.ttdk-input-addon-btn:hover,.ttdk-input-addon-select:hover{color:var(--ttdk-brand-default)}.ttdk-input-addon-btn svg,.ttdk-input-addon-select svg{width:var(--ttdk-font-size-16);height:var(--ttdk-font-size-16);color:var(--ttdk-text-icon-disabled);transition:transform .2s}.ttdk-input-addon-btn[aria-expanded=true] svg,.ttdk-input-addon-btn.active svg{transform:rotate(180deg)}.ttdk-input-addon select{font-family:inherit;font-size:var(--ttdk-font-size-14);font-weight:var(--ttdk-font-weight-medium);color:var(--ttdk-text-icon-primary);cursor:pointer;padding-right:var(--ttdk-spacing-xxs);background:0 0;border:none;outline:none}.dark .ttdk-input-addon select{color:var(--ttdk-text-icon-primary);background:var(--ttdk-bg-base-primary)}.ttdk-input-addon-dropdown{align-items:center;height:100%;display:flex;position:relative}.ttdk-input-dropdown-menu{top:calc(100% + var(--ttdk-spacing-xs));left:calc(-1 * var(--ttdk-spacing-md));z-index:50;background:var(--ttdk-bg-base-primary);border:var(--ttdk-stroke-width-thin) solid var(--ttdk-stroke-subtle);border-radius:var(--ttdk-radius-input-lg);min-width:220px;box-shadow:var(--ttdk-shadow-md);padding:var(--ttdk-spacing-xs);gap:var(--ttdk-spacing-xxxs);box-sizing:border-box;flex-direction:column;max-height:240px;display:flex;position:absolute;overflow-y:auto}.dark .ttdk-input-dropdown-menu{background:var(--ttdk-bg-base-primary);border-color:var(--ttdk-stroke-subtle);box-shadow:var(--ttdk-shadow-md)}.ttdk-input-dropdown-item{justify-content:space-between;align-items:center;gap:var(--ttdk-spacing-xs);padding:var(--ttdk-spacing-xs) var(--ttdk-spacing-sm);font-size:var(--ttdk-font-size-14);color:var(--ttdk-text-icon-primary);border-radius:var(--ttdk-radius-input-md);cursor:pointer;text-align:left;box-sizing:border-box;background:0 0;border:none;width:100%;transition:background-color .15s,color .15s;display:flex}.dark .ttdk-input-dropdown-item{color:var(--ttdk-text-icon-primary)}.ttdk-input-dropdown-item:hover,.ttdk-input-dropdown-item[data-selected=true]{background:var(--ttdk-brand-subtle);color:var(--ttdk-brand-default);font-weight:var(--ttdk-font-weight-medium)}.dark .ttdk-input-dropdown-item:hover,.dark .ttdk-input-dropdown-item[data-selected=true]{background:color-mix(in srgb, var(--ttdk-brand-default) 15%, transparent);color:var(--ttdk-stroke-border-focus)}.ttdk-form-helper-text{font-size:var(--ttdk-font-size-12);font-weight:var(--ttdk-font-weight-regular);color:var(--ttdk-text-icon-secondary);line-height:var(--ttdk-font-size-18);min-height:var(--ttdk-font-size-18)}.dark .ttdk-form-helper-text{color:var(--ttdk-text-icon-secondary)}.ttdk-form-error-msg{align-items:center;gap:var(--ttdk-spacing-xxs);font-size:var(--ttdk-font-size-12);color:var(--ttdk-text-icon-status-error);font-weight:var(--ttdk-font-weight-medium);line-height:var(--ttdk-font-size-18);min-height:var(--ttdk-font-size-18);display:flex}.dark .ttdk-form-error-msg{color:var(--ttdk-text-icon-status-error)}.ttdk-form-error-icon{width:var(--ttdk-font-size-14);height:var(--ttdk-font-size-14);flex-shrink:0}.ttdk-form-error-icon path{fill-rule:evenodd;clip-rule:evenodd}
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
3
|
+
<script>import { buildUiVars, UiProps } from "../../core/types";
|
|
4
|
+
export let className = void 0;
|
|
5
|
+
export let disabled = void 0;
|
|
6
|
+
export let error = void 0;
|
|
7
|
+
export let errorMessage = void 0;
|
|
8
|
+
export let size = void 0;
|
|
9
|
+
export let block = void 0;
|
|
10
|
+
export let ui = void 0;
|
|
11
|
+
export let label = void 0;
|
|
12
|
+
export let labelClass = void 0;
|
|
13
|
+
export let id = void 0;
|
|
14
|
+
export let labelStyle = void 0;
|
|
15
|
+
export let required = void 0;
|
|
16
|
+
export let optional = void 0;
|
|
17
|
+
export let optionalText = void 0;
|
|
18
|
+
export let helperText = void 0;
|
|
19
|
+
export let helperTextPosition = void 0;
|
|
20
|
+
export let helperTextClass = void 0;
|
|
21
|
+
export let helperTextStyle = void 0;
|
|
22
|
+
export let wrapperClass = void 0;
|
|
23
|
+
export let value = void 0;
|
|
24
|
+
export let defaultValue = void 0;
|
|
25
|
+
export let rounded = void 0;
|
|
26
|
+
export let wrapperStyle = void 0;
|
|
27
|
+
export let addonLeft = void 0;
|
|
28
|
+
export let iconLeft = void 0;
|
|
29
|
+
export let inputRef = void 0;
|
|
30
|
+
export let inputClass = void 0;
|
|
31
|
+
export let type = void 0;
|
|
32
|
+
export let name = void 0;
|
|
33
|
+
export let placeholder = void 0;
|
|
34
|
+
export let readOnly = void 0;
|
|
35
|
+
export let autoComplete = void 0;
|
|
36
|
+
export let maxLength = void 0;
|
|
37
|
+
export let minLength = void 0;
|
|
38
|
+
export let min = void 0;
|
|
39
|
+
export let max = void 0;
|
|
40
|
+
export let inputStyle = void 0;
|
|
41
|
+
export let onChange = void 0;
|
|
42
|
+
export let onInput = void 0;
|
|
43
|
+
export let onBlur = void 0;
|
|
44
|
+
export let onFocus = void 0;
|
|
45
|
+
export let onKeyDown = void 0;
|
|
46
|
+
export let onKeyUp = void 0;
|
|
47
|
+
export let loading = void 0;
|
|
48
|
+
export let iconRight = void 0;
|
|
49
|
+
export let addonRight = void 0;
|
|
50
|
+
export let errorMessageClass = void 0;
|
|
51
|
+
export let errorMessageStyle = void 0;
|
|
52
|
+
function stringifyStyles(stylesObj) {
|
|
53
|
+
let styles = "";
|
|
54
|
+
for (let key in stylesObj) {
|
|
55
|
+
const dashedKey = key.replace(/[A-Z]/g, function(match) {
|
|
56
|
+
return "-" + match.toLowerCase();
|
|
57
|
+
});
|
|
58
|
+
styles += dashedKey + ":" + stylesObj[key] + ";";
|
|
59
|
+
}
|
|
60
|
+
return styles;
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
63
|
+
|
|
64
|
+
<div
|
|
65
|
+
style={stringifyStyles({
|
|
66
|
+
...buildUiVars(ui),
|
|
67
|
+
...(ui || {}),
|
|
68
|
+
})}
|
|
69
|
+
class={`ttdk-form-item ${className || ""}`.trim()}
|
|
70
|
+
data-disabled={disabled}
|
|
71
|
+
data-error={Boolean(error || errorMessage)}
|
|
72
|
+
data-size={size || "md"}
|
|
73
|
+
data-block={block ? "true" : undefined}
|
|
74
|
+
>
|
|
75
|
+
{#if label}
|
|
76
|
+
<label
|
|
77
|
+
style={stringifyStyles({
|
|
78
|
+
...buildUiVars(labelStyle),
|
|
79
|
+
})}
|
|
80
|
+
class={`ttdk-form-label ${labelClass || ""}`.trim()}
|
|
81
|
+
for={id}
|
|
82
|
+
><span>{label}</span>
|
|
83
|
+
{#if required}
|
|
84
|
+
<span class="ttdk-form-required" aria-hidden="true"> * </span>
|
|
85
|
+
{/if}
|
|
86
|
+
{#if optional}
|
|
87
|
+
<span class="ttdk-form-optional">{optionalText || "(Opsional)"}</span>
|
|
88
|
+
{/if}</label
|
|
89
|
+
>
|
|
90
|
+
{/if}
|
|
91
|
+
{#if helperText && helperTextPosition === "top"}
|
|
92
|
+
<div
|
|
93
|
+
style={stringifyStyles({
|
|
94
|
+
...buildUiVars(helperTextStyle),
|
|
95
|
+
})}
|
|
96
|
+
class={`ttdk-form-helper-text ${helperTextClass || ""}`.trim()}
|
|
97
|
+
>
|
|
98
|
+
{helperText}
|
|
99
|
+
</div>
|
|
100
|
+
{/if}
|
|
101
|
+
<div
|
|
102
|
+
style={stringifyStyles({
|
|
103
|
+
...buildUiVars(wrapperStyle),
|
|
104
|
+
})}
|
|
105
|
+
class={`ttdk-input-wrapper ${wrapperClass || ""}`.trim()}
|
|
106
|
+
data-filled={Boolean(value || defaultValue)}
|
|
107
|
+
data-error={Boolean(error || errorMessage)}
|
|
108
|
+
data-disabled={Boolean(disabled)}
|
|
109
|
+
data-size={size || "md"}
|
|
110
|
+
data-rounded={rounded || "md"}
|
|
111
|
+
>
|
|
112
|
+
{#if addonLeft}
|
|
113
|
+
<div class="ttdk-input-addon ttdk-input-addon-left">{addonLeft}</div>
|
|
114
|
+
{/if}
|
|
115
|
+
<div class="ttdk-input-inner">
|
|
116
|
+
{#if iconLeft}
|
|
117
|
+
<span class="ttdk-input-icon ttdk-input-icon-left" aria-hidden="true"
|
|
118
|
+
>{iconLeft}</span
|
|
119
|
+
>
|
|
120
|
+
{/if}<input
|
|
121
|
+
style={stringifyStyles({
|
|
122
|
+
...buildUiVars(inputStyle),
|
|
123
|
+
})}
|
|
124
|
+
bind:this={inputRef}
|
|
125
|
+
class={`ttdk-input-control ${inputClass || ""}`.trim()}
|
|
126
|
+
type={type || "text"}
|
|
127
|
+
{name}
|
|
128
|
+
{id}
|
|
129
|
+
value={value !== undefined ? value : defaultValue}
|
|
130
|
+
{placeholder}
|
|
131
|
+
{disabled}
|
|
132
|
+
{readOnly}
|
|
133
|
+
{required}
|
|
134
|
+
autocomplete={autoComplete}
|
|
135
|
+
{maxLength}
|
|
136
|
+
{minLength}
|
|
137
|
+
{min}
|
|
138
|
+
{max}
|
|
139
|
+
aria-invalid={Boolean(error || errorMessage)}
|
|
140
|
+
on:change={(e) => {
|
|
141
|
+
onChange && onChange(e);
|
|
142
|
+
}}
|
|
143
|
+
on:input={(e) => {
|
|
144
|
+
onInput && onInput(e);
|
|
145
|
+
}}
|
|
146
|
+
on:blur={(e) => {
|
|
147
|
+
onBlur && onBlur(e);
|
|
148
|
+
}}
|
|
149
|
+
on:focus={(e) => {
|
|
150
|
+
onFocus && onFocus(e);
|
|
151
|
+
}}
|
|
152
|
+
on:keydown={(e) => {
|
|
153
|
+
onKeyDown && onKeyDown(e);
|
|
154
|
+
}}
|
|
155
|
+
on:keyup={(e) => {
|
|
156
|
+
onKeyUp && onKeyUp(e);
|
|
157
|
+
}}
|
|
158
|
+
/>
|
|
159
|
+
{#if loading}
|
|
160
|
+
<span
|
|
161
|
+
class="ttdk-input-icon ttdk-input-icon-right ttdk-input-spinner"
|
|
162
|
+
aria-hidden="true"
|
|
163
|
+
><svg viewBox="0 0 24 24"
|
|
164
|
+
><line
|
|
165
|
+
x1="12"
|
|
166
|
+
y1="2.5"
|
|
167
|
+
x2="12"
|
|
168
|
+
y2="6.5"
|
|
169
|
+
opacity="0.175"
|
|
170
|
+
transform="rotate(0 12 12)"
|
|
171
|
+
/><line
|
|
172
|
+
x1="12"
|
|
173
|
+
y1="2.5"
|
|
174
|
+
x2="12"
|
|
175
|
+
y2="6.5"
|
|
176
|
+
opacity="0.25"
|
|
177
|
+
transform="rotate(30 12 12)"
|
|
178
|
+
/><line
|
|
179
|
+
x1="12"
|
|
180
|
+
y1="2.5"
|
|
181
|
+
x2="12"
|
|
182
|
+
y2="6.5"
|
|
183
|
+
opacity="0.325"
|
|
184
|
+
transform="rotate(60 12 12)"
|
|
185
|
+
/><line
|
|
186
|
+
x1="12"
|
|
187
|
+
y1="2.5"
|
|
188
|
+
x2="12"
|
|
189
|
+
y2="6.5"
|
|
190
|
+
opacity="0.4"
|
|
191
|
+
transform="rotate(90 12 12)"
|
|
192
|
+
/><line
|
|
193
|
+
x1="12"
|
|
194
|
+
y1="2.5"
|
|
195
|
+
x2="12"
|
|
196
|
+
y2="6.5"
|
|
197
|
+
opacity="0.475"
|
|
198
|
+
transform="rotate(120 12 12)"
|
|
199
|
+
/><line
|
|
200
|
+
x1="12"
|
|
201
|
+
y1="2.5"
|
|
202
|
+
x2="12"
|
|
203
|
+
y2="6.5"
|
|
204
|
+
opacity="0.55"
|
|
205
|
+
transform="rotate(150 12 12)"
|
|
206
|
+
/><line
|
|
207
|
+
x1="12"
|
|
208
|
+
y1="2.5"
|
|
209
|
+
x2="12"
|
|
210
|
+
y2="6.5"
|
|
211
|
+
opacity="0.625"
|
|
212
|
+
transform="rotate(180 12 12)"
|
|
213
|
+
/><line
|
|
214
|
+
x1="12"
|
|
215
|
+
y1="2.5"
|
|
216
|
+
x2="12"
|
|
217
|
+
y2="6.5"
|
|
218
|
+
opacity="0.7"
|
|
219
|
+
transform="rotate(210 12 12)"
|
|
220
|
+
/><line
|
|
221
|
+
x1="12"
|
|
222
|
+
y1="2.5"
|
|
223
|
+
x2="12"
|
|
224
|
+
y2="6.5"
|
|
225
|
+
opacity="0.775"
|
|
226
|
+
transform="rotate(240 12 12)"
|
|
227
|
+
/><line
|
|
228
|
+
x1="12"
|
|
229
|
+
y1="2.5"
|
|
230
|
+
x2="12"
|
|
231
|
+
y2="6.5"
|
|
232
|
+
opacity="0.85"
|
|
233
|
+
transform="rotate(270 12 12)"
|
|
234
|
+
/><line
|
|
235
|
+
x1="12"
|
|
236
|
+
y1="2.5"
|
|
237
|
+
x2="12"
|
|
238
|
+
y2="6.5"
|
|
239
|
+
opacity="0.925"
|
|
240
|
+
transform="rotate(300 12 12)"
|
|
241
|
+
/><line
|
|
242
|
+
x1="12"
|
|
243
|
+
y1="2.5"
|
|
244
|
+
x2="12"
|
|
245
|
+
y2="6.5"
|
|
246
|
+
opacity="1"
|
|
247
|
+
transform="rotate(330 12 12)"
|
|
248
|
+
/></svg
|
|
249
|
+
></span
|
|
250
|
+
>
|
|
251
|
+
{/if}
|
|
252
|
+
{#if !loading && iconRight}
|
|
253
|
+
<span class="ttdk-input-icon ttdk-input-icon-right" aria-hidden="true"
|
|
254
|
+
>{iconRight}</span
|
|
255
|
+
>
|
|
256
|
+
{/if}
|
|
257
|
+
</div>
|
|
258
|
+
{#if addonRight}
|
|
259
|
+
<div class="ttdk-input-addon ttdk-input-addon-right">{addonRight}</div>
|
|
260
|
+
{/if}
|
|
261
|
+
</div>
|
|
262
|
+
{#if helperText && helperTextPosition !== "top"}
|
|
263
|
+
<div
|
|
264
|
+
style={stringifyStyles({
|
|
265
|
+
...buildUiVars(helperTextStyle),
|
|
266
|
+
})}
|
|
267
|
+
class={`ttdk-form-helper-text ${helperTextClass || ""}`.trim()}
|
|
268
|
+
>
|
|
269
|
+
{helperText}
|
|
270
|
+
</div>
|
|
271
|
+
{/if}
|
|
272
|
+
{#if errorMessage && (error || errorMessage)}
|
|
273
|
+
<div
|
|
274
|
+
style={stringifyStyles({
|
|
275
|
+
...buildUiVars(errorMessageStyle),
|
|
276
|
+
})}
|
|
277
|
+
role="alert"
|
|
278
|
+
class={`ttdk-form-error-msg ${errorMessageClass || ""}`.trim()}
|
|
279
|
+
>
|
|
280
|
+
<span>{errorMessage}</span>
|
|
281
|
+
</div>
|
|
282
|
+
{/if}
|
|
283
|
+
</div>
|