@atlaskit/editor-common 103.11.0 → 103.12.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/CHANGELOG.md +32 -0
- package/afm-cc/tsconfig.json +3 -0
- package/dist/cjs/analytics/types/enums.js +1 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/styles/shared/resizer.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/FloatingToolbar/Button.js +2 -0
- package/dist/cjs/ui/TableSelector/index.js +270 -0
- package/dist/cjs/ui/TableSelector/table-selector.js +162 -0
- package/dist/cjs/ui/WidthProvider/index.js +1 -0
- package/dist/cjs/ui/index.js +7 -0
- package/dist/cjs/utils/get-dom-ref-from-selection.js +38 -0
- package/dist/es2019/analytics/types/enums.js +1 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/styles/shared/resizer.js +7 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/FloatingToolbar/Button.js +2 -0
- package/dist/es2019/ui/TableSelector/index.js +265 -0
- package/dist/es2019/ui/TableSelector/table-selector.js +154 -0
- package/dist/es2019/ui/WidthProvider/index.js +1 -0
- package/dist/es2019/ui/index.js +2 -1
- package/dist/es2019/utils/get-dom-ref-from-selection.js +32 -0
- package/dist/esm/analytics/types/enums.js +1 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/styles/shared/resizer.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/FloatingToolbar/Button.js +2 -0
- package/dist/esm/ui/TableSelector/index.js +264 -0
- package/dist/esm/ui/TableSelector/table-selector.js +154 -0
- package/dist/esm/ui/WidthProvider/index.js +1 -0
- package/dist/esm/ui/index.js +2 -1
- package/dist/esm/utils/get-dom-ref-from-selection.js +32 -0
- package/dist/types/analytics/types/enums.d.ts +1 -0
- package/dist/types/types/floating-toolbar.d.ts +1 -0
- package/dist/types/ui/FloatingToolbar/Button.d.ts +2 -1
- package/dist/types/ui/TableSelector/index.d.ts +28 -0
- package/dist/types/ui/TableSelector/table-selector.d.ts +31 -0
- package/dist/types/ui/index.d.ts +1 -0
- package/dist/types/utils/get-dom-ref-from-selection.d.ts +4 -0
- package/dist/types-ts4.5/analytics/types/enums.d.ts +1 -0
- package/dist/types-ts4.5/types/floating-toolbar.d.ts +1 -0
- package/dist/types-ts4.5/ui/FloatingToolbar/Button.d.ts +2 -1
- package/dist/types-ts4.5/ui/TableSelector/index.d.ts +28 -0
- package/dist/types-ts4.5/ui/TableSelector/table-selector.d.ts +31 -0
- package/dist/types-ts4.5/ui/index.d.ts +1 -0
- package/dist/types-ts4.5/utils/get-dom-ref-from-selection.d.ts +4 -0
- package/get-dom-ref-from-selection/package.json +17 -0
- package/package.json +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 103.12.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#142852](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/142852)
|
|
8
|
+
[`ca0f841e860ab`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ca0f841e860ab) -
|
|
9
|
+
[ux] [ED-27466] When table option in quick insert typeahead is selected, shows table size picker
|
|
10
|
+
allow user selecting the table size before inserting
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#142798](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/142798)
|
|
15
|
+
[`9dd2803c4c1dc`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9dd2803c4c1dc) -
|
|
16
|
+
Preserved the previously set value for width provider
|
|
17
|
+
|
|
18
|
+
## 103.11.2
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#143960](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/143960)
|
|
23
|
+
[`e1bf8964b3cf8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e1bf8964b3cf8) -
|
|
24
|
+
Adding press interaction performance tracking to Comment action in floating toolbar. No UI change.
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
27
|
+
## 103.11.1
|
|
28
|
+
|
|
29
|
+
### Patch Changes
|
|
30
|
+
|
|
31
|
+
- [#140969](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/140969)
|
|
32
|
+
[`b4ac22e73d43c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b4ac22e73d43c) -
|
|
33
|
+
[ux] [ED-27253] hide selection states until editor has been interacted with
|
|
34
|
+
|
|
3
35
|
## 103.11.0
|
|
4
36
|
|
|
5
37
|
### Minor Changes
|
package/afm-cc/tsconfig.json
CHANGED
|
@@ -433,6 +433,7 @@ var ACTION_SUBJECT_ID = exports.ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTIO
|
|
|
433
433
|
ACTION_SUBJECT_ID["PICKER_MEDIA"] = "mediaPicker";
|
|
434
434
|
ACTION_SUBJECT_ID["PICKER_COLOR"] = "colorPicker";
|
|
435
435
|
ACTION_SUBJECT_ID["PICKER_EMOJI"] = "emojiPicker";
|
|
436
|
+
ACTION_SUBJECT_ID["PICKER_TABLE_SIZE"] = "tableSizePicker";
|
|
436
437
|
ACTION_SUBJECT_ID["DOCKED_PRIMARY_TOOLBAR"] = "dockedPrimaryToolbar";
|
|
437
438
|
ACTION_SUBJECT_ID["PLACEHOLDER_TEXT"] = "placeholderText";
|
|
438
439
|
ACTION_SUBJECT_ID["POST_QUERY_SEARCH_RESULTS"] = "postQuerySearchResults";
|
|
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
19
19
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
20
|
-
var packageVersion = "103.
|
|
20
|
+
var packageVersion = "103.12.0";
|
|
21
21
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
22
22
|
// Remove URL as it has UGC
|
|
23
23
|
// Ignored via go/ees007
|
|
@@ -27,4 +27,4 @@ var handleWrapperClass = exports.handleWrapperClass = 'resizer-handle-wrapper';
|
|
|
27
27
|
var resizerHandleZIndex = exports.resizerHandleZIndex = 1;
|
|
28
28
|
|
|
29
29
|
// eslint-disable-next-line @atlaskit/design-system/no-css-tagged-template-expression, @atlaskit/ui-styling-standard/no-exported-styles -- Ignored via go/DSP-18766, Seems perfectly safe to autofix, but comments would be lost…
|
|
30
|
-
var resizerStyles = exports.resizerStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\twill-change: width;\n\n\t\t&:hover,\n\t\t&.display-handle {\n\t\t\t& > .", " > .", " {\n\t\t\t\tvisibility: visible;\n\t\t\t\topacity: 1;\n\t\t\t}\n\t\t}\n\n\t\t&.is-resizing {\n\t\t\t& .", " {\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&.", " {\n\t\t\t& .", " {\n\t\t\t\ttransition: none;\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\t\tvisibility: hidden;\n\t\topacity: 0;\n\t\tflex-direction: column;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\twidth: 7px;\n\t\ttransition:\n\t\t\tvisibility 0.2s,\n\t\t\topacity 0.2s;\n\n\t\t/*\n NOTE: The below style is targeted at the div element added by the tooltip. We don't have any means of injecting styles\n into the tooltip\n */\n\t\t& div[role='presentation'] {\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\t\t\tmargin-top: ", ";\n\t\t\twhite-space: normal;\n\t\t}\n\n\t\t/*\n Handle Positions\n */\n\t\t&.left {\n\t\t\talign-items: flex-start;\n\t\t}\n\t\t&.right {\n\t\t\talign-items: flex-end;\n\t\t}\n\n\t\t/*\n Handle Sizing\n */\n\t\t&.small {\n\t\t\t& .", " {\n\t\t\t\theight: 43px;\n\t\t\t}\n\t\t}\n\t\t&.medium {\n\t\t\t& .", " {\n\t\t\t\theight: 64px;\n\t\t\t}\n\t\t}\n\t\t&.large {\n\t\t\t& .", " {\n\t\t\t\theight: 96px;\n\t\t\t}\n\t\t}\n\t\t&.clamped {\n\t\t\t& .", " {\n\t\t\t\theight: clamp(43px, calc(100% - 32px), 96px);\n\t\t\t}\n\t\t}\n\n\t\t/*\n Handle Alignment\n */\n\t\t&.sticky {\n\t\t\t& .", " {\n\t\t\t\tposition: sticky;\n\t\t\t\ttop: ", ";\n\t\t\t\tbottom: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&:hover {\n\t\t\t& .", " {\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\n\t\t\t& .", " {\n\t\t\t\tvisibility: visible;\n\t\t\t\topacity: 0.5;\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tcontent: ' ';\n\t\tdisplay: flex;\n\t\twidth: 3px;\n\t\tmargin: 0 ", ";\n\t\theight: 64px;\n\t\ttransition: background-color 0.2s;\n\t\tborder-radius: 6px;\n\t\tborder: 0;\n\t\tpadding: 0;\n\t\tz-index: 2;\n\t\toutline: none;\n\t\tmin-height: 24px;\n\t\tbackground: ", ";\n\n\t\t&:hover {\n\t\t\tcursor: col-resize;\n\t\t}\n\n\t\t&:focus {\n\t\t\tbackground: ", ";\n\n\t\t\t&::after {\n\t\t\t\tcontent: '';\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: ", ";\n\t\t\t\tright: ", ";\n\t\t\t\tbottom: ", ";\n\t\t\t\tleft: ", ";\n\t\t\t\tborder: 2px solid ", ";\n\t\t\t\tborder-radius: inherit;\n\t\t\t\tz-index: -1;\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tvisibility: hidden;\n\t\tposition: absolute;\n\t\twidth: 7px;\n\t\theight: calc(100% - 40px);\n\t\tborder-radius: 4px;\n\t\topacity: 0;\n\t\ttransition:\n\t\t\tbackground-color 0.2s,\n\t\t\tvisibility 0.2s,\n\t\t\topacity 0.2s;\n\n\t\t&.none {\n\t\t\tbackground: none;\n\t\t}\n\n\t\t&.shadow {\n\t\t\tbackground: ", ";\n\t\t}\n\n\t\t&.full-height {\n\t\t\tbackground: ", ";\n\t\t\theight: 100%;\n\t\t\tmin-height: 36px;\n\t\t}\n\t}\n\n\t.", " {\n\t\t& .", " {\n\t\t\tbackground: ", ";\n\t\t}\n\t}\n\n\t.", " {\n\t\tposition: relative;\n\t\tdisplay: inline-block;\n\t\twidth: 100%;\n\n\t\t&.", " {\n\t\t\tpadding: 0 ", ";\n\t\t\tleft: ", ";\n\t\t}\n\t}\n\n\t// This below style is here to make sure the image width is correct when nested in a table\n\ttable .", ", table .", ".", " {\n\t\tpadding: unset;\n\t\tleft: unset;\n\t}\n"])), resizerItemClassName, handleWrapperClass, resizerHandleClassName, resizerHandleThumbClassName, "var(--ds-border-focused, #388BFF)", resizerDangerClassName, resizerHandleThumbClassName, "var(--ds-icon-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), resizerHandleClassName, "var(--ds-space-negative-200, -16px)", resizerHandleThumbClassName, resizerHandleThumbClassName, resizerHandleThumbClassName, resizerHandleThumbClassName, resizerHandleThumbClassName, "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", resizerHandleThumbClassName, "var(--ds-border-focused, #388BFF)", resizerHandleTrackClassName, resizerHandleThumbClassName, "var(--ds-space-025, 2px)", "var(--ds-border, #091E4224)", "var(--ds-border-selected, #0C66E4)", "var(--ds-space-negative-050, -4px)", "var(--ds-space-negative-050, -4px)", "var(--ds-space-negative-050, -4px)", "var(--ds-space-negative-050, -4px)", "var(--ds-border-focused, #388BFF)", resizerHandleTrackClassName, "var(--ds-background-selected, #E9F2FF)", "var(--ds-background-selected, #E9F2FF)", akEditorSelectedNodeClassName, resizerHandleThumbClassName, "var(--ds-border-focused, #388BFF)", resizerHoverZoneClassName, resizerExtendedZone, "var(--ds-space-150, 12px)", "var(--ds-space-negative-150, -12px)", resizerHoverZoneClassName, resizerHoverZoneClassName, resizerExtendedZone);
|
|
30
|
+
var resizerStyles = exports.resizerStyles = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\t.", " {\n\t\twill-change: width;\n\n\t\t&:hover,\n\t\t&.display-handle {\n\t\t\t& > .", " > .", " {\n\t\t\t\tvisibility: visible;\n\t\t\t\topacity: 1;\n\t\t\t}\n\t\t}\n\n\t\t&.is-resizing {\n\t\t\t& .", " {\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&.", " {\n\t\t\t& .", " {\n\t\t\t\ttransition: none;\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tdisplay: flex;\n\t\tvisibility: hidden;\n\t\topacity: 0;\n\t\tflex-direction: column;\n\t\tjustify-content: center;\n\t\talign-items: center;\n\t\twidth: 7px;\n\t\ttransition:\n\t\t\tvisibility 0.2s,\n\t\t\topacity 0.2s;\n\n\t\t/*\n NOTE: The below style is targeted at the div element added by the tooltip. We don't have any means of injecting styles\n into the tooltip\n */\n\t\t& div[role='presentation'] {\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\t\t\tmargin-top: ", ";\n\t\t\twhite-space: normal;\n\t\t}\n\n\t\t/*\n Handle Positions\n */\n\t\t&.left {\n\t\t\talign-items: flex-start;\n\t\t}\n\t\t&.right {\n\t\t\talign-items: flex-end;\n\t\t}\n\n\t\t/*\n Handle Sizing\n */\n\t\t&.small {\n\t\t\t& .", " {\n\t\t\t\theight: 43px;\n\t\t\t}\n\t\t}\n\t\t&.medium {\n\t\t\t& .", " {\n\t\t\t\theight: 64px;\n\t\t\t}\n\t\t}\n\t\t&.large {\n\t\t\t& .", " {\n\t\t\t\theight: 96px;\n\t\t\t}\n\t\t}\n\t\t&.clamped {\n\t\t\t& .", " {\n\t\t\t\theight: clamp(43px, calc(100% - 32px), 96px);\n\t\t\t}\n\t\t}\n\n\t\t/*\n Handle Alignment\n */\n\t\t&.sticky {\n\t\t\t& .", " {\n\t\t\t\tposition: sticky;\n\t\t\t\ttop: ", ";\n\t\t\t\tbottom: ", ";\n\t\t\t}\n\t\t}\n\n\t\t&:hover {\n\t\t\t& .", " {\n\t\t\t\tbackground: ", ";\n\t\t\t}\n\n\t\t\t& .", " {\n\t\t\t\tvisibility: visible;\n\t\t\t\topacity: 0.5;\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tcontent: ' ';\n\t\tdisplay: flex;\n\t\twidth: 3px;\n\t\tmargin: 0 ", ";\n\t\theight: 64px;\n\t\ttransition: background-color 0.2s;\n\t\tborder-radius: 6px;\n\t\tborder: 0;\n\t\tpadding: 0;\n\t\tz-index: 2;\n\t\toutline: none;\n\t\tmin-height: 24px;\n\t\tbackground: ", ";\n\n\t\t&:hover {\n\t\t\tcursor: col-resize;\n\t\t}\n\n\t\t&:focus {\n\t\t\tbackground: ", ";\n\n\t\t\t&::after {\n\t\t\t\tcontent: '';\n\t\t\t\tposition: absolute;\n\t\t\t\ttop: ", ";\n\t\t\t\tright: ", ";\n\t\t\t\tbottom: ", ";\n\t\t\t\tleft: ", ";\n\t\t\t\tborder: 2px solid ", ";\n\t\t\t\tborder-radius: inherit;\n\t\t\t\tz-index: -1;\n\t\t\t}\n\t\t}\n\t}\n\n\t.", " {\n\t\tvisibility: hidden;\n\t\tposition: absolute;\n\t\twidth: 7px;\n\t\theight: calc(100% - 40px);\n\t\tborder-radius: 4px;\n\t\topacity: 0;\n\t\ttransition:\n\t\t\tbackground-color 0.2s,\n\t\t\tvisibility 0.2s,\n\t\t\topacity 0.2s;\n\n\t\t&.none {\n\t\t\tbackground: none;\n\t\t}\n\n\t\t&.shadow {\n\t\t\tbackground: ", ";\n\t\t}\n\n\t\t&.full-height {\n\t\t\tbackground: ", ";\n\t\t\theight: 100%;\n\t\t\tmin-height: 36px;\n\t\t}\n\t}\n\n\t.", " {\n\t\t& .", " {\n\t\t\tbackground: ", ";\n\t\t}\n\t}\n\n\t.ak-editor-no-interaction\n\t\t.", "\n\t\t.", ":not(:hover)\n\t\t.", " {\n\t\tbackground: ", ";\n\t}\n\n\t.", " {\n\t\tposition: relative;\n\t\tdisplay: inline-block;\n\t\twidth: 100%;\n\n\t\t&.", " {\n\t\t\tpadding: 0 ", ";\n\t\t\tleft: ", ";\n\t\t}\n\t}\n\n\t// This below style is here to make sure the image width is correct when nested in a table\n\ttable .", ", table .", ".", " {\n\t\tpadding: unset;\n\t\tleft: unset;\n\t}\n"])), resizerItemClassName, handleWrapperClass, resizerHandleClassName, resizerHandleThumbClassName, "var(--ds-border-focused, #388BFF)", resizerDangerClassName, resizerHandleThumbClassName, "var(--ds-icon-danger, ".concat(_editorSharedStyles.akEditorDeleteIconColor, ")"), resizerHandleClassName, "var(--ds-space-negative-200, -16px)", resizerHandleThumbClassName, resizerHandleThumbClassName, resizerHandleThumbClassName, resizerHandleThumbClassName, resizerHandleThumbClassName, "var(--ds-space-150, 12px)", "var(--ds-space-150, 12px)", resizerHandleThumbClassName, "var(--ds-border-focused, #388BFF)", resizerHandleTrackClassName, resizerHandleThumbClassName, "var(--ds-space-025, 2px)", "var(--ds-border, #091E4224)", "var(--ds-border-selected, #0C66E4)", "var(--ds-space-negative-050, -4px)", "var(--ds-space-negative-050, -4px)", "var(--ds-space-negative-050, -4px)", "var(--ds-space-negative-050, -4px)", "var(--ds-border-focused, #388BFF)", resizerHandleTrackClassName, "var(--ds-background-selected, #E9F2FF)", "var(--ds-background-selected, #E9F2FF)", akEditorSelectedNodeClassName, resizerHandleThumbClassName, "var(--ds-border-focused, #388BFF)", akEditorSelectedNodeClassName, resizerHandleClassName, resizerHandleThumbClassName, "var(--ds-border, #091E4224)", resizerHoverZoneClassName, resizerExtendedZone, "var(--ds-space-150, 12px)", "var(--ds-space-negative-150, -12px)", resizerHoverZoneClassName, resizerHoverZoneClassName, resizerExtendedZone);
|
|
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
23
23
|
* @jsx jsx
|
|
24
24
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
25
25
|
var packageName = "@atlaskit/editor-common";
|
|
26
|
-
var packageVersion = "103.
|
|
26
|
+
var packageVersion = "103.12.0";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -49,6 +49,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
49
49
|
tooltipContent = _ref.tooltipContent,
|
|
50
50
|
tooltipStyle = _ref.tooltipStyle,
|
|
51
51
|
testId = _ref.testId,
|
|
52
|
+
interactionName = _ref.interactionName,
|
|
52
53
|
_ref$hideTooltipOnCli = _ref.hideTooltipOnClick,
|
|
53
54
|
hideTooltipOnClick = _ref$hideTooltipOnCli === void 0 ? true : _ref$hideTooltipOnCli,
|
|
54
55
|
ariaHasPopup = _ref.ariaHasPopup,
|
|
@@ -132,6 +133,7 @@ var _default = exports.default = function _default(_ref) {
|
|
|
132
133
|
isSelected: selected,
|
|
133
134
|
isDisabled: disabled,
|
|
134
135
|
testId: testId,
|
|
136
|
+
interactionName: interactionName,
|
|
135
137
|
onFocus: onFocus,
|
|
136
138
|
onBlur: onBlur
|
|
137
139
|
// @ts-ignore
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.default = exports.TableSelectorPopup = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
var _react = require("react");
|
|
12
|
+
var _react2 = require("@emotion/react");
|
|
13
|
+
var _bindEventListener = require("bind-event-listener");
|
|
14
|
+
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
15
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
16
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
17
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
18
|
+
var _uiReact = require("../../ui-react");
|
|
19
|
+
var _Popup = _interopRequireDefault(require("../Popup"));
|
|
20
|
+
var _tableSelector = _interopRequireWildcard(require("./table-selector"));
|
|
21
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
24
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; } /**
|
|
25
|
+
* @jsxRuntime classic
|
|
26
|
+
* @jsx jsx
|
|
27
|
+
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
28
|
+
var TABLE_SELECTOR_PADDING_TOP = 8;
|
|
29
|
+
var TABLE_SELECTOR_PADDING_SIDE = 10;
|
|
30
|
+
var DEFAULT_TABLE_SELECTOR_ROWS = 5;
|
|
31
|
+
var DEFAULT_TABLE_SELECTOR_COLS = 10;
|
|
32
|
+
var DEFAULT_TABLE_SELECTOR_SELECTION_SIZE = 1;
|
|
33
|
+
var DEFAULT_MAX_TABLE_SELECTOR_ROWS = 10;
|
|
34
|
+
var TableSelectorWithListeners = (0, _uiReact.withReactEditorViewOuterListeners)(_tableSelector.default);
|
|
35
|
+
var initialSizeState = {
|
|
36
|
+
col: DEFAULT_TABLE_SELECTOR_SELECTION_SIZE,
|
|
37
|
+
row: DEFAULT_TABLE_SELECTOR_SELECTION_SIZE,
|
|
38
|
+
maxCol: DEFAULT_TABLE_SELECTOR_COLS,
|
|
39
|
+
maxRow: DEFAULT_TABLE_SELECTOR_ROWS
|
|
40
|
+
};
|
|
41
|
+
var tableSelectorPopupWrapperStyles = (0, _react2.css)({
|
|
42
|
+
borderRadius: "var(--ds-border-radius, 3px)",
|
|
43
|
+
backgroundColor: "var(--ds-surface-overlay, ".concat(_colors.N0, ")"),
|
|
44
|
+
boxShadow: "var(--ds-shadow-overlay, ".concat("0 0 0 1px ".concat(_colors.N30A, ", 0 2px 1px ").concat(_colors.N30A, ", 0 0 20px -6px ").concat(_colors.N60A), ")"),
|
|
45
|
+
padding: "".concat("var(--ds-space-100, ".concat("".concat(TABLE_SELECTOR_PADDING_TOP, "px"), ")"), " ", TABLE_SELECTOR_PADDING_SIDE, "px")
|
|
46
|
+
});
|
|
47
|
+
var TableSelectorPopup = exports.TableSelectorPopup = function TableSelectorPopup(props) {
|
|
48
|
+
var _useState = (0, _react.useState)(_objectSpread(_objectSpread({}, initialSizeState), props.defaultSize)),
|
|
49
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
50
|
+
size = _useState2[0],
|
|
51
|
+
setSize = _useState2[1];
|
|
52
|
+
var tablePopupRef = (0, _react.useRef)(null);
|
|
53
|
+
// If popup opened by keyboard enable keyboard mode
|
|
54
|
+
var isKeyboardMode = (0, _react.useRef)(props.isOpenedByKeyboard);
|
|
55
|
+
var enableKeyboardMode = (0, _react.useCallback)(function () {
|
|
56
|
+
if (!isKeyboardMode.current) {
|
|
57
|
+
isKeyboardMode.current = true;
|
|
58
|
+
}
|
|
59
|
+
}, [isKeyboardMode]);
|
|
60
|
+
var disableKeyboardMode = (0, _react.useCallback)(function () {
|
|
61
|
+
if (isKeyboardMode.current) {
|
|
62
|
+
isKeyboardMode.current = false;
|
|
63
|
+
}
|
|
64
|
+
}, [isKeyboardMode]);
|
|
65
|
+
|
|
66
|
+
// Mouse move is used to allow selection changes outside of the popup and is more reactive to changes.
|
|
67
|
+
var handleMouseMove = (0, _react.useCallback)(function (e) {
|
|
68
|
+
if (!tablePopupRef.current) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
disableKeyboardMode();
|
|
72
|
+
var tablePopup = tablePopupRef.current;
|
|
73
|
+
var _tablePopup$getBoundi = tablePopup.getBoundingClientRect(),
|
|
74
|
+
left = _tablePopup$getBoundi.left,
|
|
75
|
+
top = _tablePopup$getBoundi.top;
|
|
76
|
+
|
|
77
|
+
// Mouse position on popup
|
|
78
|
+
var selectedWidth = e.clientX - left;
|
|
79
|
+
var selectedHeight = e.clientY - top;
|
|
80
|
+
|
|
81
|
+
// Calculate number grid cells selected
|
|
82
|
+
var selectedGridCols = Math.ceil((selectedWidth - TABLE_SELECTOR_PADDING_SIDE + _tableSelector.TABLE_SELECTOR_BUTTON_GAP) / (_tableSelector.TABLE_SELECTOR_BUTTON_GAP + _tableSelector.TABLE_SELECTOR_BUTTON_SIZE));
|
|
83
|
+
var selectedGridRows = Math.ceil((selectedHeight - TABLE_SELECTOR_PADDING_TOP + _tableSelector.TABLE_SELECTOR_BUTTON_GAP) / (_tableSelector.TABLE_SELECTOR_BUTTON_GAP + _tableSelector.TABLE_SELECTOR_BUTTON_SIZE));
|
|
84
|
+
// Keep the selected rows and columns within the defined bounds
|
|
85
|
+
var gridRows = DEFAULT_TABLE_SELECTOR_ROWS;
|
|
86
|
+
if (selectedGridCols < 1) {
|
|
87
|
+
selectedGridCols = 1;
|
|
88
|
+
}
|
|
89
|
+
if (selectedGridCols > size.maxCol) {
|
|
90
|
+
selectedGridCols = size.maxCol;
|
|
91
|
+
}
|
|
92
|
+
if (selectedGridRows < 1) {
|
|
93
|
+
selectedGridRows = 1;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Expand grid when row selection is greater than the default grid size
|
|
97
|
+
if (selectedGridRows >= DEFAULT_TABLE_SELECTOR_ROWS && selectedGridRows < DEFAULT_MAX_TABLE_SELECTOR_ROWS) {
|
|
98
|
+
gridRows = selectedGridRows + 1;
|
|
99
|
+
}
|
|
100
|
+
if (selectedGridRows >= DEFAULT_MAX_TABLE_SELECTOR_ROWS) {
|
|
101
|
+
selectedGridRows = DEFAULT_MAX_TABLE_SELECTOR_ROWS;
|
|
102
|
+
gridRows = DEFAULT_MAX_TABLE_SELECTOR_ROWS;
|
|
103
|
+
}
|
|
104
|
+
if (selectedGridCols !== size.col || selectedGridRows !== size.row) {
|
|
105
|
+
setSize({
|
|
106
|
+
col: selectedGridCols,
|
|
107
|
+
row: selectedGridRows,
|
|
108
|
+
maxCol: DEFAULT_TABLE_SELECTOR_COLS,
|
|
109
|
+
maxRow: gridRows
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}, [disableKeyboardMode, size, setSize]);
|
|
113
|
+
var decreasingSequence = function decreasingSequence(maxNumber, prevNumber) {
|
|
114
|
+
var nextNumber = prevNumber - 1;
|
|
115
|
+
if (prevNumber === 1) {
|
|
116
|
+
nextNumber = maxNumber;
|
|
117
|
+
}
|
|
118
|
+
return nextNumber;
|
|
119
|
+
};
|
|
120
|
+
var getMaxRow = function getMaxRow(prevSize, eventKey) {
|
|
121
|
+
switch (eventKey) {
|
|
122
|
+
case 'ArrowDown':
|
|
123
|
+
// Expand the grid size when last row selected
|
|
124
|
+
if (prevSize.maxRow < DEFAULT_MAX_TABLE_SELECTOR_ROWS && prevSize.row >= DEFAULT_TABLE_SELECTOR_ROWS - 1) {
|
|
125
|
+
return prevSize.maxRow + 1;
|
|
126
|
+
}
|
|
127
|
+
if (prevSize.row === DEFAULT_MAX_TABLE_SELECTOR_ROWS) {
|
|
128
|
+
return DEFAULT_TABLE_SELECTOR_ROWS;
|
|
129
|
+
}
|
|
130
|
+
return prevSize.maxRow;
|
|
131
|
+
case 'ArrowLeft':
|
|
132
|
+
var moveToPrevRow = prevSize.col === 1 && prevSize.row > 1;
|
|
133
|
+
var moveToLastRow = prevSize.row === 1 && prevSize.col === 1;
|
|
134
|
+
// Expand the popup to max size when selected row wraps around to last row
|
|
135
|
+
if (moveToLastRow) {
|
|
136
|
+
return DEFAULT_MAX_TABLE_SELECTOR_ROWS;
|
|
137
|
+
}
|
|
138
|
+
// Decrease the popup when decreased row selection
|
|
139
|
+
if (prevSize.maxRow > DEFAULT_TABLE_SELECTOR_ROWS && moveToPrevRow) {
|
|
140
|
+
return prevSize.row;
|
|
141
|
+
}
|
|
142
|
+
return prevSize.maxRow;
|
|
143
|
+
case 'ArrowUp':
|
|
144
|
+
if (prevSize.row === 1) {
|
|
145
|
+
return DEFAULT_MAX_TABLE_SELECTOR_ROWS;
|
|
146
|
+
// Decrease the popup size when decreased row selection
|
|
147
|
+
} else if (prevSize.maxRow > DEFAULT_TABLE_SELECTOR_ROWS) {
|
|
148
|
+
return prevSize.row;
|
|
149
|
+
}
|
|
150
|
+
return prevSize.maxRow;
|
|
151
|
+
case 'ArrowRight':
|
|
152
|
+
var moveToNextRow = prevSize.col === DEFAULT_TABLE_SELECTOR_COLS;
|
|
153
|
+
var increaseMaxRow = prevSize.maxRow < DEFAULT_MAX_TABLE_SELECTOR_ROWS && moveToNextRow && prevSize.row + 1 === prevSize.maxRow;
|
|
154
|
+
|
|
155
|
+
// Decrease popup size for wrap around to selection 1 x 1
|
|
156
|
+
if (prevSize.row === DEFAULT_MAX_TABLE_SELECTOR_ROWS && prevSize.col === DEFAULT_TABLE_SELECTOR_COLS) {
|
|
157
|
+
return DEFAULT_TABLE_SELECTOR_ROWS;
|
|
158
|
+
// Decrease the popup size when decreased row selection
|
|
159
|
+
} else if (increaseMaxRow) {
|
|
160
|
+
return prevSize.maxRow + 1;
|
|
161
|
+
}
|
|
162
|
+
return prevSize.maxRow;
|
|
163
|
+
default:
|
|
164
|
+
return prevSize.maxRow;
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
var handleInitialButtonFocus = (0, _react.useCallback)(function () {
|
|
168
|
+
if (isKeyboardMode.current !== true) {
|
|
169
|
+
enableKeyboardMode();
|
|
170
|
+
setSize(initialSizeState);
|
|
171
|
+
}
|
|
172
|
+
}, [enableKeyboardMode, setSize]);
|
|
173
|
+
var handleKeyDown = (0, _react.useCallback)(
|
|
174
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
175
|
+
function (event) {
|
|
176
|
+
if (event.key === 'ArrowDown') {
|
|
177
|
+
enableKeyboardMode();
|
|
178
|
+
setSize(function (prevSize) {
|
|
179
|
+
return _objectSpread(_objectSpread({}, prevSize), {}, {
|
|
180
|
+
row: prevSize.row % prevSize.maxRow + 1,
|
|
181
|
+
maxRow: getMaxRow(prevSize, event.key)
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_table_picker')) {
|
|
185
|
+
event.preventDefault();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (event.key === 'ArrowRight') {
|
|
189
|
+
enableKeyboardMode();
|
|
190
|
+
setSize(function (prevSize) {
|
|
191
|
+
var moveToNextRow = prevSize.col === DEFAULT_TABLE_SELECTOR_COLS;
|
|
192
|
+
return _objectSpread(_objectSpread({}, prevSize), {}, {
|
|
193
|
+
col: prevSize.col % DEFAULT_TABLE_SELECTOR_COLS + 1,
|
|
194
|
+
row: moveToNextRow ? prevSize.row % prevSize.maxRow + 1 : prevSize.row,
|
|
195
|
+
maxRow: getMaxRow(prevSize, event.key)
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
if (event.key === 'ArrowLeft') {
|
|
200
|
+
enableKeyboardMode();
|
|
201
|
+
setSize(function (prevSize) {
|
|
202
|
+
var getRow = function getRow(prevRow, prevCol) {
|
|
203
|
+
var row = prevRow;
|
|
204
|
+
// Move to previous row for wrap around
|
|
205
|
+
if (prevSize.col === 1 && prevSize.row > 1) {
|
|
206
|
+
return prevRow - 1;
|
|
207
|
+
// Increase the selection to max size when selected row and column wraps around
|
|
208
|
+
} else if (prevRow === 1 && prevCol === 1) {
|
|
209
|
+
return DEFAULT_MAX_TABLE_SELECTOR_ROWS;
|
|
210
|
+
}
|
|
211
|
+
return row;
|
|
212
|
+
};
|
|
213
|
+
return _objectSpread(_objectSpread({}, prevSize), {}, {
|
|
214
|
+
col: decreasingSequence(prevSize.maxCol, prevSize.col),
|
|
215
|
+
row: getRow(prevSize.row, prevSize.col),
|
|
216
|
+
maxRow: getMaxRow(prevSize, event.key)
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
if (event.key === 'ArrowUp') {
|
|
221
|
+
enableKeyboardMode();
|
|
222
|
+
setSize(function (prevSize) {
|
|
223
|
+
var moveToLastRow = prevSize.row === 1;
|
|
224
|
+
return _objectSpread(_objectSpread({}, prevSize), {}, {
|
|
225
|
+
row: moveToLastRow ? DEFAULT_MAX_TABLE_SELECTOR_ROWS : decreasingSequence(prevSize.maxRow, prevSize.row),
|
|
226
|
+
maxRow: getMaxRow(prevSize, event.key)
|
|
227
|
+
});
|
|
228
|
+
});
|
|
229
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_table_picker')) {
|
|
230
|
+
event.preventDefault();
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}, [enableKeyboardMode, setSize]);
|
|
234
|
+
(0, _react.useEffect)(function () {
|
|
235
|
+
var unbind;
|
|
236
|
+
var target = props.allowOutsideSelection ? window : tablePopupRef.current;
|
|
237
|
+
if (target) {
|
|
238
|
+
unbind = (0, _bindEventListener.bind)(target, {
|
|
239
|
+
type: 'mousemove',
|
|
240
|
+
listener: handleMouseMove
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
return unbind;
|
|
244
|
+
}, [handleMouseMove, props.allowOutsideSelection, tablePopupRef]);
|
|
245
|
+
return (0, _react2.jsx)(_Popup.default, {
|
|
246
|
+
target: props.target,
|
|
247
|
+
offset: [0, 3],
|
|
248
|
+
mountTo: props.popupsMountPoint,
|
|
249
|
+
boundariesElement: props.popupsBoundariesElement,
|
|
250
|
+
scrollableElement: props.popupsScrollableElement,
|
|
251
|
+
focusTrap: true,
|
|
252
|
+
onUnmount: props.onUnmount,
|
|
253
|
+
zIndex: _editorSharedStyles.akEditorMenuZIndex
|
|
254
|
+
}, (0, _react2.jsx)("div", {
|
|
255
|
+
css: tableSelectorPopupWrapperStyles,
|
|
256
|
+
ref: tablePopupRef
|
|
257
|
+
}, (0, _react2.jsx)(TableSelectorWithListeners, {
|
|
258
|
+
handleClickOutside: props.handleClickOutside,
|
|
259
|
+
handleEscapeKeydown: props.handleEscapeKeydown,
|
|
260
|
+
maxCols: size.maxCol,
|
|
261
|
+
maxRows: size.maxRow,
|
|
262
|
+
onSelection: props.onSelection,
|
|
263
|
+
selectedCol: size.col,
|
|
264
|
+
selectedRow: size.row,
|
|
265
|
+
onKeyDown: handleKeyDown,
|
|
266
|
+
isFocused: isKeyboardMode.current,
|
|
267
|
+
handleInitialButtonFocus: handleInitialButtonFocus
|
|
268
|
+
})));
|
|
269
|
+
};
|
|
270
|
+
var _default = exports.default = TableSelectorPopup;
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = exports.TABLE_SELECTOR_BUTTON_SIZE = exports.TABLE_SELECTOR_BUTTON_GAP = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _react2 = require("@emotion/react");
|
|
9
|
+
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
|
+
var _primitives = require("@atlaskit/primitives");
|
|
12
|
+
var _colors = require("@atlaskit/theme/colors");
|
|
13
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
|
+
var _messages = require("../../messages");
|
|
15
|
+
var _uiReact = require("../../ui-react");
|
|
16
|
+
/**
|
|
17
|
+
* @jsxRuntime classic
|
|
18
|
+
* @jsx jsx
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
22
|
+
|
|
23
|
+
var TABLE_SELECTOR_BUTTON_GAP = exports.TABLE_SELECTOR_BUTTON_GAP = 2;
|
|
24
|
+
var TABLE_SELECTOR_BUTTON_SIZE = exports.TABLE_SELECTOR_BUTTON_SIZE = 17;
|
|
25
|
+
var selectedButtonStyles = (0, _react2.css)({
|
|
26
|
+
backgroundColor: "var(--ds-background-accent-blue-subtlest, #579DFF)",
|
|
27
|
+
border: "1px solid ".concat("var(--ds-background-accent-blue-subtle, #579DFF)")
|
|
28
|
+
});
|
|
29
|
+
var buttonStyles = (0, _react2.css)({
|
|
30
|
+
height: "".concat(TABLE_SELECTOR_BUTTON_SIZE, "px"),
|
|
31
|
+
width: "".concat(TABLE_SELECTOR_BUTTON_SIZE, "px"),
|
|
32
|
+
border: "1px solid ".concat("var(--ds-border, #091e4224)"),
|
|
33
|
+
backgroundColor: "var(--ds-background-input, #ffffff)",
|
|
34
|
+
borderRadius: '3px',
|
|
35
|
+
cursor: 'pointer',
|
|
36
|
+
display: 'block',
|
|
37
|
+
'&:focus': {
|
|
38
|
+
outline: 'none',
|
|
39
|
+
border: "1px solid ".concat("var(--ds-border-focused, ".concat(_colors.B100, ")")),
|
|
40
|
+
boxShadow: "0 0 0 0.5px ".concat("var(--ds-border-focused, ".concat(_colors.B100, ")"))
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
var selectionSizeTextStyles = (0, _react2.css)({
|
|
44
|
+
// eslint-disable-next-line @atlaskit/design-system/use-tokens-typography
|
|
45
|
+
lineHeight: '14px',
|
|
46
|
+
display: 'flex',
|
|
47
|
+
justifyContent: 'center',
|
|
48
|
+
marginTop: "var(--ds-space-075, 5px)",
|
|
49
|
+
padding: "var(--ds-space-075, 10px)"
|
|
50
|
+
});
|
|
51
|
+
var TableSelectorButton = function TableSelectorButton(_ref) {
|
|
52
|
+
var row = _ref.row,
|
|
53
|
+
col = _ref.col,
|
|
54
|
+
isActive = _ref.isActive,
|
|
55
|
+
_onClick = _ref.onClick,
|
|
56
|
+
label = _ref.label,
|
|
57
|
+
onKeyDown = _ref.onKeyDown,
|
|
58
|
+
isFocused = _ref.isFocused,
|
|
59
|
+
handleInitialButtonFocus = _ref.handleInitialButtonFocus;
|
|
60
|
+
var btnRef = (0, _react.useRef)(null);
|
|
61
|
+
(0, _react.useEffect)(function () {
|
|
62
|
+
if (btnRef.current) {
|
|
63
|
+
if (isFocused) {
|
|
64
|
+
btnRef.current.focus({
|
|
65
|
+
preventScroll: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_table_picker') ? true : undefined
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
btnRef.current.blur();
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}, [isFocused, btnRef]);
|
|
72
|
+
var handleFocus = col === 1 && row === 1 ? function () {
|
|
73
|
+
return handleInitialButtonFocus();
|
|
74
|
+
} : undefined;
|
|
75
|
+
return (0, _react2.jsx)("button", {
|
|
76
|
+
type: "button",
|
|
77
|
+
css: [buttonStyles, isActive ? selectedButtonStyles : undefined],
|
|
78
|
+
onClick: function onClick() {
|
|
79
|
+
return _onClick(row, col);
|
|
80
|
+
},
|
|
81
|
+
"aria-label": label,
|
|
82
|
+
onKeyDown: onKeyDown,
|
|
83
|
+
ref: btnRef,
|
|
84
|
+
onFocus: handleFocus
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
var createArray = function createArray(maxCols, maxRows) {
|
|
88
|
+
var arr = [];
|
|
89
|
+
for (var i = 1; i < maxRows + 1; i++) {
|
|
90
|
+
for (var j = 1; j < maxCols + 1; j++) {
|
|
91
|
+
arr.push({
|
|
92
|
+
col: j,
|
|
93
|
+
row: i
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return arr;
|
|
98
|
+
};
|
|
99
|
+
var gridWrapperStyles = function gridWrapperStyles(_ref2) {
|
|
100
|
+
var maxCols = _ref2.maxCols,
|
|
101
|
+
maxRows = _ref2.maxRows;
|
|
102
|
+
return (0, _react2.css)({
|
|
103
|
+
display: 'grid',
|
|
104
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
105
|
+
gridTemplateColumns: "repeat(".concat(maxCols, ", 1fr)"),
|
|
106
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-unsafe-values -- Ignored via go/DSP-18766
|
|
107
|
+
gridTemplateRows: "repeat(".concat(maxRows, ", 1fr)"),
|
|
108
|
+
gap: "".concat("var(--ds-space-025, ".concat("".concat(TABLE_SELECTOR_BUTTON_GAP, "px"), ")"))
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
var TableSelectorPopup = function TableSelectorPopup(_ref3) {
|
|
112
|
+
var maxCols = _ref3.maxCols,
|
|
113
|
+
maxRows = _ref3.maxRows,
|
|
114
|
+
onSelection = _ref3.onSelection,
|
|
115
|
+
selectedCol = _ref3.selectedCol,
|
|
116
|
+
selectedRow = _ref3.selectedRow,
|
|
117
|
+
onKeyDown = _ref3.onKeyDown,
|
|
118
|
+
isFocused = _ref3.isFocused,
|
|
119
|
+
handleInitialButtonFocus = _ref3.handleInitialButtonFocus,
|
|
120
|
+
formatMessage = _ref3.intl.formatMessage;
|
|
121
|
+
var buttons = (0, _react.useMemo)(function () {
|
|
122
|
+
return createArray(maxCols, maxRows);
|
|
123
|
+
}, [maxCols, maxRows]);
|
|
124
|
+
var setOutsideClickTargetRef = (0, _react.useContext)(_uiReact.OutsideClickTargetRefContext);
|
|
125
|
+
return (0, _react2.jsx)(_primitives.Stack, {
|
|
126
|
+
ref: setOutsideClickTargetRef
|
|
127
|
+
}, (0, _react2.jsx)("div", {
|
|
128
|
+
"aria-label": "".concat(formatMessage(_messages.toolbarInsertBlockMessages.tableSizeSelectorPopup)),
|
|
129
|
+
css:
|
|
130
|
+
// eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
|
|
131
|
+
gridWrapperStyles({
|
|
132
|
+
maxCols: maxCols,
|
|
133
|
+
maxRows: maxRows
|
|
134
|
+
})
|
|
135
|
+
}, buttons.map(function (_ref4, index) {
|
|
136
|
+
var col = _ref4.col,
|
|
137
|
+
row = _ref4.row;
|
|
138
|
+
var isCurrentFocused = isFocused && selectedCol === col && selectedRow === row;
|
|
139
|
+
var isActive = selectedCol >= col && selectedRow >= row ? true : false;
|
|
140
|
+
return (0, _react2.jsx)(TableSelectorButton
|
|
141
|
+
// Ignored via go/ees005
|
|
142
|
+
// eslint-disable-next-line react/no-array-index-key
|
|
143
|
+
, {
|
|
144
|
+
key: index,
|
|
145
|
+
isActive: isActive,
|
|
146
|
+
col: col,
|
|
147
|
+
row: row,
|
|
148
|
+
onClick: onSelection,
|
|
149
|
+
label: "".concat(formatMessage(_messages.toolbarInsertBlockMessages.tableSizeSelectorButton, {
|
|
150
|
+
numberOfColumns: col,
|
|
151
|
+
numberOfRows: row
|
|
152
|
+
})),
|
|
153
|
+
onKeyDown: onKeyDown,
|
|
154
|
+
isFocused: isCurrentFocused,
|
|
155
|
+
handleInitialButtonFocus: handleInitialButtonFocus
|
|
156
|
+
});
|
|
157
|
+
})), (0, _react2.jsx)("span", {
|
|
158
|
+
css: selectionSizeTextStyles,
|
|
159
|
+
"aria-hidden": true
|
|
160
|
+
}, "".concat(selectedCol, " x ").concat(selectedRow)));
|
|
161
|
+
};
|
|
162
|
+
var _default = exports.default = (0, _reactIntlNext.injectIntl)(TableSelectorPopup);
|
package/dist/cjs/ui/index.js
CHANGED
|
@@ -203,6 +203,12 @@ Object.defineProperty(exports, "SmallerEditIcon", {
|
|
|
203
203
|
return _SmallerEditIcon.SmallerEditIcon;
|
|
204
204
|
}
|
|
205
205
|
});
|
|
206
|
+
Object.defineProperty(exports, "TableSelectorPopup", {
|
|
207
|
+
enumerable: true,
|
|
208
|
+
get: function get() {
|
|
209
|
+
return _TableSelector.default;
|
|
210
|
+
}
|
|
211
|
+
});
|
|
206
212
|
Object.defineProperty(exports, "ToolbarButtonGroup", {
|
|
207
213
|
enumerable: true,
|
|
208
214
|
get: function get() {
|
|
@@ -485,5 +491,6 @@ var _ExpandIcon = require("./Toolbar/ExpandIcon");
|
|
|
485
491
|
var _Separator2 = require("./Toolbar/Separator");
|
|
486
492
|
var _DropList = _interopRequireDefault(require("./DropList"));
|
|
487
493
|
var _MultiBodiedExtension = require("./MultiBodiedExtension");
|
|
494
|
+
var _TableSelector = _interopRequireDefault(require("./TableSelector"));
|
|
488
495
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
489
496
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getDomRefFromSelection = void 0;
|
|
7
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
8
|
+
var _analytics = require("../analytics");
|
|
9
|
+
var getDomRefFromSelection = exports.getDomRefFromSelection = function getDomRefFromSelection(view, actionSubjectId, dispatchAnalyticsEvent) {
|
|
10
|
+
try {
|
|
11
|
+
var domRef = (0, _utils.findDomRefAtPos)(view.state.selection.from, view.domAtPos.bind(view));
|
|
12
|
+
if (domRef instanceof HTMLElement) {
|
|
13
|
+
// If element is not a paragraph, we need to find the closest paragraph parent
|
|
14
|
+
if (domRef.nodeName !== 'P') {
|
|
15
|
+
var paragraphRef = domRef.closest('p');
|
|
16
|
+
if (paragraphRef) {
|
|
17
|
+
return paragraphRef;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return domRef;
|
|
21
|
+
} else {
|
|
22
|
+
throw new Error('Invalid DOM reference');
|
|
23
|
+
}
|
|
24
|
+
} catch (error) {
|
|
25
|
+
if (dispatchAnalyticsEvent) {
|
|
26
|
+
var payload = {
|
|
27
|
+
action: _analytics.ACTION.ERRORED,
|
|
28
|
+
actionSubject: _analytics.ACTION_SUBJECT.PICKER,
|
|
29
|
+
actionSubjectId: actionSubjectId,
|
|
30
|
+
eventType: _analytics.EVENT_TYPE.OPERATIONAL,
|
|
31
|
+
attributes: {
|
|
32
|
+
error: 'Error getting DOM reference from selection'
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
dispatchAnalyticsEvent(payload);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
@@ -427,6 +427,7 @@ export let ACTION_SUBJECT_ID = /*#__PURE__*/function (ACTION_SUBJECT_ID) {
|
|
|
427
427
|
ACTION_SUBJECT_ID["PICKER_MEDIA"] = "mediaPicker";
|
|
428
428
|
ACTION_SUBJECT_ID["PICKER_COLOR"] = "colorPicker";
|
|
429
429
|
ACTION_SUBJECT_ID["PICKER_EMOJI"] = "emojiPicker";
|
|
430
|
+
ACTION_SUBJECT_ID["PICKER_TABLE_SIZE"] = "tableSizePicker";
|
|
430
431
|
ACTION_SUBJECT_ID["DOCKED_PRIMARY_TOOLBAR"] = "dockedPrimaryToolbar";
|
|
431
432
|
ACTION_SUBJECT_ID["PLACEHOLDER_TEXT"] = "placeholderText";
|
|
432
433
|
ACTION_SUBJECT_ID["POST_QUERY_SEARCH_RESULTS"] = "postQuerySearchResults";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "103.
|
|
4
|
+
const packageVersion = "103.12.0";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// Ignored via go/ees007
|
|
@@ -198,6 +198,13 @@ export const resizerStyles = css`
|
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
.ak-editor-no-interaction
|
|
202
|
+
.${akEditorSelectedNodeClassName}
|
|
203
|
+
.${resizerHandleClassName}:not(:hover)
|
|
204
|
+
.${resizerHandleThumbClassName} {
|
|
205
|
+
background: ${"var(--ds-border, #091E4224)"};
|
|
206
|
+
}
|
|
207
|
+
|
|
201
208
|
.${resizerHoverZoneClassName} {
|
|
202
209
|
position: relative;
|
|
203
210
|
display: inline-block;
|