origam 2.38.0 → 2.38.2

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 (228) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/src/assets/locales/en.json +1 -1
  3. package/dist/src/assets/locales/fr.json +2 -2
  4. package/dist/src/components/Alert/OrigamAlert.vue +739 -165
  5. package/dist/src/components/App/OrigamApp.vue +95 -19
  6. package/dist/src/components/App/OrigamAppBar.vue +751 -158
  7. package/dist/src/components/Audio/OrigamAudio.vue +1288 -346
  8. package/dist/src/components/Audio/OrigamAudioWaveform.vue +63 -7
  9. package/dist/src/components/Avatar/OrigamAvatar.vue +678 -126
  10. package/dist/src/components/Avatar/OrigamAvatarGroup.vue +700 -153
  11. package/dist/src/components/Badge/OrigamBadge.vue +548 -135
  12. package/dist/src/components/Blockquote/OrigamBlockquote.vue +698 -140
  13. package/dist/src/components/BottomNav/OrigamBottomNav.vue +864 -156
  14. package/dist/src/components/Bracket/OrigamBracket.vue +1013 -380
  15. package/dist/src/components/Bracket/OrigamBracketCompetitor.vue +674 -154
  16. package/dist/src/components/Bracket/OrigamBracketMatch.vue +663 -163
  17. package/dist/src/components/Bracket/OrigamBracketRound.vue +116 -34
  18. package/dist/src/components/Breadcrumb/OrigamBreadcrumb.vue +654 -119
  19. package/dist/src/components/Breadcrumb/OrigamBreadcrumbDivider.vue +292 -54
  20. package/dist/src/components/Breadcrumb/OrigamBreadcrumbItem.vue +657 -126
  21. package/dist/src/components/Btn/OrigamBtn.vue +928 -249
  22. package/dist/src/components/Btn/OrigamBtnGroup.vue +658 -141
  23. package/dist/src/components/Btn/OrigamBtnToggle.vue +578 -91
  24. package/dist/src/components/Calendar/OrigamCalendar.vue +1142 -484
  25. package/dist/src/components/Card/OrigamCard.vue +938 -194
  26. package/dist/src/components/Card/OrigamCardHeader.vue +593 -104
  27. package/dist/src/components/Card/OrigamCardText.vue +536 -84
  28. package/dist/src/components/Carousel/OrigamCarousel.vue +778 -202
  29. package/dist/src/components/Carousel/OrigamCarouselItem.vue +660 -109
  30. package/dist/src/components/Chart/OrigamChart.vue +942 -452
  31. package/dist/src/components/Chart/OrigamChartAxis.vue +111 -19
  32. package/dist/src/components/Chart/OrigamChartBoxPlot.vue +713 -297
  33. package/dist/src/components/Chart/OrigamChartBullet.vue +701 -286
  34. package/dist/src/components/Chart/OrigamChartCandlestick.vue +663 -243
  35. package/dist/src/components/Chart/OrigamChartCartesian.vue +1055 -487
  36. package/dist/src/components/Chart/OrigamChartGauge.vue +563 -164
  37. package/dist/src/components/Chart/OrigamChartHeatmap.vue +677 -251
  38. package/dist/src/components/Chart/OrigamChartHoneycomb.vue +700 -288
  39. package/dist/src/components/Chart/OrigamChartLegend.vue +108 -16
  40. package/dist/src/components/Chart/OrigamChartMap.vue +723 -299
  41. package/dist/src/components/Chart/OrigamChartPareto.vue +721 -276
  42. package/dist/src/components/Chart/OrigamChartPictorial.vue +777 -355
  43. package/dist/src/components/Chart/OrigamChartPolar.vue +603 -210
  44. package/dist/src/components/Chart/OrigamChartPolarBar.vue +674 -271
  45. package/dist/src/components/Chart/OrigamChartPyramid.vue +685 -250
  46. package/dist/src/components/Chart/OrigamChartRadar.vue +515 -165
  47. package/dist/src/components/Chart/OrigamChartRangeSelector.vue +50 -25
  48. package/dist/src/components/Chart/OrigamChartSankey.vue +913 -467
  49. package/dist/src/components/Chart/OrigamChartSparkline.vue +711 -268
  50. package/dist/src/components/Chart/OrigamChartStreamgraph.vue +810 -368
  51. package/dist/src/components/Chart/OrigamChartSunburst.vue +779 -368
  52. package/dist/src/components/Chart/OrigamChartTooltip.vue +78 -19
  53. package/dist/src/components/Chart/OrigamChartTreemap.vue +750 -288
  54. package/dist/src/components/Chart/OrigamChartVariwide.vue +679 -251
  55. package/dist/src/components/Chart/OrigamChartWordCloud.vue +674 -265
  56. package/dist/src/components/Checkbox/OrigamCheckbox.vue +781 -136
  57. package/dist/src/components/Checkbox/OrigamCheckboxBtn.vue +465 -81
  58. package/dist/src/components/Checkbox/OrigamCheckboxGroup.vue +824 -137
  59. package/dist/src/components/Chip/OrigamChip.vue +867 -202
  60. package/dist/src/components/Chip/OrigamChipGroup.vue +633 -121
  61. package/dist/src/components/ClientOnly/OrigamClientOnly.vue +30 -4
  62. package/dist/src/components/Clipboard/OrigamClipboard.vue +624 -105
  63. package/dist/src/components/Code/OrigamCode.vue +844 -206
  64. package/dist/src/components/CodeGroup/OrigamCodeGroup.vue +494 -83
  65. package/dist/src/components/ColorPicker/OrigamColorPicker.vue +777 -159
  66. package/dist/src/components/ColorPicker/OrigamColorPickerCanvas.vue +295 -181
  67. package/dist/src/components/ColorPicker/OrigamColorPickerEdit.vue +108 -45
  68. package/dist/src/components/ColorPicker/OrigamColorPickerPreview.vue +131 -46
  69. package/dist/src/components/ColorPicker/OrigamColorPickerSwatches.vue +128 -39
  70. package/dist/src/components/ColorPickerField/OrigamColorPickerField.vue +1123 -258
  71. package/dist/src/components/CommandPalette/OrigamCommandPalette.vue +415 -162
  72. package/dist/src/components/ConfirmWrapper/OrigamConfirmWrapper.vue +389 -145
  73. package/dist/src/components/ContextualMenu/OrigamContextualMenu.vue +852 -147
  74. package/dist/src/components/Counter/OrigamCounter.vue +588 -96
  75. package/dist/src/components/DataList/OrigamDataList.vue +619 -113
  76. package/dist/src/components/DataList/OrigamDataText.vue +295 -65
  77. package/dist/src/components/DataList/OrigamDataTitle.vue +295 -65
  78. package/dist/src/components/DataTable/OrigamDataTable.vue +934 -222
  79. package/dist/src/components/DataTable/OrigamDataTableColumnCell.vue +196 -51
  80. package/dist/src/components/DataTable/OrigamDataTableFooter.vue +319 -78
  81. package/dist/src/components/DataTable/OrigamDataTableGroupHeaderRow.vue +124 -44
  82. package/dist/src/components/DataTable/OrigamDataTableHeaderCell.vue +181 -70
  83. package/dist/src/components/DataTable/OrigamDataTableHeaders.vue +155 -46
  84. package/dist/src/components/DataTable/OrigamDataTableHeadersCell.vue +145 -27
  85. package/dist/src/components/DataTable/OrigamDataTableHeadersCellMobile.vue +126 -43
  86. package/dist/src/components/DataTable/OrigamDataTableRow.vue +151 -73
  87. package/dist/src/components/DataTable/OrigamDataTableRows.vue +261 -106
  88. package/dist/src/components/DatePicker/OrigamDatePicker.vue +1048 -261
  89. package/dist/src/components/DatePicker/OrigamDatePickerControls.vue +155 -51
  90. package/dist/src/components/DatePicker/OrigamDatePickerHeader.vue +147 -46
  91. package/dist/src/components/DatePicker/OrigamDatePickerMonth.vue +312 -134
  92. package/dist/src/components/DatePicker/OrigamDatePickerMonths.vue +151 -61
  93. package/dist/src/components/DatePicker/OrigamDatePickerYears.vue +154 -67
  94. package/dist/src/components/DatePickerField/OrigamDatePickerField.vue +1147 -306
  95. package/dist/src/components/DefaultsProvider/OrigamDefaultsProvider.vue +74 -14
  96. package/dist/src/components/Dialog/OrigamDialog.vue +953 -196
  97. package/dist/src/components/Dialog/OrigamDialogConfirmation.vue +886 -148
  98. package/dist/src/components/Divider/OrigamDivider.vue +210 -50
  99. package/dist/src/components/Drawer/OrigamDrawer.vue +909 -207
  100. package/dist/src/components/EmptyState/OrigamEmptyState.vue +146 -35
  101. package/dist/src/components/ExpansionPanel/OrigamExpansionPanel.vue +746 -159
  102. package/dist/src/components/ExpansionPanel/OrigamExpansionPanelContent.vue +591 -95
  103. package/dist/src/components/ExpansionPanel/OrigamExpansionPanelHeader.vue +663 -143
  104. package/dist/src/components/ExpansionPanel/OrigamExpansionPanels.vue +675 -134
  105. package/dist/src/components/Field/OrigamField.vue +1118 -306
  106. package/dist/src/components/FileField/OrigamFileField.vue +1188 -311
  107. package/dist/src/components/FileField/OrigamFileFieldDragNDropItem.vue +155 -36
  108. package/dist/src/components/FileField/OrigamFileFieldListItem.vue +155 -36
  109. package/dist/src/components/Form/OrigamForm.vue +197 -74
  110. package/dist/src/components/Grid/OrigamGrid.vue +707 -147
  111. package/dist/src/components/Grid/OrigamGridItem.vue +110 -37
  112. package/dist/src/components/Grids/OrigamCol.vue +593 -110
  113. package/dist/src/components/Grids/OrigamContainer.vue +461 -80
  114. package/dist/src/components/Grids/OrigamRow.vue +573 -112
  115. package/dist/src/components/Grids/OrigamSpacer.vue +54 -17
  116. package/dist/src/components/Icon/OrigamClassIcon.vue +573 -98
  117. package/dist/src/components/Icon/OrigamComponentIcon.vue +561 -101
  118. package/dist/src/components/Icon/OrigamIcon.vue +561 -98
  119. package/dist/src/components/Icon/OrigamLigatureIcon.vue +558 -98
  120. package/dist/src/components/Icon/OrigamSvgIcon.vue +593 -100
  121. package/dist/src/components/Img/OrigamImg.vue +869 -228
  122. package/dist/src/components/InfiniteScroll/OrigamInfiniteScroll.vue +319 -111
  123. package/dist/src/components/InfiniteScroll/OrigamInfiniteScrollIntersect.vue +80 -17
  124. package/dist/src/components/InlineEdit/OrigamInlineEdit.vue +476 -140
  125. package/dist/src/components/Input/OrigamInput.vue +747 -180
  126. package/dist/src/components/ItemGroup/OrigamItemGroup.vue +112 -36
  127. package/dist/src/components/ItemGroup/OrigamItemGroupItem.vue +80 -29
  128. package/dist/src/components/Kbd/OrigamKbd.vue +450 -75
  129. package/dist/src/components/Label/OrigamLabel.vue +584 -95
  130. package/dist/src/components/Layout/OrigamLayout.vue +563 -94
  131. package/dist/src/components/Lazy/OrigamLazy.vue +131 -34
  132. package/dist/src/components/List/OrigamList.vue +755 -170
  133. package/dist/src/components/List/OrigamListChildren.vue +59 -19
  134. package/dist/src/components/List/OrigamListGroup.vue +631 -134
  135. package/dist/src/components/List/OrigamListGroupActivator.vue +45 -17
  136. package/dist/src/components/List/OrigamListItem.vue +890 -224
  137. package/dist/src/components/List/OrigamListItemWrapper.vue +20 -10
  138. package/dist/src/components/List/OrigamListSubheader.vue +542 -93
  139. package/dist/src/components/Loader/OrigamLoader.vue +110 -25
  140. package/dist/src/components/Main/OrigamMain.vue +565 -96
  141. package/dist/src/components/Masonry/OrigamMasonry.vue +799 -187
  142. package/dist/src/components/Media/OrigamMediaController.vue +465 -182
  143. package/dist/src/components/Media/OrigamMediaScrubber.vue +389 -152
  144. package/dist/src/components/Media/OrigamMediaVolumeControl.vue +174 -44
  145. package/dist/src/components/Menu/OrigamMenu.vue +1079 -255
  146. package/dist/src/components/Messages/OrigamMessages.vue +606 -97
  147. package/dist/src/components/NumberField/OrigamNumberField.vue +1208 -333
  148. package/dist/src/components/NumberFormat/OrigamNumberFormat.vue +177 -57
  149. package/dist/src/components/OtpInputField/OrigamOtpInputField.vue +1016 -272
  150. package/dist/src/components/Overlay/OrigamOverlay.vue +446 -158
  151. package/dist/src/components/Overlay/OrigamOverlayScrim.vue +122 -30
  152. package/dist/src/components/Pagination/OrigamPagination.vue +982 -313
  153. package/dist/src/components/Parallax/OrigamParallax.vue +800 -259
  154. package/dist/src/components/Parallax/OrigamParallaxElement.vue +694 -178
  155. package/dist/src/components/Parallax/OrigamParallaxLayer.vue +132 -47
  156. package/dist/src/components/PasswordField/OrigamPasswordField.vue +1098 -265
  157. package/dist/src/components/Picker/OrigamPicker.vue +655 -108
  158. package/dist/src/components/Picker/OrigamPickerTitle.vue +108 -26
  159. package/dist/src/components/Progress/OrigamProgress.vue +436 -70
  160. package/dist/src/components/Progress/OrigamProgressCircular.vue +399 -82
  161. package/dist/src/components/Progress/OrigamProgressLinear.vue +468 -115
  162. package/dist/src/components/QrCode/OrigamQrCode.vue +642 -126
  163. package/dist/src/components/Radio/OrigamRadio.vue +772 -132
  164. package/dist/src/components/Radio/OrigamRadioBtn.vue +446 -71
  165. package/dist/src/components/Radio/OrigamRadioGroup.vue +808 -135
  166. package/dist/src/components/RatingField/OrigamRatingField.vue +963 -194
  167. package/dist/src/components/RatingField/OrigamRatingFieldItem.vue +657 -106
  168. package/dist/src/components/Responsive/OrigamResponsive.vue +548 -91
  169. package/dist/src/components/Select/OrigamSelect.vue +1639 -567
  170. package/dist/src/components/SelectionControl/OrigamSelectionControl.vue +564 -151
  171. package/dist/src/components/SelectionControl/OrigamSelectionControlGroup.vue +178 -62
  172. package/dist/src/components/Sheet/OrigamSheet.vue +773 -199
  173. package/dist/src/components/Skeleton/OrigamSkeleton.vue +249 -46
  174. package/dist/src/components/Skeleton/OrigamSkeletonGroup.vue +66 -11
  175. package/dist/src/components/Slide/OrigamSlideGroup.vue +772 -257
  176. package/dist/src/components/SliderField/OrigamSliderField.vue +1157 -335
  177. package/dist/src/components/SliderField/OrigamSliderFieldTrack.vue +236 -112
  178. package/dist/src/components/Snackbar/OrigamSnackbar.vue +871 -214
  179. package/dist/src/components/Snackbar/OrigamSnackbarGroup.vue +218 -51
  180. package/dist/src/components/Snackbar/OrigamSnackbarItem.vue +175 -43
  181. package/dist/src/components/Stepper/OrigamStepper.vue +618 -126
  182. package/dist/src/components/Stepper/OrigamStepperItem.vue +98 -37
  183. package/dist/src/components/Switch/OrigamSwitch.vue +879 -156
  184. package/dist/src/components/Switch/OrigamSwitchTrack.vue +431 -78
  185. package/dist/src/components/SystemBar/OrigamSystemBar.vue +517 -87
  186. package/dist/src/components/Table/OrigamTable.vue +585 -124
  187. package/dist/src/components/Tabs/OrigamTab.vue +239 -73
  188. package/dist/src/components/Tabs/OrigamTabPanel.vue +125 -39
  189. package/dist/src/components/Tabs/OrigamTabPanels.vue +148 -57
  190. package/dist/src/components/Tabs/OrigamTabs.vue +381 -109
  191. package/dist/src/components/TextField/OrigamTextField.vue +1077 -258
  192. package/dist/src/components/TextMask/OrigamTextMask.vue +150 -43
  193. package/dist/src/components/TextareaField/OrigamTextareaField.vue +1162 -310
  194. package/dist/src/components/TextareaField/OrigamTextareaFieldRichToolbar.vue +77 -79
  195. package/dist/src/components/ThemeProvider/OrigamThemeProvider.vue +44 -9
  196. package/dist/src/components/Timeline/OrigamTimeline.vue +113 -43
  197. package/dist/src/components/Timeline/OrigamTimelineItem.vue +163 -76
  198. package/dist/src/components/Title/OrigamTitle.vue +505 -82
  199. package/dist/src/components/Toolbar/OrigamToolbar.vue +679 -142
  200. package/dist/src/components/Tooltip/OrigamTooltip.vue +288 -72
  201. package/dist/src/components/Transition/OrigamExpandX.vue +219 -106
  202. package/dist/src/components/Transition/OrigamExpandY.vue +219 -106
  203. package/dist/src/components/Transition/OrigamFade.vue +47 -9
  204. package/dist/src/components/Transition/OrigamReverseTranslatePicker.vue +52 -10
  205. package/dist/src/components/Transition/OrigamScaleRotate.vue +52 -10
  206. package/dist/src/components/Transition/OrigamSlideX.vue +52 -10
  207. package/dist/src/components/Transition/OrigamSlideY.vue +52 -10
  208. package/dist/src/components/Transition/OrigamSnack.vue +52 -10
  209. package/dist/src/components/Transition/OrigamTransition.vue +40 -12
  210. package/dist/src/components/Transition/OrigamTranslateBottom.vue +52 -10
  211. package/dist/src/components/Transition/OrigamTranslatePicker.vue +52 -10
  212. package/dist/src/components/Transition/OrigamTranslateScale.vue +209 -97
  213. package/dist/src/components/Transition/OrigamWindowXReverseTranslate.vue +40 -7
  214. package/dist/src/components/Transition/OrigamWindowXTranslate.vue +40 -7
  215. package/dist/src/components/Transition/OrigamWindowYReverseTranslate.vue +40 -7
  216. package/dist/src/components/Transition/OrigamWindowYTranslate.vue +40 -7
  217. package/dist/src/components/Treeview/OrigamTreeview.vue +258 -118
  218. package/dist/src/components/Treeview/OrigamTreeviewNode.vue +126 -88
  219. package/dist/src/components/Video/OrigamVideo.vue +1178 -331
  220. package/dist/src/components/VirtualScroll/OrigamVirtualScroll.vue +147 -55
  221. package/dist/src/components/VirtualScroll/OrigamVirtualScrollItem.vue +94 -19
  222. package/dist/src/components/Watermark/OrigamWatermark.vue +224 -124
  223. package/dist/src/components/Window/OrigamWindow.vue +745 -175
  224. package/dist/src/components/Window/OrigamWindowItem.vue +162 -69
  225. package/dist/src/composables/Commons/display.composable.cjs +2 -0
  226. package/dist/src/composables/Commons/display.composable.js +1 -1
  227. package/dist/src/interfaces/Pagination/pagination.interface.d.ts +1 -1
  228. package/package.json +8 -8
