@wix/patterns-fields 1.108.0 → 1.110.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 (273) hide show
  1. package/dist/cjs/components/address/input/address-input.st.css.js +3 -3
  2. package/dist/cjs/components/address/input/address-input.st.css.js.map +1 -1
  3. package/dist/cjs/components/audio/actions/actions-menu/actions-menu.st.css.js +3 -3
  4. package/dist/cjs/components/audio/actions/actions-menu/actions-menu.st.css.js.map +1 -1
  5. package/dist/cjs/components/audio/audio-field/form-audio-field.st.css.js +4 -4
  6. package/dist/cjs/components/audio/audio-field/form-audio-field.st.css.js.map +1 -1
  7. package/dist/cjs/components/audio/audio-player/audio-player.st.css.js +2 -2
  8. package/dist/cjs/components/audio/audio-player/audio-player.st.css.js.map +1 -1
  9. package/dist/cjs/components/boolean/cell-checkbox.js +15 -6
  10. package/dist/cjs/components/boolean/cell-checkbox.js.map +1 -1
  11. package/dist/cjs/components/color-view/cell-color-view.st.css.js +3 -3
  12. package/dist/cjs/components/color-view/cell-color-view.st.css.js.map +1 -1
  13. package/dist/cjs/components/color-view/color-view.st.css.js +4 -4
  14. package/dist/cjs/components/color-view/color-view.st.css.js.map +1 -1
  15. package/dist/cjs/components/date-input/cell-date-input.js +21 -2
  16. package/dist/cjs/components/date-input/cell-date-input.js.map +1 -1
  17. package/dist/cjs/components/date-input/date-picker-internals.js +93 -3
  18. package/dist/cjs/components/date-input/date-picker-internals.js.map +1 -1
  19. package/dist/cjs/components/date-input/form-date-input.driver.js +2 -0
  20. package/dist/cjs/components/date-input/form-date-input.driver.js.map +1 -1
  21. package/dist/cjs/components/date-input/form-date-input.js +23 -6
  22. package/dist/cjs/components/date-input/form-date-input.js.map +1 -1
  23. package/dist/cjs/components/date-input/use-field-value-replacement.js +48 -0
  24. package/dist/cjs/components/date-input/use-field-value-replacement.js.map +1 -0
  25. package/dist/cjs/components/datetime-input/form-date-time.driver.js +3 -0
  26. package/dist/cjs/components/datetime-input/form-date-time.driver.js.map +1 -1
  27. package/dist/cjs/components/datetime-input/form-date-time.js +61 -24
  28. package/dist/cjs/components/datetime-input/form-date-time.js.map +1 -1
  29. package/dist/cjs/components/delete-dialog/delete-dialog.st.css.js +3 -3
  30. package/dist/cjs/components/delete-dialog/delete-dialog.st.css.js.map +1 -1
  31. package/dist/cjs/components/document/form-document-field.st.css.js +7 -7
  32. package/dist/cjs/components/document/form-document-field.st.css.js.map +1 -1
  33. package/dist/cjs/components/exclamation/exclamation.st.css.js +5 -5
  34. package/dist/cjs/components/exclamation/exclamation.st.css.js.map +1 -1
  35. package/dist/cjs/components/highlighted-text/highlighted-text.st.css.js +5 -5
  36. package/dist/cjs/components/highlighted-text/highlighted-text.st.css.js.map +1 -1
  37. package/dist/cjs/components/image/thumbnail-replace-overlay.st.css.js +3 -3
  38. package/dist/cjs/components/image/thumbnail-replace-overlay.st.css.js.map +1 -1
  39. package/dist/cjs/components/media-control/cell-media-edit-shell.st.css.js +2 -2
  40. package/dist/cjs/components/media-control/cell-media-edit-shell.st.css.js.map +1 -1
  41. package/dist/cjs/components/media-control/paste-url-button.st.css.js +4 -4
  42. package/dist/cjs/components/media-control/paste-url-button.st.css.js.map +1 -1
  43. package/dist/cjs/components/media-gallery/form-media-gallery-field.st.css.js +10 -10
  44. package/dist/cjs/components/media-gallery/form-media-gallery-field.st.css.js.map +1 -1
  45. package/dist/cjs/components/media-image/media-image.st.css.js +4 -4
  46. package/dist/cjs/components/media-image/media-image.st.css.js.map +1 -1
  47. package/dist/cjs/components/media-image/overlays/overlay.st.css.js +3 -3
  48. package/dist/cjs/components/media-image/overlays/overlay.st.css.js.map +1 -1
  49. package/dist/cjs/components/media-tag/web-media-tag/media-tag.st.css.js +2 -2
  50. package/dist/cjs/components/media-tag/web-media-tag/media-tag.st.css.js.map +1 -1
  51. package/dist/cjs/components/multi-document/cell-multi-document-edit.st.css.js +3 -3
  52. package/dist/cjs/components/multi-document/cell-multi-document-edit.st.css.js.map +1 -1
  53. package/dist/cjs/components/multi-document/multi-document-input/form-multi-document.st.css.js +5 -5
  54. package/dist/cjs/components/multi-document/multi-document-input/form-multi-document.st.css.js.map +1 -1
  55. package/dist/cjs/components/reference/cell-multi-reference-input.st.css.js +2 -2
  56. package/dist/cjs/components/reference/cell-multi-reference-input.st.css.js.map +1 -1
  57. package/dist/cjs/components/reference/cell-reference-input.st.css.js +3 -3
  58. package/dist/cjs/components/reference/cell-reference-input.st.css.js.map +1 -1
  59. package/dist/cjs/components/rich-content/cell-rich-content-input.js +12 -9
  60. package/dist/cjs/components/rich-content/cell-rich-content-input.js.map +1 -1
  61. package/dist/cjs/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js +4 -4
  62. package/dist/cjs/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js.map +1 -1
  63. package/dist/cjs/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js +3 -3
  64. package/dist/cjs/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js.map +1 -1
  65. package/dist/cjs/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js +2 -2
  66. package/dist/cjs/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js.map +1 -1
  67. package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js +3 -3
  68. package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js.map +1 -1
  69. package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js +3 -3
  70. package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js.map +1 -1
  71. package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js +2 -2
  72. package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js.map +1 -1
  73. package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.js +23 -17
  74. package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.js.map +1 -1
  75. package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js +7 -7
  76. package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js.map +1 -1
  77. package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js +5 -5
  78. package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js.map +1 -1
  79. package/dist/cjs/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js +4 -4
  80. package/dist/cjs/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js.map +1 -1
  81. package/dist/cjs/components/rich-text/cell-rich-text-editor.js +21 -5
  82. package/dist/cjs/components/rich-text/cell-rich-text-editor.js.map +1 -1
  83. package/dist/cjs/components/rich-text/cell-rich-text-input.js +15 -7
  84. package/dist/cjs/components/rich-text/cell-rich-text-input.js.map +1 -1
  85. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js +18 -18
  86. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js.map +1 -1
  87. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js +4 -4
  88. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js.map +1 -1
  89. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js +18 -18
  90. package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js.map +1 -1
  91. package/dist/cjs/components/text/form-short-text.js +1 -1
  92. package/dist/cjs/components/text/form-short-text.js.map +1 -1
  93. package/dist/cjs/components/text/text-view.st.css.js +3 -3
  94. package/dist/cjs/components/text/text-view.st.css.js.map +1 -1
  95. package/dist/cjs/styles.global.css +1 -1
  96. package/dist/cjs/utils/keyboard.js +12 -0
  97. package/dist/cjs/utils/keyboard.js.map +1 -0
  98. package/dist/esm/components/address/input/address-input.st.css.js +2 -2
  99. package/dist/esm/components/address/input/address-input.st.css.js.map +1 -1
  100. package/dist/esm/components/audio/actions/actions-menu/actions-menu.st.css.js +2 -2
  101. package/dist/esm/components/audio/audio-field/form-audio-field.st.css.js +2 -2
  102. package/dist/esm/components/audio/audio-player/audio-player.st.css.js +2 -2
  103. package/dist/esm/components/boolean/cell-checkbox.js +10 -4
  104. package/dist/esm/components/boolean/cell-checkbox.js.map +1 -1
  105. package/dist/esm/components/color-view/cell-color-view.st.css.js +2 -2
  106. package/dist/esm/components/color-view/color-view.st.css.js +2 -2
  107. package/dist/esm/components/date-input/cell-date-input.js +21 -2
  108. package/dist/esm/components/date-input/cell-date-input.js.map +1 -1
  109. package/dist/esm/components/date-input/date-picker-internals.js +67 -0
  110. package/dist/esm/components/date-input/date-picker-internals.js.map +1 -1
  111. package/dist/esm/components/date-input/form-date-input.driver.js +2 -0
  112. package/dist/esm/components/date-input/form-date-input.driver.js.map +1 -1
  113. package/dist/esm/components/date-input/form-date-input.js +25 -4
  114. package/dist/esm/components/date-input/form-date-input.js.map +1 -1
  115. package/dist/esm/components/date-input/use-field-value-replacement.js +48 -0
  116. package/dist/esm/components/date-input/use-field-value-replacement.js.map +1 -0
  117. package/dist/esm/components/datetime-input/form-date-time.driver.js +3 -0
  118. package/dist/esm/components/datetime-input/form-date-time.driver.js.map +1 -1
  119. package/dist/esm/components/datetime-input/form-date-time.js +51 -21
  120. package/dist/esm/components/datetime-input/form-date-time.js.map +1 -1
  121. package/dist/esm/components/delete-dialog/delete-dialog.st.css.js +2 -2
  122. package/dist/esm/components/delete-dialog/delete-dialog.st.css.js.map +1 -1
  123. package/dist/esm/components/document/form-document-field.st.css.js +2 -2
  124. package/dist/esm/components/exclamation/exclamation.st.css.js +2 -2
  125. package/dist/esm/components/highlighted-text/highlighted-text.st.css.js +3 -3
  126. package/dist/esm/components/highlighted-text/highlighted-text.st.css.js.map +1 -1
  127. package/dist/esm/components/image/thumbnail-replace-overlay.st.css.js +2 -2
  128. package/dist/esm/components/media-control/cell-media-edit-shell.st.css.js +2 -2
  129. package/dist/esm/components/media-control/cell-media-edit-shell.st.css.js.map +1 -1
  130. package/dist/esm/components/media-control/paste-url-button.st.css.js +2 -2
  131. package/dist/esm/components/media-control/paste-url-button.st.css.js.map +1 -1
  132. package/dist/esm/components/media-gallery/form-media-gallery-field.st.css.js +2 -2
  133. package/dist/esm/components/media-gallery/form-media-gallery-field.st.css.js.map +1 -1
  134. package/dist/esm/components/media-image/media-image.st.css.js +3 -3
  135. package/dist/esm/components/media-image/media-image.st.css.js.map +1 -1
  136. package/dist/esm/components/media-image/overlays/overlay.st.css.js +2 -2
  137. package/dist/esm/components/media-image/overlays/overlay.st.css.js.map +1 -1
  138. package/dist/esm/components/media-tag/web-media-tag/media-tag.st.css.js +2 -2
  139. package/dist/esm/components/multi-document/cell-multi-document-edit.st.css.js +2 -2
  140. package/dist/esm/components/multi-document/multi-document-input/form-multi-document.st.css.js +2 -2
  141. package/dist/esm/components/reference/cell-multi-reference-input.st.css.js +2 -2
  142. package/dist/esm/components/reference/cell-reference-input.st.css.js +2 -2
  143. package/dist/esm/components/reference/cell-reference-input.st.css.js.map +1 -1
  144. package/dist/esm/components/rich-content/cell-rich-content-input.js +11 -9
  145. package/dist/esm/components/rich-content/cell-rich-content-input.js.map +1 -1
  146. package/dist/esm/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js +2 -2
  147. package/dist/esm/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js +2 -2
  148. package/dist/esm/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js +2 -2
  149. package/dist/esm/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js.map +1 -1
  150. package/dist/esm/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js +2 -2
  151. package/dist/esm/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js +2 -2
  152. package/dist/esm/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js.map +1 -1
  153. package/dist/esm/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js +2 -2
  154. package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.js +8 -2
  155. package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.js.map +1 -1
  156. package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js +2 -2
  157. package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js +2 -2
  158. package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js.map +1 -1
  159. package/dist/esm/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js +2 -2
  160. package/dist/esm/components/rich-text/cell-rich-text-editor.js +16 -1
  161. package/dist/esm/components/rich-text/cell-rich-text-editor.js.map +1 -1
  162. package/dist/esm/components/rich-text/cell-rich-text-input.js +8 -0
  163. package/dist/esm/components/rich-text/cell-rich-text-input.js.map +1 -1
  164. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js +2 -2
  165. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js +2 -2
  166. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js +2 -2
  167. package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js.map +1 -1
  168. package/dist/esm/components/text/form-short-text.js +1 -1
  169. package/dist/esm/components/text/form-short-text.js.map +1 -1
  170. package/dist/esm/components/text/text-view.st.css.js +2 -2
  171. package/dist/esm/components/text/text-view.st.css.js.map +1 -1
  172. package/dist/esm/styles.global.css +1 -1
  173. package/dist/esm/utils/keyboard.js +7 -0
  174. package/dist/esm/utils/keyboard.js.map +1 -0
  175. package/dist/types/components/address/input/address-input.st.css.d.ts.map +1 -1
  176. package/dist/types/components/boolean/cell-checkbox.d.ts +4 -1
  177. package/dist/types/components/boolean/cell-checkbox.d.ts.map +1 -1
  178. package/dist/types/components/date-input/cell-date-input.d.ts +4 -0
  179. package/dist/types/components/date-input/cell-date-input.d.ts.map +1 -1
  180. package/dist/types/components/date-input/date-picker-internals.d.ts +11 -1
  181. package/dist/types/components/date-input/date-picker-internals.d.ts.map +1 -1
  182. package/dist/types/components/date-input/form-date-input.d.ts.map +1 -1
  183. package/dist/types/components/date-input/form-date-input.driver.d.ts +2 -0
  184. package/dist/types/components/date-input/form-date-input.driver.d.ts.map +1 -1
  185. package/dist/types/components/date-input/use-field-value-replacement.d.ts +3 -0
  186. package/dist/types/components/date-input/use-field-value-replacement.d.ts.map +1 -0
  187. package/dist/types/components/datetime-input/form-date-time.d.ts.map +1 -1
  188. package/dist/types/components/datetime-input/form-date-time.driver.d.ts +3 -0
  189. package/dist/types/components/datetime-input/form-date-time.driver.d.ts.map +1 -1
  190. package/dist/types/components/delete-dialog/delete-dialog.st.css.d.ts.map +1 -1
  191. package/dist/types/components/highlighted-text/highlighted-text.st.css.d.ts.map +1 -1
  192. package/dist/types/components/media-control/cell-media-edit-shell.st.css.d.ts.map +1 -1
  193. package/dist/types/components/media-control/paste-url-button.st.css.d.ts.map +1 -1
  194. package/dist/types/components/media-gallery/form-media-gallery-field.st.css.d.ts.map +1 -1
  195. package/dist/types/components/media-image/media-image.st.css.d.ts.map +1 -1
  196. package/dist/types/components/media-image/overlays/overlay.st.css.d.ts.map +1 -1
  197. package/dist/types/components/reference/cell-reference-input.st.css.d.ts.map +1 -1
  198. package/dist/types/components/rich-content/cell-rich-content-input.d.ts +2 -1
  199. package/dist/types/components/rich-content/cell-rich-content-input.d.ts.map +1 -1
  200. package/dist/types/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.d.ts.map +1 -1
  201. package/dist/types/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.d.ts.map +1 -1
  202. package/dist/types/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.d.ts +2 -0
  203. package/dist/types/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.d.ts.map +1 -1
  204. package/dist/types/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.d.ts.map +1 -1
  205. package/dist/types/components/rich-text/cell-rich-text-editor.d.ts.map +1 -1
  206. package/dist/types/components/rich-text/cell-rich-text-input.d.ts +1 -1
  207. package/dist/types/components/rich-text/cell-rich-text-input.d.ts.map +1 -1
  208. package/dist/types/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.d.ts.map +1 -1
  209. package/dist/types/components/text/text-view.st.css.d.ts.map +1 -1
  210. package/dist/types/utils/keyboard.d.ts +4 -0
  211. package/dist/types/utils/keyboard.d.ts.map +1 -0
  212. package/package.json +5 -5
  213. package/src/__tests__/components/cell-rich-content-input.spec.tsx +73 -0
  214. package/src/__tests__/components/cell-rich-text-editor.spec.tsx +64 -0
  215. package/src/__tests__/components/cell-rich-text-input.spec.tsx +39 -0
  216. package/src/__tests__/components/date-input/cell-date-input.spec.tsx +100 -0
  217. package/src/__tests__/components/date-input/date-picker-internals.spec.tsx +69 -0
  218. package/src/__tests__/components/date-input/form-date-input.spec.tsx +141 -0
  219. package/src/__tests__/components/datetime-input/form-date-time.spec.tsx +194 -0
  220. package/src/__tests__/components/rich-content-editor.spec.tsx +53 -0
  221. package/src/__tests__/components/text/form-short-text.spec.tsx +27 -0
  222. package/src/__tests__/form-field.driver.tsx +31 -3
  223. package/src/__tests__/hooks/use-field-value-replacement.spec.tsx +68 -0
  224. package/src/__tests__/utils/keyboard.spec.ts +45 -0
  225. package/src/components/address/input/address-input.st.css.ts +2 -2
  226. package/src/components/audio/actions/actions-menu/actions-menu.st.css.ts +2 -2
  227. package/src/components/audio/audio-field/form-audio-field.st.css.ts +2 -2
  228. package/src/components/audio/audio-player/audio-player.st.css.ts +2 -2
  229. package/src/components/boolean/cell-checkbox.tsx +33 -11
  230. package/src/components/color-view/cell-color-view.st.css.ts +2 -2
  231. package/src/components/color-view/color-view.st.css.ts +2 -2
  232. package/src/components/date-input/cell-date-input.tsx +28 -0
  233. package/src/components/date-input/date-picker-internals.ts +104 -3
  234. package/src/components/date-input/form-date-input.driver.ts +2 -0
  235. package/src/components/date-input/form-date-input.tsx +25 -3
  236. package/src/components/date-input/use-field-value-replacement.ts +63 -0
  237. package/src/components/datetime-input/form-date-time.driver.ts +3 -0
  238. package/src/components/datetime-input/form-date-time.tsx +55 -33
  239. package/src/components/delete-dialog/delete-dialog.st.css.ts +2 -2
  240. package/src/components/document/form-document-field.st.css.ts +2 -2
  241. package/src/components/exclamation/exclamation.st.css.ts +2 -2
  242. package/src/components/highlighted-text/highlighted-text.st.css.ts +3 -3
  243. package/src/components/image/thumbnail-replace-overlay.st.css.ts +2 -2
  244. package/src/components/media-control/cell-media-edit-shell.st.css.ts +2 -2
  245. package/src/components/media-control/paste-url-button.st.css.ts +2 -2
  246. package/src/components/media-gallery/form-media-gallery-field.st.css.ts +2 -2
  247. package/src/components/media-image/media-image.st.css.ts +3 -3
  248. package/src/components/media-image/overlays/overlay.st.css.ts +2 -2
  249. package/src/components/media-tag/web-media-tag/media-tag.st.css.ts +2 -2
  250. package/src/components/multi-document/cell-multi-document-edit.st.css.ts +2 -2
  251. package/src/components/multi-document/multi-document-input/form-multi-document.st.css.ts +2 -2
  252. package/src/components/reference/cell-multi-reference-input.st.css.ts +2 -2
  253. package/src/components/reference/cell-reference-input.st.css.ts +2 -2
  254. package/src/components/rich-content/cell-rich-content-input.tsx +12 -13
  255. package/src/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.ts +2 -2
  256. package/src/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.ts +2 -2
  257. package/src/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.ts +2 -2
  258. package/src/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.ts +2 -2
  259. package/src/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.ts +2 -2
  260. package/src/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.ts +2 -2
  261. package/src/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.ts +2 -2
  262. package/src/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.tsx +9 -1
  263. package/src/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.ts +2 -2
  264. package/src/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.ts +2 -2
  265. package/src/components/rich-text/cell-rich-text-editor.tsx +30 -1
  266. package/src/components/rich-text/cell-rich-text-input.tsx +9 -1
  267. package/src/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.ts +2 -2
  268. package/src/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.ts +2 -2
  269. package/src/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.ts +2 -2
  270. package/src/components/text/form-short-text.tsx +1 -1
  271. package/src/components/text/text-view.st.css.ts +2 -2
  272. package/src/styles.global.css +1 -1
  273. package/src/utils/keyboard.ts +7 -0
