naive-ui 2.41.0 → 2.42.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (209) hide show
  1. package/dist/index.js +930 -428
  2. package/dist/index.mjs +927 -430
  3. package/dist/index.prod.js +1 -1
  4. package/dist/index.prod.mjs +1 -1
  5. package/es/_internal/icon/src/styles/index.cssr.mjs +0 -1
  6. package/es/_internal/selection/src/Selection.d.ts +1 -1
  7. package/es/_mixins/use-form-item.d.ts +1 -1
  8. package/es/_utils/dom/download.d.ts +1 -0
  9. package/es/_utils/dom/download.mjs +3 -0
  10. package/es/_utils/index.d.ts +1 -1
  11. package/es/_utils/index.mjs +1 -1
  12. package/es/_utils/naive/index.d.ts +1 -0
  13. package/es/_utils/naive/index.mjs +1 -0
  14. package/es/_utils/naive/value.d.ts +1 -0
  15. package/es/_utils/naive/value.mjs +13 -0
  16. package/es/anchor/index.d.ts +1 -0
  17. package/es/anchor/src/Link.d.ts +3 -2
  18. package/es/anchor/src/Link.mjs +5 -2
  19. package/es/anchor/src/public-types.d.ts +5 -0
  20. package/es/anchor/src/public-types.mjs +1 -0
  21. package/es/auto-complete/src/AutoComplete.d.ts +1 -1
  22. package/es/cascader/src/Cascader.d.ts +1 -1
  23. package/es/components.d.ts +1 -0
  24. package/es/components.mjs +1 -0
  25. package/es/config-provider/src/internal-interface.d.ts +2 -0
  26. package/es/data-table/src/DataTable.d.ts +6 -6
  27. package/es/data-table/src/DataTable.mjs +6 -6
  28. package/es/data-table/src/styles/index.cssr.mjs +1 -0
  29. package/es/date-picker/src/DatePicker.d.ts +5 -5
  30. package/es/date-picker/src/DatePicker.mjs +1 -1
  31. package/es/date-picker/src/panel/date.d.ts +2 -2
  32. package/es/date-picker/src/panel/daterange.d.ts +3 -3
  33. package/es/date-picker/src/panel/datetime.d.ts +2 -2
  34. package/es/date-picker/src/panel/datetime.mjs +1 -1
  35. package/es/date-picker/src/panel/datetimerange.d.ts +3 -3
  36. package/es/date-picker/src/panel/datetimerange.mjs +2 -2
  37. package/es/date-picker/src/panel/month.d.ts +2 -2
  38. package/es/date-picker/src/panel/monthrange.d.ts +3 -3
  39. package/es/date-picker/src/panel/panelHeader.d.ts +4 -4
  40. package/es/date-picker/src/panel/use-calendar.d.ts +1 -1
  41. package/es/date-picker/src/panel/use-dual-calendar.d.ts +2 -2
  42. package/es/date-picker/src/panel/use-dual-calendar.mjs +3 -3
  43. package/es/date-picker/src/panel/use-panel-common.d.ts +1 -1
  44. package/es/date-picker/src/panel/use-panel-common.mjs +1 -1
  45. package/es/date-picker/src/props.d.ts +2 -2
  46. package/es/date-picker/src/props.mjs +1 -1
  47. package/es/descriptions/src/Descriptions.d.ts +1 -1
  48. package/es/form/index.d.ts +1 -0
  49. package/es/form/src/FormItem.d.ts +1 -1
  50. package/es/form/src/FormItemCol.d.ts +1 -1
  51. package/es/form/src/FormItemGridItem.d.ts +1 -1
  52. package/es/form/src/interface.d.ts +0 -1
  53. package/es/form/src/public-types.d.ts +1 -0
  54. package/es/form/src/public-types.mjs +1 -0
  55. package/es/icon/src/styles/index.cssr.mjs +0 -1
  56. package/es/input/src/Input.d.ts +1 -1
  57. package/es/input/src/Input.mjs +1 -8
  58. package/es/input-number/src/InputNumber.d.ts +1 -1
  59. package/es/input-otp/index.d.ts +3 -0
  60. package/es/input-otp/index.mjs +1 -0
  61. package/es/input-otp/src/InputOtp.d.ts +875 -0
  62. package/es/input-otp/src/InputOtp.mjs +322 -0
  63. package/es/input-otp/src/public-types.d.ts +24 -0
  64. package/es/input-otp/src/public-types.mjs +1 -0
  65. package/es/input-otp/src/styles/index.cssr.d.ts +2 -0
  66. package/es/input-otp/src/styles/index.cssr.mjs +20 -0
  67. package/es/input-otp/src/styles/input-otp-rtl.cssr.d.ts +2 -0
  68. package/es/input-otp/src/styles/input-otp-rtl.cssr.mjs +5 -0
  69. package/es/input-otp/styles/dark.d.ts +3 -0
  70. package/es/input-otp/styles/dark.mjs +12 -0
  71. package/es/input-otp/styles/index.d.ts +4 -0
  72. package/es/input-otp/styles/index.mjs +3 -0
  73. package/es/input-otp/styles/light.d.ts +81 -0
  74. package/es/input-otp/styles/light.mjs +22 -0
  75. package/es/input-otp/styles/rtl.d.ts +2 -0
  76. package/es/input-otp/styles/rtl.mjs +5 -0
  77. package/es/mention/src/Mention.d.ts +1 -1
  78. package/es/progress/src/Circle.d.ts +1 -1
  79. package/es/progress/src/MultipleCircle.d.ts +1 -1
  80. package/es/progress/src/Progress.d.ts +2 -2
  81. package/es/radio/src/Radio.mjs +5 -5
  82. package/es/radio/src/styles/radio.cssr.mjs +3 -7
  83. package/es/select/src/Select.d.ts +1 -1
  84. package/es/styles.d.ts +1 -0
  85. package/es/styles.mjs +1 -0
  86. package/es/tabs/src/TabPane.d.ts +1 -0
  87. package/es/themes/dark.mjs +2 -1
  88. package/es/themes/light.mjs +2 -0
  89. package/es/time-picker/src/TimePicker.d.ts +1 -1
  90. package/es/transfer/src/Transfer.d.ts +1 -1
  91. package/es/tree/src/Tree.d.ts +21 -17
  92. package/es/tree/src/Tree.mjs +4 -4
  93. package/es/tree/src/styles/index.cssr.mjs +0 -1
  94. package/es/tree-select/src/TreeSelect.d.ts +14 -1
  95. package/es/tree-select/src/TreeSelect.mjs +1 -0
  96. package/es/typography/src/text.d.ts +1 -1
  97. package/es/upload/index.d.ts +1 -0
  98. package/es/upload/index.mjs +1 -0
  99. package/es/upload/src/Upload.d.ts +11 -8
  100. package/es/upload/src/Upload.mjs +2 -0
  101. package/es/upload/src/UploadFile.mjs +8 -1
  102. package/es/upload/src/interface.d.ts +1 -0
  103. package/es/version.d.ts +1 -1
  104. package/es/version.mjs +1 -1
  105. package/es/watermark/src/Watermark.d.ts +1 -1
  106. package/lib/_internal/icon/src/styles/index.cssr.js +0 -1
  107. package/lib/_internal/selection/src/Selection.d.ts +1 -1
  108. package/lib/_mixins/use-form-item.d.ts +1 -1
  109. package/lib/_utils/dom/download.d.ts +1 -0
  110. package/lib/_utils/dom/download.js +4 -0
  111. package/lib/_utils/index.d.ts +1 -1
  112. package/lib/_utils/index.js +2 -1
  113. package/lib/_utils/naive/index.d.ts +1 -0
  114. package/lib/_utils/naive/index.js +3 -1
  115. package/lib/_utils/naive/value.d.ts +1 -0
  116. package/lib/_utils/naive/value.js +18 -0
  117. package/lib/anchor/index.d.ts +1 -0
  118. package/lib/anchor/src/Link.d.ts +3 -2
  119. package/lib/anchor/src/Link.js +4 -1
  120. package/lib/anchor/src/public-types.d.ts +5 -0
  121. package/lib/anchor/src/public-types.js +2 -0
  122. package/lib/auto-complete/src/AutoComplete.d.ts +1 -1
  123. package/lib/cascader/src/Cascader.d.ts +1 -1
  124. package/lib/components.d.ts +1 -0
  125. package/lib/components.js +1 -0
  126. package/lib/config-provider/src/internal-interface.d.ts +2 -0
  127. package/lib/data-table/src/DataTable.d.ts +6 -6
  128. package/lib/data-table/src/DataTable.js +6 -6
  129. package/lib/data-table/src/styles/index.cssr.js +1 -0
  130. package/lib/date-picker/src/DatePicker.d.ts +5 -5
  131. package/lib/date-picker/src/DatePicker.js +1 -1
  132. package/lib/date-picker/src/panel/date.d.ts +2 -2
  133. package/lib/date-picker/src/panel/daterange.d.ts +3 -3
  134. package/lib/date-picker/src/panel/datetime.d.ts +2 -2
  135. package/lib/date-picker/src/panel/datetime.js +1 -1
  136. package/lib/date-picker/src/panel/datetimerange.d.ts +3 -3
  137. package/lib/date-picker/src/panel/datetimerange.js +2 -2
  138. package/lib/date-picker/src/panel/month.d.ts +2 -2
  139. package/lib/date-picker/src/panel/monthrange.d.ts +3 -3
  140. package/lib/date-picker/src/panel/panelHeader.d.ts +4 -4
  141. package/lib/date-picker/src/panel/use-calendar.d.ts +1 -1
  142. package/lib/date-picker/src/panel/use-dual-calendar.d.ts +2 -2
  143. package/lib/date-picker/src/panel/use-dual-calendar.js +3 -3
  144. package/lib/date-picker/src/panel/use-panel-common.d.ts +1 -1
  145. package/lib/date-picker/src/panel/use-panel-common.js +1 -1
  146. package/lib/date-picker/src/props.d.ts +2 -2
  147. package/lib/date-picker/src/props.js +1 -1
  148. package/lib/descriptions/src/Descriptions.d.ts +1 -1
  149. package/lib/form/index.d.ts +1 -0
  150. package/lib/form/src/FormItem.d.ts +1 -1
  151. package/lib/form/src/FormItemCol.d.ts +1 -1
  152. package/lib/form/src/FormItemGridItem.d.ts +1 -1
  153. package/lib/form/src/interface.d.ts +0 -1
  154. package/lib/form/src/public-types.d.ts +1 -0
  155. package/lib/form/src/public-types.js +2 -0
  156. package/lib/icon/src/styles/index.cssr.js +0 -1
  157. package/lib/input/src/Input.d.ts +1 -1
  158. package/lib/input/src/Input.js +0 -7
  159. package/lib/input-number/src/InputNumber.d.ts +1 -1
  160. package/lib/input-otp/index.d.ts +3 -0
  161. package/lib/input-otp/index.js +9 -0
  162. package/lib/input-otp/src/InputOtp.d.ts +875 -0
  163. package/lib/input-otp/src/InputOtp.js +248 -0
  164. package/lib/input-otp/src/public-types.d.ts +24 -0
  165. package/lib/input-otp/src/public-types.js +2 -0
  166. package/lib/input-otp/src/styles/index.cssr.d.ts +2 -0
  167. package/lib/input-otp/src/styles/index.cssr.js +25 -0
  168. package/lib/input-otp/src/styles/input-otp-rtl.cssr.d.ts +2 -0
  169. package/lib/input-otp/src/styles/input-otp-rtl.cssr.js +10 -0
  170. package/lib/input-otp/styles/dark.d.ts +3 -0
  171. package/lib/input-otp/styles/dark.js +14 -0
  172. package/lib/input-otp/styles/index.d.ts +4 -0
  173. package/lib/input-otp/styles/index.js +12 -0
  174. package/lib/input-otp/styles/light.d.ts +81 -0
  175. package/lib/input-otp/styles/light.js +25 -0
  176. package/lib/input-otp/styles/rtl.d.ts +2 -0
  177. package/lib/input-otp/styles/rtl.js +11 -0
  178. package/lib/mention/src/Mention.d.ts +1 -1
  179. package/lib/progress/src/Circle.d.ts +1 -1
  180. package/lib/progress/src/MultipleCircle.d.ts +1 -1
  181. package/lib/progress/src/Progress.d.ts +2 -2
  182. package/lib/radio/src/Radio.js +2 -2
  183. package/lib/radio/src/styles/radio.cssr.js +3 -7
  184. package/lib/select/src/Select.d.ts +1 -1
  185. package/lib/styles.d.ts +1 -0
  186. package/lib/styles.js +99 -96
  187. package/lib/tabs/src/TabPane.d.ts +1 -0
  188. package/lib/themes/dark.js +1 -0
  189. package/lib/themes/light.js +92 -90
  190. package/lib/time-picker/src/TimePicker.d.ts +1 -1
  191. package/lib/transfer/src/Transfer.d.ts +1 -1
  192. package/lib/tree/src/Tree.d.ts +21 -17
  193. package/lib/tree/src/Tree.js +5 -4
  194. package/lib/tree/src/styles/index.cssr.js +0 -1
  195. package/lib/tree-select/src/TreeSelect.d.ts +14 -1
  196. package/lib/tree-select/src/TreeSelect.js +1 -1
  197. package/lib/typography/src/text.d.ts +1 -1
  198. package/lib/upload/index.d.ts +1 -0
  199. package/lib/upload/index.js +3 -1
  200. package/lib/upload/src/Upload.d.ts +11 -8
  201. package/lib/upload/src/Upload.js +2 -1
  202. package/lib/upload/src/UploadFile.js +7 -2
  203. package/lib/upload/src/interface.d.ts +1 -0
  204. package/lib/version.d.ts +1 -1
  205. package/lib/version.js +1 -1
  206. package/lib/watermark/src/Watermark.d.ts +1 -1
  207. package/package.json +1 -1
  208. package/volar.d.ts +3 -2
  209. package/web-types.json +139 -10
