@movk/nuxt 1.8.2 → 2.0.0-beta.1
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/README.en.md +16 -6
- package/README.md +16 -6
- package/dist/module.d.mts +6 -0
- package/dist/module.json +3 -3
- package/dist/module.mjs +21 -24
- package/dist/runtime/components/AutoForm.d.vue.ts +15 -1
- package/dist/runtime/components/AutoForm.vue +48 -50
- package/dist/runtime/components/AutoForm.vue.d.ts +15 -1
- package/dist/runtime/components/DataTable.d.vue.ts +4 -2
- package/dist/runtime/components/DataTable.vue +166 -174
- package/dist/runtime/components/DataTable.vue.d.ts +4 -2
- package/dist/runtime/components/DatePicker.d.vue.ts +6 -5
- package/dist/runtime/components/DatePicker.vue +96 -43
- package/dist/runtime/components/DatePicker.vue.d.ts +6 -5
- package/dist/runtime/components/MessageBox.d.vue.ts +1 -5
- package/dist/runtime/components/MessageBox.vue +9 -7
- package/dist/runtime/components/MessageBox.vue.d.ts +1 -5
- package/dist/runtime/components/SearchForm.d.vue.ts +12 -4
- package/dist/runtime/components/SearchForm.vue +130 -120
- package/dist/runtime/components/SearchForm.vue.d.ts +12 -4
- package/dist/runtime/components/Tree.d.vue.ts +3 -1
- package/dist/runtime/components/Tree.vue +102 -140
- package/dist/runtime/components/Tree.vue.d.ts +3 -1
- package/dist/runtime/components/theme-picker/ThemePicker.vue +5 -3
- package/dist/runtime/components/theme-picker/ThemePickerButton.vue +15 -6
- package/dist/runtime/composables/index.d.ts +1 -0
- package/dist/runtime/composables/index.js +1 -0
- package/dist/runtime/composables/useApiFetch.d.ts +7 -7
- package/dist/runtime/composables/useApiFetch.js +5 -23
- package/dist/runtime/composables/useAutoForm.js +2 -2
- package/dist/runtime/composables/useClientApiFetch.d.ts +5 -5
- package/dist/runtime/composables/useDateFormatter.d.ts +32 -34
- package/dist/runtime/composables/useDateFormatter.js +75 -232
- package/dist/runtime/composables/useDownloadWithProgress.d.ts +11 -8
- package/dist/runtime/composables/useDownloadWithProgress.js +49 -132
- package/dist/runtime/composables/useMessageBox.js +3 -2
- package/dist/runtime/composables/useMovkLocale.d.ts +16 -0
- package/dist/runtime/composables/useMovkLocale.js +20 -0
- package/dist/runtime/composables/useTheme.js +8 -18
- package/dist/runtime/composables/useUploadWithProgress.d.ts +9 -6
- package/dist/runtime/composables/useUploadWithProgress.js +50 -84
- package/dist/runtime/domains/ai/chat-transport.js +1 -0
- package/dist/runtime/domains/api/adapters/xhr.d.ts +17 -0
- package/dist/runtime/domains/api/adapters/xhr.js +55 -0
- package/dist/runtime/domains/api/auth.d.ts +4 -1
- package/dist/runtime/domains/api/auth.js +9 -13
- package/dist/runtime/domains/api/client.d.ts +13 -0
- package/dist/runtime/domains/api/client.js +35 -0
- package/dist/runtime/domains/api/download.d.ts +10 -0
- package/dist/runtime/domains/api/download.js +28 -0
- package/dist/runtime/domains/api/errors.d.ts +20 -2
- package/dist/runtime/domains/api/errors.js +61 -8
- package/dist/runtime/domains/api/fetch-key.d.ts +2 -2
- package/dist/runtime/domains/api/fetch-key.js +4 -4
- package/dist/runtime/domains/api/interceptors/request.d.ts +2 -6
- package/dist/runtime/domains/api/interceptors/request.js +3 -2
- package/dist/runtime/domains/api/interceptors/response.d.ts +8 -12
- package/dist/runtime/domains/api/interceptors/response.js +34 -20
- package/dist/runtime/domains/api/report.d.ts +25 -0
- package/dist/runtime/domains/api/report.js +51 -0
- package/dist/runtime/domains/api/response.d.ts +29 -4
- package/dist/runtime/domains/api/response.js +27 -6
- package/dist/runtime/domains/api/session.d.ts +12 -0
- package/dist/runtime/domains/api/session.js +9 -0
- package/dist/runtime/domains/api/stream.d.ts +2 -1
- package/dist/runtime/domains/api/stream.js +2 -1
- package/dist/runtime/domains/api/toast.d.ts +6 -3
- package/dist/runtime/domains/api/toast.js +7 -7
- package/dist/runtime/domains/auto-form/actions.d.ts +2 -1
- package/dist/runtime/domains/auto-form/actions.js +6 -4
- package/dist/runtime/domains/auto-form/array-ops.d.ts +3 -0
- package/dist/runtime/domains/auto-form/array-ops.js +9 -0
- package/dist/runtime/domains/auto-form/async-items.d.ts +10 -0
- package/dist/runtime/domains/auto-form/async-items.js +42 -0
- package/dist/runtime/domains/auto-form/components/Array.d.vue.ts +0 -4
- package/dist/runtime/domains/auto-form/components/Array.vue +81 -73
- package/dist/runtime/domains/auto-form/components/Array.vue.d.ts +0 -4
- package/dist/runtime/domains/auto-form/components/Children.d.vue.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Children.vue +0 -5
- package/dist/runtime/domains/auto-form/components/Children.vue.d.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Field.d.vue.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Field.vue +9 -2
- package/dist/runtime/domains/auto-form/components/Field.vue.d.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Layout.d.vue.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Layout.vue +3 -6
- package/dist/runtime/domains/auto-form/components/Layout.vue.d.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Nested.d.vue.ts +0 -2
- package/dist/runtime/domains/auto-form/components/Nested.vue +5 -9
- package/dist/runtime/domains/auto-form/components/Nested.vue.d.ts +0 -2
- package/dist/runtime/domains/auto-form/controls.d.ts +5 -572
- package/dist/runtime/domains/auto-form/controls.js +7 -20
- package/dist/runtime/domains/auto-form/fields.d.ts +21 -4
- package/dist/runtime/domains/auto-form/fields.js +52 -40
- package/dist/runtime/domains/auto-form/provider.d.ts +15 -6
- package/dist/runtime/domains/auto-form/provider.js +24 -10
- package/dist/runtime/domains/auto-form/schema.d.ts +9 -4
- package/dist/runtime/domains/auto-form/schema.js +91 -50
- package/dist/runtime/domains/auto-form/search-query.d.ts +10 -0
- package/dist/runtime/domains/auto-form/search-query.js +57 -0
- package/dist/runtime/domains/auto-form/useAutoFormCore.d.ts +62 -0
- package/dist/runtime/domains/auto-form/useAutoFormCore.js +108 -0
- package/dist/runtime/domains/auto-form/useSearchQuerySync.d.ts +11 -0
- package/dist/runtime/domains/auto-form/useSearchQuerySync.js +64 -0
- package/dist/runtime/domains/data-table/columns/constants.d.ts +2 -0
- package/dist/runtime/domains/data-table/columns/constants.js +1 -1
- package/dist/runtime/domains/data-table/columns/resolve-columns.d.ts +2 -1
- package/dist/runtime/domains/data-table/columns/resolve-columns.js +3 -2
- package/dist/runtime/domains/data-table/columns/resolve-data-column.d.ts +7 -2
- package/dist/runtime/domains/data-table/columns/resolve-data-column.js +10 -5
- package/dist/runtime/domains/data-table/columns/resolve-special-columns.js +14 -8
- package/dist/runtime/domains/data-table/components/ColumnSettings.d.vue.ts +20 -0
- package/dist/runtime/domains/data-table/components/ColumnSettings.vue +63 -0
- package/dist/runtime/domains/data-table/components/ColumnSettings.vue.d.ts +20 -0
- package/dist/runtime/domains/data-table/components/Pagination.d.vue.ts +2 -8
- package/dist/runtime/domains/data-table/components/Pagination.vue +34 -36
- package/dist/runtime/domains/data-table/components/Pagination.vue.d.ts +2 -8
- package/dist/runtime/domains/data-table/export.d.ts +23 -0
- package/dist/runtime/domains/data-table/export.js +43 -0
- package/dist/runtime/domains/data-table/load-more.d.ts +8 -0
- package/dist/runtime/domains/data-table/load-more.js +14 -0
- package/dist/runtime/domains/data-table/pagination.d.ts +29 -0
- package/dist/runtime/domains/data-table/pagination.js +42 -0
- package/dist/runtime/domains/data-table/persist.d.ts +12 -0
- package/dist/runtime/domains/data-table/persist.js +41 -0
- package/dist/runtime/domains/data-table/state/keys.d.ts +11 -0
- package/dist/runtime/domains/data-table/state/keys.js +44 -0
- package/dist/runtime/domains/data-table/state/models.d.ts +5 -0
- package/dist/runtime/domains/data-table/state/models.js +38 -0
- package/dist/runtime/domains/data-table/tree-layout.d.ts +13 -0
- package/dist/runtime/domains/data-table/tree-layout.js +30 -0
- package/dist/runtime/domains/theme/theme-color.d.ts +3 -0
- package/dist/runtime/domains/theme/theme-color.js +16 -0
- package/dist/runtime/domains/theme/theme-fouc.d.ts +5 -0
- package/dist/runtime/domains/theme/theme-fouc.js +43 -0
- package/dist/runtime/domains/tree/components/TreeToolbar.d.vue.ts +7 -5
- package/dist/runtime/domains/tree/components/TreeToolbar.vue +6 -4
- package/dist/runtime/domains/tree/components/TreeToolbar.vue.d.ts +7 -5
- package/dist/runtime/domains/tree/tree-disabled.d.ts +5 -0
- package/dist/runtime/domains/tree/tree-disabled.js +15 -0
- package/dist/runtime/domains/tree/tree-lazy.d.ts +8 -0
- package/dist/runtime/domains/tree/tree-lazy.js +19 -1
- package/dist/runtime/domains/tree/tree-search.d.ts +3 -1
- package/dist/runtime/domains/tree/tree-search.js +4 -0
- package/dist/runtime/domains/tree/useTreeLazy.d.ts +22 -0
- package/dist/runtime/domains/tree/useTreeLazy.js +57 -0
- package/dist/runtime/domains/tree/useTreeSearch.d.ts +27 -0
- package/dist/runtime/domains/tree/useTreeSearch.js +59 -0
- package/dist/runtime/domains/tree/useTreeSelection.d.ts +31 -0
- package/dist/runtime/domains/tree/useTreeSelection.js +89 -0
- package/dist/runtime/domains/zod/apply.d.ts +23 -0
- package/dist/runtime/domains/zod/apply.js +26 -0
- package/dist/runtime/domains/zod/error-map.d.ts +13 -0
- package/dist/runtime/domains/zod/error-map.js +19 -0
- package/dist/runtime/domains/zod/locale-map.d.ts +5 -0
- package/dist/runtime/domains/zod/locale-map.js +17 -0
- package/dist/runtime/domains/zod/sync.d.ts +12 -0
- package/dist/runtime/domains/zod/sync.js +30 -0
- package/dist/runtime/locale/en.d.ts +74 -0
- package/dist/runtime/locale/en.js +73 -0
- package/dist/runtime/locale/index.d.ts +8 -0
- package/dist/runtime/locale/index.js +15 -0
- package/dist/runtime/locale/zh_cn.d.ts +74 -0
- package/dist/runtime/locale/zh_cn.js +73 -0
- package/dist/runtime/plugins/api.factory.js +5 -22
- package/dist/runtime/plugins/theme.js +4 -42
- package/dist/runtime/plugins/zod.d.ts +2 -0
- package/dist/runtime/plugins/zod.js +16 -0
- package/dist/runtime/types/api/config.d.ts +12 -0
- package/dist/runtime/types/api/fetch.d.ts +3 -16
- package/dist/runtime/types/api/index.d.ts +1 -1
- package/dist/runtime/types/api/response.d.ts +33 -19
- package/dist/runtime/types/api/stream.d.ts +2 -3
- package/dist/runtime/types/api/transfer.d.ts +3 -7
- package/dist/runtime/types/auto-form/base.d.ts +9 -1
- package/dist/runtime/types/auto-form/component.d.ts +31 -3
- package/dist/runtime/types/auto-form/fields.d.ts +15 -1
- package/dist/runtime/types/auto-form/index.d.ts +3 -3
- package/dist/runtime/types/auto-form/search-form.d.ts +26 -12
- package/dist/runtime/types/auto-form/zod-factory.d.ts +2 -2
- package/dist/runtime/types/components/date-picker.d.ts +14 -3
- package/dist/runtime/types/components/index.d.ts +1 -6
- package/dist/runtime/types/components/message-box.d.ts +5 -18
- package/dist/runtime/types/components/tree.d.ts +17 -14
- package/dist/runtime/types/data-table/columns.d.ts +6 -14
- package/dist/runtime/types/data-table/component.d.ts +42 -1
- package/dist/runtime/types/data-table/index.d.ts +1 -1
- package/dist/runtime/types/data-table/pagination.d.ts +7 -8
- package/dist/runtime/types/index.d.ts +2 -0
- package/dist/runtime/types/locale.d.ts +82 -0
- package/dist/runtime/types/shared.d.ts +13 -0
- package/dist/runtime/types/zod-config.d.ts +38 -0
- package/dist/runtime/types/zod.d.ts +9 -1
- package/dist/runtime/utils/date/convert.d.ts +29 -0
- package/dist/runtime/utils/date/convert.js +93 -0
- package/dist/runtime/utils/date/guards.d.ts +10 -0
- package/dist/runtime/utils/date/guards.js +18 -0
- package/dist/runtime/utils/extend-theme.js +2 -1
- package/dist/runtime/utils/form-control.d.ts +0 -12
- package/dist/runtime/utils/form-control.js +3 -39
- package/dist/runtime/utils/interpolate.d.ts +2 -0
- package/dist/runtime/utils/interpolate.js +4 -0
- package/dist/runtime/utils/theme-defaults.d.ts +10 -0
- package/dist/runtime/utils/theme-defaults.js +9 -0
- package/dist/runtime/utils/tree-selection.d.ts +2 -15
- package/dist/runtime/utils/tv.d.ts +1 -1
- package/dist/runtime/vue/plugins/zod.d.ts +7 -0
- package/dist/runtime/vue/plugins/zod.js +12 -0
- package/dist/shared/{nuxt.C7xx2FPO.mjs → nuxt.CbmfnBRt.mjs} +92 -236
- package/dist/unplugin.d.mts +3 -2
- package/dist/unplugin.mjs +22 -22
- package/dist/vite.d.mts +1 -0
- package/dist/vite.mjs +2 -1
- package/package.json +40 -34
- package/vue-plugin.d.ts +7 -1
- package/dist/runtime/components/ColorChooser.d.vue.ts +0 -36
- package/dist/runtime/components/ColorChooser.vue +0 -328
- package/dist/runtime/components/ColorChooser.vue.d.ts +0 -36
- package/dist/runtime/components/PillGroup.d.vue.ts +0 -33
- package/dist/runtime/components/PillGroup.vue +0 -291
- package/dist/runtime/components/PillGroup.vue.d.ts +0 -33
- package/dist/runtime/components/Popconfirm.d.vue.ts +0 -30
- package/dist/runtime/components/Popconfirm.vue +0 -143
- package/dist/runtime/components/Popconfirm.vue.d.ts +0 -30
- package/dist/runtime/components/SlideVerify.d.vue.ts +0 -41
- package/dist/runtime/components/SlideVerify.vue +0 -174
- package/dist/runtime/components/SlideVerify.vue.d.ts +0 -41
- package/dist/runtime/components/input/AsPhoneNumberInput.d.vue.ts +0 -32
- package/dist/runtime/components/input/AsPhoneNumberInput.vue +0 -48
- package/dist/runtime/components/input/AsPhoneNumberInput.vue.d.ts +0 -32
- package/dist/runtime/components/input/WithCharacterLimit.d.vue.ts +0 -32
- package/dist/runtime/components/input/WithCharacterLimit.vue +0 -54
- package/dist/runtime/components/input/WithCharacterLimit.vue.d.ts +0 -32
- package/dist/runtime/components/input/WithClear.d.vue.ts +0 -33
- package/dist/runtime/components/input/WithClear.vue +0 -60
- package/dist/runtime/components/input/WithClear.vue.d.ts +0 -33
- package/dist/runtime/components/input/WithCopy.d.vue.ts +0 -33
- package/dist/runtime/components/input/WithCopy.vue +0 -66
- package/dist/runtime/components/input/WithCopy.vue.d.ts +0 -33
- package/dist/runtime/components/input/WithFloatingLabel.d.vue.ts +0 -33
- package/dist/runtime/components/input/WithFloatingLabel.vue +0 -75
- package/dist/runtime/components/input/WithFloatingLabel.vue.d.ts +0 -33
- package/dist/runtime/components/input/WithPasswordToggle.d.vue.ts +0 -32
- package/dist/runtime/components/input/WithPasswordToggle.vue +0 -61
- package/dist/runtime/components/input/WithPasswordToggle.vue.d.ts +0 -32
- package/dist/runtime/domains/api/interceptors/compose.d.ts +0 -24
- package/dist/runtime/domains/api/interceptors/compose.js +0 -18
- package/dist/runtime/domains/api/interceptors/error.d.ts +0 -13
- package/dist/runtime/domains/api/interceptors/error.js +0 -49
- package/dist/runtime/domains/api/transfer.d.ts +0 -69
- package/dist/runtime/domains/api/transfer.js +0 -82
- package/dist/runtime/types/components/color-chooser.d.ts +0 -109
- package/dist/runtime/types/components/input/as-phone-number-input.d.ts +0 -17
- package/dist/runtime/types/components/input/index.d.ts +0 -6
- package/dist/runtime/types/components/input/index.js +0 -0
- package/dist/runtime/types/components/input/with-character-limit.d.ts +0 -11
- package/dist/runtime/types/components/input/with-character-limit.js +0 -0
- package/dist/runtime/types/components/input/with-clear.d.ts +0 -10
- package/dist/runtime/types/components/input/with-clear.js +0 -0
- package/dist/runtime/types/components/input/with-copy.d.ts +0 -11
- package/dist/runtime/types/components/input/with-copy.js +0 -0
- package/dist/runtime/types/components/input/with-floating-label.d.ts +0 -12
- package/dist/runtime/types/components/input/with-floating-label.js +0 -0
- package/dist/runtime/types/components/input/with-password-toggle.d.ts +0 -7
- package/dist/runtime/types/components/input/with-password-toggle.js +0 -0
- package/dist/runtime/types/components/pill-group.d.ts +0 -103
- package/dist/runtime/types/components/pill-group.js +0 -0
- package/dist/runtime/types/components/popconfirm.d.ts +0 -74
- package/dist/runtime/types/components/popconfirm.js +0 -0
- package/dist/runtime/types/components/slide-verify.d.ts +0 -54
- package/dist/runtime/types/components/slide-verify.js +0 -0
- /package/dist/runtime/types/{components/color-chooser.js → locale.js} +0 -0
- /package/dist/runtime/types/{components/input/as-phone-number-input.js → zod-config.js} +0 -0
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { UIcon } from "#components";
|
|
3
|
-
import { useAppConfig } from "#imports";
|
|
4
|
-
import { useElementSize } from "@vueuse/core";
|
|
5
|
-
import { computed, ref, useTemplateRef } from "vue";
|
|
6
|
-
import theme from "#build/movk-ui/slide-verify";
|
|
7
|
-
import { useExtendedTv } from "../utils/extend-theme";
|
|
8
|
-
import { useFieldControl } from "../utils/form-control";
|
|
9
|
-
const props = defineProps({
|
|
10
|
-
id: { type: String, required: false },
|
|
11
|
-
name: { type: String, required: false },
|
|
12
|
-
size: { type: String, required: false },
|
|
13
|
-
disabled: { type: Boolean, required: false },
|
|
14
|
-
text: { type: String, required: false, default: "\u8BF7\u5411\u53F3\u6ED1\u52A8\u9A8C\u8BC1" },
|
|
15
|
-
successText: { type: String, required: false, default: "\u9A8C\u8BC1\u6210\u529F" },
|
|
16
|
-
icon: { type: null, required: false, default: "i-lucide-chevrons-right" },
|
|
17
|
-
successIcon: { type: null, required: false, default: "i-lucide-check" },
|
|
18
|
-
threshold: { type: Number, required: false, default: 0.9 },
|
|
19
|
-
class: { type: [Array, String, null, Number, Boolean], required: false, skipCheck: true },
|
|
20
|
-
ui: { type: Object, required: false }
|
|
21
|
-
});
|
|
22
|
-
const emits = defineEmits(["success", "dragStart", "dragEnd"]);
|
|
23
|
-
defineSlots();
|
|
24
|
-
defineOptions({ inheritAttrs: false });
|
|
25
|
-
const isVerified = defineModel({ type: Boolean, ...{ default: false } });
|
|
26
|
-
const {
|
|
27
|
-
id,
|
|
28
|
-
name,
|
|
29
|
-
size: effectiveSize,
|
|
30
|
-
disabled: effectiveDisabled,
|
|
31
|
-
fieldGroupOrientation,
|
|
32
|
-
ariaAttrs,
|
|
33
|
-
emitFormBlur,
|
|
34
|
-
emitFormChange,
|
|
35
|
-
emitFormFocus,
|
|
36
|
-
emitFormInput
|
|
37
|
-
} = useFieldControl(props);
|
|
38
|
-
const rootRef = useTemplateRef("root");
|
|
39
|
-
const sliderRef = useTemplateRef("slider");
|
|
40
|
-
const { width: rootWidth } = useElementSize(rootRef);
|
|
41
|
-
const { width: sliderWidth } = useElementSize(sliderRef);
|
|
42
|
-
const isDragging = ref(false);
|
|
43
|
-
const dragX = ref(0);
|
|
44
|
-
const pointerStartX = ref(0);
|
|
45
|
-
const dragStartX = ref(0);
|
|
46
|
-
const appConfig = useAppConfig();
|
|
47
|
-
const { extendUi } = useExtendedTv(
|
|
48
|
-
{ slots: {} },
|
|
49
|
-
theme,
|
|
50
|
-
() => appConfig.movk?.slideVerify,
|
|
51
|
-
() => ({
|
|
52
|
-
ui: {
|
|
53
|
-
...props.ui,
|
|
54
|
-
root: [props.ui?.root, props.class]
|
|
55
|
-
},
|
|
56
|
-
variants: {
|
|
57
|
-
disabled: effectiveDisabled.value,
|
|
58
|
-
verified: isVerified.value,
|
|
59
|
-
size: effectiveSize.value,
|
|
60
|
-
fieldGroup: fieldGroupOrientation.value
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
);
|
|
64
|
-
const rootPaddingX = computed(() => {
|
|
65
|
-
void effectiveSize.value;
|
|
66
|
-
const root = rootRef.value;
|
|
67
|
-
if (!root) return 0;
|
|
68
|
-
const style = getComputedStyle(root);
|
|
69
|
-
return (Number.parseFloat(style.paddingLeft) || 0) + (Number.parseFloat(style.paddingRight) || 0);
|
|
70
|
-
});
|
|
71
|
-
const sliderOuterWidth = computed(
|
|
72
|
-
() => sliderWidth.value ? sliderRef.value?.offsetWidth || sliderWidth.value : 0
|
|
73
|
-
);
|
|
74
|
-
const maxDragDistance = computed(
|
|
75
|
-
() => rootWidth.value ? Math.max(0, (rootRef.value?.clientWidth || 0) - rootPaddingX.value - sliderOuterWidth.value) : 0
|
|
76
|
-
);
|
|
77
|
-
const progress = computed(
|
|
78
|
-
() => isVerified.value ? 1 : maxDragDistance.value ? Math.min(dragX.value / maxDragDistance.value, 1) : 0
|
|
79
|
-
);
|
|
80
|
-
const canInteract = computed(() => !effectiveDisabled.value && !isVerified.value && rootWidth.value > 0);
|
|
81
|
-
const currentTranslateX = computed(
|
|
82
|
-
() => isVerified.value ? maxDragDistance.value : dragX.value
|
|
83
|
-
);
|
|
84
|
-
function handlePointerDown(e) {
|
|
85
|
-
if (!canInteract.value) return;
|
|
86
|
-
pointerStartX.value = e.clientX;
|
|
87
|
-
dragStartX.value = dragX.value;
|
|
88
|
-
isDragging.value = true;
|
|
89
|
-
e.currentTarget.setPointerCapture(e.pointerId);
|
|
90
|
-
emits("dragStart");
|
|
91
|
-
}
|
|
92
|
-
function handlePointerMove(e) {
|
|
93
|
-
if (!isDragging.value || !canInteract.value) return;
|
|
94
|
-
dragX.value = Math.max(0, Math.min(
|
|
95
|
-
dragStartX.value + (e.clientX - pointerStartX.value),
|
|
96
|
-
maxDragDistance.value
|
|
97
|
-
));
|
|
98
|
-
}
|
|
99
|
-
function handlePointerUp() {
|
|
100
|
-
if (!isDragging.value) return;
|
|
101
|
-
isDragging.value = false;
|
|
102
|
-
const success = progress.value >= props.threshold;
|
|
103
|
-
if (success) {
|
|
104
|
-
isVerified.value = true;
|
|
105
|
-
emits("success");
|
|
106
|
-
emitFormInput();
|
|
107
|
-
emitFormChange();
|
|
108
|
-
} else {
|
|
109
|
-
dragX.value = 0;
|
|
110
|
-
}
|
|
111
|
-
emits("dragEnd", success);
|
|
112
|
-
}
|
|
113
|
-
function reset() {
|
|
114
|
-
isVerified.value = false;
|
|
115
|
-
dragX.value = 0;
|
|
116
|
-
}
|
|
117
|
-
defineExpose({ reset });
|
|
118
|
-
</script>
|
|
119
|
-
|
|
120
|
-
<template>
|
|
121
|
-
<div
|
|
122
|
-
:id="id"
|
|
123
|
-
ref="root"
|
|
124
|
-
:name="name"
|
|
125
|
-
:class="extendUi.root"
|
|
126
|
-
role="slider"
|
|
127
|
-
:aria-label="text"
|
|
128
|
-
:aria-valuenow="Math.round(progress * 100)"
|
|
129
|
-
aria-valuemin="0"
|
|
130
|
-
aria-valuemax="100"
|
|
131
|
-
:aria-disabled="effectiveDisabled"
|
|
132
|
-
:tabindex="canInteract ? 0 : -1"
|
|
133
|
-
v-bind="ariaAttrs"
|
|
134
|
-
@blur="emitFormBlur"
|
|
135
|
-
@focus="emitFormFocus"
|
|
136
|
-
>
|
|
137
|
-
<div ref="track" :class="extendUi.track">
|
|
138
|
-
<div
|
|
139
|
-
v-if="!isVerified"
|
|
140
|
-
:class="[extendUi.fill, isDragging ? 'transition-none' : 'transition-[width] duration-300']"
|
|
141
|
-
:style="{ width: `${progress * 100}%` }"
|
|
142
|
-
/>
|
|
143
|
-
|
|
144
|
-
<div :class="extendUi.text">
|
|
145
|
-
<span
|
|
146
|
-
v-if="!isVerified"
|
|
147
|
-
class="animate-[shimmer_2s_linear_infinite] [background-size:200%_100%] bg-clip-text text-transparent bg-no-repeat select-none"
|
|
148
|
-
:style="{
|
|
149
|
-
backgroundImage: 'linear-gradient(90deg, var(--ui-text-dimmed) 0%, var(--ui-text-muted) 50%, var(--ui-text-dimmed) 100%)',
|
|
150
|
-
opacity: 1 - progress * 0.5
|
|
151
|
-
}"
|
|
152
|
-
>{{ text }}</span>
|
|
153
|
-
<span v-else class="font-medium text-inverted">{{ successText }}</span>
|
|
154
|
-
</div>
|
|
155
|
-
</div>
|
|
156
|
-
|
|
157
|
-
<div
|
|
158
|
-
ref="slider"
|
|
159
|
-
:class="[
|
|
160
|
-
extendUi.slider,
|
|
161
|
-
isDragging ? 'transition-none' : 'transition-transform duration-300 ease-out',
|
|
162
|
-
canInteract ? 'hover:scale-[1.02] active:scale-[0.98]' : ''
|
|
163
|
-
]"
|
|
164
|
-
:style="{ transform: `translateX(${currentTranslateX}px)` }"
|
|
165
|
-
@pointerdown="handlePointerDown"
|
|
166
|
-
@pointermove="handlePointerMove"
|
|
167
|
-
@pointerup="handlePointerUp"
|
|
168
|
-
>
|
|
169
|
-
<slot name="slider" :verified="isVerified" :progress="progress">
|
|
170
|
-
<UIcon :name="isVerified ? successIcon : icon" :class="extendUi.icon" />
|
|
171
|
-
</slot>
|
|
172
|
-
</div>
|
|
173
|
-
</div>
|
|
174
|
-
</template>
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import theme from '#build/movk-ui/slide-verify';
|
|
2
|
-
import type { ComponentConfig } from '@nuxt/ui';
|
|
3
|
-
import type { AppConfig } from 'nuxt/schema';
|
|
4
|
-
import type { SlideVerifyProps, SlideVerifySlots } from '../types/components/slide-verify';
|
|
5
|
-
type __VLS_Props = SlideVerifyProps & {
|
|
6
|
-
size?: ComponentConfig<typeof theme, AppConfig, 'slideVerify'>['variants']['size'];
|
|
7
|
-
ui?: ComponentConfig<typeof theme, AppConfig, 'slideVerify'>['slots'];
|
|
8
|
-
};
|
|
9
|
-
type __VLS_Slots = SlideVerifySlots;
|
|
10
|
-
declare function reset(): void;
|
|
11
|
-
type __VLS_ModelProps = {
|
|
12
|
-
modelValue?: boolean;
|
|
13
|
-
};
|
|
14
|
-
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
15
|
-
declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {
|
|
16
|
-
reset: typeof reset;
|
|
17
|
-
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
18
|
-
success: () => any;
|
|
19
|
-
"update:modelValue": (value: boolean) => any;
|
|
20
|
-
dragStart: () => any;
|
|
21
|
-
dragEnd: (success: boolean) => any;
|
|
22
|
-
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
23
|
-
onSuccess?: (() => any) | undefined;
|
|
24
|
-
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
25
|
-
onDragStart?: (() => any) | undefined;
|
|
26
|
-
onDragEnd?: ((success: boolean) => any) | undefined;
|
|
27
|
-
}>, {
|
|
28
|
-
icon: any;
|
|
29
|
-
text: string;
|
|
30
|
-
successText: string;
|
|
31
|
-
successIcon: any;
|
|
32
|
-
threshold: number;
|
|
33
|
-
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
34
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
35
|
-
declare const _default: typeof __VLS_export;
|
|
36
|
-
export default _default;
|
|
37
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
38
|
-
new (): {
|
|
39
|
-
$slots: S;
|
|
40
|
-
};
|
|
41
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig, InputSlots, InputValue } from '@nuxt/ui';
|
|
2
|
-
import type { OmitByKey } from '@movk/core';
|
|
3
|
-
import theme from '#build/movk-ui/as-phone-number-input';
|
|
4
|
-
import inputTheme from '#build/ui/input';
|
|
5
|
-
import type { AsPhoneNumberInputProps } from '../../types/components/input/as-phone-number-input';
|
|
6
|
-
import type { AppConfig } from 'nuxt/schema';
|
|
7
|
-
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
8
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(AsPhoneNumberInputProps<T> & {
|
|
9
|
-
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "asPhoneNumberInput">["slots"];
|
|
10
|
-
} & {
|
|
11
|
-
modelValue?: T;
|
|
12
|
-
}) & {
|
|
13
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
14
|
-
onChange?: ((event: Event) => any) | undefined;
|
|
15
|
-
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
16
|
-
}> & (typeof globalThis extends {
|
|
17
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
18
|
-
} ? P : {});
|
|
19
|
-
expose: (exposed: {}) => void;
|
|
20
|
-
attrs: any;
|
|
21
|
-
slots: OmitByKey<InputSlots, "leading">;
|
|
22
|
-
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
23
|
-
}>) => import("vue").VNode & {
|
|
24
|
-
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
25
|
-
};
|
|
26
|
-
declare const _default: typeof __VLS_export;
|
|
27
|
-
export default _default;
|
|
28
|
-
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
29
|
-
[K in keyof T]: T[K];
|
|
30
|
-
} : {
|
|
31
|
-
[K in keyof T as K]: T[K];
|
|
32
|
-
}) & {};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { UInput } from "#components";
|
|
3
|
-
import { vMaska } from "maska/vue";
|
|
4
|
-
import { useAppConfig } from "#imports";
|
|
5
|
-
import theme from "#build/movk-ui/as-phone-number-input";
|
|
6
|
-
import inputTheme from "#build/ui/input";
|
|
7
|
-
import { useExtendedTv } from "../../utils/extend-theme";
|
|
8
|
-
import { useForwardedProps } from "../../utils/form-control";
|
|
9
|
-
const props = defineProps({
|
|
10
|
-
mask: { type: String, required: false, default: "(###) ###-####" },
|
|
11
|
-
dialCode: { type: String, required: false, default: "+86" },
|
|
12
|
-
ui: { type: Object, required: false }
|
|
13
|
-
});
|
|
14
|
-
const modelValue = defineModel({ type: null });
|
|
15
|
-
const emits = defineEmits(["update:modelValue", "blur", "change"]);
|
|
16
|
-
const slots = defineSlots();
|
|
17
|
-
defineOptions({ inheritAttrs: false });
|
|
18
|
-
const appConfig = useAppConfig();
|
|
19
|
-
const inputProps = useForwardedProps(props, ["ui", "mask", "dialCode", "placeholder", "defaultValue", "modelModifiers"]);
|
|
20
|
-
const { baseUi, extraUi } = useExtendedTv(
|
|
21
|
-
inputTheme,
|
|
22
|
-
theme,
|
|
23
|
-
() => appConfig.movk?.asPhoneNumberInput,
|
|
24
|
-
() => ({ ui: props.ui, variants: { dialCode: !!props.dialCode } })
|
|
25
|
-
);
|
|
26
|
-
</script>
|
|
27
|
-
|
|
28
|
-
<template>
|
|
29
|
-
<UInput
|
|
30
|
-
v-model="modelValue"
|
|
31
|
-
v-maska="props.mask"
|
|
32
|
-
type="tel"
|
|
33
|
-
:placeholder="props.placeholder ?? props.mask.replaceAll('#', '_')"
|
|
34
|
-
:style="props.dialCode ? { '--dial-code-length': `${props.dialCode.length + 1.5}ch` } : void 0"
|
|
35
|
-
:ui="baseUi"
|
|
36
|
-
v-bind="{ ...inputProps, ...$attrs }"
|
|
37
|
-
@blur="emits('blur', $event)"
|
|
38
|
-
@change="emits('change', $event)"
|
|
39
|
-
>
|
|
40
|
-
<template v-for="(_, slotName) in slots" :key="slotName" #[slotName]="slotProps">
|
|
41
|
-
<slot :name="slotName" v-bind="slotProps ?? {}" />
|
|
42
|
-
</template>
|
|
43
|
-
|
|
44
|
-
<template v-if="props.dialCode" #leading>
|
|
45
|
-
<span :class="extraUi.dialCode">{{ props.dialCode }}</span>
|
|
46
|
-
</template>
|
|
47
|
-
</UInput>
|
|
48
|
-
</template>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig, InputSlots, InputValue } from '@nuxt/ui';
|
|
2
|
-
import type { OmitByKey } from '@movk/core';
|
|
3
|
-
import theme from '#build/movk-ui/as-phone-number-input';
|
|
4
|
-
import inputTheme from '#build/ui/input';
|
|
5
|
-
import type { AsPhoneNumberInputProps } from '../../types/components/input/as-phone-number-input';
|
|
6
|
-
import type { AppConfig } from 'nuxt/schema';
|
|
7
|
-
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
8
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(AsPhoneNumberInputProps<T> & {
|
|
9
|
-
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "asPhoneNumberInput">["slots"];
|
|
10
|
-
} & {
|
|
11
|
-
modelValue?: T;
|
|
12
|
-
}) & {
|
|
13
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
14
|
-
onChange?: ((event: Event) => any) | undefined;
|
|
15
|
-
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
16
|
-
}> & (typeof globalThis extends {
|
|
17
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
18
|
-
} ? P : {});
|
|
19
|
-
expose: (exposed: {}) => void;
|
|
20
|
-
attrs: any;
|
|
21
|
-
slots: OmitByKey<InputSlots, "leading">;
|
|
22
|
-
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
23
|
-
}>) => import("vue").VNode & {
|
|
24
|
-
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
25
|
-
};
|
|
26
|
-
declare const _default: typeof __VLS_export;
|
|
27
|
-
export default _default;
|
|
28
|
-
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
29
|
-
[K in keyof T]: T[K];
|
|
30
|
-
} : {
|
|
31
|
-
[K in keyof T as K]: T[K];
|
|
32
|
-
}) & {};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig, InputSlots, InputValue } from '@nuxt/ui';
|
|
2
|
-
import type { OmitByKey } from '@movk/core';
|
|
3
|
-
import theme from '#build/movk-ui/with-character-limit';
|
|
4
|
-
import inputTheme from '#build/ui/input';
|
|
5
|
-
import type { WithCharacterLimitProps } from '../../types/components/input/with-character-limit';
|
|
6
|
-
import type { AppConfig } from 'nuxt/schema';
|
|
7
|
-
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
8
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCharacterLimitProps<T> & {
|
|
9
|
-
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "withCharacterLimit">["slots"];
|
|
10
|
-
} & {
|
|
11
|
-
modelValue?: T;
|
|
12
|
-
}) & {
|
|
13
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
14
|
-
onChange?: ((event: Event) => any) | undefined;
|
|
15
|
-
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
16
|
-
}> & (typeof globalThis extends {
|
|
17
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
18
|
-
} ? P : {});
|
|
19
|
-
expose: (exposed: {}) => void;
|
|
20
|
-
attrs: any;
|
|
21
|
-
slots: OmitByKey<InputSlots, "trailing">;
|
|
22
|
-
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
23
|
-
}>) => import("vue").VNode & {
|
|
24
|
-
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
25
|
-
};
|
|
26
|
-
declare const _default: typeof __VLS_export;
|
|
27
|
-
export default _default;
|
|
28
|
-
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
29
|
-
[K in keyof T]: T[K];
|
|
30
|
-
} : {
|
|
31
|
-
[K in keyof T as K]: T[K];
|
|
32
|
-
}) & {};
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { computed, useAttrs } from "vue";
|
|
3
|
-
import { UInput } from "#components";
|
|
4
|
-
import { useAppConfig } from "#imports";
|
|
5
|
-
import theme from "#build/movk-ui/with-character-limit";
|
|
6
|
-
import inputTheme from "#build/ui/input";
|
|
7
|
-
import { useExtendedTv } from "../../utils/extend-theme";
|
|
8
|
-
import { useForwardedProps } from "../../utils/form-control";
|
|
9
|
-
const props = defineProps({
|
|
10
|
-
maxLength: { type: Number, required: false, default: 50 },
|
|
11
|
-
ui: { type: Object, required: false }
|
|
12
|
-
});
|
|
13
|
-
const emits = defineEmits(["update:modelValue", "blur", "change"]);
|
|
14
|
-
const slots = defineSlots();
|
|
15
|
-
defineOptions({ inheritAttrs: false });
|
|
16
|
-
const attrs = useAttrs();
|
|
17
|
-
const appConfig = useAppConfig();
|
|
18
|
-
const modelValue = defineModel({ type: null });
|
|
19
|
-
const inputProps = useForwardedProps(props, ["ui", "maxLength", "maxlength", "defaultValue", "modelModifiers"]);
|
|
20
|
-
const { baseUi, extraUi } = useExtendedTv(
|
|
21
|
-
inputTheme,
|
|
22
|
-
theme,
|
|
23
|
-
() => appConfig.movk?.withCharacterLimit,
|
|
24
|
-
() => ({ ui: props.ui })
|
|
25
|
-
);
|
|
26
|
-
const currentLength = computed(() => String(modelValue.value ?? "").length);
|
|
27
|
-
</script>
|
|
28
|
-
|
|
29
|
-
<template>
|
|
30
|
-
<UInput
|
|
31
|
-
v-model="modelValue"
|
|
32
|
-
:maxlength="props.maxLength"
|
|
33
|
-
aria-describedby="character-count"
|
|
34
|
-
:ui="baseUi"
|
|
35
|
-
v-bind="{ ...inputProps, ...attrs }"
|
|
36
|
-
@blur="emits('blur', $event)"
|
|
37
|
-
@change="emits('change', $event)"
|
|
38
|
-
>
|
|
39
|
-
<template v-for="(_, slotName) in slots" :key="slotName" #[slotName]="slotProps">
|
|
40
|
-
<slot :name="slotName" v-bind="slotProps ?? {}" />
|
|
41
|
-
</template>
|
|
42
|
-
|
|
43
|
-
<template #trailing>
|
|
44
|
-
<div
|
|
45
|
-
id="character-count"
|
|
46
|
-
:class="extraUi.counter"
|
|
47
|
-
aria-live="polite"
|
|
48
|
-
role="status"
|
|
49
|
-
>
|
|
50
|
-
{{ currentLength }}/{{ props.maxLength }}
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
|
53
|
-
</UInput>
|
|
54
|
-
</template>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig, InputSlots, InputValue } from '@nuxt/ui';
|
|
2
|
-
import type { OmitByKey } from '@movk/core';
|
|
3
|
-
import theme from '#build/movk-ui/with-character-limit';
|
|
4
|
-
import inputTheme from '#build/ui/input';
|
|
5
|
-
import type { WithCharacterLimitProps } from '../../types/components/input/with-character-limit';
|
|
6
|
-
import type { AppConfig } from 'nuxt/schema';
|
|
7
|
-
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
8
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCharacterLimitProps<T> & {
|
|
9
|
-
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "withCharacterLimit">["slots"];
|
|
10
|
-
} & {
|
|
11
|
-
modelValue?: T;
|
|
12
|
-
}) & {
|
|
13
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
14
|
-
onChange?: ((event: Event) => any) | undefined;
|
|
15
|
-
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
16
|
-
}> & (typeof globalThis extends {
|
|
17
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
18
|
-
} ? P : {});
|
|
19
|
-
expose: (exposed: {}) => void;
|
|
20
|
-
attrs: any;
|
|
21
|
-
slots: OmitByKey<InputSlots, "trailing">;
|
|
22
|
-
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
23
|
-
}>) => import("vue").VNode & {
|
|
24
|
-
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
25
|
-
};
|
|
26
|
-
declare const _default: typeof __VLS_export;
|
|
27
|
-
export default _default;
|
|
28
|
-
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
29
|
-
[K in keyof T]: T[K];
|
|
30
|
-
} : {
|
|
31
|
-
[K in keyof T as K]: T[K];
|
|
32
|
-
}) & {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { InputProps, InputSlots, InputValue, ComponentConfig } from '@nuxt/ui';
|
|
2
|
-
import type { OmitByKey } from '@movk/core';
|
|
3
|
-
import theme from '#build/movk-ui/with-clear';
|
|
4
|
-
import inputTheme from '#build/ui/input';
|
|
5
|
-
import type { AppConfig } from 'nuxt/schema';
|
|
6
|
-
import type { WithClearProps } from '../../types/components/input/with-clear';
|
|
7
|
-
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
8
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithClearProps<T> & {
|
|
9
|
-
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "withCharacterLimit">["slots"];
|
|
10
|
-
} & {
|
|
11
|
-
modelValue?: InputProps<T>["modelValue"];
|
|
12
|
-
}) & {
|
|
13
|
-
onClear?: (() => any) | undefined;
|
|
14
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
15
|
-
onChange?: ((event: Event) => any) | undefined;
|
|
16
|
-
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
17
|
-
}> & (typeof globalThis extends {
|
|
18
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
19
|
-
} ? P : {});
|
|
20
|
-
expose: (exposed: {}) => void;
|
|
21
|
-
attrs: any;
|
|
22
|
-
slots: OmitByKey<InputSlots, "trailing">;
|
|
23
|
-
emit: (((evt: "clear") => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
24
|
-
}>) => import("vue").VNode & {
|
|
25
|
-
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
26
|
-
};
|
|
27
|
-
declare const _default: typeof __VLS_export;
|
|
28
|
-
export default _default;
|
|
29
|
-
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
30
|
-
[K in keyof T]: T[K];
|
|
31
|
-
} : {
|
|
32
|
-
[K in keyof T as K]: T[K];
|
|
33
|
-
}) & {};
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
<script setup>
|
|
2
|
-
import { useAttrs } from "vue";
|
|
3
|
-
import { UInput, UButton } from "#components";
|
|
4
|
-
import { isEmpty } from "@movk/core";
|
|
5
|
-
import { useAppConfig } from "#imports";
|
|
6
|
-
import theme from "#build/movk-ui/with-clear";
|
|
7
|
-
import inputTheme from "#build/ui/input";
|
|
8
|
-
import { useExtendedTv } from "../../utils/extend-theme";
|
|
9
|
-
import { useFormFieldBridge, useForwardedProps } from "../../utils/form-control";
|
|
10
|
-
const props = defineProps({
|
|
11
|
-
buttonProps: { type: Object, required: false },
|
|
12
|
-
ui: { type: Object, required: false }
|
|
13
|
-
});
|
|
14
|
-
const emits = defineEmits(["update:modelValue", "blur", "change", "clear"]);
|
|
15
|
-
const slots = defineSlots();
|
|
16
|
-
defineOptions({ inheritAttrs: false });
|
|
17
|
-
const attrs = useAttrs();
|
|
18
|
-
const appConfig = useAppConfig();
|
|
19
|
-
const modelValue = defineModel({ type: null });
|
|
20
|
-
const inputProps = useForwardedProps(props, ["ui", "buttonProps", "defaultValue", "modelModifiers"]);
|
|
21
|
-
const { size: buttonSize, emitFormChange, emitFormInput } = useFormFieldBridge(props);
|
|
22
|
-
const { baseUi } = useExtendedTv(
|
|
23
|
-
inputTheme,
|
|
24
|
-
theme,
|
|
25
|
-
() => appConfig.movk?.withClear,
|
|
26
|
-
() => ({ ui: props.ui })
|
|
27
|
-
);
|
|
28
|
-
function handleClear() {
|
|
29
|
-
modelValue.value = void 0;
|
|
30
|
-
emitFormInput();
|
|
31
|
-
emitFormChange();
|
|
32
|
-
emits("clear");
|
|
33
|
-
}
|
|
34
|
-
</script>
|
|
35
|
-
|
|
36
|
-
<template>
|
|
37
|
-
<UInput
|
|
38
|
-
v-model="modelValue"
|
|
39
|
-
:ui="baseUi"
|
|
40
|
-
v-bind="{ ...inputProps, ...attrs }"
|
|
41
|
-
@blur="emits('blur', $event)"
|
|
42
|
-
@change="emits('change', $event)"
|
|
43
|
-
>
|
|
44
|
-
<template v-for="(_, slotName) in slots" :key="slotName" #[slotName]="slotProps">
|
|
45
|
-
<slot :name="slotName" v-bind="slotProps ?? {}" />
|
|
46
|
-
</template>
|
|
47
|
-
|
|
48
|
-
<template v-if="!isEmpty(modelValue)" #trailing>
|
|
49
|
-
<UButton
|
|
50
|
-
color="neutral"
|
|
51
|
-
variant="link"
|
|
52
|
-
:size="buttonSize"
|
|
53
|
-
icon="i-lucide-circle-x"
|
|
54
|
-
aria-label="Clear input"
|
|
55
|
-
v-bind="props.buttonProps"
|
|
56
|
-
@click="handleClear"
|
|
57
|
-
/>
|
|
58
|
-
</template>
|
|
59
|
-
</UInput>
|
|
60
|
-
</template>
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { InputProps, InputSlots, InputValue, ComponentConfig } from '@nuxt/ui';
|
|
2
|
-
import type { OmitByKey } from '@movk/core';
|
|
3
|
-
import theme from '#build/movk-ui/with-clear';
|
|
4
|
-
import inputTheme from '#build/ui/input';
|
|
5
|
-
import type { AppConfig } from 'nuxt/schema';
|
|
6
|
-
import type { WithClearProps } from '../../types/components/input/with-clear';
|
|
7
|
-
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
8
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithClearProps<T> & {
|
|
9
|
-
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "withCharacterLimit">["slots"];
|
|
10
|
-
} & {
|
|
11
|
-
modelValue?: InputProps<T>["modelValue"];
|
|
12
|
-
}) & {
|
|
13
|
-
onClear?: (() => any) | undefined;
|
|
14
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
15
|
-
onChange?: ((event: Event) => any) | undefined;
|
|
16
|
-
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
17
|
-
}> & (typeof globalThis extends {
|
|
18
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
19
|
-
} ? P : {});
|
|
20
|
-
expose: (exposed: {}) => void;
|
|
21
|
-
attrs: any;
|
|
22
|
-
slots: OmitByKey<InputSlots, "trailing">;
|
|
23
|
-
emit: (((evt: "clear") => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
24
|
-
}>) => import("vue").VNode & {
|
|
25
|
-
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
26
|
-
};
|
|
27
|
-
declare const _default: typeof __VLS_export;
|
|
28
|
-
export default _default;
|
|
29
|
-
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
30
|
-
[K in keyof T]: T[K];
|
|
31
|
-
} : {
|
|
32
|
-
[K in keyof T as K]: T[K];
|
|
33
|
-
}) & {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { ComponentConfig, InputSlots, InputValue } from '@nuxt/ui';
|
|
2
|
-
import type { OmitByKey } from '@movk/core';
|
|
3
|
-
import theme from '#build/movk-ui/with-copy';
|
|
4
|
-
import inputTheme from '#build/ui/input';
|
|
5
|
-
import type { WithCopyProps } from '../../types/components/input/with-copy';
|
|
6
|
-
import type { AppConfig } from 'nuxt/schema';
|
|
7
|
-
declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
8
|
-
props: import("vue").PublicProps & __VLS_PrettifyLocal<(WithCopyProps<T> & {
|
|
9
|
-
ui?: ComponentConfig<typeof inputTheme & typeof theme, AppConfig, "withCopy">["slots"];
|
|
10
|
-
} & {
|
|
11
|
-
modelValue?: T;
|
|
12
|
-
}) & {
|
|
13
|
-
onBlur?: ((event: FocusEvent) => any) | undefined;
|
|
14
|
-
onChange?: ((event: Event) => any) | undefined;
|
|
15
|
-
onCopy?: ((value: string) => any) | undefined;
|
|
16
|
-
"onUpdate:modelValue"?: ((value: T | undefined) => any) | undefined;
|
|
17
|
-
}> & (typeof globalThis extends {
|
|
18
|
-
__VLS_PROPS_FALLBACK: infer P;
|
|
19
|
-
} ? P : {});
|
|
20
|
-
expose: (exposed: {}) => void;
|
|
21
|
-
attrs: any;
|
|
22
|
-
slots: OmitByKey<InputSlots, "trailing">;
|
|
23
|
-
emit: (((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "copy", value: string) => void) & ((evt: "update:modelValue", value: T) => void)) & ((event: "update:modelValue", value: T | undefined) => void);
|
|
24
|
-
}>) => import("vue").VNode & {
|
|
25
|
-
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
26
|
-
};
|
|
27
|
-
declare const _default: typeof __VLS_export;
|
|
28
|
-
export default _default;
|
|
29
|
-
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
30
|
-
[K in keyof T]: T[K];
|
|
31
|
-
} : {
|
|
32
|
-
[K in keyof T as K]: T[K];
|
|
33
|
-
}) & {};
|