@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,783 @@
|
|
|
1
|
+
<script context="module"></script>
|
|
2
|
+
|
|
3
|
+
<script>import { buildUiVars, UiProps } from "../../core/types";
|
|
4
|
+
export let value = void 0;
|
|
5
|
+
export let defaultValue = void 0;
|
|
6
|
+
export let withoutButton = void 0;
|
|
7
|
+
export let controls = void 0;
|
|
8
|
+
export let step = void 0;
|
|
9
|
+
export let precision = void 0;
|
|
10
|
+
export let thousandSeparator = void 0;
|
|
11
|
+
export let type = void 0;
|
|
12
|
+
export let disabled = void 0;
|
|
13
|
+
export let readOnly = void 0;
|
|
14
|
+
export let loading = void 0;
|
|
15
|
+
export let max = void 0;
|
|
16
|
+
export let min = void 0;
|
|
17
|
+
export let onValueChange = void 0;
|
|
18
|
+
export let onChange = void 0;
|
|
19
|
+
export let name = void 0;
|
|
20
|
+
export let id = void 0;
|
|
21
|
+
export let onInput = void 0;
|
|
22
|
+
export let onBlur = void 0;
|
|
23
|
+
export let onCopy = void 0;
|
|
24
|
+
export let onCut = void 0;
|
|
25
|
+
export let onKeyDown = void 0;
|
|
26
|
+
export let allowExponential = void 0;
|
|
27
|
+
export let className = void 0;
|
|
28
|
+
export let error = void 0;
|
|
29
|
+
export let errorMessage = void 0;
|
|
30
|
+
export let size = void 0;
|
|
31
|
+
export let block = void 0;
|
|
32
|
+
export let ui = void 0;
|
|
33
|
+
export let label = void 0;
|
|
34
|
+
export let labelClass = void 0;
|
|
35
|
+
export let labelStyle = void 0;
|
|
36
|
+
export let required = void 0;
|
|
37
|
+
export let optional = void 0;
|
|
38
|
+
export let optionalText = void 0;
|
|
39
|
+
export let helperText = void 0;
|
|
40
|
+
export let helperTextPosition = void 0;
|
|
41
|
+
export let helperTextClass = void 0;
|
|
42
|
+
export let helperTextStyle = void 0;
|
|
43
|
+
export let wrapperClass = void 0;
|
|
44
|
+
export let rounded = void 0;
|
|
45
|
+
export let controlsPosition = void 0;
|
|
46
|
+
export let wrapperStyle = void 0;
|
|
47
|
+
export let addonLeft = void 0;
|
|
48
|
+
export let iconLeft = void 0;
|
|
49
|
+
export let inputRef = void 0;
|
|
50
|
+
export let inputClass = void 0;
|
|
51
|
+
export let placeholder = void 0;
|
|
52
|
+
export let autoComplete = void 0;
|
|
53
|
+
export let maxLength = void 0;
|
|
54
|
+
export let minLength = void 0;
|
|
55
|
+
export let inputStyle = void 0;
|
|
56
|
+
export let onFocus = void 0;
|
|
57
|
+
export let onKeyUp = void 0;
|
|
58
|
+
export let iconRight = void 0;
|
|
59
|
+
export let controlsClass = void 0;
|
|
60
|
+
export let controlsStyle = void 0;
|
|
61
|
+
export let addonRight = void 0;
|
|
62
|
+
export let errorMessageClass = void 0;
|
|
63
|
+
export let errorMessageStyle = void 0;
|
|
64
|
+
function stringifyStyles(stylesObj) {
|
|
65
|
+
let styles = "";
|
|
66
|
+
for (let key in stylesObj) {
|
|
67
|
+
const dashedKey = key.replace(/[A-Z]/g, function(match) {
|
|
68
|
+
return "-" + match.toLowerCase();
|
|
69
|
+
});
|
|
70
|
+
styles += dashedKey + ":" + stylesObj[key] + ";";
|
|
71
|
+
}
|
|
72
|
+
return styles;
|
|
73
|
+
}
|
|
74
|
+
function shouldShowControls() {
|
|
75
|
+
if (withoutButton) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
return controls !== false;
|
|
79
|
+
}
|
|
80
|
+
function getStep() {
|
|
81
|
+
return step !== void 0 ? step : 1;
|
|
82
|
+
}
|
|
83
|
+
function getPrecision() {
|
|
84
|
+
if (precision !== void 0) {
|
|
85
|
+
return precision;
|
|
86
|
+
}
|
|
87
|
+
if (step !== void 0) {
|
|
88
|
+
const stepVal = step;
|
|
89
|
+
const stepStr = String(stepVal);
|
|
90
|
+
const dotIdx = stepStr.indexOf(".");
|
|
91
|
+
return dotIdx === -1 ? 0 : stepStr.length - dotIdx - 1;
|
|
92
|
+
}
|
|
93
|
+
return -1;
|
|
94
|
+
}
|
|
95
|
+
function getThousandSep() {
|
|
96
|
+
return thousandSeparator ? "." : "";
|
|
97
|
+
}
|
|
98
|
+
function getInputType() {
|
|
99
|
+
if (type)
|
|
100
|
+
return type;
|
|
101
|
+
return "text";
|
|
102
|
+
}
|
|
103
|
+
function getInputMode() {
|
|
104
|
+
return getPrecision() === 0 ? "numeric" : "decimal";
|
|
105
|
+
}
|
|
106
|
+
function parseToRawNumber(displayVal) {
|
|
107
|
+
if (displayVal === void 0 || displayVal === null || displayVal === "") {
|
|
108
|
+
return "";
|
|
109
|
+
}
|
|
110
|
+
if (typeof displayVal === "number") {
|
|
111
|
+
return String(displayVal);
|
|
112
|
+
}
|
|
113
|
+
let s = String(displayVal).trim();
|
|
114
|
+
if (s === "-" || s === "")
|
|
115
|
+
return s;
|
|
116
|
+
let isNegative = false;
|
|
117
|
+
if (s.startsWith("-")) {
|
|
118
|
+
isNegative = true;
|
|
119
|
+
s = s.slice(1);
|
|
120
|
+
}
|
|
121
|
+
s = s.replace(/\./g, "");
|
|
122
|
+
s = s.replace(/,/g, ".");
|
|
123
|
+
s = s.replace(/[^0-9.]/g, "");
|
|
124
|
+
const dotIndex = s.indexOf(".");
|
|
125
|
+
if (dotIndex !== -1) {
|
|
126
|
+
s = s.slice(0, dotIndex + 1) + s.slice(dotIndex + 1).replace(/\./g, "");
|
|
127
|
+
}
|
|
128
|
+
return (isNegative ? "-" : "") + s;
|
|
129
|
+
}
|
|
130
|
+
function formatValue(rawVal) {
|
|
131
|
+
if (rawVal === void 0 || rawVal === null || rawVal === "") {
|
|
132
|
+
return "";
|
|
133
|
+
}
|
|
134
|
+
const strVal = String(rawVal);
|
|
135
|
+
if (strVal === "-")
|
|
136
|
+
return "-";
|
|
137
|
+
const thSep = getThousandSep();
|
|
138
|
+
let isNegative = false;
|
|
139
|
+
let clean = strVal;
|
|
140
|
+
if (clean.startsWith("-")) {
|
|
141
|
+
isNegative = true;
|
|
142
|
+
clean = clean.slice(1);
|
|
143
|
+
}
|
|
144
|
+
let intPart = clean;
|
|
145
|
+
let decPart = "";
|
|
146
|
+
let hasDecimal = false;
|
|
147
|
+
if (clean.includes(".")) {
|
|
148
|
+
hasDecimal = true;
|
|
149
|
+
const parts = clean.split(".");
|
|
150
|
+
intPart = parts[0];
|
|
151
|
+
decPart = parts.slice(1).join("");
|
|
152
|
+
} else if (clean.includes(",")) {
|
|
153
|
+
hasDecimal = true;
|
|
154
|
+
const parts = clean.split(",");
|
|
155
|
+
intPart = parts[0];
|
|
156
|
+
decPart = parts.slice(1).join("");
|
|
157
|
+
}
|
|
158
|
+
const formattedInt = thSep ? intPart.replace(/\B(?=(\d{3})+(?!\d))/g, thSep) : intPart;
|
|
159
|
+
let result = (isNegative ? "-" : "") + (formattedInt || (hasDecimal ? "0" : ""));
|
|
160
|
+
if (hasDecimal) {
|
|
161
|
+
result += "," + decPart;
|
|
162
|
+
}
|
|
163
|
+
return result;
|
|
164
|
+
}
|
|
165
|
+
function getRawValue() {
|
|
166
|
+
if (value !== void 0) {
|
|
167
|
+
if (innerValue === "-") {
|
|
168
|
+
return "-";
|
|
169
|
+
}
|
|
170
|
+
if (value === void 0 || value === null || value === "") {
|
|
171
|
+
return "";
|
|
172
|
+
}
|
|
173
|
+
if (typeof innerValue === "string" && (innerValue.includes(".") || innerValue.includes(",") || innerValue === "-")) {
|
|
174
|
+
const innerNum = Number(parseToRawNumber(innerValue));
|
|
175
|
+
const propNum = Number(value);
|
|
176
|
+
if (innerNum === propNum) {
|
|
177
|
+
return innerValue;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return value;
|
|
181
|
+
}
|
|
182
|
+
return innerValue !== void 0 && innerValue !== null ? innerValue : "";
|
|
183
|
+
}
|
|
184
|
+
function getDisplayValue() {
|
|
185
|
+
const raw = getRawValue();
|
|
186
|
+
if (raw === void 0 || raw === null || raw === "")
|
|
187
|
+
return "";
|
|
188
|
+
if (raw === "-")
|
|
189
|
+
return "-";
|
|
190
|
+
return formatValue(raw);
|
|
191
|
+
}
|
|
192
|
+
function getCurrentNumber() {
|
|
193
|
+
const raw = getRawValue();
|
|
194
|
+
if (raw === void 0 || raw === null || raw === "")
|
|
195
|
+
return void 0;
|
|
196
|
+
const parsed = parseToRawNumber(raw);
|
|
197
|
+
if (parsed === "" || parsed === "-")
|
|
198
|
+
return void 0;
|
|
199
|
+
const num = Number(parsed);
|
|
200
|
+
return isNaN(num) ? void 0 : num;
|
|
201
|
+
}
|
|
202
|
+
function canIncrement() {
|
|
203
|
+
if (disabled || readOnly || loading)
|
|
204
|
+
return false;
|
|
205
|
+
const num = getCurrentNumber();
|
|
206
|
+
if (max !== void 0 && num !== void 0) {
|
|
207
|
+
return num < max;
|
|
208
|
+
}
|
|
209
|
+
return true;
|
|
210
|
+
}
|
|
211
|
+
function canDecrement() {
|
|
212
|
+
if (disabled || readOnly || loading)
|
|
213
|
+
return false;
|
|
214
|
+
const num = getCurrentNumber();
|
|
215
|
+
if (min !== void 0 && num !== void 0) {
|
|
216
|
+
return num > min;
|
|
217
|
+
}
|
|
218
|
+
return true;
|
|
219
|
+
}
|
|
220
|
+
function clamp(val) {
|
|
221
|
+
let result = val;
|
|
222
|
+
if (min !== void 0 && result < min) {
|
|
223
|
+
result = min;
|
|
224
|
+
}
|
|
225
|
+
if (max !== void 0 && result > max) {
|
|
226
|
+
result = max;
|
|
227
|
+
}
|
|
228
|
+
const prec = getPrecision();
|
|
229
|
+
if (prec > 0) {
|
|
230
|
+
const factor = Math.pow(10, prec);
|
|
231
|
+
result = Math.round(result * factor) / factor;
|
|
232
|
+
} else if (prec === 0 && precision === 0) {
|
|
233
|
+
result = Math.round(result);
|
|
234
|
+
}
|
|
235
|
+
return result;
|
|
236
|
+
}
|
|
237
|
+
function emitValue(nextVal) {
|
|
238
|
+
innerValue = nextVal;
|
|
239
|
+
const rawParsed = typeof nextVal === "string" ? parseToRawNumber(nextVal) : nextVal;
|
|
240
|
+
const numVal = typeof rawParsed === "number" ? rawParsed : rawParsed === "" || rawParsed === "-" ? void 0 : Number(rawParsed);
|
|
241
|
+
const safeNumVal = numVal !== void 0 && isNaN(numVal) ? void 0 : numVal;
|
|
242
|
+
if (onValueChange) {
|
|
243
|
+
onValueChange(safeNumVal);
|
|
244
|
+
}
|
|
245
|
+
if (onChange) {
|
|
246
|
+
const syntheticEvent = {
|
|
247
|
+
target: {
|
|
248
|
+
value: rawParsed,
|
|
249
|
+
valueAsNumber: safeNumVal,
|
|
250
|
+
name,
|
|
251
|
+
id
|
|
252
|
+
},
|
|
253
|
+
currentTarget: {
|
|
254
|
+
value: rawParsed,
|
|
255
|
+
valueAsNumber: safeNumVal
|
|
256
|
+
},
|
|
257
|
+
type: "change",
|
|
258
|
+
value: rawParsed
|
|
259
|
+
};
|
|
260
|
+
onChange(syntheticEvent);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
function stepUp() {
|
|
264
|
+
if (!canIncrement())
|
|
265
|
+
return;
|
|
266
|
+
const current = getCurrentNumber();
|
|
267
|
+
const step2 = getStep();
|
|
268
|
+
const base = current !== void 0 ? current : min !== void 0 ? min : 0;
|
|
269
|
+
const next = clamp(base + step2);
|
|
270
|
+
emitValue(next);
|
|
271
|
+
}
|
|
272
|
+
function stepDown() {
|
|
273
|
+
if (!canDecrement())
|
|
274
|
+
return;
|
|
275
|
+
const current = getCurrentNumber();
|
|
276
|
+
const step2 = getStep();
|
|
277
|
+
const base = current !== void 0 ? current : min !== void 0 ? min : 0;
|
|
278
|
+
const next = clamp(base - step2);
|
|
279
|
+
emitValue(next);
|
|
280
|
+
}
|
|
281
|
+
function handleInput(e) {
|
|
282
|
+
const input = e.target;
|
|
283
|
+
const inputValue = input ? input.value : "";
|
|
284
|
+
const raw = parseToRawNumber(inputValue);
|
|
285
|
+
if (getThousandSep()) {
|
|
286
|
+
const cursorPos = input && input.selectionEnd || inputValue.length;
|
|
287
|
+
let validCharsBeforeCursor = 0;
|
|
288
|
+
for (let i = 0; i < cursorPos; i++) {
|
|
289
|
+
const ch = inputValue[i];
|
|
290
|
+
if (/\d/.test(ch) || ch === "-" || ch === ",") {
|
|
291
|
+
validCharsBeforeCursor++;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
const formatted = formatValue(raw);
|
|
295
|
+
innerValue = raw;
|
|
296
|
+
emitValue(raw);
|
|
297
|
+
if (input && typeof input.setSelectionRange === "function") {
|
|
298
|
+
let newCursorPos = 0;
|
|
299
|
+
let count = 0;
|
|
300
|
+
for (let i = 0; i < formatted.length; i++) {
|
|
301
|
+
const ch = formatted[i];
|
|
302
|
+
if (/\d/.test(ch) || ch === "-" || ch === ",") {
|
|
303
|
+
count++;
|
|
304
|
+
}
|
|
305
|
+
if (count >= validCharsBeforeCursor) {
|
|
306
|
+
newCursorPos = i + 1;
|
|
307
|
+
break;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
if (count < validCharsBeforeCursor) {
|
|
311
|
+
newCursorPos = formatted.length;
|
|
312
|
+
}
|
|
313
|
+
input.value = formatted;
|
|
314
|
+
try {
|
|
315
|
+
input.setSelectionRange(newCursorPos, newCursorPos);
|
|
316
|
+
} catch (err) {
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
} else {
|
|
320
|
+
innerValue = raw;
|
|
321
|
+
emitValue(raw);
|
|
322
|
+
}
|
|
323
|
+
if (onInput) {
|
|
324
|
+
onInput(e);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
function handleChange(e) {
|
|
328
|
+
handleInput(e);
|
|
329
|
+
}
|
|
330
|
+
function handleBlur(e) {
|
|
331
|
+
const current = getCurrentNumber();
|
|
332
|
+
if (current !== void 0) {
|
|
333
|
+
const clamped = clamp(current);
|
|
334
|
+
if (clamped !== current) {
|
|
335
|
+
emitValue(clamped);
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
if (onBlur) {
|
|
339
|
+
onBlur(e);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
function handleCopy(e) {
|
|
343
|
+
const input = e.target;
|
|
344
|
+
if (!input)
|
|
345
|
+
return;
|
|
346
|
+
const start = input.selectionStart;
|
|
347
|
+
const end = input.selectionEnd;
|
|
348
|
+
if (start === null || end === null || start === end)
|
|
349
|
+
return;
|
|
350
|
+
const selectedText = input.value.substring(start, end);
|
|
351
|
+
if (!selectedText)
|
|
352
|
+
return;
|
|
353
|
+
const cleanText = selectedText.replace(/\./g, "");
|
|
354
|
+
if (e.clipboardData) {
|
|
355
|
+
e.clipboardData.setData("text/plain", cleanText);
|
|
356
|
+
e.preventDefault();
|
|
357
|
+
}
|
|
358
|
+
if (onCopy) {
|
|
359
|
+
onCopy(e);
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
function handleCut(e) {
|
|
363
|
+
if (disabled || readOnly) {
|
|
364
|
+
e.preventDefault();
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
const input = e.target;
|
|
368
|
+
if (!input)
|
|
369
|
+
return;
|
|
370
|
+
const start = input.selectionStart;
|
|
371
|
+
const end = input.selectionEnd;
|
|
372
|
+
if (start === null || end === null || start === end)
|
|
373
|
+
return;
|
|
374
|
+
const selectedText = input.value.substring(start, end);
|
|
375
|
+
if (!selectedText)
|
|
376
|
+
return;
|
|
377
|
+
const cleanText = selectedText.replace(/\./g, "");
|
|
378
|
+
if (e.clipboardData) {
|
|
379
|
+
e.clipboardData.setData("text/plain", cleanText);
|
|
380
|
+
e.preventDefault();
|
|
381
|
+
}
|
|
382
|
+
const val = input.value || "";
|
|
383
|
+
const nextVal = val.slice(0, start) + val.slice(end);
|
|
384
|
+
const raw = parseToRawNumber(nextVal);
|
|
385
|
+
innerValue = raw;
|
|
386
|
+
emitValue(raw);
|
|
387
|
+
const formatted = formatValue(raw);
|
|
388
|
+
input.value = formatted;
|
|
389
|
+
try {
|
|
390
|
+
input.setSelectionRange(start, start);
|
|
391
|
+
} catch (err) {
|
|
392
|
+
}
|
|
393
|
+
if (onCut) {
|
|
394
|
+
onCut(e);
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
function handleKeyDown(e) {
|
|
398
|
+
if (e.key === "Backspace" || e.key === "Delete" || e.key === "Tab" || e.key === "Escape" || e.key === "Enter" || e.key === "ArrowLeft" || e.key === "ArrowRight" || e.key === "Home" || e.key === "End" || e.key === "PageUp" || e.key === "PageDown" || e.ctrlKey || e.metaKey || e.altKey || e.key.length > 1) {
|
|
399
|
+
if (onKeyDown) {
|
|
400
|
+
onKeyDown(e);
|
|
401
|
+
}
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
if (e.key === "ArrowUp") {
|
|
405
|
+
e.preventDefault();
|
|
406
|
+
stepUp();
|
|
407
|
+
if (onKeyDown)
|
|
408
|
+
onKeyDown(e);
|
|
409
|
+
return;
|
|
410
|
+
}
|
|
411
|
+
if (e.key === "ArrowDown") {
|
|
412
|
+
e.preventDefault();
|
|
413
|
+
stepDown();
|
|
414
|
+
if (onKeyDown)
|
|
415
|
+
onKeyDown(e);
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
if (e.key === "e" || e.key === "E") {
|
|
419
|
+
if (!allowExponential) {
|
|
420
|
+
e.preventDefault();
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
if (e.key === "+") {
|
|
425
|
+
e.preventDefault();
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
if (e.key === "-") {
|
|
429
|
+
if (min !== void 0 && min >= 0) {
|
|
430
|
+
e.preventDefault();
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
const input = e.target;
|
|
434
|
+
const val = input ? input.value : "";
|
|
435
|
+
if (val.startsWith("-")) {
|
|
436
|
+
e.preventDefault();
|
|
437
|
+
const positiveVal = val.slice(1);
|
|
438
|
+
const raw = parseToRawNumber(positiveVal);
|
|
439
|
+
innerValue = raw;
|
|
440
|
+
emitValue(raw);
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
443
|
+
if (val && input && (input.selectionStart === null || input.selectionStart > 0)) {
|
|
444
|
+
e.preventDefault();
|
|
445
|
+
const negativeVal = "-" + val;
|
|
446
|
+
const raw = parseToRawNumber(negativeVal);
|
|
447
|
+
innerValue = raw;
|
|
448
|
+
emitValue(raw);
|
|
449
|
+
return;
|
|
450
|
+
}
|
|
451
|
+
if (onKeyDown)
|
|
452
|
+
onKeyDown(e);
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
if (e.key === ",") {
|
|
456
|
+
if (precision === 0) {
|
|
457
|
+
e.preventDefault();
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
const input = e.target;
|
|
461
|
+
const val = input ? input.value : "";
|
|
462
|
+
if (val.includes(",")) {
|
|
463
|
+
e.preventDefault();
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
466
|
+
if (onKeyDown)
|
|
467
|
+
onKeyDown(e);
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
if (e.key === ".") {
|
|
471
|
+
if (onKeyDown)
|
|
472
|
+
onKeyDown(e);
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
475
|
+
if (!/^[0-9]$/.test(e.key)) {
|
|
476
|
+
e.preventDefault();
|
|
477
|
+
return;
|
|
478
|
+
}
|
|
479
|
+
if (onKeyDown) {
|
|
480
|
+
onKeyDown(e);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
483
|
+
let innerValue = value !== void 0 ? value : defaultValue !== void 0 ? defaultValue : "";
|
|
484
|
+
</script>
|
|
485
|
+
|
|
486
|
+
<div
|
|
487
|
+
style={stringifyStyles({
|
|
488
|
+
...buildUiVars(ui),
|
|
489
|
+
...(ui || {}),
|
|
490
|
+
})}
|
|
491
|
+
class={`ttdk-form-item ${className || ""}`.trim()}
|
|
492
|
+
data-disabled={disabled}
|
|
493
|
+
data-error={Boolean(error || errorMessage)}
|
|
494
|
+
data-size={size || "md"}
|
|
495
|
+
data-block={block ? "true" : undefined}
|
|
496
|
+
>
|
|
497
|
+
{#if label}
|
|
498
|
+
<label
|
|
499
|
+
style={stringifyStyles({
|
|
500
|
+
...buildUiVars(labelStyle),
|
|
501
|
+
...(labelStyle || {}),
|
|
502
|
+
})}
|
|
503
|
+
class={`ttdk-form-label ${labelClass || ""}`.trim()}
|
|
504
|
+
for={id}
|
|
505
|
+
><span>{label}</span>
|
|
506
|
+
{#if required}
|
|
507
|
+
<span class="ttdk-form-required" aria-hidden="true"> * </span>
|
|
508
|
+
{/if}
|
|
509
|
+
{#if optional}
|
|
510
|
+
<span class="ttdk-form-optional">{optionalText || "(Opsional)"}</span>
|
|
511
|
+
{/if}</label
|
|
512
|
+
>
|
|
513
|
+
{/if}
|
|
514
|
+
{#if helperText && helperTextPosition === "top"}
|
|
515
|
+
<div
|
|
516
|
+
style={stringifyStyles({
|
|
517
|
+
...buildUiVars(helperTextStyle),
|
|
518
|
+
...(helperTextStyle || {}),
|
|
519
|
+
})}
|
|
520
|
+
class={`ttdk-form-helper-text ${helperTextClass || ""}`.trim()}
|
|
521
|
+
>
|
|
522
|
+
{helperText}
|
|
523
|
+
</div>
|
|
524
|
+
{/if}
|
|
525
|
+
<div
|
|
526
|
+
style={stringifyStyles({
|
|
527
|
+
...buildUiVars(wrapperStyle),
|
|
528
|
+
...(wrapperStyle || {}),
|
|
529
|
+
})}
|
|
530
|
+
class={`ttdk-input-wrapper ttdk-input-number-wrapper ${
|
|
531
|
+
wrapperClass || ""
|
|
532
|
+
}`.trim()}
|
|
533
|
+
data-filled={Boolean(String(getRawValue()) !== "")}
|
|
534
|
+
data-error={Boolean(error || errorMessage)}
|
|
535
|
+
data-disabled={Boolean(disabled)}
|
|
536
|
+
data-size={size || "md"}
|
|
537
|
+
data-rounded={rounded || "md"}
|
|
538
|
+
data-split={shouldShowControls() && controlsPosition === "split"
|
|
539
|
+
? "true"
|
|
540
|
+
: undefined}
|
|
541
|
+
>
|
|
542
|
+
{#if shouldShowControls() && controlsPosition === "split"}
|
|
543
|
+
<button
|
|
544
|
+
type="button"
|
|
545
|
+
aria-label="Kurangi nilai"
|
|
546
|
+
class="ttdk-input-number-split-btn ttdk-input-number-split-down"
|
|
547
|
+
tabIndex={-1}
|
|
548
|
+
disabled={!canDecrement()}
|
|
549
|
+
data-disabled={!canDecrement() ? "true" : "false"}
|
|
550
|
+
on:click={(event) => {
|
|
551
|
+
stepDown();
|
|
552
|
+
}}
|
|
553
|
+
/>
|
|
554
|
+
{/if}
|
|
555
|
+
{#if addonLeft}
|
|
556
|
+
<div class="ttdk-input-addon ttdk-input-addon-left">{addonLeft}</div>
|
|
557
|
+
{/if}
|
|
558
|
+
<div class="ttdk-input-inner">
|
|
559
|
+
{#if iconLeft}
|
|
560
|
+
<span class="ttdk-input-icon ttdk-input-icon-left" aria-hidden="true"
|
|
561
|
+
>{iconLeft}</span
|
|
562
|
+
>
|
|
563
|
+
{/if}<input
|
|
564
|
+
style={stringifyStyles({
|
|
565
|
+
...buildUiVars(inputStyle),
|
|
566
|
+
...(inputStyle || {}),
|
|
567
|
+
})}
|
|
568
|
+
bind:this={inputRef}
|
|
569
|
+
class={`ttdk-input-control ttdk-input-number-control ${
|
|
570
|
+
inputClass || ""
|
|
571
|
+
}`.trim()}
|
|
572
|
+
type={getInputType()}
|
|
573
|
+
inputMode={getInputMode()}
|
|
574
|
+
{name}
|
|
575
|
+
{id}
|
|
576
|
+
value={getDisplayValue()}
|
|
577
|
+
{placeholder}
|
|
578
|
+
{disabled}
|
|
579
|
+
{readOnly}
|
|
580
|
+
{required}
|
|
581
|
+
autocomplete={autoComplete}
|
|
582
|
+
{maxLength}
|
|
583
|
+
{minLength}
|
|
584
|
+
{min}
|
|
585
|
+
{max}
|
|
586
|
+
step={step !== undefined ? step : 1}
|
|
587
|
+
aria-invalid={Boolean(error || errorMessage)}
|
|
588
|
+
on:change={(e) => {
|
|
589
|
+
handleChange(e);
|
|
590
|
+
}}
|
|
591
|
+
on:input={(e) => {
|
|
592
|
+
handleInput(e);
|
|
593
|
+
}}
|
|
594
|
+
on:blur={(e) => {
|
|
595
|
+
handleBlur(e);
|
|
596
|
+
}}
|
|
597
|
+
on:focus={(e) => {
|
|
598
|
+
onFocus && onFocus(e);
|
|
599
|
+
}}
|
|
600
|
+
on:copy={(e) => {
|
|
601
|
+
handleCopy(e);
|
|
602
|
+
}}
|
|
603
|
+
on:cut={(e) => {
|
|
604
|
+
handleCut(e);
|
|
605
|
+
}}
|
|
606
|
+
on:keydown={(e) => {
|
|
607
|
+
handleKeyDown(e);
|
|
608
|
+
}}
|
|
609
|
+
on:keyup={(e) => {
|
|
610
|
+
onKeyUp && onKeyUp(e);
|
|
611
|
+
}}
|
|
612
|
+
/>
|
|
613
|
+
{#if loading}
|
|
614
|
+
<span
|
|
615
|
+
class="ttdk-input-icon ttdk-input-icon-right ttdk-input-spinner"
|
|
616
|
+
aria-hidden="true"
|
|
617
|
+
><svg viewBox="0 0 24 24"
|
|
618
|
+
><line
|
|
619
|
+
x1="12"
|
|
620
|
+
y1="2.5"
|
|
621
|
+
x2="12"
|
|
622
|
+
y2="6.5"
|
|
623
|
+
opacity="0.175"
|
|
624
|
+
transform="rotate(0 12 12)"
|
|
625
|
+
/><line
|
|
626
|
+
x1="12"
|
|
627
|
+
y1="2.5"
|
|
628
|
+
x2="12"
|
|
629
|
+
y2="6.5"
|
|
630
|
+
opacity="0.25"
|
|
631
|
+
transform="rotate(30 12 12)"
|
|
632
|
+
/><line
|
|
633
|
+
x1="12"
|
|
634
|
+
y1="2.5"
|
|
635
|
+
x2="12"
|
|
636
|
+
y2="6.5"
|
|
637
|
+
opacity="0.325"
|
|
638
|
+
transform="rotate(60 12 12)"
|
|
639
|
+
/><line
|
|
640
|
+
x1="12"
|
|
641
|
+
y1="2.5"
|
|
642
|
+
x2="12"
|
|
643
|
+
y2="6.5"
|
|
644
|
+
opacity="0.4"
|
|
645
|
+
transform="rotate(90 12 12)"
|
|
646
|
+
/><line
|
|
647
|
+
x1="12"
|
|
648
|
+
y1="2.5"
|
|
649
|
+
x2="12"
|
|
650
|
+
y2="6.5"
|
|
651
|
+
opacity="0.475"
|
|
652
|
+
transform="rotate(120 12 12)"
|
|
653
|
+
/><line
|
|
654
|
+
x1="12"
|
|
655
|
+
y1="2.5"
|
|
656
|
+
x2="12"
|
|
657
|
+
y2="6.5"
|
|
658
|
+
opacity="0.55"
|
|
659
|
+
transform="rotate(150 12 12)"
|
|
660
|
+
/><line
|
|
661
|
+
x1="12"
|
|
662
|
+
y1="2.5"
|
|
663
|
+
x2="12"
|
|
664
|
+
y2="6.5"
|
|
665
|
+
opacity="0.625"
|
|
666
|
+
transform="rotate(180 12 12)"
|
|
667
|
+
/><line
|
|
668
|
+
x1="12"
|
|
669
|
+
y1="2.5"
|
|
670
|
+
x2="12"
|
|
671
|
+
y2="6.5"
|
|
672
|
+
opacity="0.7"
|
|
673
|
+
transform="rotate(210 12 12)"
|
|
674
|
+
/><line
|
|
675
|
+
x1="12"
|
|
676
|
+
y1="2.5"
|
|
677
|
+
x2="12"
|
|
678
|
+
y2="6.5"
|
|
679
|
+
opacity="0.775"
|
|
680
|
+
transform="rotate(240 12 12)"
|
|
681
|
+
/><line
|
|
682
|
+
x1="12"
|
|
683
|
+
y1="2.5"
|
|
684
|
+
x2="12"
|
|
685
|
+
y2="6.5"
|
|
686
|
+
opacity="0.85"
|
|
687
|
+
transform="rotate(270 12 12)"
|
|
688
|
+
/><line
|
|
689
|
+
x1="12"
|
|
690
|
+
y1="2.5"
|
|
691
|
+
x2="12"
|
|
692
|
+
y2="6.5"
|
|
693
|
+
opacity="0.925"
|
|
694
|
+
transform="rotate(300 12 12)"
|
|
695
|
+
/><line
|
|
696
|
+
x1="12"
|
|
697
|
+
y1="2.5"
|
|
698
|
+
x2="12"
|
|
699
|
+
y2="6.5"
|
|
700
|
+
opacity="1"
|
|
701
|
+
transform="rotate(330 12 12)"
|
|
702
|
+
/></svg
|
|
703
|
+
></span
|
|
704
|
+
>
|
|
705
|
+
{/if}
|
|
706
|
+
{#if !loading && iconRight}
|
|
707
|
+
<span class="ttdk-input-icon ttdk-input-icon-right" aria-hidden="true"
|
|
708
|
+
>{iconRight}</span
|
|
709
|
+
>
|
|
710
|
+
{/if}
|
|
711
|
+
{#if shouldShowControls() && controlsPosition !== "split"}
|
|
712
|
+
<div
|
|
713
|
+
style={stringifyStyles({
|
|
714
|
+
...buildUiVars(controlsStyle),
|
|
715
|
+
...(controlsStyle || {}),
|
|
716
|
+
})}
|
|
717
|
+
class={`ttdk-input-number-stepper ${controlsClass || ""}`.trim()}
|
|
718
|
+
>
|
|
719
|
+
<button
|
|
720
|
+
type="button"
|
|
721
|
+
aria-label="Tingkatkan nilai"
|
|
722
|
+
class="ttdk-input-number-btn ttdk-input-number-btn-up"
|
|
723
|
+
tabIndex={-1}
|
|
724
|
+
disabled={!canIncrement()}
|
|
725
|
+
data-disabled={!canIncrement() ? "true" : "false"}
|
|
726
|
+
on:click={(event) => {
|
|
727
|
+
stepUp();
|
|
728
|
+
}}
|
|
729
|
+
/><button
|
|
730
|
+
type="button"
|
|
731
|
+
aria-label="Kurangi nilai"
|
|
732
|
+
class="ttdk-input-number-btn ttdk-input-number-btn-down"
|
|
733
|
+
tabIndex={-1}
|
|
734
|
+
disabled={!canDecrement()}
|
|
735
|
+
data-disabled={!canDecrement() ? "true" : "false"}
|
|
736
|
+
on:click={(event) => {
|
|
737
|
+
stepDown();
|
|
738
|
+
}}
|
|
739
|
+
/>
|
|
740
|
+
</div>
|
|
741
|
+
{/if}
|
|
742
|
+
</div>
|
|
743
|
+
{#if addonRight}
|
|
744
|
+
<div class="ttdk-input-addon ttdk-input-addon-right">{addonRight}</div>
|
|
745
|
+
{/if}
|
|
746
|
+
{#if shouldShowControls() && controlsPosition === "split"}
|
|
747
|
+
<button
|
|
748
|
+
type="button"
|
|
749
|
+
aria-label="Tingkatkan nilai"
|
|
750
|
+
class="ttdk-input-number-split-btn ttdk-input-number-split-up"
|
|
751
|
+
tabIndex={-1}
|
|
752
|
+
disabled={!canIncrement()}
|
|
753
|
+
data-disabled={!canIncrement() ? "true" : "false"}
|
|
754
|
+
on:click={(event) => {
|
|
755
|
+
stepUp();
|
|
756
|
+
}}
|
|
757
|
+
/>
|
|
758
|
+
{/if}
|
|
759
|
+
</div>
|
|
760
|
+
{#if helperText && helperTextPosition !== "top"}
|
|
761
|
+
<div
|
|
762
|
+
style={stringifyStyles({
|
|
763
|
+
...buildUiVars(helperTextStyle),
|
|
764
|
+
...(helperTextStyle || {}),
|
|
765
|
+
})}
|
|
766
|
+
class={`ttdk-form-helper-text ${helperTextClass || ""}`.trim()}
|
|
767
|
+
>
|
|
768
|
+
{helperText}
|
|
769
|
+
</div>
|
|
770
|
+
{/if}
|
|
771
|
+
{#if errorMessage && (error || errorMessage)}
|
|
772
|
+
<div
|
|
773
|
+
style={stringifyStyles({
|
|
774
|
+
...buildUiVars(errorMessageStyle),
|
|
775
|
+
...(errorMessageStyle || {}),
|
|
776
|
+
})}
|
|
777
|
+
role="alert"
|
|
778
|
+
class={`ttdk-form-error-msg ${errorMessageClass || ""}`.trim()}
|
|
779
|
+
>
|
|
780
|
+
<span>{errorMessage}</span>
|
|
781
|
+
</div>
|
|
782
|
+
{/if}
|
|
783
|
+
</div>
|