@wix/patterns-fields 1.95.0 → 1.97.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.
- package/dist/cjs/components/address/input/address-input.js +127 -36
- package/dist/cjs/components/address/input/address-input.js.map +1 -1
- package/dist/cjs/components/address/input/address-input.st.css.js +3 -3
- package/dist/cjs/components/address/input/address-input.st.css.js.map +1 -1
- package/dist/cjs/components/audio/actions/actions-menu/actions-menu.st.css.js +3 -3
- package/dist/cjs/components/audio/actions/actions-menu/actions-menu.st.css.js.map +1 -1
- package/dist/cjs/components/audio/audio-field/controlled-audio.uni.driver.js +3 -2
- package/dist/cjs/components/audio/audio-field/controlled-audio.uni.driver.js.map +1 -1
- package/dist/cjs/components/audio/audio-field/form-audio-field.js +55 -48
- package/dist/cjs/components/audio/audio-field/form-audio-field.js.map +1 -1
- package/dist/cjs/components/audio/audio-field/form-audio-field.st.css.js +4 -4
- package/dist/cjs/components/audio/audio-field/form-audio-field.st.css.js.map +1 -1
- package/dist/cjs/components/audio/audio-player/audio-player.st.css.js +2 -2
- package/dist/cjs/components/audio/audio-player/audio-player.st.css.js.map +1 -1
- package/dist/cjs/components/color-view/cell-color-view.st.css.js +3 -3
- package/dist/cjs/components/color-view/cell-color-view.st.css.js.map +1 -1
- package/dist/cjs/components/color-view/color-view.st.css.js +4 -4
- package/dist/cjs/components/color-view/color-view.st.css.js.map +1 -1
- package/dist/cjs/components/delete-dialog/delete-dialog.st.css.js +3 -3
- package/dist/cjs/components/delete-dialog/delete-dialog.st.css.js.map +1 -1
- package/dist/cjs/components/document/form-document-field.st.css.js +7 -7
- package/dist/cjs/components/document/form-document-field.st.css.js.map +1 -1
- package/dist/cjs/components/exclamation/exclamation.st.css.js +5 -5
- package/dist/cjs/components/exclamation/exclamation.st.css.js.map +1 -1
- package/dist/cjs/components/field-validation-settings/field-validation-settings-input.js +85 -49
- package/dist/cjs/components/field-validation-settings/field-validation-settings-input.js.map +1 -1
- package/dist/cjs/components/field-validation-settings/field-validation-settings.uni.driver.js +2 -1
- package/dist/cjs/components/field-validation-settings/field-validation-settings.uni.driver.js.map +1 -1
- package/dist/cjs/components/highlighted-text/highlighted-text.st.css.js +5 -5
- package/dist/cjs/components/highlighted-text/highlighted-text.st.css.js.map +1 -1
- package/dist/cjs/components/image/thumbnail-replace-overlay.st.css.js +3 -3
- package/dist/cjs/components/image/thumbnail-replace-overlay.st.css.js.map +1 -1
- package/dist/cjs/components/media-control/cell-media-edit-shell.st.css.js +2 -2
- package/dist/cjs/components/media-control/cell-media-edit-shell.st.css.js.map +1 -1
- package/dist/cjs/components/media-control/paste-url-button.st.css.js +4 -4
- package/dist/cjs/components/media-control/paste-url-button.st.css.js.map +1 -1
- package/dist/cjs/components/media-gallery/form-media-gallery-field.st.css.js +10 -10
- package/dist/cjs/components/media-gallery/form-media-gallery-field.st.css.js.map +1 -1
- package/dist/cjs/components/media-image/media-image.st.css.js +4 -4
- package/dist/cjs/components/media-image/media-image.st.css.js.map +1 -1
- package/dist/cjs/components/media-image/overlays/overlay.st.css.js +3 -3
- package/dist/cjs/components/media-image/overlays/overlay.st.css.js.map +1 -1
- package/dist/cjs/components/media-tag/web-media-tag/media-tag.st.css.js +2 -2
- package/dist/cjs/components/media-tag/web-media-tag/media-tag.st.css.js.map +1 -1
- package/dist/cjs/components/multi-document/cell-multi-document-edit.st.css.js +3 -3
- package/dist/cjs/components/multi-document/cell-multi-document-edit.st.css.js.map +1 -1
- package/dist/cjs/components/multi-document/multi-document-input/form-multi-document.st.css.js +5 -5
- package/dist/cjs/components/multi-document/multi-document-input/form-multi-document.st.css.js.map +1 -1
- package/dist/cjs/components/reference/cell-multi-reference-input.st.css.js +2 -2
- package/dist/cjs/components/reference/cell-multi-reference-input.st.css.js.map +1 -1
- package/dist/cjs/components/reference/cell-reference-input.st.css.js +3 -3
- package/dist/cjs/components/reference/cell-reference-input.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js +4 -4
- package/dist/cjs/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css +3 -0
- package/dist/cjs/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js +6 -4
- package/dist/cjs/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js +2 -2
- 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
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js +3 -3
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js +3 -3
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js +2 -2
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js +7 -7
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js +5 -5
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js.map +1 -1
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js +4 -4
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js.map +1 -1
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css +3 -1
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js +20 -18
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js.map +1 -1
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css +3 -0
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js +7 -5
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js.map +1 -1
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css +2 -1
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js +20 -19
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js.map +1 -1
- package/dist/cjs/components/text/text-view.st.css.js +3 -3
- package/dist/cjs/components/text/text-view.st.css.js.map +1 -1
- package/dist/cjs/components/url/form-url.js +22 -9
- package/dist/cjs/components/url/form-url.js.map +1 -1
- package/dist/cjs/components/video/form-video-field.js +35 -28
- package/dist/cjs/components/video/form-video-field.js.map +1 -1
- package/dist/cjs/services/atlas/types.js.map +1 -1
- package/dist/cjs/services/atlas/wix-atlas-service.js +16 -1
- package/dist/cjs/services/atlas/wix-atlas-service.js.map +1 -1
- package/dist/cjs/styles.global.css +1 -1
- package/dist/cjs/types/validation.js.map +1 -1
- package/dist/esm/components/address/input/address-input.js +139 -38
- package/dist/esm/components/address/input/address-input.js.map +1 -1
- package/dist/esm/components/address/input/address-input.st.css.js +2 -2
- package/dist/esm/components/audio/actions/actions-menu/actions-menu.st.css.js +2 -2
- package/dist/esm/components/audio/actions/actions-menu/actions-menu.st.css.js.map +1 -1
- package/dist/esm/components/audio/audio-field/controlled-audio.uni.driver.js +3 -2
- package/dist/esm/components/audio/audio-field/controlled-audio.uni.driver.js.map +1 -1
- package/dist/esm/components/audio/audio-field/form-audio-field.js +9 -13
- package/dist/esm/components/audio/audio-field/form-audio-field.js.map +1 -1
- package/dist/esm/components/audio/audio-field/form-audio-field.st.css.js +2 -2
- package/dist/esm/components/audio/audio-field/form-audio-field.st.css.js.map +1 -1
- package/dist/esm/components/audio/audio-player/audio-player.st.css.js +2 -2
- package/dist/esm/components/color-view/cell-color-view.st.css.js +2 -2
- package/dist/esm/components/color-view/color-view.st.css.js +2 -2
- package/dist/esm/components/delete-dialog/delete-dialog.st.css.js +2 -2
- package/dist/esm/components/delete-dialog/delete-dialog.st.css.js.map +1 -1
- package/dist/esm/components/document/form-document-field.st.css.js +2 -2
- package/dist/esm/components/document/form-document-field.st.css.js.map +1 -1
- package/dist/esm/components/exclamation/exclamation.st.css.js +2 -2
- package/dist/esm/components/field-validation-settings/field-validation-settings-input.js +45 -10
- package/dist/esm/components/field-validation-settings/field-validation-settings-input.js.map +1 -1
- package/dist/esm/components/field-validation-settings/field-validation-settings.uni.driver.js +2 -1
- package/dist/esm/components/field-validation-settings/field-validation-settings.uni.driver.js.map +1 -1
- package/dist/esm/components/highlighted-text/highlighted-text.st.css.js +3 -3
- package/dist/esm/components/image/thumbnail-replace-overlay.st.css.js +2 -2
- package/dist/esm/components/media-control/cell-media-edit-shell.st.css.js +2 -2
- package/dist/esm/components/media-control/paste-url-button.st.css.js +2 -2
- package/dist/esm/components/media-control/paste-url-button.st.css.js.map +1 -1
- package/dist/esm/components/media-gallery/form-media-gallery-field.st.css.js +2 -2
- package/dist/esm/components/media-gallery/form-media-gallery-field.st.css.js.map +1 -1
- package/dist/esm/components/media-image/media-image.st.css.js +3 -3
- package/dist/esm/components/media-image/media-image.st.css.js.map +1 -1
- package/dist/esm/components/media-image/overlays/overlay.st.css.js +2 -2
- package/dist/esm/components/media-image/overlays/overlay.st.css.js.map +1 -1
- package/dist/esm/components/media-tag/web-media-tag/media-tag.st.css.js +2 -2
- package/dist/esm/components/multi-document/cell-multi-document-edit.st.css.js +2 -2
- package/dist/esm/components/multi-document/cell-multi-document-edit.st.css.js.map +1 -1
- package/dist/esm/components/multi-document/multi-document-input/form-multi-document.st.css.js +2 -2
- package/dist/esm/components/multi-document/multi-document-input/form-multi-document.st.css.js.map +1 -1
- package/dist/esm/components/reference/cell-multi-reference-input.st.css.js +2 -2
- package/dist/esm/components/reference/cell-reference-input.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css +3 -0
- package/dist/esm/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js +3 -3
- package/dist/esm/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js.map +1 -1
- package/dist/esm/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js.map +1 -1
- package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js.map +1 -1
- package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.js +2 -2
- package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css +3 -1
- package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js +3 -3
- package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.js.map +1 -1
- package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css +3 -0
- package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js +3 -3
- package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js.map +1 -1
- package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css +2 -1
- package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js +3 -3
- package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js.map +1 -1
- package/dist/esm/components/text/text-view.st.css.js +2 -2
- package/dist/esm/components/url/form-url.js +14 -1
- package/dist/esm/components/url/form-url.js.map +1 -1
- package/dist/esm/components/video/form-video-field.js +8 -1
- package/dist/esm/components/video/form-video-field.js.map +1 -1
- package/dist/esm/services/atlas/wix-atlas-service.js +22 -2
- package/dist/esm/services/atlas/wix-atlas-service.js.map +1 -1
- package/dist/esm/styles.global.css +1 -1
- package/dist/types/components/address/input/address-input.d.ts.map +1 -1
- package/dist/types/components/audio/actions/actions-menu/actions-menu.st.css.d.ts.map +1 -1
- package/dist/types/components/audio/audio-field/controlled-audio.uni.driver.d.ts +1 -0
- package/dist/types/components/audio/audio-field/controlled-audio.uni.driver.d.ts.map +1 -1
- package/dist/types/components/audio/audio-field/form-audio-field.d.ts.map +1 -1
- package/dist/types/components/audio/audio-field/form-audio-field.st.css.d.ts.map +1 -1
- package/dist/types/components/controlled-input.uni.driver.d.ts +1 -0
- package/dist/types/components/controlled-input.uni.driver.d.ts.map +1 -1
- package/dist/types/components/delete-dialog/delete-dialog.st.css.d.ts.map +1 -1
- package/dist/types/components/document/form-document-field.st.css.d.ts.map +1 -1
- package/dist/types/components/field-validation-settings/field-validation-settings-input.d.ts +4 -1
- package/dist/types/components/field-validation-settings/field-validation-settings-input.d.ts.map +1 -1
- package/dist/types/components/field-validation-settings/field-validation-settings.uni.driver.d.ts +7 -0
- package/dist/types/components/field-validation-settings/field-validation-settings.uni.driver.d.ts.map +1 -1
- package/dist/types/components/media-control/paste-url-button.st.css.d.ts.map +1 -1
- package/dist/types/components/media-gallery/form-media-gallery-field.st.css.d.ts.map +1 -1
- package/dist/types/components/media-image/media-image.st.css.d.ts.map +1 -1
- package/dist/types/components/media-image/overlays/overlay.st.css.d.ts.map +1 -1
- package/dist/types/components/multi-document/cell-multi-document-edit.st.css.d.ts.map +1 -1
- package/dist/types/components/multi-document/multi-document-input/form-multi-document.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.d.ts +2 -0
- package/dist/types/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.d.ts +2 -0
- package/dist/types/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.d.ts +2 -0
- package/dist/types/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.d.ts +1 -0
- package/dist/types/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.d.ts.map +1 -1
- package/dist/types/components/url/form-url.d.ts.map +1 -1
- package/dist/types/components/video/form-video-field.d.ts.map +1 -1
- package/dist/types/services/atlas/types.d.ts +5 -1
- package/dist/types/services/atlas/types.d.ts.map +1 -1
- package/dist/types/services/atlas/wix-atlas-service.d.ts +6 -1
- package/dist/types/services/atlas/wix-atlas-service.d.ts.map +1 -1
- package/dist/types/types/validation.d.ts +6 -1
- package/dist/types/types/validation.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/__tests__/components/address/address-input.driver.tsx +17 -1
- package/src/__tests__/components/address/address-input.spec.tsx +207 -1
- package/src/__tests__/components/field-validation-settings/field-validation-settings-input.spec.tsx +87 -0
- package/src/__tests__/components/url/form-url.spec.tsx +63 -0
- package/src/__tests__/components/video/form-video.spec.tsx +17 -0
- package/src/__tests__/exports/controlled-inputs.spec.tsx +46 -0
- package/src/components/address/input/address-input.st.css.ts +2 -2
- package/src/components/address/input/address-input.tsx +163 -50
- package/src/components/audio/actions/actions-menu/actions-menu.st.css.ts +2 -2
- package/src/components/audio/audio-field/controlled-audio.uni.driver.ts +3 -2
- package/src/components/audio/audio-field/form-audio-field.st.css.ts +2 -2
- package/src/components/audio/audio-field/form-audio-field.tsx +59 -53
- package/src/components/audio/audio-player/audio-player.st.css.ts +2 -2
- package/src/components/color-view/cell-color-view.st.css.ts +2 -2
- package/src/components/color-view/color-view.st.css.ts +2 -2
- package/src/components/delete-dialog/delete-dialog.st.css.ts +2 -2
- package/src/components/document/form-document-field.st.css.ts +2 -2
- package/src/components/exclamation/exclamation.st.css.ts +2 -2
- package/src/components/field-validation-settings/field-validation-settings-input.tsx +75 -11
- package/src/components/field-validation-settings/field-validation-settings.uni.driver.ts +3 -1
- package/src/components/highlighted-text/highlighted-text.st.css.ts +3 -3
- package/src/components/image/thumbnail-replace-overlay.st.css.ts +2 -2
- package/src/components/media-control/cell-media-edit-shell.st.css.ts +2 -2
- package/src/components/media-control/paste-url-button.st.css.ts +2 -2
- package/src/components/media-gallery/form-media-gallery-field.st.css.ts +2 -2
- package/src/components/media-image/media-image.st.css.ts +3 -3
- package/src/components/media-image/overlays/overlay.st.css.ts +2 -2
- package/src/components/media-tag/web-media-tag/media-tag.st.css.ts +2 -2
- package/src/components/multi-document/cell-multi-document-edit.st.css.ts +2 -2
- package/src/components/multi-document/multi-document-input/form-multi-document.st.css.ts +2 -2
- package/src/components/reference/cell-multi-reference-input.st.css.ts +2 -2
- package/src/components/reference/cell-reference-input.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css +3 -0
- package/src/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.ts +3 -3
- package/src/components/rich-content/rich-content-input/form-read-only-input/rich-content-form-read-only-input.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/rich-content-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/rich-content-viewer/rich-content-viewer.st.css.ts +2 -2
- package/src/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css +3 -1
- package/src/components/rich-text/rich-text-input/rich-text-editor/rich-editor.st.css.ts +3 -3
- package/src/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css +3 -0
- package/src/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.ts +3 -3
- package/src/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css +2 -1
- package/src/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.ts +3 -3
- package/src/components/text/text-view.st.css.ts +2 -2
- package/src/components/url/form-url.tsx +16 -1
- package/src/components/video/form-video-field.tsx +6 -0
- package/src/services/atlas/types.ts +6 -1
- package/src/services/atlas/wix-atlas-service.ts +27 -3
- package/src/styles.global.css +1 -1
- package/src/types/validation.ts +6 -1
- package/dist/cjs/components/media-loader/index.js +0 -10
- package/dist/cjs/components/media-loader/index.js.map +0 -1
- package/dist/cjs/components/media-loader/media-loader.js +0 -37
- package/dist/cjs/components/media-loader/media-loader.js.map +0 -1
- package/dist/cjs/components/media-loader/media-loader.st.css +0 -20
- package/dist/cjs/components/media-loader/media-loader.st.css.js +0 -29
- package/dist/cjs/components/media-loader/media-loader.st.css.js.map +0 -1
- package/dist/esm/components/media-loader/index.js +0 -2
- package/dist/esm/components/media-loader/index.js.map +0 -1
- package/dist/esm/components/media-loader/media-loader.js +0 -8
- package/dist/esm/components/media-loader/media-loader.js.map +0 -1
- package/dist/esm/components/media-loader/media-loader.st.css +0 -20
- package/dist/esm/components/media-loader/media-loader.st.css.js +0 -15
- package/dist/esm/components/media-loader/media-loader.st.css.js.map +0 -1
- package/dist/types/components/media-loader/index.d.ts +0 -2
- package/dist/types/components/media-loader/index.d.ts.map +0 -1
- package/dist/types/components/media-loader/media-loader.d.ts +0 -7
- package/dist/types/components/media-loader/media-loader.d.ts.map +0 -1
- package/dist/types/components/media-loader/media-loader.st.css.d.ts +0 -20
- package/dist/types/components/media-loader/media-loader.st.css.d.ts.map +0 -1
- package/src/components/media-loader/index.ts +0 -1
- package/src/components/media-loader/media-loader.st.css +0 -20
- package/src/components/media-loader/media-loader.st.css.ts +0 -25
- package/src/components/media-loader/media-loader.tsx +0 -30
package/src/__tests__/components/field-validation-settings/field-validation-settings-input.spec.tsx
CHANGED
|
@@ -30,6 +30,8 @@ const charactersLimitRule: FieldValidationRuleConfig = {
|
|
|
30
30
|
separator: 'and',
|
|
31
31
|
outOfBoundsError: (min, max) => `Enter a value from ${min} to ${max}.`,
|
|
32
32
|
maxBelowMinError: 'Maximum must not be below minimum.',
|
|
33
|
+
exclusiveRulesExplanation:
|
|
34
|
+
"You can't limit character count for specific values.",
|
|
33
35
|
};
|
|
34
36
|
|
|
35
37
|
const specificValuesRule: FieldValidationRuleConfig = {
|
|
@@ -49,6 +51,8 @@ const patternRule: FieldValidationRuleConfig = {
|
|
|
49
51
|
tooltip: 'Pattern tooltip',
|
|
50
52
|
inputLabel: 'Regular expression',
|
|
51
53
|
invalidError: 'Enter a valid regular expression.',
|
|
54
|
+
exclusiveRulesExplanation:
|
|
55
|
+
"You can't add pattern validation for specific values.",
|
|
52
56
|
};
|
|
53
57
|
|
|
54
58
|
const allRules = [
|
|
@@ -68,6 +72,7 @@ interface RenderInputOptions {
|
|
|
68
72
|
readOnly?: boolean;
|
|
69
73
|
invalid?: boolean;
|
|
70
74
|
disabledRules?: readonly FieldValidationRuleConfig['type'][];
|
|
75
|
+
exclusiveSpecificValues?: boolean;
|
|
71
76
|
}
|
|
72
77
|
|
|
73
78
|
const renderInput = (
|
|
@@ -77,6 +82,7 @@ const renderInput = (
|
|
|
77
82
|
readOnly,
|
|
78
83
|
invalid,
|
|
79
84
|
disabledRules,
|
|
85
|
+
exclusiveSpecificValues,
|
|
80
86
|
}: RenderInputOptions = {},
|
|
81
87
|
) => {
|
|
82
88
|
const onChange = jest.fn<void, [FieldValidationSettingsValue]>();
|
|
@@ -91,6 +97,7 @@ const renderInput = (
|
|
|
91
97
|
readOnly={readOnly}
|
|
92
98
|
invalid={invalid}
|
|
93
99
|
disabledRules={disabledRules}
|
|
100
|
+
exclusiveSpecificValues={exclusiveSpecificValues}
|
|
94
101
|
onChange={(nextData) => {
|
|
95
102
|
onChange(nextData);
|
|
96
103
|
setData(nextData);
|
|
@@ -337,6 +344,86 @@ describe('FieldValidationSettingsInput', () => {
|
|
|
337
344
|
expect(await driver.getPatternToggle().isDisabled()).toBe(true);
|
|
338
345
|
});
|
|
339
346
|
|
|
347
|
+
it('explains exclusivity under each rule that specific values block', async () => {
|
|
348
|
+
const { driver } = renderInput({ specificValues: [] });
|
|
349
|
+
|
|
350
|
+
expect(
|
|
351
|
+
await driver.getExclusiveRulesExplanation('characters-limit').text(),
|
|
352
|
+
).toBe("You can't limit character count for specific values.");
|
|
353
|
+
expect(await driver.getExclusiveRulesExplanation('pattern').text()).toBe(
|
|
354
|
+
"You can't add pattern validation for specific values.",
|
|
355
|
+
);
|
|
356
|
+
expect(
|
|
357
|
+
await driver.getExclusiveRulesExplanation('specific-values').exists(),
|
|
358
|
+
).toBe(false);
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
it('explains exclusivity under specific values when a character limit blocks it', async () => {
|
|
362
|
+
const { driver } = renderInput({ charactersLimit: {} });
|
|
363
|
+
|
|
364
|
+
expect(
|
|
365
|
+
await driver.getExclusiveRulesExplanation('specific-values').text(),
|
|
366
|
+
).toBe('Disable the active rule first.');
|
|
367
|
+
expect(
|
|
368
|
+
await driver.getExclusiveRulesExplanation('characters-limit').exists(),
|
|
369
|
+
).toBe(false);
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
it('falls back to the specific-values explanation exactly once for legacy configs', async () => {
|
|
373
|
+
const { driver, container } = renderInput(
|
|
374
|
+
{ specificValues: [] },
|
|
375
|
+
{
|
|
376
|
+
rules: [
|
|
377
|
+
{ ...charactersLimitRule, exclusiveRulesExplanation: undefined },
|
|
378
|
+
specificValuesRule,
|
|
379
|
+
{ ...patternRule, exclusiveRulesExplanation: undefined },
|
|
380
|
+
],
|
|
381
|
+
},
|
|
382
|
+
);
|
|
383
|
+
|
|
384
|
+
expect(await driver.hasExclusiveRulesExplanation()).toBe(true);
|
|
385
|
+
expect(
|
|
386
|
+
Array.from(
|
|
387
|
+
container.querySelectorAll('[data-hook$="exclusive-help"]'),
|
|
388
|
+
).map((node) => node.textContent),
|
|
389
|
+
).toEqual(['Disable the active rule first.']);
|
|
390
|
+
});
|
|
391
|
+
|
|
392
|
+
it('omits an exclusivity explanation when no rule config supplies one', async () => {
|
|
393
|
+
const { driver } = renderInput(
|
|
394
|
+
{ specificValues: [] },
|
|
395
|
+
{
|
|
396
|
+
rules: [
|
|
397
|
+
{ ...charactersLimitRule, exclusiveRulesExplanation: undefined },
|
|
398
|
+
{ ...specificValuesRule, exclusiveRulesExplanation: undefined },
|
|
399
|
+
],
|
|
400
|
+
},
|
|
401
|
+
);
|
|
402
|
+
|
|
403
|
+
expect(await driver.getCharactersLimitToggle().isDisabled()).toBe(true);
|
|
404
|
+
expect(await driver.hasExclusiveRulesExplanation()).toBe(false);
|
|
405
|
+
});
|
|
406
|
+
|
|
407
|
+
it('keeps every rule toggle enabled when specific values are not exclusive', async () => {
|
|
408
|
+
const { driver } = renderInput(
|
|
409
|
+
{ specificValues: [] },
|
|
410
|
+
{ exclusiveSpecificValues: false },
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
expect(await driver.getSpecificValuesToggle().isDisabled()).toBe(false);
|
|
414
|
+
expect(await driver.getCharactersLimitToggle().isDisabled()).toBe(false);
|
|
415
|
+
expect(await driver.getPatternToggle().isDisabled()).toBe(false);
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
it('does not explain exclusivity when specific values are not exclusive', async () => {
|
|
419
|
+
const { driver } = renderInput(
|
|
420
|
+
{ charactersLimit: {} },
|
|
421
|
+
{ exclusiveSpecificValues: false },
|
|
422
|
+
);
|
|
423
|
+
|
|
424
|
+
expect(await driver.hasExclusiveRulesExplanation()).toBe(false);
|
|
425
|
+
});
|
|
426
|
+
|
|
340
427
|
it('keeps active conflicting rules enabled so loaded data can be repaired', async () => {
|
|
341
428
|
const { driver, onChange } = renderInput({
|
|
342
429
|
charactersLimit: {},
|
|
@@ -109,6 +109,69 @@ describe('FormUrl field', () => {
|
|
|
109
109
|
expect(await driver.tk.hasError()).toBe(false);
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
+
it('shows a min-length error when the URL is shorter than minLength', async () => {
|
|
113
|
+
const driver = setup({
|
|
114
|
+
field: makeField({
|
|
115
|
+
type: 'URL',
|
|
116
|
+
validation: { required: false, stringLengthRange: { minLength: 25 } },
|
|
117
|
+
}),
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
await driver.tk.enterText('https://wix.com');
|
|
121
|
+
|
|
122
|
+
expect(await driver.tk.hasError()).toBe(true);
|
|
123
|
+
expect(await driver.tk.getErrorMessage()).toBe(
|
|
124
|
+
'cairo.fieldValidation.minCharacter{charMin=25}',
|
|
125
|
+
);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('shows a max-length error when the URL is longer than maxLength', async () => {
|
|
129
|
+
const driver = setup({
|
|
130
|
+
field: makeField({
|
|
131
|
+
type: 'URL',
|
|
132
|
+
validation: { required: false, stringLengthRange: { maxLength: 20 } },
|
|
133
|
+
}),
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
await driver.tk.enterText('https://example.com/a/very/long/path');
|
|
137
|
+
|
|
138
|
+
expect(await driver.tk.hasError()).toBe(true);
|
|
139
|
+
expect(await driver.tk.getErrorMessage()).toBe(
|
|
140
|
+
'cairo.fieldValidation.maxCharacter{charMax=20}',
|
|
141
|
+
);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('accepts a URL inside the allowed length range', async () => {
|
|
145
|
+
const driver = setup({
|
|
146
|
+
field: makeField({
|
|
147
|
+
type: 'URL',
|
|
148
|
+
validation: {
|
|
149
|
+
required: false,
|
|
150
|
+
stringLengthRange: { minLength: 10, maxLength: 40 },
|
|
151
|
+
},
|
|
152
|
+
}),
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
await driver.tk.enterText('https://example.com');
|
|
156
|
+
|
|
157
|
+
expect(await driver.tk.hasError()).toBe(false);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('reports the malformed-URL error before the length error', async () => {
|
|
161
|
+
const driver = setup({
|
|
162
|
+
field: makeField({
|
|
163
|
+
type: 'URL',
|
|
164
|
+
validation: { required: false, stringLengthRange: { minLength: 25 } },
|
|
165
|
+
}),
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
await driver.tk.enterText('not a url');
|
|
169
|
+
|
|
170
|
+
expect(await driver.tk.getErrorMessage()).toBe(
|
|
171
|
+
'cairo.customFields.url-input.error',
|
|
172
|
+
);
|
|
173
|
+
});
|
|
174
|
+
|
|
112
175
|
it('reports the malformed-URL error before the pattern error', async () => {
|
|
113
176
|
const driver = setup({
|
|
114
177
|
field: makeField({
|
|
@@ -2,6 +2,7 @@ import '../../../testkit/test-polyfills';
|
|
|
2
2
|
|
|
3
3
|
import type { Field } from '@wix/bex-core';
|
|
4
4
|
|
|
5
|
+
import { Z_INDEX_MODAL_POPOVER } from '../../../components/common';
|
|
5
6
|
import { FormVideo } from '../../../components/video/form-video';
|
|
6
7
|
import { FormVideoDriver } from '../../../components/video/form-video.driver';
|
|
7
8
|
import { FormFieldDriver, makeField } from '../../form-field.driver';
|
|
@@ -82,6 +83,22 @@ describe('FormVideo field', () => {
|
|
|
82
83
|
);
|
|
83
84
|
});
|
|
84
85
|
|
|
86
|
+
it('raises the more-actions menu above modal content', async () => {
|
|
87
|
+
const field = makeField({ type: 'VIDEO' });
|
|
88
|
+
const driver = setup({ field, initialValue: VALID_VIDEO_URI });
|
|
89
|
+
|
|
90
|
+
await driver.tk.clickMore();
|
|
91
|
+
|
|
92
|
+
const deleteAction = document.querySelector(
|
|
93
|
+
`[data-hook="video-delete-${field.id}"]`,
|
|
94
|
+
);
|
|
95
|
+
expect(deleteAction).toBeTruthy();
|
|
96
|
+
expect(deleteAction!.closest('[data-zindex]')).toHaveAttribute(
|
|
97
|
+
'data-zindex',
|
|
98
|
+
String(Z_INDEX_MODAL_POPOVER),
|
|
99
|
+
);
|
|
100
|
+
});
|
|
101
|
+
|
|
85
102
|
// The empty state is the only one that can fail `required`, so its add
|
|
86
103
|
// button is what react-hook-form should land on.
|
|
87
104
|
it('focuses the add button when a required value blocks submit', async () => {
|
|
@@ -488,6 +488,52 @@ describe('controlled inputs', () => {
|
|
|
488
488
|
expect(onChange).toHaveBeenCalledWith(undefined);
|
|
489
489
|
});
|
|
490
490
|
|
|
491
|
+
// The testkit factory resolves a dataHook once, when the driver is built, so
|
|
492
|
+
// a driver made before the click keeps answering about the old render. Each
|
|
493
|
+
// assertion below uses a driver created after the render it describes.
|
|
494
|
+
it('shows the audio loader inside the add button while the picker is open', async () => {
|
|
495
|
+
let resolvePick: (value: unknown) => void = () => {};
|
|
496
|
+
const openMediaManager = jest.fn().mockImplementation(
|
|
497
|
+
() =>
|
|
498
|
+
new Promise((resolve) => {
|
|
499
|
+
resolvePick = resolve;
|
|
500
|
+
}),
|
|
501
|
+
);
|
|
502
|
+
const { container } = render(
|
|
503
|
+
<ControlledAudioInput
|
|
504
|
+
data={undefined}
|
|
505
|
+
onChange={jest.fn()}
|
|
506
|
+
dataHook="audio-loading"
|
|
507
|
+
/>,
|
|
508
|
+
{ wrapper: withMediaManager(openMediaManager) },
|
|
509
|
+
);
|
|
510
|
+
|
|
511
|
+
await getInput(container, 'audio-loading').audio.clickAddButton();
|
|
512
|
+
await act(async () => {});
|
|
513
|
+
|
|
514
|
+
expect(openMediaManager).toHaveBeenCalledTimes(1);
|
|
515
|
+
|
|
516
|
+
const fieldBox = container.querySelector<HTMLElement>(
|
|
517
|
+
'[data-hook="audio-loading"]',
|
|
518
|
+
);
|
|
519
|
+
expect(fieldBox).not.toBeNull();
|
|
520
|
+
expect(
|
|
521
|
+
fieldBox!.querySelector('[data-hook="fromAudioInput.loader"]'),
|
|
522
|
+
).not.toBeNull();
|
|
523
|
+
|
|
524
|
+
const loading = getInput(container, 'audio-loading').audio;
|
|
525
|
+
expect(await loading.isLoading()).toBe(true);
|
|
526
|
+
expect(await loading.getAddButtonText()).toBe('');
|
|
527
|
+
|
|
528
|
+
await act(async () => {
|
|
529
|
+
resolvePick({ items: [] });
|
|
530
|
+
});
|
|
531
|
+
|
|
532
|
+
const settled = getInput(container, 'audio-loading').audio;
|
|
533
|
+
expect(await settled.isLoading()).toBe(false);
|
|
534
|
+
expect(await settled.getAddButtonText()).toBe('CMS.audio.button.add');
|
|
535
|
+
});
|
|
536
|
+
|
|
491
537
|
it('disables the audio replace and delete actions when readOnly', async () => {
|
|
492
538
|
const { container } = render(
|
|
493
539
|
<ControlledAudioInput
|
|
@@ -5,7 +5,7 @@ import { classesRuntime, statesRuntime } from "../../../stylable-esm-runtime.js"
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "addressinput2635647605";
|
|
9
9
|
var _style_ = classesRuntime.bind(null, _namespace_);
|
|
10
10
|
|
|
11
11
|
export var cssStates = statesRuntime.bind(null, _namespace_);
|
|
@@ -13,7 +13,7 @@ export var style: import("@stylable/runtime").STFunction = _style_;
|
|
|
13
13
|
export var st: import("@stylable/runtime").STFunction = _style_;
|
|
14
14
|
|
|
15
15
|
export var namespace = _namespace_;
|
|
16
|
-
export var classes = {"root":"
|
|
16
|
+
export var classes = {"root":"addressinput2635647605__root","tableAddressInput":"addressinput2635647605__tableAddressInput"};
|
|
17
17
|
export var keyframes = {};
|
|
18
18
|
export var layers = {};
|
|
19
19
|
export var containers = {};
|
|
@@ -10,6 +10,7 @@ import React, {
|
|
|
10
10
|
|
|
11
11
|
import isEqual from 'lodash/isEqual';
|
|
12
12
|
import debounce from 'lodash/debounce';
|
|
13
|
+
import { usePatternsCmsFieldsContainer } from '../../../providers/PatternsFieldsContainerProvider';
|
|
13
14
|
import type { Address } from '../../../types/address';
|
|
14
15
|
import type {
|
|
15
16
|
AddressInputProps as WDSAddressInputProps,
|
|
@@ -36,6 +37,14 @@ import { noop } from '../../../utils';
|
|
|
36
37
|
|
|
37
38
|
const SEARCH_ADDRESS_DEBOUNCE = 250;
|
|
38
39
|
|
|
40
|
+
interface AddressSuggestion {
|
|
41
|
+
formatted: string;
|
|
42
|
+
mainLabel: string;
|
|
43
|
+
secondaryLabel: string;
|
|
44
|
+
searchId?: string;
|
|
45
|
+
address?: AtlasAddress;
|
|
46
|
+
}
|
|
47
|
+
|
|
39
48
|
export interface AddressInputProps
|
|
40
49
|
extends Omit<
|
|
41
50
|
WDSAddressInputProps,
|
|
@@ -85,9 +94,11 @@ export const AddressInput = forwardRef<
|
|
|
85
94
|
},
|
|
86
95
|
forwardedRef,
|
|
87
96
|
) => {
|
|
97
|
+
const { patternsContainer } = usePatternsCmsFieldsContainer();
|
|
98
|
+
const errorHandler = patternsContainer?.errorHandler;
|
|
88
99
|
const atlas = useMemo(
|
|
89
|
-
() => atlasService ?? new WixAtlasService(),
|
|
90
|
-
[atlasService],
|
|
100
|
+
() => atlasService ?? new WixAtlasService(errorHandler),
|
|
101
|
+
[atlasService, errorHandler],
|
|
91
102
|
);
|
|
92
103
|
const { t } = useTranslations();
|
|
93
104
|
|
|
@@ -111,46 +122,107 @@ export const AddressInput = forwardRef<
|
|
|
111
122
|
const clearInputValue = useClearValue(setInputValue, '');
|
|
112
123
|
|
|
113
124
|
const [isSearching, setIsSearching] = useState(false);
|
|
114
|
-
const [searchResults, setSearchResults] = useState<
|
|
125
|
+
const [searchResults, setSearchResults] = useState<AddressSuggestion[]>([]);
|
|
115
126
|
const [searchResultsError, setSearchResultsError] = useState<Error>();
|
|
127
|
+
const requestIdRef = useRef(0);
|
|
128
|
+
const isMountedRef = useRef(true);
|
|
116
129
|
const searchAddress = useMemo(
|
|
117
130
|
() =>
|
|
118
|
-
debounce((query: string) => {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
.
|
|
124
|
-
|
|
125
|
-
|
|
131
|
+
debounce(async (query: string, requestId: number) => {
|
|
132
|
+
const isCurrent = () =>
|
|
133
|
+
isMountedRef.current && requestId === requestIdRef.current;
|
|
134
|
+
try {
|
|
135
|
+
let suggestions: AddressSuggestion[];
|
|
136
|
+
if (atlas.predictAddress && atlas.getAddress) {
|
|
137
|
+
const predictions = await atlas.predictAddress(query);
|
|
138
|
+
suggestions = predictions.flatMap((prediction) =>
|
|
139
|
+
prediction.searchId && prediction.description
|
|
140
|
+
? [
|
|
141
|
+
{
|
|
142
|
+
searchId: prediction.searchId,
|
|
143
|
+
formatted: prediction.description,
|
|
144
|
+
mainLabel:
|
|
145
|
+
prediction.textStructure?.mainText ??
|
|
146
|
+
prediction.description,
|
|
147
|
+
secondaryLabel:
|
|
148
|
+
prediction.textStructure?.secondaryText ?? '',
|
|
149
|
+
},
|
|
150
|
+
]
|
|
151
|
+
: [],
|
|
152
|
+
);
|
|
153
|
+
} else {
|
|
154
|
+
const addresses = await atlas.searchAddress(query);
|
|
155
|
+
suggestions = addresses.map((result) => {
|
|
156
|
+
const [mainLabel, ...secondary] =
|
|
157
|
+
result.formatted?.split(', ') ?? [];
|
|
158
|
+
return {
|
|
159
|
+
address: result,
|
|
160
|
+
formatted: result.formatted ?? '',
|
|
161
|
+
mainLabel: mainLabel ?? '',
|
|
162
|
+
secondaryLabel: secondary.join(', '),
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
if (isCurrent()) {
|
|
167
|
+
setSearchResults(suggestions);
|
|
168
|
+
}
|
|
169
|
+
} catch (error) {
|
|
170
|
+
if (isCurrent()) {
|
|
171
|
+
setSearchResultsError(
|
|
172
|
+
error instanceof Error ? error : new Error(String(error)),
|
|
173
|
+
);
|
|
174
|
+
}
|
|
175
|
+
} finally {
|
|
176
|
+
if (isCurrent()) {
|
|
177
|
+
setIsSearching(false);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
126
180
|
}, SEARCH_ADDRESS_DEBOUNCE),
|
|
127
181
|
[atlas],
|
|
128
182
|
);
|
|
129
|
-
|
|
130
|
-
|
|
183
|
+
|
|
184
|
+
const cancelSearch = useCallback(() => {
|
|
185
|
+
requestIdRef.current++;
|
|
186
|
+
searchAddress.cancel();
|
|
187
|
+
setIsSearching(false);
|
|
188
|
+
}, [searchAddress]);
|
|
189
|
+
|
|
190
|
+
useEffect(() => {
|
|
191
|
+
const requests = requestIdRef;
|
|
192
|
+
isMountedRef.current = true;
|
|
193
|
+
return () => {
|
|
194
|
+
isMountedRef.current = false;
|
|
195
|
+
requests.current++;
|
|
131
196
|
searchAddress.cancel();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
);
|
|
197
|
+
};
|
|
198
|
+
}, [searchAddress]);
|
|
135
199
|
|
|
136
200
|
const onInputChange = useCallback(
|
|
137
201
|
({ target }: React.ChangeEvent<HTMLInputElement>) => {
|
|
138
202
|
onInput?.();
|
|
203
|
+
cancelSearch();
|
|
139
204
|
setInputValue(target.value);
|
|
205
|
+
setSearchResults([]);
|
|
206
|
+
setSearchResultsError(undefined);
|
|
140
207
|
|
|
141
208
|
const trimmedValue = target.value.trim();
|
|
142
209
|
|
|
143
210
|
if (trimmedValue) {
|
|
144
|
-
|
|
211
|
+
setIsSearching(true);
|
|
212
|
+
searchAddress(trimmedValue, requestIdRef.current);
|
|
145
213
|
} else {
|
|
146
214
|
setAddress(undefined);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
setIsSearching(false);
|
|
150
|
-
setSearchResultsError(undefined);
|
|
215
|
+
triggerOnChange(undefined);
|
|
151
216
|
}
|
|
152
217
|
},
|
|
153
|
-
[
|
|
218
|
+
[
|
|
219
|
+
onInput,
|
|
220
|
+
cancelSearch,
|
|
221
|
+
setAddress,
|
|
222
|
+
setInputValue,
|
|
223
|
+
searchAddress,
|
|
224
|
+
triggerOnChange,
|
|
225
|
+
],
|
|
154
226
|
);
|
|
155
227
|
|
|
156
228
|
const addressInputRef = useRef<WDSAddressInputRef>(null);
|
|
@@ -159,25 +231,29 @@ export const AddressInput = forwardRef<
|
|
|
159
231
|
() => ({
|
|
160
232
|
focus: () => addressInputRef.current?.focus(),
|
|
161
233
|
clear: () => {
|
|
234
|
+
cancelSearch();
|
|
162
235
|
clearAddress();
|
|
163
236
|
clearInputValue();
|
|
237
|
+
setSearchResults([]);
|
|
238
|
+
triggerOnChange(undefined);
|
|
164
239
|
},
|
|
165
240
|
}),
|
|
166
|
-
[clearAddress, clearInputValue],
|
|
241
|
+
[cancelSearch, clearAddress, clearInputValue, triggerOnChange],
|
|
167
242
|
);
|
|
168
243
|
|
|
169
244
|
useEffect(() => {
|
|
170
|
-
if (!initialSearchText)
|
|
245
|
+
if (!initialSearchText) {
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
171
248
|
setInputValue(initialSearchText);
|
|
172
|
-
|
|
249
|
+
setIsSearching(true);
|
|
250
|
+
searchAddress(initialSearchText.trim(), ++requestIdRef.current);
|
|
173
251
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
174
252
|
}, []); // Deliberately run only on mount — initialSearchText is a one-shot seed
|
|
175
253
|
|
|
176
|
-
const isFocusedRef = useRef(false);
|
|
177
254
|
const onSetSelection = useSetSelectionOnFocus();
|
|
178
255
|
const onInputFocus = useCallback(
|
|
179
256
|
(e?: React.FocusEvent<HTMLInputElement>) => {
|
|
180
|
-
isFocusedRef.current = true;
|
|
181
257
|
onSetSelection(e);
|
|
182
258
|
onFocus?.(e);
|
|
183
259
|
},
|
|
@@ -186,40 +262,70 @@ export const AddressInput = forwardRef<
|
|
|
186
262
|
const onInputBlur = useCallback(
|
|
187
263
|
(e: React.FocusEvent<HTMLInputElement>) => {
|
|
188
264
|
setSearchResultsError(undefined);
|
|
189
|
-
|
|
265
|
+
cancelSearch();
|
|
190
266
|
onBlur?.(e);
|
|
191
267
|
},
|
|
192
|
-
[onBlur],
|
|
193
|
-
);
|
|
194
|
-
|
|
195
|
-
const isMountedRef = useRef(true);
|
|
196
|
-
useEffect(
|
|
197
|
-
() => () => {
|
|
198
|
-
isMountedRef.current = false;
|
|
199
|
-
},
|
|
200
|
-
[],
|
|
268
|
+
[onBlur, cancelSearch],
|
|
201
269
|
);
|
|
202
270
|
|
|
203
271
|
const requestFrameCallback = useRequestFrameCallback();
|
|
204
272
|
const onSelect = useCallback(
|
|
205
273
|
async (option: DropdownLayoutValueOption) => {
|
|
206
274
|
const index = Number(option.id);
|
|
207
|
-
const
|
|
275
|
+
const suggestion = searchResults[index];
|
|
208
276
|
|
|
209
|
-
if (!
|
|
277
|
+
if (!suggestion) {
|
|
210
278
|
return;
|
|
211
279
|
}
|
|
212
280
|
|
|
213
281
|
onInput?.();
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
282
|
+
cancelSearch();
|
|
283
|
+
const requestId = requestIdRef.current;
|
|
284
|
+
const isCurrent = () =>
|
|
285
|
+
isMountedRef.current && requestId === requestIdRef.current;
|
|
286
|
+
setIsSearching(true);
|
|
287
|
+
try {
|
|
288
|
+
const resolvedAddress = suggestion.searchId
|
|
289
|
+
? await atlas.getAddress?.(suggestion.searchId)
|
|
290
|
+
: suggestion.address;
|
|
291
|
+
if (!isCurrent()) {
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
if (!resolvedAddress) {
|
|
295
|
+
throw new Error('Address could not be resolved');
|
|
296
|
+
}
|
|
297
|
+
const selectedAddress = {
|
|
298
|
+
...resolvedAddress,
|
|
299
|
+
formatted: resolvedAddress.formatted || suggestion.formatted,
|
|
300
|
+
};
|
|
301
|
+
setAddress(atlasAddressToAddress(selectedAddress));
|
|
302
|
+
setInputValue(selectedAddress.formatted);
|
|
303
|
+
triggerOnChange(selectedAddress);
|
|
304
|
+
requestFrameCallback(() => {
|
|
305
|
+
if (isCurrent()) {
|
|
306
|
+
onSelectAddress();
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
} catch (error) {
|
|
310
|
+
if (isCurrent()) {
|
|
311
|
+
setSearchResultsError(
|
|
312
|
+
error instanceof Error ? error : new Error(String(error)),
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
} finally {
|
|
316
|
+
if (isCurrent()) {
|
|
317
|
+
setIsSearching(false);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
217
320
|
},
|
|
218
321
|
[
|
|
219
322
|
onInput,
|
|
323
|
+
atlas,
|
|
324
|
+
cancelSearch,
|
|
220
325
|
onSelectAddress,
|
|
221
326
|
requestFrameCallback,
|
|
222
327
|
searchResults,
|
|
328
|
+
setAddress,
|
|
223
329
|
setInputValue,
|
|
224
330
|
triggerOnChange,
|
|
225
331
|
],
|
|
@@ -281,15 +387,12 @@ export const AddressInput = forwardRef<
|
|
|
281
387
|
|
|
282
388
|
const options = useMemo(
|
|
283
389
|
() =>
|
|
284
|
-
searchResults.map((
|
|
285
|
-
const [mainLabel, ...secondaryLabelParts] =
|
|
286
|
-
addr?.formatted?.split(', ') ?? [];
|
|
287
|
-
|
|
390
|
+
searchResults.map((suggestion, index) => {
|
|
288
391
|
return addressInputItemBuilder({
|
|
289
392
|
id: index,
|
|
290
|
-
displayLabel:
|
|
291
|
-
mainLabel: mainLabel
|
|
292
|
-
secondaryLabel:
|
|
393
|
+
displayLabel: suggestion.formatted,
|
|
394
|
+
mainLabel: suggestion.mainLabel,
|
|
395
|
+
secondaryLabel: suggestion.secondaryLabel,
|
|
293
396
|
optionLayout: 'single-line',
|
|
294
397
|
});
|
|
295
398
|
}),
|
|
@@ -297,7 +400,16 @@ export const AddressInput = forwardRef<
|
|
|
297
400
|
);
|
|
298
401
|
|
|
299
402
|
return (
|
|
300
|
-
<div
|
|
403
|
+
<div
|
|
404
|
+
onMouseDown={onMouseDown}
|
|
405
|
+
onKeyDown={onKeyDown}
|
|
406
|
+
onKeyDownCapture={(event) => {
|
|
407
|
+
// The dropdown can stop Escape before it reaches onKeyDown.
|
|
408
|
+
if (event.key === 'Escape') {
|
|
409
|
+
cancelSearch();
|
|
410
|
+
}
|
|
411
|
+
}}
|
|
412
|
+
>
|
|
301
413
|
<WDSAddressInput
|
|
302
414
|
dataHook="address-input"
|
|
303
415
|
{...props}
|
|
@@ -313,6 +425,7 @@ export const AddressInput = forwardRef<
|
|
|
313
425
|
onBlur={onInputBlur}
|
|
314
426
|
autoSelect={false}
|
|
315
427
|
status={inputStatus}
|
|
428
|
+
size="small"
|
|
316
429
|
/>
|
|
317
430
|
</div>
|
|
318
431
|
);
|
|
@@ -5,7 +5,7 @@ import { classesRuntime, statesRuntime } from "../../../../stylable-esm-runtime.
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "actionsmenu372674477";
|
|
9
9
|
var _style_ = classesRuntime.bind(null, _namespace_);
|
|
10
10
|
|
|
11
11
|
export var cssStates = statesRuntime.bind(null, _namespace_);
|
|
@@ -13,7 +13,7 @@ export var style: import("@stylable/runtime").STFunction = _style_;
|
|
|
13
13
|
export var st: import("@stylable/runtime").STFunction = _style_;
|
|
14
14
|
|
|
15
15
|
export var namespace = _namespace_;
|
|
16
|
-
export var classes = {"root":"
|
|
16
|
+
export var classes = {"root":"actionsmenu372674477__root","action":"actionsmenu372674477__action"};
|
|
17
17
|
export var keyframes = {};
|
|
18
18
|
export var layers = {};
|
|
19
19
|
export var containers = {};
|
|
@@ -7,8 +7,8 @@ export function ControlledAudioInputUniDriver(
|
|
|
7
7
|
base: UniDriver,
|
|
8
8
|
body: UniDriver,
|
|
9
9
|
) {
|
|
10
|
-
// The dataHook sits on the AddItem in the empty
|
|
11
|
-
// in the filled one, so `base` is either.
|
|
10
|
+
// The dataHook sits on the AddItem in the empty and loading states and on the
|
|
11
|
+
// wrapper Box in the filled one, so `base` is either.
|
|
12
12
|
const addItem = AddItemUniDriver(base, body);
|
|
13
13
|
const moreButton = base.$('[data-hook="fromAudioInput.button.more"]');
|
|
14
14
|
const deleteAction = body.$('[data-hook="fromAudioInput.button.delete"]');
|
|
@@ -23,6 +23,7 @@ export function ControlledAudioInputUniDriver(
|
|
|
23
23
|
getAddButtonText: () => base.text(),
|
|
24
24
|
clickAddButton: () => addItem.click(),
|
|
25
25
|
isAddButtonFocused: () => addItem.isFocused(),
|
|
26
|
+
isLoading: () => base.$('[data-hook="fromAudioInput.loader"]').exists(),
|
|
26
27
|
getAudioName: () => base.$('[data-hook="fromAudioInput.audioName"]').text(),
|
|
27
28
|
audioPlayerExists: () =>
|
|
28
29
|
base.$('[data-hook="fromAudioInput.player"]').exists(),
|
|
@@ -5,7 +5,7 @@ import { classesRuntime, statesRuntime } from "../../../stylable-esm-runtime.js"
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "formaudiofield127042580";
|
|
9
9
|
var _style_ = classesRuntime.bind(null, _namespace_);
|
|
10
10
|
|
|
11
11
|
export var cssStates = statesRuntime.bind(null, _namespace_);
|
|
@@ -13,7 +13,7 @@ export var style: import("@stylable/runtime").STFunction = _style_;
|
|
|
13
13
|
export var st: import("@stylable/runtime").STFunction = _style_;
|
|
14
14
|
|
|
15
15
|
export var namespace = _namespace_;
|
|
16
|
-
export var classes = {"root":"
|
|
16
|
+
export var classes = {"root":"formaudiofield127042580__root","addItem":"formaudiofield127042580__addItem","mediaTitle":"formaudiofield127042580__mediaTitle"};
|
|
17
17
|
export var keyframes = {};
|
|
18
18
|
export var layers = {};
|
|
19
19
|
export var containers = {};
|