@@ -168,349 +168,1093 @@ import { filterInputAttrs } from "../../utils/Input/input.util";
168
168
  import { focusChild, wrapInArray } from "../../utils/Commons/commons.util";
169
169
  import { forwardRefs } from "../../utils/Commons/forwardRefs.util";
170
170
  import { getUid } from "../../utils/Commons/getCurrentInstance.util";
171
+ /*********************************************************
172
+ * Global
173
+ *
174
+ * @description
175
+ * Props, emits, slots and filterProps for the OtpInputField component.
176
+ ********************************************************/
171
177
  const props = defineProps({
172
- autofocus: { type: Boolean, required: false },
173
- divider: { type: String, required: false },
174
- focusAll: { type: Boolean, required: false },
175
- length: { type: [Number, String], required: false, default: 6 },
176
- modelValue: { type: [Number, String, null], required: false },
177
- placeholder: { type: String, required: false },
178
- role: { type: String, required: false, default: "group" },
179
- type: { type: null, required: false, default: OTP_INPUT_FIELD_TYPE.NUMBER },
180
- centerAffix: { type: Boolean, required: false },
181
- dirty: { type: Boolean, required: false },
182
- disabled: { type: Boolean, required: false },
183
- error: { type: [String, Boolean], required: false },
184
- inline: { type: Boolean, required: false },
185
- label: { type: String, required: false },
186
- prefix: { type: String, required: false },
187
- suffix: { type: String, required: false },
188
- persistentClear: { type: Boolean, required: false },
189
- singleLine: { type: Boolean, required: false },
190
- required: { type: Boolean, required: false },
191
- id: { type: String, required: false },
192
- class: { type: [String, Array, Object], required: false },
193
- style: { type: [String, Array, Object, Boolean, null], required: false, skipCheck: true },
194
- loading: { type: [Boolean, Number, Object], required: false },
195
- loadingText: { type: String, required: false },
196
- tag: { type: String, required: false },
197
- color: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
198
- bgColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
199
- appendInnerAvatar: { type: String, required: false },
200
- appendInnerIcon: { type: null, required: false },
201
- prependInnerAvatar: { type: String, required: false },
202
- prependInnerIcon: { type: null, required: false },
203
- clearIcon: { type: null, required: false },
204
- clearable: { type: Boolean, required: false },
205
- prependInnerAriaLabel: { type: String, required: false },
206
- appendInnerAriaLabel: { type: String, required: false },
207
- border: { type: [Boolean, Number, String, Array], required: false, skipCheck: true },
208
- borderTop: { type: [Boolean, Number, String], required: false },
209
- borderLeft: { type: [Boolean, Number, String], required: false },
210
- borderBottom: { type: [Boolean, Number, String], required: false },
211
- borderRight: { type: [Boolean, Number, String], required: false },
212
- borderBlock: { type: [Boolean, Number, String], required: false },
213
- borderInline: { type: [Boolean, Number, String], required: false },
214
- borderInlineStart: { type: [Boolean, Number, String], required: false },
215
- borderInlineEnd: { type: [Boolean, Number, String], required: false },
216
- borderBlockStart: { type: [Boolean, Number, String], required: false },
217
- borderBlockEnd: { type: [Boolean, Number, String], required: false },
218
- borderColor: { type: String, required: false },
219
- borderStyle: { type: String, required: false },
220
- borderTopColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
221
- borderRightColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
222
- borderBottomColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
223
- borderLeftColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
224
- borderInlineStartColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
225
- borderInlineEndColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
226
- borderBlockStartColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
227
- borderBlockEndColor: { type: [String, Object, Boolean, null], required: false, skipCheck: true },
228
- focused: { type: Boolean, required: false },
229
- density: { type: null, required: false },
230
- text: { type: String, required: false },
231
- floating: { type: Boolean, required: false },
232
- name: { type: String, required: false },
233
- margin: { type: [Boolean, Number, String], required: false },
234
- marginTop: { type: [Boolean, Number, String], required: false },
235
- marginLeft: { type: [Boolean, Number, String], required: false },
236
- marginBottom: { type: [Boolean, Number, String], required: false },
237
- marginRight: { type: [Boolean, Number, String], required: false },
238
- marginBlock: { type: [Boolean, Number, String], required: false },
239
- marginInline: { type: [Boolean, Number, String], required: false },
240
- marginInlineStart: { type: [Boolean, Number, String], required: false },
241
- marginInlineEnd: { type: [Boolean, Number, String], required: false },
242
- marginBlockStart: { type: [Boolean, Number, String], required: false },
243
- marginBlockEnd: { type: [Boolean, Number, String], required: false },
244
- padding: { type: [Boolean, Number, String], required: false },
245
- paddingTop: { type: [Boolean, Number, String], required: false },
246
- paddingLeft: { type: [Boolean, Number, String], required: false },
247
- paddingBottom: { type: [Boolean, Number, String], required: false },
248
- paddingRight: { type: [Boolean, Number, String], required: false },
249
- paddingBlock: { type: [Boolean, Number, String], required: false },
250
- paddingInline: { type: [Boolean, Number, String], required: false },
251
- paddingInlineStart: { type: [Boolean, Number, String], required: false },
252
- paddingInlineEnd: { type: [Boolean, Number, String], required: false },
253
- paddingBlockStart: { type: [Boolean, Number, String], required: false },
254
- paddingBlockEnd: { type: [Boolean, Number, String], required: false },
255
- rounded: { type: [Boolean, Number, String, null], required: false, skipCheck: true },
256
- roundedTopRight: { type: [Boolean, Number, String], required: false },
257
- roundedTopLeft: { type: [Boolean, Number, String], required: false },
258
- roundedBottomLeft: { type: [Boolean, Number, String], required: false },
259
- roundedBottomRight: { type: [Boolean, Number, String], required: false },
260
- roundedStartStart: { type: [Boolean, Number, String], required: false },
261
- roundedStartEnd: { type: [Boolean, Number, String], required: false },
262
- roundedEndStart: { type: [Boolean, Number, String], required: false },
263
- roundedEndEnd: { type: [Boolean, Number, String], required: false },
264
- fontSize: { type: null, required: false },
265
- active: { type: [Boolean, Object], required: false },
266
- activeClass: { type: String, required: false },
267
- variant: { type: null, required: false },
268
- elevation: { type: [Number, String], required: false },
269
- size: { type: null, required: false },
270
- hideDetails: { type: [Boolean, String], required: false },
271
- hideSpinButtons: { type: Boolean, required: false },
272
- hint: { type: String, required: false },
273
- persistentHint: { type: Boolean, required: false },
274
- messages: { type: [Array, String], required: false },
275
- height: { type: [Number, String], required: false },
276
- maxHeight: { type: [Number, String], required: false },
277
- maxWidth: { type: [Number, String], required: false },
278
- minHeight: { type: [Number, String], required: false },
279
- minWidth: { type: [Number, String], required: false },
280
- width: { type: [Number, String], required: false },
281
- direction: { type: null, required: false },
282
- errorMessages: { type: [Array, String], required: false },
283
- maxErrors: { type: [Number, String], required: false },
284
- readonly: { type: Boolean, required: false },
285
- rules: { type: Array, required: false },
286
- validateOn: { type: null, required: false },
287
- validationValue: { type: null, required: false }
178
+ autofocus: {
179
+ type: Boolean,
180
+ required: false
181
+ },
182
+ divider: {
183
+ type: String,
184
+ required: false
185
+ },
186
+ focusAll: {
187
+ type: Boolean,
188
+ required: false
189
+ },
190
+ length: {
191
+ type: [Number, String],
192
+ required: false,
193
+ default: 6
194
+ },
195
+ modelValue: {
196
+ type: [
197
+ Number,
198
+ String,
199
+ null
200
+ ],
201
+ required: false
202
+ },
203
+ placeholder: {
204
+ type: String,
205
+ required: false
206
+ },
207
+ role: {
208
+ type: String,
209
+ required: false,
210
+ default: "group"
211
+ },
212
+ type: {
213
+ type: null,
214
+ required: false,
215
+ default: OTP_INPUT_FIELD_TYPE.NUMBER
216
+ },
217
+ centerAffix: {
218
+ type: Boolean,
219
+ required: false
220
+ },
221
+ dirty: {
222
+ type: Boolean,
223
+ required: false
224
+ },
225
+ disabled: {
226
+ type: Boolean,
227
+ required: false
228
+ },
229
+ error: {
230
+ type: [String, Boolean],
231
+ required: false
232
+ },
233
+ inline: {
234
+ type: Boolean,
235
+ required: false
236
+ },
237
+ label: {
238
+ type: String,
239
+ required: false
240
+ },
241
+ prefix: {
242
+ type: String,
243
+ required: false
244
+ },
245
+ suffix: {
246
+ type: String,
247
+ required: false
248
+ },
249
+ persistentClear: {
250
+ type: Boolean,
251
+ required: false
252
+ },
253
+ singleLine: {
254
+ type: Boolean,
255
+ required: false
256
+ },
257
+ required: {
258
+ type: Boolean,
259
+ required: false
260
+ },
261
+ id: {
262
+ type: String,
263
+ required: false
264
+ },
265
+ class: {
266
+ type: [
267
+ String,
268
+ Array,
269
+ Object
270
+ ],
271
+ required: false
272
+ },
273
+ style: {
274
+ type: [
275
+ String,
276
+ Array,
277
+ Object,
278
+ Boolean,
279
+ null
280
+ ],
281
+ required: false,
282
+ skipCheck: true
283
+ },
284
+ loading: {
285
+ type: [
286
+ Boolean,
287
+ Number,
288
+ Object
289
+ ],
290
+ required: false
291
+ },
292
+ loadingText: {
293
+ type: String,
294
+ required: false
295
+ },
296
+ tag: {
297
+ type: String,
298
+ required: false
299
+ },
300
+ color: {
301
+ type: [
302
+ String,
303
+ Object,
304
+ Boolean,
305
+ null
306
+ ],
307
+ required: false,
308
+ skipCheck: true
309
+ },
310
+ bgColor: {
311
+ type: [
312
+ String,
313
+ Object,
314
+ Boolean,
315
+ null
316
+ ],
317
+ required: false,
318
+ skipCheck: true
319
+ },
320
+ appendInnerAvatar: {
321
+ type: String,
322
+ required: false
323
+ },
324
+ appendInnerIcon: {
325
+ type: null,
326
+ required: false
327
+ },
328
+ prependInnerAvatar: {
329
+ type: String,
330
+ required: false
331
+ },
332
+ prependInnerIcon: {
333
+ type: null,
334
+ required: false
335
+ },
336
+ clearIcon: {
337
+ type: null,
338
+ required: false
339
+ },
340
+ clearable: {
341
+ type: Boolean,
342
+ required: false
343
+ },
344
+ prependInnerAriaLabel: {
345
+ type: String,
346
+ required: false
347
+ },
348
+ appendInnerAriaLabel: {
349
+ type: String,
350
+ required: false
351
+ },
352
+ border: {
353
+ type: [
354
+ Boolean,
355
+ Number,
356
+ String,
357
+ Array
358
+ ],
359
+ required: false,
360
+ skipCheck: true
361
+ },
362
+ borderTop: {
363
+ type: [
364
+ Boolean,
365
+ Number,
366
+ String
367
+ ],
368
+ required: false
369
+ },
370
+ borderLeft: {
371
+ type: [
372
+ Boolean,
373
+ Number,
374
+ String
375
+ ],
376
+ required: false
377
+ },
378
+ borderBottom: {
379
+ type: [
380
+ Boolean,
381
+ Number,
382
+ String
383
+ ],
384
+ required: false
385
+ },
386
+ borderRight: {
387
+ type: [
388
+ Boolean,
389
+ Number,
390
+ String
391
+ ],
392
+ required: false
393
+ },
394
+ borderBlock: {
395
+ type: [
396
+ Boolean,
397
+ Number,
398
+ String
399
+ ],
400
+ required: false
401
+ },
402
+ borderInline: {
403
+ type: [
404
+ Boolean,
405
+ Number,
406
+ String
407
+ ],
408
+ required: false
409
+ },
410
+ borderInlineStart: {
411
+ type: [
412
+ Boolean,
413
+ Number,
414
+ String
415
+ ],
416
+ required: false
417
+ },
418
+ borderInlineEnd: {
419
+ type: [
420
+ Boolean,
421
+ Number,
422
+ String
423
+ ],
424
+ required: false
425
+ },
426
+ borderBlockStart: {
427
+ type: [
428
+ Boolean,
429
+ Number,
430
+ String
431
+ ],
432
+ required: false
433
+ },
434
+ borderBlockEnd: {
435
+ type: [
436
+ Boolean,
437
+ Number,
438
+ String
439
+ ],
440
+ required: false
441
+ },
442
+ borderColor: {
443
+ type: String,
444
+ required: false
445
+ },
446
+ borderStyle: {
447
+ type: String,
448
+ required: false
449
+ },
450
+ borderTopColor: {
451
+ type: [
452
+ String,
453
+ Object,
454
+ Boolean,
455
+ null
456
+ ],
457
+ required: false,
458
+ skipCheck: true
459
+ },
460
+ borderRightColor: {
461
+ type: [
462
+ String,
463
+ Object,
464
+ Boolean,
465
+ null
466
+ ],
467
+ required: false,
468
+ skipCheck: true
469
+ },
470
+ borderBottomColor: {
471
+ type: [
472
+ String,
473
+ Object,
474
+ Boolean,
475
+ null
476
+ ],
477
+ required: false,
478
+ skipCheck: true
479
+ },
480
+ borderLeftColor: {
481
+ type: [
482
+ String,
483
+ Object,
484
+ Boolean,
485
+ null
486
+ ],
487
+ required: false,
488
+ skipCheck: true
489
+ },
490
+ borderInlineStartColor: {
491
+ type: [
492
+ String,
493
+ Object,
494
+ Boolean,
495
+ null
496
+ ],
497
+ required: false,
498
+ skipCheck: true
499
+ },
500
+ borderInlineEndColor: {
501
+ type: [
502
+ String,
503
+ Object,
504
+ Boolean,
505
+ null
506
+ ],
507
+ required: false,
508
+ skipCheck: true
509
+ },
510
+ borderBlockStartColor: {
511
+ type: [
512
+ String,
513
+ Object,
514
+ Boolean,
515
+ null
516
+ ],
517
+ required: false,
518
+ skipCheck: true
519
+ },
520
+ borderBlockEndColor: {
521
+ type: [
522
+ String,
523
+ Object,
524
+ Boolean,
525
+ null
526
+ ],
527
+ required: false,
528
+ skipCheck: true
529
+ },
530
+ focused: {
531
+ type: Boolean,
532
+ required: false
533
+ },
534
+ density: {
535
+ type: null,
536
+ required: false
537
+ },
538
+ text: {
539
+ type: String,
540
+ required: false
541
+ },
542
+ floating: {
543
+ type: Boolean,
544
+ required: false
545
+ },
546
+ name: {
547
+ type: String,
548
+ required: false
549
+ },
550
+ margin: {
551
+ type: [
552
+ Boolean,
553
+ Number,
554
+ String
555
+ ],
556
+ required: false
557
+ },
558
+ marginTop: {
559
+ type: [
560
+ Boolean,
561
+ Number,
562
+ String
563
+ ],
564
+ required: false
565
+ },
566
+ marginLeft: {
567
+ type: [
568
+ Boolean,
569
+ Number,
570
+ String
571
+ ],
572
+ required: false
573
+ },
574
+ marginBottom: {
575
+ type: [
576
+ Boolean,
577
+ Number,
578
+ String
579
+ ],
580
+ required: false
581
+ },
582
+ marginRight: {
583
+ type: [
584
+ Boolean,
585
+ Number,
586
+ String
587
+ ],
588
+ required: false
589
+ },
590
+ marginBlock: {
591
+ type: [
592
+ Boolean,
593
+ Number,
594
+ String
595
+ ],
596
+ required: false
597
+ },
598
+ marginInline: {
599
+ type: [
600
+ Boolean,
601
+ Number,
602
+ String
603
+ ],
604
+ required: false
605
+ },
606
+ marginInlineStart: {
607
+ type: [
608
+ Boolean,
609
+ Number,
610
+ String
611
+ ],
612
+ required: false
613
+ },
614
+ marginInlineEnd: {
615
+ type: [
616
+ Boolean,
617
+ Number,
618
+ String
619
+ ],
620
+ required: false
621
+ },
622
+ marginBlockStart: {
623
+ type: [
624
+ Boolean,
625
+ Number,
626
+ String
627
+ ],
628
+ required: false
629
+ },
630
+ marginBlockEnd: {
631
+ type: [
632
+ Boolean,
633
+ Number,
634
+ String
635
+ ],
636
+ required: false
637
+ },
638
+ padding: {
639
+ type: [
640
+ Boolean,
641
+ Number,
642
+ String
643
+ ],
644
+ required: false
645
+ },
646
+ paddingTop: {
647
+ type: [
648
+ Boolean,
649
+ Number,
650
+ String
651
+ ],
652
+ required: false
653
+ },
654
+ paddingLeft: {
655
+ type: [
656
+ Boolean,
657
+ Number,
658
+ String
659
+ ],
660
+ required: false
661
+ },
662
+ paddingBottom: {
663
+ type: [
664
+ Boolean,
665
+ Number,
666
+ String
667
+ ],
668
+ required: false
669
+ },
670
+ paddingRight: {
671
+ type: [
672
+ Boolean,
673
+ Number,
674
+ String
675
+ ],
676
+ required: false
677
+ },
678
+ paddingBlock: {
679
+ type: [
680
+ Boolean,
681
+ Number,
682
+ String
683
+ ],
684
+ required: false
685
+ },
686
+ paddingInline: {
687
+ type: [
688
+ Boolean,
689
+ Number,
690
+ String
691
+ ],
692
+ required: false
693
+ },
694
+ paddingInlineStart: {
695
+ type: [
696
+ Boolean,
697
+ Number,
698
+ String
699
+ ],
700
+ required: false
701
+ },
702
+ paddingInlineEnd: {
703
+ type: [
704
+ Boolean,
705
+ Number,
706
+ String
707
+ ],
708
+ required: false
709
+ },
710
+ paddingBlockStart: {
711
+ type: [
712
+ Boolean,
713
+ Number,
714
+ String
715
+ ],
716
+ required: false
717
+ },
718
+ paddingBlockEnd: {
719
+ type: [
720
+ Boolean,
721
+ Number,
722
+ String
723
+ ],
724
+ required: false
725
+ },
726
+ rounded: {
727
+ type: [
728
+ Boolean,
729
+ Number,
730
+ String,
731
+ null
732
+ ],
733
+ required: false,
734
+ skipCheck: true
735
+ },
736
+ roundedTopRight: {
737
+ type: [
738
+ Boolean,
739
+ Number,
740
+ String
741
+ ],
742
+ required: false
743
+ },
744
+ roundedTopLeft: {
745
+ type: [
746
+ Boolean,
747
+ Number,
748
+ String
749
+ ],
750
+ required: false
751
+ },
752
+ roundedBottomLeft: {
753
+ type: [
754
+ Boolean,
755
+ Number,
756
+ String
757
+ ],
758
+ required: false
759
+ },
760
+ roundedBottomRight: {
761
+ type: [
762
+ Boolean,
763
+ Number,
764
+ String
765
+ ],
766
+ required: false
767
+ },
768
+ roundedStartStart: {
769
+ type: [
770
+ Boolean,
771
+ Number,
772
+ String
773
+ ],
774
+ required: false
775
+ },
776
+ roundedStartEnd: {
777
+ type: [
778
+ Boolean,
779
+ Number,
780
+ String
781
+ ],
782
+ required: false
783
+ },
784
+ roundedEndStart: {
785
+ type: [
786
+ Boolean,
787
+ Number,
788
+ String
789
+ ],
790
+ required: false
791
+ },
792
+ roundedEndEnd: {
793
+ type: [
794
+ Boolean,
795
+ Number,
796
+ String
797
+ ],
798
+ required: false
799
+ },
800
+ fontSize: {
801
+ type: null,
802
+ required: false
803
+ },
804
+ active: {
805
+ type: [Boolean, Object],
806
+ required: false
807
+ },
808
+ activeClass: {
809
+ type: String,
810
+ required: false
811
+ },
812
+ variant: {
813
+ type: null,
814
+ required: false
815
+ },
816
+ elevation: {
817
+ type: [Number, String],
818
+ required: false
819
+ },
820
+ size: {
821
+ type: null,
822
+ required: false
823
+ },
824
+ hideDetails: {
825
+ type: [Boolean, String],
826
+ required: false
827
+ },
828
+ hideSpinButtons: {
829
+ type: Boolean,
830
+ required: false
831
+ },
832
+ hint: {
833
+ type: String,
834
+ required: false
835
+ },
836
+ persistentHint: {
837
+ type: Boolean,
838
+ required: false
839
+ },
840
+ messages: {
841
+ type: [Array, String],
842
+ required: false
843
+ },
844
+ height: {
845
+ type: [Number, String],
846
+ required: false
847
+ },
848
+ maxHeight: {
849
+ type: [Number, String],
850
+ required: false
851
+ },
852
+ maxWidth: {
853
+ type: [Number, String],
854
+ required: false
855
+ },
856
+ minHeight: {
857
+ type: [Number, String],
858
+ required: false
859
+ },
860
+ minWidth: {
861
+ type: [Number, String],
862
+ required: false
863
+ },
864
+ width: {
865
+ type: [Number, String],
866
+ required: false
867
+ },
868
+ direction: {
869
+ type: null,
870
+ required: false
871
+ },
872
+ errorMessages: {
873
+ type: [Array, String],
874
+ required: false
875
+ },
876
+ maxErrors: {
877
+ type: [Number, String],
878
+ required: false
879
+ },
880
+ readonly: {
881
+ type: Boolean,
882
+ required: false
883
+ },
884
+ rules: {
885
+ type: Array,
886
+ required: false
887
+ },
888
+ validateOn: {
889
+ type: null,
890
+ required: false
891
+ },
892
+ validationValue: {
893
+ type: null,
894
+ required: false
895
+ }
288
896
  });
