@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
package/dist/es/src/components/CdsOtpInput/CdsOtpSeparator.vue_vue_type_script_setup_true_lang.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { defineComponent, useSlots, createVNode } from "vue";
|
|
2
|
+
import { u as useDefaults } from "../../core/useDefaults.js";
|
|
3
|
+
import { c as classNames } from "../../utils/dom/classNames.js";
|
|
4
|
+
import { b as CdsOtpSeparatorConstants } from "./api/CdsOtpInput.constants.js";
|
|
5
|
+
import { b as defineCdsOtpSeparatorProps } from "./api/CdsOtpInput.props.js";
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
...{
|
|
8
|
+
name: CdsOtpSeparatorConstants.name
|
|
9
|
+
},
|
|
10
|
+
__name: "CdsOtpSeparator",
|
|
11
|
+
props: {
|
|
12
|
+
...defineCdsOtpSeparatorProps()
|
|
13
|
+
},
|
|
14
|
+
setup(__props) {
|
|
15
|
+
const _props = __props;
|
|
16
|
+
const props = useDefaults(_props);
|
|
17
|
+
const slots = useSlots();
|
|
18
|
+
return () => {
|
|
19
|
+
var _a;
|
|
20
|
+
const {
|
|
21
|
+
rootClass
|
|
22
|
+
} = CdsOtpSeparatorConstants;
|
|
23
|
+
return createVNode("div", {
|
|
24
|
+
"class": classNames(rootClass, props.class),
|
|
25
|
+
"style": [props.style],
|
|
26
|
+
"aria-hidden": "true"
|
|
27
|
+
}, [(_a = slots.default) == null ? void 0 : _a.call(slots)]);
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
export {
|
|
32
|
+
_sfc_main as _
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=CdsOtpSeparator.vue_vue_type_script_setup_true_lang.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CdsOtpSeparator.vue_vue_type_script_setup_true_lang.js","sources":["../../../../../src/components/CdsOtpInput/CdsOtpSeparator.vue"],"sourcesContent":["<script setup lang=\"tsx\">\nimport { useDefaults } from '@cds/core';\nimport { classNames } from '@cds/utils';\n\nimport { CdsOtpSeparatorConstants } from './api/CdsOtpInput.constants';\nimport { defineCdsOtpSeparatorProps } from './api/CdsOtpInput.props';\nimport type { CdsOtpSeparatorSlots } from './api/CdsOtpInput.types';\n\ndefineOptions({\n name: CdsOtpSeparatorConstants.name\n});\n\nconst _props = defineProps({ ...defineCdsOtpSeparatorProps() });\nconst props = useDefaults(_props);\nconst slots = defineSlots<CdsOtpSeparatorSlots>();\n\ndefineRender(() => {\n const { rootClass } = CdsOtpSeparatorConstants;\n\n return (\n <div class={classNames(rootClass, props.class)} style={[props.style]} aria-hidden=\"true\">\n {slots.default?.()}\n </div>\n );\n});\n</script>\n"],"names":["_props","__props","props","useDefaults","slots","_useSlots","rootClass","CdsOtpSeparatorConstants","_createVNode","classNames","class","style","default"],"mappings":";;;;;;;;;;;;;;AAYA,UAAMA,SAASC;AACf,UAAMC,QAAQC,YAAYH,MAAM;AAChC,UAAMI,QAAQC,SAAA;WAED,MAAM;;AACjB,YAAM;AAAA,QAAEC;AAAAA,MAAU,IAAIC;AAEtB,aAAAC,YAAA,OAAA;AAAA,QAAA,SACcC,WAAWH,WAAWJ,MAAMQ,KAAK;AAAA,QAAC,SAAS,CAACR,MAAMS,KAAK;AAAA,QAAC,eAAA;AAAA,MAAA,GAAA,EACjEP,WAAMQ,YAANR,8BAAiB,CAAA;AAAA,IAGxB;AAAA;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { d as defineConstants } from "../../../core/defineConstants.js";
|
|
2
|
+
const CdsOtpInputConstants = defineConstants("CdsOtpInput", {
|
|
3
|
+
types: ["text", "password", "number"]
|
|
4
|
+
});
|
|
5
|
+
const CdsOtpFieldConstants = defineConstants("CdsOtpField");
|
|
6
|
+
const CdsOtpGroupConstants = defineConstants("CdsOtpGroup");
|
|
7
|
+
const CdsOtpSeparatorConstants = defineConstants("CdsOtpSeparator");
|
|
8
|
+
const CdsOtpInputSymbol = Symbol.for("cds:otp-input");
|
|
9
|
+
export {
|
|
10
|
+
CdsOtpFieldConstants as C,
|
|
11
|
+
CdsOtpGroupConstants as a,
|
|
12
|
+
CdsOtpSeparatorConstants as b,
|
|
13
|
+
CdsOtpInputConstants as c,
|
|
14
|
+
CdsOtpInputSymbol as d
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=CdsOtpInput.constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CdsOtpInput.constants.js","sources":["../../../../../../src/components/CdsOtpInput/api/CdsOtpInput.constants.ts"],"sourcesContent":["import { defineConstants } from '@cds/core';\nimport type { InjectionKey } from 'vue';\n\nimport type { CdsOtpInputContext, CdsOtpInputType } from './CdsOtpInput.types';\n\nexport const CdsOtpInputConstants = defineConstants('CdsOtpInput', {\n types: ['text', 'password', 'number'] as const satisfies readonly CdsOtpInputType[]\n});\n\nexport const CdsOtpFieldConstants = defineConstants('CdsOtpField');\nexport const CdsOtpGroupConstants = defineConstants('CdsOtpGroup');\nexport const CdsOtpSeparatorConstants = defineConstants('CdsOtpSeparator');\n\nexport const CdsOtpInputSymbol: InjectionKey<CdsOtpInputContext> = Symbol.for('cds:otp-input');\n"],"names":[],"mappings":";AAKO,MAAM,uBAAuB,gBAAgB,eAAe;AAAA,EACjE,OAAO,CAAC,QAAQ,YAAY,QAAQ;AACtC,CAAC;AAEM,MAAM,uBAAuB,gBAAgB,aAAa;AAC1D,MAAM,uBAAuB,gBAAgB,aAAa;AAC1D,MAAM,2BAA2B,gBAAgB,iBAAiB;AAElE,MAAM,oBAAsD,OAAO,IAAI,eAAe;"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { d as defineDisabledProps } from "../../../composables/useDisabled/useDisabled.js";
|
|
2
|
+
import { d as defineFocusProps, a as defineAutofocusProps } from "../../../composables/useFocus/useFocus.js";
|
|
3
|
+
import { d as defineLoaderProps } from "../../../composables/useLoader/useLoader.js";
|
|
4
|
+
import { d as defineThemeProps } from "../../../composables/useTheme/useTheme.js";
|
|
5
|
+
import { d as defineComponentProps } from "../../../core/defineComponent.js";
|
|
6
|
+
import { p as propsFactory } from "../../../core/propsFactory.js";
|
|
7
|
+
import { C as CdsOtpFieldConstants, a as CdsOtpGroupConstants, b as CdsOtpSeparatorConstants, c as CdsOtpInputConstants } from "./CdsOtpInput.constants.js";
|
|
8
|
+
import { d as defineSizeProps } from "../../../composables/useSize/useSize.js";
|
|
9
|
+
import { d as defineDimensionsProps } from "../../../composables/useDimensions/useDimensions.js";
|
|
10
|
+
import { d as defineColorProps } from "../../../composables/useColor/useColor.js";
|
|
11
|
+
const defineCdsOtpInputProps = propsFactory(
|
|
12
|
+
{
|
|
13
|
+
/** Символ-разделитель, который ставится между ячейками кода */
|
|
14
|
+
divider: String,
|
|
15
|
+
/** Подсвечивать все ячейки, пока поле находится в фокусе, а не только активную */
|
|
16
|
+
focusAll: Boolean,
|
|
17
|
+
/** Слитный вид: ячейки объединяются в одно поле без промежутков между ними */
|
|
18
|
+
merged: Boolean,
|
|
19
|
+
/** Доступное имя поля (`aria-label`). Принимает ключ локализации вида `$cds.input.otp` */
|
|
20
|
+
label: {
|
|
21
|
+
type: String,
|
|
22
|
+
default: "$cds.input.otp"
|
|
23
|
+
},
|
|
24
|
+
/** Количество ячеек кода */
|
|
25
|
+
length: {
|
|
26
|
+
type: [Number, String],
|
|
27
|
+
default: 6
|
|
28
|
+
},
|
|
29
|
+
/** Скрывать введённые символы точками */
|
|
30
|
+
masked: Boolean,
|
|
31
|
+
/** Значение компонента v-model */
|
|
32
|
+
modelValue: {
|
|
33
|
+
type: [Number, String],
|
|
34
|
+
default: void 0
|
|
35
|
+
},
|
|
36
|
+
/** Допустимые символы: имя готового паттерна (`numeric`, `alpha`, `alphanumeric`, `unicode-alpha`, `unicode-alphanumeric`) или собственное регулярное выражение */
|
|
37
|
+
pattern: {
|
|
38
|
+
type: [String, Object],
|
|
39
|
+
default: void 0
|
|
40
|
+
},
|
|
41
|
+
/** Символ-заполнитель, который показывается в пустой ячейке */
|
|
42
|
+
placeholder: String,
|
|
43
|
+
/** Тип вводимого кода. `number` ограничивает ввод цифрами, `password` скрывает символы */
|
|
44
|
+
type: {
|
|
45
|
+
type: String,
|
|
46
|
+
default: "number",
|
|
47
|
+
validator: (value) => CdsOtpInputConstants.types.includes(value)
|
|
48
|
+
},
|
|
49
|
+
/** Состояние ошибки */
|
|
50
|
+
error: Boolean,
|
|
51
|
+
...defineAutofocusProps(),
|
|
52
|
+
...defineColorProps(),
|
|
53
|
+
...defineComponentProps(),
|
|
54
|
+
...defineDimensionsProps(),
|
|
55
|
+
...defineDisabledProps(),
|
|
56
|
+
...defineFocusProps(),
|
|
57
|
+
...defineLoaderProps(),
|
|
58
|
+
...defineSizeProps(),
|
|
59
|
+
...defineThemeProps()
|
|
60
|
+
},
|
|
61
|
+
CdsOtpInputConstants.name
|
|
62
|
+
);
|
|
63
|
+
const defineCdsOtpFieldProps = propsFactory(
|
|
64
|
+
{
|
|
65
|
+
/** Порядковый номер ячейки, начиная с нуля */
|
|
66
|
+
index: {
|
|
67
|
+
type: Number,
|
|
68
|
+
required: true
|
|
69
|
+
},
|
|
70
|
+
...defineComponentProps()
|
|
71
|
+
},
|
|
72
|
+
CdsOtpFieldConstants.name
|
|
73
|
+
);
|
|
74
|
+
const defineCdsOtpGroupProps = propsFactory(
|
|
75
|
+
{
|
|
76
|
+
/** Слитный вид группы. По умолчанию наследуется от родительского `CdsOtpInput` */
|
|
77
|
+
merged: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: null
|
|
80
|
+
},
|
|
81
|
+
...defineComponentProps()
|
|
82
|
+
},
|
|
83
|
+
CdsOtpGroupConstants.name
|
|
84
|
+
);
|
|
85
|
+
const defineCdsOtpSeparatorProps = propsFactory(
|
|
86
|
+
{
|
|
87
|
+
...defineComponentProps()
|
|
88
|
+
},
|
|
89
|
+
CdsOtpSeparatorConstants.name
|
|
90
|
+
);
|
|
91
|
+
export {
|
|
92
|
+
defineCdsOtpGroupProps as a,
|
|
93
|
+
defineCdsOtpSeparatorProps as b,
|
|
94
|
+
defineCdsOtpInputProps as c,
|
|
95
|
+
defineCdsOtpFieldProps as d
|
|
96
|
+
};
|
|
97
|
+
//# sourceMappingURL=CdsOtpInput.props.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CdsOtpInput.props.js","sources":["../../../../../../src/components/CdsOtpInput/api/CdsOtpInput.props.ts"],"sourcesContent":["import { defineColorProps } from '@cds/composables/useColor';\nimport { defineDimensionsProps } from '@cds/composables/useDimensions';\nimport { defineDisabledProps } from '@cds/composables/useDisabled';\nimport { defineAutofocusProps, defineFocusProps } from '@cds/composables/useFocus';\nimport { defineLoaderProps } from '@cds/composables/useLoader';\nimport { defineSizeProps } from '@cds/composables/useSize';\nimport { defineThemeProps } from '@cds/composables/useTheme';\nimport { defineComponentProps, propsFactory } from '@cds/core';\nimport type { PropType } from 'vue';\n\nimport type { OtpInputPattern } from '../composables/useOtpInput';\nimport {\n CdsOtpFieldConstants,\n CdsOtpGroupConstants,\n CdsOtpInputConstants,\n CdsOtpSeparatorConstants\n} from './CdsOtpInput.constants';\nimport type { CdsOtpInputType } from './CdsOtpInput.types';\n\nexport const defineCdsOtpInputProps = propsFactory(\n {\n /** Символ-разделитель, который ставится между ячейками кода */\n divider: String,\n /** Подсвечивать все ячейки, пока поле находится в фокусе, а не только активную */\n focusAll: Boolean,\n /** Слитный вид: ячейки объединяются в одно поле без промежутков между ними */\n merged: Boolean,\n /** Доступное имя поля (`aria-label`). Принимает ключ локализации вида `$cds.input.otp` */\n label: {\n type: String,\n default: '$cds.input.otp'\n },\n /** Количество ячеек кода */\n length: {\n type: [Number, String] as PropType<number | string>,\n default: 6\n },\n /** Скрывать введённые символы точками */\n masked: Boolean,\n /** Значение компонента v-model */\n modelValue: {\n type: [Number, String] as PropType<number | string>,\n default: undefined\n },\n /** Допустимые символы: имя готового паттерна (`numeric`, `alpha`, `alphanumeric`, `unicode-alpha`, `unicode-alphanumeric`) или собственное регулярное выражение */\n pattern: {\n type: [String, Object] as PropType<OtpInputPattern | RegExp>,\n default: undefined\n },\n /** Символ-заполнитель, который показывается в пустой ячейке */\n placeholder: String,\n /** Тип вводимого кода. `number` ограничивает ввод цифрами, `password` скрывает символы */\n type: {\n type: String as PropType<CdsOtpInputType>,\n default: 'number',\n validator: (value: CdsOtpInputType) => CdsOtpInputConstants.types.includes(value)\n },\n /** Состояние ошибки */\n error: Boolean,\n\n ...defineAutofocusProps(),\n ...defineColorProps(),\n ...defineComponentProps(),\n ...defineDimensionsProps(),\n ...defineDisabledProps(),\n ...defineFocusProps(),\n ...defineLoaderProps(),\n ...defineSizeProps(),\n ...defineThemeProps()\n },\n CdsOtpInputConstants.name\n);\n\nexport const defineCdsOtpFieldProps = propsFactory(\n {\n /** Порядковый номер ячейки, начиная с нуля */\n index: {\n type: Number,\n required: true as const\n },\n\n ...defineComponentProps()\n },\n CdsOtpFieldConstants.name\n);\n\nexport const defineCdsOtpGroupProps = propsFactory(\n {\n /** Слитный вид группы. По умолчанию наследуется от родительского `CdsOtpInput` */\n merged: {\n type: Boolean as PropType<boolean | null>,\n default: null\n },\n\n ...defineComponentProps()\n },\n CdsOtpGroupConstants.name\n);\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EE,QAAQ;AAAA,MACN,MAAM;AAAA,MACN,SAAS;AAAA,IAAA;AAAA,IAGX,GAAG,qBAAA;AAAA,EAAqB;AAAA,EAE1B,qBAAqB;AACvB;AAEO,MAAM,6BAA6B;AAAA,EACxC;AAAA,IACE,GAAG,qBAAA;AAAA,EAAqB;AAAA,EAE1B,yBAAyB;AAC3B;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CdsOtpInput.types.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -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.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useOtpInput.js","sources":["../../../../../../src/components/CdsOtpInput/composables/useOtpInput.ts"],"sourcesContent":["import { computed, type MaybeRefOrGetter, type Ref, shallowRef, toRef, toValue } from 'vue';\n\nexport interface OtpSlotData {\n char: string | null;\n compositionChar: string | null;\n placeholderChar: string | null;\n isActive: boolean;\n hasFakeCaret: boolean;\n}\n\nexport interface OtpSelection {\n start: number;\n end: number;\n direction: 'forward' | 'backward' | 'none';\n}\n\nexport interface OtpSelectionInput {\n value: string;\n selectionStart: number | null;\n selectionEnd: number | null;\n selectionDirection: 'forward' | 'backward' | 'none' | null;\n maxLength: number;\n}\n\nexport const OtpInputPatterns = {\n numeric: /[0-9]/,\n alpha: /[a-zA-Z]/,\n alphanumeric: /[a-zA-Z0-9]/,\n 'unicode-alpha': /\\p{L}/u,\n 'unicode-alphanumeric': /[\\p{L}\\p{N}]/u\n} as const;\n\nexport type OtpInputPattern = keyof typeof OtpInputPatterns;\n\nconst IME_SCRIPT_RE = /[\\p{Script=Han}\\p{Script=Hiragana}\\p{Script=Katakana}\\p{Script=Hangul}\\p{Script=Bopomofo}]/u;\n\nconst graphemeSegmenter = /* @__PURE__ */ new Intl.Segmenter(undefined, { granularity: 'grapheme' });\n\nexport interface OtpInputOptions {\n value: Ref<string>;\n length?: MaybeRefOrGetter<number>;\n pattern?: MaybeRefOrGetter<OtpInputPattern | RegExp | null | undefined>;\n type?: MaybeRefOrGetter<'text' | 'password' | 'number'>;\n masked?: MaybeRefOrGetter<boolean>;\n placeholder?: MaybeRefOrGetter<string | null | undefined>;\n isFocused?: Ref<boolean | undefined>;\n}\n\nexport interface OtpInputContext {\n value: Ref<string>;\n length: Readonly<Ref<number>>;\n slots: Readonly<Ref<OtpSlotData[]>>;\n selection: Readonly<Ref<OtpSelection | null>>;\n composition: Readonly<Ref<string>>;\n isComposing: Readonly<Ref<boolean>>;\n isFocused: Ref<boolean | undefined>;\n effectivePattern: Readonly<Ref<RegExp | null>>;\n inputMode: Readonly<Ref<'numeric' | 'text'>>;\n\n filter: (text: string) => string;\n isImeText: (text: string) => boolean;\n\n setValue: (text: string) => string;\n insert: (text: string, range?: { start: number; end: number }) => string;\n deleteRange: (start: number, end: number) => string;\n bulkDelete: (isBackward: boolean) => string;\n\n syncSelection: (raw: OtpSelectionInput) => OtpSelection | null;\n setSelection: (start: number | null, end: number | null, direction?: 'forward' | 'backward' | 'none') => void;\n clearSelection: () => void;\n selectAtEnd: () => OtpSelection;\n selectSlot: (index: number) => OtpSelection;\n extendSelection: (direction: -1 | 1) => OtpSelection | null;\n\n startComposition: () => void;\n updateComposition: (data: string) => void;\n endComposition: () => void;\n\n reset: () => void;\n}\n\n/**\n * Headless-логика ввода одноразового кода: раскладывает строку значения по ячейкам,\n * фильтрует символы по паттерну и держит выделение скрытого input'а так, чтобы\n * визуально всегда была подсвечена ровно одна ячейка.\n *\n * Границы ячеек считаются в графемах, поэтому эмодзи, ZWJ-последовательности и\n * модификаторы тона кожи занимают ровно одну ячейку.\n */\nexport function useOtpInput(options: OtpInputOptions): OtpInputContext {\n const {\n value,\n length: _length = 6,\n pattern,\n type = 'number',\n masked = false,\n placeholder,\n isFocused = shallowRef(false)\n } = options;\n\n const selection = shallowRef<OtpSelection | null>(null);\n const composition = shallowRef('');\n const isComposing = shallowRef(false);\n let prevSelection: OtpSelection | null = null;\n // Якорь и фокус Shift+стрелок отслеживаются в графемах.\n let anchorG: number | null = null;\n let focusG: number | null = null;\n\n const length = toRef(() => Number(toValue(_length)));\n const isMasked = toRef(() => toValue(masked) || toValue(type) === 'password');\n const effectivePattern = toRef((): RegExp | null => {\n const p = toValue(pattern);\n if (p instanceof RegExp) return p;\n if (p != null) return OtpInputPatterns[p as OtpInputPattern] ?? null;\n if (toValue(type) === 'number') return OtpInputPatterns.numeric;\n return null;\n });\n const inputMode = toRef(() =>\n effectivePattern.value === OtpInputPatterns.numeric ? ('numeric' as const) : ('text' as const)\n );\n\n function graphemes(s: string): string[] {\n return Array.from(graphemeSegmenter.segment(s), (seg) => seg.segment);\n }\n\n function codeUnitsToGraphemeIndex(s: string, pos: number): number {\n let count = 0;\n for (const seg of graphemeSegmenter.segment(s)) {\n if (seg.index >= pos) break;\n count++;\n }\n return count;\n }\n\n function graphemeIndexToCodeUnits(s: string, gIndex: number): number {\n if (gIndex <= 0) return 0;\n let count = 0;\n for (const seg of graphemeSegmenter.segment(s)) {\n if (count === gIndex) return seg.index;\n count++;\n }\n return s.length;\n }\n\n const slots = computed((): OtpSlotData[] => {\n const chars = graphemes(value.value);\n const compositionChars = graphemes(composition.value);\n const placeholderChar = toValue(placeholder) ?? null;\n const currentSelection = selection.value;\n const startG = currentSelection ? codeUnitsToGraphemeIndex(value.value, currentSelection.start) : null;\n const endG = currentSelection ? codeUnitsToGraphemeIndex(value.value, currentSelection.end) : null;\n const compositionStart = startG ?? chars.length;\n\n return Array.from({ length: length.value }, (_, i) => {\n const char = chars[i] ?? null;\n const displayChar = char !== null && isMasked.value ? '•' : char;\n\n let compositionChar: string | null = null;\n if (composition.value && i >= compositionStart) {\n const offset = i - compositionStart;\n const c = compositionChars[offset];\n if (c != null) compositionChar = isMasked.value ? '•' : c;\n }\n\n const isActive = !!(\n isFocused.value &&\n startG !== null &&\n endG !== null &&\n ((startG === endG && i === startG) || (i >= startG && i < endG))\n );\n\n return {\n char: displayChar,\n compositionChar,\n placeholderChar,\n isActive,\n hasFakeCaret: isActive && char === null && compositionChar === null\n };\n });\n });\n\n function filter(text: string): string {\n const re = effectivePattern.value;\n if (!re) return text;\n return graphemes(text)\n .filter((c) => re.test(c))\n .join('');\n }\n\n function clampGraphemes(text: string, max: number): string {\n const chars = graphemes(text);\n if (chars.length <= max) return text;\n return chars.slice(0, max).join('');\n }\n\n function isImeText(text: string): boolean {\n return IME_SCRIPT_RE.test(text);\n }\n\n function setValue(text: string): string {\n const next = clampGraphemes(filter(text), length.value);\n value.value = next;\n return next;\n }\n\n function insert(text: string, range?: { start: number; end: number }): string {\n const current = value.value;\n const start = range?.start ?? current.length;\n const end = range?.end ?? current.length;\n const filtered = filter(text);\n const next = clampGraphemes(current.slice(0, start) + filtered + current.slice(end), length.value);\n value.value = next;\n\n const insertEnd = Math.min(start + filtered.length, next.length);\n const insertEndG = codeUnitsToGraphemeIndex(next, insertEnd);\n const cursorG = Math.min(insertEndG, length.value - 1);\n const cursor = graphemeIndexToCodeUnits(next, cursorG);\n setSelection(cursor, insertEnd, 'forward');\n return next;\n }\n\n function deleteRange(start: number, end: number): string {\n const current = value.value;\n const next = current.slice(0, start) + current.slice(end);\n value.value = next;\n const newEnd = Math.min(start + 1, next.length);\n setSelection(start, newEnd, 'forward');\n return next;\n }\n\n function bulkDelete(isBackward: boolean): string {\n const current = value.value;\n const currentSelection = selection.value;\n const next = isBackward\n ? current.slice(currentSelection?.end ?? current.length)\n : current.slice(0, currentSelection?.start ?? 0);\n value.value = next;\n\n if (next.length === 0) setSelection(0, 0, 'none');\n else if (isBackward) setSelection(0, 1, 'forward');\n else setSelection(next.length, next.length, 'none');\n return next;\n }\n\n function setSelection(\n start: number | null,\n end: number | null,\n direction: 'forward' | 'backward' | 'none' = 'none'\n ): void {\n if (start === null || end === null) {\n selection.value = null;\n anchorG = null;\n focusG = null;\n return;\n }\n const next: OtpSelection = { start, end, direction };\n selection.value = next;\n prevSelection = next;\n const startG = codeUnitsToGraphemeIndex(value.value, start);\n anchorG = startG;\n focusG = startG;\n }\n\n function clearSelection(): void {\n selection.value = null;\n anchorG = null;\n focusG = null;\n }\n\n function selectAtEnd(): OtpSelection {\n const current = value.value;\n const graphemeCount = graphemes(current).length;\n let start: number;\n let end: number;\n if (graphemeCount >= length.value) {\n start = graphemeIndexToCodeUnits(current, length.value - 1);\n end = current.length;\n } else {\n start = current.length;\n end = current.length;\n }\n const next: OtpSelection = { start, end, direction: 'forward' };\n selection.value = next;\n prevSelection = next;\n anchorG = graphemeCount >= length.value ? length.value - 1 : graphemeCount;\n focusG = anchorG;\n return next;\n }\n\n function selectSlot(index: number): OtpSelection {\n const current = value.value;\n const graphemeCount = graphemes(current).length;\n const clamped = Math.min(index, graphemeCount);\n const start = graphemeIndexToCodeUnits(current, clamped);\n const end = clamped < graphemeCount ? graphemeIndexToCodeUnits(current, clamped + 1) : current.length;\n const next: OtpSelection = { start, end, direction: 'forward' };\n selection.value = next;\n prevSelection = next;\n anchorG = clamped;\n focusG = clamped;\n return next;\n }\n\n function extendSelection(direction: -1 | 1): OtpSelection | null {\n const current = value.value;\n const valueG = graphemes(current).length;\n if (valueG === 0) return null;\n\n const maxFocus = Math.min(length.value - 1, valueG);\n\n if (anchorG === null || focusG === null) {\n const currentSelection = selection.value;\n if (!currentSelection) return null;\n const selectionStartG = codeUnitsToGraphemeIndex(current, currentSelection.start);\n const selectionEndG = codeUnitsToGraphemeIndex(current, currentSelection.end);\n if (selectionEndG - selectionStartG <= 1) {\n anchorG = selectionStartG;\n focusG = selectionStartG;\n } else if (currentSelection.direction === 'backward') {\n anchorG = selectionEndG - 1;\n focusG = selectionStartG;\n } else {\n anchorG = selectionStartG;\n focusG = selectionEndG - 1;\n }\n }\n\n const newFocus = Math.max(0, Math.min(maxFocus, focusG + direction));\n focusG = newFocus;\n\n const minG = Math.min(anchorG, newFocus);\n const maxG = Math.max(anchorG, newFocus);\n const start = graphemeIndexToCodeUnits(current, minG);\n const end = maxG + 1 >= valueG ? current.length : graphemeIndexToCodeUnits(current, maxG + 1);\n const newDirection: 'forward' | 'backward' = newFocus < anchorG ? 'backward' : 'forward';\n\n const next: OtpSelection = { start, end, direction: newDirection };\n selection.value = next;\n prevSelection = next;\n return next;\n }\n\n // Приводим выделение к тому, чтобы оно всегда покрывало хотя бы одну ячейку:\n // иначе каретка между двумя ячейками не подсветила бы ни одну из них.\n function syncSelection(raw: OtpSelectionInput): OtpSelection | null {\n if (isComposing.value) return selection.value;\n\n const { value: inputValue, selectionStart, selectionEnd, selectionDirection, maxLength } = raw;\n\n if (selectionStart === null || selectionEnd === null) {\n selection.value = null;\n prevSelection = null;\n return null;\n }\n\n const valueG = graphemes(inputValue).length;\n const startG = codeUnitsToGraphemeIndex(inputValue, selectionStart);\n const endG = codeUnitsToGraphemeIndex(inputValue, selectionEnd);\n\n let outStartG = -1;\n let outEndG = -1;\n let direction: 'forward' | 'backward' | 'none' | undefined;\n\n if (valueG !== 0) {\n const isSingleCaret = startG === endG;\n const isInsertMode = startG === valueG && valueG < maxLength;\n\n if (isSingleCaret && !isInsertMode) {\n if (startG === 0) {\n outStartG = 0;\n outEndG = 1;\n direction = 'forward';\n } else if (startG === maxLength) {\n outStartG = startG - 1;\n outEndG = startG;\n direction = 'backward';\n } else if (maxLength > 1 && valueG > 1) {\n let offset = 0;\n if (prevSelection !== null) {\n const prevStartG = codeUnitsToGraphemeIndex(inputValue, prevSelection.start);\n const prevEndG = codeUnitsToGraphemeIndex(inputValue, prevSelection.end);\n direction = startG < prevEndG ? 'backward' : 'forward';\n const wasPreviouslyInserting = prevStartG === prevEndG && prevStartG < maxLength;\n // Схлопывание мультиячейкового выделения: каретка встала на край прошлого\n // диапазона, между ячейками пользователь не переходил — не сдвигаем ячейку назад.\n const wasMultiSlot = prevEndG - prevStartG > 1;\n if (direction === 'backward' && !wasPreviouslyInserting && !wasMultiSlot) {\n offset = -1;\n }\n }\n outStartG = offset + startG;\n outEndG = offset + startG + 1;\n }\n }\n }\n\n const finalStartG = outStartG !== -1 ? outStartG : startG;\n const finalEndG = outEndG !== -1 ? outEndG : endG;\n const finalStart = graphemeIndexToCodeUnits(inputValue, finalStartG);\n const finalEnd = graphemeIndexToCodeUnits(inputValue, finalEndG);\n const finalDirection = direction ?? selectionDirection ?? 'none';\n\n const next: OtpSelection = { start: finalStart, end: finalEnd, direction: finalDirection };\n selection.value = next;\n prevSelection = next;\n // Сбрасываем якорь при обычной навигации, но сохраняем его на время работы extendSelection.\n if (finalEndG - finalStartG <= 1) {\n anchorG = finalStartG;\n focusG = finalStartG;\n }\n return next;\n }\n\n function startComposition(): void {\n isComposing.value = true;\n composition.value = '';\n }\n\n function updateComposition(data: string): void {\n composition.value = IME_SCRIPT_RE.test(data) ? data : '';\n }\n\n function endComposition(): void {\n isComposing.value = false;\n composition.value = '';\n }\n\n function reset(): void {\n value.value = '';\n selection.value = null;\n composition.value = '';\n isComposing.value = false;\n prevSelection = null;\n anchorG = null;\n focusG = null;\n }\n\n return {\n value,\n length,\n slots,\n selection,\n composition,\n isComposing,\n isFocused,\n effectivePattern,\n inputMode,\n\n filter,\n isImeText,\n\n setValue,\n insert,\n deleteRange,\n bulkDelete,\n\n syncSelection,\n setSelection,\n clearSelection,\n selectAtEnd,\n selectSlot,\n extendSelection,\n\n startComposition,\n updateComposition,\n endComposition,\n\n reset\n };\n}\n"],"names":[],"mappings":";AAwBO,MAAM,mBAAmB;AAAA,EAC9B,SAAS;AAAA,EACT,OAAO;AAAA,EACP,cAAc;AAAA,EACd,iBAAiB,WAAA,UAAA,GAAA;AAAA,EACjB,wBAAwB;AAC1B;AAIA,MAAM,gBAAgB;AAEtB,MAAM,wCAAwC,KAAK,UAAU,QAAW,EAAE,aAAa,YAAY;AAqD5F,SAAS,YAAY,SAA2C;AACrE,QAAM;AAAA,IACJ;AAAA,IACA,QAAQ,UAAU;AAAA,IAClB;AAAA,IACA,OAAO;AAAA,IACP,SAAS;AAAA,IACT;AAAA,IACA,YAAY,WAAW,KAAK;AAAA,EAAA,IAC1B;AAEJ,QAAM,YAAY,WAAgC,IAAI;AACtD,QAAM,cAAc,WAAW,EAAE;AACjC,QAAM,cAAc,WAAW,KAAK;AACpC,MAAI,gBAAqC;AAEzC,MAAI,UAAyB;AAC7B,MAAI,SAAwB;AAE5B,QAAM,SAAS,MAAM,MAAM,OAAO,QAAQ,OAAO,CAAC,CAAC;AACnD,QAAM,WAAW,MAAM,MAAM,QAAQ,MAAM,KAAK,QAAQ,IAAI,MAAM,UAAU;AAC5E,QAAM,mBAAmB,MAAM,MAAqB;AAClD,UAAM,IAAI,QAAQ,OAAO;AACzB,QAAI,aAAa,OAAQ,QAAO;AAChC,QAAI,KAAK,KAAM,QAAO,iBAAiB,CAAoB,KAAK;AAChE,QAAI,QAAQ,IAAI,MAAM,iBAAiB,iBAAiB;AACxD,WAAO;AAAA,EACT,CAAC;AACD,QAAM,YAAY;AAAA,IAAM,MACtB,iBAAiB,UAAU,iBAAiB,UAAW,YAAuB;AAAA,EAAA;AAGhF,WAAS,UAAU,GAAqB;AACtC,WAAO,MAAM,KAAK,kBA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AAA,IACA;AAAA,IACA;AAAA,IAEA;AAAA,EAAA;AAEJ;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { w as withConstants } from "../../core/withConstants.js";
|
|
2
|
+
import { c as CdsOtpInputConstants, C as CdsOtpFieldConstants, a as CdsOtpGroupConstants, b as CdsOtpSeparatorConstants } from "./api/CdsOtpInput.constants.js";
|
|
3
|
+
import { _ as _sfc_main$1 } from "./CdsOtpField.vue_vue_type_script_setup_true_lang.js";
|
|
4
|
+
import { _ as _sfc_main$2 } from "./CdsOtpGroup.vue_vue_type_script_setup_true_lang.js";
|
|
5
|
+
import { _ as _sfc_main } from "./CdsOtpInput.vue_vue_type_script_setup_true_lang.js";
|
|
6
|
+
import { _ as _sfc_main$3 } from "./CdsOtpSeparator.vue_vue_type_script_setup_true_lang.js";
|
|
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.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/components/CdsOtpInput/index.ts"],"sourcesContent":["import { withConstants } from '@cds/core';\n\nimport {\n CdsOtpFieldConstants,\n CdsOtpGroupConstants,\n CdsOtpInputConstants,\n CdsOtpSeparatorConstants\n} from './api/CdsOtpInput.constants';\nimport _CdsOtpField from './CdsOtpField.vue';\nimport _CdsOtpGroup from './CdsOtpGroup.vue';\nimport _CdsOtpInput from './CdsOtpInput.vue';\nimport _CdsOtpSeparator from './CdsOtpSeparator.vue';\n\n// Components\nexport const CdsOtpInput = withConstants(_CdsOtpInput, CdsOtpInputConstants);\nexport const CdsOtpField = withConstants(_CdsOtpField, CdsOtpFieldConstants);\nexport const CdsOtpGroup = withConstants(_CdsOtpGroup, CdsOtpGroupConstants);\nexport const CdsOtpSeparator = withConstants(_CdsOtpSeparator, CdsOtpSeparatorConstants);\n\n// Constants\nexport { CdsOtpInputSymbol } from './api/CdsOtpInput.constants';\n\n// Composables\nexport { OtpInputPatterns, useOtpInput } from './composables/useOtpInput';\n\n// Types\nexport * from './api/CdsOtpInput.types';\n"],"names":["_CdsOtpInput","_CdsOtpField","_CdsOtpGroup","_CdsOtpSeparator"],"mappings":";;;;;;AAcO,MAAM,cAAc,cAAcA,WAAc,oBAAoB;AACpE,MAAM,cAAc,cAAcC,aAAc,oBAAoB;AACpE,MAAM,cAAc,cAAcC,aAAc,oBAAoB;AACpE,MAAM,kBAAkB,cAAcC,aAAkB,wBAAwB;"}
|
|
@@ -42,6 +42,7 @@ import { C as CdsMessages } from "./CdsMessages/index.js";
|
|
|
42
42
|
import { C as CdsModal } from "./CdsModal/index.js";
|
|
43
43
|
import { C as CdsNotification } from "./CdsNotification/index.js";
|
|
44
44
|
import { C as CdsNotificationAlert } from "./CdsNotificationAlert/index.js";
|
|
45
|
+
import { C as CdsOtpField, a as CdsOtpGroup, b as CdsOtpInput, c as CdsOtpSeparator } from "./CdsOtpInput/index.js";
|
|
45
46
|
import { C as CdsOverlay } from "./CdsOverlay/index.js";
|
|
46
47
|
import { C as CdsPage } from "./CdsPage/index.js";
|
|
47
48
|
import { C as CdsPagination } from "./CdsPagination/index.js";
|
|
@@ -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.js";
|
|
80
81
|
import { _ as _sfc_main$2 } from "./CdsGrid/CdsRow.vue_vue_type_script_setup_true_lang.js";
|
|
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.js";
|
|
83
|
+
import { d as CdsOtpInputSymbol } from "./CdsOtpInput/api/CdsOtpInput.constants.js";
|
|
82
84
|
import { C as CssGridSymbol } from "./CdsGrid/api/CdsGrid.constants.js";
|
|
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.js";
|
|
86
|
+
import { O as OtpInputPatterns, u as useOtpInput } from "./CdsOtpInput/composables/useOtpInput.js";
|
|
84
87
|
import { a as allowedTypes } from "./CdsSkeletonLoader/api/CdsSkeletonLoader.types.js";
|
|
85
88
|
import { m as makeTableProps, u as useLazyKVMap } from "./CdsTable/composable/table.js";
|
|
86
89
|
import { u as useToastItem, a as useToastQueue } from "./CdsToastQueue/composables/useToastQueue.js";
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
//# sourceMappingURL=index.js.map
|