@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,58 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
3
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
4
|
+
import { buildUiVars, UiProps } from "../../core/types";
|
|
5
|
+
export let id = void 0;
|
|
6
|
+
export let type = void 0;
|
|
7
|
+
export let disabled = void 0;
|
|
8
|
+
export let loading = void 0;
|
|
9
|
+
export let variant = void 0;
|
|
10
|
+
export let color = void 0;
|
|
11
|
+
export let size = void 0;
|
|
12
|
+
export let shape = void 0;
|
|
13
|
+
export let block = void 0;
|
|
14
|
+
export let ui = void 0;
|
|
15
|
+
const dispatch = createEventDispatcher();
|
|
16
|
+
export let onClick = void 0;
|
|
17
|
+
function stringifyStyles(stylesObj) {
|
|
18
|
+
let styles = "";
|
|
19
|
+
for (let key in stylesObj) {
|
|
20
|
+
const dashedKey = key.replace(/[A-Z]/g, function(match) {
|
|
21
|
+
return "-" + match.toLowerCase();
|
|
22
|
+
});
|
|
23
|
+
styles += dashedKey + ":" + stylesObj[key] + ";";
|
|
24
|
+
}
|
|
25
|
+
return styles;
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<button
|
|
30
|
+
style={stringifyStyles({
|
|
31
|
+
...buildUiVars(ui?.style),
|
|
32
|
+
})}
|
|
33
|
+
{id}
|
|
34
|
+
type={type || "button"}
|
|
35
|
+
disabled={disabled || loading}
|
|
36
|
+
class={"ttdk-btn-ios" +
|
|
37
|
+
" ttdk-btn-ios--" +
|
|
38
|
+
(variant || "filled") +
|
|
39
|
+
" ttdk-btn-ios--" +
|
|
40
|
+
(color || "primary") +
|
|
41
|
+
" ttdk-btn-ios--" +
|
|
42
|
+
(size || "md") +
|
|
43
|
+
(shape === "capsule" ? " ttdk-btn-ios--capsule" : "") +
|
|
44
|
+
(block ? " ttdk-btn-ios--block" : "") +
|
|
45
|
+
(loading ? " ttdk-btn-ios--loading" : "") +
|
|
46
|
+
(disabled ? " ttdk-btn-ios--disabled" : "") +
|
|
47
|
+
(ui?.class ? " " + ui.class : "")}
|
|
48
|
+
on:click={(e) => {
|
|
49
|
+
if (!disabled && !loading && onClick) {
|
|
50
|
+
onClick(e);
|
|
51
|
+
dispatch("click", e);
|
|
52
|
+
}
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
{#if loading}
|
|
56
|
+
<span class="ttdk-btn-ios__spinner" aria-hidden="true" />
|
|
57
|
+
{/if}<slot /></button
|
|
58
|
+
>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
export type ButtonIosUiProps = UiProps;
|
|
3
|
+
export interface ButtonIosProps {
|
|
4
|
+
/**
|
|
5
|
+
* Inline CSS style kustom.
|
|
6
|
+
*/
|
|
7
|
+
style?: any;
|
|
8
|
+
/**
|
|
9
|
+
* Gaya varian tombol berdasarkan Apple Human Interface Guidelines:
|
|
10
|
+
* - `'filled'`: Tombol solid high-emphasis / prominent (default).
|
|
11
|
+
* - `'tinted'`: Tombol berlatar belakang transparan lembut dengan aksen warna.
|
|
12
|
+
* - `'gray'`: Tombol berlatar belakang abu-abu netral khas Apple (systemGray).
|
|
13
|
+
* - `'plain'`: Tombol teks tanpa latar dan border (link style).
|
|
14
|
+
*
|
|
15
|
+
* @default 'filled'
|
|
16
|
+
*/
|
|
17
|
+
variant?: "filled" | "tinted" | "gray" | "plain";
|
|
18
|
+
/**
|
|
19
|
+
* Warna aksen semantik iOS:
|
|
20
|
+
* - `'primary'`: iOS System Blue (#007aff).
|
|
21
|
+
* - `'success'`: iOS System Green (#34c759).
|
|
22
|
+
* - `'warning'`: iOS System Orange (#ff9500).
|
|
23
|
+
* - `'danger'`: iOS System Red (#ff3b30).
|
|
24
|
+
* - `'neutral'`: iOS System Gray (#8e8e93).
|
|
25
|
+
*
|
|
26
|
+
* @default 'primary'
|
|
27
|
+
*/
|
|
28
|
+
color?: "primary" | "success" | "warning" | "danger" | "neutral";
|
|
29
|
+
/**
|
|
30
|
+
* Skala ukuran tombol:
|
|
31
|
+
* - `'sm'`: 30px (compact)
|
|
32
|
+
* - `'md'`: 42px (standar iOS touch target)
|
|
33
|
+
* - `'lg'`: 50px (large CTA)
|
|
34
|
+
*
|
|
35
|
+
* @default 'md'
|
|
36
|
+
*/
|
|
37
|
+
size?: "sm" | "md" | "lg";
|
|
38
|
+
/**
|
|
39
|
+
* Bentuk sudut tombol:
|
|
40
|
+
* - `'rounded'`: Continuous curve squircle khas iOS (~10-14px).
|
|
41
|
+
* - `'capsule'`: Full pill / capsule (border-radius: 9999px).
|
|
42
|
+
*
|
|
43
|
+
* @default 'rounded'
|
|
44
|
+
*/
|
|
45
|
+
shape?: "rounded" | "capsule";
|
|
46
|
+
/**
|
|
47
|
+
* Tipe tombol HTML native.
|
|
48
|
+
* @default 'button'
|
|
49
|
+
*/
|
|
50
|
+
type?: "button" | "submit" | "reset";
|
|
51
|
+
/**
|
|
52
|
+
* Kondisi non-aktif tombol.
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Menampilkan iOS activity indicator / spinner.
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
loading?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Lebar penuh 100% mengikuti kontainer induk.
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
block?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* ID unik elemen HTML.
|
|
68
|
+
*/
|
|
69
|
+
id?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Konfigurasi styling kustom UI.
|
|
72
|
+
*/
|
|
73
|
+
ui?: ButtonIosUiProps;
|
|
74
|
+
/**
|
|
75
|
+
* Callback saat tombol ditekan / diklik.
|
|
76
|
+
*/
|
|
77
|
+
onClick?: (event: any) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Konten label / elemen di dalam tombol.
|
|
80
|
+
*/
|
|
81
|
+
children?: any;
|
|
82
|
+
}
|
|
83
|
+
import { UiProps } from "../../core/types";
|
|
84
|
+
declare const __propDef: {
|
|
85
|
+
props: {
|
|
86
|
+
id?: ButtonIosProps["id"];
|
|
87
|
+
type?: ButtonIosProps["type"];
|
|
88
|
+
disabled?: ButtonIosProps["disabled"];
|
|
89
|
+
loading?: ButtonIosProps["loading"];
|
|
90
|
+
variant?: ButtonIosProps["variant"];
|
|
91
|
+
color?: ButtonIosProps["color"];
|
|
92
|
+
size?: ButtonIosProps["size"];
|
|
93
|
+
shape?: ButtonIosProps["shape"];
|
|
94
|
+
block?: ButtonIosProps["block"];
|
|
95
|
+
ui?: ButtonIosProps["ui"];
|
|
96
|
+
onClick?: ButtonIosProps["onClick"];
|
|
97
|
+
};
|
|
98
|
+
events: {
|
|
99
|
+
click: CustomEvent<any>;
|
|
100
|
+
} & {
|
|
101
|
+
[evt: string]: CustomEvent<any>;
|
|
102
|
+
};
|
|
103
|
+
slots: {
|
|
104
|
+
default: {};
|
|
105
|
+
};
|
|
106
|
+
exports?: {} | undefined;
|
|
107
|
+
bindings?: string | undefined;
|
|
108
|
+
};
|
|
109
|
+
type ButtonIosProps_ = typeof __propDef.props;
|
|
110
|
+
export type ButtonIosEvents = typeof __propDef.events;
|
|
111
|
+
export type ButtonIosSlots = typeof __propDef.slots;
|
|
112
|
+
export default class ButtonIos extends SvelteComponent<ButtonIosProps_, ButtonIosEvents, ButtonIosSlots> {
|
|
113
|
+
}
|
|
114
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.ttdk-btn-m3{box-sizing:border-box;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;letter-spacing:.1px;border:none;border-radius:9999px;outline:none;justify-content:center;align-items:center;min-height:40px;font-family:Roboto,Segoe UI,system-ui,-apple-system,sans-serif;font-weight:500;line-height:20px;text-decoration:none;transition:box-shadow .2s cubic-bezier(.2,0,0,1),background-color .2s cubic-bezier(.2,0,0,1),color .2s cubic-bezier(.2,0,0,1),border-color .2s cubic-bezier(.2,0,0,1);display:inline-flex;position:relative;overflow:hidden}.ttdk-btn-m3--block{width:100%;display:flex}.ttdk-btn-m3:before{content:"";border-radius:inherit;opacity:0;pointer-events:none;background-color:currentColor;transition:opacity .2s cubic-bezier(.2,0,0,1);position:absolute;inset:0}.ttdk-btn-m3:hover:not(:disabled):before{opacity:.08}.ttdk-btn-m3:focus-visible:not(:disabled):before{opacity:.12}.ttdk-btn-m3:active:not(:disabled):before{opacity:.16}.ttdk-btn-m3:after{content:"";opacity:0;pointer-events:none;background:radial-gradient(circle,currentColor 10%,#0000 10.01%) 50% no-repeat;width:100%;height:100%;transition:transform .4s cubic-bezier(.2,0,0,1),opacity .8s cubic-bezier(.2,0,0,1);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)scale(8)}.ttdk-btn-m3:active:not(:disabled):after{opacity:.24;transition:all;transform:translate(-50%,-50%)scale(0)}.ttdk-btn-m3--sm{gap:6px;height:32px;min-height:32px;padding:0 16px;font-size:12px}.ttdk-btn-m3--md{gap:8px;height:40px;min-height:40px;padding:0 24px;font-size:14px}.ttdk-btn-m3--lg{gap:10px;height:48px;min-height:48px;padding:0 28px;font-size:16px}.ttdk-btn-m3--rounded{border-radius:12px!important}.ttdk-btn-m3--filled.ttdk-btn-m3--primary{background-color:var(--md-sys-color-primary,#006a60);color:var(--md-sys-color-on-primary,#fff)}.ttdk-btn-m3--filled.ttdk-btn-m3--secondary{background-color:var(--md-sys-color-secondary,#4a635f);color:#fff}.ttdk-btn-m3--filled.ttdk-btn-m3--tertiary{background-color:var(--md-sys-color-tertiary,#456179);color:#fff}.ttdk-btn-m3--filled.ttdk-btn-m3--error{background-color:var(--md-sys-color-error,#ba1a1a);color:#fff}.ttdk-btn-m3--filled:hover:not(:disabled){box-shadow:0 1px 3px 1px #00000026,0 1px 2px #0003}.ttdk-btn-m3--elevated{background-color:var(--md-sys-color-surface-container-low,#f7fbf8);box-shadow:0 1px 3px 1px #00000026,0 1px 2px #0003}.ttdk-btn-m3--elevated.ttdk-btn-m3--primary{color:var(--md-sys-color-primary,#006a60)}.ttdk-btn-m3--elevated.ttdk-btn-m3--secondary{color:var(--md-sys-color-secondary,#4a635f)}.ttdk-btn-m3--elevated.ttdk-btn-m3--tertiary{color:var(--md-sys-color-tertiary,#456179)}.ttdk-btn-m3--elevated.ttdk-btn-m3--error{color:var(--md-sys-color-error,#ba1a1a)}.ttdk-btn-m3--elevated:hover:not(:disabled){box-shadow:0 2px 6px 2px #00000026,0 1px 2px #00000040}.ttdk-btn-m3--tonal.ttdk-btn-m3--primary{background-color:var(--md-sys-color-secondary-container,#cce8e3);color:var(--md-sys-color-on-secondary-container,#05201d)}.ttdk-btn-m3--tonal.ttdk-btn-m3--secondary{color:#1e2a2e;background-color:#dbe4e6}.ttdk-btn-m3--tonal.ttdk-btn-m3--tertiary{color:#0b1d28;background-color:#d1e5f4}.ttdk-btn-m3--tonal.ttdk-btn-m3--error{color:#410002;background-color:#ffdad6}.ttdk-btn-m3--tonal:hover:not(:disabled){box-shadow:0 1px 3px 1px #0000001f,0 1px 2px #0000002e}.ttdk-btn-m3--outlined{border:1px solid var(--md-sys-color-outline,#707977);background-color:#0000}.ttdk-btn-m3--outlined.ttdk-btn-m3--primary{color:var(--md-sys-color-primary,#006a60)}.ttdk-btn-m3--outlined.ttdk-btn-m3--secondary{color:var(--md-sys-color-secondary,#4a635f)}.ttdk-btn-m3--outlined.ttdk-btn-m3--tertiary{color:var(--md-sys-color-tertiary,#456179)}.ttdk-btn-m3--outlined.ttdk-btn-m3--error{color:var(--md-sys-color-error,#ba1a1a);border-color:#ba1a1a}.ttdk-btn-m3--text{background-color:#0000;padding-left:12px;padding-right:12px}.ttdk-btn-m3--text.ttdk-btn-m3--primary{color:var(--md-sys-color-primary,#006a60)}.ttdk-btn-m3--text.ttdk-btn-m3--secondary{color:var(--md-sys-color-secondary,#4a635f)}.ttdk-btn-m3--text.ttdk-btn-m3--tertiary{color:var(--md-sys-color-tertiary,#456179)}.ttdk-btn-m3--text.ttdk-btn-m3--error{color:var(--md-sys-color-error,#ba1a1a)}.ttdk-btn-m3:disabled,.ttdk-btn-m3--disabled{opacity:.38!important;cursor:not-allowed!important;pointer-events:none!important;box-shadow:none!important}.ttdk-btn-m3--loading{cursor:wait}.ttdk-btn-m3__spinner{border:2.5px solid;border-right-color:#0000;border-radius:50%;width:1.1em;height:1.1em;animation:.75s cubic-bezier(.4,0,.2,1) infinite ttdk-m3-spin;display:inline-block}@keyframes ttdk-m3-spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
3
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
4
|
+
import { buildUiVars, UiProps } from "../../core/types";
|
|
5
|
+
export let id = void 0;
|
|
6
|
+
export let type = void 0;
|
|
7
|
+
export let disabled = void 0;
|
|
8
|
+
export let loading = void 0;
|
|
9
|
+
export let variant = void 0;
|
|
10
|
+
export let color = void 0;
|
|
11
|
+
export let size = void 0;
|
|
12
|
+
export let shape = void 0;
|
|
13
|
+
export let block = void 0;
|
|
14
|
+
export let ui = void 0;
|
|
15
|
+
const dispatch = createEventDispatcher();
|
|
16
|
+
export let onClick = void 0;
|
|
17
|
+
function stringifyStyles(stylesObj) {
|
|
18
|
+
let styles = "";
|
|
19
|
+
for (let key in stylesObj) {
|
|
20
|
+
const dashedKey = key.replace(/[A-Z]/g, function(match) {
|
|
21
|
+
return "-" + match.toLowerCase();
|
|
22
|
+
});
|
|
23
|
+
styles += dashedKey + ":" + stylesObj[key] + ";";
|
|
24
|
+
}
|
|
25
|
+
return styles;
|
|
26
|
+
}
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<button
|
|
30
|
+
style={stringifyStyles({
|
|
31
|
+
...buildUiVars(ui?.style),
|
|
32
|
+
})}
|
|
33
|
+
{id}
|
|
34
|
+
type={type || "button"}
|
|
35
|
+
disabled={disabled || loading}
|
|
36
|
+
class={"ttdk-btn-m3" +
|
|
37
|
+
" ttdk-btn-m3--" +
|
|
38
|
+
(variant || "filled") +
|
|
39
|
+
" ttdk-btn-m3--" +
|
|
40
|
+
(color || "primary") +
|
|
41
|
+
" ttdk-btn-m3--" +
|
|
42
|
+
(size || "md") +
|
|
43
|
+
(shape === "rounded" ? " ttdk-btn-m3--rounded" : "") +
|
|
44
|
+
(block ? " ttdk-btn-m3--block" : "") +
|
|
45
|
+
(loading ? " ttdk-btn-m3--loading" : "") +
|
|
46
|
+
(disabled ? " ttdk-btn-m3--disabled" : "") +
|
|
47
|
+
(ui?.class ? " " + ui.class : "")}
|
|
48
|
+
on:click={(e) => {
|
|
49
|
+
if (!disabled && !loading && onClick) {
|
|
50
|
+
onClick(e);
|
|
51
|
+
dispatch("click", e);
|
|
52
|
+
}
|
|
53
|
+
}}
|
|
54
|
+
>
|
|
55
|
+
{#if loading}
|
|
56
|
+
<span class="ttdk-btn-m3__spinner" aria-hidden="true" />
|
|
57
|
+
{/if}<slot /></button
|
|
58
|
+
>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { SvelteComponent } from "svelte";
|
|
2
|
+
export type ButtonMaterialUiProps = UiProps;
|
|
3
|
+
export interface ButtonMaterialProps {
|
|
4
|
+
/**
|
|
5
|
+
* Inline CSS style kustom.
|
|
6
|
+
*/
|
|
7
|
+
style?: any;
|
|
8
|
+
/**
|
|
9
|
+
* 5 Tipe tombol resmi Material Design 3 (M3):
|
|
10
|
+
* - `'filled'`: Tombol kontainer warna primer pekat (high emphasis, default).
|
|
11
|
+
* - `'elevated'`: Tombol berlatar surface dengan bayangan elevasi level 1.
|
|
12
|
+
* - `'tonal'`: Tombol warna kontainer sekunder (medium-high emphasis).
|
|
13
|
+
* - `'outlined'`: Tombol bergaris tepi 1px dengan latar transparan.
|
|
14
|
+
* - `'text'`: Tombol teks tanpa latar dan border (low emphasis).
|
|
15
|
+
*
|
|
16
|
+
* @default 'filled'
|
|
17
|
+
*/
|
|
18
|
+
variant?: "filled" | "elevated" | "tonal" | "outlined" | "text";
|
|
19
|
+
/**
|
|
20
|
+
* Skema peran warna Material 3:
|
|
21
|
+
* - `'primary'`: Warna tema primer (M3 Primary).
|
|
22
|
+
* - `'secondary'`: Warna tema sekunder (M3 Secondary).
|
|
23
|
+
* - `'tertiary'`: Warna tema tersier (M3 Tertiary).
|
|
24
|
+
* - `'error'`: Warna peringatan / bahaya (M3 Error).
|
|
25
|
+
*
|
|
26
|
+
* @default 'primary'
|
|
27
|
+
*/
|
|
28
|
+
color?: "primary" | "secondary" | "tertiary" | "error";
|
|
29
|
+
/**
|
|
30
|
+
* Skala ukuran tombol M3:
|
|
31
|
+
* - `'sm'`: 32px (compact)
|
|
32
|
+
* - `'md'`: 40px (standar M3 spec)
|
|
33
|
+
* - `'lg'`: 48px (large touch target)
|
|
34
|
+
*
|
|
35
|
+
* @default 'md'
|
|
36
|
+
*/
|
|
37
|
+
size?: "sm" | "md" | "lg";
|
|
38
|
+
/**
|
|
39
|
+
* Bentuk sudut kontainer:
|
|
40
|
+
* - `'pill'`: Full rounded pill khas Material 3 (border-radius: 9999px).
|
|
41
|
+
* - `'rounded'`: Sudut membulat medium (~12px).
|
|
42
|
+
*
|
|
43
|
+
* @default 'pill'
|
|
44
|
+
*/
|
|
45
|
+
shape?: "pill" | "rounded";
|
|
46
|
+
/**
|
|
47
|
+
* Tipe tombol HTML native.
|
|
48
|
+
* @default 'button'
|
|
49
|
+
*/
|
|
50
|
+
type?: "button" | "submit" | "reset";
|
|
51
|
+
/**
|
|
52
|
+
* Kondisi non-aktif tombol.
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Menampilkan spinner loading M3.
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
loading?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Lebar penuh 100% mengikuti kontainer induk.
|
|
63
|
+
* @default false
|
|
64
|
+
*/
|
|
65
|
+
block?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* ID unik elemen HTML.
|
|
68
|
+
*/
|
|
69
|
+
id?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Konfigurasi styling kustom UI.
|
|
72
|
+
*/
|
|
73
|
+
ui?: ButtonMaterialUiProps;
|
|
74
|
+
/**
|
|
75
|
+
* Callback saat tombol ditekan / diklik.
|
|
76
|
+
*/
|
|
77
|
+
onClick?: (event: any) => void;
|
|
78
|
+
/**
|
|
79
|
+
* Konten label / elemen di dalam tombol.
|
|
80
|
+
*/
|
|
81
|
+
children?: any;
|
|
82
|
+
}
|
|
83
|
+
import { UiProps } from "../../core/types";
|
|
84
|
+
declare const __propDef: {
|
|
85
|
+
props: {
|
|
86
|
+
id?: ButtonMaterialProps["id"];
|
|
87
|
+
type?: ButtonMaterialProps["type"];
|
|
88
|
+
disabled?: ButtonMaterialProps["disabled"];
|
|
89
|
+
loading?: ButtonMaterialProps["loading"];
|
|
90
|
+
variant?: ButtonMaterialProps["variant"];
|
|
91
|
+
color?: ButtonMaterialProps["color"];
|
|
92
|
+
size?: ButtonMaterialProps["size"];
|
|
93
|
+
shape?: ButtonMaterialProps["shape"];
|
|
94
|
+
block?: ButtonMaterialProps["block"];
|
|
95
|
+
ui?: ButtonMaterialProps["ui"];
|
|
96
|
+
onClick?: ButtonMaterialProps["onClick"];
|
|
97
|
+
};
|
|
98
|
+
events: {
|
|
99
|
+
click: CustomEvent<any>;
|
|
100
|
+
} & {
|
|
101
|
+
[evt: string]: CustomEvent<any>;
|
|
102
|
+
};
|
|
103
|
+
slots: {
|
|
104
|
+
default: {};
|
|
105
|
+
};
|
|
106
|
+
exports?: {} | undefined;
|
|
107
|
+
bindings?: string | undefined;
|
|
108
|
+
};
|
|
109
|
+
type ButtonMaterialProps_ = typeof __propDef.props;
|
|
110
|
+
export type ButtonMaterialEvents = typeof __propDef.events;
|
|
111
|
+
export type ButtonMaterialSlots = typeof __propDef.slots;
|
|
112
|
+
export default class ButtonMaterial extends SvelteComponent<ButtonMaterialProps_, ButtonMaterialEvents, ButtonMaterialSlots> {
|
|
113
|
+
}
|
|
114
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as ButtonIos } from './button-ios.svelte';
|
|
2
|
+
export type { ButtonIosProps, ButtonIosUiProps } from './button-ios.svelte';
|
|
3
|
+
export * from './button-ios.svelte';
|
|
4
|
+
export { default as ButtonMaterial } from './button-material.svelte';
|
|
5
|
+
export type { ButtonMaterialProps, ButtonMaterialUiProps } from './button-material.svelte';
|
|
6
|
+
export * from './button-material.svelte';
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ttdk-design-system/button",
|
|
3
|
+
"component": "ButtonMaterial",
|
|
4
|
+
"folder": "button",
|
|
5
|
+
"description": "TTDK ButtonMaterial component with multi-theme support.",
|
|
6
|
+
"stylesheets": [
|
|
7
|
+
{
|
|
8
|
+
"theme": "common",
|
|
9
|
+
"file": "button-ios.css",
|
|
10
|
+
"importPath": "webview/button/button-ios.css"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"theme": "common",
|
|
14
|
+
"file": "button-material.css",
|
|
15
|
+
"importPath": "webview/button/button-material.css"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"props": {},
|
|
19
|
+
"subInterfaces": {
|
|
20
|
+
"ButtonMaterialProps": {
|
|
21
|
+
"style": {
|
|
22
|
+
"name": "style",
|
|
23
|
+
"type": "any",
|
|
24
|
+
"optional": true,
|
|
25
|
+
"default": null,
|
|
26
|
+
"description": "Inline CSS style kustom.",
|
|
27
|
+
"example": null,
|
|
28
|
+
"param": null
|
|
29
|
+
},
|
|
30
|
+
"variant": {
|
|
31
|
+
"name": "variant",
|
|
32
|
+
"type": "'filled' | 'elevated' | 'tonal' | 'outlined' | 'text'",
|
|
33
|
+
"optional": true,
|
|
34
|
+
"default": "filled",
|
|
35
|
+
"description": "5 Tipe tombol resmi Material Design 3 (M3): - `'filled'`: Tombol kontainer warna primer pekat (high emphasis, default). - `'elevated'`: Tombol berlatar surface dengan bayangan elevasi level 1. - `'tonal'`: Tombol warna kontainer sekunder (medium-high emphasis). - `'outlined'`: Tombol bergaris tepi 1px dengan latar transparan. - `'text'`: Tombol teks tanpa latar dan border (low emphasis).",
|
|
36
|
+
"example": null,
|
|
37
|
+
"param": null
|
|
38
|
+
},
|
|
39
|
+
"color": {
|
|
40
|
+
"name": "color",
|
|
41
|
+
"type": "'primary' | 'secondary' | 'tertiary' | 'error'",
|
|
42
|
+
"optional": true,
|
|
43
|
+
"default": "primary",
|
|
44
|
+
"description": "Skema peran warna Material 3: - `'primary'`: Warna tema primer (M3 Primary). - `'secondary'`: Warna tema sekunder (M3 Secondary). - `'tertiary'`: Warna tema tersier (M3 Tertiary). - `'error'`: Warna peringatan / bahaya (M3 Error).",
|
|
45
|
+
"example": null,
|
|
46
|
+
"param": null
|
|
47
|
+
},
|
|
48
|
+
"size": {
|
|
49
|
+
"name": "size",
|
|
50
|
+
"type": "'sm' | 'md' | 'lg'",
|
|
51
|
+
"optional": true,
|
|
52
|
+
"default": "md",
|
|
53
|
+
"description": "Skala ukuran tombol M3: - `'sm'`: 32px (compact) - `'md'`: 40px (standar M3 spec) - `'lg'`: 48px (large touch target)",
|
|
54
|
+
"example": null,
|
|
55
|
+
"param": null
|
|
56
|
+
},
|
|
57
|
+
"shape": {
|
|
58
|
+
"name": "shape",
|
|
59
|
+
"type": "'pill' | 'rounded'",
|
|
60
|
+
"optional": true,
|
|
61
|
+
"default": "pill",
|
|
62
|
+
"description": "Bentuk sudut kontainer: - `'pill'`: Full rounded pill khas Material 3 (border-radius: 9999px). - `'rounded'`: Sudut membulat medium (~12px).",
|
|
63
|
+
"example": null,
|
|
64
|
+
"param": null
|
|
65
|
+
},
|
|
66
|
+
"type": {
|
|
67
|
+
"name": "type",
|
|
68
|
+
"type": "'button' | 'submit' | 'reset'",
|
|
69
|
+
"optional": true,
|
|
70
|
+
"default": "button",
|
|
71
|
+
"description": "Tipe tombol HTML native.",
|
|
72
|
+
"example": null,
|
|
73
|
+
"param": null
|
|
74
|
+
},
|
|
75
|
+
"disabled": {
|
|
76
|
+
"name": "disabled",
|
|
77
|
+
"type": "boolean",
|
|
78
|
+
"optional": true,
|
|
79
|
+
"default": "false",
|
|
80
|
+
"description": "Kondisi non-aktif tombol.",
|
|
81
|
+
"example": null,
|
|
82
|
+
"param": null
|
|
83
|
+
},
|
|
84
|
+
"loading": {
|
|
85
|
+
"name": "loading",
|
|
86
|
+
"type": "boolean",
|
|
87
|
+
"optional": true,
|
|
88
|
+
"default": "false",
|
|
89
|
+
"description": "Menampilkan spinner loading M3.",
|
|
90
|
+
"example": null,
|
|
91
|
+
"param": null
|
|
92
|
+
},
|
|
93
|
+
"block": {
|
|
94
|
+
"name": "block",
|
|
95
|
+
"type": "boolean",
|
|
96
|
+
"optional": true,
|
|
97
|
+
"default": "false",
|
|
98
|
+
"description": "Lebar penuh 100% mengikuti kontainer induk.",
|
|
99
|
+
"example": null,
|
|
100
|
+
"param": null
|
|
101
|
+
},
|
|
102
|
+
"id": {
|
|
103
|
+
"name": "id",
|
|
104
|
+
"type": "string",
|
|
105
|
+
"optional": true,
|
|
106
|
+
"default": null,
|
|
107
|
+
"description": "ID unik elemen HTML.",
|
|
108
|
+
"example": null,
|
|
109
|
+
"param": null
|
|
110
|
+
},
|
|
111
|
+
"ui": {
|
|
112
|
+
"name": "ui",
|
|
113
|
+
"type": "ButtonMaterialUiProps",
|
|
114
|
+
"optional": true,
|
|
115
|
+
"default": null,
|
|
116
|
+
"description": "Konfigurasi styling kustom UI.",
|
|
117
|
+
"example": null,
|
|
118
|
+
"param": null
|
|
119
|
+
},
|
|
120
|
+
"onClick": {
|
|
121
|
+
"name": "onClick",
|
|
122
|
+
"type": "(event: any) => void",
|
|
123
|
+
"optional": true,
|
|
124
|
+
"default": null,
|
|
125
|
+
"description": "Callback saat tombol ditekan / diklik.",
|
|
126
|
+
"example": null,
|
|
127
|
+
"param": null
|
|
128
|
+
},
|
|
129
|
+
"children": {
|
|
130
|
+
"name": "children",
|
|
131
|
+
"type": "any",
|
|
132
|
+
"optional": true,
|
|
133
|
+
"default": null,
|
|
134
|
+
"description": "Konten label / elemen di dalam tombol.",
|
|
135
|
+
"example": null,
|
|
136
|
+
"param": null
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"supportedFrameworks": [
|
|
141
|
+
"react",
|
|
142
|
+
"vue",
|
|
143
|
+
"svelte"
|
|
144
|
+
],
|
|
145
|
+
"themes": [
|
|
146
|
+
"tw"
|
|
147
|
+
]
|
|
148
|
+
}
|