@wix/patterns-fields 1.18.0 → 1.22.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/assets/locale/messages_en.json +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-player/audio-player.st.css.js +2 -2
- package/dist/cjs/components/audio/audio-player/audio-player.st.css.js.map +1 -1
- package/dist/cjs/components/color-view/color-view.st.css.js +4 -4
- package/dist/cjs/components/color-view/color-view.st.css.js.map +1 -1
- package/dist/cjs/components/delete-dialog/delete-dialog.st.css.js +3 -3
- package/dist/cjs/components/delete-dialog/delete-dialog.st.css.js.map +1 -1
- package/dist/cjs/components/document/form-document-field.st.css.js +7 -7
- package/dist/cjs/components/document/form-document-field.st.css.js.map +1 -1
- package/dist/cjs/components/exclamation/exclamation.st.css.js +5 -5
- package/dist/cjs/components/exclamation/exclamation.st.css.js.map +1 -1
- package/dist/cjs/components/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/cell-image-edit.js +35 -112
- package/dist/cjs/components/image/cell-image-edit.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/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/cell-media-gallery-edit.js +301 -0
- package/dist/cjs/components/media-gallery/cell-media-gallery-edit.js.map +1 -0
- package/dist/cjs/components/media-gallery/cell-media-gallery-view.js +45 -0
- package/dist/cjs/components/media-gallery/cell-media-gallery-view.js.map +1 -0
- 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/index.js +12 -0
- package/dist/cjs/components/media-gallery/index.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 +4 -4
- 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/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/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js +6 -6
- 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 +5 -5
- 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 +8 -8
- 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 +4 -4
- 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 +20 -20
- 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 +20 -20
- package/dist/cjs/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js.map +1 -1
- package/dist/cjs/components/text/text-view.st.css.js +3 -3
- package/dist/cjs/components/text/text-view.st.css.js.map +1 -1
- package/dist/cjs/hooks/index.js +6 -0
- package/dist/cjs/hooks/index.js.map +1 -1
- package/dist/cjs/hooks/use-cell-edit-keyboard.js +94 -0
- package/dist/cjs/hooks/use-cell-edit-keyboard.js.map +1 -0
- package/dist/cjs/styles.global.css +1 -1
- package/dist/esm/assets/locale/messages_en.json +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-player/audio-player.st.css.js +2 -2
- package/dist/esm/components/audio/audio-player/audio-player.st.css.js.map +1 -1
- package/dist/esm/components/color-view/color-view.st.css.js +2 -2
- package/dist/esm/components/color-view/color-view.st.css.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/exclamation/exclamation.st.css.js +2 -2
- package/dist/esm/components/exclamation/exclamation.st.css.js.map +1 -1
- package/dist/esm/components/highlighted-text/highlighted-text.st.css.js +3 -3
- package/dist/esm/components/image/cell-image-edit.js +7 -81
- package/dist/esm/components/image/cell-image-edit.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/paste-url-button.st.css.js +2 -2
- package/dist/esm/components/media-gallery/cell-media-gallery-edit.js +103 -0
- package/dist/esm/components/media-gallery/cell-media-gallery-edit.js.map +1 -0
- package/dist/esm/components/media-gallery/cell-media-gallery-view.js +11 -0
- package/dist/esm/components/media-gallery/cell-media-gallery-view.js.map +1 -0
- package/dist/esm/components/media-gallery/form-media-gallery-field.st.css.js +2 -2
- package/dist/esm/components/media-gallery/index.js +2 -0
- package/dist/esm/components/media-gallery/index.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 +3 -3
- package/dist/esm/components/media-loader/media-loader.st.css.js +2 -2
- package/dist/esm/components/media-tag/web-media-tag/media-tag.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/multi-document/multi-document-input/form-multi-document.st.css.js.map +1 -1
- package/dist/esm/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.js +3 -3
- 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-read-only-input/rich-content-form-read-only-input.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-common/fullscreen-modal/fullscreen-modal.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-common/publish-loader/publish-loader.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-common/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-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.js.map +1 -1
- package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js +3 -3
- package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.js.map +1 -1
- package/dist/esm/components/rich-content/rich-content-input/rich-content-editor/rich-content-toolbar.st.css.js +2 -2
- package/dist/esm/components/rich-content/rich-content-input/rich-content-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 +3 -3
- 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 +3 -3
- package/dist/esm/components/rich-text/rich-text-input/rich-text-editor/toolbar/toolbar.st.css.js.map +1 -1
- package/dist/esm/components/text/text-view.st.css.js +2 -2
- package/dist/esm/hooks/index.js +1 -0
- package/dist/esm/hooks/index.js.map +1 -1
- package/dist/esm/hooks/use-cell-edit-keyboard.js +81 -0
- package/dist/esm/hooks/use-cell-edit-keyboard.js.map +1 -0
- package/dist/esm/styles.global.css +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-player/audio-player.st.css.d.ts.map +1 -1
- package/dist/types/components/color-view/color-view.st.css.d.ts.map +1 -1
- package/dist/types/components/exclamation/exclamation.st.css.d.ts.map +1 -1
- package/dist/types/components/image/cell-image-edit.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-gallery/cell-media-gallery-edit.d.ts +15 -0
- package/dist/types/components/media-gallery/cell-media-gallery-edit.d.ts.map +1 -0
- package/dist/types/components/media-gallery/cell-media-gallery-view.d.ts +11 -0
- package/dist/types/components/media-gallery/cell-media-gallery-view.d.ts.map +1 -0
- package/dist/types/components/media-gallery/index.d.ts +2 -0
- package/dist/types/components/media-gallery/index.d.ts.map +1 -1
- package/dist/types/components/multi-document/multi-document-input/form-multi-document.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-content/rich-content-input/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-common/toggle-fullscreen-button/toggle-fullscreen-button.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-content/rich-content-input/rich-content-editor/rich-content-editor.st.css.d.ts.map +1 -1
- package/dist/types/components/rich-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/toolbar/toolbar.st.css.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-cell-edit-keyboard.d.ts +26 -0
- package/dist/types/hooks/use-cell-edit-keyboard.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/assets/locale/messages_en.json +1 -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-player/audio-player.st.css.ts +2 -2
- package/src/components/color-view/color-view.st.css.ts +2 -2
- package/src/components/delete-dialog/delete-dialog.st.css.ts +2 -2
- package/src/components/document/form-document-field.st.css.ts +2 -2
- package/src/components/exclamation/exclamation.st.css.ts +2 -2
- package/src/components/highlighted-text/highlighted-text.st.css.ts +3 -3
- package/src/components/image/cell-image-edit.tsx +7 -89
- package/src/components/image/thumbnail-replace-overlay.st.css.ts +2 -2
- package/src/components/media-control/paste-url-button.st.css.ts +2 -2
- package/src/components/media-gallery/cell-media-gallery-edit.tsx +223 -0
- package/src/components/media-gallery/cell-media-gallery-view.tsx +35 -0
- package/src/components/media-gallery/form-media-gallery-field.st.css.ts +2 -2
- package/src/components/media-gallery/index.ts +2 -0
- package/src/components/media-image/media-image.st.css.ts +3 -3
- package/src/components/media-image/overlays/overlay.st.css.ts +3 -3
- 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/multi-document-input/form-multi-document.st.css.ts +2 -2
- package/src/components/rich-content/rich-content-input/default-value-input/rich-content-default-value-input.st.css.ts +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- package/src/components/text/text-view.st.css.ts +2 -2
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-cell-edit-keyboard.ts +109 -0
- package/src/styles.global.css +1 -1
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface UseCellEditKeyboardOptions {
|
|
3
|
+
containerRef: React.RefObject<HTMLDivElement | null>;
|
|
4
|
+
onCancel?: () => void;
|
|
5
|
+
inputRef?: React.MutableRefObject<{
|
|
6
|
+
focus: () => void;
|
|
7
|
+
} | null | undefined>;
|
|
8
|
+
}
|
|
9
|
+
interface UseCellEditKeyboardResult {
|
|
10
|
+
handleContainerFocus: () => void;
|
|
11
|
+
handleContainerBlur: (e: React.FocusEvent) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Shared keyboard/focus wiring for cell-edit components that contain buttons.
|
|
15
|
+
*
|
|
16
|
+
* - Wires inputRef so the parent table can focus the first button on Enter.
|
|
17
|
+
* - Sets/removes data-inner-focused on the container for CSS styling.
|
|
18
|
+
* - Native keydown handler: Escape → onCancel + return focus to gridcell;
|
|
19
|
+
* Tab / Shift+Tab → cycle through buttons, Tab off last returns to gridcell.
|
|
20
|
+
*
|
|
21
|
+
* Must use a native listener (not React onKeyDown) so stopPropagation fires
|
|
22
|
+
* before the React root's useKeyboardNavigation intercepts Tab.
|
|
23
|
+
*/
|
|
24
|
+
export declare function useCellEditKeyboard({ containerRef, onCancel, inputRef, }: UseCellEditKeyboardOptions): UseCellEditKeyboardResult;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=use-cell-edit-keyboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-cell-edit-keyboard.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-cell-edit-keyboard.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,UAAU,0BAA0B;IAClC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;IACrD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC;QAAE,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;CAC7E;AAED,UAAU,yBAAyB;IACjC,oBAAoB,EAAE,MAAM,IAAI,CAAC;IACjC,mBAAmB,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,UAAU,KAAK,IAAI,CAAC;CACpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,YAAY,EACZ,QAAQ,EACR,QAAQ,GACT,EAAE,0BAA0B,GAAG,yBAAyB,CA+ExD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/patterns-fields",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.22.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Kobi",
|
|
@@ -112,7 +112,7 @@
|
|
|
112
112
|
"@wix/atlas": "^1.0.35",
|
|
113
113
|
"@wix/data": "^1.0.323",
|
|
114
114
|
"@wix/media": "^1.0.231",
|
|
115
|
-
"@wix/patterns-fields-utils": "1.
|
|
115
|
+
"@wix/patterns-fields-utils": "1.14.0",
|
|
116
116
|
"@wix/rich-content": "1.0.37",
|
|
117
117
|
"@wix/ricos": "^10.155.2",
|
|
118
118
|
"@wix/wix-ui-icons-common": "^3.100.0",
|
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"@types/jest": "^27.5.2",
|
|
139
139
|
"@types/lodash": "^4.17.20",
|
|
140
140
|
"@types/react": "^16.14.68",
|
|
141
|
-
"@wix/bex-core": "2.
|
|
141
|
+
"@wix/bex-core": "2.303.0",
|
|
142
142
|
"@wix/design-system": "^1.271.0",
|
|
143
143
|
"@wix/eslint-config-yoshi": "^6.74.0",
|
|
144
144
|
"@wix/jest-yoshi-preset": "^6.74.0",
|
|
@@ -192,5 +192,5 @@
|
|
|
192
192
|
"type": "yoshi-flow-library"
|
|
193
193
|
}
|
|
194
194
|
},
|
|
195
|
-
"falconPackageHash": "
|
|
195
|
+
"falconPackageHash": "bc89993b0834f04e63dde1b389796b5ab39bb4df896ed6498ac3811f"
|
|
196
196
|
}
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
"CMS.mediaGallery.emptyHint": "Select images and videos to add",
|
|
96
96
|
"CMS.mediaGallery.manageGallery": "Manage media",
|
|
97
97
|
"CMS.mediaGallery.preview": "Preview",
|
|
98
|
-
"CMS.mediaGallery.clear": "
|
|
98
|
+
"CMS.mediaGallery.clear": "Delete gallery",
|
|
99
99
|
"CMS.mediaGallery.addMedia": "Add media",
|
|
100
100
|
"CMS.mediaGallery.replaceItem": "Replace Media",
|
|
101
101
|
|
|
@@ -5,7 +5,7 @@ import { classesRuntime, statesRuntime } from "../../../stylable-esm-runtime.js"
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "addressinput3960735310";
|
|
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":"addressinput3960735310__root","tableAddressInput":"addressinput3960735310__tableAddressInput"};
|
|
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.
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "actionsmenu3677708562";
|
|
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":"actionsmenu3677708562__root","action":"actionsmenu3677708562__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_ = "formaudiofield659327102";
|
|
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":"formaudiofield659327102__root","addItem":"formaudiofield659327102__addItem","mediaTitle":"formaudiofield659327102__mediaTitle"};
|
|
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_ = "audioplayer469313110";
|
|
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":"audioplayer469313110__root"};
|
|
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_ = "colorview2990793565";
|
|
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":"colorview2990793565__root","view":"colorview2990793565__view","fillPreview":"colorview2990793565__fillPreview"};
|
|
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_ = "deletedialog1621463198";
|
|
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":"deletedialog1621463198__root","layout":"deletedialog1621463198__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_ = "formdocumentfield4151355258";
|
|
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":"formdocumentfield4151355258__root","viewWrapper":"formdocumentfield4151355258__viewWrapper","textWidth":"formdocumentfield4151355258__textWidth","documentLoader":"formdocumentfield4151355258__documentLoader","addDocument":"formdocumentfield4151355258__addDocument","addItemWrapper":"formdocumentfield4151355258__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_ = "exclamation728294289";
|
|
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":"exclamation728294289__root","exclamation":"exclamation728294289__exclamation","actions":"exclamation728294289__actions","action":"exclamation728294289__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_ = "highlightedtext4166910545";
|
|
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":"highlightedtext4166910545__root","substring":"highlightedtext4166910545__substring"};
|
|
17
|
+
export var keyframes = {"highlighted":"highlightedtext4166910545__highlighted","highlighted-match":"highlightedtext4166910545__highlighted-match"};
|
|
18
18
|
export var layers = {};
|
|
19
19
|
export var containers = {};
|
|
20
20
|
export var stVars = {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useCallback,
|
|
1
|
+
import React, { useCallback, useRef } from 'react';
|
|
2
2
|
import {
|
|
3
3
|
Box,
|
|
4
4
|
IconButton,
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
Delete,
|
|
16
16
|
} from '@wix/wix-ui-icons-common';
|
|
17
17
|
import { MEDIA_TYPES } from '../../utils/media-utils';
|
|
18
|
-
import { useTranslations } from '../../hooks';
|
|
18
|
+
import { useTranslations, useCellEditKeyboard } from '../../hooks';
|
|
19
19
|
import {
|
|
20
20
|
useMediaControl,
|
|
21
21
|
usePasteURLForm,
|
|
@@ -98,93 +98,11 @@ export const CellImageEdit: React.FC<CellImageEditProps> = ({
|
|
|
98
98
|
onCommit();
|
|
99
99
|
}, [onChange, onCommit]);
|
|
100
100
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
focus: () => {
|
|
107
|
-
const first =
|
|
108
|
-
containerRef.current?.querySelectorAll<HTMLElement>('button')[0];
|
|
109
|
-
first?.focus();
|
|
110
|
-
},
|
|
111
|
-
};
|
|
112
|
-
return () => {
|
|
113
|
-
inputRef.current = null;
|
|
114
|
-
};
|
|
115
|
-
}, [inputRef]);
|
|
116
|
-
|
|
117
|
-
const handleContainerFocus = useCallback(() => {
|
|
118
|
-
containerRef.current?.setAttribute('data-inner-focused', '');
|
|
119
|
-
}, []);
|
|
120
|
-
|
|
121
|
-
const handleContainerBlur = useCallback((e: React.FocusEvent) => {
|
|
122
|
-
if (!e.currentTarget.contains(e.relatedTarget as Node | null)) {
|
|
123
|
-
containerRef.current?.removeAttribute('data-inner-focused');
|
|
124
|
-
}
|
|
125
|
-
}, []);
|
|
126
|
-
|
|
127
|
-
const focusCell = useCallback(() => {
|
|
128
|
-
const cellDiv = containerRef.current?.closest(
|
|
129
|
-
'[role="gridcell"]',
|
|
130
|
-
) as HTMLElement | null;
|
|
131
|
-
cellDiv?.focus({ preventScroll: true });
|
|
132
|
-
}, []);
|
|
133
|
-
|
|
134
|
-
// Native keydown listener — must be native (not React onKeyDown) so that
|
|
135
|
-
// e.stopPropagation() fires during the native bubble phase, before the event
|
|
136
|
-
// reaches the React root where useKeyboardNavigation's onKeyDown would
|
|
137
|
-
// otherwise intercept Tab and move to the next cell.
|
|
138
|
-
useEffect(() => {
|
|
139
|
-
const el = containerRef.current;
|
|
140
|
-
if (!el) return;
|
|
141
|
-
|
|
142
|
-
const handleKeyDown = (e: KeyboardEvent) => {
|
|
143
|
-
if (e.key === 'Escape') {
|
|
144
|
-
e.preventDefault();
|
|
145
|
-
e.stopPropagation();
|
|
146
|
-
// Cancel any in-progress edit (e.g. if isEditing was set before opening
|
|
147
|
-
// a modal that then got dismissed via keyboard), then return focus to the
|
|
148
|
-
// cell div. The useCellFocusAndEditing useEffect will also refocus the
|
|
149
|
-
// cell div if isEditing transitions false→false is a no-op, so we also
|
|
150
|
-
// call focusCell() directly as a reliable fallback.
|
|
151
|
-
onCancel?.();
|
|
152
|
-
focusCell();
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
// Tab while a button in this component is focused: cycle through the
|
|
157
|
-
// interactive elements. Tab off the last (or Shift+Tab off the first)
|
|
158
|
-
// returns focus to the cell div for normal cell-level navigation.
|
|
159
|
-
if (e.key === 'Tab') {
|
|
160
|
-
const buttons = Array.from(el.querySelectorAll<HTMLElement>('button'));
|
|
161
|
-
const currentIdx = buttons.indexOf(
|
|
162
|
-
document.activeElement as HTMLElement,
|
|
163
|
-
);
|
|
164
|
-
if (currentIdx === -1) return; // focus is not on one of our buttons — pass through
|
|
165
|
-
|
|
166
|
-
e.preventDefault();
|
|
167
|
-
e.stopPropagation();
|
|
168
|
-
|
|
169
|
-
if (!e.shiftKey) {
|
|
170
|
-
if (currentIdx >= buttons.length - 1) {
|
|
171
|
-
focusCell();
|
|
172
|
-
} else {
|
|
173
|
-
buttons[currentIdx + 1]?.focus();
|
|
174
|
-
}
|
|
175
|
-
} else {
|
|
176
|
-
if (currentIdx <= 0) {
|
|
177
|
-
focusCell();
|
|
178
|
-
} else {
|
|
179
|
-
buttons[currentIdx - 1]?.focus();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
el.addEventListener('keydown', handleKeyDown);
|
|
186
|
-
return () => el.removeEventListener('keydown', handleKeyDown);
|
|
187
|
-
}, [focusCell, onCancel]);
|
|
101
|
+
const { handleContainerFocus, handleContainerBlur } = useCellEditKeyboard({
|
|
102
|
+
containerRef,
|
|
103
|
+
onCancel,
|
|
104
|
+
inputRef,
|
|
105
|
+
});
|
|
188
106
|
|
|
189
107
|
if (loading) {
|
|
190
108
|
return (
|
|
@@ -5,7 +5,7 @@ import { classesRuntime, statesRuntime } from "../../stylable-esm-runtime.js";
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var _namespace_ = "
|
|
8
|
+
var _namespace_ = "thumbnailreplaceoverlay1904833214";
|
|
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":"thumbnailreplaceoverlay1904833214__root","icon":"thumbnailreplaceoverlay1904833214__icon"};
|
|
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_ = "pasteurlbutton2991491681";
|
|
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":"pasteurlbutton2991491681__root","iconButtonTooltip":"pasteurlbutton2991491681__iconButtonTooltip","iconButton":"pasteurlbutton2991491681__iconButton"};
|
|
17
17
|
export var keyframes = {};
|
|
18
18
|
export var layers = {};
|
|
19
19
|
export var containers = {};
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import React, { useCallback, useRef, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
AvatarGroup,
|
|
4
|
+
Box,
|
|
5
|
+
IconButton,
|
|
6
|
+
PopoverMenu,
|
|
7
|
+
Tooltip,
|
|
8
|
+
} from '@wix/design-system';
|
|
9
|
+
import {
|
|
10
|
+
Add,
|
|
11
|
+
MoreSmall,
|
|
12
|
+
Refresh,
|
|
13
|
+
Delete,
|
|
14
|
+
Maximize,
|
|
15
|
+
} from '@wix/wix-ui-icons-common';
|
|
16
|
+
import { files } from '@wix/media';
|
|
17
|
+
import {
|
|
18
|
+
mediaURItoImageURL,
|
|
19
|
+
ThumbnailSize,
|
|
20
|
+
getMediaURL,
|
|
21
|
+
} from '../../auto-field-types';
|
|
22
|
+
import type { WixCodeGalleryItem } from '../../auto-field-types';
|
|
23
|
+
import { useTranslations, useCellEditKeyboard } from '../../hooks';
|
|
24
|
+
import { executeDownloading } from '../../utils/media-utils';
|
|
25
|
+
import { useMediaGalleryDialog } from './media-gallery-dialog/hooks';
|
|
26
|
+
import { MediaGalleryDialog } from './media-gallery-dialog/media-gallery-dialog';
|
|
27
|
+
import { MediaPreviewModal } from './media-preview-modal';
|
|
28
|
+
|
|
29
|
+
const mediaGalleryPreviewTextKeys = {
|
|
30
|
+
replace: 'CMS.mediaGallery.preview.replace',
|
|
31
|
+
download: 'CMS.mediaGallery.preview.download',
|
|
32
|
+
delete: 'CMS.mediaGallery.preview.delete',
|
|
33
|
+
} as const;
|
|
34
|
+
|
|
35
|
+
export interface CellMediaGalleryEditProps {
|
|
36
|
+
value: WixCodeGalleryItem[] | null;
|
|
37
|
+
onChange: (value: WixCodeGalleryItem[] | null) => void;
|
|
38
|
+
onCommit: () => void;
|
|
39
|
+
onCancel?: () => void;
|
|
40
|
+
onStartEdit?: () => void;
|
|
41
|
+
inputRef?: React.MutableRefObject<{ focus: () => void } | null | undefined>;
|
|
42
|
+
dataHook?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export const CellMediaGalleryEdit: React.FC<CellMediaGalleryEditProps> = ({
|
|
46
|
+
value,
|
|
47
|
+
onChange,
|
|
48
|
+
onCommit,
|
|
49
|
+
onCancel,
|
|
50
|
+
onStartEdit,
|
|
51
|
+
inputRef,
|
|
52
|
+
dataHook,
|
|
53
|
+
}) => {
|
|
54
|
+
const { t } = useTranslations();
|
|
55
|
+
const containerRef = useRef<HTMLDivElement | null>(null);
|
|
56
|
+
const hasValue = Boolean(value?.length);
|
|
57
|
+
const [isPreviewOpen, setIsPreviewOpen] = useState(false);
|
|
58
|
+
// Tracks whether a commit happened during the current external-UI session.
|
|
59
|
+
// Prevents calling onCancel() after the user already committed (e.g., clear
|
|
60
|
+
// in the preview modal fires onClear then onClose, but we should not cancel).
|
|
61
|
+
const didCommitRef = useRef(false);
|
|
62
|
+
|
|
63
|
+
const avatarItems = (value ?? []).map((item) => ({
|
|
64
|
+
imgProps: { src: mediaURItoImageURL(item.src, ThumbnailSize.S) },
|
|
65
|
+
}));
|
|
66
|
+
|
|
67
|
+
const { openMediaGalleryDialog, ...dialogProps } = useMediaGalleryDialog({
|
|
68
|
+
initialOpen: false,
|
|
69
|
+
items: value ?? [],
|
|
70
|
+
onChange: (items: WixCodeGalleryItem[]) => {
|
|
71
|
+
didCommitRef.current = true;
|
|
72
|
+
onChange(items.length > 0 ? items : null);
|
|
73
|
+
onCommit();
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const handleOpenGallery = useCallback(() => {
|
|
78
|
+
didCommitRef.current = false;
|
|
79
|
+
onStartEdit?.();
|
|
80
|
+
openMediaGalleryDialog();
|
|
81
|
+
}, [onStartEdit, openMediaGalleryDialog]);
|
|
82
|
+
|
|
83
|
+
const handleOpenPreview = useCallback(() => {
|
|
84
|
+
didCommitRef.current = false;
|
|
85
|
+
onStartEdit?.();
|
|
86
|
+
setIsPreviewOpen(true);
|
|
87
|
+
}, [onStartEdit]);
|
|
88
|
+
|
|
89
|
+
const handlePreviewClose = useCallback(() => {
|
|
90
|
+
setIsPreviewOpen(false);
|
|
91
|
+
if (!didCommitRef.current) {
|
|
92
|
+
onCancel?.();
|
|
93
|
+
}
|
|
94
|
+
didCommitRef.current = false;
|
|
95
|
+
}, [onCancel]);
|
|
96
|
+
|
|
97
|
+
const handlePreviewRequestMedia = useCallback(() => {
|
|
98
|
+
setIsPreviewOpen(false);
|
|
99
|
+
openMediaGalleryDialog();
|
|
100
|
+
}, [openMediaGalleryDialog]);
|
|
101
|
+
|
|
102
|
+
const handlePreviewClear = useCallback(() => {
|
|
103
|
+
didCommitRef.current = true;
|
|
104
|
+
onChange(null);
|
|
105
|
+
onCommit();
|
|
106
|
+
}, [onChange, onCommit]);
|
|
107
|
+
|
|
108
|
+
const handleClearAll = useCallback(() => {
|
|
109
|
+
onChange(null);
|
|
110
|
+
onCommit();
|
|
111
|
+
}, [onChange, onCommit]);
|
|
112
|
+
|
|
113
|
+
const onDownloadMedia = useCallback(
|
|
114
|
+
async (mediaUri?: string) => {
|
|
115
|
+
const uri = mediaUri ?? value?.[0]?.src;
|
|
116
|
+
if (!uri) return;
|
|
117
|
+
try {
|
|
118
|
+
const result = await files.generateFileDownloadUrl(uri);
|
|
119
|
+
const downloadUrl = result.downloadUrls?.[0]?.url;
|
|
120
|
+
if (!downloadUrl) throw new Error('No download URL returned');
|
|
121
|
+
executeDownloading(downloadUrl);
|
|
122
|
+
} catch {
|
|
123
|
+
executeDownloading(getMediaURL(uri));
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
[value],
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
const { handleContainerFocus, handleContainerBlur } = useCellEditKeyboard({
|
|
130
|
+
containerRef,
|
|
131
|
+
onCancel,
|
|
132
|
+
inputRef,
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<div
|
|
137
|
+
ref={containerRef}
|
|
138
|
+
data-hook={dataHook}
|
|
139
|
+
style={{ width: '100%', height: '100%' }}
|
|
140
|
+
onFocus={handleContainerFocus}
|
|
141
|
+
onBlur={handleContainerBlur}
|
|
142
|
+
>
|
|
143
|
+
<Box
|
|
144
|
+
align="space-between"
|
|
145
|
+
verticalAlign="middle"
|
|
146
|
+
height="100%"
|
|
147
|
+
padding="0 8px"
|
|
148
|
+
style={{ boxSizing: 'border-box' }}
|
|
149
|
+
>
|
|
150
|
+
{hasValue ? (
|
|
151
|
+
<AvatarGroup items={avatarItems} size="tiny" type="condensed" />
|
|
152
|
+
) : (
|
|
153
|
+
<Tooltip content={t('CMS.mediaGallery.addGallery')} appendTo="window">
|
|
154
|
+
<IconButton
|
|
155
|
+
size="tiny"
|
|
156
|
+
priority="secondary"
|
|
157
|
+
dataHook="gallery-edit-add-button"
|
|
158
|
+
onClick={handleOpenGallery}
|
|
159
|
+
>
|
|
160
|
+
<Add />
|
|
161
|
+
</IconButton>
|
|
162
|
+
</Tooltip>
|
|
163
|
+
)}
|
|
164
|
+
|
|
165
|
+
{hasValue ? (
|
|
166
|
+
<PopoverMenu
|
|
167
|
+
textSize="small"
|
|
168
|
+
appendTo="window"
|
|
169
|
+
triggerElement={
|
|
170
|
+
<Tooltip
|
|
171
|
+
content={t('auto-patterns.fields.more_actions_tooltip')}
|
|
172
|
+
appendTo="window"
|
|
173
|
+
>
|
|
174
|
+
<IconButton
|
|
175
|
+
size="tiny"
|
|
176
|
+
priority="tertiary"
|
|
177
|
+
dataHook="gallery-edit-more-button"
|
|
178
|
+
>
|
|
179
|
+
<MoreSmall />
|
|
180
|
+
</IconButton>
|
|
181
|
+
</Tooltip>
|
|
182
|
+
}
|
|
183
|
+
>
|
|
184
|
+
<PopoverMenu.MenuItem
|
|
185
|
+
dataHook="gallery-edit-action-manage"
|
|
186
|
+
text={t('CMS.mediaGallery.manageGallery')}
|
|
187
|
+
prefixIcon={<Refresh />}
|
|
188
|
+
onClick={handleOpenGallery}
|
|
189
|
+
/>
|
|
190
|
+
<PopoverMenu.MenuItem
|
|
191
|
+
dataHook="gallery-edit-action-preview"
|
|
192
|
+
text={t('CMS.mediaGallery.preview')}
|
|
193
|
+
prefixIcon={<Maximize />}
|
|
194
|
+
onClick={handleOpenPreview}
|
|
195
|
+
/>
|
|
196
|
+
<PopoverMenu.Divider />
|
|
197
|
+
<PopoverMenu.MenuItem
|
|
198
|
+
dataHook="gallery-edit-action-clear"
|
|
199
|
+
text={t('CMS.mediaGallery.clear')}
|
|
200
|
+
skin="destructive"
|
|
201
|
+
prefixIcon={<Delete />}
|
|
202
|
+
onClick={handleClearAll}
|
|
203
|
+
/>
|
|
204
|
+
</PopoverMenu>
|
|
205
|
+
) : null}
|
|
206
|
+
</Box>
|
|
207
|
+
|
|
208
|
+
{dialogProps.isOpen && <MediaGalleryDialog {...dialogProps} />}
|
|
209
|
+
|
|
210
|
+
<MediaPreviewModal
|
|
211
|
+
isOpen={isPreviewOpen}
|
|
212
|
+
onClose={handlePreviewClose}
|
|
213
|
+
value={(value ?? []).map((item) => item.src)}
|
|
214
|
+
onRequestMedia={handlePreviewRequestMedia}
|
|
215
|
+
onClearMedia={handlePreviewClear}
|
|
216
|
+
onDownloadMedia={onDownloadMedia}
|
|
217
|
+
textKeys={mediaGalleryPreviewTextKeys}
|
|
218
|
+
/>
|
|
219
|
+
</div>
|
|
220
|
+
);
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
CellMediaGalleryEdit.displayName = 'CellMediaGalleryEdit';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AvatarGroup, Box } from '@wix/design-system';
|
|
3
|
+
import { mediaURItoImageURL, ThumbnailSize } from '../../auto-field-types';
|
|
4
|
+
import type { WixCodeGalleryItem } from '../../auto-field-types';
|
|
5
|
+
|
|
6
|
+
export interface CellMediaGalleryViewProps {
|
|
7
|
+
data: WixCodeGalleryItem[] | null;
|
|
8
|
+
dataHook?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function CellMediaGalleryView({
|
|
12
|
+
data,
|
|
13
|
+
dataHook,
|
|
14
|
+
}: CellMediaGalleryViewProps) {
|
|
15
|
+
const items = (data ?? []).map((item) => ({
|
|
16
|
+
imgProps: { src: mediaURItoImageURL(item.src, ThumbnailSize.S) },
|
|
17
|
+
}));
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<Box
|
|
21
|
+
dataHook={dataHook}
|
|
22
|
+
verticalAlign="middle"
|
|
23
|
+
height="100%"
|
|
24
|
+
width="100%"
|
|
25
|
+
padding="0 8px"
|
|
26
|
+
overflow="hidden"
|
|
27
|
+
>
|
|
28
|
+
{items.length > 0 ? (
|
|
29
|
+
<AvatarGroup items={items} size="tiny" type="condensed" />
|
|
30
|
+
) : null}
|
|
31
|
+
</Box>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
CellMediaGalleryView.displayName = 'CellMediaGalleryView';
|