@wix/patterns-fields 1.108.0 → 1.110.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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-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/cell-checkbox.js +15 -6
- package/dist/cjs/components/boolean/cell-checkbox.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/date-input/cell-date-input.js +21 -2
- package/dist/cjs/components/date-input/cell-date-input.js.map +1 -1
- package/dist/cjs/components/date-input/date-picker-internals.js +93 -3
- package/dist/cjs/components/date-input/date-picker-internals.js.map +1 -1
- package/dist/cjs/components/date-input/form-date-input.driver.js +2 -0
- package/dist/cjs/components/date-input/form-date-input.driver.js.map +1 -1
- package/dist/cjs/components/date-input/form-date-input.js +23 -6
- package/dist/cjs/components/date-input/form-date-input.js.map +1 -1
- package/dist/cjs/components/date-input/use-field-value-replacement.js +48 -0
- package/dist/cjs/components/date-input/use-field-value-replacement.js.map +1 -0
- package/dist/cjs/components/datetime-input/form-date-time.driver.js +3 -0
- package/dist/cjs/components/datetime-input/form-date-time.driver.js.map +1 -1
- package/dist/cjs/components/datetime-input/form-date-time.js +61 -24
- 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/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/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/cell-rich-content-input.js +12 -9
- package/dist/cjs/components/rich-content/cell-rich-content-input.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.js +3 -3
- 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.js +23 -17
- package/dist/cjs/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.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/cell-rich-text-editor.js +21 -5
- package/dist/cjs/components/rich-text/cell-rich-text-editor.js.map +1 -1
- package/dist/cjs/components/rich-text/cell-rich-text-input.js +15 -7
- package/dist/cjs/components/rich-text/cell-rich-text-input.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.js +4 -4
- 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.js +1 -1
- package/dist/cjs/components/text/form-short-text.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/styles.global.css +1 -1
- package/dist/cjs/utils/keyboard.js +12 -0
- package/dist/cjs/utils/keyboard.js.map +1 -0
- 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/audio-field/form-audio-field.st.css.js +2 -2
- package/dist/esm/components/audio/audio-player/audio-player.st.css.js +2 -2
- package/dist/esm/components/boolean/cell-checkbox.js +10 -4
- package/dist/esm/components/boolean/cell-checkbox.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-view.st.css.js +2 -2
- package/dist/esm/components/date-input/cell-date-input.js +21 -2
- package/dist/esm/components/date-input/cell-date-input.js.map +1 -1
- package/dist/esm/components/date-input/date-picker-internals.js +67 -0
- package/dist/esm/components/date-input/date-picker-internals.js.map +1 -1
- package/dist/esm/components/date-input/form-date-input.driver.js +2 -0
- package/dist/esm/components/date-input/form-date-input.driver.js.map +1 -1
- package/dist/esm/components/date-input/form-date-input.js +25 -4
- package/dist/esm/components/date-input/form-date-input.js.map +1 -1
- package/dist/esm/components/date-input/use-field-value-replacement.js +48 -0
- package/dist/esm/components/date-input/use-field-value-replacement.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 +51 -21
- 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/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/exclamation/exclamation.st.css.js +2 -2
- package/dist/esm/components/highlighted-text/highlighted-text.st.css.js +3 -3
- package/dist/esm/components/highlighted-text/highlighted-text.st.css.js.map +1 -1
- 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/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-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/multi-document-input/form-multi-document.st.css.js +2 -2
- 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/reference/cell-reference-input.st.css.js.map +1 -1
- package/dist/esm/components/rich-content/cell-rich-content-input.js +11 -9
- package/dist/esm/components/rich-content/cell-rich-content-input.js.map +1 -1
- 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.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 +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/publish-loader/publish-loader.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js.map +1 -1
- 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.js +8 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.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-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/cell-rich-text-editor.js +16 -1
- package/dist/esm/components/rich-text/cell-rich-text-editor.js.map +1 -1
- package/dist/esm/components/rich-text/cell-rich-text-input.js +8 -0
- package/dist/esm/components/rich-text/cell-rich-text-input.js.map +1 -1
- 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.js +2 -2
- 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.js +1 -1
- package/dist/esm/components/text/form-short-text.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/styles.global.css +1 -1
- package/dist/esm/utils/keyboard.js +7 -0
- package/dist/esm/utils/keyboard.js.map +1 -0
- package/dist/types/components/address/input/address-input.st.css.d.ts.map +1 -1
- package/dist/types/components/boolean/cell-checkbox.d.ts +4 -1
- package/dist/types/components/boolean/cell-checkbox.d.ts.map +1 -1
- package/dist/types/components/date-input/cell-date-input.d.ts +4 -0
- package/dist/types/components/date-input/cell-date-input.d.ts.map +1 -1
- package/dist/types/components/date-input/date-picker-internals.d.ts +11 -1
- package/dist/types/components/date-input/date-picker-internals.d.ts.map +1 -1
- package/dist/types/components/date-input/form-date-input.d.ts.map +1 -1
- package/dist/types/components/date-input/form-date-input.driver.d.ts +2 -0
- package/dist/types/components/date-input/form-date-input.driver.d.ts.map +1 -1
- package/dist/types/components/date-input/use-field-value-replacement.d.ts +3 -0
- package/dist/types/components/date-input/use-field-value-replacement.d.ts.map +1 -0
- package/dist/types/components/datetime-input/form-date-time.d.ts.map +1 -1
- package/dist/types/components/datetime-input/form-date-time.driver.d.ts +3 -0
- package/dist/types/components/datetime-input/form-date-time.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/highlighted-text/highlighted-text.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-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/reference/cell-reference-input.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-content/cell-rich-content-input.d.ts +2 -1
- package/dist/types/components/rich-content/cell-rich-content-input.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/publish-loader/publish-loader.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.d.ts +2 -0
- package/dist/types/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.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/cell-rich-text-editor.d.ts.map +1 -1
- package/dist/types/components/rich-text/cell-rich-text-input.d.ts +1 -1
- package/dist/types/components/rich-text/cell-rich-text-input.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/text-view.st.css.d.ts.map +1 -1
- package/dist/types/utils/keyboard.d.ts +4 -0
- package/dist/types/utils/keyboard.d.ts.map +1 -0
- package/package.json +5 -5
- package/src/__tests__/components/cell-rich-content-input.spec.tsx +73 -0
- package/src/__tests__/components/cell-rich-text-editor.spec.tsx +64 -0
- package/src/__tests__/components/cell-rich-text-input.spec.tsx +39 -0
- package/src/__tests__/components/date-input/cell-date-input.spec.tsx +100 -0
- package/src/__tests__/components/date-input/date-picker-internals.spec.tsx +69 -0
- package/src/__tests__/components/date-input/form-date-input.spec.tsx +141 -0
- package/src/__tests__/components/datetime-input/form-date-time.spec.tsx +194 -0
- package/src/__tests__/components/rich-content-editor.spec.tsx +53 -0
- package/src/__tests__/components/text/form-short-text.spec.tsx +27 -0
- package/src/__tests__/form-field.driver.tsx +31 -3
- package/src/__tests__/hooks/use-field-value-replacement.spec.tsx +68 -0
- package/src/__tests__/utils/keyboard.spec.ts +45 -0
- 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-player/audio-player.st.css.ts +2 -2
- package/src/components/boolean/cell-checkbox.tsx +33 -11
- 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/date-input/cell-date-input.tsx +28 -0
- package/src/components/date-input/date-picker-internals.ts +104 -3
- package/src/components/date-input/form-date-input.driver.ts +2 -0
- package/src/components/date-input/form-date-input.tsx +25 -3
- package/src/components/date-input/use-field-value-replacement.ts +63 -0
- package/src/components/datetime-input/form-date-time.driver.ts +3 -0
- package/src/components/datetime-input/form-date-time.tsx +55 -33
- 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/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/cell-rich-content-input.tsx +12 -13
- 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.ts +2 -2
- 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-editor.tsx +9 -1
- 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/cell-rich-text-editor.tsx +30 -1
- package/src/components/rich-text/cell-rich-text-input.tsx +9 -1
- 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.ts +2 -2
- 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.tsx +1 -1
- package/src/components/text/text-view.st.css.ts +2 -2
- package/src/styles.global.css +1 -1
- package/src/utils/keyboard.ts +7 -0
|
@@ -7,6 +7,7 @@ import React, {
|
|
|
7
7
|
import { DatePicker } from '@wix/design-system';
|
|
8
8
|
import {
|
|
9
9
|
closeDatePickerCalendar,
|
|
10
|
+
typedDateInputProps,
|
|
10
11
|
getDatePickerInputElement,
|
|
11
12
|
} from './date-picker-internals';
|
|
12
13
|
|
|
@@ -29,6 +30,10 @@ export interface CellDateInputProps {
|
|
|
29
30
|
* after a date pick).
|
|
30
31
|
*/
|
|
31
32
|
onChange?: (date: Date) => void;
|
|
33
|
+
/** Fires when the user empties the input. */
|
|
34
|
+
onEmpty?: () => void;
|
|
35
|
+
/** Fires on Enter in the input with the typed date, or `null` when empty. */
|
|
36
|
+
onEnter?: (date: Date | null) => void;
|
|
32
37
|
/** When set, renders the clear (X) suffix and calls this on click. */
|
|
33
38
|
onClear?: () => void;
|
|
34
39
|
/** Ref object that receives the underlying `<input>` element. Consumers
|
|
@@ -62,6 +67,8 @@ export const CellDateInput = forwardRef<
|
|
|
62
67
|
{
|
|
63
68
|
value,
|
|
64
69
|
onChange,
|
|
70
|
+
onEmpty,
|
|
71
|
+
onEnter,
|
|
65
72
|
onClear,
|
|
66
73
|
inputRef,
|
|
67
74
|
dataHook,
|
|
@@ -73,6 +80,7 @@ export const CellDateInput = forwardRef<
|
|
|
73
80
|
forwardedRef,
|
|
74
81
|
) => {
|
|
75
82
|
const datePickerRef = useRef<DatePicker | null>(null);
|
|
83
|
+
const inputElementRef = useRef<HTMLInputElement | null>(null);
|
|
76
84
|
|
|
77
85
|
useImperativeHandle(
|
|
78
86
|
forwardedRef,
|
|
@@ -91,6 +99,16 @@ export const CellDateInput = forwardRef<
|
|
|
91
99
|
[onChange],
|
|
92
100
|
);
|
|
93
101
|
|
|
102
|
+
const handleEmptyEnter = useCallback(() => {
|
|
103
|
+
if (onEnter) {
|
|
104
|
+
onEnter(null);
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
onEmpty?.();
|
|
108
|
+
}, [onEnter, onEmpty]);
|
|
109
|
+
|
|
110
|
+
const handlesTypedInput = Boolean(onEmpty || onEnter);
|
|
111
|
+
|
|
94
112
|
const validValue =
|
|
95
113
|
value instanceof Date && !isNaN(value.getTime()) ? value : undefined;
|
|
96
114
|
|
|
@@ -110,7 +128,17 @@ export const CellDateInput = forwardRef<
|
|
|
110
128
|
border: 'none',
|
|
111
129
|
...(hidePrefix ? { prefix: <span /> } : {}),
|
|
112
130
|
...(ariaLabel ? { ariaLabel } : {}),
|
|
131
|
+
...(handlesTypedInput
|
|
132
|
+
? typedDateInputProps({
|
|
133
|
+
picker: datePickerRef,
|
|
134
|
+
input: inputElementRef,
|
|
135
|
+
onEmpty,
|
|
136
|
+
onEmptyEnter: handleEmptyEnter,
|
|
137
|
+
onEnter,
|
|
138
|
+
})
|
|
139
|
+
: {}),
|
|
113
140
|
inputRef: (el: HTMLInputElement | null) => {
|
|
141
|
+
inputElementRef.current = el;
|
|
114
142
|
if (inputRef) {
|
|
115
143
|
inputRef.current = el ?? undefined;
|
|
116
144
|
}
|
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { KeyboardEvent, RefObject } from 'react';
|
|
2
|
+
import type { DatePicker, InputProps } from '@wix/design-system';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
|
-
* WDS `DatePicker` exposes
|
|
5
|
+
* WDS `DatePicker` exposes operations we need that aren't part of its
|
|
5
6
|
* public type surface:
|
|
6
7
|
*
|
|
7
8
|
* - `state.inputRef` — the underlying `HTMLInputElement` (used to focus
|
|
8
9
|
* the input and to programmatically seed it for type-to-edit).
|
|
9
10
|
* - `_closeCalendar()` — WDS declares `closeCalendar` in its types but
|
|
10
11
|
* only the underscored form exists at runtime.
|
|
12
|
+
* - `_handleInputChange()` / `_handleKeyDown()` — its handlers for typed
|
|
13
|
+
* text and keys.
|
|
11
14
|
*
|
|
12
|
-
*
|
|
15
|
+
* These reaches live behind this helper so the cast happens in exactly one
|
|
13
16
|
* place. If WDS adds a public surface for these, swap the implementation
|
|
14
17
|
* here and every consumer picks it up automatically.
|
|
15
18
|
*/
|
|
16
19
|
type DatePickerWithInternals = DatePicker & {
|
|
17
20
|
state?: { inputRef?: HTMLInputElement };
|
|
18
21
|
_closeCalendar?: () => void;
|
|
22
|
+
_handleInputChange?: (change: { dateVal: Date }) => void;
|
|
23
|
+
_handleKeyDown?: (event: KeyboardEvent, date: Date | null) => void;
|
|
24
|
+
_handleChange?: (date: Date, modifiers?: { disabled?: boolean }) => void;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// The handlers DatePicker's inner DateInput calls. `InputProps` types
|
|
28
|
+
// `onChange` and `onKeyDown` as DOM event handlers, so it can't hold these.
|
|
29
|
+
type DateInputHandlers = {
|
|
30
|
+
onChange: (change: { dateVal: Date }) => void;
|
|
31
|
+
onKeyDown: (event: KeyboardEvent, date: Date | null) => void;
|
|
19
32
|
};
|
|
20
33
|
|
|
21
34
|
export const getDatePickerInputElement = (
|
|
@@ -28,3 +41,91 @@ export const closeDatePickerCalendar = (
|
|
|
28
41
|
): void => {
|
|
29
42
|
(picker as DatePickerWithInternals | null | undefined)?._closeCalendar?.();
|
|
30
43
|
};
|
|
44
|
+
|
|
45
|
+
// WDS skips `onChange` when the picked day is the day of its `value` prop.
|
|
46
|
+
// This reports that pick through `onPick` and returns a function that undoes it.
|
|
47
|
+
export const onSameDayCalendarPick = (
|
|
48
|
+
picker: DatePicker | null | undefined,
|
|
49
|
+
onPick: (date: Date) => void,
|
|
50
|
+
): (() => void) => {
|
|
51
|
+
const internals = picker as DatePickerWithInternals | null | undefined;
|
|
52
|
+
const handleChange = internals?._handleChange;
|
|
53
|
+
if (!internals || !handleChange) {
|
|
54
|
+
return () => {};
|
|
55
|
+
}
|
|
56
|
+
internals._handleChange = (date, modifiers) => {
|
|
57
|
+
handleChange(date, modifiers);
|
|
58
|
+
const { value } = internals.props;
|
|
59
|
+
// Same guard as WDS `_saveNewValue`.
|
|
60
|
+
if (value?.toDateString() === date.toDateString() && !modifiers?.disabled) {
|
|
61
|
+
onPick(date);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
return () => {
|
|
65
|
+
internals._handleChange = handleChange;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const isValidDate = (date: Date | null): date is Date =>
|
|
70
|
+
date !== null && !isNaN(date.getTime());
|
|
71
|
+
|
|
72
|
+
// WDS parses empty input text as today. These `inputProps` handlers report an
|
|
73
|
+
// emptied input through `onEmpty` and Enter on it through `onEmptyEnter`
|
|
74
|
+
// instead, send typed dates to `onType` when it is given (the picker's
|
|
75
|
+
// `onChange` otherwise), and Enter on a typed date to `onEnter`. An event
|
|
76
|
+
// without its callback goes to the picker as before. Calendar picks don't go
|
|
77
|
+
// through them.
|
|
78
|
+
// WDS thread: https://wix.slack.com/archives/C39FTGUBZ/p1790691851370229
|
|
79
|
+
export const typedDateInputProps = ({
|
|
80
|
+
picker,
|
|
81
|
+
input,
|
|
82
|
+
onEmpty,
|
|
83
|
+
onEmptyEnter,
|
|
84
|
+
onType,
|
|
85
|
+
onEnter,
|
|
86
|
+
}: {
|
|
87
|
+
picker: RefObject<DatePicker | null>;
|
|
88
|
+
input: RefObject<HTMLInputElement | null>;
|
|
89
|
+
onEmpty?: () => void;
|
|
90
|
+
onEmptyEnter?: () => void;
|
|
91
|
+
onType?: (date: Date) => void;
|
|
92
|
+
onEnter?: (date: Date) => void;
|
|
93
|
+
}): Partial<InputProps> => {
|
|
94
|
+
const internals = () => picker.current as DatePickerWithInternals | null;
|
|
95
|
+
const isEmpty = () => input.current?.value === '';
|
|
96
|
+
const takeOverEnter = (event: KeyboardEvent) => {
|
|
97
|
+
event.preventDefault();
|
|
98
|
+
closeDatePickerCalendar(picker.current);
|
|
99
|
+
};
|
|
100
|
+
const handlers: DateInputHandlers = {
|
|
101
|
+
onChange: (change) => {
|
|
102
|
+
if (onEmpty && isEmpty()) {
|
|
103
|
+
onEmpty();
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
if (onType) {
|
|
107
|
+
onType(change.dateVal);
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
internals()?._handleInputChange?.(change);
|
|
111
|
+
},
|
|
112
|
+
onKeyDown: (event, date) => {
|
|
113
|
+
if (event.key === 'Enter') {
|
|
114
|
+
const isInputEmpty = isEmpty();
|
|
115
|
+
if (isInputEmpty && onEmptyEnter) {
|
|
116
|
+
takeOverEnter(event);
|
|
117
|
+
onEmptyEnter();
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (!isInputEmpty && onEnter && isValidDate(date)) {
|
|
121
|
+
takeOverEnter(event);
|
|
122
|
+
onEnter(date);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
internals()?._handleKeyDown?.(event, date);
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
// DatePicker passes `inputProps` to its inner DateInput, not to `<Input>`.
|
|
130
|
+
return handlers as unknown as Partial<InputProps>;
|
|
131
|
+
};
|
|
@@ -25,7 +25,9 @@ export function FormDateInputDriver(
|
|
|
25
25
|
getLabel: () => getFormFieldLabelText(formField),
|
|
26
26
|
datePickerExists: () => datePickerBase.exists(),
|
|
27
27
|
enterText: (text: string) => datePicker.inputDriver.enterText(text),
|
|
28
|
+
getValue: () => datePicker.inputDriver.getValue(),
|
|
28
29
|
blur: () => datePicker.inputDriver.blur(),
|
|
30
|
+
selectDate: (date: Date) => datePicker.calendarDriver.clickDay(date),
|
|
29
31
|
hasError: () => datePicker.inputDriver.hasStatus('error'),
|
|
30
32
|
getErrorMessage: () => datePicker.inputDriver.getStatusMessage(),
|
|
31
33
|
isRequired: () => formField.isRequired(),
|
|
@@ -8,6 +8,7 @@ import { BaseInputProps, BaseInputRef } from '../../types/base-input';
|
|
|
8
8
|
import { useTranslations } from '../../hooks';
|
|
9
9
|
import { isEmpty } from '../../validations/string';
|
|
10
10
|
import { calendarPopoverDefaults } from '../popover-defaults';
|
|
11
|
+
import { useFieldValueReplacement } from './use-field-value-replacement';
|
|
11
12
|
import {
|
|
12
13
|
getDateWithoutTimezone,
|
|
13
14
|
getISODateStringWithFixedTimezone,
|
|
@@ -19,14 +20,17 @@ const _FormDateInput = (props: FormDateInputProps) => {
|
|
|
19
20
|
const { field, dataHook, inputRef, formControl, data } = props;
|
|
20
21
|
const { translate: t } = useWixPatternsContainer();
|
|
21
22
|
const { t: tFields } = useTranslations();
|
|
23
|
+
const inputError = useRef('');
|
|
22
24
|
|
|
23
25
|
const computeError = (
|
|
24
26
|
value: string | null | undefined,
|
|
25
27
|
format?: string,
|
|
26
28
|
validationType?: 'outOfBoundsError' | 'formatError' | 'valid',
|
|
27
29
|
): string => {
|
|
28
|
-
if (
|
|
29
|
-
return
|
|
30
|
+
if (isEmpty(value)) {
|
|
31
|
+
return field.validation?.required
|
|
32
|
+
? t('cairo.fieldValidation.requiredField')
|
|
33
|
+
: '';
|
|
30
34
|
}
|
|
31
35
|
if (validationType === 'formatError' && format) {
|
|
32
36
|
return t('cairo.customFields.fieldType.date.invalid.value', {
|
|
@@ -42,7 +46,7 @@ const _FormDateInput = (props: FormDateInputProps) => {
|
|
|
42
46
|
defaultValue: data?.[field?.id ?? ''],
|
|
43
47
|
rules: {
|
|
44
48
|
validate: (value) => {
|
|
45
|
-
const error = computeError(value);
|
|
49
|
+
const error = inputError.current || computeError(value);
|
|
46
50
|
return error || true;
|
|
47
51
|
},
|
|
48
52
|
},
|
|
@@ -59,6 +63,16 @@ const _FormDateInput = (props: FormDateInputProps) => {
|
|
|
59
63
|
|
|
60
64
|
const ref = useRef<BaseInputRef>({});
|
|
61
65
|
const [errorMessage, setErrorMessage] = useState<string>('');
|
|
66
|
+
const revision = useFieldValueReplacement(formControl, field.id, (value) => {
|
|
67
|
+
inputError.current = '';
|
|
68
|
+
setErrorMessage('');
|
|
69
|
+
ref.current.invalid = false;
|
|
70
|
+
const iso =
|
|
71
|
+
typeof value === 'string'
|
|
72
|
+
? getISODateStringWithFixedTimezone(value)
|
|
73
|
+
: undefined;
|
|
74
|
+
setDate(iso ? getDateWithoutTimezone(iso) : undefined);
|
|
75
|
+
});
|
|
62
76
|
|
|
63
77
|
return (
|
|
64
78
|
<FormField
|
|
@@ -68,6 +82,7 @@ const _FormDateInput = (props: FormDateInputProps) => {
|
|
|
68
82
|
dataHook={dataHook}
|
|
69
83
|
>
|
|
70
84
|
<DatePicker
|
|
85
|
+
key={revision}
|
|
71
86
|
ref={(internalRef) => {
|
|
72
87
|
inputRef?.(ref.current);
|
|
73
88
|
const inputEl =
|
|
@@ -84,6 +99,9 @@ const _FormDateInput = (props: FormDateInputProps) => {
|
|
|
84
99
|
placeholderText={tFields('CMS.formDate.placeholder')}
|
|
85
100
|
value={date}
|
|
86
101
|
onChange={(newValue: Date) => {
|
|
102
|
+
inputError.current = '';
|
|
103
|
+
setErrorMessage('');
|
|
104
|
+
ref.current.invalid = false;
|
|
87
105
|
setDate(newValue);
|
|
88
106
|
const formattedDate = newValue
|
|
89
107
|
? getISODateStringWithFixedTimezone(newValue)
|
|
@@ -92,12 +110,16 @@ const _FormDateInput = (props: FormDateInputProps) => {
|
|
|
92
110
|
}}
|
|
93
111
|
onValidate={({ validationType, value: newValue, format }) => {
|
|
94
112
|
const error = computeError(newValue, format, validationType);
|
|
113
|
+
inputError.current = error;
|
|
95
114
|
setErrorMessage(error);
|
|
96
115
|
ref.current.invalid = !!error;
|
|
97
116
|
|
|
98
117
|
if (validationType === 'formatError' && newValue === '') {
|
|
99
118
|
setDate(undefined);
|
|
100
119
|
controller.field.onChange(null);
|
|
120
|
+
} else {
|
|
121
|
+
// Invalid text does not change the stored date, but must revalidate it.
|
|
122
|
+
controller.field.onChange(controller.field.value);
|
|
101
123
|
}
|
|
102
124
|
}}
|
|
103
125
|
status={errorMessage ? 'error' : undefined}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { get } from '@wix/bex-core/form';
|
|
3
|
+
import type { Control } from '@wix/bex-core/form';
|
|
4
|
+
|
|
5
|
+
export function useFieldValueReplacement(
|
|
6
|
+
control: Control,
|
|
7
|
+
name: string,
|
|
8
|
+
onReplace: (value: unknown) => void,
|
|
9
|
+
) {
|
|
10
|
+
const callback = useRef(onReplace);
|
|
11
|
+
callback.current = onReplace;
|
|
12
|
+
// A new key discards the picker's draft even when its saved value is unchanged.
|
|
13
|
+
const [revision, setRevision] = useState(0);
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
// Control has no public reset listener. Input edits carry a type; setValue
|
|
17
|
+
// does not. Older RHF releases have a separate values subject.
|
|
18
|
+
const subjects:
|
|
19
|
+
| (Partial<Control['_subjects']> & {
|
|
20
|
+
values?: Pick<Control['_subjects']['state'], 'subscribe'>;
|
|
21
|
+
})
|
|
22
|
+
| undefined = control._subjects;
|
|
23
|
+
const values = subjects?.values ?? subjects?.state;
|
|
24
|
+
const array = subjects?.array;
|
|
25
|
+
// Reset cleanup is optional; an incompatible RHF version must not crash the field.
|
|
26
|
+
if (
|
|
27
|
+
typeof values?.subscribe !== 'function' ||
|
|
28
|
+
typeof array?.subscribe !== 'function'
|
|
29
|
+
) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const subscription = values.subscribe({
|
|
33
|
+
next: (update) => {
|
|
34
|
+
if (
|
|
35
|
+
!update.values ||
|
|
36
|
+
!update.name ||
|
|
37
|
+
update.type ||
|
|
38
|
+
(update.name !== name && !name.startsWith(`${update.name}.`))
|
|
39
|
+
) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
callback.current(get(update.values, name));
|
|
43
|
+
setRevision((value) => value + 1);
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
// Reset broadcasts here even for unchanged values. Unlike the state
|
|
47
|
+
// subject, this does not fire when an unrelated field unregisters.
|
|
48
|
+
const resets = array.subscribe({
|
|
49
|
+
next: (update) => {
|
|
50
|
+
if (!update.name && update.values) {
|
|
51
|
+
callback.current(get(update.values, name));
|
|
52
|
+
setRevision((value) => value + 1);
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
return () => {
|
|
57
|
+
subscription?.unsubscribe?.();
|
|
58
|
+
resets?.unsubscribe?.();
|
|
59
|
+
};
|
|
60
|
+
}, [control, name]);
|
|
61
|
+
|
|
62
|
+
return revision;
|
|
63
|
+
}
|
|
@@ -32,7 +32,10 @@ export function FormDateTimeDriver(
|
|
|
32
32
|
dateExists: () => dateBase.exists(),
|
|
33
33
|
timeExists: () => timeBase.exists(),
|
|
34
34
|
enterDateText: (text: string) => datePicker.inputDriver.enterText(text),
|
|
35
|
+
getDateText: () => datePicker.inputDriver.getValue(),
|
|
35
36
|
blurDate: () => datePicker.inputDriver.blur(),
|
|
37
|
+
enterTimeText: (text: string) => timeInput.setValue(text),
|
|
38
|
+
blurTime: () => timeInput.confirmValue(),
|
|
36
39
|
dateHasError: () => datePicker.inputDriver.hasStatus('error'),
|
|
37
40
|
getDateErrorMessage: () => datePicker.inputDriver.getStatusMessage(),
|
|
38
41
|
timeHasError: () =>
|
|
@@ -13,6 +13,7 @@ import { useController } from '@wix/bex-core/form';
|
|
|
13
13
|
import { BaseInputProps, BaseInputRef } from '../../types/base-input';
|
|
14
14
|
import { useTranslations } from '../../hooks';
|
|
15
15
|
import { isEmpty } from '../../validations/string';
|
|
16
|
+
import { useFieldValueReplacement } from '../date-input/use-field-value-replacement';
|
|
16
17
|
import {
|
|
17
18
|
calendarPopoverDefaults,
|
|
18
19
|
dropdownPopoverDefaults,
|
|
@@ -24,6 +25,7 @@ const _FormDateTime = (props: FormDateTimeProps) => {
|
|
|
24
25
|
const { field, dataHook, inputRef, formControl, data } = props;
|
|
25
26
|
const { translate: t } = useWixPatternsContainer();
|
|
26
27
|
const { t: tFields } = useTranslations();
|
|
28
|
+
const inputErrors = useRef({ date: '', time: '' });
|
|
27
29
|
|
|
28
30
|
const controller = useController({
|
|
29
31
|
name: field?.id ?? '',
|
|
@@ -31,6 +33,10 @@ const _FormDateTime = (props: FormDateTimeProps) => {
|
|
|
31
33
|
defaultValue: data?.[field?.id ?? ''],
|
|
32
34
|
rules: {
|
|
33
35
|
validate: (v) => {
|
|
36
|
+
const inputError = inputErrors.current.date || inputErrors.current.time;
|
|
37
|
+
if (inputError) {
|
|
38
|
+
return inputError;
|
|
39
|
+
}
|
|
34
40
|
if (field?.validation?.required && isEmpty(v)) {
|
|
35
41
|
return t('cairo.fieldValidation.requiredField');
|
|
36
42
|
}
|
|
@@ -49,6 +55,19 @@ const _FormDateTime = (props: FormDateTimeProps) => {
|
|
|
49
55
|
|
|
50
56
|
const [dateStatusMessage, setDateStatusMessage] = useState('');
|
|
51
57
|
const [timeStatusMessage, setTimeStatusMessage] = useState('');
|
|
58
|
+
const formError =
|
|
59
|
+
!dateStatusMessage && !timeStatusMessage
|
|
60
|
+
? controller.fieldState.error
|
|
61
|
+
: undefined;
|
|
62
|
+
|
|
63
|
+
const setDateError = (error: string) => {
|
|
64
|
+
inputErrors.current.date = error;
|
|
65
|
+
setDateStatusMessage(error);
|
|
66
|
+
};
|
|
67
|
+
const setTimeError = (error: string) => {
|
|
68
|
+
inputErrors.current.time = error;
|
|
69
|
+
setTimeStatusMessage(error);
|
|
70
|
+
};
|
|
52
71
|
|
|
53
72
|
const ref = useRef<BaseInputRef>({});
|
|
54
73
|
const dateRef = useRef<BaseInputRef>({});
|
|
@@ -59,6 +78,16 @@ const _FormDateTime = (props: FormDateTimeProps) => {
|
|
|
59
78
|
const [timeValue, setTimeValue] = useState<number | string | undefined>(
|
|
60
79
|
date?.getTime(),
|
|
61
80
|
);
|
|
81
|
+
const revision = useFieldValueReplacement(formControl, field.id, (value) => {
|
|
82
|
+
setDateError('');
|
|
83
|
+
setTimeError('');
|
|
84
|
+
ref.current.invalid = false;
|
|
85
|
+
dateRef.current.invalid = false;
|
|
86
|
+
timeRef.current.invalid = false;
|
|
87
|
+
const nextDate = typeof value === 'string' ? new Date(value) : undefined;
|
|
88
|
+
setDateValue(nextDate?.getDate());
|
|
89
|
+
setTimeValue(nextDate?.getTime());
|
|
90
|
+
});
|
|
62
91
|
|
|
63
92
|
useEffect(() => {
|
|
64
93
|
ref.current.focus = () => {
|
|
@@ -81,6 +110,7 @@ const _FormDateTime = (props: FormDateTimeProps) => {
|
|
|
81
110
|
<Layout gap="12px">
|
|
82
111
|
<Cell span={6}>
|
|
83
112
|
<DatePicker
|
|
113
|
+
key={revision}
|
|
84
114
|
ref={(internalRef) => {
|
|
85
115
|
const inputEl =
|
|
86
116
|
// TODO: PR to WSR needed to expose as public API
|
|
@@ -99,6 +129,7 @@ const _FormDateTime = (props: FormDateTimeProps) => {
|
|
|
99
129
|
// onChange is triggered only when you have valid, non-empty value.
|
|
100
130
|
// and onValidate is triggered on every change so we use onValidate
|
|
101
131
|
onValidate={({ validationType, value: newValue, format }) => {
|
|
132
|
+
let value = controller.field.value;
|
|
102
133
|
if (validationType === 'valid') {
|
|
103
134
|
const dateWithNewDate = date
|
|
104
135
|
? new Date(date)
|
|
@@ -107,26 +138,24 @@ const _FormDateTime = (props: FormDateTimeProps) => {
|
|
|
107
138
|
dateWithNewDate.setFullYear(_value.getFullYear());
|
|
108
139
|
dateWithNewDate.setMonth(_value.getMonth());
|
|
109
140
|
dateWithNewDate.setDate(_value.getDate());
|
|
110
|
-
|
|
141
|
+
value = dateWithNewDate.toISOString();
|
|
111
142
|
setDateValue(new Date(newValue).getDate());
|
|
112
|
-
|
|
143
|
+
setDateError('');
|
|
113
144
|
dateRef.current.invalid = false;
|
|
114
145
|
} else if (validationType === 'formatError' && newValue === '') {
|
|
115
146
|
if (field.validation?.required) {
|
|
116
|
-
|
|
117
|
-
t('cairo.fieldValidation.requiredField'),
|
|
118
|
-
);
|
|
147
|
+
setDateError(t('cairo.fieldValidation.requiredField'));
|
|
119
148
|
dateRef.current.invalid = true;
|
|
120
149
|
} else {
|
|
121
|
-
|
|
150
|
+
setDateError('');
|
|
122
151
|
dateRef.current.invalid = false;
|
|
123
152
|
}
|
|
124
153
|
setDateValue(newValue);
|
|
125
154
|
if (!timeValue) {
|
|
126
|
-
|
|
155
|
+
value = null;
|
|
127
156
|
}
|
|
128
157
|
} else {
|
|
129
|
-
|
|
158
|
+
setDateError(
|
|
130
159
|
t('cairo.customFields.fieldType.date.invalid.value', {
|
|
131
160
|
dateFormat: format ?? '',
|
|
132
161
|
}),
|
|
@@ -136,21 +165,17 @@ const _FormDateTime = (props: FormDateTimeProps) => {
|
|
|
136
165
|
|
|
137
166
|
ref.current.invalid =
|
|
138
167
|
dateRef.current.invalid || timeRef.current.invalid;
|
|
168
|
+
controller.field.onChange(value);
|
|
139
169
|
}}
|
|
140
|
-
status={
|
|
141
|
-
|
|
142
|
-
? 'error'
|
|
143
|
-
: undefined
|
|
144
|
-
}
|
|
145
|
-
statusMessage={
|
|
146
|
-
controller.fieldState.error?.message || dateStatusMessage
|
|
147
|
-
}
|
|
170
|
+
status={dateStatusMessage || formError ? 'error' : undefined}
|
|
171
|
+
statusMessage={dateStatusMessage || formError?.message}
|
|
148
172
|
dataHook={`datetime-date-${field.id}`}
|
|
149
173
|
popoverProps={calendarPopoverDefaults}
|
|
150
174
|
/>
|
|
151
175
|
</Cell>
|
|
152
176
|
<Cell span={6}>
|
|
153
177
|
<TimeInput
|
|
178
|
+
key={revision}
|
|
154
179
|
ref={(internalRef) => {
|
|
155
180
|
timeRef.current.focus = () => internalRef?.focus();
|
|
156
181
|
}}
|
|
@@ -159,23 +184,19 @@ const _FormDateTime = (props: FormDateTimeProps) => {
|
|
|
159
184
|
placeholder={tFields('CMS.formTime.placeholder')}
|
|
160
185
|
invalidMessage={tFields('CMS.formTime.invalidMessage')}
|
|
161
186
|
value={date ?? null}
|
|
162
|
-
status={
|
|
163
|
-
|
|
164
|
-
? 'error'
|
|
165
|
-
: undefined
|
|
166
|
-
}
|
|
167
|
-
statusMessage={
|
|
168
|
-
controller.fieldState.error?.message || timeStatusMessage
|
|
169
|
-
}
|
|
187
|
+
status={timeStatusMessage || formError ? 'error' : undefined}
|
|
188
|
+
statusMessage={timeStatusMessage || formError?.message}
|
|
170
189
|
onInvalid={() => {
|
|
171
190
|
timeRef.current.invalid = true;
|
|
172
|
-
|
|
191
|
+
setTimeError(
|
|
173
192
|
t('cairo.customFields.fieldType.dateAndTime.invalid.value'),
|
|
174
193
|
);
|
|
175
194
|
ref.current.invalid =
|
|
176
195
|
dateRef.current.invalid || timeRef.current.invalid;
|
|
196
|
+
controller.field.onChange(controller.field.value);
|
|
177
197
|
}}
|
|
178
198
|
onChange={({ date: newValue }) => {
|
|
199
|
+
let value = controller.field.value;
|
|
179
200
|
timeRef.current.invalid = false;
|
|
180
201
|
ref.current.invalid =
|
|
181
202
|
dateRef.current.invalid || timeRef.current.invalid;
|
|
@@ -186,28 +207,29 @@ const _FormDateTime = (props: FormDateTimeProps) => {
|
|
|
186
207
|
dateWithNewTime.setMinutes(newValue.getMinutes());
|
|
187
208
|
dateWithNewTime.setSeconds(newValue.getSeconds());
|
|
188
209
|
dateWithNewTime.setMilliseconds(newValue.getMilliseconds());
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
210
|
+
value = dateWithNewTime.toISOString();
|
|
211
|
+
setTimeError('');
|
|
212
|
+
if (!dateRef.current.invalid) {
|
|
213
|
+
setDateError('');
|
|
214
|
+
}
|
|
192
215
|
} else {
|
|
193
216
|
if (!newValue) {
|
|
194
217
|
setTimeValue('');
|
|
195
218
|
if (field.validation?.required) {
|
|
196
|
-
|
|
197
|
-
t('cairo.fieldValidation.requiredField'),
|
|
198
|
-
);
|
|
219
|
+
setTimeError(t('cairo.fieldValidation.requiredField'));
|
|
199
220
|
timeRef.current.invalid = true;
|
|
200
221
|
} else {
|
|
201
|
-
|
|
222
|
+
setTimeError('');
|
|
202
223
|
timeRef.current.invalid = false;
|
|
203
224
|
}
|
|
204
225
|
if (!ref.current.invalid) {
|
|
205
226
|
if (!dateValue) {
|
|
206
|
-
|
|
227
|
+
value = null;
|
|
207
228
|
}
|
|
208
229
|
}
|
|
209
230
|
}
|
|
210
231
|
}
|
|
232
|
+
controller.field.onChange(value);
|
|
211
233
|
}}
|
|
212
234
|
/>
|
|
213
235
|
</Cell>
|
|
@@ -5,7 +5,7 @@ import { classesRuntime, statesRuntime } from "../../stylable-esm-runtime.js";
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "deletedialog2793524866";
|
|
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":"deletedialog2793524866__root","layout":"deletedialog2793524866__layout"};
|
|
17
17
|
export var keyframes = {};
|
|
18
18
|
export var layers = {};
|
|
19
19
|
export var containers = {};
|
|
@@ -5,7 +5,7 @@ import { classesRuntime, statesRuntime } from "../../stylable-esm-runtime.js";
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "formdocumentfield3083378965";
|
|
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":"formdocumentfield3083378965__root","viewWrapper":"formdocumentfield3083378965__viewWrapper","textWidth":"formdocumentfield3083378965__textWidth","documentLoader":"formdocumentfield3083378965__documentLoader","addDocument":"formdocumentfield3083378965__addDocument","addItemWrapper":"formdocumentfield3083378965__addItemWrapper"};
|
|
17
17
|
export var keyframes = {};
|
|
18
18
|
export var layers = {};
|
|
19
19
|
export var containers = {};
|
|
@@ -5,7 +5,7 @@ import { classesRuntime, statesRuntime } from "../../stylable-esm-runtime.js";
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "exclamation2723601405";
|
|
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":"exclamation2723601405__root","exclamation":"exclamation2723601405__exclamation","actions":"exclamation2723601405__actions","action":"exclamation2723601405__action"};
|
|
17
17
|
export var keyframes = {};
|
|
18
18
|
export var layers = {};
|
|
19
19
|
export var containers = {};
|
|
@@ -5,7 +5,7 @@ import { classesRuntime, statesRuntime } from "../../stylable-esm-runtime.js";
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "highlightedtext38924617";
|
|
9
9
|
var _style_ = classesRuntime.bind(null, _namespace_);
|
|
10
10
|
|
|
11
11
|
export var cssStates = statesRuntime.bind(null, _namespace_);
|
|
@@ -13,8 +13,8 @@ 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":"
|
|
17
|
-
export var keyframes = {"highlighted":"
|
|
16
|
+
export var classes = {"root":"highlightedtext38924617__root","substring":"highlightedtext38924617__substring"};
|
|
17
|
+
export var keyframes = {"highlighted":"highlightedtext38924617__highlighted","highlighted-match":"highlightedtext38924617__highlighted-match"};
|
|
18
18
|
export var layers = {};
|
|
19
19
|
export var containers = {};
|
|
20
20
|
export var stVars = {};
|
|
@@ -5,7 +5,7 @@ import { classesRuntime, statesRuntime } from "../../stylable-esm-runtime.js";
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "thumbnailreplaceoverlay1453798223";
|
|
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":"thumbnailreplaceoverlay1453798223__root","icon":"thumbnailreplaceoverlay1453798223__icon"};
|
|
17
17
|
export var keyframes = {};
|
|
18
18
|
export var layers = {};
|
|
19
19
|
export var containers = {};
|