@central-design-system/components 4.0.0-alpha.2 → 4.0.0-alpha.3
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/CHANGELOG.md +5 -1
- package/MIGRATION.md +1 -1
- package/dist/cjs/entry.js +10 -10
- package/dist/es/entry.js +173 -163
- package/dist/es/entry.js.map +1 -1
- package/dist/es/src/components/CdsList/CdsList.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/src/components/CdsList/CdsListGroup.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/src/components/CdsList/CdsListItem.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/src/components/CdsList/CdsListSubheader.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/es/src/components/CdsList/api/CdsList.constants.js +4 -4
- package/dist/es/src/components/CdsList/api/CdsList.props.js +2 -2
- package/dist/es/src/components/CdsList/index.js +1 -1
- package/dist/es/src/components/CdsOtpInput/CdsOtpField.js +2 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpField.js.map +1 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpField.vue_vue_type_script_setup_true_lang.js +62 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpField.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpGroup.js +2 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpGroup.js.map +1 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpGroup.vue_vue_type_script_setup_true_lang.js +51 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpGroup.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpInput.css +204 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpInput.js +2 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpInput.js.map +1 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpInput.vue_vue_type_script_setup_true_lang.js +338 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpInput.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpSeparator.js +2 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpSeparator.js.map +1 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpSeparator.vue_vue_type_script_setup_true_lang.js +34 -0
- package/dist/es/src/components/CdsOtpInput/CdsOtpSeparator.vue_vue_type_script_setup_true_lang.js.map +1 -0
- package/dist/es/src/components/CdsOtpInput/api/CdsOtpInput.constants.js +16 -0
- package/dist/es/src/components/CdsOtpInput/api/CdsOtpInput.constants.js.map +1 -0
- package/dist/es/src/components/CdsOtpInput/api/CdsOtpInput.props.js +97 -0
- package/dist/es/src/components/CdsOtpInput/api/CdsOtpInput.props.js.map +1 -0
- package/dist/es/src/components/CdsOtpInput/api/CdsOtpInput.types.js +2 -0
- package/dist/es/src/components/CdsOtpInput/api/CdsOtpInput.types.js.map +1 -0
- package/dist/es/src/components/CdsOtpInput/composables/useOtpInput.js +329 -0
- package/dist/es/src/components/CdsOtpInput/composables/useOtpInput.js.map +1 -0
- package/dist/es/src/components/CdsOtpInput/index.js +17 -0
- package/dist/es/src/components/CdsOtpInput/index.js.map +1 -0
- package/dist/es/src/components/index.js +10 -0
- package/dist/es/src/components/index.js.map +1 -1
- package/dist/es/src/composables/useDisabled/index.js +1 -1
- package/dist/es/src/composables/useDisabled/index.js.map +1 -1
- package/dist/es/src/composables/useLoader/index.js +1 -1
- package/dist/es/src/composables/useLoader/index.js.map +1 -1
- package/dist/es/src/composables/useLocation/index.js +1 -1
- package/dist/es/src/composables/useLocation/index.js.map +1 -1
- package/dist/es/src/composables/useRouter/index.js +1 -1
- package/dist/es/src/composables/useRouter/index.js.map +1 -1
- package/dist/es/src/locales/ru.js +1 -0
- package/dist/es/src/locales/ru.js.map +1 -1
- package/dist/esm-node/entry.mjs +173 -163
- package/dist/esm-node/src/components/CdsOtpInput/CdsOtpField.mjs +2 -0
- package/dist/esm-node/src/components/CdsOtpInput/CdsOtpField.vue_vue_type_script_setup_true_lang.mjs +62 -0
- package/dist/esm-node/src/components/CdsOtpInput/CdsOtpGroup.mjs +2 -0
- package/dist/esm-node/src/components/CdsOtpInput/CdsOtpGroup.vue_vue_type_script_setup_true_lang.mjs +51 -0
- package/dist/esm-node/src/components/CdsOtpInput/CdsOtpInput.css +204 -0
- package/dist/esm-node/src/components/CdsOtpInput/CdsOtpInput.mjs +2 -0
- package/dist/esm-node/src/components/CdsOtpInput/CdsOtpInput.vue_vue_type_script_setup_true_lang.mjs +336 -0
- package/dist/esm-node/src/components/CdsOtpInput/CdsOtpSeparator.mjs +2 -0
- package/dist/esm-node/src/components/CdsOtpInput/CdsOtpSeparator.vue_vue_type_script_setup_true_lang.mjs +34 -0
- package/dist/esm-node/src/components/CdsOtpInput/api/CdsOtpInput.constants.mjs +16 -0
- package/dist/esm-node/src/components/CdsOtpInput/api/CdsOtpInput.props.mjs +97 -0
- package/dist/esm-node/src/components/CdsOtpInput/api/CdsOtpInput.types.mjs +2 -0
- package/dist/esm-node/src/components/CdsOtpInput/composables/useOtpInput.mjs +329 -0
- package/dist/esm-node/src/components/CdsOtpInput/index.mjs +17 -0
- package/dist/esm-node/src/components/index.mjs +10 -0
- package/dist/esm-node/src/composables/useLoader/index.mjs +1 -1
- package/dist/esm-node/src/composables/useLocation/index.mjs +1 -1
- package/dist/esm-node/src/composables/useRouter/index.mjs +1 -1
- package/dist/esm-node/src/locales/ru.mjs +1 -0
- package/dist/iife/entry.js +10 -10
- package/dist/styles.css +1 -1
- package/dist/types/components/CdsOtpInput/CdsOtpField.vue.d.ts +25 -0
- package/dist/types/components/CdsOtpInput/CdsOtpGroup.vue.d.ts +34 -0
- package/dist/types/components/CdsOtpInput/CdsOtpInput.vue.d.ts +222 -0
- package/dist/types/components/CdsOtpInput/CdsOtpSeparator.vue.d.ts +25 -0
- package/dist/types/components/CdsOtpInput/api/CdsOtpInput.constants.d.ts +9 -0
- package/dist/types/components/CdsOtpInput/api/CdsOtpInput.props.d.ts +340 -0
- package/dist/types/components/CdsOtpInput/api/CdsOtpInput.types.d.ts +47 -0
- package/dist/types/components/CdsOtpInput/composables/useOtpInput.d.ts +76 -0
- package/dist/types/components/CdsOtpInput/index.d.ts +529 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/entry.d.ts +5 -1
- package/dist/types/locales/en.d.ts +1 -0
- package/dist/types/locales/ru.d.ts +1 -0
- package/llms/llms-components.txt +512 -1
- package/llms/llms-full.txt +513 -2
- package/llms/llms-guides.txt +1 -1
- package/llms/llms-migration.txt +2 -2
- package/llms/llms-tokens.txt +1 -1
- package/llms/llms.txt +4 -3
- package/package.json +1 -1
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { shallowRef, toRef, toValue, computed } from "vue";
|
|
2
|
+
const OtpInputPatterns = {
|
|
3
|
+
numeric: /[0-9]/,
|
|
4
|
+
alpha: /[a-zA-Z]/,
|
|
5
|
+
alphanumeric: /[a-zA-Z0-9]/,
|
|
6
|
+
"unicode-alpha": new RegExp("\\p{L}", "u"),
|
|
7
|
+
"unicode-alphanumeric": /[\p{L}\p{N}]/u
|
|
8
|
+
};
|
|
9
|
+
const IME_SCRIPT_RE = /[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Bopomofo}]/u;
|
|
10
|
+
const graphemeSegmenter = /* @__PURE__ */ new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
11
|
+
function useOtpInput(options) {
|
|
12
|
+
const {
|
|
13
|
+
value,
|
|
14
|
+
length: _length = 6,
|
|
15
|
+
pattern,
|
|
16
|
+
type = "number",
|
|
17
|
+
masked = false,
|
|
18
|
+
placeholder,
|
|
19
|
+
isFocused = shallowRef(false)
|
|
20
|
+
} = options;
|
|
21
|
+
const selection = shallowRef(null);
|
|
22
|
+
const composition = shallowRef("");
|
|
23
|
+
const isComposing = shallowRef(false);
|
|
24
|
+
let prevSelection = null;
|
|
25
|
+
let anchorG = null;
|
|
26
|
+
let focusG = null;
|
|
27
|
+
const length = toRef(() => Number(toValue(_length)));
|
|
28
|
+
const isMasked = toRef(() => toValue(masked) || toValue(type) === "password");
|
|
29
|
+
const effectivePattern = toRef(() => {
|
|
30
|
+
const p = toValue(pattern);
|
|
31
|
+
if (p instanceof RegExp) return p;
|
|
32
|
+
if (p != null) return OtpInputPatterns[p] ?? null;
|
|
33
|
+
if (toValue(type) === "number") return OtpInputPatterns.numeric;
|
|
34
|
+
return null;
|
|
35
|
+
});
|
|
36
|
+
const inputMode = toRef(
|
|
37
|
+
() => effectivePattern.value === OtpInputPatterns.numeric ? "numeric" : "text"
|
|
38
|
+
);
|
|
39
|
+
function graphemes(s) {
|
|
40
|
+
return Array.from(graphemeSegmenter.segment(s), (seg) => seg.segment);
|
|
41
|
+
}
|
|
42
|
+
function codeUnitsToGraphemeIndex(s, pos) {
|
|
43
|
+
let count = 0;
|
|
44
|
+
for (const seg of graphemeSegmenter.segment(s)) {
|
|
45
|
+
if (seg.index >= pos) break;
|
|
46
|
+
count++;
|
|
47
|
+
}
|
|
48
|
+
return count;
|
|
49
|
+
}
|
|
50
|
+
function graphemeIndexToCodeUnits(s, gIndex) {
|
|
51
|
+
if (gIndex <= 0) return 0;
|
|
52
|
+
let count = 0;
|
|
53
|
+
for (const seg of graphemeSegmenter.segment(s)) {
|
|
54
|
+
if (count === gIndex) return seg.index;
|
|
55
|
+
count++;
|
|
56
|
+
}
|
|
57
|
+
return s.length;
|
|
58
|
+
}
|
|
59
|
+
const slots = computed(() => {
|
|
60
|
+
const chars = graphemes(value.value);
|
|
61
|
+
const compositionChars = graphemes(composition.value);
|
|
62
|
+
const placeholderChar = toValue(placeholder) ?? null;
|
|
63
|
+
const currentSelection = selection.value;
|
|
64
|
+
const startG = currentSelection ? codeUnitsToGraphemeIndex(value.value, currentSelection.start) : null;
|
|
65
|
+
const endG = currentSelection ? codeUnitsToGraphemeIndex(value.value, currentSelection.end) : null;
|
|
66
|
+
const compositionStart = startG ?? chars.length;
|
|
67
|
+
return Array.from({ length: length.value }, (_, i) => {
|
|
68
|
+
const char = chars[i] ?? null;
|
|
69
|
+
const displayChar = char !== null && isMasked.value ? "•" : char;
|
|
70
|
+
let compositionChar = null;
|
|
71
|
+
if (composition.value && i >= compositionStart) {
|
|
72
|
+
const offset = i - compositionStart;
|
|
73
|
+
const c = compositionChars[offset];
|
|
74
|
+
if (c != null) compositionChar = isMasked.value ? "•" : c;
|
|
75
|
+
}
|
|
76
|
+
const isActive = !!(isFocused.value && startG !== null && endG !== null && (startG === endG && i === startG || i >= startG && i < endG));
|
|
77
|
+
return {
|
|
78
|
+
char: displayChar,
|
|
79
|
+
compositionChar,
|
|
80
|
+
placeholderChar,
|
|
81
|
+
isActive,
|
|
82
|
+
hasFakeCaret: isActive && char === null && compositionChar === null
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
function filter(text) {
|
|
87
|
+
const re = effectivePattern.value;
|
|
88
|
+
if (!re) return text;
|
|
89
|
+
return graphemes(text).filter((c) => re.test(c)).join("");
|
|
90
|
+
}
|
|
91
|
+
function clampGraphemes(text, max) {
|
|
92
|
+
const chars = graphemes(text);
|
|
93
|
+
if (chars.length <= max) return text;
|
|
94
|
+
return chars.slice(0, max).join("");
|
|
95
|
+
}
|
|
96
|
+
function isImeText(text) {
|
|
97
|
+
return IME_SCRIPT_RE.test(text);
|
|
98
|
+
}
|
|
99
|
+
function setValue(text) {
|
|
100
|
+
const next = clampGraphemes(filter(text), length.value);
|
|
101
|
+
value.value = next;
|
|
102
|
+
return next;
|
|
103
|
+
}
|
|
104
|
+
function insert(text, range) {
|
|
105
|
+
const current = value.value;
|
|
106
|
+
const start = (range == null ? void 0 : range.start) ?? current.length;
|
|
107
|
+
const end = (range == null ? void 0 : range.end) ?? current.length;
|
|
108
|
+
const filtered = filter(text);
|
|
109
|
+
const next = clampGraphemes(current.slice(0, start) + filtered + current.slice(end), length.value);
|
|
110
|
+
value.value = next;
|
|
111
|
+
const insertEnd = Math.min(start + filtered.length, next.length);
|
|
112
|
+
const insertEndG = codeUnitsToGraphemeIndex(next, insertEnd);
|
|
113
|
+
const cursorG = Math.min(insertEndG, length.value - 1);
|
|
114
|
+
const cursor = graphemeIndexToCodeUnits(next, cursorG);
|
|
115
|
+
setSelection(cursor, insertEnd, "forward");
|
|
116
|
+
return next;
|
|
117
|
+
}
|
|
118
|
+
function deleteRange(start, end) {
|
|
119
|
+
const current = value.value;
|
|
120
|
+
const next = current.slice(0, start) + current.slice(end);
|
|
121
|
+
value.value = next;
|
|
122
|
+
const newEnd = Math.min(start + 1, next.length);
|
|
123
|
+
setSelection(start, newEnd, "forward");
|
|
124
|
+
return next;
|
|
125
|
+
}
|
|
126
|
+
function bulkDelete(isBackward) {
|
|
127
|
+
const current = value.value;
|
|
128
|
+
const currentSelection = selection.value;
|
|
129
|
+
const next = isBackward ? current.slice((currentSelection == null ? void 0 : currentSelection.end) ?? current.length) : current.slice(0, (currentSelection == null ? void 0 : currentSelection.start) ?? 0);
|
|
130
|
+
value.value = next;
|
|
131
|
+
if (next.length === 0) setSelection(0, 0, "none");
|
|
132
|
+
else if (isBackward) setSelection(0, 1, "forward");
|
|
133
|
+
else setSelection(next.length, next.length, "none");
|
|
134
|
+
return next;
|
|
135
|
+
}
|
|
136
|
+
function setSelection(start, end, direction = "none") {
|
|
137
|
+
if (start === null || end === null) {
|
|
138
|
+
selection.value = null;
|
|
139
|
+
anchorG = null;
|
|
140
|
+
focusG = null;
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
const next = { start, end, direction };
|
|
144
|
+
selection.value = next;
|
|
145
|
+
prevSelection = next;
|
|
146
|
+
const startG = codeUnitsToGraphemeIndex(value.value, start);
|
|
147
|
+
anchorG = startG;
|
|
148
|
+
focusG = startG;
|
|
149
|
+
}
|
|
150
|
+
function clearSelection() {
|
|
151
|
+
selection.value = null;
|
|
152
|
+
anchorG = null;
|
|
153
|
+
focusG = null;
|
|
154
|
+
}
|
|
155
|
+
function selectAtEnd() {
|
|
156
|
+
const current = value.value;
|
|
157
|
+
const graphemeCount = graphemes(current).length;
|
|
158
|
+
let start;
|
|
159
|
+
let end;
|
|
160
|
+
if (graphemeCount >= length.value) {
|
|
161
|
+
start = graphemeIndexToCodeUnits(current, length.value - 1);
|
|
162
|
+
end = current.length;
|
|
163
|
+
} else {
|
|
164
|
+
start = current.length;
|
|
165
|
+
end = current.length;
|
|
166
|
+
}
|
|
167
|
+
const next = { start, end, direction: "forward" };
|
|
168
|
+
selection.value = next;
|
|
169
|
+
prevSelection = next;
|
|
170
|
+
anchorG = graphemeCount >= length.value ? length.value - 1 : graphemeCount;
|
|
171
|
+
focusG = anchorG;
|
|
172
|
+
return next;
|
|
173
|
+
}
|
|
174
|
+
function selectSlot(index) {
|
|
175
|
+
const current = value.value;
|
|
176
|
+
const graphemeCount = graphemes(current).length;
|
|
177
|
+
const clamped = Math.min(index, graphemeCount);
|
|
178
|
+
const start = graphemeIndexToCodeUnits(current, clamped);
|
|
179
|
+
const end = clamped < graphemeCount ? graphemeIndexToCodeUnits(current, clamped + 1) : current.length;
|
|
180
|
+
const next = { start, end, direction: "forward" };
|
|
181
|
+
selection.value = next;
|
|
182
|
+
prevSelection = next;
|
|
183
|
+
anchorG = clamped;
|
|
184
|
+
focusG = clamped;
|
|
185
|
+
return next;
|
|
186
|
+
}
|
|
187
|
+
function extendSelection(direction) {
|
|
188
|
+
const current = value.value;
|
|
189
|
+
const valueG = graphemes(current).length;
|
|
190
|
+
if (valueG === 0) return null;
|
|
191
|
+
const maxFocus = Math.min(length.value - 1, valueG);
|
|
192
|
+
if (anchorG === null || focusG === null) {
|
|
193
|
+
const currentSelection = selection.value;
|
|
194
|
+
if (!currentSelection) return null;
|
|
195
|
+
const selectionStartG = codeUnitsToGraphemeIndex(current, currentSelection.start);
|
|
196
|
+
const selectionEndG = codeUnitsToGraphemeIndex(current, currentSelection.end);
|
|
197
|
+
if (selectionEndG - selectionStartG <= 1) {
|
|
198
|
+
anchorG = selectionStartG;
|
|
199
|
+
focusG = selectionStartG;
|
|
200
|
+
} else if (currentSelection.direction === "backward") {
|
|
201
|
+
anchorG = selectionEndG - 1;
|
|
202
|
+
focusG = selectionStartG;
|
|
203
|
+
} else {
|
|
204
|
+
anchorG = selectionStartG;
|
|
205
|
+
focusG = selectionEndG - 1;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
const newFocus = Math.max(0, Math.min(maxFocus, focusG + direction));
|
|
209
|
+
focusG = newFocus;
|
|
210
|
+
const minG = Math.min(anchorG, newFocus);
|
|
211
|
+
const maxG = Math.max(anchorG, newFocus);
|
|
212
|
+
const start = graphemeIndexToCodeUnits(current, minG);
|
|
213
|
+
const end = maxG + 1 >= valueG ? current.length : graphemeIndexToCodeUnits(current, maxG + 1);
|
|
214
|
+
const newDirection = newFocus < anchorG ? "backward" : "forward";
|
|
215
|
+
const next = { start, end, direction: newDirection };
|
|
216
|
+
selection.value = next;
|
|
217
|
+
prevSelection = next;
|
|
218
|
+
return next;
|
|
219
|
+
}
|
|
220
|
+
function syncSelection(raw) {
|
|
221
|
+
if (isComposing.value) return selection.value;
|
|
222
|
+
const { value: inputValue, selectionStart, selectionEnd, selectionDirection, maxLength } = raw;
|
|
223
|
+
if (selectionStart === null || selectionEnd === null) {
|
|
224
|
+
selection.value = null;
|
|
225
|
+
prevSelection = null;
|
|
226
|
+
return null;
|
|
227
|
+
}
|
|
228
|
+
const valueG = graphemes(inputValue).length;
|
|
229
|
+
const startG = codeUnitsToGraphemeIndex(inputValue, selectionStart);
|
|
230
|
+
const endG = codeUnitsToGraphemeIndex(inputValue, selectionEnd);
|
|
231
|
+
let outStartG = -1;
|
|
232
|
+
let outEndG = -1;
|
|
233
|
+
let direction;
|
|
234
|
+
if (valueG !== 0) {
|
|
235
|
+
const isSingleCaret = startG === endG;
|
|
236
|
+
const isInsertMode = startG === valueG && valueG < maxLength;
|
|
237
|
+
if (isSingleCaret && !isInsertMode) {
|
|
238
|
+
if (startG === 0) {
|
|
239
|
+
outStartG = 0;
|
|
240
|
+
outEndG = 1;
|
|
241
|
+
direction = "forward";
|
|
242
|
+
} else if (startG === maxLength) {
|
|
243
|
+
outStartG = startG - 1;
|
|
244
|
+
outEndG = startG;
|
|
245
|
+
direction = "backward";
|
|
246
|
+
} else if (maxLength > 1 && valueG > 1) {
|
|
247
|
+
let offset = 0;
|
|
248
|
+
if (prevSelection !== null) {
|
|
249
|
+
const prevStartG = codeUnitsToGraphemeIndex(inputValue, prevSelection.start);
|
|
250
|
+
const prevEndG = codeUnitsToGraphemeIndex(inputValue, prevSelection.end);
|
|
251
|
+
direction = startG < prevEndG ? "backward" : "forward";
|
|
252
|
+
const wasPreviouslyInserting = prevStartG === prevEndG && prevStartG < maxLength;
|
|
253
|
+
const wasMultiSlot = prevEndG - prevStartG > 1;
|
|
254
|
+
if (direction === "backward" && !wasPreviouslyInserting && !wasMultiSlot) {
|
|
255
|
+
offset = -1;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
outStartG = offset + startG;
|
|
259
|
+
outEndG = offset + startG + 1;
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
const finalStartG = outStartG !== -1 ? outStartG : startG;
|
|
264
|
+
const finalEndG = outEndG !== -1 ? outEndG : endG;
|
|
265
|
+
const finalStart = graphemeIndexToCodeUnits(inputValue, finalStartG);
|
|
266
|
+
const finalEnd = graphemeIndexToCodeUnits(inputValue, finalEndG);
|
|
267
|
+
const finalDirection = direction ?? selectionDirection ?? "none";
|
|
268
|
+
const next = { start: finalStart, end: finalEnd, direction: finalDirection };
|
|
269
|
+
selection.value = next;
|
|
270
|
+
prevSelection = next;
|
|
271
|
+
if (finalEndG - finalStartG <= 1) {
|
|
272
|
+
anchorG = finalStartG;
|
|
273
|
+
focusG = finalStartG;
|
|
274
|
+
}
|
|
275
|
+
return next;
|
|
276
|
+
}
|
|
277
|
+
function startComposition() {
|
|
278
|
+
isComposing.value = true;
|
|
279
|
+
composition.value = "";
|
|
280
|
+
}
|
|
281
|
+
function updateComposition(data) {
|
|
282
|
+
composition.value = IME_SCRIPT_RE.test(data) ? data : "";
|
|
283
|
+
}
|
|
284
|
+
function endComposition() {
|
|
285
|
+
isComposing.value = false;
|
|
286
|
+
composition.value = "";
|
|
287
|
+
}
|
|
288
|
+
function reset() {
|
|
289
|
+
value.value = "";
|
|
290
|
+
selection.value = null;
|
|
291
|
+
composition.value = "";
|
|
292
|
+
isComposing.value = false;
|
|
293
|
+
prevSelection = null;
|
|
294
|
+
anchorG = null;
|
|
295
|
+
focusG = null;
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
value,
|
|
299
|
+
length,
|
|
300
|
+
slots,
|
|
301
|
+
selection,
|
|
302
|
+
composition,
|
|
303
|
+
isComposing,
|
|
304
|
+
isFocused,
|
|
305
|
+
effectivePattern,
|
|
306
|
+
inputMode,
|
|
307
|
+
filter,
|
|
308
|
+
isImeText,
|
|
309
|
+
setValue,
|
|
310
|
+
insert,
|
|
311
|
+
deleteRange,
|
|
312
|
+
bulkDelete,
|
|
313
|
+
syncSelection,
|
|
314
|
+
setSelection,
|
|
315
|
+
clearSelection,
|
|
316
|
+
selectAtEnd,
|
|
317
|
+
selectSlot,
|
|
318
|
+
extendSelection,
|
|
319
|
+
startComposition,
|
|
320
|
+
updateComposition,
|
|
321
|
+
endComposition,
|
|
322
|
+
reset
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
export {
|
|
326
|
+
OtpInputPatterns as O,
|
|
327
|
+
useOtpInput as u
|
|
328
|
+
};
|
|
329
|
+
//# sourceMappingURL=useOtpInput.mjs.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { w as withConstants } from "../../core/withConstants.mjs";
|
|
2
|
+
import { c as CdsOtpInputConstants, C as CdsOtpFieldConstants, a as CdsOtpGroupConstants, b as CdsOtpSeparatorConstants } from "./api/CdsOtpInput.constants.mjs";
|
|
3
|
+
import { _ as _sfc_main$1 } from "./CdsOtpField.vue_vue_type_script_setup_true_lang.mjs";
|
|
4
|
+
import { _ as _sfc_main$2 } from "./CdsOtpGroup.vue_vue_type_script_setup_true_lang.mjs";
|
|
5
|
+
import { _ as _sfc_main } from "./CdsOtpInput.vue_vue_type_script_setup_true_lang.mjs";
|
|
6
|
+
import { _ as _sfc_main$3 } from "./CdsOtpSeparator.vue_vue_type_script_setup_true_lang.mjs";
|
|
7
|
+
const CdsOtpInput = withConstants(_sfc_main, CdsOtpInputConstants);
|
|
8
|
+
const CdsOtpField = withConstants(_sfc_main$1, CdsOtpFieldConstants);
|
|
9
|
+
const CdsOtpGroup = withConstants(_sfc_main$2, CdsOtpGroupConstants);
|
|
10
|
+
const CdsOtpSeparator = withConstants(_sfc_main$3, CdsOtpSeparatorConstants);
|
|
11
|
+
export {
|
|
12
|
+
CdsOtpField as C,
|
|
13
|
+
CdsOtpGroup as a,
|
|
14
|
+
CdsOtpInput as b,
|
|
15
|
+
CdsOtpSeparator as c
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -42,6 +42,7 @@ import { C as CdsMessages } from "./CdsMessages/index.mjs";
|
|
|
42
42
|
import { C as CdsModal } from "./CdsModal/index.mjs";
|
|
43
43
|
import { C as CdsNotification } from "./CdsNotification/index.mjs";
|
|
44
44
|
import { C as CdsNotificationAlert } from "./CdsNotificationAlert/index.mjs";
|
|
45
|
+
import { C as CdsOtpField, a as CdsOtpGroup, b as CdsOtpInput, c as CdsOtpSeparator } from "./CdsOtpInput/index.mjs";
|
|
45
46
|
import { C as CdsOverlay } from "./CdsOverlay/index.mjs";
|
|
46
47
|
import { C as CdsPage } from "./CdsPage/index.mjs";
|
|
47
48
|
import { C as CdsPagination } from "./CdsPagination/index.mjs";
|
|
@@ -79,8 +80,10 @@ import { _ as _sfc_main } from "./CdsGrid/CdsCol.vue_vue_type_script_setup_true_
|
|
|
79
80
|
import { _ as _sfc_main$1 } from "./CdsGrid/CdsGrid.vue_vue_type_script_setup_true_lang.mjs";
|
|
80
81
|
import { _ as _sfc_main$2 } from "./CdsGrid/CdsRow.vue_vue_type_script_setup_true_lang.mjs";
|
|
81
82
|
import { c as CDS_DRAWER_WIDTH, b as CDS_DRAWER_WIDTH_MINIFIED, d as CDS_DRAWER_Z_INDEX_INNER, a as CDS_DRAWER_Z_INDEX_OUTER } from "./CdsDrawer/api/CdsDrawer.constants.mjs";
|
|
83
|
+
import { d as CdsOtpInputSymbol } from "./CdsOtpInput/api/CdsOtpInput.constants.mjs";
|
|
82
84
|
import { C as CssGridSymbol } from "./CdsGrid/api/CdsGrid.constants.mjs";
|
|
83
85
|
import { E as EXPAND_COLUMN, a as SELECTION_ALL, S as SELECTION_COLUMN, b as SELECTION_INVERT, c as SELECTION_NONE, u as useSelection } from "./CdsTable/composable/selection.mjs";
|
|
86
|
+
import { O as OtpInputPatterns, u as useOtpInput } from "./CdsOtpInput/composables/useOtpInput.mjs";
|
|
84
87
|
import { a as allowedTypes } from "./CdsSkeletonLoader/api/CdsSkeletonLoader.types.mjs";
|
|
85
88
|
import { m as makeTableProps, u as useLazyKVMap } from "./CdsTable/composable/table.mjs";
|
|
86
89
|
import { u as useToastItem, a as useToastQueue } from "./CdsToastQueue/composables/useToastQueue.mjs";
|
|
@@ -161,6 +164,11 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
161
164
|
CdsModal,
|
|
162
165
|
CdsNotification,
|
|
163
166
|
CdsNotificationAlert,
|
|
167
|
+
CdsOtpField,
|
|
168
|
+
CdsOtpGroup,
|
|
169
|
+
CdsOtpInput,
|
|
170
|
+
CdsOtpInputSymbol,
|
|
171
|
+
CdsOtpSeparator,
|
|
164
172
|
CdsOverlay,
|
|
165
173
|
CdsPage,
|
|
166
174
|
CdsPagination,
|
|
@@ -212,6 +220,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
212
220
|
CdsVirtualScrollItem,
|
|
213
221
|
CssGridSymbol,
|
|
214
222
|
EXPAND_COLUMN,
|
|
223
|
+
OtpInputPatterns,
|
|
215
224
|
SELECTION_ALL,
|
|
216
225
|
SELECTION_COLUMN,
|
|
217
226
|
SELECTION_INVERT,
|
|
@@ -219,6 +228,7 @@ const index = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
219
228
|
allowedTypes,
|
|
220
229
|
makeTableProps,
|
|
221
230
|
useLazyKVMap,
|
|
231
|
+
useOtpInput,
|
|
222
232
|
useSelection,
|
|
223
233
|
useToastItem,
|
|
224
234
|
useToastQueue
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import "vue";
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import "vue";
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import "vue";
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|