289
- const emits = defineEmits(["finish", "click:control", "mousedown:control", "update:modelValue", "update:focused", "click:appendInner", "click:prependInner", "click:clear"]);
897
+ const emits = defineEmits([
898
+ "finish",
899
+ "click:control",
900
+ "mousedown:control",
901
+ "update:modelValue",
902
+ "update:focused",
903
+ "click:appendInner",
904
+ "click:prependInner",
905
+ "click:clear"
906
+ ]);
290
907
  defineSlots();
908
+ /*********************************************************
909
+ * Frames bornees a la duree de vie du composant (#753)
910
+ *
911
+ * @description
912
+ * Les deux rAF de gestion du focus etaient nus. Leur corps
913
+ * dereference `contentRef.value!` et `inputRef.value[index]` avec un
914
+ * `!` — or apres le demontage `contentRef.value` vaut `null`, et
915
+ * `focusChild(null, target)` n'a aucune raison de survivre a ca. La
916
+ * frame est armee depuis un `keydown`, donc typiquement une touche
917
+ * pressee au moment ou le champ disparait (validation d'OTP qui ferme
918
+ * la modale) tombe pile dans la fenetre.
919
+ ********************************************************/
291
920
  let disposed = false;
292
- const frames = /* @__PURE__ */ new Set();
921
+ const frames = new Set();
293
922
  const scheduleFrame = (cb) => {
294
- if (disposed) return;
295
- const id2 = requestAnimationFrame(() => {
296
- frames.delete(id2);
297
- if (disposed) return;
298
- cb();
299
- });
300
- frames.add(id2);
923
+ if (disposed) return;
924
+ const id = requestAnimationFrame(() => {
925
+ frames.delete(id);
926
+ if (disposed) return;
927
+ cb();
928
+ });
929
+ frames.add(id);
301
930
  };
