@varlet/ui 3.15.2 → 3.16.0-alpha.1778498431663

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.
Files changed (43) hide show
  1. package/README.md +0 -1
  2. package/README.zh-CN.md +0 -1
  3. package/es/action-sheet/style/index.mjs +1 -1
  4. package/es/card/Card.mjs +26 -4
  5. package/es/card/card.css +1 -1
  6. package/es/card/props.mjs +2 -0
  7. package/es/card/style/index.mjs +1 -0
  8. package/es/index.bundle.mjs +7 -1
  9. package/es/index.mjs +6 -1
  10. package/es/otp-input/OtpInput.mjs +424 -0
  11. package/es/otp-input/OtpInputSfc.css +0 -0
  12. package/es/otp-input/index.mjs +12 -0
  13. package/es/otp-input/otpInput.css +1 -0
  14. package/es/otp-input/props.mjs +78 -0
  15. package/es/otp-input/style/index.mjs +7 -0
  16. package/es/paper/Paper.mjs +23 -6
  17. package/es/paper/paper.css +1 -1
  18. package/es/paper/props.mjs +2 -0
  19. package/es/paper/style/index.mjs +1 -0
  20. package/es/style.mjs +1 -0
  21. package/es/themes/dark/index.mjs +3 -2
  22. package/es/themes/dark/otpInput.mjs +10 -0
  23. package/es/themes/md3-dark/card.mjs +1 -0
  24. package/es/themes/md3-dark/index.mjs +3 -2
  25. package/es/themes/md3-dark/otpInput.mjs +10 -0
  26. package/es/themes/md3-dark/paper.mjs +1 -0
  27. package/es/themes/md3-light/card.mjs +1 -0
  28. package/es/themes/md3-light/index.mjs +3 -2
  29. package/es/themes/md3-light/otpInput.mjs +10 -0
  30. package/es/themes/md3-light/paper.mjs +1 -0
  31. package/es/varlet.css +1 -1
  32. package/es/varlet.esm.js +6994 -6583
  33. package/highlight/web-types.en-US.json +237 -1
  34. package/highlight/web-types.zh-CN.json +237 -1
  35. package/lib/varlet.cjs.js +2280 -1775
  36. package/lib/varlet.css +1 -1
  37. package/package.json +7 -7
  38. package/types/card.d.ts +4 -0
  39. package/types/index.d.ts +2 -0
  40. package/types/otpInput.d.ts +68 -0
  41. package/types/paper.d.ts +4 -0
  42. package/types/styleVars.d.ts +7 -0
  43. package/umd/varlet.js +7 -7
