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,248 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.inputOtpProps = void 0;
18
+ const seemly_1 = require("seemly");
19
+ const vooks_1 = require("vooks");
20
+ const vue_1 = require("vue");
21
+ const _mixins_1 = require("../../_mixins");
22
+ const _utils_1 = require("../../_utils");
23
+ const input_1 = require("../../input");
24
+ const light_1 = __importDefault(require("../styles/light"));
25
+ const index_cssr_1 = __importDefault(require("./styles/index.cssr"));
26
+ exports.inputOtpProps = Object.assign(Object.assign({}, _mixins_1.useTheme.props), { defaultValue: { type: Array, default: [] }, value: Array, length: {
27
+ type: Number,
28
+ default: 6
29
+ }, block: Boolean, size: String, disabled: Boolean, mask: Boolean, readonly: Boolean, status: String, gap: [String, Number], placeholder: { type: String, default: '' }, allowInput: Function, onBlur: [Function, Array], onFocus: [Function, Array], 'onUpdate:value': [Function, Array], onUpdateValue: [Function, Array], onFinish: [Function, Array] });
30
+ exports.default = (0, vue_1.defineComponent)({
31
+ name: 'InputOtp',
32
+ props: exports.inputOtpProps,
33
+ slots: Object,
34
+ setup(props) {
35
+ const { mergedClsPrefixRef, mergedRtlRef, inlineThemeDisabled } = (0, _mixins_1.useConfig)(props);
36
+ const themeRef = (0, _mixins_1.useTheme)('InputOtp', '-input-otp', index_cssr_1.default, light_1.default, props, mergedClsPrefixRef);
37
+ const rtlEnabledRef = (0, _mixins_1.useRtl)('InputOtp', mergedRtlRef, mergedClsPrefixRef);
38
+ // form-item
39
+ const formItem = (0, _mixins_1.useFormItem)(props);
40
+ const { mergedSizeRef, mergedDisabledRef, mergedStatusRef } = formItem;
41
+ const cssVarsRef = (0, vue_1.computed)(() => {
42
+ const { value: size } = mergedSizeRef;
43
+ const { gap: propGap } = props;
44
+ const { self: { [(0, _utils_1.createKey)('inputWidth', size)]: inputWidth, [(0, _utils_1.createKey)('gap', size)]: gap } } = themeRef.value;
45
+ return {
46
+ '--n-gap': propGap === undefined
47
+ ? gap
48
+ : typeof propGap === 'number'
49
+ ? (0, seemly_1.pxfy)(propGap)
50
+ : propGap,
51
+ '--n-input-width': inputWidth
52
+ };
53
+ });
54
+ const themeClassHandle = inlineThemeDisabled
55
+ ? (0, _mixins_1.useThemeClass)('input-otp', (0, vue_1.computed)(() => {
56
+ const { value: size } = mergedSizeRef;
57
+ return size[0];
58
+ }), cssVarsRef, props)
59
+ : undefined;
60
+ const uncontrolledValueRef = (0, vue_1.ref)(props.defaultValue);
61
+ const controlledValueRef = (0, vue_1.toRef)(props, 'value');
62
+ const mergedValueRef = (0, vooks_1.useMergedState)(controlledValueRef, uncontrolledValueRef);
63
+ const inputRefList = (0, vue_1.ref)([]);
64
+ const inputTypeRef = (0, vue_1.computed)(() => props.mask ? 'password' : 'text');
65
+ const handleFocus = (e, index) => {
66
+ // If it's focused from other input element inside the component, returns
67
+ if (inputRefList === null || inputRefList === void 0 ? void 0 : inputRefList.value.some(inputInst => inputInst.inputElRef === e.relatedTarget)) {
68
+ return;
69
+ }
70
+ const { onFocus } = props;
71
+ if (onFocus) {
72
+ (0, _utils_1.call)(onFocus, e, index);
73
+ }
74
+ const { nTriggerFormFocus } = formItem;
75
+ nTriggerFormFocus();
76
+ };
77
+ const handleBlur = (e, index) => {
78
+ // If it's blured to other input element inside the component, returns
79
+ if (inputRefList === null || inputRefList === void 0 ? void 0 : inputRefList.value.some(inputInst => inputInst.inputElRef === e.relatedTarget)) {
80
+ return;
81
+ }
82
+ const { onBlur } = props;
83
+ const { nTriggerFormBlur } = formItem;
84
+ if (onBlur)
85
+ (0, _utils_1.call)(onBlur, e, index);
86
+ nTriggerFormBlur();
87
+ };
88
+ const focusOnChar = (charIndex) => {
89
+ if (charIndex >= props.length)
90
+ return;
91
+ if (charIndex < 0)
92
+ return;
93
+ inputRefList === null || inputRefList === void 0 ? void 0 : inputRefList.value[charIndex].focus();
94
+ inputRefList === null || inputRefList === void 0 ? void 0 : inputRefList.value[charIndex].select();
95
+ };
96
+ const focusOnNextChar = (currentIndex) => {
97
+ if (currentIndex >= props.length - 1) {
98
+ return;
99
+ }
100
+ focusOnChar(currentIndex + 1);
101
+ };
102
+ const focusOnPrevChar = (currentIndex) => {
103
+ if (currentIndex <= 0) {
104
+ return;
105
+ }
106
+ focusOnChar(currentIndex - 1);
107
+ };
108
+ const justifyValue = (value) => {
109
+ const justifiedValue = value ? Array.from(value) : [];
110
+ const length = props.length;
111
+ while (justifiedValue.length > length) {
112
+ justifiedValue.pop();
113
+ }
114
+ while (justifiedValue.length < length) {
115
+ justifiedValue.push('');
116
+ }
117
+ return justifiedValue;
118
+ };
119
+ function doUpdateValue(value, meta) {
120
+ const { nTriggerFormInput, nTriggerFormChange } = formItem;
121
+ if ((0, _utils_1.isArrayShallowEqual)(value, mergedValueRef.value)) {
122
+ nTriggerFormInput();
123
+ return;
124
+ }
125
+ const { 'onUpdate:value': _onUpdateValue, onUpdateValue, length, onFinish } = props;
126
+ if (_onUpdateValue)
127
+ (0, _utils_1.call)(_onUpdateValue, value, meta);
128
+ if (onUpdateValue)
129
+ (0, _utils_1.call)(onUpdateValue, value, meta);
130
+ if (value.filter(v => v).length === length && onFinish) {
131
+ (0, _utils_1.call)(onFinish, value);
132
+ }
133
+ uncontrolledValueRef.value = value;
134
+ nTriggerFormInput();
135
+ nTriggerFormChange();
136
+ }
137
+ const handlePaste = (e, index) => {
138
+ if (props.readonly || mergedDisabledRef.value) {
139
+ return;
140
+ }
141
+ e.preventDefault();
142
+ const { clipboardData } = e;
143
+ const text = clipboardData === null || clipboardData === void 0 ? void 0 : clipboardData.getData('text');
144
+ if (!text)
145
+ return;
146
+ const currentValue = justifyValue(mergedValueRef.value);
147
+ let startIndex = index;
148
+ const allowInput = props.allowInput;
149
+ let pasteApplied = false;
150
+ let appendedText = '';
151
+ for (let i = 0; i < text.length; ++i) {
152
+ if (allowInput && !allowInput(text[i], startIndex, currentValue)) {
153
+ continue;
154
+ }
155
+ pasteApplied = true;
156
+ currentValue[startIndex] = text[i];
157
+ appendedText += text[i];
158
+ startIndex++;
159
+ if (startIndex >= currentValue.length) {
160
+ break;
161
+ }
162
+ }
163
+ if (pasteApplied) {
164
+ focusOnChar(startIndex);
165
+ doUpdateValue(currentValue, {
166
+ diff: appendedText,
167
+ index: startIndex,
168
+ source: 'paste'
169
+ });
170
+ }
171
+ };
172
+ const handleKeydown = (e, index) => {
173
+ if (mergedDisabledRef.value)
174
+ return;
175
+ const keyCode = e.code || e.key;
176
+ const currentValue = justifyValue(mergedValueRef.value);
177
+ if (keyCode === 'Backspace' && !props.readonly) {
178
+ e.preventDefault();
179
+ currentValue[Math.max(index, 0)] = '';
180
+ doUpdateValue(currentValue, { diff: '', index, source: 'delete' });
181
+ focusOnPrevChar(index);
182
+ }
183
+ else if (keyCode === 'ArrowLeft') {
184
+ e.preventDefault();
185
+ focusOnPrevChar(index);
186
+ }
187
+ else if (keyCode === 'ArrowRight') {
188
+ e.preventDefault();
189
+ focusOnNextChar(index);
190
+ }
191
+ };
192
+ const handleInput = (value, index) => {
193
+ const currentValue = justifyValue(mergedValueRef.value);
194
+ const currentValueAtIndex = currentValue[index];
195
+ const diff = value.replace(currentValueAtIndex, '');
196
+ const char = diff[diff.length - 1] || value[value.length - 1] || '';
197
+ const allowInput = props.allowInput;
198
+ if (allowInput && !allowInput(char, index, currentValue)) {
199
+ return;
200
+ }
201
+ currentValue[index] = char;
202
+ doUpdateValue(currentValue, { diff: char, index, source: 'input' });
203
+ focusOnNextChar(index);
204
+ };
205
+ const getTemplateEvents = (index) => {
206
+ return {
207
+ onInput: (value) => handleInput(value, index),
208
+ onPaste: (event) => handlePaste(event, index),
209
+ onKeydown: (event) => handleKeydown(event, index),
210
+ onFocus: (event) => handleFocus(event, index),
211
+ onBlur: (event) => handleBlur(event, index)
212
+ };
213
+ };
214
+ return {
215
+ mergedTheme: themeRef,
216
+ perItemValueArray: (0, vue_1.computed)(() => justifyValue(mergedValueRef.value)),
217
+ mergedClsPrefix: mergedClsPrefixRef,
218
+ inputRefList,
219
+ inputType: inputTypeRef,
220
+ rtlEnabled: rtlEnabledRef,
221
+ mergedStatus: mergedStatusRef,
222
+ mergedDisabled: mergedDisabledRef,
223
+ cssVars: inlineThemeDisabled ? undefined : cssVarsRef,
224
+ themeClass: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.themeClass,
225
+ getTemplateEvents,
226
+ onRender: themeClassHandle === null || themeClassHandle === void 0 ? void 0 : themeClassHandle.onRender
227
+ };
228
+ },
229
+ render() {
230
+ const { mergedTheme, mergedClsPrefix, perItemValueArray, size, placeholder, mergedDisabled, mergedStatus, readonly, inputType, $slots, getTemplateEvents, themeClass, onRender } = this;
231
+ onRender === null || onRender === void 0 ? void 0 : onRender();
232
+ return ((0, vue_1.h)("div", { style: this.cssVars, class: [
233
+ `${mergedClsPrefix}-input-otp`,
234
+ themeClass,
235
+ this.rtlEnabled && `${mergedClsPrefix}-input-otp--rtl`,
236
+ this.block && `${mergedClsPrefix}-input-otp--block`
237
+ ] }, (0, seemly_1.repeat)(this.length, undefined).map((_, index) => (0, _utils_1.resolveSlotWithTypedProps)($slots.default, Object.assign({ index, value: perItemValueArray[index], type: inputType, size,
238
+ placeholder, disabled: mergedDisabled, readonly, status: mergedStatus, builtinThemeOverrides: {
239
+ paddingTiny: '0',
240
+ paddingSmall: '0',
241
+ paddingMedium: '0',
242
+ paddingLarge: '0'
243
+ }, theme: mergedTheme.peers.Input, themeOverrides: mergedTheme.peerOverrides.Input, ref: (el) => (this.inputRefList[index] = el) }, getTemplateEvents(index)), (_a) => {
244
+ var { index } = _a, restProps = __rest(_a, ["index"]);
245
+ return [(0, vue_1.h)(input_1.NInput, Object.assign({}, restProps, { key: index }))];
246
+ }))));
247
+ }
248
+ });
@@ -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,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("css-render").CNode;
2
+ export default _default;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ const cssr_1 = require("../../../_utils/cssr");
7
+ // --n-input-width
8
+ // --n-gap
9
+ exports.default = (0, cssr_1.c)([(0, cssr_1.cB)('input-otp', `
10
+ display: flex;
11
+ align-items: center;
12
+ gap: var(--n-gap);
13
+ `, [(0, cssr_1.cM)('block', ``, [(0, cssr_1.cB)('input', ``, [(0, cssr_1.cNotM)('autosize', `
14
+ text-align: center;
15
+ min-width: 0;
16
+ `), (0, cssr_1.cM)('autosize', `
17
+ text-align: center;
18
+ min-width: 0;
19
+ `)])]), (0, cssr_1.cNotM)('block', ``, [(0, cssr_1.cB)('input', ``, [(0, cssr_1.cNotM)('autosize', `
20
+ width: var(--n-input-width);
21
+ text-align: center;
22
+ `), (0, cssr_1.cM)('autosize', `
23
+ width: var(--n-input-width);
24
+ text-align: center;
25
+ `)])])])]);
@@ -0,0 +1,2 @@
1
+ declare const _default: import("css-render").CNode;
2
+ export default _default;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ const cssr_1 = require("../../../_utils/cssr");
7
+ // --n-gap
8
+ exports.default = (0, cssr_1.cB)('input-otp', [(0, cssr_1.cM)('rtl', `
9
+ direction: rtl;
10
+ `)]);
@@ -0,0 +1,3 @@
1
+ import type { InputOtpTheme } from './light';
2
+ declare const inputOtpDark: InputOtpTheme;
3
+ export default inputOtpDark;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const common_1 = require("../../_styles/common");
4
+ const styles_1 = require("../../styles");
5
+ const light_1 = require("./light");
6
+ const inputOtpDark = {
7
+ name: 'InputOtp',
8
+ common: common_1.commonDark,
9
+ peers: {
10
+ Input: styles_1.inputDark
11
+ },
12
+ self: light_1.self
13
+ };
14
+ exports.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,12 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.inputOtpRtl = exports.inputOtpLight = exports.inputOtpDark = void 0;
7
+ var dark_1 = require("./dark");
8
+ Object.defineProperty(exports, "inputOtpDark", { enumerable: true, get: function () { return __importDefault(dark_1).default; } });
9
+ var light_1 = require("./light");
10
+ Object.defineProperty(exports, "inputOtpLight", { enumerable: true, get: function () { return __importDefault(light_1).default; } });
11
+ var rtl_1 = require("./rtl");
12
+ Object.defineProperty(exports, "inputOtpRtl", { enumerable: true, get: function () { return rtl_1.inputOtpRtl; } });
@@ -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,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.self = self;
4
+ const _mixins_1 = require("../../_mixins");
5
+ const common_1 = require("../../_styles/common");
6
+ const styles_1 = require("../../input/styles");
7
+ function self() {
8
+ return {
9
+ inputWidthSmall: '24px',
10
+ inputWidthMedium: '30px',
11
+ inputWidthLarge: '36px',
12
+ gapSmall: '8px',
13
+ gapMedium: '8px',
14
+ gapLarge: '8px'
15
+ };
16
+ }
17
+ const inputOtpLight = (0, _mixins_1.createTheme)({
18
+ name: 'InputOtp',
19
+ common: common_1.commonLight,
20
+ peers: {
21
+ Input: styles_1.inputLight
22
+ },
23
+ self
24
+ });
25
+ exports.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,11 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.inputOtpRtl = void 0;
7
+ const input_otp_rtl_cssr_1 = __importDefault(require("../src/styles/input-otp-rtl.cssr"));
8
+ exports.inputOtpRtl = {
9
+ name: 'InputOtp',
10
+ style: input_otp_rtl_cssr_1.default
11
+ };
@@ -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;
@@ -65,13 +65,13 @@ exports.default = (0, vue_1.defineComponent)({
65
65
  this.renderSafeChecked && `${mergedClsPrefix}-radio--checked`,
66
66
  this.focus && `${mergedClsPrefix}-radio--focus`
67
67
  ], style: this.cssVars },