302
931
  onBeforeUnmount(() => {
303
- disposed = true;
304
- for (const id2 of frames) cancelAnimationFrame(id2);
305
- frames.clear();
932
+ disposed = true;
933
+ for (const id of frames) cancelAnimationFrame(id);
934
+ frames.clear();
306
935
  });
307
936
  const { filterProps } = useProps(props);
308
937
  const { t } = useLocale();
309
938
  const attrs = useAttrs();
310
939
  const slots = useSlots();
940
+ /*********************************************************
941
+ * Identity
942
+ ********************************************************/
311
943
  const uid = getUid();
312
944
  const id = computed(() => props.id || `otp-input-field-${uid}`);
313
945
  const messagesId = computed(() => `${id.value}-messages`);
946
+ /*********************************************************
947
+ * Composables
948
+ ********************************************************/
314
949
  const { dimensionStyles } = useDimension(props);
950
+ /*********************************************************
951
+ * Effect
952
+ ********************************************************/
315
953
  const { isFocused, onFocus: focus, onBlur: blur } = useFocus(props);
316
- const model = useVModel(
317
- props,
318
- "modelValue",
319
- "",
320
- (val) => val == null ? [] : String(val).split(""),
321
- (val) => val.join("")
322
- );
954
+ /*********************************************************
955
+ * Value & model
956
+ *
957
+ * @description
958
+ * model is a char-array split from the string v-model value.
959
+ * length / fields drive the rendered cell count.
960
+ ********************************************************/
961
+ const model = useVModel(props, "modelValue", "", (val) => val == null ? [] : String(val).split(""), (val) => val.join(""));
323
962
  const length = computed(() => {
324
- return Number(props.length);
963
+ return Number(props.length);
325
964
  });