@@ -0,0 +1,322 @@
1
+ var __rest = this && this.__rest || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
4
+ if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
5
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
6
+ }
7
+ return t;
8
+ };
9
+ import { pxfy, repeat } from 'seemly';
10
+ import { useMergedState } from 'vooks';
11
+ import { computed, defineComponent, h, ref, toRef } from 'vue';
12
+ import { useConfig, useFormItem, useRtl, useTheme, useThemeClass } from "../../_mixins/index.mjs";
13
+ import { call, createKey, isArrayShallowEqual, resolveSlotWithTypedProps } from "../../_utils/index.mjs";
14
+ import { NInput } from "../../input/index.mjs";
15
+ import inputOtpLight from "../styles/light.mjs";
16
+ import style from "./styles/index.cssr.mjs";
17
+ export const inputOtpProps = Object.assign(Object.assign({}, useTheme.props), {
18
+ defaultValue: {
19
+ type: Array,
20
+ default: []
21
+ },
22
+ value: Array,
23
+ length: {
24
+ type: Number,
25
+ default: 6
26
+ },
27
+ block: Boolean,
28
+ size: String,
29
+ disabled: Boolean,
30
+ mask: Boolean,
31
+ readonly: Boolean,
32
+ status: String,
33
+ gap: [String, Number],
34
+ placeholder: {
35
+ type: String,
36
+ default: ''
37
+ },
38
+ allowInput: Function,
39
+ onBlur: [Function, Array],
40
+ onFocus: [Function, Array],
41
+ 'onUpdate:value': [Function, Array],
42
+ onUpdateValue: [Function, Array],
43
+ onFinish: [Function, Array]
44
+ });
45
+ export default defineComponent({
46
+ name: 'InputOtp',
47
+ props: inputOtpProps,
48
+ slots: Object,
49
+ setup(props) {
50
+ const {
51
+ mergedClsPrefixRef,
52
+ mergedRtlRef,
53
+ inlineThemeDisabled
54
+ } = useConfig(props);
55
+ const themeRef = useTheme('InputOtp', '-input-otp', style, inputOtpLight, props, mergedClsPrefixRef);
56
+ const rtlEnabledRef = useRtl('InputOtp', mergedRtlRef, mergedClsPrefixRef);
57
+ // form-item
58
+ const formItem = useFormItem(props);
59
+ const {
60
+ mergedSizeRef,
61
+ mergedDisabledRef,
62
+ mergedStatusRef
63
+ } = formItem;
64
+ const cssVarsRef = computed(() => {
65
+ const {
66
+ value: size
67
+ } = mergedSizeRef;
68
+ const {
69
+ gap: propGap
70
+ } = props;
71
+ const {
72
+ self: {
73
+ [createKey('inputWidth', size)]: inputWidth,
74
+ [createKey('gap', size)]: gap
75
+ }
76
+ } = themeRef.value;
77
+ return {
78
+ '--n-gap': propGap === undefined ? gap : typeof propGap === 'number' ? pxfy(propGap) : propGap,
79
+ '--n-input-width': inputWidth
80
+ };
81
+ });
82
+ const themeClassHandle = inlineThemeDisabled ? useThemeClass('input-otp', computed(() => {
83
+ const {
84
+ value: size
85
+ } = mergedSizeRef;
86
+ return size[0];
87
+ }), cssVarsRef, props) : undefined;
88
+ const uncontrolledValueRef = ref(props.defaultValue);
89
+ const controlledValueRef = toRef(props, 'value');
90
+ const mergedValueRef = useMergedState(controlledValueRef, uncontrolledValueRef);
91
+ const inputRefList = ref([]);
92
+ const inputTypeRef = computed(() => props.mask ? 'password' : 'text');
93
+ const handleFocus = (e, index) => {
94
+ // If it's focused from other input element inside the component, returns
95
+ if (inputRefList === null || inputRefList === void 0 ? void 0 : inputRefList.value.some(inputInst => inputInst.inputElRef === e.relatedTarget)) {
96
+ return;
97
+ }
98
+ const {
99
+ onFocus
100
+ } = props;
101
+ if (onFocus) {
102
+ call(onFocus, e, index);
103
+ }
104
+ const {
105
+ nTriggerFormFocus
106
+ } = formItem;
107
+ nTriggerFormFocus();
108
+ };
109
+ const handleBlur = (e, index) => {
110
+ // If it's blured to other input element inside the component, returns
111
+ if (inputRefList === null || inputRefList === void 0 ? void 0 : inputRefList.value.some(inputInst => inputInst.inputElRef === e.relatedTarget)) {
112
+ return;
113
+ }
114
+ const {
115
+ onBlur
116
+ } = props;
117
+ const {
118
+ nTriggerFormBlur
119
+ } = formItem;
120
+ if (onBlur) call(onBlur, e, index);
121
+ nTriggerFormBlur();
122
+ };
123
+ const focusOnChar = charIndex => {
124
+ if (charIndex >= props.length) return;
125
+ if (charIndex < 0) return;
126
+ inputRefList === null || inputRefList === void 0 ? void 0 : inputRefList.value[charIndex].focus();
127
+ inputRefList === null || inputRefList === void 0 ? void 0 : inputRefList.value[charIndex].select();
128
+ };
129
+ const focusOnNextChar = currentIndex => {
130
+ if (currentIndex >= props.length - 1) {
131
+ return;
132
+ }
133
+ focusOnChar(currentIndex + 1);
134
+ };
135
+ const focusOnPrevChar = currentIndex => {
136
+ if (currentIndex <= 0) {
137
+ return;
138
+ }
139
+ focusOnChar(currentIndex - 1);
140
+ };
141
+ const justifyValue = value => {
142
+ const justifiedValue = value ? Array.from(value) : [];
143
+ const length = props.length;
144
+ while (justifiedValue.length > length) {
145
+ justifiedValue.pop();
146
+ }
147
+ while (justifiedValue.length < length) {
148
+ justifiedValue.push('');
149
+ }
150
+ return justifiedValue;
151
+ };
152
+ function doUpdateValue(value, meta) {
153
+ const {
154
+ nTriggerFormInput,
155
+ nTriggerFormChange
156
+ } = formItem;
157
+ if (isArrayShallowEqual(value, mergedValueRef.value)) {
158
+ nTriggerFormInput();
159
+ return;
160
+ }
161
+ const {
162
+ 'onUpdate:value': _onUpdateValue,
163
+ onUpdateValue,
164
+ length,
165
+ onFinish
166
+ } = props;
167
+ if (_onUpdateValue) call(_onUpdateValue, value, meta);
168
+ if (onUpdateValue) call(onUpdateValue, value, meta);
169
+ if (value.filter(v => v).length === length && onFinish) {
170
+ call(onFinish, value);
171
+ }
172
+ uncontrolledValueRef.value = value;
173
+ nTriggerFormInput();
174
+ nTriggerFormChange();
175
+ }
176
+ const handlePaste = (e, index) => {
177
+ if (props.readonly || mergedDisabledRef.value) {
178
+ return;
179
+ }
180
+ e.preventDefault();
181
+ const {
182
+ clipboardData
183
+ } = e;
184
+ const text = clipboardData === null || clipboardData === void 0 ? void 0 : clipboardData.getData('text');
185
+ if (!text) return;
186
+ const currentValue = justifyValue(mergedValueRef.value);
187
+ let startIndex = index;
188
+ const allowInput = props.allowInput;
189
+ let pasteApplied = false;
190
+ let appendedText = '';
191
+ for (let i = 0; i < text.length; ++i) {
192
+ if (allowInput && !allowInput(text[i], startIndex, currentValue)) {
193
+ continue;
194
+ }
195
+ pasteApplied = true;
196
+ currentValue[startIndex] = text[i];
197
+ appendedText += text[i];
198
+ startIndex++;
199
+ if (startIndex >= currentValue.length) {
200
+ break;
201
+ }
202
+ }
203
+ if (pasteApplied) {
204
+ focusOnChar(startIndex);
205
+ doUpdateValue(currentValue, {
206
+ diff: appendedText,
207
+ index: startIndex,
208
+ source: 'paste'
209
+ });
210
+ }
211
+ };
212
+ const handleKeydown = (e, index) => {
213
+ if (mergedDisabledRef.value) return;
214
+ const keyCode = e.code || e.key;
215
+ const currentValue = justifyValue(mergedValueRef.value);
216
+ if (keyCode === 'Backspace' && !props.readonly) {
217
+ e.preventDefault();
218
+ currentValue[Math.max(index, 0)] = '';
219
+ doUpdateValue(currentValue, {
220
+ diff: '',
221
+ index,
222
+ source: 'delete'
223
+ });
224
+ focusOnPrevChar(index);
225
+ } else if (keyCode === 'ArrowLeft') {
226
+ e.preventDefault();
227
+ focusOnPrevChar(index);
228
+ } else if (keyCode === 'ArrowRight') {
229
+ e.preventDefault();
230
+ focusOnNextChar(index);
231
+ }
232
+ };
233
+ const handleInput = (value, index) => {
234
+ const currentValue = justifyValue(mergedValueRef.value);
235
+ const currentValueAtIndex = currentValue[index];
236
+ const diff = value.replace(currentValueAtIndex, '');
237
+ const char = diff[diff.length - 1] || value[value.length - 1] || '';
238
+ const allowInput = props.allowInput;
239
+ if (allowInput && !allowInput(char, index, currentValue)) {
240
+ return;
241
+ }
242
+ currentValue[index] = char;
243
+ doUpdateValue(currentValue, {
244
+ diff: char,
245
+ index,
246
+ source: 'input'
247
+ });
248
+ focusOnNextChar(index);
249
+ };
250
+ const getTemplateEvents = index => {
251
+ return {
252
+ onInput: value => handleInput(value, index),
253
+ onPaste: event => handlePaste(event, index),
254
+ onKeydown: event => handleKeydown(event, index),
255
+ onFocus: event => handleFocus(event, index),
256
+ onBlur: event => handleBlur(event, index)
257
+ };
258
+ };
259
+ return {
260
+ mergedTheme: themeRef,
261
+ perItemValueArray: computed(() => justifyValue(mergedValueRef.value)),
262
+ mergedClsPrefix: mergedClsPrefixRef,
263
+ inputRefList,
264
+ inputType: inputTypeRef,
265
+ rtlEnabled: rtlEnabledRef,
266
+ mergedStatus: mergedStatusRef,
267
+ mergedDisabled: mergedDisabledRef,
268
+ cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
269
+ themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
270
+ getTemplateEvents,
271
+ onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
272
+ };
273
+ },
274
+ render() {
275
+ const {
276
+ mergedTheme,
277
+ mergedClsPrefix,
278
+ perItemValueArray,
279
+ size,
280
+ placeholder,
281
+ mergedDisabled,
282
+ mergedStatus,
283
+ readonly,
284
+ inputType,
285
+ $slots,
286
+ getTemplateEvents,
287
+ themeClass,
288
+ onRender
289
+ } = this;
290
+ onRender === null || onRender === void 0 ? void 0 : onRender();
291
+ return h("div", {
292
+ style: this.cssVars,
293
+ class: [`${mergedClsPrefix}-input-otp`, themeClass, this.rtlEnabled && `${mergedClsPrefix}-input-otp--rtl`, this.block && `${mergedClsPrefix}-input-otp--block`]
294
+ }, repeat(this.length, undefined).map((_, index) => resolveSlotWithTypedProps($slots.default, Object.assign({
295
+ index,
296
+ value: perItemValueArray[index],
297
+ type: inputType,
298
+ size,
299
+ placeholder,
300
+ disabled: mergedDisabled,
301
+ readonly,
302
+ status: mergedStatus,
303
+ builtinThemeOverrides: {
304
+ paddingTiny: '0',
305
+ paddingSmall: '0',
306
+ paddingMedium: '0',
307
+ paddingLarge: '0'
308
+ },
309
+ theme: mergedTheme.peers.Input,
310
+ themeOverrides: mergedTheme.peerOverrides.Input,
311
+ ref: el => this.inputRefList[index] = el
312
+ }, getTemplateEvents(index)), _a => {
313
+ var {
314
+ index
315
+ } = _a,
316
+ restProps = __rest(_a, ["index"]);
317
+ return [h(NInput, Object.assign({}, restProps, {
318
+ key: index
319
+ }))];
320
+ })));
321
+ }
322
+ });
@@ -0,0 +1,24 @@
1
+ import type { VNode } from 'vue';
2
+ import type { InputInst } from '../../components';
3
+ import type { InputProps } from '../../input/src/Input';
4
+ export type InputOtpAllowInput = (char: string, index: number, currentValue: string[]) => boolean;
5
+ export type InputOtpSize = 'small' | 'medium' | 'large';
6
+ export type InputOtpOnUpdateValue = (value: string[], meta: InputOtpOnUpdateValueMeta) => void;
7
+ export type InputOtpOnFocus = (e: FocusEvent, index: number) => void;
8
+ export type InputOtpOnBlur = (e: FocusEvent, index: number) => void;
9
+ export interface InputOtpSlots {
10
+ default?: InputOtpDefaultSlot;
11
+ }
12
+ export type InputOtpDefaultSlot = (props: InputProps & {
13
+ index: number;
14
+ ref: (inst: InputInst) => void;
15
+ }) => VNode[];
16
+ export type InputOtpOnFinish = (value: string[]) => void;
17
+ export interface InputOtpOnUpdateValueMeta {
18
+ diff: string;
19
+ index: number;
20
+ source: InputOtpOnUpdateValueMetaSource;
21
+ }
22
+ export type InputOtpOnUpdateValueMetaSource = 'paste' | 'input' | 'delete';
23
+ export interface InputOtpInst {
24
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const _default: import("css-render").CNode;
2
+ export default _default;
@@ -0,0 +1,20 @@
1
+ import { c, cB, cM, cNotM } from "../../../_utils/cssr/index.mjs";
2
+ // --n-input-width
3
+ // --n-gap
4
+ export default c([cB('input-otp', `
5
+ display: flex;
6
+ align-items: center;
7
+ gap: var(--n-gap);
8
+ `, [cM('block', ``, [cB('input', ``, [cNotM('autosize', `
9
+ text-align: center;
10
+ min-width: 0;
11
+ `), cM('autosize', `
12
+ text-align: center;
13
+ min-width: 0;
14
+ `)])]), cNotM('block', ``, [cB('input', ``, [cNotM('autosize', `
15
+ width: var(--n-input-width);
16
+ text-align: center;
17
+ `), cM('autosize', `
18
+ width: var(--n-input-width);
19
+ text-align: center;
20
+ `)])])])]);
@@ -0,0 +1,2 @@
1
+ declare const _default: import("css-render").CNode;
2
+ export default _default;
@@ -0,0 +1,5 @@
1
+ import { cB, cM } from "../../../_utils/cssr/index.mjs";
2
+ // --n-gap
3
+ export default cB('input-otp', [cM('rtl', `
4
+ direction: rtl;
5
+ `)]);
@@ -0,0 +1,3 @@
1
+ import type { InputOtpTheme } from './light';
2
+ declare const inputOtpDark: InputOtpTheme;
3
+ export default inputOtpDark;
@@ -0,0 +1,12 @@
1
+ import { commonDark } from "../../_styles/common/index.mjs";
2
+ import { inputDark } from "../../styles.mjs";
3
+ import { self } from "./light.mjs";
4
+ const inputOtpDark = {
5
+ name: 'InputOtp',
6
+ common: commonDark,
7
+ peers: {
8
+ Input: inputDark
9
+ },
10
+ self
11
+ };
12
+ export default inputOtpDark;
@@ -0,0 +1,4 @@
1
+ export { default as inputOtpDark } from './dark';
2
+ export { default as inputOtpLight } from './light';
3
+ export type { InputOtpTheme } from './light';
4
+ export { inputOtpRtl } from './rtl';
@@ -0,0 +1,3 @@
1
+ export { default as inputOtpDark } from "./dark.mjs";
2
+ export { default as inputOtpLight } from "./light.mjs";
3
+ export { inputOtpRtl } from "./rtl.mjs";
@@ -0,0 +1,81 @@
1
+ export declare function self(): {
2
+ inputWidthSmall: string;
3
+ inputWidthMedium: string;
4
+ inputWidthLarge: string;
5
+ gapSmall: string;
6
+ gapMedium: string;
7
+ gapLarge: string;
8
+ };
9
+ declare const inputOtpLight: import("../../_mixins").Theme<"InputOtp", {
10
+ inputWidthSmall: string;
11
+ inputWidthMedium: string;
12
+ inputWidthLarge: string;
13
+ gapSmall: string;
14
+ gapMedium: string;
15
+ gapLarge: string;
16
+ }, {
17
+ Input: import("../../_mixins").Theme<"Input", {
18
+ fontWeight: string;
19
+ countTextColorDisabled: string;
20
+ countTextColor: string;
21
+ heightTiny: string;
22
+ heightSmall: string;
23
+ heightMedium: string;
24
+ heightLarge: string;
25
+ fontSizeTiny: string;
26
+ fontSizeSmall: string;
27
+ fontSizeMedium: string;
28
+ fontSizeLarge: string;
29
+ lineHeight: string;
30
+ lineHeightTextarea: string;
31
+ borderRadius: string;
32
+ iconSize: string;
33
+ groupLabelColor: string;
34
+ groupLabelTextColor: string;
35
+ textColor: string;
36
+ textColorDisabled: string;
37
+ textDecorationColor: string;
38
+ caretColor: string;
39
+ placeholderColor: string;
40
+ placeholderColorDisabled: string;
41
+ color: string;
42
+ colorDisabled: string;
43
+ colorFocus: string;
44
+ groupLabelBorder: string;
45
+ border: string;
46
+ borderHover: string;
47
+ borderDisabled: string;
48
+ borderFocus: string;
49
+ boxShadowFocus: string;
50
+ loadingColor: string;
51
+ loadingColorWarning: string;
52
+ borderWarning: string;
53
+ borderHoverWarning: string;
54
+ colorFocusWarning: string;
55
+ borderFocusWarning: string;
56
+ boxShadowFocusWarning: string;
57
+ caretColorWarning: string;
58
+ loadingColorError: string;
59
+ borderError: string;
60
+ borderHoverError: string;
61
+ colorFocusError: string;
62
+ borderFocusError: string;
63
+ boxShadowFocusError: string;
64
+ caretColorError: string;
65
+ clearColor: string;
66
+ clearColorHover: string;
67
+ clearColorPressed: string;
68
+ iconColor: string;
69
+ iconColorDisabled: string;
70
+ iconColorHover: string;
71
+ iconColorPressed: string;
72
+ suffixTextColor: string;
73
+ paddingTiny: string;
74
+ paddingSmall: string;
75
+ paddingMedium: string;
76
+ paddingLarge: string;
77
+ clearSize: string;
78
+ }, any>;
79
+ }>;
80
+ export default inputOtpLight;
81
+ export type InputOtpTheme = typeof inputOtpLight;
@@ -0,0 +1,22 @@
1
+ import { createTheme } from "../../_mixins/index.mjs";
2
+ import { commonLight } from "../../_styles/common/index.mjs";
3
+ import { inputLight } from "../../input/styles/index.mjs";
4
+ export function self() {
5
+ return {
6
+ inputWidthSmall: '24px',
7
+ inputWidthMedium: '30px',
8
+ inputWidthLarge: '36px',
9
+ gapSmall: '8px',
10
+ gapMedium: '8px',
11
+ gapLarge: '8px'
12
+ };
13
+ }
14
+ const inputOtpLight = createTheme({
15
+ name: 'InputOtp',
16
+ common: commonLight,
17
+ peers: {
18
+ Input: inputLight
19
+ },
20
+ self
21
+ });
22
+ export default inputOtpLight;
@@ -0,0 +1,2 @@
1
+ import type { RtlItem } from '../../config-provider/src/internal-interface';
2
+ export declare const inputOtpRtl: RtlItem;
@@ -0,0 +1,5 @@
1
+ import rtlStyle from "../src/styles/input-otp-rtl.cssr.mjs";
2
+ export const inputOtpRtl = {
3
+ name: 'InputOtp',
4
+ style: rtlStyle
5
+ };
@@ -1,6 +1,6 @@
1
1
  import type { RenderLabel } from '../../_internal/select-menu/src/interface';
2
2
  import type { ExtractPublicPropTypes, MaybeArray } from '../../_utils';
3
- import type { FormValidationStatus } from '../../form/src/interface';
3
+ import type { FormValidationStatus } from '../../form/src/public-types';
4
4
  import type { Size as InputSize } from '../../input/src/interface';
5
5
  import type { SelectBaseOption, SelectGroupOption, SelectIgnoredOption } from '../../select/src/interface';
6
6
  import type { MentionOption } from './interface';
@@ -85,8 +85,8 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
85
85
  default: number;
86
86
  };