@@ -0,0 +1,424 @@
1
+ import { call, clamp, toNumber } from "@varlet/shared";
2
+ import { onSmartMounted } from "@varlet/use";
3
+ import { computed, defineComponent, nextTick, ref, useSlots } from "vue";
4
+ import VarFormDetails from "../form-details/index.mjs";
5
+ import { useForm } from "../form/provide.mjs";
6
+ import VarInput from "../input/Input.mjs";
7
+ import { createNamespace, flatFragment, useValidation } from "../utils/components.mjs";
8
+ import { toSizeUnit } from "../utils/elements.mjs";
9
+ import { props } from "./props.mjs";
10
+ const { name, n, classes } = createNamespace("otp-input");
11
+ import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, resolveComponent as _resolveComponent, createVNode as _createVNode, normalizeClass as _normalizeClass, createElementVNode as _createElementVNode, renderSlot as _renderSlot, createCommentVNode as _createCommentVNode, normalizeStyle as _normalizeStyle } from "vue";
12
+ const _hoisted_1 = ["data-index"];
13
+ function __render__(_ctx, _cache) {
14
+ const _component_var_input = _resolveComponent("var-input");
15
+ const _component_var_form_details = _resolveComponent("var-form-details");
16
+ return _openBlock(), _createElementBlock(
17
+ "div",
18
+ {
19
+ ref: "rootEl",
20
+ class: _normalizeClass(_ctx.classes(_ctx.n(), _ctx.n("$--box"))),
21
+ style: _normalizeStyle({
22
+ "--otp-input-gutter": _ctx.gutterStyle,
23
+ "--otp-input-cell-height": _ctx.cellHeightStyle,
24
+ "--otp-input-cell-max-width": _ctx.cellMaxWidthStyle
25
+ }),
26
+ onClick: _cache[1] || (_cache[1] = (...args) => _ctx.handleClick && _ctx.handleClick(...args)),
27
+ onKeydown: _cache[2] || (_cache[2] = (...args) => _ctx.handleKeydown && _ctx.handleKeydown(...args)),
28
+ onPaste: _cache[3] || (_cache[3] = (...args) => _ctx.handlePaste && _ctx.handlePaste(...args))
29
+ },
30
+ [
31
+ _createElementVNode(
32
+ "div",
33
+ {
34
+ class: _normalizeClass(_ctx.n("cells"))
35
+ },
36
+ [
37
+ (_openBlock(true), _createElementBlock(
38
+ _Fragment,
39
+ null,
40
+ _renderList(_ctx.cellIndexes, (_, index) => {
41
+ return _openBlock(), _createElementBlock(
42
+ _Fragment,
43
+ { key: index },
44
+ [
45
+ _createElementVNode("div", {
46
+ class: _normalizeClass(_ctx.n("cell")),
47
+ "data-index": index
48
+ }, [
49
+ _createVNode(_component_var_input, {
50
+ ref_for: true,
51
+ ref: (el) => _ctx.setInputRef(el, index),
52
+ "model-value": _ctx.getDisplayChar(index),
53
+ type: _ctx.nativeInputType,
54
+ maxlength: 1,
55
+ autocomplete: "one-time-code",
56
+ placeholder: "",
57
+ hint: false,
58
+ variant: _ctx.variant,
59
+ "text-color": _ctx.textColor,
60
+ "focus-color": _ctx.focusColor,
61
+ "blur-color": _ctx.blurColor,
62
+ disabled: _ctx.formDisabled || _ctx.disabled,
63
+ readonly: _ctx.formReadonly || _ctx.readonly,
64
+ inputmode: _ctx.resolvedInputmode,
65
+ "is-force-focusing-effect": _ctx.activeIndex === index,
66
+ "is-force-error-effect": !!_ctx.errorMessage,
67
+ "is-show-form-details": false,
68
+ onFocus: () => _ctx.handleFocus(index),
69
+ onBlur: _cache[0] || (_cache[0] = (event) => _ctx.handleBlur(event)),
70
+ onInput: (value) => _ctx.handleCellInput(index, value)
71
+ }, null, 8, ["model-value", "type", "variant", "text-color", "focus-color", "blur-color", "disabled", "readonly", "inputmode", "is-force-focusing-effect", "is-force-error-effect", "onFocus", "onInput"])
72
+ ], 10, _hoisted_1),
73
+ _ctx.shouldRenderSeparator(index) ? (_openBlock(), _createElementBlock(
74
+ "div",
75
+ {
76
+ key: 0,
77
+ class: _normalizeClass(_ctx.n("separator"))
78
+ },
79
+ [
80
+ _renderSlot(_ctx.$slots, "separator", { index })
81
+ ],
82
+ 2
83
+ /* CLASS */
84
+ )) : _createCommentVNode("v-if", true)
85
+ ],
86
+ 64
87
+ /* STABLE_FRAGMENT */
88
+ );
89
+ }),
90
+ 128
91
+ /* KEYED_FRAGMENT */
92
+ ))
93
+ ],
94
+ 2
95
+ /* CLASS */
96
+ ),
97
+ _createVNode(_component_var_form_details, {
98
+ class: _normalizeClass(_ctx.n("details")),
99
+ "var-otp-input-cover": "",
100
+ "error-message": _ctx.errorMessage
101
+ }, null, 8, ["class", "error-message"])
102
+ ],
103
+ 38
104
+ /* CLASS, STYLE, NEED_HYDRATION */
105
+ );
106
+ }
107
+ const __sfc__ = defineComponent({
108
+ name,
109
+ components: {
110
+ VarFormDetails,
111
+ VarInput
112
+ },
113
+ props,
114
+ setup(props2) {
115
+ const slots = useSlots();
116
+ const rootEl = ref(null);
117
+ const inputRefs = ref([]);
118
+ const activeIndex = ref(-1);
119
+ const { errorMessage, validateWithTrigger: vt, validate: v, resetValidation } = useValidation();
120
+ const { bindForm, form } = useForm();
121
+ const normalizedLength = computed(() => toNumber(props2.length));
122
+ const normalizedMaskSymbol = computed(() => {
123
+ var _a;
124
+ return (_a = splitChars(props2.maskSymbol)[0]) != null ? _a : "\u2022";
125
+ });
126
+ const normalizedValue = computed(() => normalizeValue(props2.modelValue));
127
+ const cellIndexes = computed(() => Array.from({ length: normalizedLength.value }));
128
+ const gutterStyle = computed(() => toSizeUnit(props2.gutter));
129
+ const cellHeightStyle = computed(() => toSizeUnit(props2.cellHeight));
130
+ const cellMaxWidthStyle = computed(() => toSizeUnit(props2.cellMaxWidth));
131
+ const resolvedInputmode = computed(() => props2.type === "digit" ? "numeric" : void 0);
132
+ const nativeInputType = computed(() => props2.type === "digit" ? "tel" : "text");
133
+ const formDisabled = computed(() => {
134
+ var _a;
135
+ return (_a = form == null ? void 0 : form.disabled.value) != null ? _a : false;
136
+ });
137
+ const formReadonly = computed(() => {
138
+ var _a;
139
+ return (_a = form == null ? void 0 : form.readonly.value) != null ? _a : false;
140
+ });
141
+ let pendingFocusIndex = null;
142
+ let focusEffectQueued = false;
143
+ bindForm == null ? void 0 : bindForm({ validate, resetValidation, reset });
144
+ onSmartMounted(() => {
145
+ if (props2.autofocus) {
146
+ focus();
147
+ }
148
+ });
149
+ function splitChars(value) {
150
+ return Array.from(value);
151
+ }
152
+ function normalizeValue(value) {
153
+ return transformByType(value).slice(0, normalizedLength.value);
154
+ }
155
+ function transformByType(value) {
156
+ switch (props2.type) {
157
+ case "digit":
158
+ return value.replace(/\D+/g, "");
159
+ case "alphanumeric":
160
+ return splitChars(value).filter((char) => /[A-Za-z0-9]/.test(char)).join("");
161
+ default:
162
+ return value;
163
+ }
164
+ }
165
+ function getValueChars() {
166
+ return splitChars(normalizedValue.value);
167
+ }
168
+ function getDisplayChar(index) {
169
+ var _a;
170
+ const char = (_a = getValueChars()[index]) != null ? _a : "";
171
+ if (!char) {
172
+ return "";
173
+ }
174
+ return props2.mask ? normalizedMaskSymbol.value : char;
175
+ }
176
+ function setInputRef(el, index) {
177
+ inputRefs.value[index] = el && "$" in el ? el : null;
178
+ }
179
+ function shouldRenderSeparator(index) {
180
+ if (index >= normalizedLength.value - 1 || !slots.separator) {
181
+ return false;
182
+ }
183
+ const vNodes = slots.separator({ index });
184
+ return flatFragment(vNodes).length > 0;
185
+ }
186
+ function validateWithTrigger(trigger, value = normalizedValue.value) {
187
+ nextTick(() => {
188
+ vt(props2.validateTrigger, trigger, props2.rules, value);
189
+ });
190
+ }
191
+ function maybeEmitComplete(value) {
192
+ if (splitChars(value).length !== normalizedLength.value) {
193
+ return;
194
+ }
195
+ call(props2.onComplete, value);
196
+ validateWithTrigger("onComplete", value);
197
+ }
198
+ function updateValue(value, index) {
199
+ if (value === normalizedValue.value) {
200
+ syncCellDisplayValue(index);
201
+ return;
202
+ }
203
+ call(props2["onUpdate:modelValue"], value);
204
+ call(props2.onInput, value);
205
+ validateWithTrigger("onInput", value);
206
+ maybeEmitComplete(value);
207
+ }
208
+ function focusCell(index) {
209
+ var _a, _b;
210
+ const targetIndex = clamp(index, 0, normalizedLength.value - 1);
211
+ (_b = (_a = inputRefs.value[targetIndex]) == null ? void 0 : _a.focus) == null ? void 0 : _b.call(_a);
212
+ }
213
+ function focus(index) {
214
+ const targetIndex = index == null ? Math.min(getValueChars().length, normalizedLength.value - 1) : index;
215
+ focusCell(targetIndex);
216
+ }
217
+ function blur() {
218
+ inputRefs.value.forEach((inputRef) => {
219
+ var _a;
220
+ (_a = inputRef == null ? void 0 : inputRef.blur) == null ? void 0 : _a.call(inputRef);
221
+ });
222
+ }
223
+ function validate() {
224
+ return v(props2.rules, normalizedValue.value);
225
+ }
226
+ function reset() {
227
+ if (normalizedValue.value !== "") {
228
+ call(props2["onUpdate:modelValue"], "");
229
+ }
230
+ resetValidation();
231
+ }
232
+ function syncCellDisplayValue(index) {
233
+ var _a;
234
+ const inputEl = (_a = inputRefs.value[index]) == null ? void 0 : _a.el;
235
+ if (inputEl) {
236
+ inputEl.value = getDisplayChar(index);
237
+ }
238
+ }
239
+ function syncAllCellDisplayValues() {
240
+ cellIndexes.value.forEach((_, index) => {
241
+ syncCellDisplayValue(index);
242
+ });
243
+ }
244
+ function scheduleFocusEffect(index) {
245
+ pendingFocusIndex = index;
246
+ if (focusEffectQueued) {
247
+ return;
248
+ }
249
+ focusEffectQueued = true;
250
+ nextTick(() => {
251
+ focusEffectQueued = false;
252
+ if (pendingFocusIndex == null) {
253
+ return;
254
+ }
255
+ activeIndex.value = pendingFocusIndex;
256
+ focusCell(pendingFocusIndex);
257
+ pendingFocusIndex = null;
258
+ });
259
+ }
260
+ function replaceChars(index, chars) {
261
+ const valueChars = getValueChars();
262
+ const targetIndex = clamp(index, 0, valueChars.length);
263
+ const nextChars = [...valueChars];
264
+ const processedChars = chars.slice(0, normalizedLength.value - targetIndex);
265
+ processedChars.forEach((char, offset) => {
266
+ nextChars[targetIndex + offset] = char;
267
+ });
268
+ const nextValue = nextChars.join("").slice(0, normalizedLength.value);
269
+ updateValue(nextValue, targetIndex);
270
+ const nextFocusIndex = clamp(targetIndex + processedChars.length, 0, normalizedLength.value - 1);
271
+ scheduleFocusEffect(nextFocusIndex);
272
+ }
273
+ function removeAt(index, focusIndex = clamp(index, 0, normalizedLength.value - 1)) {
274
+ const valueChars = getValueChars();
275
+ valueChars.splice(index, 1);
276
+ const nextValue = valueChars.join("");
277
+ updateValue(nextValue, index);
278
+ scheduleFocusEffect(focusIndex);
279
+ }
280
+ function removeWithBackspace(index) {
281
+ const valueChars = getValueChars();
282
+ if (!valueChars[index]) {
283
+ if (index <= 0) {
284
+ syncAllCellDisplayValues();
285
+ return;
286
+ }
287
+ removeAt(index - 1, index - 1);
288
+ return;
289
+ }
290
+ const isLastCell = index === valueChars.length - 1;
291
+ const nextFocusIndex = !isLastCell && index > 0 ? index - 1 : clamp(index, 0, normalizedLength.value - 1);
292
+ removeAt(index, nextFocusIndex);
293
+ }
294
+ function handleClick(event) {
295
+ if (props2.disabled || formDisabled.value) {
296
+ return;
297
+ }
298
+ call(props2.onClick, event);
299
+ validateWithTrigger("onClick");
300
+ }
301
+ function handleFocus(index) {
302
+ const valueChars = getValueChars();
303
+ activeIndex.value = index;
304
+ if (valueChars[index]) {
305
+ nextTick(() => {
306
+ var _a, _b;
307
+ (_b = (_a = inputRefs.value[index]) == null ? void 0 : _a.select) == null ? void 0 : _b.call(_a);
308
+ });
309
+ }
310
+ }
311
+ function handleBlur(event) {
312
+ var _a;
313
+ const relatedTarget = event.relatedTarget;
314
+ const isLeavingComponent = !relatedTarget || !((_a = rootEl.value) == null ? void 0 : _a.contains(relatedTarget));
315
+ if (isLeavingComponent) {
316
+ activeIndex.value = -1;
317
+ }
318
+ }
319
+ function handleCellInput(index, value) {
320
+ const inputChars = splitChars(transformByType(value));
321
+ const valueChars = getValueChars();
322
+ const crossTargetIndex = index > valueChars.length;
323
+ if (inputChars.length === 0) {
324
+ if (crossTargetIndex) {
325
+ scheduleFocusEffect(valueChars.length);
326
+ syncCellDisplayValue(index);
327
+ return;
328
+ }
329
+ if (value === "") {
330
+ removeAt(index);
331
+ } else {
332
+ syncCellDisplayValue(index);
333
+ }
334
+ return;
335
+ }
336
+ if (crossTargetIndex) {
337
+ replaceChars(valueChars.length, inputChars);
338
+ return;
339
+ }
340
+ replaceChars(index, inputChars);
341
+ }
342
+ function handlePaste(event) {
343
+ var _a, _b;
344
+ if (!props2.allowPaste || formDisabled.value || formReadonly.value || props2.disabled || props2.readonly) {
345
+ return;
346
+ }
347
+ const text = (_b = (_a = event.clipboardData) == null ? void 0 : _a.getData("text")) != null ? _b : "";
348
+ if (!text) {
349
+ return;
350
+ }
351
+ event.preventDefault();
352
+ const transformedValue = props2.pasteTransform ? props2.pasteTransform(text) : text;
353
+ const result = transformByType(transformedValue);
354
+ call(props2.onPaste, result, event);
355
+ validateWithTrigger("onPaste", result);
356
+ if (!result) {
357
+ syncAllCellDisplayValues();
358
+ return;
359
+ }
360
+ replaceChars(0, splitChars(result));
361
+ }
362
+ function handleKeydown(event) {
363
+ if (formDisabled.value || formReadonly.value || props2.disabled || props2.readonly) {
364
+ return;
365
+ }
366
+ const target = event.target;
367
+ const cell = target == null ? void 0 : target.closest(`.${n("cell")}`);
368
+ const indexAttr = cell == null ? void 0 : cell.dataset.index;
369
+ if (indexAttr == null) {
370
+ return;
371
+ }
372
+ const index = Number(indexAttr);
373
+ if (event.key === "Backspace" && getValueChars().length > 0) {
374
+ event.preventDefault();
375
+ removeWithBackspace(index);
376
+ return;
377
+ }
378
+ if (event.key === "ArrowLeft" && index > 0) {
379
+ event.preventDefault();
380
+ focusCell(index - 1);
381
+ return;
382
+ }
383
+ if (event.key === "ArrowRight" && index < normalizedLength.value - 1) {
384
+ event.preventDefault();
385
+ focusCell(index + 1);
386
+ return;
387
+ }
388
+ }
389
+ return {
390
+ rootEl,
391
+ activeIndex,
392
+ errorMessage,
393
+ formDisabled,
394
+ formReadonly,
395
+ cellIndexes,
396
+ gutterStyle,
397
+ cellHeightStyle,
398
+ cellMaxWidthStyle,
399
+ resolvedInputmode,
400
+ nativeInputType,
401
+ n,
402
+ classes,
403
+ setInputRef,
404
+ getDisplayChar,
405
+ shouldRenderSeparator,
406
+ handleClick,
407
+ handleFocus,
408
+ handleBlur,
409
+ handleCellInput,
410
+ handleKeydown,
411
+ handlePaste,
412
+ focus,
413
+ blur,
414
+ reset,
415
+ validate,
416
+ resetValidation
417
+ };
418
+ }
419
+ });
420
+ __sfc__.render = __render__;
421
+ var stdin_default = __sfc__;
422
+ export {
423
+ stdin_default as default
424
+ };
File without changes
@@ -0,0 +1,12 @@
1
+ import { withInstall, withPropsDefaultsSetter } from "../utils/components.mjs";
2
+ import OtpInput from "./OtpInput.mjs";
3
+ import { props as otpInputProps } from "./props.mjs";
4
+ withInstall(OtpInput);
5
+ withPropsDefaultsSetter(OtpInput, otpInputProps);
6
+ const _OtpInputComponent = OtpInput;
7
+ var stdin_default = OtpInput;
8
+ export {
9
+ _OtpInputComponent,
10
+ stdin_default as default,
11
+ otpInputProps
12
+ };
@@ -0,0 +1 @@
1
+ :root { --otp-input-gutter: 8px; --otp-input-cell-height: 48px; --otp-input-cell-max-width: 48px; --otp-input-input-font-size: 20px; --otp-input-separator-color: var(--color-text-disabled);}.var-otp-input { display: inline-flex; flex-direction: column; align-items: stretch; width: 100%; max-width: 100%;}.var-otp-input__cells { display: flex; align-items: center; justify-content: center; gap: var(--otp-input-gutter); width: 100%; max-width: 100%;}.var-otp-input__cell { flex: 1 1 0; min-width: 0; height: var(--otp-input-cell-height); max-width: var(--otp-input-cell-max-width);}.var-otp-input__separator { flex: none; display: inline-flex; align-items: center; justify-content: center; color: var(--otp-input-separator-color); white-space: nowrap;}.var-otp-input__details { width: 100%;}.var-otp-input .var-input__input { text-align: center; font-size: var(--otp-input-input-font-size); text-transform: none; height: 100%;}.var-otp-input .var-field-decorator__middle { justify-content: center;}.var-otp-input .var-field-decorator--standard .var-field-decorator__controller,.var-otp-input .var-field-decorator--standard .var-field-decorator__middle { height: 100%;}.var-otp-input .var-field-decorator--standard .var-field-decorator__middle,.var-otp-input .var-field-decorator--standard .var-field-decorator__icon,.var-otp-input .var-field-decorator--standard .var-field-decorator--middle-non-hint,.var-otp-input .var-field-decorator--standard .var-field-decorator--icon-non-hint { margin-top: 0; margin-bottom: 0;}.var-otp-input .var-field-decorator--outlined .var-field-decorator__controller,.var-otp-input .var-field-decorator--outlined .var-field-decorator__middle { height: 100%;}.var-otp-input .var-field-decorator--outlined .var-field-decorator__middle,.var-otp-input .var-field-decorator--outlined .var-field-decorator__icon { margin-top: 0; margin-bottom: 0;}.var-otp-input .var-field-decorator--filled .var-field-decorator__controller,.var-otp-input .var-field-decorator--filled .var-field-decorator__middle { height: 100%;}.var-otp-input .var-field-decorator--filled .var-field-decorator__middle,.var-otp-input .var-field-decorator--filled .var-field-decorator__icon,.var-otp-input .var-field-decorator--filled .var-field-decorator--middle-non-hint,.var-otp-input .var-field-decorator--filled .var-field-decorator--icon-non-hint { margin-top: 0; margin-bottom: 0;}.var-otp-input .var-input,.var-otp-input .var-field-decorator,.var-otp-input .var-field-decorator__container,.var-otp-input .var-field-decorator__main,.var-otp-input .var-field-decorator__body { height: 100%;}
@@ -0,0 +1,78 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import { fieldDecoratorProps } from "../field-decorator/index.mjs";
21
+ import { defineListenerProp, pickProps } from "../utils/components.mjs";
22
+ const props = __spreadProps(__spreadValues({
23
+ modelValue: {
24
+ type: String,
25
+ default: ""
26
+ },
27
+ length: {
28
+ type: [String, Number],
29
+ default: 6
30
+ },
31
+ type: {
32
+ type: String,
33
+ default: "digit"
34
+ },
35
+ mask: Boolean,
36
+ maskSymbol: {
37
+ type: String,
38
+ default: "\u2022"
39
+ },
40
+ cellHeight: {
41
+ type: [String, Number],
42
+ default: 48
43
+ },
44
+ cellMaxWidth: {
45
+ type: [String, Number],
46
+ default: 48
47
+ },
48
+ disabled: Boolean,
49
+ readonly: Boolean,
50
+ autofocus: Boolean,
51
+ gutter: {
52
+ type: [String, Number],
53
+ default: 8
54
+ },
55
+ validateTrigger: {
56
+ type: Array,
57
+ default: () => ["onInput", "onComplete"]
58
+ },
59
+ rules: [Array, Function, Object],
60
+ allowPaste: {
61
+ type: Boolean,
62
+ default: true
63
+ },
64
+ pasteTransform: Function,
65
+ onInput: defineListenerProp(),
66
+ onClick: defineListenerProp(),
67
+ onPaste: defineListenerProp(),
68
+ onComplete: defineListenerProp(),
69
+ "onUpdate:modelValue": defineListenerProp()
70
+ }, pickProps(fieldDecoratorProps, ["textColor", "focusColor", "blurColor"])), {
71
+ variant: {
72
+ type: String,
73
+ default: "outlined"
74
+ }
75
+ });
76
+ export {
77
+ props
78
+ };
@@ -0,0 +1,7 @@
1
+ import '../../styles/common.css'
2
+ import '../../icon/icon.css'
3
+ import '../../field-decorator/fieldDecorator.css'
4
+ import '../../form-details/formDetails.css'
5
+ import '../../input/input.css'
6
+ import '../otpInput.css'
7
+ import '../OtpInputSfc.css'
@@ -1,13 +1,17 @@
1
1
  import { call } from "@varlet/shared";