326
965
  const fields = computed(() => {
327
- return Array(length.value).fill(0);
966
+ return Array(length.value).fill(0);
328
967
  });
329
968
  const otpStringValue = computed(() => model.value.join(""));
330
- const {
331
- errorMessages,
332
- isPristine,
333
- isValid,
334
- isValidating,
335
- reset: resetValidation,
336
- validate,
337
- validationClasses
338
- } = useValidation(
339
- new Proxy(props, {
340
- get(target, key) {
341
- if (key === "modelValue" || key === "validationValue") {
342
- return otpStringValue.value;
343
- }
344
- return target[key];
345
- }
346
- }),
347
- "origam-otp-input-field",
348
- id
349
- );
969
+ /*********************************************************
970
+ * Validation
971
+ *
972
+ * @description
973
+ * useValidation evaluates `props.rules` against the joined OTP
974
+ * string (otpStringValue). A Proxy wraps props so that both
975
+ * `modelValue` and `validationValue` accesses transparently
976
+ * return the reactive OTP string — without duplicating the
977
+ * useVModel wiring that already lives above.
978
+ *
979
+ * `validationValue` is overridden DELIBERATELY, not by accident
980
+ * of the `||` condition: an OTP field only ever has one thing
981
+ * worth validating — the joined code the user actually typed.
982
+ * Validating a cell array, or some unrelated consumer-supplied
983
+ * value, has no functional meaning here. The prop stays on the
984
+ * declared surface (it is inherited from `IInputProps`, and
985
+ * removing it would be a public API break), but whatever a
986
+ * consumer passes is IGNORED: the rules always receive
987
+ * `otpStringValue`. This exception is documented in
988
+ * `packages/docs/components/OtpInputField/OrigamOtpInputField.md`
989
+ * and pinned by the `validationValue` tests in
990
+ * `packages/tests/TU/components/OtpInputField/OrigamOtpInputField.spec.ts`.
991
+ * See issue #697.
992
+ *
993
+ * `validationMessages` mirrors the `messages` computed from
994
+ * OrigamInput: errorMessages take precedence, then hint, then
995
+ * props.messages.
996
+ ********************************************************/
997
+ const { errorMessages, isPristine, isValid, isValidating, reset: resetValidation, validate, validationClasses } = useValidation(new Proxy(props, { get(target, key) {
998
+ if (key === "modelValue" || key === "validationValue") {
999
+ return otpStringValue.value;
1000
+ }
1001
+ return target[key];
1002
+ } }), "origam-otp-input-field", id);
350
1003
  const validationMessages = computed(() => {
351
- if (props.errorMessages?.length || !isPristine.value && errorMessages.value.length) {
352
- return errorMessages.value;
353
- } else if (props.hint && (props.persistentHint || isFocused.value)) {
354
- return wrapInArray(props.hint);
355
- }
356
- return wrapInArray(props.messages ?? []);
1004
+ if (props.errorMessages?.length || !isPristine.value && errorMessages.value.length) {
1005
+ return errorMessages.value;
1006
+ } else if (props.hint && (props.persistentHint || isFocused.value)) {
1007
+ return wrapInArray(props.hint);
1008
+ }
1009
+ return wrapInArray(props.messages ?? []);
357
1010
  });