87
87
  }>> & Readonly<{}>, {
88
+ gapOffsetDegree: number;
88
89
  percentage: number;
89
90
  offsetDegree: number;
90
- gapOffsetDegree: number;
91
91
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
92
92
  export default _default;
@@ -77,7 +77,7 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
77
77
  }>> & Readonly<{}>, {
78
78
  railColor: string[];
79
79
  fillColor: string[] | ProgressGradient[];
80
- percentage: number[];
81
80
  railStyle: (string | CSSProperties)[];
81
+ percentage: number[];
82
82
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
83
83
  export default _default;
@@ -385,10 +385,10 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
385
385
  readonly strokeWidth: number;
386
386
  readonly unit: string;
387
387
  readonly processing: boolean;
388
- readonly showIndicator: boolean;
389
388
  readonly viewBoxWidth: number;
389
+ readonly showIndicator: boolean;
390
+ readonly indicatorPosition: "inside" | "outside";
390
391
  readonly indicatorPlacement: "inside" | "outside";
391
392
  readonly circleGap: number;
392
- readonly indicatorPosition: "inside" | "outside";
393
393
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
394
394
  export default _default;
@@ -88,7 +88,11 @@ export default defineComponent({
88
88
  return h("label", {
89
89
  class: [`${mergedClsPrefix}-radio`, this.themeClass, this.rtlEnabled && `${mergedClsPrefix}-radio--rtl`, this.mergedDisabled && `${mergedClsPrefix}-radio--disabled`, this.renderSafeChecked && `${mergedClsPrefix}-radio--checked`, this.focus && `${mergedClsPrefix}-radio--focus`],
90
90
  style: this.cssVars
91
- }, h("input", {
91
+ }, h("div", {
92
+ class: `${mergedClsPrefix}-radio__dot-wrapper`
93
+ }, "\u00A0", h("div", {
94
+ class: [`${mergedClsPrefix}-radio__dot`, this.renderSafeChecked && `${mergedClsPrefix}-radio__dot--checked`]
95
+ }), h("input", {
92
96
  ref: "inputRef",
93
97
  type: "radio",
94
98
  class: `${mergedClsPrefix}-radio-input`,
@@ -99,10 +103,6 @@ export default defineComponent({
99
103
  onChange: this.handleRadioInputChange,
100
104
  onFocus: this.handleRadioInputFocus,
101
105
  onBlur: this.handleRadioInputBlur
102
- }), h("div", {
103
- class: `${mergedClsPrefix}-radio__dot-wrapper`
104
- }, "\u00A0", h("div", {
105
- class: [`${mergedClsPrefix}-radio__dot`, this.renderSafeChecked && `${mergedClsPrefix}-radio__dot--checked`]
106
106
  })), resolveWrappedSlot($slots.default, children => {
107
107
  if (!children && !label) return null;
108
108
  return h("div", {
@@ -38,14 +38,10 @@ export default cB('radio', `
38
38
  `), cB('radio-input', `
39
39
  position: absolute;
40
40
  border: 0;
41
- border-radius: inherit;
42
- left: 0;
43
- right: 0;
44
- top: 0;
45
- bottom: 0;
41
+ width: 0;
42
+ height: 0;
46
43
  opacity: 0;
47
- z-index: 1;
48
- cursor: pointer;
44
+ margin: 0;
49
45
  `), cE('dot', `
50
46
  position: absolute;
51
47
  top: 50%;
@@ -1,7 +1,7 @@
1
1
  import type { NodeProps, RenderLabel, RenderOption } from '../../_internal/select-menu/src/interface';
2
2
  import type { RenderTag } from '../../_internal/selection/src/interface';
3
3
  import type { ExtractPublicPropTypes, MaybeArray } from '../../_utils';
4
- import type { FormValidationStatus } from '../../form/src/interface';
4
+ import type { FormValidationStatus } from '../../form/src/public-types';
5
5
  import type { PopoverProps } from '../../popover';
6
6
  import type { OnUpdateValue, SelectBaseOption, SelectFallbackOption, SelectFilter, SelectGroupOption, SelectIgnoredOption, SelectMixedOption, SelectOption, Size, Value, ValueAtom } from './interface';
7
7
  import { type TreeNode } from 'treemate';
package/es/styles.d.ts CHANGED
@@ -36,6 +36,7 @@ export { formDark } from './form/styles';
36
36
  export { gradientTextDark } from './gradient-text/styles';
37
37
  export { iconDark } from './icon/styles';
38
38
  export { inputNumberDark, inputNumberRtl as unstableInputNumberRtl } from './input-number/styles';
39
+ export { inputOtpDark, inputOtpRtl as unstableInputOtpRtl } from './input-otp/styles';
39
40
  export { inputDark, inputRtl as unstableInputRtl } from './input/styles';
40
41
  export { layoutDark } from './layout/styles';
41
42
  export { rowRtl as unstableRowRtl } from './legacy-grid/styles';
package/es/styles.mjs CHANGED
@@ -37,6 +37,7 @@ export { formDark } from "./form/styles/index.mjs";
37
37
  export { gradientTextDark } from "./gradient-text/styles/index.mjs";
38
38
  export { iconDark } from "./icon/styles/index.mjs";
39
39
  export { inputNumberDark, inputNumberRtl as unstableInputNumberRtl } from "./input-number/styles/index.mjs";
40
+ export { inputOtpDark, inputOtpRtl as unstableInputOtpRtl } from "./input-otp/styles/index.mjs";
40
41
  export { inputDark, inputRtl as unstableInputRtl } from "./input/styles/index.mjs";
41
42
  export { layoutDark } from "./layout/styles/index.mjs";
42
43
  export { rowRtl as unstableRowRtl } from "./legacy-grid/styles/index.mjs";
@@ -22,6 +22,7 @@ export declare const tabPaneProps: {
22
22
  export type TabPaneProps = ExtractPublicPropTypes<typeof tabPaneProps>;
23
23
  export interface TabPaneSlots {
24
24
  default?: () => VNode[];
25
+ tab?: () => VNode[];
25
26
  prefix?: () => VNode[];
26
27
  suffix?: () => VNode[];
27
28
  }
@@ -71,7 +71,7 @@ import { spinDark } from "../spin/styles/index.mjs";
71
71
  import { splitDark } from "../split/styles/index.mjs";
72
72
  import { statisticDark } from "../statistic/styles/index.mjs";
73
73
  import { stepsDark } from "../steps/styles/index.mjs";
74
- import { flexDark } from "../styles.mjs";
74
+ import { flexDark, inputOtpDark } from "../styles.mjs";
75
75
  import { switchDark } from "../switch/styles/index.mjs";
76
76
  import { tableDark } from "../table/styles/index.mjs";
77
77
  import { tabsDark } from "../tabs/styles/index.mjs";
@@ -129,6 +129,7 @@ export const darkTheme = {
129
129
  Image: imageDark,
130
130
  Input: inputDark,
131
131
  InputNumber: inputNumberDark,
132
+ InputOtp: inputOtpDark,
132
133
  LegacyTransfer: legacyTransferDark,
133
134
  Layout: layoutDark,
134
135
  List: listDark,