2
- import { defineComponent } from "vue";
2
+ import { computed, defineComponent } from "vue";
3
+ import Hover from "../hover/index.mjs";
4
+ import VarHoverOverlay, { useHoverOverlay } from "../hover-overlay/index.mjs";
3
5
  import Ripple from "../ripple/index.mjs";
4
6
  import { createNamespace, formatElevation } from "../utils/components.mjs";
5
7
  import { toSizeUnit } from "../utils/elements.mjs";
6
8
  import { props } from "./props.mjs";
7
9
  const { name, n, classes } = createNamespace("paper");
8
- import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, openBlock as _openBlock, createElementBlock as _createElementBlock, withDirectives as _withDirectives } from "vue";
10
+ import { renderSlot as _renderSlot, resolveComponent as _resolveComponent, createVNode as _createVNode, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, resolveDirective as _resolveDirective, openBlock as _openBlock, createElementBlock as _createElementBlock, withDirectives as _withDirectives } from "vue";
9
11
  function __render__(_ctx, _cache) {
12
+ const _component_var_hover_overlay = _resolveComponent("var-hover-overlay");
10
13
  const _directive_ripple = _resolveDirective("ripple");
14
+ const _directive_hover = _resolveDirective("hover");
11
15
  return _withDirectives((_openBlock(), _createElementBlock(
12
16
  "div",
13
17
  {
@@ -16,8 +20,9 @@ function __render__(_ctx, _cache) {
16
20
  _ctx.n(),
17
21
  _ctx.n("$--box"),
18
22
  _ctx.formatElevation(_ctx.elevation, 2),
19
- [_ctx.onClick, _ctx.n("--cursor")],
23
+ [_ctx.onClick || _ctx.hoverable, _ctx.n("--cursor")],
20
24
  [_ctx.round, _ctx.n("--round")],
25
+ [_ctx.surfaceLow, _ctx.n("--surface-low")],
21
26
  [_ctx.inline, _ctx.n("$--inline-flex")]
22
27
  )
23
28
  ),
@@ -29,19 +34,28 @@ function __render__(_ctx, _cache) {
29
34
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
30
35
  },
31
36
  [
32
- _renderSlot(_ctx.$slots, "default")
37
+ _renderSlot(_ctx.$slots, "default"),
38
+ _createVNode(_component_var_hover_overlay, {
39
+ hovering: _ctx.hoverable ? _ctx.hovering : false
40
+ }, null, 8, ["hovering"])
33
41
  ],
34
42
  6
35
43
  /* CLASS, STYLE */
36
44
  )), [
37
- [_directive_ripple, { disabled: !_ctx.ripple }]
45
+ [_directive_ripple, { disabled: !_ctx.ripple }],
46
+ [_directive_hover, _ctx.handleHovering, "desktop"]
38
47
  ]);
39
48
  }