358
1011
  const hasMessages = computed(() => validationMessages.value.length > 0);
359
1012
  const hasDetails = computed(() => {
360
- if (props.hideDetails === true) return false;
361
- if (props.hideDetails === "auto") return hasMessages.value;
362
- return true;
1013
+ if (props.hideDetails === true) return false;
1014
+ if (props.hideDetails === "auto") return hasMessages.value;
1015
+ return true;
363
1016
  });
1017
+ /*********************************************************
1018
+ * DOM refs
1019
+ *
1020
+ * @description
1021
+ * focusIndex tracks which cell currently has focus (-1 = none).
1022
+ * contentRef is the scrollable wrapper used by focusChild.
1023
+ * inputRef holds native <input> references, one per cell.
1024
+ * origamFieldRef holds OrigamField component references.
1025
+ * current is the currently focused native input.
1026
+ ********************************************************/
364
1027
  const focusIndex = ref(-1);
365
1028
  const contentRef = ref();
366
1029
  const inputRef = ref([]);
367
1030
  const origamFieldRef = ref([]);
368
1031
  const current = computed(() => {
369
- return inputRef.value[focusIndex.value];
1032
+ return inputRef.value[focusIndex.value];
370
1033
  });
371
1034
  const [rootAttrs, inputAttrs] = filterInputAttrs(attrs);
