@atlaskit/editor-toolbar 0.5.1 → 0.6.1
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 +20 -0
- package/dist/cjs/index.js +20 -0
- package/dist/cjs/ui/ResponsiveContainer.compiled.css +12 -0
- package/dist/cjs/ui/ResponsiveContainer.js +71 -0
- package/dist/cjs/ui/Show.js +43 -0
- package/dist/cjs/ui/Toolbar.compiled.css +2 -0
- package/dist/cjs/ui/Toolbar.js +18 -4
- package/dist/cjs/ui/ToolbarButton.js +2 -1
- package/dist/cjs/ui/ToolbarButtonGroup.js +2 -1
- package/dist/cjs/ui/ToolbarDropdownItem.js +8 -1
- package/dist/cjs/ui/ToolbarDropdownMenu.compiled.css +3 -1
- package/dist/cjs/ui/ToolbarDropdownMenu.js +34 -21
- package/dist/cjs/ui/ToolbarDropdownMenuContext.js +10 -2
- package/dist/cjs/ui/ToolbarSection.js +2 -1
- package/dist/es2019/index.js +3 -1
- package/dist/es2019/ui/ResponsiveContainer.compiled.css +12 -0
- package/dist/es2019/ui/ResponsiveContainer.js +65 -0
- package/dist/es2019/ui/Show.js +36 -0
- package/dist/es2019/ui/Toolbar.compiled.css +2 -0
- package/dist/es2019/ui/Toolbar.js +18 -4
- package/dist/es2019/ui/ToolbarButton.js +2 -1
- package/dist/es2019/ui/ToolbarButtonGroup.js +2 -1
- package/dist/es2019/ui/ToolbarDropdownItem.js +8 -1
- package/dist/es2019/ui/ToolbarDropdownMenu.compiled.css +3 -1
- package/dist/es2019/ui/ToolbarDropdownMenu.js +33 -22
- package/dist/es2019/ui/ToolbarDropdownMenuContext.js +7 -1
- package/dist/es2019/ui/ToolbarSection.js +2 -1
- package/dist/esm/index.js +3 -1
- package/dist/esm/ui/ResponsiveContainer.compiled.css +12 -0
- package/dist/esm/ui/ResponsiveContainer.js +64 -0
- package/dist/esm/ui/Show.js +35 -0
- package/dist/esm/ui/Toolbar.compiled.css +2 -0
- package/dist/esm/ui/Toolbar.js +18 -4
- package/dist/esm/ui/ToolbarButton.js +2 -1
- package/dist/esm/ui/ToolbarButtonGroup.js +2 -1
- package/dist/esm/ui/ToolbarDropdownItem.js +8 -1
- package/dist/esm/ui/ToolbarDropdownMenu.compiled.css +3 -1
- package/dist/esm/ui/ToolbarDropdownMenu.js +34 -21
- package/dist/esm/ui/ToolbarDropdownMenuContext.js +9 -1
- package/dist/esm/ui/ToolbarSection.js +2 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/ui/ResponsiveContainer.d.ts +54 -0
- package/dist/types/ui/Show.d.ts +22 -0
- package/dist/types/ui/Toolbar.d.ts +3 -1
- package/dist/types/ui/ToolbarDropdownMenu.d.ts +5 -1
- package/dist/types/ui/ToolbarDropdownMenuContext.d.ts +3 -1
- package/dist/types-ts4.5/index.d.ts +3 -1
- package/dist/types-ts4.5/ui/ResponsiveContainer.d.ts +54 -0
- package/dist/types-ts4.5/ui/Show.d.ts +22 -0
- package/dist/types-ts4.5/ui/Toolbar.d.ts +3 -1
- package/dist/types-ts4.5/ui/ToolbarDropdownMenu.d.ts +5 -1
- package/dist/types-ts4.5/ui/ToolbarDropdownMenuContext.d.ts +3 -1
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-toolbar
|
|
2
2
|
|
|
3
|
+
## 0.6.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`36e649e4988d3`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/36e649e4988d3) -
|
|
8
|
+
[ux] ED-29072 close all menus on nested menu item clicked
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 0.6.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`51f3f2db61f6e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/51f3f2db61f6e) -
|
|
16
|
+
Add ranks and keys for new collapsed text section component, add responsive container to
|
|
17
|
+
PrimaryToolbar export with new query selectors to hide empty elements, export types
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 0.5.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -286,6 +286,18 @@ Object.defineProperty(exports, "RedoIcon", {
|
|
|
286
286
|
return _RedoIcon.RedoIcon;
|
|
287
287
|
}
|
|
288
288
|
});
|
|
289
|
+
Object.defineProperty(exports, "ResponsiveContainer", {
|
|
290
|
+
enumerable: true,
|
|
291
|
+
get: function get() {
|
|
292
|
+
return _ResponsiveContainer.ResponsiveContainer;
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
Object.defineProperty(exports, "Show", {
|
|
296
|
+
enumerable: true,
|
|
297
|
+
get: function get() {
|
|
298
|
+
return _Show.Show;
|
|
299
|
+
}
|
|
300
|
+
});
|
|
289
301
|
Object.defineProperty(exports, "ShowMoreHorizontalIcon", {
|
|
290
302
|
enumerable: true,
|
|
291
303
|
get: function get() {
|
|
@@ -376,6 +388,12 @@ Object.defineProperty(exports, "ToolbarDropdownMenu", {
|
|
|
376
388
|
return _ToolbarDropdownMenu.ToolbarDropdownMenu;
|
|
377
389
|
}
|
|
378
390
|
});
|
|
391
|
+
Object.defineProperty(exports, "ToolbarDropdownMenuProvider", {
|
|
392
|
+
enumerable: true,
|
|
393
|
+
get: function get() {
|
|
394
|
+
return _ToolbarDropdownMenuContext.ToolbarDropdownMenuProvider;
|
|
395
|
+
}
|
|
396
|
+
});
|
|
379
397
|
Object.defineProperty(exports, "ToolbarKeyboardShortcutHint", {
|
|
380
398
|
enumerable: true,
|
|
381
399
|
get: function get() {
|
|
@@ -448,6 +466,8 @@ var _ToolbarSection = require("./ui/ToolbarSection");
|
|
|
448
466
|
var _ToolbarTooltip = require("./ui/ToolbarTooltip");
|
|
449
467
|
var _ToolbarColorSwatch = require("./ui/ToolbarColorSwatch");
|
|
450
468
|
var _ToolbarDropdownMenuContext = require("./ui/ToolbarDropdownMenuContext");
|
|
469
|
+
var _ResponsiveContainer = require("./ui/ResponsiveContainer");
|
|
470
|
+
var _Show = require("./ui/Show");
|
|
451
471
|
var _AIAdjustLengthIcon = require("./ui/icons/AIAdjustLengthIcon");
|
|
452
472
|
var _AIChatIcon = require("./ui/icons/AIChatIcon");
|
|
453
473
|
var _AIProfessionalIcon = require("./ui/icons/AIProfessionalIcon");
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
._1bsb1osq{width:100%}
|
|
2
|
+
._1bx91ule .show-above-lg, ._1ehg1ule .show-above-md, ._1onx1ule .show-above-sm, ._1xt01ule .show-above-xl{display:block}
|
|
3
|
+
._1f38ptqj{container-name:toolbar-container}
|
|
4
|
+
._7cca15wb{container-type:inline-size}
|
|
5
|
+
._zg9wglyw .show-below-lg, ._1a2cglyw .show-below-md, ._sum2glyw .show-below-sm, ._1vtcglyw .show-below-xl{display:none}
|
|
6
|
+
@container toolbar-container (max-width: 1024px){._t3a8glyw .show-above-xl{display:none}._1x5z1ule .show-below-xl{display:block}}
|
|
7
|
+
@container toolbar-container (max-width: 210px){._48suglyw .show-above-sm{display:none}._j2p61ule .show-below-sm{display:block}}
|
|
8
|
+
@container toolbar-container (max-width: 350px){._1vg1glyw .show-above-md{display:none}._1ei51ule .show-below-md{display:block}}
|
|
9
|
+
@container toolbar-container (max-width: 410px){._6nrqglyw .show-above-sm{display:none}._1fq21ule .show-below-sm{display:block}}
|
|
10
|
+
@container toolbar-container (max-width: 476px){._1ireglyw .show-above-md{display:none}._zy2m1ule .show-below-md{display:block}}
|
|
11
|
+
@container toolbar-container (max-width: 500px){._pjeuglyw .show-above-lg{display:none}._3bio1ule .show-below-lg{display:block}}
|
|
12
|
+
@container toolbar-container (max-width: 768px){._hfbeglyw .show-above-lg{display:none}._gw6d1ule .show-below-lg{display:block}}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/* ResponsiveContainer.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-selectors */
|
|
3
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-container-queries */
|
|
4
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors */
|
|
5
|
+
"use strict";
|
|
6
|
+
|
|
7
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
8
|
+
Object.defineProperty(exports, "__esModule", {
|
|
9
|
+
value: true
|
|
10
|
+
});
|
|
11
|
+
exports.ResponsiveContainer = void 0;
|
|
12
|
+
require("./ResponsiveContainer.compiled.css");
|
|
13
|
+
var _runtime = require("@compiled/react/runtime");
|
|
14
|
+
var _react = _interopRequireDefault(require("react"));
|
|
15
|
+
var _css = require("@atlaskit/css");
|
|
16
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
17
|
+
var styles = {
|
|
18
|
+
responsiveContainer: "_1bsb1osq _7cca15wb _1f38ptqj _1bx91ule _1ehg1ule _1onx1ule _1xt01ule _zg9wglyw _1a2cglyw _sum2glyw _1vtcglyw",
|
|
19
|
+
responsiveRules: "_t3a8glyw _1x5z1ule _6nrqglyw _1fq21ule _1ireglyw _zy2m1ule _hfbeglyw _gw6d1ule",
|
|
20
|
+
responsiveRulesReduced: "_t3a8glyw _1x5z1ule _48suglyw _j2p61ule _1vg1glyw _1ei51ule _pjeuglyw _3bio1ule"
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* A responsive container that enables container query-based responsive design using CSS container queries.
|
|
24
|
+
* This component establishes a containment context named 'toolbar-container' that child components can
|
|
25
|
+
* reference for responsive behavior based on the container's width rather than the viewport width.
|
|
26
|
+
*
|
|
27
|
+
* The container defines breakpoints at:
|
|
28
|
+
* - sm: 410px
|
|
29
|
+
* - md: 476px
|
|
30
|
+
* - lg: 768px
|
|
31
|
+
* - xl: 1024px
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* Basic usage with Show component for responsive visibility:
|
|
35
|
+
* ```tsx
|
|
36
|
+
* <ResponsiveContainer>
|
|
37
|
+
* <Show above="md">
|
|
38
|
+
* <Button>Only visible when container is wider than 476px</Button>
|
|
39
|
+
* </Show>
|
|
40
|
+
* <Show below="sm">
|
|
41
|
+
* <Icon>Only visible when container is narrower than 410px</Icon>
|
|
42
|
+
* </Show>
|
|
43
|
+
* </ResponsiveContainer>
|
|
44
|
+
* ```
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* Combining multiple Show components for different breakpoints:
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <ResponsiveContainer>
|
|
50
|
+
* <Show above="lg">
|
|
51
|
+
* <FullToolbar />
|
|
52
|
+
* </Show>
|
|
53
|
+
* <Show below="lg" above="md">
|
|
54
|
+
* <CompactToolbar />
|
|
55
|
+
* </Show>
|
|
56
|
+
* <Show below="md">
|
|
57
|
+
* <MinimalToolbar />
|
|
58
|
+
* </Show>
|
|
59
|
+
* </ResponsiveContainer>
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* @param children - React nodes to render within the responsive container context
|
|
63
|
+
* @returns A Box component with container query styles applied
|
|
64
|
+
*/
|
|
65
|
+
var ResponsiveContainer = exports.ResponsiveContainer = function ResponsiveContainer(_ref) {
|
|
66
|
+
var children = _ref.children,
|
|
67
|
+
reducedBreakpoints = _ref.reducedBreakpoints;
|
|
68
|
+
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
69
|
+
xcss: (0, _css.cx)(styles.responsiveContainer, reducedBreakpoints ? styles.responsiveRulesReduced : styles.responsiveRules)
|
|
70
|
+
}, children);
|
|
71
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Show = void 0;
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-classname-prop */
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Generate a className based on the breakpoints provided.
|
|
13
|
+
*
|
|
14
|
+
* **Warning** - must much classnames defined in ResponsiveContainer.tsx
|
|
15
|
+
* @param above - The breakpoint to show the element above.
|
|
16
|
+
* @param below - The breakpoint to show the element below.
|
|
17
|
+
* @returns The className to apply to the element.
|
|
18
|
+
*/
|
|
19
|
+
var generateClassName = function generateClassName(above, below) {
|
|
20
|
+
if (above) {
|
|
21
|
+
return "show-above-".concat(above);
|
|
22
|
+
}
|
|
23
|
+
if (below) {
|
|
24
|
+
return "show-below-".concat(below);
|
|
25
|
+
}
|
|
26
|
+
return;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Conditionally renders children based on responsive breakpoints.
|
|
31
|
+
* Use either `above` or `below` prop to control visibility.
|
|
32
|
+
*
|
|
33
|
+
* *note:* This component must be an ancestor of a ResponsiveContainer component to work correctly
|
|
34
|
+
* as it relies on CSS container queries.
|
|
35
|
+
*/
|
|
36
|
+
var Show = exports.Show = function Show(_ref) {
|
|
37
|
+
var children = _ref.children,
|
|
38
|
+
above = _ref.above,
|
|
39
|
+
below = _ref.below;
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement("div", {
|
|
41
|
+
className: generateClassName(above, below)
|
|
42
|
+
}, children);
|
|
43
|
+
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
._2rko1qi0{border-radius:var(--ds-radius-medium,6px)}
|
|
3
3
|
._zulp1b66{gap:var(--ds-space-050,4px)}._16qs1cd0{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #091e4226,0 0 1px #091e424f)}
|
|
4
|
+
._18shglyw [class*=show-above-]:not(:has([data-toolbar-component=section] [data-toolbar-component=button],[data-toolbar-component=button-group] [data-toolbar-component=button])), ._ze7rglyw [class*=show-below-]:not(:has([data-toolbar-component=section] [data-toolbar-component=button],[data-toolbar-component=button-group] [data-toolbar-component=button])){display:none}
|
|
4
5
|
._19bv1b66{padding-left:var(--ds-space-050,4px)}
|
|
5
6
|
._1e0c1txw{display:flex}
|
|
6
7
|
._1tkezwfg{min-height:2pc}
|
|
7
8
|
._4cvr1h6o{align-items:center}
|
|
8
9
|
._4t3i14no{height:36px}
|
|
9
10
|
._bfhkvuon{background-color:var(--ds-surface,#fff)}
|
|
11
|
+
._fy9oglyw [data-toolbar-component=section]:not(:has([data-toolbar-component=button])){display:none}
|
|
10
12
|
._u5f31b66{padding-right:var(--ds-space-050,4px)}
|
package/dist/cjs/ui/Toolbar.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/* Toolbar.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-selectors */
|
|
3
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors */
|
|
2
4
|
"use strict";
|
|
3
5
|
|
|
4
6
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
@@ -11,10 +13,13 @@ var _runtime = require("@compiled/react/runtime");
|
|
|
11
13
|
var _react = _interopRequireDefault(require("react"));
|
|
12
14
|
var _css = require("@atlaskit/css");
|
|
13
15
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
16
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
17
|
+
var _ResponsiveContainer = require("./ResponsiveContainer");
|
|
14
18
|
var styles = {
|
|
15
19
|
toolbarBase: "_2rko1qi0 _zulp1b66 _bfhkvuon _1e0c1txw _4cvr1h6o",
|
|
16
20
|
toolbar: "_4t3i14no _u5f31b66 _19bv1b66 _16qs1cd0",
|
|
17
|
-
primaryToolbar: "_bfhkvuon _1tkezwfg"
|
|
21
|
+
primaryToolbar: "_bfhkvuon _1tkezwfg",
|
|
22
|
+
hiddenSelectors: "_fy9oglyw _18shglyw _ze7rglyw"
|
|
18
23
|
};
|
|
19
24
|
/**
|
|
20
25
|
* A simple component representing a toolbar with box shadows - used to represent a secondary/floating toolbar
|
|
@@ -23,18 +28,27 @@ var Toolbar = exports.Toolbar = function Toolbar(_ref) {
|
|
|
23
28
|
var children = _ref.children,
|
|
24
29
|
label = _ref.label;
|
|
25
30
|
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
26
|
-
xcss: (0, _css.cx)(styles.toolbarBase, styles.toolbar),
|
|
31
|
+
xcss: (0, _css.cx)(styles.toolbarBase, styles.toolbar, (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) && styles.hiddenSelectors),
|
|
27
32
|
role: "toolbar",
|
|
28
33
|
"aria-label": label
|
|
29
34
|
}, children);
|
|
30
35
|
};
|
|
31
|
-
|
|
32
36
|
/**
|
|
33
37
|
* A simple component representing a toolbar without box shadows - used to represent a primary toolbar
|
|
34
38
|
*/
|
|
35
39
|
var PrimaryToolbar = exports.PrimaryToolbar = function PrimaryToolbar(_ref2) {
|
|
36
40
|
var children = _ref2.children,
|
|
37
|
-
label = _ref2.label
|
|
41
|
+
label = _ref2.label,
|
|
42
|
+
reducedBreakpoints = _ref2.reducedBreakpoints;
|
|
43
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_responsive', 'isEnabled', true)) {
|
|
44
|
+
return /*#__PURE__*/_react.default.createElement(_ResponsiveContainer.ResponsiveContainer, {
|
|
45
|
+
reducedBreakpoints: reducedBreakpoints
|
|
46
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
47
|
+
xcss: (0, _css.cx)(styles.toolbarBase, styles.primaryToolbar, styles.hiddenSelectors),
|
|
48
|
+
role: "toolbar",
|
|
49
|
+
"aria-label": label
|
|
50
|
+
}, children));
|
|
51
|
+
}
|
|
38
52
|
return /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
39
53
|
xcss: (0, _css.cx)(styles.toolbarBase, styles.primaryToolbar),
|
|
40
54
|
role: "toolbar",
|
|
@@ -24,7 +24,8 @@ var ToolbarButtonGroup = exports.ToolbarButtonGroup = function ToolbarButtonGrou
|
|
|
24
24
|
var LastChild = items.at(-1);
|
|
25
25
|
var middleChildren = items.slice(1, -1);
|
|
26
26
|
return /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
27
|
-
xcss: styles.container
|
|
27
|
+
xcss: styles.container,
|
|
28
|
+
"data-toolbar-component": "button-group"
|
|
28
29
|
}, items.length <= 1 ? children : /*#__PURE__*/React.createElement(_react.Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
29
30
|
className: (0, _runtime.ax)([styles.firstChild])
|
|
30
31
|
}, FirstChild), middleChildren, /*#__PURE__*/React.createElement("div", {
|
|
@@ -13,6 +13,7 @@ var _css = require("@atlaskit/css");
|
|
|
13
13
|
var _dropdownMenu = require("@atlaskit/dropdown-menu");
|
|
14
14
|
var _compiled = require("@atlaskit/primitives/compiled");
|
|
15
15
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
16
|
+
var _ToolbarDropdownMenuContext = require("./ToolbarDropdownMenuContext");
|
|
16
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
17
18
|
var styles = {
|
|
18
19
|
toolbarDropdownItem: "_18zrpxbi _1rjcu2gc _1e0c1txw _kqswh2mm _bfhksm61 _1bsb1osq _1tke14no _1ul9163w _1basglpi _1ah31i6y",
|
|
@@ -56,8 +57,14 @@ var ToolbarDropdownItem = exports.ToolbarDropdownItem = function ToolbarDropdown
|
|
|
56
57
|
href = _ref2.href,
|
|
57
58
|
target = _ref2.target,
|
|
58
59
|
rel = _ref2.rel;
|
|
60
|
+
var parentContext = (0, _ToolbarDropdownMenuContext.useToolbarDropdownMenuNew)();
|
|
59
61
|
return /*#__PURE__*/_react.default.createElement(_dropdownMenu.DropdownItem, {
|
|
60
|
-
onClick:
|
|
62
|
+
onClick: (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_1', 'isEnabled', true) ? function (e) {
|
|
63
|
+
if (!hasNestedDropdownMenu) {
|
|
64
|
+
parentContext === null || parentContext === void 0 || parentContext.closeMenu();
|
|
65
|
+
}
|
|
66
|
+
onClick === null || onClick === void 0 || onClick(e);
|
|
67
|
+
} : onClick,
|
|
61
68
|
elemBefore: elemBefore,
|
|
62
69
|
elemAfter: elemAfter,
|
|
63
70
|
isSelected: isSelected,
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
|
|
2
|
-
._1mou1b66{margin-block:var(--ds-space-050,4px)}._18l8n7od [data-section]:first-of-type{border-block-start:unset}
|
|
2
|
+
._1mou1b66{margin-block:var(--ds-space-050,4px)}._18l8n7od [data-section]:first-of-type{border-block-start:unset}
|
|
3
|
+
._18m91wug{overflow-y:auto}
|
|
4
|
+
._c71lnklw{max-height:20pc}
|
|
@@ -10,7 +10,9 @@ exports.ToolbarDropdownMenu = void 0;
|
|
|
10
10
|
require("./ToolbarDropdownMenu.compiled.css");
|
|
11
11
|
var _runtime = require("@compiled/react/runtime");
|
|
12
12
|
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _react2 = require("@compiled/react");
|
|
13
14
|
var _dropdownMenu = _interopRequireDefault(require("@atlaskit/dropdown-menu"));
|
|
15
|
+
var _compiled = require("@atlaskit/primitives/compiled");
|
|
14
16
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
15
17
|
var _uiContext = require("../hooks/ui-context");
|
|
16
18
|
var _ToolbarButton = require("./ToolbarButton");
|
|
@@ -18,7 +20,8 @@ var _ToolbarDropdownMenuContext = require("./ToolbarDropdownMenuContext");
|
|
|
18
20
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
19
21
|
var styles = {
|
|
20
22
|
sectionMargin: "_1mou1b66",
|
|
21
|
-
firstSectionSeparator: "_18l8n7od"
|
|
23
|
+
firstSectionSeparator: "_18l8n7od",
|
|
24
|
+
scrollContainer: "_c71lnklw _18m91wug"
|
|
22
25
|
};
|
|
23
26
|
var ToolbarDropdownMenuContent = function ToolbarDropdownMenuContent(_ref) {
|
|
24
27
|
var iconBefore = _ref.iconBefore,
|
|
@@ -28,23 +31,20 @@ var ToolbarDropdownMenuContent = function ToolbarDropdownMenuContent(_ref) {
|
|
|
28
31
|
label = _ref.label;
|
|
29
32
|
var _useToolbarUI = (0, _uiContext.useToolbarUI)(),
|
|
30
33
|
onDropdownOpenChanged = _useToolbarUI.onDropdownOpenChanged;
|
|
31
|
-
var
|
|
32
|
-
closeMenu = _useToolbarDropdownMe.closeMenu,
|
|
33
|
-
isOpen = _useToolbarDropdownMe.isOpen,
|
|
34
|
-
openMenu = _useToolbarDropdownMe.openMenu;
|
|
34
|
+
var menuContext = (0, _ToolbarDropdownMenuContext.useToolbarDropdownMenu)();
|
|
35
35
|
var handleOpenChange = (0, _react.useCallback)(function (args) {
|
|
36
36
|
onDropdownOpenChanged(args);
|
|
37
37
|
if (!args.isOpen) {
|
|
38
|
-
closeMenu();
|
|
38
|
+
menuContext === null || menuContext === void 0 || menuContext.closeMenu();
|
|
39
39
|
}
|
|
40
|
-
}, [
|
|
40
|
+
}, [menuContext, onDropdownOpenChanged]);
|
|
41
41
|
var handleClick = (0, _react.useCallback)(function () {
|
|
42
|
-
if (!isOpen) {
|
|
43
|
-
openMenu();
|
|
42
|
+
if (!(menuContext !== null && menuContext !== void 0 && menuContext.isOpen)) {
|
|
43
|
+
menuContext === null || menuContext === void 0 || menuContext.openMenu();
|
|
44
44
|
} else {
|
|
45
|
-
closeMenu();
|
|
45
|
+
menuContext === null || menuContext === void 0 || menuContext.closeMenu();
|
|
46
46
|
}
|
|
47
|
-
}, [
|
|
47
|
+
}, [menuContext]);
|
|
48
48
|
return /*#__PURE__*/_react.default.createElement(_dropdownMenu.default, {
|
|
49
49
|
trigger: function trigger(triggerProps) {
|
|
50
50
|
return /*#__PURE__*/_react.default.createElement(_ToolbarButton.ToolbarButton, {
|
|
@@ -66,7 +66,7 @@ var ToolbarDropdownMenuContent = function ToolbarDropdownMenuContent(_ref) {
|
|
|
66
66
|
});
|
|
67
67
|
},
|
|
68
68
|
onOpenChange: handleOpenChange,
|
|
69
|
-
isOpen: isOpen
|
|
69
|
+
isOpen: menuContext === null || menuContext === void 0 ? void 0 : menuContext.isOpen
|
|
70
70
|
}, children);
|
|
71
71
|
};
|
|
72
72
|
var ToolbarDropdownMenu = exports.ToolbarDropdownMenu = function ToolbarDropdownMenu(_ref2) {
|
|
@@ -76,13 +76,26 @@ var ToolbarDropdownMenu = exports.ToolbarDropdownMenu = function ToolbarDropdown
|
|
|
76
76
|
testId = _ref2.testId,
|
|
77
77
|
label = _ref2.label,
|
|
78
78
|
_ref2$hasSectionMargi = _ref2.hasSectionMargin,
|
|
79
|
-
hasSectionMargin = _ref2$hasSectionMargi === void 0 ? true : _ref2$hasSectionMargi
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
hasSectionMargin = _ref2$hasSectionMargi === void 0 ? true : _ref2$hasSectionMargi,
|
|
80
|
+
_ref2$enableMaxHeight = _ref2.enableMaxHeight,
|
|
81
|
+
enableMaxHeight = _ref2$enableMaxHeight === void 0 ? false : _ref2$enableMaxHeight;
|
|
82
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_1', 'isEnabled', true)) {
|
|
83
|
+
return /*#__PURE__*/_react.default.createElement(ToolbarDropdownMenuContent, {
|
|
84
|
+
iconBefore: iconBefore,
|
|
85
|
+
isDisabled: isDisabled,
|
|
86
|
+
testId: testId,
|
|
87
|
+
label: label
|
|
88
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
89
|
+
xcss: (0, _react2.cx)(hasSectionMargin && styles.sectionMargin, enableMaxHeight && styles.scrollContainer, (0, _expValEquals.expValEquals)('platform_editor_toolbar_migrate_loom', 'isEnabled', true) && styles.firstSectionSeparator)
|
|
90
|
+
}, children));
|
|
91
|
+
} else {
|
|
92
|
+
return /*#__PURE__*/_react.default.createElement(_ToolbarDropdownMenuContext.ToolbarDropdownMenuProvider, null, /*#__PURE__*/_react.default.createElement(ToolbarDropdownMenuContent, {
|
|
93
|
+
iconBefore: iconBefore,
|
|
94
|
+
isDisabled: isDisabled,
|
|
95
|
+
testId: testId,
|
|
96
|
+
label: label
|
|
97
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
98
|
+
className: (0, _runtime.ax)([hasSectionMargin && styles.sectionMargin, (0, _expValEquals.expValEquals)('platform_editor_toolbar_migrate_loom', 'isEnabled', true) && styles.firstSectionSeparator])
|
|
99
|
+
}, children)));
|
|
100
|
+
}
|
|
88
101
|
};
|
|
@@ -5,18 +5,26 @@ var _typeof = require("@babel/runtime/helpers/typeof");
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.useToolbarDropdownMenu = exports.ToolbarDropdownMenuProvider = void 0;
|
|
8
|
+
exports.useToolbarDropdownMenuOld = exports.useToolbarDropdownMenuNew = exports.useToolbarDropdownMenu = exports.ToolbarDropdownMenuProvider = void 0;
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _platformFeatureFlagsReact = require("@atlaskit/platform-feature-flags-react");
|
|
12
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
11
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
12
14
|
var ToolbarDropdownMenuContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
13
|
-
var
|
|
15
|
+
var useToolbarDropdownMenuOld = exports.useToolbarDropdownMenuOld = function useToolbarDropdownMenuOld() {
|
|
14
16
|
var context = (0, _react.useContext)(ToolbarDropdownMenuContext);
|
|
15
17
|
if (!context) {
|
|
16
18
|
throw new Error('useToolbarDropdownMenu must be used within ToolbarDropdownMenuProvider');
|
|
17
19
|
}
|
|
18
20
|
return context;
|
|
19
21
|
};
|
|
22
|
+
var useToolbarDropdownMenuNew = exports.useToolbarDropdownMenuNew = function useToolbarDropdownMenuNew() {
|
|
23
|
+
return (0, _react.useContext)(ToolbarDropdownMenuContext);
|
|
24
|
+
};
|
|
25
|
+
var useToolbarDropdownMenu = exports.useToolbarDropdownMenu = (0, _platformFeatureFlagsReact.conditionalHooksFactory)(function () {
|
|
26
|
+
return (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_1', 'isEnabled', true);
|
|
27
|
+
}, useToolbarDropdownMenuNew, useToolbarDropdownMenuOld);
|
|
20
28
|
var ToolbarDropdownMenuProvider = exports.ToolbarDropdownMenuProvider = function ToolbarDropdownMenuProvider(_ref) {
|
|
21
29
|
var children = _ref.children;
|
|
22
30
|
var _useState = (0, _react.useState)(false),
|
|
@@ -22,7 +22,8 @@ var ToolbarSection = exports.ToolbarSection = function ToolbarSection(_ref) {
|
|
|
22
22
|
hasSeparator = _ref.hasSeparator;
|
|
23
23
|
return /*#__PURE__*/React.createElement(_compiled.Box, {
|
|
24
24
|
xcss: (0, _css.cx)(styles.container),
|
|
25
|
-
testId: testId
|
|
25
|
+
testId: testId,
|
|
26
|
+
"data-toolbar-component": "section"
|
|
26
27
|
}, hasSeparator && /*#__PURE__*/React.createElement("div", {
|
|
27
28
|
className: (0, _runtime.ax)(["_195gu2gc _4t3igktf _1bsbt94y _bfhkmuej"])
|
|
28
29
|
}), children);
|
package/dist/es2019/index.js
CHANGED
|
@@ -10,7 +10,9 @@ export { ToolbarKeyboardShortcutHint } from './ui/ToolbarKeyboardShortcutHint';
|
|
|
10
10
|
export { ToolbarSection } from './ui/ToolbarSection';
|
|
11
11
|
export { ToolbarTooltip } from './ui/ToolbarTooltip';
|
|
12
12
|
export { ToolbarColorSwatch } from './ui/ToolbarColorSwatch';
|
|
13
|
-
export { useToolbarDropdownMenu } from './ui/ToolbarDropdownMenuContext';
|
|
13
|
+
export { useToolbarDropdownMenu, ToolbarDropdownMenuProvider } from './ui/ToolbarDropdownMenuContext';
|
|
14
|
+
export { ResponsiveContainer } from './ui/ResponsiveContainer';
|
|
15
|
+
export { Show } from './ui/Show';
|
|
14
16
|
export { AIAdjustLengthIcon } from './ui/icons/AIAdjustLengthIcon';
|
|
15
17
|
export { AIChatIcon } from './ui/icons/AIChatIcon';
|
|
16
18
|
export { AIBriefcaseIcon } from './ui/icons/AIProfessionalIcon';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
._1bsb1osq{width:100%}
|
|
2
|
+
._1bx91ule .show-above-lg, ._1ehg1ule .show-above-md, ._1onx1ule .show-above-sm, ._1xt01ule .show-above-xl{display:block}
|
|
3
|
+
._1f38ptqj{container-name:toolbar-container}
|
|
4
|
+
._7cca15wb{container-type:inline-size}
|
|
5
|
+
._zg9wglyw .show-below-lg, ._1a2cglyw .show-below-md, ._sum2glyw .show-below-sm, ._1vtcglyw .show-below-xl{display:none}
|
|
6
|
+
@container toolbar-container (max-width: 1024px){._t3a8glyw .show-above-xl{display:none}._1x5z1ule .show-below-xl{display:block}}
|
|
7
|
+
@container toolbar-container (max-width: 210px){._48suglyw .show-above-sm{display:none}._j2p61ule .show-below-sm{display:block}}
|
|
8
|
+
@container toolbar-container (max-width: 350px){._1vg1glyw .show-above-md{display:none}._1ei51ule .show-below-md{display:block}}
|
|
9
|
+
@container toolbar-container (max-width: 410px){._6nrqglyw .show-above-sm{display:none}._1fq21ule .show-below-sm{display:block}}
|
|
10
|
+
@container toolbar-container (max-width: 476px){._1ireglyw .show-above-md{display:none}._zy2m1ule .show-below-md{display:block}}
|
|
11
|
+
@container toolbar-container (max-width: 500px){._pjeuglyw .show-above-lg{display:none}._3bio1ule .show-below-lg{display:block}}
|
|
12
|
+
@container toolbar-container (max-width: 768px){._hfbeglyw .show-above-lg{display:none}._gw6d1ule .show-below-lg{display:block}}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/* ResponsiveContainer.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-selectors */
|
|
3
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-container-queries */
|
|
4
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors */
|
|
5
|
+
import "./ResponsiveContainer.compiled.css";
|
|
6
|
+
import { ax, ix } from "@compiled/react/runtime";
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { cx } from '@atlaskit/css';
|
|
9
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
10
|
+
const styles = {
|
|
11
|
+
responsiveContainer: "_1bsb1osq _7cca15wb _1f38ptqj _1bx91ule _1ehg1ule _1onx1ule _1xt01ule _zg9wglyw _1a2cglyw _sum2glyw _1vtcglyw",
|
|
12
|
+
responsiveRules: "_t3a8glyw _1x5z1ule _6nrqglyw _1fq21ule _1ireglyw _zy2m1ule _hfbeglyw _gw6d1ule",
|
|
13
|
+
responsiveRulesReduced: "_t3a8glyw _1x5z1ule _48suglyw _j2p61ule _1vg1glyw _1ei51ule _pjeuglyw _3bio1ule"
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* A responsive container that enables container query-based responsive design using CSS container queries.
|
|
17
|
+
* This component establishes a containment context named 'toolbar-container' that child components can
|
|
18
|
+
* reference for responsive behavior based on the container's width rather than the viewport width.
|
|
19
|
+
*
|
|
20
|
+
* The container defines breakpoints at:
|
|
21
|
+
* - sm: 410px
|
|
22
|
+
* - md: 476px
|
|
23
|
+
* - lg: 768px
|
|
24
|
+
* - xl: 1024px
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* Basic usage with Show component for responsive visibility:
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <ResponsiveContainer>
|
|
30
|
+
* <Show above="md">
|
|
31
|
+
* <Button>Only visible when container is wider than 476px</Button>
|
|
32
|
+
* </Show>
|
|
33
|
+
* <Show below="sm">
|
|
34
|
+
* <Icon>Only visible when container is narrower than 410px</Icon>
|
|
35
|
+
* </Show>
|
|
36
|
+
* </ResponsiveContainer>
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* Combining multiple Show components for different breakpoints:
|
|
41
|
+
* ```tsx
|
|
42
|
+
* <ResponsiveContainer>
|
|
43
|
+
* <Show above="lg">
|
|
44
|
+
* <FullToolbar />
|
|
45
|
+
* </Show>
|
|
46
|
+
* <Show below="lg" above="md">
|
|
47
|
+
* <CompactToolbar />
|
|
48
|
+
* </Show>
|
|
49
|
+
* <Show below="md">
|
|
50
|
+
* <MinimalToolbar />
|
|
51
|
+
* </Show>
|
|
52
|
+
* </ResponsiveContainer>
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @param children - React nodes to render within the responsive container context
|
|
56
|
+
* @returns A Box component with container query styles applied
|
|
57
|
+
*/
|
|
58
|
+
export const ResponsiveContainer = ({
|
|
59
|
+
children,
|
|
60
|
+
reducedBreakpoints
|
|
61
|
+
}) => {
|
|
62
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
63
|
+
xcss: cx(styles.responsiveContainer, reducedBreakpoints ? styles.responsiveRulesReduced : styles.responsiveRules)
|
|
64
|
+
}, children);
|
|
65
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-classname-prop */
|
|
2
|
+
import React from 'react';
|
|
3
|
+
/**
|
|
4
|
+
* Generate a className based on the breakpoints provided.
|
|
5
|
+
*
|
|
6
|
+
* **Warning** - must much classnames defined in ResponsiveContainer.tsx
|
|
7
|
+
* @param above - The breakpoint to show the element above.
|
|
8
|
+
* @param below - The breakpoint to show the element below.
|
|
9
|
+
* @returns The className to apply to the element.
|
|
10
|
+
*/
|
|
11
|
+
const generateClassName = (above, below) => {
|
|
12
|
+
if (above) {
|
|
13
|
+
return `show-above-${above}`;
|
|
14
|
+
}
|
|
15
|
+
if (below) {
|
|
16
|
+
return `show-below-${below}`;
|
|
17
|
+
}
|
|
18
|
+
return;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Conditionally renders children based on responsive breakpoints.
|
|
23
|
+
* Use either `above` or `below` prop to control visibility.
|
|
24
|
+
*
|
|
25
|
+
* *note:* This component must be an ancestor of a ResponsiveContainer component to work correctly
|
|
26
|
+
* as it relies on CSS container queries.
|
|
27
|
+
*/
|
|
28
|
+
export const Show = ({
|
|
29
|
+
children,
|
|
30
|
+
above,
|
|
31
|
+
below
|
|
32
|
+
}) => {
|
|
33
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
34
|
+
className: generateClassName(above, below)
|
|
35
|
+
}, children);
|
|
36
|
+
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
._2rko1qi0{border-radius:var(--ds-radius-medium,6px)}
|
|
3
3
|
._zulp1b66{gap:var(--ds-space-050,4px)}._16qs1cd0{box-shadow:var(--ds-shadow-overlay,0 8px 9pt #091e4226,0 0 1px #091e424f)}
|
|
4
|
+
._18shglyw [class*=show-above-]:not(:has([data-toolbar-component=section] [data-toolbar-component=button],[data-toolbar-component=button-group] [data-toolbar-component=button])), ._ze7rglyw [class*=show-below-]:not(:has([data-toolbar-component=section] [data-toolbar-component=button],[data-toolbar-component=button-group] [data-toolbar-component=button])){display:none}
|
|
4
5
|
._19bv1b66{padding-left:var(--ds-space-050,4px)}
|
|
5
6
|
._1e0c1txw{display:flex}
|
|
6
7
|
._1tkezwfg{min-height:2pc}
|
|
7
8
|
._4cvr1h6o{align-items:center}
|
|
8
9
|
._4t3i14no{height:36px}
|
|
9
10
|
._bfhkvuon{background-color:var(--ds-surface,#fff)}
|
|
11
|
+
._fy9oglyw [data-toolbar-component=section]:not(:has([data-toolbar-component=button])){display:none}
|
|
10
12
|
._u5f31b66{padding-right:var(--ds-space-050,4px)}
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
/* Toolbar.tsx generated by @compiled/babel-plugin v0.36.1 */
|
|
2
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-unsafe-selectors */
|
|
3
|
+
/* eslint-disable @atlaskit/ui-styling-standard/no-nested-selectors */
|
|
2
4
|
import "./Toolbar.compiled.css";
|
|
3
5
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
6
|
import React from 'react';
|
|
5
7
|
import { cx } from '@atlaskit/css';
|
|
6
8
|
import { Box } from '@atlaskit/primitives/compiled';
|
|
9
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
10
|
+
import { ResponsiveContainer } from './ResponsiveContainer';
|
|
7
11
|
const styles = {
|
|
8
12
|
toolbarBase: "_2rko1qi0 _zulp1b66 _bfhkvuon _1e0c1txw _4cvr1h6o",
|
|
9
13
|
toolbar: "_4t3i14no _u5f31b66 _19bv1b66 _16qs1cd0",
|
|
10
|
-
primaryToolbar: "_bfhkvuon _1tkezwfg"
|
|
14
|
+
primaryToolbar: "_bfhkvuon _1tkezwfg",
|
|
15
|
+
hiddenSelectors: "_fy9oglyw _18shglyw _ze7rglyw"
|
|
11
16
|
};
|
|
12
17
|
/**
|
|
13
18
|
* A simple component representing a toolbar with box shadows - used to represent a secondary/floating toolbar
|
|
@@ -17,19 +22,28 @@ export const Toolbar = ({
|
|
|
17
22
|
label
|
|
18
23
|
}) => {
|
|
19
24
|
return /*#__PURE__*/React.createElement(Box, {
|
|
20
|
-
xcss: cx(styles.toolbarBase, styles.toolbar),
|
|
25
|
+
xcss: cx(styles.toolbarBase, styles.toolbar, expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) && styles.hiddenSelectors),
|
|
21
26
|
role: "toolbar",
|
|
22
27
|
"aria-label": label
|
|
23
28
|
}, children);
|
|
24
29
|
};
|
|
25
|
-
|
|
26
30
|
/**
|
|
27
31
|
* A simple component representing a toolbar without box shadows - used to represent a primary toolbar
|
|
28
32
|
*/
|
|
29
33
|
export const PrimaryToolbar = ({
|
|
30
34
|
children,
|
|
31
|
-
label
|
|
35
|
+
label,
|
|
36
|
+
reducedBreakpoints
|
|
32
37
|
}) => {
|
|
38
|
+
if (expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true)) {
|
|
39
|
+
return /*#__PURE__*/React.createElement(ResponsiveContainer, {
|
|
40
|
+
reducedBreakpoints: reducedBreakpoints
|
|
41
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
42
|
+
xcss: cx(styles.toolbarBase, styles.primaryToolbar, styles.hiddenSelectors),
|
|
43
|
+
role: "toolbar",
|
|
44
|
+
"aria-label": label
|
|
45
|
+
}, children));
|
|
46
|
+
}
|
|
33
47
|
return /*#__PURE__*/React.createElement(Box, {
|
|
34
48
|
xcss: cx(styles.toolbarBase, styles.primaryToolbar),
|
|
35
49
|
role: "toolbar",
|