68
- (0, vue_1.h)("input", { ref: "inputRef", type: "radio", class: `${mergedClsPrefix}-radio-input`, value: this.value, name: this.mergedName, checked: this.renderSafeChecked, disabled: this.mergedDisabled, onChange: this.handleRadioInputChange, onFocus: this.handleRadioInputFocus, onBlur: this.handleRadioInputBlur }),
69
68
  (0, vue_1.h)("div", { class: `${mergedClsPrefix}-radio__dot-wrapper` },
70
69
  "\u00A0",
71
70
  (0, vue_1.h)("div", { class: [
72
71
  `${mergedClsPrefix}-radio__dot`,
73
72
  this.renderSafeChecked && `${mergedClsPrefix}-radio__dot--checked`
74
- ] })),
73
+ ] }),
74
+ (0, vue_1.h)("input", { ref: "inputRef", type: "radio", class: `${mergedClsPrefix}-radio-input`, value: this.value, name: this.mergedName, checked: this.renderSafeChecked, disabled: this.mergedDisabled, onChange: this.handleRadioInputChange, onFocus: this.handleRadioInputFocus, onBlur: this.handleRadioInputBlur })),
75
75
  (0, _utils_1.resolveWrappedSlot)($slots.default, (children) => {
76
76
  if (!children && !label)
77
77
  return null;
@@ -43,14 +43,10 @@ exports.default = (0, cssr_1.cB)('radio', `
43
43
  `), (0, cssr_1.cB)('radio-input', `
44
44
  position: absolute;
45
45
  border: 0;
46
- border-radius: inherit;
47
- left: 0;
48
- right: 0;
49
- top: 0;
50
- bottom: 0;
46
+ width: 0;
47
+ height: 0;
51
48
  opacity: 0;
52
- z-index: 1;
53
- cursor: pointer;
49
+ margin: 0;
54
50
  `), (0, cssr_1.cE)('dot', `
55
51
  position: absolute;
56
52
  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/lib/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';