372
1035
  const fieldProps = (index) => {
373
- return origamFieldRef.value?.[index]?.filterProps(props, ["class", "style", "id", "label"]);
1036
+ return origamFieldRef.value?.[index]?.filterProps(props, [
1037
+ "class",
1038
+ "style",
1039
+ "id",
1040
+ "label"
1041
+ ]);
374
1042
  };
1043
+ /*********************************************************
1044
+ * Event handlers
1045
+ *
1046
+ * @description
1047
+ * handleInput, handleKeydown, handlePaste manage OTP cell navigation.
1048
+ * handleFocus / handleBlur track focusIndex and isFocused state.
1049
+ * reset is exposed for external programmatic clearing.
1050
+ * isInvalidValue guards non-numeric characters in number mode.
1051
+ ********************************************************/
375
1052
  const handleInput = () => {
376
- if (!current.value) return;
377
- if (isInvalidValue(current.value.value)) {
378
- current.value.value = "";
379
- return;
380
- }
381
- const array = model.value.slice();
382
- const value = current.value.value;
383
- array[focusIndex.value] = value;
384
- let target = null;
385
- if (focusIndex.value > model.value.length) {
386
- target = model.value.length + 1;
387
- } else if (focusIndex.value + 1 !== length.value) {
388
- target = "next";
389
- }
390
- model.value = array;
391
- if (target) focusChild(contentRef.value, target);
1053
+ if (!current.value) return;
1054
+ // The maxlength attribute doesn't work for the number type input, so the text type is used.
1055
+ // The following logic simulates the behavior of a number input.
1056
+ if (isInvalidValue(current.value.value)) {
1057
+ current.value.value = "";
1058
+ return;
1059
+ }
1060
+ const array = model.value.slice();
1061
+ const value = current.value.value;
1062
+ array[focusIndex.value] = value;
1063
+ let target = null;
1064
+ if (focusIndex.value > model.value.length) {
1065
+ target = model.value.length + 1;
1066
+ } else if (focusIndex.value + 1 !== length.value) {
1067
+ target = "next";
1068
+ }
1069
+ model.value = array;
1070
+ if (target) focusChild(contentRef.value, target);
392
1071
  };
393
1072
  const handleKeydown = (e) => {
394
- const array = model.value.slice();
395
- const index = focusIndex.value;
396
- let target = null;
397
- if (![
398
- "ArrowLeft",
399
- "ArrowRight",
400
- "Backspace",
401
- "Delete"
402
- ].includes(e.key)) return;
403
- e.preventDefault();
404
- if (e.key === "ArrowLeft") {
405
- target = "prev";
406
- } else if (e.key === "ArrowRight") {
407
- target = "next";
408
- } else if (["Backspace", "Delete"].includes(e.key)) {
409
- array[focusIndex.value] = "";
410
- model.value = array;
411
- if (focusIndex.value > 0 && e.key === "Backspace") {
412
- target = "prev";
413
- } else {
414
- scheduleFrame(() => {
415
- inputRef.value[index]?.select();
416
- });
417
- }
418
- }
419
- scheduleFrame(() => {
420
- if (target != null) {
421
- focusChild(contentRef.value, target);
422
- }
423
- });
1073
+ const array = model.value.slice();
1074
+ const index = focusIndex.value;
1075
+ let target = null;
1076
+ if (![
1077
+ "ArrowLeft",
1078
+ "ArrowRight",
1079
+ "Backspace",
1080
+ "Delete"
1081
+ ].includes(e.key)) return;
1082
+ e.preventDefault();
1083
+ if (e.key === "ArrowLeft") {
1084
+ target = "prev";
1085
+ } else if (e.key === "ArrowRight") {
1086
+ target = "next";
1087
+ } else if (["Backspace", "Delete"].includes(e.key)) {
1088
+ array[focusIndex.value] = "";
1089
+ model.value = array;
1090
+ if (focusIndex.value > 0 && e.key === "Backspace") {
1091
+ target = "prev";
1092
+ } else {
1093
+ scheduleFrame(() => {
1094
+ inputRef.value[index]?.select();
1095
+ });
1096
+ }
1097
+ }
1098
+ scheduleFrame(() => {
1099
+ if (target != null) {
1100
+ focusChild(contentRef.value, target);
1101
+ }
1102
+ });
424
1103
  };
425
1104
  const handlePaste = (index, e) => {
426
- e.preventDefault();
427
- e.stopPropagation();
428
- const clipboardText = e?.clipboardData?.getData("Text").slice(0, length.value) ?? "";
429
- if (isInvalidValue(clipboardText)) return;
430
- model.value = clipboardText.split("");
431
- inputRef.value?.[index].blur();
1105
+ e.preventDefault();
1106
+ e.stopPropagation();
1107
+ const clipboardText = e?.clipboardData?.getData("Text").slice(0, length.value) ?? "";
1108
+ if (isInvalidValue(clipboardText)) return;
1109
+ model.value = clipboardText.split("");
1110
+ inputRef.value?.[index].blur();
432
1111
  };
433
1112
  const reset = () => {
434
- model.value = [];
1113
+ model.value = [];
435
1114
  };
436
1115
  const handleFocus = (_e, index) => {
437
- if (!isFocused.value) focus();
438
- focusIndex.value = index;
1116
+ if (!isFocused.value) focus();
1117
+ focusIndex.value = index;
439
1118
  };