40
49
  const __sfc__ = defineComponent({
41
50
  name,
42
- directives: { Ripple },
51
+ directives: { Ripple, Hover },
52
+ components: {
53
+ VarHoverOverlay
54
+ },
43
55
  props,
44
56
  setup(props2) {
57
+ const surfaceLow = computed(() => props2.surface === "low");
58
+ const { hovering, handleHovering } = useHoverOverlay();
45
59
  function handleClick(e) {
46
60
  call(props2.onClick, e);
47
61
  }
@@ -49,6 +63,9 @@ const __sfc__ = defineComponent({
49
63
  n,
50
64
  classes,
51
65
  formatElevation,
66
+ surfaceLow,
67
+ hovering,
68
+ handleHovering,
52
69
  toSizeUnit,
53
70
  handleClick
54
71
  };
@@ -1 +1 @@
1
- :root { --paper-background: var(--color-surface-container-highest); --paper-border-radius: 4px;}.var-paper { background: var(--paper-background); transition: background-color 0.25s; overflow: hidden; border-radius: var(--paper-border-radius); -webkit-tap-highlight-color: transparent;}.var-paper--round { border-radius: 50%;}.var-paper--cursor { cursor: pointer;}
1
+ :root { --paper-background: var(--color-surface-container-highest); --paper-surface-low-background: var(--color-surface-container-highest); --paper-border-radius: 4px;}.var-paper { position: relative; background: var(--paper-background); transition: background-color 0.25s; overflow: hidden; border-radius: var(--paper-border-radius); -webkit-tap-highlight-color: transparent;}.var-paper--round { border-radius: 50%;}.var-paper--cursor { cursor: pointer;}.var-paper--surface-low { background: var(--paper-surface-low-background);}
@@ -10,6 +10,8 @@ const props = {
10
10
  height: [Number, String],
11
11
  round: Boolean,
12
12
  inline: Boolean,
13
+ surface: String,
14
+ hoverable: Boolean,
13
15
  onClick: defineListenerProp()
14
16
  };
15
17
  export {
@@ -1,5 +1,6 @@
1
1
  import '../../styles/common.css'
2
2
  import '../../styles/elevation.css'
3
+ import '../../hover-overlay/hoverOverlay.css'
3
4
  import '../../ripple/ripple.css'
4
5
  import '../paper.css'
5
6
  import '../PaperSfc.css'
package/es/style.mjs CHANGED
@@ -56,6 +56,7 @@ import './menu/style/index.mjs'
56
56
  import './menu-option/style/index.mjs'
57
57
  import './menu-select/style/index.mjs'
58
58
  import './option/style/index.mjs'
59
+ import './otp-input/style/index.mjs'
59
60
  import './overlay/style/index.mjs'
60
61
  import './pagination/style/index.mjs'
61
62
  import './paper/style/index.mjs'
@@ -53,6 +53,7 @@ import menu from "./menu.mjs";
53
53
  import menuOption from "./menuOption.mjs";
54
54
  import menuSelect from "./menuSelect.mjs";
55
55
  import option from "./option.mjs";
56
+ import otpInput from "./otpInput.mjs";
56
57
  import overlay from "./overlay.mjs";
57
58
  import pagination from "./pagination.mjs";
58
59
  import paper from "./paper.mjs";
@@ -80,7 +81,7 @@ import timePicker from "./timePicker.mjs";
80
81
  import tooltip from "./tooltip.mjs";
81
82
  import uploader from "./uploader.mjs";
82
83
  import watermark from "./watermark.mjs";
83
- var stdin_default = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
84
+ var stdin_default = __spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues(__spreadValues({
84
85
  "--color-scheme": "dark",
85
86
  "--font-size-xs": "10px",
86
87
  "--font-size-sm": "12px",
@@ -159,7 +160,7 @@ var stdin_default = __spreadValues(__spreadValues(__spreadValues(__spreadValues(
159
160
  "--shadow-key-umbra-opacity": "rgba(0, 0, 0, 0.2)",
160
161
  "--shadow-key-penumbra-opacity": "rgba(0, 0, 0, 0.14)",
161
162
  "--shadow-key-ambient-opacity": "rgba(0, 0, 0, 0.12)"
162
- }, button), alert), cell), card), timePicker), datePicker), skeleton), tabs), tab), popup), dialog), actionSheet), chip), badge), uploader), collapse), pullRefresh), switchThemes), step), pagination), table), fieldDecorator), radio), checkbox), divider), picker), appBar), bottomNavigationItem), menu), result), breadcrumb), avatar), link), progress), option), watermark), menuSelect), menuOption), avatarGroup), backTop), bottomNavigation), countdown), counter), fab), floatingPanel), formDetails), hoverOverlay), icon), imagePreview), indexBar), input), list), loading), loadingBar), overlay), paper), rate), ripple), slider), snackbar), space), swipe), tooltip), select), code), signature);
163
+ }, button), alert), cell), card), timePicker), datePicker), skeleton), tabs), tab), popup), dialog), actionSheet), chip), badge), uploader), collapse), pullRefresh), switchThemes), step), pagination), table), fieldDecorator), radio), checkbox), divider), picker), appBar), bottomNavigationItem), menu), result), breadcrumb), avatar), link), progress), option), watermark), menuSelect), menuOption), avatarGroup), backTop), bottomNavigation), countdown), counter), fab), floatingPanel), formDetails), hoverOverlay), icon), imagePreview), indexBar), input), otpInput), list), loading), loadingBar), overlay), paper), rate), ripple), slider), snackbar), space), swipe), tooltip), select), code), signature);
163
164
  export {
164
165
  stdin_default as default
165
166
  };
@@ -0,0 +1,10 @@
1
+ var stdin_default = {
2
+ "--otp-input-gutter": "8px",
3
+ "--otp-input-cell-height": "48px",
4
+ "--otp-input-cell-max-width": "48px",
5
+ "--otp-input-input-font-size": "20px",
6
+ "--otp-input-separator-color": "var(--color-text-disabled)"
7
+ };
8
+ export {
9
+ stdin_default as default
10
+ };