@@ -10,6 +10,7 @@ var _form = require("@wix/bex-core/form");
10
10
  var _hooks = require("../../hooks");
11
11
  var _string = require("../../validations/string");
12
12
  var _popoverDefaults = require("../popover-defaults");
13
+ var _useFieldValueReplacement = require("./use-field-value-replacement");
13
14
  var _dateUtils = require("./date-utils");
14
15
  var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/fields/dist/cjs/components/date-input/form-date-input.tsx";
15
16
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
@@ -28,10 +29,11 @@ const _FormDateInput = props => {
28
29
  const {
29
30
  t: tFields
30
31
  } = (0, _hooks.useTranslations)();
32
+ const inputError = (0, _react.useRef)('');
31
33
  const computeError = (value, format, validationType) => {
32
- var _field$validation;
33
- if ((_field$validation = field.validation) != null && _field$validation.required && (0, _string.isEmpty)(value)) {
34
- return t('cairo.fieldValidation.requiredField');
34
+ if ((0, _string.isEmpty)(value)) {
35
+ var _field$validation;
36
+ return (_field$validation = field.validation) != null && _field$validation.required ? t('cairo.fieldValidation.requiredField') : '';
35
37
  }
36
38
  if (validationType === 'formatError' && format) {
37
39
  return t('cairo.customFields.fieldType.date.invalid.value', {
@@ -46,7 +48,7 @@ const _FormDateInput = props => {
46
48
  defaultValue: data == null ? void 0 : data[(field == null ? void 0 : field.id) ?? ''],
47
49
  rules: {
48
50
  validate: value => {
49
- const error = computeError(value);
51
+ const error = inputError.current || computeError(value);
50
52
  return error || true;
51
53
  }
52
54
  }
@@ -60,6 +62,13 @@ const _FormDateInput = props => {
60
62
  });
61
63
  const ref = (0, _react.useRef)({});
62
64
  const [errorMessage, setErrorMessage] = (0, _react.useState)('');
65
+ const revision = (0, _useFieldValueReplacement.useFieldValueReplacement)(formControl, field.id, value => {
66
+ inputError.current = '';
67
+ setErrorMessage('');
68
+ ref.current.invalid = false;
69
+ const iso = typeof value === 'string' ? (0, _dateUtils.getISODateStringWithFixedTimezone)(value) : undefined;
70
+ setDate(iso ? (0, _dateUtils.getDateWithoutTimezone)(iso) : undefined);
71
+ });
63
72
  return /*#__PURE__*/_react.default.createElement(_designSystem.FormField, {
64
73
  label: field.displayName,
65
74
  required: (_field$validation2 = field.validation) == null ? void 0 : _field$validation2.required,
@@ -68,10 +77,11 @@ const _FormDateInput = props => {
68
77
  __self: void 0,
69
78
  __source: {
70
79
  fileName: _jsxFileName,
71
- lineNumber: 64,
80
+ lineNumber: 78,
72
81
  columnNumber: 5
73
82
  }
74
83
  }, /*#__PURE__*/_react.default.createElement(_designSystem.DatePicker, {
84
+ key: revision,
75
85
  ref: internalRef => {
76
86
  var _internalRef$state;
77
87
  inputRef == null || inputRef(ref.current);
@@ -88,6 +98,9 @@ const _FormDateInput = props => {
88
98
  placeholderText: tFields('CMS.formDate.placeholder'),
89
99
  value: date,
90
100
  onChange: newValue => {
101
+ inputError.current = '';
102
+ setErrorMessage('');
103
+ ref.current.invalid = false;
91
104
  setDate(newValue);
92
105
  const formattedDate = newValue ? (0, _dateUtils.getISODateStringWithFixedTimezone)(newValue) : undefined;
93
106
  controller.field.onChange((formattedDate == null ? void 0 : formattedDate.split('T')[0]) ?? null);
@@ -98,11 +111,15 @@ const _FormDateInput = props => {
98
111
  format
99
112
  }) => {
100
113
  const error = computeError(newValue, format, validationType);
114
+ inputError.current = error;
101
115
  setErrorMessage(error);
102
116
  ref.current.invalid = !!error;
103
117
  if (validationType === 'formatError' && newValue === '') {
104
118
  setDate(undefined);
105
119
  controller.field.onChange(null);
120
+ } else {
121
+ // Invalid text does not change the stored date, but must revalidate it.
122
+ controller.field.onChange(controller.field.value);
106
123
  }
107
124
  },
108
125
  status: errorMessage ? 'error' : undefined,
@@ -110,7 +127,7 @@ const _FormDateInput = props => {
110
127
  __self: void 0,
111
128
  __source: {
112
129
  fileName: _jsxFileName,
113
- lineNumber: 70,
130
+ lineNumber: 84,
114
131
  columnNumber: 7
115
132
  }
116
133
  }));
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_designSystem","_mobxReactLite","_react2","_form","_hooks","_string","_popoverDefaults","_dateUtils","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_FormDateInput","props","_field$validation2","field","dataHook","inputRef","formControl","data","translate","useWixPatternsContainer","tFields","useTranslations","computeError","value","format","validationType","_field$validation","validation","required","isEmpty","dateFormat","controller","useController","name","id","control","defaultValue","rules","validate","error","date","setDate","useState","iso","getISODateStringWithFixedTimezone","undefined","getDateWithoutTimezone","ref","useRef","errorMessage","setErrorMessage","createElement","FormField","label","displayName","statusMessage","__self","__source","fileName","lineNumber","columnNumber","DatePicker","internalRef","_internalRef$state","current","inputEl","state","focus","popoverProps","calendarPopoverDefaults","width","placeholderText","onChange","newValue","formattedDate","split","onValidate","invalid","status","FormDateInput","exports","observer"],"sources":["../../../../src/components/date-input/form-date-input.tsx"],"sourcesContent":["import React, { useState, useRef } from 'react';\nimport { FormField, DatePicker } from '@wix/design-system';\nimport { observer } from 'mobx-react-lite';\nimport { useWixPatternsContainer } from '@wix/bex-core/react';\nimport { useController } from '@wix/bex-core/form';\n\nimport { BaseInputProps, BaseInputRef } from '../../types/base-input';\nimport { useTranslations } from '../../hooks';\nimport { isEmpty } from '../../validations/string';\nimport { calendarPopoverDefaults } from '../popover-defaults';\nimport {\n getDateWithoutTimezone,\n getISODateStringWithFixedTimezone,\n} from './date-utils';\n\nexport interface FormDateInputProps extends BaseInputProps<string | null> {}\n\nconst _FormDateInput = (props: FormDateInputProps) => {\n const { field, dataHook, inputRef, formControl, data } = props;\n const { translate: t } = useWixPatternsContainer();\n const { t: tFields } = useTranslations();\n\n const computeError = (\n value: string | null | undefined,\n format?: string,\n validationType?: 'outOfBoundsError' | 'formatError' | 'valid',\n ): string => {\n if (field.validation?.required && isEmpty(value)) {\n return t('cairo.fieldValidation.requiredField');\n }\n if (validationType === 'formatError' && format) {\n return t('cairo.customFields.fieldType.date.invalid.value', {\n dateFormat: format,\n });\n }\n return '';\n };\n\n const controller = useController({\n name: field?.id ?? '',\n control: formControl,\n defaultValue: data?.[field?.id ?? ''],\n rules: {\n validate: (value) => {\n const error = computeError(value);\n return error || true;\n },\n },\n });\n\n // A stored value that isn't a date leaves the picker empty instead of\n // throwing out of render.\n const [date, setDate] = useState<Date | undefined>(() => {\n const iso = controller.field.value\n ? getISODateStringWithFixedTimezone(controller.field.value)\n : undefined;\n return iso ? getDateWithoutTimezone(iso) : undefined;\n });\n\n const ref = useRef<BaseInputRef>({});\n const [errorMessage, setErrorMessage] = useState<string>('');\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n statusMessage={errorMessage}\n dataHook={dataHook}\n >\n <DatePicker\n ref={(internalRef) => {\n inputRef?.(ref.current);\n const inputEl =\n // @ts-expect-error: WSR internal API hack for focusing\n internalRef?.state?.inputRef as HTMLElement | undefined;\n ref.current.focus = () => inputEl?.focus?.();\n // Let react-hook-form's shouldFocusError scroll to + focus this field\n // when it blocks save.\n controller.field.ref(inputEl ?? null);\n }}\n dataHook={`date-${field.id}`}\n popoverProps={calendarPopoverDefaults}\n width=\"100%\"\n placeholderText={tFields('CMS.formDate.placeholder')}\n value={date}\n onChange={(newValue: Date) => {\n setDate(newValue);\n const formattedDate = newValue\n ? getISODateStringWithFixedTimezone(newValue)\n : undefined;\n controller.field.onChange(formattedDate?.split('T')[0] ?? null);\n }}\n onValidate={({ validationType, value: newValue, format }) => {\n const error = computeError(newValue, format, validationType);\n setErrorMessage(error);\n ref.current.invalid = !!error;\n\n if (validationType === 'formatError' && newValue === '') {\n setDate(undefined);\n controller.field.onChange(null);\n }\n }}\n status={errorMessage ? 'error' : undefined}\n statusMessage={errorMessage}\n />\n </FormField>\n );\n};\n\nexport const FormDateInput = observer(_FormDateInput);\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ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","_react2","_form","_hooks","_string","_popoverDefaults","_useFieldValueReplacement","_dateUtils","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_FormDateInput","props","_field$validation2","field","dataHook","inputRef","formControl","data","translate","useWixPatternsContainer","tFields","useTranslations","inputError","useRef","computeError","value","format","validationType","isEmpty","_field$validation","validation","required","dateFormat","controller","useController","name","id","control","defaultValue","rules","validate","error","current","date","setDate","useState","iso","getISODateStringWithFixedTimezone","undefined","getDateWithoutTimezone","ref","errorMessage","setErrorMessage","revision","useFieldValueReplacement","invalid","createElement","FormField","label","displayName","statusMessage","__self","__source","fileName","lineNumber","columnNumber","DatePicker","key","internalRef","_internalRef$state","inputEl","state","focus","popoverProps","calendarPopoverDefaults","width","placeholderText","onChange","newValue","formattedDate","split","onValidate","status","FormDateInput","exports","observer"],"sources":["../../../../src/components/date-input/form-date-input.tsx"],"sourcesContent":["import React, { useState, useRef } from 'react';\nimport { FormField, DatePicker } from '@wix/design-system';\nimport { observer } from 'mobx-react-lite';\nimport { useWixPatternsContainer } from '@wix/bex-core/react';\nimport { useController } from '@wix/bex-core/form';\n\nimport { BaseInputProps, BaseInputRef } from '../../types/base-input';\nimport { useTranslations } from '../../hooks';\nimport { isEmpty } from '../../validations/string';\nimport { calendarPopoverDefaults } from '../popover-defaults';\nimport { useFieldValueReplacement } from './use-field-value-replacement';\nimport {\n getDateWithoutTimezone,\n getISODateStringWithFixedTimezone,\n} from './date-utils';\n\nexport interface FormDateInputProps extends BaseInputProps<string | null> {}\n\nconst _FormDateInput = (props: FormDateInputProps) => {\n const { field, dataHook, inputRef, formControl, data } = props;\n const { translate: t } = useWixPatternsContainer();\n const { t: tFields } = useTranslations();\n const inputError = useRef('');\n\n const computeError = (\n value: string | null | undefined,\n format?: string,\n validationType?: 'outOfBoundsError' | 'formatError' | 'valid',\n ): string => {\n if (isEmpty(value)) {\n return field.validation?.required\n ? t('cairo.fieldValidation.requiredField')\n : '';\n }\n if (validationType === 'formatError' && format) {\n return t('cairo.customFields.fieldType.date.invalid.value', {\n dateFormat: format,\n });\n }\n return '';\n };\n\n const controller = useController({\n name: field?.id ?? '',\n control: formControl,\n defaultValue: data?.[field?.id ?? ''],\n rules: {\n validate: (value) => {\n const error = inputError.current || computeError(value);\n return error || true;\n },\n },\n });\n\n // A stored value that isn't a date leaves the picker empty instead of\n // throwing out of render.\n const [date, setDate] = useState<Date | undefined>(() => {\n const iso = controller.field.value\n ? getISODateStringWithFixedTimezone(controller.field.value)\n : undefined;\n return iso ? getDateWithoutTimezone(iso) : undefined;\n });\n\n const ref = useRef<BaseInputRef>({});\n const [errorMessage, setErrorMessage] = useState<string>('');\n const revision = useFieldValueReplacement(formControl, field.id, (value) => {\n inputError.current = '';\n setErrorMessage('');\n ref.current.invalid = false;\n const iso =\n typeof value === 'string'\n ? getISODateStringWithFixedTimezone(value)\n : undefined;\n setDate(iso ? getDateWithoutTimezone(iso) : undefined);\n });\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n statusMessage={errorMessage}\n dataHook={dataHook}\n >\n <DatePicker\n key={revision}\n ref={(internalRef) => {\n inputRef?.(ref.current);\n const inputEl =\n // @ts-expect-error: WSR internal API hack for focusing\n internalRef?.state?.inputRef as HTMLElement | undefined;\n ref.current.focus = () => inputEl?.focus?.();\n // Let react-hook-form's shouldFocusError scroll to + focus this field\n // when it blocks save.\n controller.field.ref(inputEl ?? null);\n }}\n dataHook={`date-${field.id}`}\n popoverProps={calendarPopoverDefaults}\n width=\"100%\"\n placeholderText={tFields('CMS.formDate.placeholder')}\n value={date}\n onChange={(newValue: Date) => {\n inputError.current = '';\n setErrorMessage('');\n ref.current.invalid = false;\n setDate(newValue);\n const formattedDate = newValue\n ? getISODateStringWithFixedTimezone(newValue)\n : undefined;\n controller.field.onChange(formattedDate?.split('T')[0] ?? null);\n }}\n onValidate={({ validationType, value: newValue, format }) => {\n const error = computeError(newValue, format, validationType);\n inputError.current = error;\n setErrorMessage(error);\n ref.current.invalid = !!error;\n\n if (validationType === 'formatError' && newValue === '') {\n setDate(undefined);\n controller.field.onChange(null);\n } else {\n // Invalid text does not change the stored date, but must revalidate it.\n controller.field.onChange(controller.field.value);\n }\n }}\n status={errorMessage ? 'error' : undefined}\n statusMessage={errorMessage}\n />\n </FormField>\n );\n};\n\nexport const FormDateInput = observer(_FormDateInput);\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAGA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AACA,IAAAQ,yBAAA,GAAAR,OAAA;AACA,IAAAS,UAAA,GAAAT,OAAA;AAGsB,IAAAU,YAAA;AAAA,SAAAX,wBAAAY,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAd,uBAAA,YAAAA,CAAAY,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,c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,cAAc,CAAC","ignoreList":[]}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.useFieldValueReplacement = useFieldValueReplacement;
5
+ var _react = require("react");
6
+ var _form = require("@wix/bex-core/form");
7
+ function useFieldValueReplacement(control, name, onReplace) {
8
+ const callback = (0, _react.useRef)(onReplace);
9
+ callback.current = onReplace;
10
+ // A new key discards the picker's draft even when its saved value is unchanged.
11
+ const [revision, setRevision] = (0, _react.useState)(0);
12
+ (0, _react.useEffect)(() => {
13
+ // Control has no public reset listener. Input edits carry a type; setValue
14
+ // does not. Older RHF releases have a separate values subject.
15
+ const subjects = control._subjects;
16
+ const values = (subjects == null ? void 0 : subjects.values) ?? (subjects == null ? void 0 : subjects.state);
17
+ const array = subjects == null ? void 0 : subjects.array;
18
+ // Reset cleanup is optional; an incompatible RHF version must not crash the field.
19
+ if (typeof (values == null ? void 0 : values.subscribe) !== 'function' || typeof (array == null ? void 0 : array.subscribe) !== 'function') {
20
+ return;
21
+ }
22
+ const subscription = values.subscribe({
23
+ next: update => {
24
+ if (!update.values || !update.name || update.type || update.name !== name && !name.startsWith(`${update.name}.`)) {
25
+ return;
26
+ }
27
+ callback.current((0, _form.get)(update.values, name));
28
+ setRevision(value => value + 1);
29
+ }
30
+ });
31
+ // Reset broadcasts here even for unchanged values. Unlike the state
32
+ // subject, this does not fire when an unrelated field unregisters.
33
+ const resets = array.subscribe({
34
+ next: update => {
35
+ if (!update.name && update.values) {
36
+ callback.current((0, _form.get)(update.values, name));
37
+ setRevision(value => value + 1);
38
+ }
39
+ }
40
+ });
41
+ return () => {
42
+ subscription == null || subscription.unsubscribe == null || subscription.unsubscribe();
43
+ resets == null || resets.unsubscribe == null || resets.unsubscribe();
44
+ };
45
+ }, [control, name]);
46
+ return revision;
47
+ }
48
+ //# sourceMappingURL=use-field-value-replacement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","require","_form","useFieldValueReplacement","control","name","onReplace","callback","useRef","current","revision","setRevision","useState","useEffect","subjects","_subjects","values","state","array","subscribe","subscription","next","update","type","startsWith","get","value","resets","unsubscribe"],"sources":["../../../../src/components/date-input/use-field-value-replacement.ts"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport { get } from '@wix/bex-core/form';\nimport type { Control } from '@wix/bex-core/form';\n\nexport function useFieldValueReplacement(\n control: Control,\n name: string,\n onReplace: (value: unknown) => void,\n) {\n const callback = useRef(onReplace);\n callback.current = onReplace;\n // A new key discards the picker's draft even when its saved value is unchanged.\n const [revision, setRevision] = useState(0);\n\n useEffect(() => {\n // Control has no public reset listener. Input edits carry a type; setValue\n // does not. Older RHF releases have a separate values subject.\n const subjects:\n | (Partial<Control['_subjects']> & {\n values?: Pick<Control['_subjects']['state'], 'subscribe'>;\n })\n | undefined = control._subjects;\n const values = subjects?.values ?? subjects?.state;\n const array = subjects?.array;\n // Reset cleanup is optional; an incompatible RHF version must not crash the field.\n if (\n typeof values?.subscribe !== 'function' ||\n typeof array?.subscribe !== 'function'\n ) {\n return;\n }\n const subscription = values.subscribe({\n next: (update) => {\n if (\n !update.values ||\n !update.name ||\n update.type ||\n (update.name !== name && !name.startsWith(`${update.name}.`))\n ) {\n return;\n }\n callback.current(get(update.values, name));\n setRevision((value) => value + 1);\n },\n });\n // Reset broadcasts here even for unchanged values. Unlike the state\n // subject, this does not fire when an unrelated field unregisters.\n const resets = array.subscribe({\n next: (update) => {\n if (!update.name && update.values) {\n callback.current(get(update.values, name));\n setRevision((value) => value + 1);\n }\n },\n });\n return () => {\n subscription?.unsubscribe?.();\n resets?.unsubscribe?.();\n };\n }, [control, name]);\n\n return revision;\n}\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,KAAA,GAAAD,OAAA;AAGO,SAASE,wBAAwBA,CACtCC,OAAgB,EAChBC,IAAY,EACZC,SAAmC,EACnC;EACA,MAAMC,QAAQ,GAAG,IAAAC,aAAM,EAACF,SAAS,CAAC;EACl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N,MAAM,EAAEX,IAAI,CAAC,CAAC;UAC1CM,WAAW,CAAEe,KAAK,IAAKA,KAAK,GAAG,CAAC,CAAC;QACnC;MACF;IACF,CAAC,CAAC;IACF,OAAO,MAAM;MACXN,YAAY,YAAZA,YAAY,CAAEQ,WAAW,YAAzBR,YAAY,CAAEQ,WAAW,CAAG,CAAC;MAC7BD,MAAM,YAANA,MAAM,CAAEC,WAAW,YAAnBD,MAAM,CAAEC,WAAW,CAAG,CAAC;IACzB,CAAC;EACH,CAAC,EAAE,CAACxB,OAAO,EAAEC,IAAI,CAAC,CAAC;EAEnB,OAAOK,QAAQ;AACjB","ignoreList":[]}
@@ -17,7 +17,10 @@ function FormDateTimeDriver(base, body, field) {
17
17
  dateExists: () => dateBase.exists(),
18
18
  timeExists: () => timeBase.exists(),
19
19
  enterDateText: text => datePicker.inputDriver.enterText(text),
20
+ getDateText: () => datePicker.inputDriver.getValue(),
20
21
  blurDate: () => datePicker.inputDriver.blur(),
22
+ enterTimeText: text => timeInput.setValue(text),
23
+ blurTime: () => timeInput.confirmValue(),
21
24
  dateHasError: () => datePicker.inputDriver.hasStatus('error'),
22
25
  getDateErrorMessage: () => datePicker.inputDriver.getStatusMessage(),
23
26
  timeHasError: () =>
@@ -1 +1 @@
1
- {"version":3,"names":["_unidriver","require","_baseDriver","_popoverDriver","FormDateTimeDriver","base","body","field","formField","FormFieldUniDriver","dateBase","$","id","timeBase","datePicker","DatePickerUniDriver","timeInput","TimeInputUniDriver","baseUniDriverFactory","getLabel","getFormFieldLabelText","dateExists","exists","timeExists","enterDateText","text","inputDriver","enterText","blurDate","blur","dateHasError","hasStatus","getDateErrorMessage","getStatusMessage","timeHasError","getTimeErrorMessage","isRequired","getInputsGap","attr","calendarPopover","CalendarPopoverUniDriver","timeDropdown","TimeDropdownUniDriver"],"sources":["../../../../src/components/datetime-input/form-date-time.driver.ts"],"sourcesContent":["import type { Field } from '@wix/bex-core';\nimport { UniDriver } from '@wix/wix-ui-test-utils/unidriver';\nimport {\n DatePickerUniDriver,\n FormFieldUniDriver,\n TimeInputUniDriver,\n} from '@wix/design-system/dist/testkit/unidriver';\n\nimport {\n baseUniDriverFactory,\n getFormFieldLabelText,\n} from '../../testkit/base-driver';\nimport {\n CalendarPopoverUniDriver,\n TimeDropdownUniDriver,\n} from '../../testkit/popover-driver';\n\nexport function FormDateTimeDriver(\n base: UniDriver,\n body: UniDriver,\n field: Field,\n) {\n const formField = FormFieldUniDriver(base, body);\n const dateBase = base.$(`[data-hook=\"datetime-date-${field.id}\"]`);\n const timeBase = base.$(`[data-hook=\"datetime-time-${field.id}\"]`);\n const datePicker = DatePickerUniDriver(dateBase, body);\n const timeInput = TimeInputUniDriver(timeBase, body);\n\n return {\n ...baseUniDriverFactory(base),\n getLabel: () => getFormFieldLabelText(formField),\n dateExists: () => dateBase.exists(),\n timeExists: () => timeBase.exists(),\n enterDateText: (text: string) => datePicker.inputDriver.enterText(text),\n blurDate: () => datePicker.inputDriver.blur(),\n dateHasError: () => datePicker.inputDriver.hasStatus('error'),\n getDateErrorMessage: () => datePicker.inputDriver.getStatusMessage(),\n timeHasError: () =>\n // WDS TimeInput.uni.driver.d.ts types `hasStatus` as no-arg, but the\n // runtime forwards `status` to Input.hasStatus. See TimeInput.uni.driver.js:43.\n // @ts-expect-error\n timeInput.hasStatus('error'),\n getTimeErrorMessage: () => timeInput.getStatusMessage(),\n isRequired: () => formField.isRequired(),\n // WDS Layout mirrors its `gap` prop onto `data-gap`; it is the only\n // element in this field carrying that attribute.\n getInputsGap: () => base.$('[data-gap]').attr('data-gap'),\n calendarPopover: CalendarPopoverUniDriver(datePicker, body),\n timeDropdown: TimeDropdownUniDriver(timeBase, body),\n };\n}\n"],"mappings":";;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AAMA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,cAAA,GAAAF,OAAA;AAKO,SAASG,kBAAkBA,CAChCC,IAAe,EACfC,IAAe,EACfC,KAAY,EACZ;E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AAY,EAAEA,CAAA,KAAMhC,IAAI,CAACM,CAAC,CAAC,YAAY,CAAC,CAAC2B,IAAI,CAAC,UAAU,CAAC;IACzDC,eAAe,EAAE,IAAAC,uCAAwB,EAAC1B,UAAU,EAAER,IAAI,CAAC;IAC3DmC,YAAY,EAAE,IAAAC,oCAAqB,EAAC7B,QAAQ,EAAEP,IAAI;EACpD,CAAC;AACH","ignoreList":[]}
1
+ {"version":3,"names":["_unidriver","require","_baseDriver","_popoverDriver","FormDateTimeDriver","base","body","field","formField","FormFieldUniDriver","dateBase","$","id","timeBase","datePicker","DatePickerUniDriver","timeInput","TimeInputUniDriver","baseUniDriverFactory","getLabel","getFormFieldLabelText","dateExists","exists","timeExists","enterDateText","text","inputDriver","enterText","getDateText","getValue","blurDate","blur","enterTimeText","setValue","blurTime","confirmValue","dateHasError","hasStatus","getDateErrorMessage","getStatusMessage","timeHasError","getTimeErrorMessage","isRequired","getInputsGap","attr","calendarPopover","CalendarPopoverUniDriver","timeDropdown","TimeDropdownUniDriver"],"sources":["../../../../src/components/datetime-input/form-date-time.driver.ts"],"sourcesContent":["import type { Field } from '@wix/bex-core';\nimport { UniDriver } from '@wix/wix-ui-test-utils/unidriver';\nimport {\n DatePickerUniDriver,\n FormFieldUniDriver,\n TimeInputUniDriver,\n} from '@wix/design-system/dist/testkit/unidriver';\n\nimport {\n baseUniDriverFactory,\n getFormFieldLabelText,\n} from '../../testkit/base-driver';\nimport {\n CalendarPopoverUniDriver,\n TimeDropdownUniDriver,\n} from '../../testkit/popover-driver';\n\nexport function FormDateTimeDriver(\n base: UniDriver,\n body: UniDriver,\n field: Field,\n) {\n const formField = FormFieldUniDriver(base, body);\n const dateBase = base.$(`[data-hook=\"datetime-date-${field.id}\"]`);\n const timeBase = base.$(`[data-hook=\"datetime-time-${field.id}\"]`);\n const datePicker = DatePickerUniDriver(dateBase, body);\n const timeInput = TimeInputUniDriver(timeBase, body);\n\n return {\n ...baseUniDriverFactory(base),\n getLabel: () => getFormFieldLabelText(formField),\n dateExists: () => dateBase.exists(),\n timeExists: () => timeBase.exists(),\n enterDateText: (text: string) => datePicker.inputDriver.enterText(text),\n getDateText: () => datePicker.inputDriver.getValue(),\n blurDate: () => datePicker.inputDriver.blur(),\n enterTimeText: (text: string) => timeInput.setValue(text),\n blurTime: () => timeInput.confirmValue(),\n dateHasError: () => datePicker.inputDriver.hasStatus('error'),\n getDateErrorMessage: () => datePicker.inputDriver.getStatusMessage(),\n timeHasError: () =>\n // WDS TimeInput.uni.driver.d.ts types `hasStatus` as no-arg, but the\n // runtime forwards `status` to Input.hasStatus. See TimeInput.uni.driver.js:43.\n // @ts-expect-error\n timeInput.hasStatus('error'),\n getTimeErrorMessage: () => timeInput.getStatusMessage(),\n isRequired: () => formField.isRequired(),\n // WDS Layout mirrors its `gap` prop onto `data-gap`; it is the only\n // element in this field carrying that attribute.\n getInputsGap: () => base.$('[data-gap]').attr('data-gap'),\n calendarPopover: CalendarPopoverUniDriver(datePicker, body),\n timeDropdown: TimeDropdownUniDriver(timeBase, body),\n };\n}\n"],"mappings":";;;;AAEA,IAAAA,UAAA,GAAAC,OAAA;AAMA,IAAAC,WAAA,GAAAD,OAAA;AAIA,IAAAE,cAAA,GAAAF,OAAA;AAKO,SAASG,kBAAkBA,CAChCC,IAAe,EACfC,IAAe,EACfC,KAAY,EACZ;EACA,MAAMC,SAAS,GAAG,IAAAC,6BAAkB,EAACJ,IAAI,EAAEC,IAAI,CAAC;EAChD,MAAMI,QAAQ,GAAGL,IAAI,CAACM,CAAC,CAAC,6BAA6BJ,KAAK,CAACK,EAAE,IAAI,CAAC;EAClE,MAAMC,QAAQ,GAAGR,IAAI,CAACM,CAAC,CAAC,6BAA6BJ,KAAK,CAACK,EAAE,IAAI,CAAC;EAClE,MAAME,UAAU,GAAG,IAAAC,8BAAmB,EAACL,QAAQ,EAAEJ,IAAI,CAAC;EACtD,MAAMU,SAAS,GAAG,IAAAC,6BAAkB,EAACJ,QAAQ,EAAEP,IAAI,CA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AAAC,oCAAqB,EAACnC,QAAQ,EAAEP,IAAI;EACpD,CAAC;AACH","ignoreList":[]}
@@ -9,11 +9,12 @@ var _react2 = require("@wix/bex-core/react");
9
9
  var _form = require("@wix/bex-core/form");
10
10
  var _hooks = require("../../hooks");
11
11
  var _string = require("../../validations/string");
12
+ var _useFieldValueReplacement = require("../date-input/use-field-value-replacement");
12
13
  var _popoverDefaults = require("../popover-defaults");
13
14
  var _jsxFileName = "/home/builduser/work/843658b9f44192f0/packages/fields/dist/cjs/components/datetime-input/form-date-time.tsx";
14
15
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
15
16
  const _FormDateTime = props => {
16
- var _field$validation2, _controller$fieldStat, _controller$fieldStat2;
17
+ var _field$validation2;
17
18
  const {
18
19
  field,
19
20
  dataHook,
@@ -27,6 +28,10 @@ const _FormDateTime = props => {
27
28
  const {
28
29
  t: tFields
29
30
  } = (0, _hooks.useTranslations)();
31
+ const inputErrors = (0, _react.useRef)({
32
+ date: '',
33
+ time: ''
34
+ });
30
35
  const controller = (0, _form.useController)({
31
36
  name: (field == null ? void 0 : field.id) ?? '',
32
37
  control: formControl,
@@ -34,6 +39,10 @@ const _FormDateTime = props => {
34
39
  rules: {
35
40
  validate: v => {
36
41
  var _field$validation;
42
+ const inputError = inputErrors.current.date || inputErrors.current.time;
43
+ if (inputError) {
44
+ return inputError;
45
+ }
37
46
  if (field != null && (_field$validation = field.validation) != null && _field$validation.required && (0, _string.isEmpty)(v)) {
38
47
  return t('cairo.fieldValidation.requiredField');
39
48
  }
@@ -50,11 +59,30 @@ const _FormDateTime = props => {
50
59
  }, [controller.field.value]);
51
60
  const [dateStatusMessage, setDateStatusMessage] = (0, _react.useState)('');
52
61
  const [timeStatusMessage, setTimeStatusMessage] = (0, _react.useState)('');
62
+ const formError = !dateStatusMessage && !timeStatusMessage ? controller.fieldState.error : undefined;
63
+ const setDateError = error => {
64
+ inputErrors.current.date = error;
65
+ setDateStatusMessage(error);
66
+ };
67
+ const setTimeError = error => {
68
+ inputErrors.current.time = error;
69
+ setTimeStatusMessage(error);
70
+ };
53
71
  const ref = (0, _react.useRef)({});
54
72
  const dateRef = (0, _react.useRef)({});
55
73
  const timeRef = (0, _react.useRef)({});
56
74
  const [dateValue, setDateValue] = (0, _react.useState)(date == null ? void 0 : date.getDate());
57
75
  const [timeValue, setTimeValue] = (0, _react.useState)(date == null ? void 0 : date.getTime());
76
+ const revision = (0, _useFieldValueReplacement.useFieldValueReplacement)(formControl, field.id, value => {
77
+ setDateError('');
78
+ setTimeError('');
79
+ ref.current.invalid = false;
80
+ dateRef.current.invalid = false;
81
+ timeRef.current.invalid = false;
82
+ const nextDate = typeof value === 'string' ? new Date(value) : undefined;
83
+ setDateValue(nextDate == null ? void 0 : nextDate.getDate());
84
+ setTimeValue(nextDate == null ? void 0 : nextDate.getTime());
85
+ });
58
86
  (0, _react.useEffect)(() => {
59
87
  ref.current.focus = () => {
60
88
  if (dateRef.current.invalid) {
@@ -71,7 +99,7 @@ const _FormDateTime = props => {
71
99
  __self: void 0,
72
100
  __source: {
73
101
  fileName: _jsxFileName,
74
- lineNumber: 76,
102
+ lineNumber: 105,
75
103
  columnNumber: 5
76
104
  }
77
105
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Layout, {
@@ -79,7 +107,7 @@ const _FormDateTime = props => {
79
107
  __self: void 0,
80
108
  __source: {
81
109
  fileName: _jsxFileName,
82
- lineNumber: 81,
110
+ lineNumber: 110,
83
111
  columnNumber: 7
84
112
  }
85
113
  }, /*#__PURE__*/_react.default.createElement(_designSystem.Cell, {
@@ -87,10 +115,11 @@ const _FormDateTime = props => {
87
115
  __self: void 0,
88
116
  __source: {
89
117
  fileName: _jsxFileName,
90
- lineNumber: 82,
118
+ lineNumber: 111,
91
119
  columnNumber: 9
92
120
  }
93
121
  }, /*#__PURE__*/_react.default.createElement(_designSystem.DatePicker, {
122
+ key: revision,
94
123
  ref: internalRef => {
95
124
  var _internalRef$state;
96
125
  const inputEl = // TODO: PR to WSR needed to expose as public API
@@ -114,45 +143,47 @@ const _FormDateTime = props => {
114
143
  value: newValue,
115
144
  format
116
145
  }) => {
146
+ let value = controller.field.value;
117
147
  if (validationType === 'valid') {
118
148
  const dateWithNewDate = date ? new Date(date) : new Date(newValue);
119
149
  const _value = new Date(newValue);
120
150
  dateWithNewDate.setFullYear(_value.getFullYear());
121
151
  dateWithNewDate.setMonth(_value.getMonth());
122
152
  dateWithNewDate.setDate(_value.getDate());
123
- controller.field.onChange(dateWithNewDate.toISOString());
153
+ value = dateWithNewDate.toISOString();
124
154
  setDateValue(new Date(newValue).getDate());
125
- setDateStatusMessage('');
155
+ setDateError('');
126
156
  dateRef.current.invalid = false;
127
157
  } else if (validationType === 'formatError' && newValue === '') {
128
158
  var _field$validation3;
129
159
  if ((_field$validation3 = field.validation) != null && _field$validation3.required) {
130
- setDateStatusMessage(t('cairo.fieldValidation.requiredField'));
160
+ setDateError(t('cairo.fieldValidation.requiredField'));
131
161
  dateRef.current.invalid = true;
132
162
  } else {
133
- setDateStatusMessage('');
163
+ setDateError('');
134
164
  dateRef.current.invalid = false;
135
165
  }
136
166
  setDateValue(newValue);
137
167
  if (!timeValue) {
138
- controller.field.onChange(null);
168
+ value = null;
139
169
  }
140
170
  } else {
141
- setDateStatusMessage(t('cairo.customFields.fieldType.date.invalid.value', {
171
+ setDateError(t('cairo.customFields.fieldType.date.invalid.value', {
142
172
  dateFormat: format ?? ''
143
173
  }));
144
174
  dateRef.current.invalid = true;
145
175
  }
146
176
  ref.current.invalid = dateRef.current.invalid || timeRef.current.invalid;
177
+ controller.field.onChange(value);
147
178
  },
148
- status: controller.fieldState.error || dateStatusMessage ? 'error' : undefined,
149
- statusMessage: ((_controller$fieldStat = controller.fieldState.error) == null ? void 0 : _controller$fieldStat.message) || dateStatusMessage,
179
+ status: dateStatusMessage || formError ? 'error' : undefined,
180
+ statusMessage: dateStatusMessage || (formError == null ? void 0 : formError.message),
150
181
  dataHook: `datetime-date-${field.id}`,
151
182
  popoverProps: _popoverDefaults.calendarPopoverDefaults,
152
183
  __self: void 0,
153
184
  __source: {
154
185
  fileName: _jsxFileName,
155
- lineNumber: 83,
186
+ lineNumber: 112,
156
187
  columnNumber: 11
157
188
  }
158
189
  })), /*#__PURE__*/_react.default.createElement(_designSystem.Cell, {
@@ -160,10 +191,11 @@ const _FormDateTime = props => {
160
191
  __self: void 0,
161
192
  __source: {
162
193
  fileName: _jsxFileName,
163
- lineNumber: 152,
194
+ lineNumber: 176,
164
195
  columnNumber: 9
165
196
  }
166
197
  }, /*#__PURE__*/_react.default.createElement(_designSystem.TimeInput, {
198
+ key: revision,
167
199
  ref: internalRef => {
168
200
  timeRef.current.focus = () => internalRef == null ? void 0 : internalRef.focus();
169
201
  },
@@ -172,16 +204,18 @@ const _FormDateTime = props => {
172
204
  placeholder: tFields('CMS.formTime.placeholder'),
173
205
  invalidMessage: tFields('CMS.formTime.invalidMessage'),
174
206
  value: date ?? null,
175
- status: controller.fieldState.error || timeStatusMessage ? 'error' : undefined,
176
- statusMessage: ((_controller$fieldStat2 = controller.fieldState.error) == null ? void 0 : _controller$fieldStat2.message) || timeStatusMessage,
207
+ status: timeStatusMessage || formError ? 'error' : undefined,
208
+ statusMessage: timeStatusMessage || (formError == null ? void 0 : formError.message),
177
209
  onInvalid: () => {
178
210
  timeRef.current.invalid = true;
179
- setTimeStatusMessage(t('cairo.customFields.fieldType.dateAndTime.invalid.value'));
211
+ setTimeError(t('cairo.customFields.fieldType.dateAndTime.invalid.value'));
180
212
  ref.current.invalid = dateRef.current.invalid || timeRef.current.invalid;
213
+ controller.field.onChange(controller.field.value);
181
214
  },
182
215
  onChange: ({
183
216
  date: newValue
184
217
  }) => {
218
+ let value = controller.field.value;
185
219
  timeRef.current.invalid = false;
186
220
  ref.current.invalid = dateRef.current.invalid || timeRef.current.invalid;
187
221
  if (newValue) {
@@ -190,32 +224,35 @@ const _FormDateTime = props => {
190
224
  dateWithNewTime.setMinutes(newValue.getMinutes());
191
225
  dateWithNewTime.setSeconds(newValue.getSeconds());
192
226
  dateWithNewTime.setMilliseconds(newValue.getMilliseconds());
193
- controller.field.onChange(dateWithNewTime.toISOString());
194
- setTimeStatusMessage('');
195
- setDateStatusMessage('');
227
+ value = dateWithNewTime.toISOString();
228
+ setTimeError('');
229
+ if (!dateRef.current.invalid) {
230
+ setDateError('');
231
+ }
196
232
  } else {
197
233
  if (!newValue) {
198
234
  var _field$validation4;
199
235
  setTimeValue('');
200
236
  if ((_field$validation4 = field.validation) != null && _field$validation4.required) {
201
- setTimeStatusMessage(t('cairo.fieldValidation.requiredField'));
237
+ setTimeError(t('cairo.fieldValidation.requiredField'));
202
238
  timeRef.current.invalid = true;
203
239
  } else {
204
- setTimeStatusMessage('');
240
+ setTimeError('');
205
241
  timeRef.current.invalid = false;
206
242
  }
207
243
  if (!ref.current.invalid) {
208
244
  if (!dateValue) {
209
- controller.field.onChange(null);
245
+ value = null;
210
246
  }
211
247
  }
212
248
  }
213
249
  }
250
+ controller.field.onChange(value);
214
251
  },
215
252
  __self: void 0,
216
253
  __source: {
217
254
  fileName: _jsxFileName,
218
- lineNumber: 153,
255
+ lineNumber: 177,
219
256
  columnNumber: 11
220
257
  }
221
258
  }))));
@@ -1 +1 @@
1
- {"version":3,"names":["_react","_interopRequireWildcard","require","_designSystem","_mobxReactLite","_react2","_form","_hooks","_string","_popoverDefaults","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_FormDateTime","props","_field$validation2","_controller$fieldStat","_controller$fieldStat2","field","dataHook","inputRef","formControl","data","translate","useWixPatternsContainer","tFields","useTranslations","controller","useController","name","id","control","defaultValue","rules","validate","v","_field$validation","validation","required","isEmpty","date","useMemo","value","undefined","d","Date","isNaN","getTime","dateStatusMessage","setDateStatusMessage","useState","timeStatusMessage","setTimeStatusMessage","ref","useRef","dateRef","timeRef","dateValue","setDateValue","getDate","timeValue","setTimeValue","useEffect","current","focus","invalid","createElement","FormField","label","displayName","__self","__source","fileName","lineNumber","columnNumber","Layout","gap","Cell","span","DatePicker","internalRef","_internalRef$state","inputEl","state","width","placeholderText","onChange","onValidate","validationType","newValue","format","dateWithNewDate","_value","setFullYear","getFullYear","setMonth","getMonth","setDate","toISOString","_field$validation3","dateFormat","status","fieldState","error","statusMessage","message","popoverProps","calendarPopoverDefaults","TimeInput","dropdownPopoverDefaults","placeholder","invalidMessage","onInvalid","dateWithNewTime","setHours","getHours","setMinutes","getMinutes","setSeconds","getSeconds","setMilliseconds","getMilliseconds","_field$validation4","FormDateTime","exports","observer"],"sources":["../../../../src/components/datetime-input/form-date-time.tsx"],"sourcesContent":["import React, { useRef, useMemo, useState, useEffect } from 'react';\nimport {\n Cell,\n DatePicker,\n FormField,\n Layout,\n TimeInput,\n} from '@wix/design-system';\nimport { observer } from 'mobx-react-lite';\nimport { useWixPatternsContainer } from '@wix/bex-core/react';\nimport { useController } from '@wix/bex-core/form';\n\nimport { BaseInputProps, BaseInputRef } from '../../types/base-input';\nimport { useTranslations } from '../../hooks';\nimport { isEmpty } from '../../validations/string';\nimport {\n calendarPopoverDefaults,\n dropdownPopoverDefaults,\n} from '../popover-defaults';\n\nexport interface FormDateTimeProps extends BaseInputProps<string | null> {}\n\nconst _FormDateTime = (props: FormDateTimeProps) => {\n const { field, dataHook, inputRef, formControl, data } = props;\n const { translate: t } = useWixPatternsContainer();\n const { t: tFields } = useTranslations();\n\n const controller = useController({\n name: field?.id ?? '',\n control: formControl,\n defaultValue: data?.[field?.id ?? ''],\n rules: {\n validate: (v) => {\n if (field?.validation?.required && isEmpty(v)) {\n return t('cairo.fieldValidation.requiredField');\n }\n return true;\n },\n },\n });\n\n const date = useMemo(() => {\n if (!controller.field.value) {\n return undefined;\n }\n const d = new Date(controller.field.value);\n return isNaN(d.getTime()) ? undefined : d;\n }, [controller.field.value]);\n\n const [dateStatusMessage, setDateStatusMessage] = useState('');\n const [timeStatusMessage, setTimeStatusMessage] = useState('');\n\n const ref = useRef<BaseInputRef>({});\n const dateRef = useRef<BaseInputRef>({});\n const timeRef = useRef<BaseInputRef>({});\n const [dateValue, setDateValue] = useState<number | string | undefined>(\n date?.getDate(),\n );\n const [timeValue, setTimeValue] = useState<number | string | undefined>(\n date?.getTime(),\n );\n\n useEffect(() => {\n ref.current.focus = () => {\n if (dateRef.current.invalid) {\n return dateRef.current.focus?.();\n }\n\n return timeRef.current.focus?.();\n };\n\n inputRef?.(ref.current);\n }, [inputRef]);\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n dataHook={dataHook}\n >\n <Layout gap=\"12px\">\n <Cell span={6}>\n <DatePicker\n ref={(internalRef) => {\n const inputEl =\n // TODO: PR to WSR needed to expose as public API\n // @ts-expect-error internal API\n internalRef?.state?.inputRef as HTMLElement | undefined;\n dateRef.current.focus = () => inputEl?.focus?.();\n // Hand the date input to react-hook-form so shouldFocusError can\n // scroll to and focus this field when it blocks save (the\n // composite date/time inputs have no single ref to pass directly).\n controller.field.ref(inputEl ?? null);\n }}\n width=\"100%\"\n placeholderText={tFields('CMS.formDate.placeholder')}\n value={date}\n onChange={() => {}}\n // onChange is triggered only when you have valid, non-empty value.\n // and onValidate is triggered on every change so we use onValidate\n onValidate={({ validationType, value: newValue, format }) => {\n if (validationType === 'valid') {\n const dateWithNewDate = date\n ? new Date(date)\n : new Date(newValue);\n const _value = new Date(newValue);\n dateWithNewDate.setFullYear(_value.getFullYear());\n dateWithNewDate.setMonth(_value.getMonth());\n dateWithNewDate.setDate(_value.getDate());\n controller.field.onChange(dateWithNewDate.toISOString());\n setDateValue(new Date(newValue).getDate());\n setDateStatusMessage('');\n dateRef.current.invalid = false;\n } else if (validationType === 'formatError' && newValue === '') {\n if (field.validation?.required) {\n setDateStatusMessage(\n t('cairo.fieldValidation.requiredField'),\n );\n dateRef.current.invalid = true;\n } else {\n setDateStatusMessage('');\n dateRef.current.invalid = false;\n }\n setDateValue(newValue);\n if (!timeValue) {\n controller.field.onChange(null);\n }\n } else {\n setDateStatusMessage(\n t('cairo.customFields.fieldType.date.invalid.value', {\n dateFormat: format ?? '',\n }),\n );\n dateRef.current.invalid = true;\n }\n\n ref.current.invalid =\n dateRef.current.invalid || timeRef.current.invalid;\n }}\n status={\n controller.fieldState.error || dateStatusMessage\n ? 'error'\n : undefined\n }\n statusMessage={\n controller.fieldState.error?.message || dateStatusMessage\n }\n dataHook={`datetime-date-${field.id}`}\n popoverProps={calendarPopoverDefaults}\n />\n </Cell>\n <Cell span={6}>\n <TimeInput\n ref={(internalRef) => {\n timeRef.current.focus = () => internalRef?.focus();\n }}\n dataHook={`datetime-time-${field.id}`}\n popoverProps={dropdownPopoverDefaults}\n placeholder={tFields('CMS.formTime.placeholder')}\n invalidMessage={tFields('CMS.formTime.invalidMessage')}\n value={date ?? null}\n status={\n controller.fieldState.error || timeStatusMessage\n ? 'error'\n : undefined\n }\n statusMessage={\n controller.fieldState.error?.message || timeStatusMessage\n }\n onInvalid={() => {\n timeRef.current.invalid = true;\n setTimeStatusMessage(\n t('cairo.customFields.fieldType.dateAndTime.invalid.value'),\n );\n ref.current.invalid =\n dateRef.current.invalid || timeRef.current.invalid;\n }}\n onChange={({ date: newValue }) => {\n timeRef.current.invalid = false;\n ref.current.invalid =\n dateRef.current.invalid || timeRef.current.invalid;\n\n if (newValue) {\n const dateWithNewTime = date ? new Date(date) : newValue;\n dateWithNewTime.setHours(newValue.getHours());\n dateWithNewTime.setMinutes(newValue.getMinutes());\n dateWithNewTime.setSeconds(newValue.getSeconds());\n dateWithNewTime.setMilliseconds(newValue.getMilliseconds());\n controller.field.onChange(dateWithNewTime.toISOString());\n setTimeStatusMessage('');\n setDateStatusMessage('');\n } else {\n if (!newValue) {\n setTimeValue('');\n if (field.validation?.required) {\n setTimeStatusMessage(\n t('cairo.fieldValidation.requiredField'),\n );\n timeRef.current.invalid = true;\n } else {\n setTimeStatusMessage('');\n timeRef.current.invalid = false;\n }\n if (!ref.current.invalid) {\n if (!dateValue) {\n controller.field.onChange(null);\n }\n }\n }\n }\n }}\n />\n </Cell>\n </Layout>\n </FormField>\n );\n};\n\nexport const FormDateTime = observer(_FormDateTime);\n"],"mappings":";;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAOA,IAAAE,cAAA,GAAAF,OAAA;AACA,IAAAG,OAAA,GAAAH,OAAA;AACA,IAAAI,KAAA,GAAAJ,OAAA;AAGA,IAAAK,MAAA,GAAAL,OAAA;AACA,IAAAM,OAAA,GAAAN,OAAA;AACA,IAAAO,gBAAA,GAAAP,OAAA;AAG6B,IAAAQ,YAAA;AAAA,SAAAT,wBAAAU,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAZ,uBAAA,YAAAA,CAAAU,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CA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AAE;IAAAhB,MAAA;IAAAC,QAAA;MAAAC,QAAA,EAAA/E,YAAA;MAAAgF,UAAA;MAAAC,YAAA;IAAA;EAAA,CACH,CACG,CACA,CACC,CAAC;AAEhB,CAAC;AAEM,MAAMiD,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,IAAAE,uBAAQ,EAAChH,aAAa,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_designSystem","_mobxReactLite","_react2","_form","_hooks","_string","_useFieldValueReplacement","_popoverDefaults","_jsxFileName","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_FormDateTime","props","_field$validation2","field","dataHook","inputRef","formControl","data","translate","useWixPatternsContainer","tFields","useTranslations","inputErrors","useRef","date","time","controller","useController","name","id","control","defaultValue","rules","validate","v","_field$validation","inputError","current","validation","required","isEmpty","useMemo","value","undefined","d","Date","isNaN","getTime","dateStatusMessage","setDateStatusMessage","useState","timeStatusMessage","setTimeStatusMessage","formError","fieldState","error","setDateError","setTimeError","ref","dateRef","timeRef","dateValue","setDateValue","getDate","timeValue","setTimeValue","revision","useFieldValueReplacement","invalid","nextDate","useEffect","focus","createElement","FormField","label","displayName","__self","__source","fileName","lineNumber","columnNumber","Layout","gap","Cell","span","DatePicker","key","internalRef","_internalRef$state","inputEl","state","width","placeholderText","onChange","onValidate","validationType","newValue","format","dateWithNewDate","_value","setFullYear","getFullYear","setMonth","getMonth","setDate","toISOString","_field$validation3","dateFormat","status","statusMessage","message","popoverProps","calendarPopoverDefaults","TimeInput","dropdownPopoverDefaults","placeholder","invalidMessage","onInvalid","dateWithNewTime","setHours","getHours","setMinutes","getMinutes","setSeconds","getSeconds","setMilliseconds","getMilliseconds","_field$validation4","FormDateTime","exports","observer"],"sources":["../../../../src/components/datetime-input/form-date-time.tsx"],"sourcesContent":["import React, { useRef, useMemo, useState, useEffect } from 'react';\nimport {\n Cell,\n DatePicker,\n FormField,\n Layout,\n TimeInput,\n} from '@wix/design-system';\nimport { observer } from 'mobx-react-lite';\nimport { useWixPatternsContainer } from '@wix/bex-core/react';\nimport { useController } from '@wix/bex-core/form';\n\nimport { BaseInputProps, BaseInputRef } from '../../types/base-input';\nimport { useTranslations } from '../../hooks';\nimport { isEmpty } from '../../validations/string';\nimport { useFieldValueReplacement } from '../date-input/use-field-value-replacement';\nimport {\n calendarPopoverDefaults,\n dropdownPopoverDefaults,\n} from '../popover-defaults';\n\nexport interface FormDateTimeProps extends BaseInputProps<string | null> {}\n\nconst _FormDateTime = (props: FormDateTimeProps) => {\n const { field, dataHook, inputRef, formControl, data } = props;\n const { translate: t } = useWixPatternsContainer();\n const { t: tFields } = useTranslations();\n const inputErrors = useRef({ date: '', time: '' });\n\n const controller = useController({\n name: field?.id ?? '',\n control: formControl,\n defaultValue: data?.[field?.id ?? ''],\n rules: {\n validate: (v) => {\n const inputError = inputErrors.current.date || inputErrors.current.time;\n if (inputError) {\n return inputError;\n }\n if (field?.validation?.required && isEmpty(v)) {\n return t('cairo.fieldValidation.requiredField');\n }\n return true;\n },\n },\n });\n\n const date = useMemo(() => {\n if (!controller.field.value) {\n return undefined;\n }\n const d = new Date(controller.field.value);\n return isNaN(d.getTime()) ? undefined : d;\n }, [controller.field.value]);\n\n const [dateStatusMessage, setDateStatusMessage] = useState('');\n const [timeStatusMessage, setTimeStatusMessage] = useState('');\n const formError =\n !dateStatusMessage && !timeStatusMessage\n ? controller.fieldState.error\n : undefined;\n\n const setDateError = (error: string) => {\n inputErrors.current.date = error;\n setDateStatusMessage(error);\n };\n const setTimeError = (error: string) => {\n inputErrors.current.time = error;\n setTimeStatusMessage(error);\n };\n\n const ref = useRef<BaseInputRef>({});\n const dateRef = useRef<BaseInputRef>({});\n const timeRef = useRef<BaseInputRef>({});\n const [dateValue, setDateValue] = useState<number | string | undefined>(\n date?.getDate(),\n );\n const [timeValue, setTimeValue] = useState<number | string | undefined>(\n date?.getTime(),\n );\n const revision = useFieldValueReplacement(formControl, field.id, (value) => {\n setDateError('');\n setTimeError('');\n ref.current.invalid = false;\n dateRef.current.invalid = false;\n timeRef.current.invalid = false;\n const nextDate = typeof value === 'string' ? new Date(value) : undefined;\n setDateValue(nextDate?.getDate());\n setTimeValue(nextDate?.getTime());\n });\n\n useEffect(() => {\n ref.current.focus = () => {\n if (dateRef.current.invalid) {\n return dateRef.current.focus?.();\n }\n\n return timeRef.current.focus?.();\n };\n\n inputRef?.(ref.current);\n }, [inputRef]);\n\n return (\n <FormField\n label={field.displayName}\n required={field.validation?.required}\n dataHook={dataHook}\n >\n <Layout gap=\"12px\">\n <Cell span={6}>\n <DatePicker\n key={revision}\n ref={(internalRef) => {\n const inputEl =\n // TODO: PR to WSR needed to expose as public API\n // @ts-expect-error internal API\n internalRef?.state?.inputRef as HTMLElement | undefined;\n dateRef.current.focus = () => inputEl?.focus?.();\n // Hand the date input to react-hook-form so shouldFocusError can\n // scroll to and focus this field when it blocks save (the\n // composite date/time inputs have no single ref to pass directly).\n controller.field.ref(inputEl ?? null);\n }}\n width=\"100%\"\n placeholderText={tFields('CMS.formDate.placeholder')}\n value={date}\n onChange={() => {}}\n // onChange is triggered only when you have valid, non-empty value.\n // and onValidate is triggered on every change so we use onValidate\n onValidate={({ validationType, value: newValue, format }) => {\n let value = controller.field.value;\n if (validationType === 'valid') {\n const dateWithNewDate = date\n ? new Date(date)\n : new Date(newValue);\n const _value = new Date(newValue);\n dateWithNewDate.setFullYear(_value.getFullYear());\n dateWithNewDate.setMonth(_value.getMonth());\n dateWithNewDate.setDate(_value.getDate());\n value = dateWithNewDate.toISOString();\n setDateValue(new Date(newValue).getDate());\n setDateError('');\n dateRef.current.invalid = false;\n } else if (validationType === 'formatError' && newValue === '') {\n if (field.validation?.required) {\n setDateError(t('cairo.fieldValidation.requiredField'));\n dateRef.current.invalid = true;\n } else {\n setDateError('');\n dateRef.current.invalid = false;\n }\n setDateValue(newValue);\n if (!timeValue) {\n value = null;\n }\n } else {\n setDateError(\n t('cairo.customFields.fieldType.date.invalid.value', {\n dateFormat: format ?? '',\n }),\n );\n dateRef.current.invalid = true;\n }\n\n ref.current.invalid =\n dateRef.current.invalid || timeRef.current.invalid;\n controller.field.onChange(value);\n }}\n status={dateStatusMessage || formError ? 'error' : undefined}\n statusMessage={dateStatusMessage || formError?.message}\n dataHook={`datetime-date-${field.id}`}\n popoverProps={calendarPopoverDefaults}\n />\n </Cell>\n <Cell span={6}>\n <TimeInput\n key={revision}\n ref={(internalRef) => {\n timeRef.current.focus = () => internalRef?.focus();\n }}\n dataHook={`datetime-time-${field.id}`}\n popoverProps={dropdownPopoverDefaults}\n placeholder={tFields('CMS.formTime.placeholder')}\n invalidMessage={tFields('CMS.formTime.invalidMessage')}\n value={date ?? null}\n status={timeStatusMessage || formError ? 'error' : undefined}\n statusMessage={timeStatusMessage || formError?.message}\n onInvalid={() => {\n timeRef.current.invalid = true;\n setTimeError(\n t('cairo.customFields.fieldType.dateAndTime.invalid.value'),\n );\n ref.current.invalid =\n dateRef.current.invalid || timeRef.current.invalid;\n controller.field.onChange(controller.field.value);\n }}\n onChange={({ date: newValue }) => {\n let value = controller.field.value;\n timeRef.current.invalid = false;\n ref.current.invalid =\n dateRef.current.invalid || timeRef.current.invalid;\n\n if (newValue) {\n const dateWithNewTime = date ? new Date(date) : newValue;\n dateWithNewTime.setHours(newValue.getHours());\n dateWithNewTime.setMinutes(newValue.getMinutes());\n dateWithNewTime.setSeconds(newValue.getSeconds());\n dateWithNewTime.setMilliseconds(newValue.getMilliseconds());\n value = dateWithNewTime.toISOString();\n setTimeError('');\n if (!dateRef.current.invalid) {\n setDateError('');\n }\n } else {\n if (!newValue) {\n setTimeValue('');\n if (field.validation?.required) {\n setTimeError(t('cairo.fieldValidation.requiredField'));\n timeRef.current.invalid = true;\n } else {\n setTimeError('');\n timeRef.current.invalid = false;\n }\n if (!ref.current.invalid) {\n if (!dateValue) {\n value = null;\n }\n }\n }\n }\n controller.field.onChange(value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IAAA;EAAA,CACH,CACG,CACA,CACC,CAAC;AAEhB,CAAC;AAEM,MAAMgD,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,IAAAE,uBAAQ,EAACxH,aAAa,CAAC","ignoreList":[]}
@@ -5,15 +5,15 @@ exports.vars = exports.style = exports.stVars = exports.st = exports.namespace =
5
5
  var _stylableEsmRuntime = require("../../stylable-esm-runtime.js");
6
6
  // @ts-nocheck
7
7
 
8
- var _namespace_ = "deletedialog744307190";
8
+ var _namespace_ = "deletedialog2793524866";
9
9
  var _style_ = _stylableEsmRuntime.classesRuntime.bind(null, _namespace_);
10
10
  var cssStates = exports.cssStates = _stylableEsmRuntime.statesRuntime.bind(null, _namespace_);
11
11
  var style = exports.style = _style_;
12
12
  var st = exports.st = _style_;
13
13
  var namespace = exports.namespace = _namespace_;
14
14
  var classes = exports.classes = {
15
- "root": "deletedialog744307190__root",
16
- "layout": "deletedialog744307190__layout"
15
+ "root": "deletedialog2793524866__root",
16
+ "layout": "deletedialog2793524866__layout"
17
17
  };
18
18
  var keyframes = exports.keyframes = {};
19
19
  var layers = exports.layers = {};
@@ -1 +1 @@
1
- {"version":3,"names":["_stylableEsmRuntime","require","_namespace_","_style_","classesRuntime","bind","cssStates","exports","statesRuntime","style","st","namespace","classes","keyframes","layers","containers","stVars","vars"],"sources":["../../../../src/components/delete-dialog/delete-dialog.st.css.ts"],"sourcesContent":["// @ts-nocheck\n\n\nimport { classesRuntime, statesRuntime } from \"../../stylable-esm-runtime.js\";\n\n\n\nvar _namespace_ = \"deletedialog744307190\";\nvar _style_ = classesRuntime.bind(null, _namespace_);\n\nexport var cssStates = statesRuntime.bind(null, _namespace_);\nexport var style: import(\"@stylable/runtime\").STFunction = _style_;\nexport var st: import(\"@stylable/runtime\").STFunction = _style_;\n\nexport var namespace = _namespace_;\nexport var classes = {\"root\":\"deletedialog744307190__root\",\"layout\":\"deletedialog744307190__layout\"};\nexport var keyframes = {}; \nexport var layers = {};\nexport var containers = {};\nexport var stVars = {}; \nexport var vars = {}; \n\n\n\n\n"],"mappings":";;;;AAGA,IAAAA,mBAAA,GAAAC,OAAA;AAHA;;AAOA,IAAIC,WAAW,GAAG,uBAAuB;AACzC,IAAIC,OAAO,GAAGC,kCAAc,CAACC,IAAI,CAAC,IAAI,EAAEH,WAAW,CAAC;AAE7C,IAAII,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAGE,iCAAa,CAACH,IAAI,CAAC,IAAI,EAAEH,WAAW,CAAC;AACrD,IAAIO,KAA6C,GAAAF,OAAA,CAAAE,KAAA,GAAGN,OAAO;AAC3D,IAAIO,EAA0C,GAAAH,OAAA,CAAAG,EAAA,GAAGP,OAAO;AAExD,IAAIQ,SAAS,GAAAJ,OAAA,CAAAI,SAAA,GAAGT,WAAW;AAC3B,IAAIU,OAAO,GAAAL,OAAA,CAAAK,OAAA,GAAG;EAAC,MAAM,EAAC,6BAA6B;EAAC,QAAQ,EAAC;AAA+B,CAAC;AAC7F,IAAIC,SAAS,GAAAN,OAAA,CAAAM,SAAA,GAAG,CAAC,CAAC;AAClB,IAAIC,MAAM,GAAAP,OAAA,CAAAO,MAAA,GAAG,CAAC,CAAC;AACf,IAAIC,UAAU,GAAAR,OAAA,CAAAQ,UAAA,GAAG,CAAC,CAAC;AACnB,IAAIC,MAAM,GAAAT,OAAA,CAAAS,MAAA,GAAG,CAAC,CAAC;AACf,IAAIC,IAAI,GAAAV,OAAA,CAAAU,IAAA,GAAG,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_stylableEsmRuntime","require","_namespace_","_style_","classesRuntime","bind","cssStates","exports","statesRuntime","style","st","namespace","classes","keyframes","layers","containers","stVars","vars"],"sources":["../../../../src/components/delete-dialog/delete-dialog.st.css.ts"],"sourcesContent":["// @ts-nocheck\n\n\nimport { classesRuntime, statesRuntime } from \"../../stylable-esm-runtime.js\";\n\n\n\nvar _namespace_ = \"deletedialog2793524866\";\nvar _style_ = classesRuntime.bind(null, _namespace_);\n\nexport var cssStates = statesRuntime.bind(null, _namespace_);\nexport var style: import(\"@stylable/runtime\").STFunction = _style_;\nexport var st: import(\"@stylable/runtime\").STFunction = _style_;\n\nexport var namespace = _namespace_;\nexport var classes = {\"root\":\"deletedialog2793524866__root\",\"layout\":\"deletedialog2793524866__layout\"};\nexport var keyframes = {}; \nexport var layers = {};\nexport var containers = {};\nexport var stVars = {}; \nexport var vars = {}; \n\n\n\n\n"],"mappings":";;;;AAGA,IAAAA,mBAAA,GAAAC,OAAA;AAHA;;AAOA,IAAIC,WAAW,GAAG,wBAAwB;AAC1C,IAAIC,OAAO,GAAGC,kCAAc,CAACC,IAAI,CAAC,IAAI,EAAEH,WAAW,CAAC;AAE7C,IAAII,SAAS,GAAAC,OAAA,CAAAD,SAAA,GAAGE,iCAAa,CAACH,IAAI,CAAC,IAAI,EAAEH,WAAW,CAAC;AACrD,IAAIO,KAA6C,GAAAF,OAAA,CAAAE,KAAA,GAAGN,OAAO;AAC3D,IAAIO,EAA0C,GAAAH,OAAA,CAAAG,EAAA,GAAGP,OAAO;AAExD,IAAIQ,SAAS,GAAAJ,OAAA,CAAAI,SAAA,GAAGT,WAAW;AAC3B,IAAIU,OAAO,GAAAL,OAAA,CAAAK,OAAA,GAAG;EAAC,MAAM,EAAC,8BAA8B;EAAC,QAAQ,EAAC;AAAgC,CAAC;AAC/F,IAAIC,SAAS,GAAAN,OAAA,CAAAM,SAAA,GAAG,CAAC,CAAC;AAClB,IAAIC,MAAM,GAAAP,OAAA,CAAAO,MAAA,GAAG,CAAC,CAAC;AACf,IAAIC,UAAU,GAAAR,OAAA,CAAAQ,UAAA,GAAG,CAAC,CAAC;AACnB,IAAIC,MAAM,GAAAT,OAAA,CAAAS,MAAA,GAAG,CAAC,CAAC;AACf,IAAIC,IAAI,GAAAV,OAAA,CAAAU,IAAA,GAAG,CAAC,CAAC","ignoreList":[]}