440
1119
  const handleBlur = () => {
441
- blur();
442
- focusIndex.value = -1;
1120
+ blur();
1121
+ focusIndex.value = -1;
443
1122
  };
1123
+ /*********************************************************
1124
+ * Control / clear handlers
1125
+ *
1126
+ * @description
1127
+ * Mirrors the sibling Field-wrapping components (TextField,
1128
+ * NumberField, PasswordField, Select, FileField, DatePickerField,
1129
+ * TextareaField, ColorPickerField): `click:control`/`mousedown:control`
1130
+ * relay a click/mousedown on the control area, `click:clear` relays
1131
+ * `<origam-field>`'s own `click:clear` and — same as TextField's
1132
+ * `handleClear` — actually performs the clear via the existing
1133
+ * `reset()` rather than only notifying.
1134
+ ********************************************************/
444
1135
  const handleControlClick = (e) => {
445
- emits("click:control", e);
1136
+ emits("click:control", e);
446
1137
  };
447
1138
  const handleControlMousedown = (e) => {
448
- emits("mousedown:control", e);
1139
+ emits("mousedown:control", e);
449
1140
  };
450
1141
  const handleClear = (e) => {
451
- e.stopPropagation();
452
- reset();
453
- emits("click:clear", e);
1142
+ e.stopPropagation();
1143
+ reset();
1144
+ emits("click:clear", e);
454
1145
  };
1146
+ /*********************************************************
1147
+ * click:appendInner / click:prependInner relay
1148
+ *
1149
+ * @description
1150
+ * `<origam-field>` (one per OTP cell) already emits both via its own
1151
+ * `useAdjacentInner` when a consumer sets `appendInnerIcon` /
1152
+ * `prependInnerIcon`, but nothing here listened for them — declared,
1153
+ * never fired (issue: guard `unemitted-declarations`,
1154
+ * `OtpInputField:click:appendInner,click:prependInner`). Mirrors
1155
+ * `handleClear` above: relay on THIS component's own instance whichever
1156
+ * cell the click came from.
1157
+ ********************************************************/
455
1158
  const handleClickAppendInner = (e) => {
456
- emits("click:appendInner", e);
1159
+ emits("click:appendInner", e);
457
1160
  };
458
1161
  const handleClickPrependInner = (e) => {
459
- emits("click:prependInner", e);
1162
+ emits("click:prependInner", e);
460
1163
  };
461
1164
  const isInvalidValue = (value) => {
462
- return props.type === OTP_INPUT_FIELD_TYPE.NUMBER && /[^0-9]/g.test(value);
1165
+ return props.type === OTP_INPUT_FIELD_TYPE.NUMBER && /[^0-9]/g.test(value);
463
1166
  };
464
1167
  watch(model, (val) => {
465
- if (val.length === length.value) {
466
- emits("finish", val.join(""));
467
- validate();
468
- }
1168
+ if (val.length === length.value) {
1169
+ emits("finish", val.join(""));
1170
+ validate();
1171
+ }
469
1172
  }, { deep: true });
470
1173
  watch(focusIndex, (val) => {
471
- if (val < 0) return;
472
- nextTick(() => {
473
- inputRef.value[val]?.select();
474
- });
1174
+ if (val < 0) return;
1175
+ nextTick(() => {
1176
+ inputRef.value[val]?.select();
1177
+ });
475
1178
  });
1179
+ /*********************************************************
1180
+ * Class & Style
1181
+ *
1182
+ * @description
1183
+ * otpInputFieldStyles and otpInputFieldClasses compose the BEM root.
1184
+ ********************************************************/
476
1185
  const { typographyStyles } = useTypography(props, "otp-input-field__cell");
477
1186
  const otpInputFieldStyles = computed(() => {
478
- return [
479
- props.style
480
- ];
1187
+ return [props.style];
481
1188
  });
482
1189
  const otpInputFieldClasses = computed(() => {
483
- return [
484
- "origam-otp-input-field",
485
- {
486
- "origam-otp-input-field--divided": !!props.divider
487
- },
488
- validationClasses.value,
489
- props.class
490
- ];
1190
+ return [
1191
+ "origam-otp-input-field",
1192
+ { "origam-otp-input-field--divided": !!props.divider },
1193
+ validationClasses.value,
1194
+ props.class
1195
+ ];
491
1196
  });
1197
+ /*********************************************************
1198
+ * styleId — l'id de la RACINE, celui du consommateur quand il en passe un
1199
+ *
1200
+ * @description
1201
+ * #790 — la racine ne portait AUCUN `:id`, et `useStyle` etait appele
1202
+ * sans son second argument. Deux defauts en un, mesures :
1203
+ * 1. l'`id` du consommateur n'atteignait aucun noeud — un
1204
+ * `getElementById` ou un `aria-describedby` externe ne trouvait
1205
+ * rien, sans le moindre avertissement ;
1206
+ * 2. la regle `#origam-otp-input-field-<uid> { … }` injectee dans
1207
+ * <head> ne matchait aucun noeud — un style MORT et silencieux.
1208
+ *
1209
+ * @description
1210
+ * Les deux contraintes de #790 se satisfont d'un seul geste, et c'est
1211
+ * la raison pour laquelle l'arbitrage redoute par le ticket n'existe
1212
+ * pas : `useStyle` retourne l'id qu'il CIBLE. Lier ce meme id sur la
1213
+ * racine garantit par construction que la regle generee continue de
1214
+ * s'appliquer, que l'id vienne du consommateur ou du repli genere.
1215
+ *
1216
+ * @description
1217
+ * ⛔ Pas de doublon ici, contrairement a `OrigamInput` / `OrigamField`
1218
+ * (#421/#422) : `props.id` n'est porte par aucun autre noeud de cet
1219
+ * arbre — les six `<origam-field>` l'excluent via `filterProps`, et
1220
+ * seul `messagesId` en DERIVE (`<id>-messages`). Mesure a l'appui dans
1221
+ * la sonde de rayon de souffle. La racine est bien le noeud a designer :
1222
+ * elle porte deja `role` et `aria-label`, c'est l'element de groupe.
1223
+ *
1224
+ * @description
1225
+ * Le getter garde la lecture PARESSEUSE (ADR-005) : le resolveur de
1226
+ * theme ecrit dans `beforeCreate`, donc APRES `setup()`.
1227
+ ********************************************************/
492
1228
  const { id: styleId, css, load, isLoaded, unload } = useStyle(otpInputFieldStyles, () => props.id);
1229
+ /*********************************************************
1230
+ * Expose
1231
+ *
1232
+ * @description
1233
+ * Exposes blur, focus, reset, resetValidation, validate, isValid,
1234
+ * isValidating, errorMessages, isFocused and filterProps to
1235
+ * parent ref consumers.
1236
+ ********************************************************/
493
1237
  defineExpose(forwardRefs({
494
- blur: () => {
495
- inputRef.value?.forEach((input) => input.blur());
496
- },
497
- focus: () => {
498
- inputRef.value?.[0]?.focus();
499
- },
500
- reset,
501
- resetValidation,
502
- validate,
503
- isValid,
504
- isValidating,
505
- errorMessages,
506
- isFocused,
507
- filterProps,
508
- css,
509
- id,
510
- styleId,
511
- load,
512
- unload,
513
- isLoaded
1238
+ blur: () => {
1239
+ inputRef.value?.forEach((input) => input.blur());
1240
+ },
1241
+ focus: () => {
1242
+ inputRef.value?.[0]?.focus();
1243
+ },
1244
+ reset,
1245
+ resetValidation,
1246
+ validate,
1247
+ isValid,
1248
+ isValidating,
1249
+ errorMessages,
1250
+ isFocused,
1251
+ filterProps,
1252
+ css,
1253
+ id,
1254
+ styleId,
1255
+ load,
1256
+ unload,
1257
+ isLoaded
514
1258
  }));
515
1259
  </script>
516
1260