@wix/patterns-fields 1.73.0 → 1.75.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/form-address.js +5 -3
- package/dist/cjs/components/address/form-address.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/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-field/form-audio.js +5 -3
- package/dist/cjs/components/audio/audio-field/form-audio.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/boolean/form-checkbox-input.js +40 -0
- package/dist/cjs/components/boolean/form-checkbox-input.js.map +1 -0
- package/dist/cjs/components/boolean/form-checkbox.js +6 -5
- package/dist/cjs/components/boolean/form-checkbox.js.map +1 -1
- package/dist/cjs/components/boolean/index.js +6 -0
- package/dist/cjs/components/boolean/index.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-input.js +6 -5
- package/dist/cjs/components/color-view/color-input.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/color-view/form-color.driver.js +8 -2
- package/dist/cjs/components/color-view/form-color.driver.js.map +1 -1
- package/dist/cjs/components/controlled-input.driver.js +16 -0
- package/dist/cjs/components/controlled-input.driver.js.map +1 -0
- package/dist/cjs/components/datetime-input/form-date-time.driver.js +4 -1
- package/dist/cjs/components/datetime-input/form-date-time.driver.js.map +1 -1
- package/dist/cjs/components/datetime-input/form-date-time.js +1 -0
- package/dist/cjs/components/datetime-input/form-date-time.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/document/form-document.js +5 -3
- package/dist/cjs/components/document/form-document.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/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/form-image-input.js +6 -4
- package/dist/cjs/components/image/form-image-input.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-gallery/form-media-gallery.js +5 -3
- package/dist/cjs/components/media-gallery/form-media-gallery.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-loader/media-loader.st.css.js +3 -3
- package/dist/cjs/components/media-loader/media-loader.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.js +5 -3
- package/dist/cjs/components/multi-document/multi-document-input/form-multi-document.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/number-input/form-number-input.js +38 -0
- package/dist/cjs/components/number-input/form-number-input.js.map +1 -0
- package/dist/cjs/components/number-input/form-number.js +7 -5
- package/dist/cjs/components/number-input/form-number.js.map +1 -1
- package/dist/cjs/components/number-input/index.js +6 -0
- package/dist/cjs/components/number-input/index.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 +15 -7
- package/dist/cjs/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.js +11 -7
- 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.js +18 -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 +32 -19
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js +20 -12
- 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.js +18 -18
- 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/form-short-text-input.js +97 -0
- package/dist/cjs/components/text/form-short-text-input.js.map +1 -0
- package/dist/cjs/components/text/form-short-text.driver.js +1 -0
- package/dist/cjs/components/text/form-short-text.driver.js.map +1 -1
- package/dist/cjs/components/text/form-short-text.js +18 -80
- package/dist/cjs/components/text/form-short-text.js.map +1 -1
- package/dist/cjs/components/text/index.js +6 -0
- package/dist/cjs/components/text/index.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/time-input/form-time.js +9 -10
- package/dist/cjs/components/time-input/form-time.js.map +1 -1
- package/dist/cjs/components/url/form-url-input.js +55 -0
- package/dist/cjs/components/url/form-url-input.js.map +1 -0
- package/dist/cjs/components/url/form-url.js +6 -20
- package/dist/cjs/components/url/form-url.js.map +1 -1
- package/dist/cjs/components/url/index.js +6 -0
- package/dist/cjs/components/url/index.js.map +1 -1
- package/dist/cjs/components/video/form-video.js +30 -29
- package/dist/cjs/components/video/form-video.js.map +1 -1
- package/dist/cjs/exports/unidriver.js +3 -1
- package/dist/cjs/exports/unidriver.js.map +1 -1
- package/dist/cjs/hooks/index.js +6 -0
- package/dist/cjs/hooks/index.js.map +1 -1
- package/dist/cjs/hooks/pr-5746-kobiburnley-comments.md +54 -0
- package/dist/cjs/hooks/use-field-ref.js +60 -0
- package/dist/cjs/hooks/use-field-ref.js.map +1 -0
- package/dist/cjs/hooks/use-scroll-to-error-ref.js +15 -15
- package/dist/cjs/hooks/use-scroll-to-error-ref.js.map +1 -1
- package/dist/cjs/styles.global.css +1 -1
- package/dist/cjs/types/controlled-input.js +4 -0
- package/dist/cjs/types/controlled-input.js.map +1 -0
- package/dist/esm/components/address/form-address.js +3 -1
- package/dist/esm/components/address/form-address.js.map +1 -1
- package/dist/esm/components/address/input/address-input.st.css.js +2 -2
- package/dist/esm/components/address/input/address-input.st.css.js.map +1 -1
- 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/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-field/form-audio.js +3 -1
- package/dist/esm/components/audio/audio-field/form-audio.js.map +1 -1
- package/dist/esm/components/audio/audio-player/audio-player.st.css.js +2 -2
- package/dist/esm/components/boolean/form-checkbox-input.js +10 -0
- package/dist/esm/components/boolean/form-checkbox-input.js.map +1 -0
- package/dist/esm/components/boolean/form-checkbox.js +2 -2
- package/dist/esm/components/boolean/form-checkbox.js.map +1 -1
- package/dist/esm/components/boolean/index.js +1 -0
- package/dist/esm/components/boolean/index.js.map +1 -1
- package/dist/esm/components/color-view/cell-color-view.st.css.js +2 -2
- package/dist/esm/components/color-view/color-input.js +1 -1
- package/dist/esm/components/color-view/color-input.js.map +1 -1
- package/dist/esm/components/color-view/color-view.st.css.js +2 -2
- package/dist/esm/components/color-view/form-color.driver.js +8 -2
- package/dist/esm/components/color-view/form-color.driver.js.map +1 -1
- package/dist/esm/components/controlled-input.driver.js +12 -0
- package/dist/esm/components/controlled-input.driver.js.map +1 -0
- package/dist/esm/components/datetime-input/form-date-time.driver.js +3 -0
- package/dist/esm/components/datetime-input/form-date-time.driver.js.map +1 -1
- package/dist/esm/components/datetime-input/form-date-time.js +1 -1
- package/dist/esm/components/datetime-input/form-date-time.js.map +1 -1
- package/dist/esm/components/delete-dialog/delete-dialog.st.css.js +2 -2
- package/dist/esm/components/document/form-document-field.st.css.js +2 -2
- package/dist/esm/components/document/form-document.js +3 -1
- package/dist/esm/components/document/form-document.js.map +1 -1
- package/dist/esm/components/exclamation/exclamation.st.css.js +2 -2
- package/dist/esm/components/highlighted-text/highlighted-text.st.css.js +3 -3
- package/dist/esm/components/image/form-image-input.js +3 -1
- package/dist/esm/components/image/form-image-input.js.map +1 -1
- package/dist/esm/components/image/thumbnail-replace-overlay.st.css.js +2 -2
- package/dist/esm/components/image/thumbnail-replace-overlay.st.css.js.map +1 -1
- package/dist/esm/components/media-control/cell-media-edit-shell.st.css.js +2 -2
- package/dist/esm/components/media-control/cell-media-edit-shell.st.css.js.map +1 -1
- 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.js +3 -1
- package/dist/esm/components/media-gallery/form-media-gallery.js.map +1 -1
- package/dist/esm/components/media-image/media-image.st.css.js +3 -3
- package/dist/esm/components/media-image/overlays/overlay.st.css.js +2 -2
- package/dist/esm/components/media-loader/media-loader.st.css.js +2 -2
- package/dist/esm/components/media-loader/media-loader.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/multi-document-input/form-multi-document.js +3 -1
- package/dist/esm/components/multi-document/multi-document-input/form-multi-document.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/number-input/form-number-input.js +5 -0
- package/dist/esm/components/number-input/form-number-input.js.map +1 -0
- package/dist/esm/components/number-input/form-number.js +3 -2
- package/dist/esm/components/number-input/form-number.js.map +1 -1
- package/dist/esm/components/number-input/index.js +1 -0
- package/dist/esm/components/number-input/index.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 +15 -7
- 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/form-read-only-input/rich-content-form-read-only-input.st.css.js.map +1 -1
- 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/fullscreen-modal/fullscreen-modal.st.css.js.map +1 -1
- 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-editor/rich-content-editor.st.css.js +2 -2
- 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-editor/rich-content-toolbar.st.css.js.map +1 -1
- 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.js +2 -2
- package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css +32 -19
- 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.js +2 -2
- 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/form-short-text-input.js +41 -0
- package/dist/esm/components/text/form-short-text-input.js.map +1 -0
- package/dist/esm/components/text/form-short-text.driver.js +3 -0
- package/dist/esm/components/text/form-short-text.driver.js.map +1 -1
- package/dist/esm/components/text/form-short-text.js +8 -40
- package/dist/esm/components/text/form-short-text.js.map +1 -1
- package/dist/esm/components/text/index.js +1 -0
- package/dist/esm/components/text/index.js.map +1 -1
- package/dist/esm/components/text/text-view.st.css.js +2 -2
- package/dist/esm/components/text/text-view.st.css.js.map +1 -1
- package/dist/esm/components/time-input/form-time.js +4 -3
- package/dist/esm/components/time-input/form-time.js.map +1 -1
- package/dist/esm/components/url/form-url-input.js +7 -0
- package/dist/esm/components/url/form-url-input.js.map +1 -0
- package/dist/esm/components/url/form-url.js +3 -4
- package/dist/esm/components/url/form-url.js.map +1 -1
- package/dist/esm/components/url/index.js +1 -0
- package/dist/esm/components/url/index.js.map +1 -1
- package/dist/esm/components/video/form-video.js +3 -2
- package/dist/esm/components/video/form-video.js.map +1 -1
- package/dist/esm/exports/unidriver.js +1 -0
- package/dist/esm/exports/unidriver.js.map +1 -1
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/pr-5746-kobiburnley-comments.md +54 -0
- package/dist/esm/hooks/use-field-ref.js +36 -0
- package/dist/esm/hooks/use-field-ref.js.map +1 -0
- package/dist/esm/hooks/use-scroll-to-error-ref.js +12 -12
- package/dist/esm/hooks/use-scroll-to-error-ref.js.map +1 -1
- package/dist/esm/styles.global.css +1 -1
- package/dist/esm/types/controlled-input.js +2 -0
- package/dist/esm/types/controlled-input.js.map +1 -0
- package/dist/types/components/address/form-address.d.ts.map +1 -1
- package/dist/types/components/address/input/address-input.st.css.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/form-audio-field.st.css.d.ts.map +1 -1
- package/dist/types/components/audio/audio-field/form-audio.d.ts.map +1 -1
- package/dist/types/components/boolean/form-checkbox-input.d.ts +7 -0
- package/dist/types/components/boolean/form-checkbox-input.d.ts.map +1 -0
- package/dist/types/components/boolean/form-checkbox.d.ts.map +1 -1
- package/dist/types/components/boolean/index.d.ts +1 -0
- package/dist/types/components/boolean/index.d.ts.map +1 -1
- package/dist/types/components/color-view/color-input.d.ts.map +1 -1
- package/dist/types/components/color-view/form-color.driver.d.ts +5 -15
- package/dist/types/components/color-view/form-color.driver.d.ts.map +1 -1
- package/dist/types/components/controlled-input.driver.d.ts +502 -0
- package/dist/types/components/controlled-input.driver.d.ts.map +1 -0
- package/dist/types/components/datetime-input/form-date-time.driver.d.ts +1 -0
- package/dist/types/components/datetime-input/form-date-time.driver.d.ts.map +1 -1
- package/dist/types/components/document/form-document.d.ts.map +1 -1
- package/dist/types/components/image/form-image-input.d.ts.map +1 -1
- package/dist/types/components/image/thumbnail-replace-overlay.st.css.d.ts.map +1 -1
- package/dist/types/components/media-control/cell-media-edit-shell.st.css.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.d.ts.map +1 -1
- package/dist/types/components/media-loader/media-loader.st.css.d.ts.map +1 -1
- package/dist/types/components/multi-document/multi-document-input/form-multi-document.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/number-input/form-number-input.d.ts +9 -0
- package/dist/types/components/number-input/form-number-input.d.ts.map +1 -0
- package/dist/types/components/number-input/form-number.d.ts.map +1 -1
- package/dist/types/components/number-input/index.d.ts +1 -0
- package/dist/types/components/number-input/index.d.ts.map +1 -1
- package/dist/types/components/rich-content/rich-content-input/form-input/rich-content-form-input.st.css.d.ts +7 -3
- 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/form-read-only-input/rich-content-form-read-only-input.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.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 +16 -8
- 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.map +1 -1
- package/dist/types/components/text/form-short-text-input.d.ts +15 -0
- package/dist/types/components/text/form-short-text-input.d.ts.map +1 -0
- package/dist/types/components/text/form-short-text.d.ts.map +1 -1
- package/dist/types/components/text/form-short-text.driver.d.ts +1 -0
- package/dist/types/components/text/form-short-text.driver.d.ts.map +1 -1
- package/dist/types/components/text/index.d.ts +1 -0
- package/dist/types/components/text/index.d.ts.map +1 -1
- package/dist/types/components/text/text-view.st.css.d.ts.map +1 -1
- package/dist/types/components/time-input/form-time.d.ts.map +1 -1
- package/dist/types/components/url/form-url-input.d.ts +8 -0
- package/dist/types/components/url/form-url-input.d.ts.map +1 -0
- package/dist/types/components/url/form-url.d.ts.map +1 -1
- package/dist/types/components/url/index.d.ts +1 -0
- package/dist/types/components/url/index.d.ts.map +1 -1
- package/dist/types/components/video/form-video.d.ts.map +1 -1
- package/dist/types/exports/unidriver.d.ts +1 -0
- package/dist/types/exports/unidriver.d.ts.map +1 -1
- package/dist/types/hooks/index.d.ts +1 -0
- package/dist/types/hooks/index.d.ts.map +1 -1
- package/dist/types/hooks/use-field-ref.d.ts +36 -0
- package/dist/types/hooks/use-field-ref.d.ts.map +1 -0
- package/dist/types/hooks/use-scroll-to-error-ref.d.ts +5 -5
- package/dist/types/hooks/use-scroll-to-error-ref.d.ts.map +1 -1
- package/dist/types/types/controlled-input.d.ts +10 -0
- package/dist/types/types/controlled-input.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/__tests__/components/color-view/form-color.spec.tsx +46 -3
- package/src/__tests__/components/rich-editors-border.spec.ts +45 -0
- package/src/__tests__/components/text/form-short-text.spec.tsx +18 -0
- package/src/__tests__/exports/controlled-inputs.spec.tsx +138 -0
- package/src/__tests__/hooks/use-field-ref.spec.tsx +132 -0
- package/src/components/address/form-address.tsx +4 -1
- package/src/components/address/input/address-input.st.css.ts +2 -2
- package/src/components/audio/actions/actions-menu/actions-menu.st.css.ts +2 -2
- package/src/components/audio/audio-field/form-audio-field.st.css.ts +2 -2
- package/src/components/audio/audio-field/form-audio.tsx +4 -1
- package/src/components/audio/audio-player/audio-player.st.css.ts +2 -2
- package/src/components/boolean/form-checkbox-input.tsx +40 -0
- package/src/components/boolean/form-checkbox.tsx +6 -7
- package/src/components/boolean/index.ts +1 -0
- package/src/components/color-view/cell-color-view.st.css.ts +2 -2
- package/src/components/color-view/color-input.tsx +13 -2
- package/src/components/color-view/color-view.st.css.ts +2 -2
- package/src/components/color-view/form-color.driver.ts +8 -2
- package/src/components/controlled-input.driver.ts +19 -0
- package/src/components/datetime-input/form-date-time.driver.ts +3 -0
- package/src/components/datetime-input/form-date-time.tsx +1 -1
- 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/document/form-document.tsx +4 -1
- package/src/components/exclamation/exclamation.st.css.ts +2 -2
- package/src/components/highlighted-text/highlighted-text.st.css.ts +3 -3
- package/src/components/image/form-image-input.tsx +4 -1
- 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-gallery/form-media-gallery.tsx +4 -1
- 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-loader/media-loader.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/multi-document/multi-document-input/form-multi-document.tsx +4 -1
- package/src/components/number-input/form-number-input.tsx +37 -0
- package/src/components/number-input/form-number.tsx +6 -4
- package/src/components/number-input/index.ts +1 -0
- 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 +15 -7
- 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.ts +2 -2
- package/src/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css +32 -19
- 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.ts +2 -2
- package/src/components/text/form-short-text-input.tsx +121 -0
- package/src/components/text/form-short-text.driver.ts +4 -0
- package/src/components/text/form-short-text.tsx +20 -108
- package/src/components/text/index.ts +1 -0
- package/src/components/text/text-view.st.css.ts +2 -2
- package/src/components/time-input/form-time.tsx +9 -3
- package/src/components/url/form-url-input.tsx +42 -0
- package/src/components/url/form-url.tsx +7 -11
- package/src/components/url/index.ts +1 -0
- package/src/components/video/form-video.tsx +4 -2
- package/src/exports/unidriver.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/pr-5746-kobiburnley-comments.md +54 -0
- package/src/hooks/use-field-ref.ts +65 -0
- package/src/hooks/use-scroll-to-error-ref.ts +15 -10
- package/src/styles.global.css +1 -1
- package/src/types/controlled-input.ts +9 -0
package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import { classesRuntime, statesRuntime } from "../../../../stylable-esm-runtime.js";
|
|
3
|
-
var _namespace_ = "
|
|
3
|
+
var _namespace_ = "richtexteditor1211455191";
|
|
4
4
|
var _style_ = classesRuntime.bind(null, _namespace_);
|
|
5
5
|
export var cssStates = statesRuntime.bind(null, _namespace_);
|
|
6
6
|
export var style = _style_;
|
|
7
7
|
export var st = _style_;
|
|
8
8
|
export var namespace = _namespace_;
|
|
9
|
-
export var classes = { "root": "
|
|
9
|
+
export var classes = { "root": "richtexteditor1211455191__root", "nativeInput": "richtexteditor1211455191__nativeInput", "editor": "richtexteditor1211455191__editor" };
|
|
10
10
|
export var keyframes = {};
|
|
11
11
|
export var layers = {};
|
|
12
12
|
export var containers = {};
|
|
13
13
|
export var stVars = {};
|
|
14
|
-
export var vars = { "wds-color-
|
|
14
|
+
export var vars = { "wds-input-border-color": "--wds-input-border-color", "wds-input-border-color-focus": "--wds-input-border-color-focus", "wds-input-shadow-focus-standard": "--wds-input-shadow-focus-standard", "wds-input-shadow-focus-destructive": "--wds-input-shadow-focus-destructive", "wds-input-shadow-focus-warning": "--wds-input-shadow-focus-warning", "wds-input-border-radius-default-medium": "--wds-input-border-radius-default-medium", "wds-color-border-destructive-secondary-active": "--wds-color-border-destructive-secondary-active", "wds-color-border-warning-secondary-active": "--wds-color-border-warning-secondary-active", "wsr-color-B10": "--wsr-color-B10", "wsr-color-B40": "--wsr-color-B40", "wsr-color-R10": "--wsr-color-R10", "wsr-color-R40": "--wsr-color-R40", "wsr-color-Y10": "--wsr-color-Y10", "wsr-color-Y40": "--wsr-color-Y40", "wsr-color-F00": "--wsr-color-F00", "wsr-border-radius-06": "--wsr-border-radius-06", "wds-color-black-700": "--wds-color-black-700" };
|
|
15
15
|
//# sourceMappingURL=rich-text-editor.st.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rich-text-editor.st.css.js","sourceRoot":"","sources":["../../../../../../src/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.ts"],"names":[],"mappings":"AAAA,cAAc;AAGd,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAIpF,IAAI,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"rich-text-editor.st.css.js","sourceRoot":"","sources":["../../../../../../src/components/rich-text/rich-text-input/rich-text-editor/rich-text-editor.st.css.ts"],"names":[],"mappings":"AAAA,cAAc;AAGd,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAIpF,IAAI,WAAW,GAAG,0BAA0B,CAAC;AAC7C,IAAI,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAErD,MAAM,CAAC,IAAI,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAC7D,MAAM,CAAC,IAAI,KAAK,GAA2C,OAAO,CAAC;AACnE,MAAM,CAAC,IAAI,EAAE,GAA2C,OAAO,CAAC;AAEhE,MAAM,CAAC,IAAI,SAAS,GAAG,WAAW,CAAC;AACnC,MAAM,CAAC,IAAI,OAAO,GAAG,EAAC,MAAM,EAAC,gCAAgC,EAAC,aAAa,EAAC,uCAAuC,EAAC,QAAQ,EAAC,kCAAkC,EAAC,CAAC;AACjK,MAAM,CAAC,IAAI,SAAS,GAAG,EAAE,CAAC;AAC1B,MAAM,CAAC,IAAI,MAAM,GAAG,EAAE,CAAC;AACvB,MAAM,CAAC,IAAI,UAAU,GAAG,EAAE,CAAC;AAC3B,MAAM,CAAC,IAAI,MAAM,GAAG,EAAE,CAAC;AACvB,MAAM,CAAC,IAAI,IAAI,GAAG,EAAC,wBAAwB,EAAC,0BAA0B,EAAC,8BAA8B,EAAC,gCAAgC,EAAC,iCAAiC,EAAC,mCAAmC,EAAC,oCAAoC,EAAC,sCAAsC,EAAC,gCAAgC,EAAC,kCAAkC,EAAC,wCAAwC,EAAC,0CAA0C,EAAC,+CAA+C,EAAC,iDAAiD,EAAC,2CAA2C,EAAC,6CAA6C,EAAC,eAAe,EAAC,iBAAiB,EAAC,eAAe,EAAC,iBAAiB,EAAC,eAAe,EAAC,iBAAiB,EAAC,eAAe,EAAC,iBAAiB,EAAC,eAAe,EAAC,iBAAiB,EAAC,eAAe,EAAC,iBAAiB,EAAC,eAAe,EAAC,iBAAiB,EAAC,sBAAsB,EAAC,wBAAwB,EAAC,qBAAqB,EAAC,uBAAuB,EAAC,CAAC"}
|
package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import { classesRuntime, statesRuntime } from "../../../../../stylable-esm-runtime.js";
|
|
3
|
-
var _namespace_ = "
|
|
3
|
+
var _namespace_ = "toolbar904415871";
|
|
4
4
|
var _style_ = classesRuntime.bind(null, _namespace_);
|
|
5
5
|
export var cssStates = statesRuntime.bind(null, _namespace_);
|
|
6
6
|
export var style = _style_;
|
|
7
7
|
export var st = _style_;
|
|
8
8
|
export var namespace = _namespace_;
|
|
9
|
-
export var classes = { "root": "
|
|
9
|
+
export var classes = { "root": "toolbar904415871__root", "item": "toolbar904415871__item", "separator": "toolbar904415871__separator", "clearFormatting": "toolbar904415871__clearFormatting", "fullScreen": "toolbar904415871__fullScreen", "dropdownItemContent": "toolbar904415871__dropdownItemContent", "dropdownItemTitle": "toolbar904415871__dropdownItemTitle", "dropdownItemSubtitle": "toolbar904415871__dropdownItemSubtitle", "dropdownHeaderOne": "toolbar904415871__dropdownHeaderOne", "dropdownHeaderTwo": "toolbar904415871__dropdownHeaderTwo", "dropdownHeaderThree": "toolbar904415871__dropdownHeaderThree", "dropdownHeaderFour": "toolbar904415871__dropdownHeaderFour", "dropdownHeaderFive": "toolbar904415871__dropdownHeaderFive", "dropdownHeaderSix": "toolbar904415871__dropdownHeaderSix", "dropdownParagraphOne": "toolbar904415871__dropdownParagraphOne", "dropdownNormalText": "toolbar904415871__dropdownNormalText", "dropdownParagraphThree": "toolbar904415871__dropdownParagraphThree" };
|
|
10
10
|
export var keyframes = {};
|
|
11
11
|
export var layers = {};
|
|
12
12
|
export var containers = {};
|
package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toolbar.st.css.js","sourceRoot":"","sources":["../../../../../../../src/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.ts"],"names":[],"mappings":"AAAA,cAAc;AAGd,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAIvF,IAAI,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"toolbar.st.css.js","sourceRoot":"","sources":["../../../../../../../src/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.ts"],"names":[],"mappings":"AAAA,cAAc;AAGd,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,wCAAwC,CAAC;AAIvF,IAAI,WAAW,GAAG,kBAAkB,CAAC;AACrC,IAAI,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI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AC,mBAAmB,EAAC,qBAAqB,EAAC,0BAA0B,EAAC,4BAA4B,EAAC,eAAe,EAAC,iBAAiB,EAAC,eAAe,EAAC,iBAAiB,EAAC,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React, { useCallback, useMemo, useState } from 'react';
|
|
2
|
+
import { AutoComplete, Input, listItemSelectBuilder, } from '@wix/design-system';
|
|
3
|
+
export const FormShortTextInput = ({ data, onChange, onBlur, readOnly, autoFocus, invalid, dataHook, options, required, placeholder, emptyStateMessage, inputRef, }) => {
|
|
4
|
+
const [searchValue, setSearchValue] = useState();
|
|
5
|
+
const selectedOption = options?.find((option) => option.id === data);
|
|
6
|
+
const selectedId = selectedOption?.id;
|
|
7
|
+
const displayValue = searchValue ?? selectedOption?.value ?? data;
|
|
8
|
+
const dropdownOptions = useMemo(() => {
|
|
9
|
+
const source = searchValue
|
|
10
|
+
? options?.filter((option) => option.value.toLowerCase().includes(searchValue.toLowerCase()))
|
|
11
|
+
: options;
|
|
12
|
+
return (source ?? []).map((option) => listItemSelectBuilder({
|
|
13
|
+
id: option.id,
|
|
14
|
+
title: option.value,
|
|
15
|
+
selected: option.id === selectedId,
|
|
16
|
+
}));
|
|
17
|
+
}, [options, searchValue, selectedId]);
|
|
18
|
+
const handleSelect = useCallback((option) => {
|
|
19
|
+
onChange(String(option.id));
|
|
20
|
+
setSearchValue(undefined);
|
|
21
|
+
}, [onChange]);
|
|
22
|
+
const handleSearch = useCallback((event) => {
|
|
23
|
+
setSearchValue(event.target.value);
|
|
24
|
+
if (!event.target.value) {
|
|
25
|
+
onChange('');
|
|
26
|
+
}
|
|
27
|
+
}, [onChange]);
|
|
28
|
+
const handleBlur = useCallback(() => {
|
|
29
|
+
setSearchValue(undefined);
|
|
30
|
+
onBlur?.();
|
|
31
|
+
}, [onBlur]);
|
|
32
|
+
if (!options?.length) {
|
|
33
|
+
return (React.createElement(Input, { value: data, onChange: (event) => onChange(event.target.value), onBlur: onBlur, readOnly: readOnly, autoFocus: autoFocus, status: invalid ? 'error' : undefined, inputRef: inputRef, placeholder: placeholder, dataHook: dataHook }));
|
|
34
|
+
}
|
|
35
|
+
return (React.createElement(AutoComplete, { value: displayValue, selectedId: selectedId, options: dropdownOptions, onSelect: handleSelect, onChange: handleSearch, onClear: () => {
|
|
36
|
+
onChange('');
|
|
37
|
+
setSearchValue(undefined);
|
|
38
|
+
}, onBlur: handleBlur, disabled: readOnly, autoFocus: autoFocus, status: invalid ? 'error' : undefined, clearButton: !required, placeholder: placeholder, emptyStateMessage: emptyStateMessage, inputRef: inputRef, dataHook: dataHook }));
|
|
39
|
+
};
|
|
40
|
+
FormShortTextInput.displayName = 'FormShortTextInput';
|
|
41
|
+
//# sourceMappingURL=form-short-text-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-short-text-input.js","sourceRoot":"","sources":["../../../../src/components/text/form-short-text-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC9D,OAAO,EACL,YAAY,EACZ,KAAK,EACL,qBAAqB,GAEtB,MAAM,oBAAoB,CAAC;AAiB5B,MAAM,CAAC,MAAM,kBAAkB,GAAsC,CAAC,EACpE,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,WAAW,EACX,iBAAiB,EACjB,QAAQ,GACT,EAAE,EAAE;IACH,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,EAAU,CAAC;IACzD,MAAM,cAAc,GAAG,OAAO,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC;IACrE,MAAM,UAAU,GAAG,cAAc,EAAE,EAAE,CAAC;IACtC,MAAM,YAAY,GAAG,WAAW,IAAI,cA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C,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAEb,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE;QACpB,OAAO,CACL,oBAAC,KAAK,IACJ,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACjD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EACrC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;KACH;IAED,OAAO,CACL,oBAAC,YAAY,IACX,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,eAAe,EACxB,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,YAAY,EACtB,OAAO,EAAE,GAAG,EAAE;YACZ,QAAQ,CAAC,EAAE,CAAC,CAAC;YACb,cAAc,CAAC,SAAS,CAAC,CAAC;QAC5B,CAAC,EACD,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EACrC,WAAW,EAAE,CAAC,QAAQ,EACtB,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,EACpC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAkB,CAAC,WAAW,GAAG,oBAAoB,CAAC"}
|
|
@@ -15,6 +15,9 @@ export function FormShortTextDriver(base, body, field) {
|
|
|
15
15
|
getValue: async () => hasSpecificValues
|
|
16
16
|
? autocomplete.inputDriver.getValue()
|
|
17
17
|
: input.getValue(),
|
|
18
|
+
getPlaceholder: async () => hasSpecificValues
|
|
19
|
+
? autocomplete.inputDriver.getPlaceholder()
|
|
20
|
+
: input.getPlaceholder(),
|
|
18
21
|
enterText: async (value) => hasSpecificValues
|
|
19
22
|
? autocomplete.inputDriver.enterText(value)
|
|
20
23
|
: input.enterText(value),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-short-text.driver.js","sourceRoot":"","sources":["../../../../src/components/text/form-short-text.driver.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,GACf,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,UAAU,mBAAmB,CACjC,IAAe,EACf,IAAe,EACf,KAAY;IAEZ,MAAM,SAAS,GAAG,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjD,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,0BAA0B,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,cAAc,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC9C,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,UAAU,EAAE,cAAc,EAAE,MAAM,CAAC;IACrE,MAAM,YAAY,GAAG,qBAAqB,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAE5D,OAAO;QACL,GAAG,oBAAoB,CAAC,IAAI,CAAC;QAC7B,QAAQ,EAAE,KAAK,IAAI,EAAE;YACnB,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,QAAQ,EAAE,CAAC;YAC3C,OAAO,OAAO,EAAE,WAAW,IAAI,EAAE,CAAC;QACpC,CAAC;QACD,QAAQ,EAAE,KAAK,IAAI,EAAE,CACnB,iBAAiB;YACf,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,EAAE;YACrC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE;QACtB,SAAS,EAAE,KAAK,EAAE,KAAa,EAAE,EAAE,CACjC,iBAAiB;YACf,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC;YAC3C,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC;QAC5B,YAAY,EAAE,CAAC,EAAU,EAAE,EAAE;YAC3B,IAAI,CAAC,iBAAiB,EAAE;gBACtB,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;aACH;YAED,OAAO,YAAY,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;QAClD,CAAC;QACD,IAAI,EAAE,KAAK,IAAI,EAAE,CACf,iBAAiB,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE;QACpE,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC;QAC5C,eAAe,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE;QACnD,gBAAgB,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,aAAa,EAAE;QACjD,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE;KACzC,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"form-short-text.driver.js","sourceRoot":"","sources":["../../../../src/components/text/form-short-text.driver.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EAClB,cAAc,GACf,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,MAAM,UAAU,mBAAmB,CACjC,IAAe,EACf,IAAe,EACf,KAAY;IAEZ,MAAM,SAAS,GAAG,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACjD,MAAM,SAAS,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E,CACf,iBAAiB,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE;QACpE,QAAQ,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,CAAC;QAC5C,eAAe,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,gBAAgB,EAAE;QACnD,gBAAgB,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,aAAa,EAAE;QACjD,UAAU,EAAE,GAAG,EAAE,CAAC,SAAS,CAAC,UAAU,EAAE;KACzC,CAAC;AACJ,CAAC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import React
|
|
2
|
-
import {
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FormField } from '@wix/design-system';
|
|
3
3
|
import { observer } from 'mobx-react-lite';
|
|
4
4
|
import { useWixPatternsContainer } from '@wix/bex-core/react';
|
|
5
5
|
import { useController } from '@wix/bex-core/form';
|
|
6
6
|
import { isEmpty, isLongerThan, isShorterThan } from '../../validations/string';
|
|
7
7
|
import { useTranslations } from '../../hooks/use-translations';
|
|
8
|
+
import { FormShortTextInput } from './form-short-text-input';
|
|
8
9
|
const specificValuesMessage = (displayName) => `${displayName} must be one of the allowed values`;
|
|
9
10
|
const _FormShortText = (props) => {
|
|
10
11
|
const { field, dataHook, formControl, data } = props;
|
|
11
12
|
const { translate: t } = useWixPatternsContainer();
|
|
13
|
+
const { t: tf } = useTranslations();
|
|
12
14
|
const stringLengthRange = field.validation?.stringLengthRange;
|
|
13
15
|
const minLength = stringLengthRange?.minLength;
|
|
14
16
|
const maxLength = stringLengthRange?.maxLength;
|
|
@@ -44,44 +46,10 @@ const _FormShortText = (props) => {
|
|
|
44
46
|
const charCount = maxLength
|
|
45
47
|
? maxLength - controller.field.value?.length
|
|
46
48
|
: undefined;
|
|
47
|
-
return (React.createElement(FormField, { label: field.displayName, required: field.validation?.required, charCount: charCount, status: controller.fieldState.error ? 'error' : undefined, statusMessage: controller.fieldState.error?.message, dataHook: dataHook },
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const [searchValue, setSearchValue] = useState();
|
|
52
|
-
const selectedOption = specificValues.find((option) => option.id === controller.field.value);
|
|
53
|
-
const selectedId = selectedOption ? selectedOption.id : undefined;
|
|
54
|
-
const displayValue = searchValue ?? selectedOption?.value ?? controller.field.value ?? '';
|
|
55
|
-
const options = useMemo(() => {
|
|
56
|
-
const source = searchValue
|
|
57
|
-
? specificValues.filter((option) => option.value.toLowerCase().includes(searchValue.toLowerCase()))
|
|
58
|
-
: specificValues;
|
|
59
|
-
return source.map((option) => listItemSelectBuilder({
|
|
60
|
-
id: option.id,
|
|
61
|
-
title: option.value,
|
|
62
|
-
selected: option.id === selectedId,
|
|
63
|
-
}));
|
|
64
|
-
}, [searchValue, specificValues, selectedId]);
|
|
65
|
-
const handleSelect = useCallback((option) => {
|
|
66
|
-
const id = String(option.id);
|
|
67
|
-
controller.field.onChange(id);
|
|
68
|
-
setSearchValue(undefined);
|
|
69
|
-
}, [controller.field]);
|
|
70
|
-
const handleSearch = useCallback((e) => {
|
|
71
|
-
setSearchValue(e.target.value);
|
|
72
|
-
if (!e.target.value) {
|
|
73
|
-
controller.field.onChange('');
|
|
74
|
-
}
|
|
75
|
-
}, [controller.field]);
|
|
76
|
-
const handleClear = useCallback(() => {
|
|
77
|
-
controller.field.onChange('');
|
|
78
|
-
setSearchValue(undefined);
|
|
79
|
-
}, [controller.field]);
|
|
80
|
-
const handleBlur = useCallback(() => {
|
|
81
|
-
setSearchValue(undefined);
|
|
82
|
-
controller.field.onBlur();
|
|
83
|
-
}, [controller.field]);
|
|
84
|
-
return (React.createElement(AutoComplete, { value: displayValue, selectedId: selectedId, options: options, onSelect: handleSelect, onChange: handleSearch, onClear: handleClear, onBlur: handleBlur, clearButton: !field.validation?.required, placeholder: tf('auto-patterns.fields.select_placeholder'), emptyStateMessage: tf('auto-patterns.fields.no_results_found'), inputRef: controller.field.ref, dataHook: `short-text-${field.id}` }));
|
|
49
|
+
return (React.createElement(FormField, { label: field.displayName, required: field.validation?.required, charCount: charCount, status: controller.fieldState.error ? 'error' : undefined, statusMessage: controller.fieldState.error?.message, dataHook: dataHook },
|
|
50
|
+
React.createElement(FormShortTextInput, { data: controller.field.value ?? '', onChange: controller.field.onChange, onBlur: controller.field.onBlur, options: specificValues, required: field.validation?.required, invalid: Boolean(controller.fieldState.error), placeholder: specificValues?.length
|
|
51
|
+
? tf('auto-patterns.fields.select_placeholder')
|
|
52
|
+
: undefined, emptyStateMessage: tf('auto-patterns.fields.no_results_found'), inputRef: controller.field.ref, dataHook: `short-text-${field.id}` })));
|
|
85
53
|
};
|
|
86
54
|
export const FormShortText = observer(_FormShortText);
|
|
87
55
|
//# sourceMappingURL=form-short-text.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-short-text.js","sourceRoot":"","sources":["../../../../src/components/text/form-short-text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"form-short-text.js","sourceRoot":"","sources":["../../../../src/components/text/form-short-text.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAI7D,MAAM,qBAAqB,GAAG,CAAC,WAAmB,EAAE,EAAE,CACpD,GAA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,GAAG,EAC9B,QAAQ,EAAE,cAAc,KAAK,CAAC,EAAE,EAAE,GAClC,CACQ,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/text/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/text/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
import { classesRuntime, statesRuntime } from "../../stylable-esm-runtime.js";
|
|
3
|
-
var _namespace_ = "
|
|
3
|
+
var _namespace_ = "textview3886369445";
|
|
4
4
|
var _style_ = classesRuntime.bind(null, _namespace_);
|
|
5
5
|
export var cssStates = statesRuntime.bind(null, _namespace_);
|
|
6
6
|
export var style = _style_;
|
|
7
7
|
export var st = _style_;
|
|
8
8
|
export var namespace = _namespace_;
|
|
9
|
-
export var classes = { "root": "
|
|
9
|
+
export var classes = { "root": "textview3886369445__root", "textView": "textview3886369445__textView" };
|
|
10
10
|
export var keyframes = {};
|
|
11
11
|
export var layers = {};
|
|
12
12
|
export var containers = {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-view.st.css.js","sourceRoot":"","sources":["../../../../src/components/text/text-view.st.css.ts"],"names":[],"mappings":"AAAA,cAAc;AAGd,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAI9E,IAAI,WAAW,GAAG,
|
|
1
|
+
{"version":3,"file":"text-view.st.css.js","sourceRoot":"","sources":["../../../../src/components/text/text-view.st.css.ts"],"names":[],"mappings":"AAAA,cAAc;AAGd,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAI9E,IAAI,WAAW,GAAG,oBAAoB,CAAC;AACvC,IAAI,OAAO,GAAG,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAErD,MAAM,CAAC,IAAI,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAC7D,MAAM,CAAC,IAAI,KAAK,GAA2C,OAAO,CAAC;AACnE,MAAM,CAAC,IAAI,EAAE,GAA2C,OAAO,CAAC;AAEhE,MAAM,CAAC,IAAI,SAAS,GAAG,WAAW,CAAC;AACnC,MAAM,CAAC,IAAI,OAAO,GAAG,EAAC,MAAM,EAAC,0BAA0B,EAAC,UAAU,EAAC,8BAA8B,EAAC,CAAC;AACnG,MAAM,CAAC,IAAI,SAAS,GAAG,EAAE,CAAC;AAC1B,MAAM,CAAC,IAAI,MAAM,GAAG,EAAE,CAAC;AACvB,MAAM,CAAC,IAAI,UAAU,GAAG,EAAE,CAAC;AAC3B,MAAM,CAAC,IAAI,MAAM,GAAG,EAAE,CAAC;AACvB,MAAM,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { FormField } from '@wix/design-system';
|
|
|
3
3
|
import { observer } from 'mobx-react-lite';
|
|
4
4
|
import { useWixPatternsContainer } from '@wix/bex-core/react';
|
|
5
5
|
import { useController } from '@wix/bex-core/form';
|
|
6
|
-
import { useTranslations } from '../../hooks';
|
|
6
|
+
import { fieldRefHandle, useTranslations } from '../../hooks';
|
|
7
7
|
import { isDataValidOrNotSet, timeValidation, } from '../../validations/validations';
|
|
8
8
|
import { isEmpty } from '../../validations/string';
|
|
9
9
|
import { TypeMismatchExclamation } from '../exclamation/type-mismatch-exclamation';
|
|
@@ -27,10 +27,11 @@ const _FormTime = (props) => {
|
|
|
27
27
|
});
|
|
28
28
|
// TimeInput has no DOM ref to hand to field.ref, so bridge its imperative
|
|
29
29
|
// focus() — lets react-hook-form's shouldFocusError scroll to this field
|
|
30
|
-
// when it blocks save.
|
|
30
|
+
// when it blocks save. TimeInputImperativeActions has no select(), so the
|
|
31
|
+
// handle absorbs the calls react-hook-form makes beyond focus.
|
|
31
32
|
const timeRef = useRef(null);
|
|
32
33
|
useEffect(() => {
|
|
33
|
-
controller.field.ref(
|
|
34
|
+
controller.field.ref(fieldRefHandle(() => timeRef.current?.focus(), () => timeRef.current));
|
|
34
35
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
36
|
}, []);
|
|
36
37
|
return (React.createElement(FormField, { label: field.displayName, required: field.validation?.required, status: controller.fieldState.error ? 'error' : undefined, statusMessage: controller.fieldState.error?.message, dataHook: dataHook, suffix: isDataValidOrNotSet(controller.field.value, timeValidation) ? undefined : (React.createElement(TypeMismatchExclamation, { typeName: t('auto-patterns.fields.field_type_time_title'), clearButtonText: t('auto-patterns.fields.type_mismatch_clear'), convertButtonText: t('auto-patterns.fields.type_mismatch_convert'), onClear: () => controller.field.onChange(undefined), onChange: (value) => controller.field.onChange(value), convertDisabledText: t('auto-patterns.fields.type_mismatch_convert_disabled'), fieldName: field.displayName, isConverted: false, isConverting: false, convertedValue: "00:00:00.000", tooltipText: t('auto-patterns.fields.type_mismatch_tip', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-time.js","sourceRoot":"","sources":["../../../../src/components/time-input/form-time.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB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4C,CAAC,EAClE,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,CAAC,EACnD,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EACrD,mBAAmB,EAAE,CAAC,CACpB,qDAAqD,CACtD,EACD,SAAS,EAAE,KAAK,CAAC,WAAW,EAC5B,WAAW,EAAE,KAAK,EAClB,YAAY,EAAE,KAAK,EACnB,cAAc,EAAC,cAAc,EAC7B,WAAW,EAAE,CAAC,CAAC,wCAAwC,EAAE;gBACvD,QAAQ,EAAE,MAAM;aACjB,CAAC,GACF,CACH;QAGH,oBAAC,aAAa,IACZ,SAAS,EAAE,KAAK,EAChB,QAAQ,EAAE,OAAO,EACjB,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,KAAK,EAC5B,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,EACrD,QAAQ,EAAE,QAAQ,KAAK,CAAC,EAAE,EAAE,GAC5B,CACQ,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Input } from '@wix/design-system';
|
|
3
|
+
import { Link } from '@wix/wix-ui-icons-common/lazy';
|
|
4
|
+
export const FormUrlInput = ({ data, onChange, onBlur, readOnly, autoFocus, invalid, dataHook, inputRef, placeholder, }) => (React.createElement(Input, { prefix: React.createElement(Input.IconAffix, null,
|
|
5
|
+
React.createElement(Link, null)), type: "url", value: data, onChange: (event) => onChange(event.target.value), onBlur: onBlur, readOnly: readOnly, autoFocus: autoFocus, status: invalid ? 'error' : undefined, inputRef: inputRef, placeholder: placeholder, dataHook: dataHook }));
|
|
6
|
+
FormUrlInput.displayName = 'FormUrlInput';
|
|
7
|
+
//# sourceMappingURL=form-url-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-url-input.js","sourceRoot":"","sources":["../../../../src/components/url/form-url-input.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,IAAI,EAAE,MAAM,+BAA+B,CAAC;AASrD,MAAM,CAAC,MAAM,YAAY,GAAgC,CAAC,EACxD,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,WAAW,GACZ,EAAE,EAAE,CAAC,CACJ,oBAAC,KAAK,IACJ,MAAM,EACJ,oBAAC,KAAK,CAAC,SAAS;QACd,oBAAC,IAAI,OAAG,CACQ,EAEpB,IAAI,EAAC,KAAK,EACV,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,EACjD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EACrC,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC;AAEF,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { FormField
|
|
2
|
+
import { FormField } from '@wix/design-system';
|
|
3
3
|
import { observer } from 'mobx-react-lite';
|
|
4
|
-
import { Link } from '@wix/wix-ui-icons-common/lazy';
|
|
5
4
|
import { useWixPatternsContainer } from '@wix/bex-core/react';
|
|
6
5
|
import { useController } from '@wix/bex-core/form';
|
|
7
6
|
import { isEmpty } from '../../validations/string';
|
|
8
7
|
import { isValidUri } from '../../validations/url';
|
|
8
|
+
import { FormUrlInput } from './form-url-input';
|
|
9
9
|
const _FormUrl = (props) => {
|
|
10
10
|
const { field, dataHook, formControl, data } = props;
|
|
11
11
|
const { translate: t } = useWixPatternsContainer();
|
|
@@ -26,8 +26,7 @@ const _FormUrl = (props) => {
|
|
|
26
26
|
},
|
|
27
27
|
});
|
|
28
28
|
return (React.createElement(FormField, { label: field.displayName, required: field.validation?.required, dataHook: dataHook, status: controller.fieldState.error ? 'error' : undefined, statusMessage: controller.fieldState.error?.message },
|
|
29
|
-
React.createElement(
|
|
30
|
-
React.createElement(Link, null)), placeholder: t('cairo.customFields.url-input.placeholder'), dataHook: `url-${field.id}`, value: controller.field.value, onChange: (e) => controller.field.onChange?.(e.target.value), onBlur: controller.field.onBlur, ref: controller.field.ref })));
|
|
29
|
+
React.createElement(FormUrlInput, { placeholder: t('cairo.customFields.url-input.placeholder'), dataHook: `url-${field.id}`, data: controller.field.value ?? '', onChange: controller.field.onChange, onBlur: controller.field.onBlur, inputRef: controller.field.ref, invalid: Boolean(controller.fieldState.error) })));
|
|
31
30
|
};
|
|
32
31
|
export const FormUrl = observer(_FormUrl);
|
|
33
32
|
//# sourceMappingURL=form-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-url.js","sourceRoot":"","sources":["../../../../src/components/url/form-url.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"form-url.js","sourceRoot":"","sources":["../../../../src/components/url/form-url.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,i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AS,EACzD,aAAa,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,EAAE,OAAO;QAEnD,oBAAC,YAAY,IACX,WAAW,EAAE,CAAC,CAAC,0CAA0C,CAAC,EAC1D,QAAQ,EAAE,OAAO,KAAK,CAAC,EAAE,EAAE,EAC3B,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,EAClC,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,QAAQ,EACnC,MAAM,EAAE,UAAU,CAAC,KAAK,CAAC,MAAM,EAC/B,QAAQ,EAAE,UAAU,CAAC,KAAK,CAAC,GAAG,EAC9B,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC,KAAK,CAAC,GAC7C,CACQ,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/url/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/url/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
@@ -4,7 +4,7 @@ import { Replace, More, Download, Delete, Maximize, } from '@wix/wix-ui-icons-co
|
|
|
4
4
|
import { observer } from 'mobx-react-lite';
|
|
5
5
|
import { useIsMobile, useWixPatternsContainer } from '@wix/bex-core/react';
|
|
6
6
|
import { useController } from '@wix/bex-core/form';
|
|
7
|
-
import { useTranslations } from '../../hooks';
|
|
7
|
+
import { useFieldRef, useTranslations } from '../../hooks';
|
|
8
8
|
import { isEmpty } from '../../validations/string';
|
|
9
9
|
import { isDataValidOrNotSet } from '../../validations/validations';
|
|
10
10
|
import * as videoValidation from '../../validations/video';
|
|
@@ -29,6 +29,7 @@ const _FormVideo = (props) => {
|
|
|
29
29
|
},
|
|
30
30
|
},
|
|
31
31
|
});
|
|
32
|
+
const setFieldRef = useFieldRef(controller.field.ref);
|
|
32
33
|
async function openMedia() {
|
|
33
34
|
if (!openMediaManager)
|
|
34
35
|
return;
|
|
@@ -71,7 +72,7 @@ const _FormVideo = (props) => {
|
|
|
71
72
|
, {
|
|
72
73
|
// Only the empty state can fail `required`, so the add button is
|
|
73
74
|
// always the right target for react-hook-form's shouldFocusError.
|
|
74
|
-
ref:
|
|
75
|
+
ref: setFieldRef, dataHook: `video-${field.id}`, onAddImage: isMobile ? undefined : () => openMedia(), addImageInfo: t('auto-patterns.fields.add_video_tooltip'), height: MEDIA_HEIGHT, width: "100%" }))),
|
|
75
76
|
isPreviewOpen && (React.createElement(Modal, { isOpen: isPreviewOpen, onRequestClose: handleClosePreview },
|
|
76
77
|
React.createElement(CustomModalLayout, { title: field.displayName, onCloseButtonClick: handleClosePreview, content: React.createElement("div", { style: {
|
|
77
78
|
display: 'flex',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-video.js","sourceRoot":"","sources":["../../../../src/components/video/form-video.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EACL,SAAS,EACT,WAAW,EACX,KAAK,EACL,iBAAiB,EACjB,YAAY,EACZ,GAAG,EACH,OAAO,EACP,UAAU,EACV,WAAW,EACX,KAAK,GACN,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACL,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,MAAM,EACN,QAAQ,GACT,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC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AAW,EACxB,kBAAkB,EAAE,kBAAkB,EACtC,OAAO,EACL,6BACE,KAAK,EAAE;wBACL,OAAO,EAAE,MAAM;wBACf,cAAc,EAAE,QAAQ;wBACxB,OAAO,EAAE,MAAM;qBAChB;oBAED,+BACE,QAAQ,QACR,QAAQ,QACR,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,EAC9C,MAAM,EAAE,QAAQ;wBAEf,QAAQ,IAAI,gCAAQ,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAC,WAAW,GAAG;uEAEjD,CACJ,GAER,CACI,CACT,CACS,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { FormMediaGalleryFieldUniDriver } from '../components/media-gallery/form-media-gallery-field.uni.driver';
|
|
2
2
|
export { ColorViewUniDriver } from '../components/color-view/color-view.uni.driver';
|
|
3
|
+
export { ControlledInputUniDriver } from '../components/controlled-input.driver';
|
|
3
4
|
//# sourceMappingURL=unidriver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unidriver.js","sourceRoot":"","sources":["../../../src/exports/unidriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,iEAAiE,CAAC;AACjH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC"}
|
|
1
|
+
{"version":3,"file":"unidriver.js","sourceRoot":"","sources":["../../../src/exports/unidriver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,iEAAiE,CAAC;AACjH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC"}
|
package/dist/esm/hooks/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export * from './use-translations';
|
|
|
7
7
|
export * from './use-with-callback';
|
|
8
8
|
export * from './use-resize-effect';
|
|
9
9
|
export * from './use-cell-edit-keyboard';
|
|
10
|
+
export * from './use-field-ref';
|
|
10
11
|
export * from './use-merged-ref';
|
|
11
12
|
export * from './use-scroll-to-error-ref';
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# PR #5746 — kobiburnley review
|
|
2
|
+
|
|
3
|
+
[fix(fields): register a field ref that answers every call react-hook-form makes](https://github.com/wix-private/cairo/pull/5746)
|
|
4
|
+
|
|
5
|
+
> **Verdict: Request changes** — 1 blocker. (Posted as a comment review because GitHub will not let the
|
|
6
|
+
> author formally request changes on their own PR.)
|
|
7
|
+
>
|
|
8
|
+
> The diagnosis is right, and I checked it against the installed `react-hook-form` (7.56.4) rather than
|
|
9
|
+
> taking it on trust […] `fieldRefHandle` / `useFieldRef` are a clean way to close it […] I also confirmed
|
|
10
|
+
> the integration test is a real guard, not decoration.
|
|
11
|
+
>
|
|
12
|
+
> One blocker: the audit missed a call site with exactly the shape the helper exists for.
|
|
13
|
+
>
|
|
14
|
+
> — [pullrequestreview-5002194499](https://github.com/wix-private/cairo/pull/5746#pullrequestreview-5002194499)
|
|
15
|
+
|
|
16
|
+
All claims below were checked against the branch before being written down. Every one holds.
|
|
17
|
+
|
|
18
|
+
| # | Comment link | Description | Severity | Status | Resolution recommendation |
|
|
19
|
+
|---|---|---|---|---|---|
|
|
20
|
+
| 1 | [discussion_r3838295772](https://github.com/wix-private/cairo/pull/5746#discussion_r3838295772) — `packages/fields/src/components/time-input/form-time.tsx:46` | `form-time` registers a hand-rolled focus-only object, `controller.field.ref({ focus: () => timeRef.current?.focus() })`. Exactly the shape the helper exists for, missed by the audit, so it ships still broken while the PR reads as closing the trap. | Blocker | done | Fixed in `23dc894` — wrapped with `fieldRefHandle` as suggested. Missed originally because `form-time` calls `controller.field.ref(...)` directly in a `useEffect`, so the `inputRef=`/`ref=` grep never matched it. Covered by the table-driven `setFocus` guard. |
|
|
21
|
+
| 2 | [review summary](https://github.com/wix-private/cairo/pull/5746#pullrequestreview-5002194499) | PR body claims "audited all nine that register directly"; there are ~23 `controller.field.ref` sites. The 7 passing `ref=` to a WDS `Input`/`InputArea` get `InputImperativeActions`, which has `select` but no `setCustomValidity`/`reportValidity` — so the `shouldUseNativeValidation` half stays open in `form-url`, `form-email`, `form-short-text` (Input branch), `form-long-text`, `form-color`, `form-array`, `form-object`. | Major (accuracy) | done | PR description rewritten with the full 23-site table. `InputImperativeActions` confirmed as `{ focus, blur, select, setSelectionRange, clear, input }`. The `shouldUseNativeValidation` gap in the 7 `ref=`-on-`Input` sites is left open and stated as a follow-up rather than implied fixed. |
|
|
22
|
+
| 3 | [review summary](https://github.com/wix-private/cairo/pull/5746#pullrequestreview-5002194499) | Fix it once in `packages/core` instead. `packages/core/src/exports/form.ts` is `export * from 'react-hook-form'`, so core owns the entry point; a `useController` there installing the safe handle would cover all sites and every future one, making `useFieldRef` and the seven adopting edits unnecessary. As it stands the fix is opt-in — which is how `form-time` got missed. | Major (design) | dismiss | Not implemented; kept per-site by decision. Rationale recorded in the PR reply: core's `exports/form.ts` is a bare re-export, so wrapping `useController` there would turn it into real implementation and change behaviour for every consumer of `@wix/bex-core/form`, not just Cairo renderers. Filed as a follow-up — if it lands, `useFieldRef` and all adopting edits should be deleted and the `Input` group closes for free. |
|
|
23
|
+
| 4 | [review summary](https://github.com/wix-private/cairo/pull/5746#pullrequestreview-5002194499) | The same 3-line comment is copy-pasted verbatim into seven files; the `fieldRefHandle` docblock already says it, and `AGENTS.md` asks for a comment only when it tells the reader something the code cannot. | Nit | done | Removed from all seven files in `b64bfc4`. |
|
|
24
|
+
| 5 | [review summary](https://github.com/wix-private/cairo/pull/5746#pullrequestreview-5002194499) | `useFieldRef`'s type parameter `T` appears only in the return type, so every call site infers `FieldControl` and the annotation buys nothing. | Minor | done | `T` dropped in `a51e9c6`; takes and returns `FieldControl`. |
|
|
25
|
+
| 6 | [review summary](https://github.com/wix-private/cairo/pull/5746#pullrequestreview-5002194499) | Lint is not clean: `use-field-ref.ts:56` trips `prettier/prettier`. | Minor | done | Fixed in `c6406f6`. Root cause of the false "clean" report: all changed files were passed as one joined argument, so eslint matched nothing. Re-verified one file at a time. `form-video.tsx:73` `curly` warning remains but is unchanged from master. |
|
|
26
|
+
| 7 | [review summary](https://github.com/wix-private/cairo/pull/5746#pullrequestreview-5002194499) | Only `form-address` has an integration guard; the other six conversions would not notice a revert. | Test gap | done | Fixed in `94baa17`. Table-driven over one renderer per control shape: address, time, `FormDocument` (`AddItemActions`, shared with audio/multi-document/media-gallery), `FormImageInput` (`ImageViewer`, shared with video). Each verified failing via `git checkout origin/master -- <file>` — note `git checkout -- <file>` restores from HEAD and silently proves nothing once the change is committed. |
|
|
27
|
+
| 8 | [review summary](https://github.com/wix-private/cairo/pull/5746#pullrequestreview-5002194499) | In `EntityPageCustomField`, the new `control` closure and the `focus` callback each resolve consumer-then-`querySelector` separately; not wrong (focus needs `scrollIntoView` between the steps) but they will drift. | Nit | done | Fixed in `91147ff`. Both paths read one `control()`. The identity check I first wrote was also wrong, not just duplicative: with nothing focusable, `target` and `consumerRef.current` were both `null`, so it skipped the scroll in exactly the case needing it. Now keyed off `!consumerRef.current`. |
|
|
28
|
+
|
|
29
|
+
## Notes
|
|
30
|
+
|
|
31
|
+
- #3 is the pivot. If the fix moves into core's `useController`, then #1, #2, #4, #5 and #7 mostly evaporate and this
|
|
32
|
+
PR shrinks to deleting `useFieldRef` and reverting the seven adopting edits. Worth settling before spending
|
|
33
|
+
effort on the others.
|
|
34
|
+
- #1 is a blocker on its own terms and is a one-line fix either way, since `form-time` is broken today
|
|
35
|
+
regardless of which mechanism wins.
|
|
36
|
+
- The reviewer independently reproduced the address integration test (revert → `1 failed, 3 passed`), so the
|
|
37
|
+
guard is trusted; the gap is coverage of the other six (#7), not the approach.
|
|
38
|
+
|
|
39
|
+
## Outcome
|
|
40
|
+
|
|
41
|
+
All eight resolved: seven fixed, one (row 3) dismissed with rationale. Commits on `fix/delegating-field-ref`,
|
|
42
|
+
all pushed:
|
|
43
|
+
|
|
44
|
+
| Commit | Row |
|
|
45
|
+
|---|---|
|
|
46
|
+
| `23dc894` fix(TimeInput): give form-time a field ref that answers every call | 1 |
|
|
47
|
+
| `c6406f6` style(fields): format the fieldRefHandle call in useFieldRef | 6 |
|
|
48
|
+
| `a51e9c6` refactor(fields): drop useFieldRef's unusable type parameter | 5 |
|
|
49
|
+
| `b64bfc4` refactor(fields): drop the repeated useFieldRef comment | 4 |
|
|
50
|
+
| `91147ff` refactor(EntityPageCustomField): resolve the control once | 8 |
|
|
51
|
+
| `94baa17` test(fields): guard the other converted renderers against setFocus | 7 |
|
|
52
|
+
|
|
53
|
+
Row 2 was a PR-description correction, not code. Row 3 answered in
|
|
54
|
+
[issuecomment-5385655358](https://github.com/wix-private/cairo/pull/5746#issuecomment-5385655358).
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { useCallback, useRef } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Handle to register with react-hook-form, covering every method it may call.
|
|
4
|
+
*
|
|
5
|
+
* `useController` rewrites whatever is registered into
|
|
6
|
+
* `{ focus, select, setCustomValidity, reportValidity }` and calls all four
|
|
7
|
+
* through to the target. The guards check that wrapper rather than the target,
|
|
8
|
+
* so registering a control that only has `focus` makes `setFocus` with
|
|
9
|
+
* `shouldSelect`, or `shouldUseNativeValidation`, throw on the way to it.
|
|
10
|
+
*
|
|
11
|
+
* @param focus What to do when the field has to be reached.
|
|
12
|
+
* @param getControl The control the remaining calls go to, when there is one.
|
|
13
|
+
*/
|
|
14
|
+
export const fieldRefHandle = (focus, getControl) => ({
|
|
15
|
+
focus,
|
|
16
|
+
select: () => getControl()?.select?.(),
|
|
17
|
+
setCustomValidity: (message) => getControl()?.setCustomValidity?.(message),
|
|
18
|
+
reportValidity: () => getControl()?.reportValidity?.() ?? true,
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* Callback ref for a field's control. Pass it where the control lands and
|
|
22
|
+
* react-hook-form gets a handle that reaches it.
|
|
23
|
+
*
|
|
24
|
+
* @param registerRef `controller.field.ref` from useController.
|
|
25
|
+
*/
|
|
26
|
+
export const useFieldRef = (registerRef) => {
|
|
27
|
+
const control = useRef(null);
|
|
28
|
+
return useCallback((instance) => {
|
|
29
|
+
control.current = instance;
|
|
30
|
+
if (!instance) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
registerRef(fieldRefHandle(() => control.current?.focus?.(), () => control.current));
|
|
34
|
+
}, [registerRef]);
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=use-field-ref.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-field-ref.js","sourceRoot":"","sources":["../../../src/hooks/use-field-ref.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAa5C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAiB,EACjB,UAAiD,EACjD,EAAE,CAAC,CAAC;IACJ,KAAK;IACL,MAAM,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE;IACtC,iBAAiB,EAAE,CAAC,OAAe,EAAE,EAAE,CACrC,UAAU,EAAE,EAAE,iBAAiB,EAAE,CAAC,OAAO,CAAC;IAC5C,cAAc,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE,EAAE,cAAc,EAAE,EAAE,IAAI,IAAI;CAC/D,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,WAAwC,EACG,EAAE;IAC7C,MAAM,OAAO,GACX,MAAM,CAAsB,IAAI,CAAC,CAAC;IAEpC,OAAO,WAAW,CAChB,CAAC,QAA6B,EAAE,EAAE;QAChC,OAAO,CAAC,OAAO,GAAG,QAAQ,CAAC;QAC3B,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO;SACR;QACD,WAAW,CACT,cAAc,CACZ,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,EAChC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CACtB,CACF,CAAC;IACJ,CAAC,EACD,CAAC,WAAW,CAAC,CACd,CAAC;AACJ,CAAC,CAAC"}
|