@atlaskit/editor-toolbar 0.5.0 → 0.6.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 +19 -0
- package/dist/cjs/index.js +14 -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 +3 -1
- package/dist/cjs/ui/Toolbar.js +19 -5
- package/dist/cjs/ui/ToolbarButton.js +2 -1
- package/dist/cjs/ui/ToolbarButtonGroup.js +2 -1
- package/dist/cjs/ui/ToolbarDropdownMenu.compiled.css +3 -1
- package/dist/cjs/ui/ToolbarDropdownMenu.js +9 -4
- package/dist/cjs/ui/ToolbarSection.js +2 -1
- package/dist/es2019/index.js +2 -0
- 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 +3 -1
- package/dist/es2019/ui/Toolbar.js +19 -5
- package/dist/es2019/ui/ToolbarButton.js +2 -1
- package/dist/es2019/ui/ToolbarButtonGroup.js +2 -1
- package/dist/es2019/ui/ToolbarDropdownMenu.compiled.css +3 -1
- package/dist/es2019/ui/ToolbarDropdownMenu.js +8 -4
- package/dist/es2019/ui/ToolbarSection.js +2 -1
- package/dist/esm/index.js +2 -0
- 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 +3 -1
- package/dist/esm/ui/Toolbar.js +19 -5
- package/dist/esm/ui/ToolbarButton.js +2 -1
- package/dist/esm/ui/ToolbarButtonGroup.js +2 -1
- package/dist/esm/ui/ToolbarDropdownMenu.compiled.css +3 -1
- package/dist/esm/ui/ToolbarDropdownMenu.js +9 -4
- package/dist/esm/ui/ToolbarSection.js +2 -1
- package/dist/types/index.d.ts +2 -0
- 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-ts4.5/index.d.ts +2 -0
- 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/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-toolbar
|
|
2
2
|
|
|
3
|
+
## 0.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`51f3f2db61f6e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/51f3f2db61f6e) -
|
|
8
|
+
Add ranks and keys for new collapsed text section component, add responsive container to
|
|
9
|
+
PrimaryToolbar export with new query selectors to hide empty elements, export types
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 0.5.1
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`ef3b2dfa2f8a8`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ef3b2dfa2f8a8) -
|
|
20
|
+
Internal changes to use radius tokens. No visual changes.
|
|
21
|
+
|
|
3
22
|
## 0.5.0
|
|
4
23
|
|
|
5
24
|
### Minor 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() {
|
|
@@ -448,6 +460,8 @@ var _ToolbarSection = require("./ui/ToolbarSection");
|
|
|
448
460
|
var _ToolbarTooltip = require("./ui/ToolbarTooltip");
|
|
449
461
|
var _ToolbarColorSwatch = require("./ui/ToolbarColorSwatch");
|
|
450
462
|
var _ToolbarDropdownMenuContext = require("./ui/ToolbarDropdownMenuContext");
|
|
463
|
+
var _ResponsiveContainer = require("./ui/ResponsiveContainer");
|
|
464
|
+
var _Show = require("./ui/Show");
|
|
451
465
|
var _AIAdjustLengthIcon = require("./ui/icons/AIAdjustLengthIcon");
|
|
452
466
|
var _AIChatIcon = require("./ui/icons/AIChatIcon");
|
|
453
467
|
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
|
-
toolbarBase: "
|
|
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", {
|
|
@@ -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,
|
|
@@ -76,13 +79,15 @@ var ToolbarDropdownMenu = exports.ToolbarDropdownMenu = function ToolbarDropdown
|
|
|
76
79
|
testId = _ref2.testId,
|
|
77
80
|
label = _ref2.label,
|
|
78
81
|
_ref2$hasSectionMargi = _ref2.hasSectionMargin,
|
|
79
|
-
hasSectionMargin = _ref2$hasSectionMargi === void 0 ? true : _ref2$hasSectionMargi
|
|
82
|
+
hasSectionMargin = _ref2$hasSectionMargi === void 0 ? true : _ref2$hasSectionMargi,
|
|
83
|
+
_ref2$enableMaxHeight = _ref2.enableMaxHeight,
|
|
84
|
+
enableMaxHeight = _ref2$enableMaxHeight === void 0 ? false : _ref2$enableMaxHeight;
|
|
80
85
|
return /*#__PURE__*/_react.default.createElement(_ToolbarDropdownMenuContext.ToolbarDropdownMenuProvider, null, /*#__PURE__*/_react.default.createElement(ToolbarDropdownMenuContent, {
|
|
81
86
|
iconBefore: iconBefore,
|
|
82
87
|
isDisabled: isDisabled,
|
|
83
88
|
testId: testId,
|
|
84
89
|
label: label
|
|
85
|
-
}, /*#__PURE__*/_react.default.createElement(
|
|
86
|
-
|
|
90
|
+
}, /*#__PURE__*/_react.default.createElement(_compiled.Box, {
|
|
91
|
+
xcss: (0, _react2.cx)(hasSectionMargin && styles.sectionMargin, enableMaxHeight && styles.scrollContainer, (0, _expValEquals.expValEquals)('platform_editor_toolbar_migrate_loom', 'isEnabled', true) && styles.firstSectionSeparator)
|
|
87
92
|
}, children)));
|
|
88
93
|
};
|
|
@@ -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
|
@@ -11,6 +11,8 @@ export { ToolbarSection } from './ui/ToolbarSection';
|
|
|
11
11
|
export { ToolbarTooltip } from './ui/ToolbarTooltip';
|
|
12
12
|
export { ToolbarColorSwatch } from './ui/ToolbarColorSwatch';
|
|
13
13
|
export { useToolbarDropdownMenu } 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
|
-
toolbarBase: "
|
|
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",
|
|
@@ -17,7 +17,8 @@ export const ToolbarButtonGroup = ({
|
|
|
17
17
|
const LastChild = items.at(-1);
|
|
18
18
|
const middleChildren = items.slice(1, -1);
|
|
19
19
|
return /*#__PURE__*/React.createElement(Box, {
|
|
20
|
-
xcss: styles.container
|
|
20
|
+
xcss: styles.container,
|
|
21
|
+
"data-toolbar-component": "button-group"
|
|
21
22
|
}, items.length <= 1 ? children : /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
22
23
|
className: ax([styles.firstChild])
|
|
23
24
|
}, FirstChild), middleChildren, /*#__PURE__*/React.createElement("div", {
|
|
@@ -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}
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
import "./ToolbarDropdownMenu.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useCallback } from 'react';
|
|
5
|
+
import { cx } from '@compiled/react';
|
|
5
6
|
import DropdownMenu from '@atlaskit/dropdown-menu';
|
|
7
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
8
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
9
|
import { useToolbarUI } from '../hooks/ui-context';
|
|
8
10
|
import { ToolbarButton } from './ToolbarButton';
|
|
9
11
|
import { ToolbarDropdownMenuProvider, useToolbarDropdownMenu } from './ToolbarDropdownMenuContext';
|
|
10
12
|
const styles = {
|
|
11
13
|
sectionMargin: "_1mou1b66",
|
|
12
|
-
firstSectionSeparator: "_18l8n7od"
|
|
14
|
+
firstSectionSeparator: "_18l8n7od",
|
|
15
|
+
scrollContainer: "_c71lnklw _18m91wug"
|
|
13
16
|
};
|
|
14
17
|
const ToolbarDropdownMenuContent = ({
|
|
15
18
|
iconBefore,
|
|
@@ -67,14 +70,15 @@ export const ToolbarDropdownMenu = ({
|
|
|
67
70
|
isDisabled,
|
|
68
71
|
testId,
|
|
69
72
|
label,
|
|
70
|
-
hasSectionMargin = true
|
|
73
|
+
hasSectionMargin = true,
|
|
74
|
+
enableMaxHeight = false
|
|
71
75
|
}) => {
|
|
72
76
|
return /*#__PURE__*/React.createElement(ToolbarDropdownMenuProvider, null, /*#__PURE__*/React.createElement(ToolbarDropdownMenuContent, {
|
|
73
77
|
iconBefore: iconBefore,
|
|
74
78
|
isDisabled: isDisabled,
|
|
75
79
|
testId: testId,
|
|
76
80
|
label: label
|
|
77
|
-
}, /*#__PURE__*/React.createElement(
|
|
78
|
-
|
|
81
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
82
|
+
xcss: cx(hasSectionMargin && styles.sectionMargin, enableMaxHeight && styles.scrollContainer, expValEquals('platform_editor_toolbar_migrate_loom', 'isEnabled', true) && styles.firstSectionSeparator)
|
|
79
83
|
}, children)));
|
|
80
84
|
};
|
|
@@ -15,7 +15,8 @@ export const ToolbarSection = ({
|
|
|
15
15
|
}) => {
|
|
16
16
|
return /*#__PURE__*/React.createElement(Box, {
|
|
17
17
|
xcss: cx(styles.container),
|
|
18
|
-
testId: testId
|
|
18
|
+
testId: testId,
|
|
19
|
+
"data-toolbar-component": "section"
|
|
19
20
|
}, hasSeparator && /*#__PURE__*/React.createElement("div", {
|
|
20
21
|
className: ax(["_195gu2gc _4t3igktf _1bsbt94y _bfhkmuej"])
|
|
21
22
|
}), children);
|
package/dist/esm/index.js
CHANGED
|
@@ -11,6 +11,8 @@ export { ToolbarSection } from './ui/ToolbarSection';
|
|
|
11
11
|
export { ToolbarTooltip } from './ui/ToolbarTooltip';
|
|
12
12
|
export { ToolbarColorSwatch } from './ui/ToolbarColorSwatch';
|
|
13
13
|
export { useToolbarDropdownMenu } 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,64 @@
|
|
|
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
|
+
var 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 var ResponsiveContainer = function ResponsiveContainer(_ref) {
|
|
59
|
+
var children = _ref.children,
|
|
60
|
+
reducedBreakpoints = _ref.reducedBreakpoints;
|
|
61
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
62
|
+
xcss: cx(styles.responsiveContainer, reducedBreakpoints ? styles.responsiveRulesReduced : styles.responsiveRules)
|
|
63
|
+
}, children);
|
|
64
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
var generateClassName = function generateClassName(above, below) {
|
|
12
|
+
if (above) {
|
|
13
|
+
return "show-above-".concat(above);
|
|
14
|
+
}
|
|
15
|
+
if (below) {
|
|
16
|
+
return "show-below-".concat(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 var Show = function Show(_ref) {
|
|
29
|
+
var children = _ref.children,
|
|
30
|
+
above = _ref.above,
|
|
31
|
+
below = _ref.below;
|
|
32
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
33
|
+
className: generateClassName(above, below)
|
|
34
|
+
}, children);
|
|
35
|
+
};
|
|
@@ -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/esm/ui/Toolbar.js
CHANGED
|
@@ -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
|
var styles = {
|
|
8
|
-
toolbarBase: "
|
|
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
|
|
@@ -16,18 +21,27 @@ export var Toolbar = function Toolbar(_ref) {
|
|
|
16
21
|
var children = _ref.children,
|
|
17
22
|
label = _ref.label;
|
|
18
23
|
return /*#__PURE__*/React.createElement(Box, {
|
|
19
|
-
xcss: cx(styles.toolbarBase, styles.toolbar),
|
|
24
|
+
xcss: cx(styles.toolbarBase, styles.toolbar, expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true) && styles.hiddenSelectors),
|
|
20
25
|
role: "toolbar",
|
|
21
26
|
"aria-label": label
|
|
22
27
|
}, children);
|
|
23
28
|
};
|
|
24
|
-
|
|
25
29
|
/**
|
|
26
30
|
* A simple component representing a toolbar without box shadows - used to represent a primary toolbar
|
|
27
31
|
*/
|
|
28
32
|
export var PrimaryToolbar = function PrimaryToolbar(_ref2) {
|
|
29
33
|
var children = _ref2.children,
|
|
30
|
-
label = _ref2.label
|
|
34
|
+
label = _ref2.label,
|
|
35
|
+
reducedBreakpoints = _ref2.reducedBreakpoints;
|
|
36
|
+
if (expValEquals('platform_editor_toolbar_aifc_responsive', 'isEnabled', true)) {
|
|
37
|
+
return /*#__PURE__*/React.createElement(ResponsiveContainer, {
|
|
38
|
+
reducedBreakpoints: reducedBreakpoints
|
|
39
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
40
|
+
xcss: cx(styles.toolbarBase, styles.primaryToolbar, styles.hiddenSelectors),
|
|
41
|
+
role: "toolbar",
|
|
42
|
+
"aria-label": label
|
|
43
|
+
}, children));
|
|
44
|
+
}
|
|
31
45
|
return /*#__PURE__*/React.createElement(Box, {
|
|
32
46
|
xcss: cx(styles.toolbarBase, styles.primaryToolbar),
|
|
33
47
|
role: "toolbar",
|
|
@@ -16,7 +16,8 @@ export var ToolbarButtonGroup = function ToolbarButtonGroup(_ref) {
|
|
|
16
16
|
var LastChild = items.at(-1);
|
|
17
17
|
var middleChildren = items.slice(1, -1);
|
|
18
18
|
return /*#__PURE__*/React.createElement(Box, {
|
|
19
|
-
xcss: styles.container
|
|
19
|
+
xcss: styles.container,
|
|
20
|
+
"data-toolbar-component": "button-group"
|
|
20
21
|
}, items.length <= 1 ? children : /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("div", {
|
|
21
22
|
className: ax([styles.firstChild])
|
|
22
23
|
}, FirstChild), middleChildren, /*#__PURE__*/React.createElement("div", {
|
|
@@ -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}
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
import "./ToolbarDropdownMenu.compiled.css";
|
|
3
3
|
import { ax, ix } from "@compiled/react/runtime";
|
|
4
4
|
import React, { useCallback } from 'react';
|
|
5
|
+
import { cx } from '@compiled/react';
|
|
5
6
|
import DropdownMenu from '@atlaskit/dropdown-menu';
|
|
7
|
+
import { Box } from '@atlaskit/primitives/compiled';
|
|
6
8
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
9
|
import { useToolbarUI } from '../hooks/ui-context';
|
|
8
10
|
import { ToolbarButton } from './ToolbarButton';
|
|
9
11
|
import { ToolbarDropdownMenuProvider, useToolbarDropdownMenu } from './ToolbarDropdownMenuContext';
|
|
10
12
|
var styles = {
|
|
11
13
|
sectionMargin: "_1mou1b66",
|
|
12
|
-
firstSectionSeparator: "_18l8n7od"
|
|
14
|
+
firstSectionSeparator: "_18l8n7od",
|
|
15
|
+
scrollContainer: "_c71lnklw _18m91wug"
|
|
13
16
|
};
|
|
14
17
|
var ToolbarDropdownMenuContent = function ToolbarDropdownMenuContent(_ref) {
|
|
15
18
|
var iconBefore = _ref.iconBefore,
|
|
@@ -67,13 +70,15 @@ export var ToolbarDropdownMenu = function ToolbarDropdownMenu(_ref2) {
|
|
|
67
70
|
testId = _ref2.testId,
|
|
68
71
|
label = _ref2.label,
|
|
69
72
|
_ref2$hasSectionMargi = _ref2.hasSectionMargin,
|
|
70
|
-
hasSectionMargin = _ref2$hasSectionMargi === void 0 ? true : _ref2$hasSectionMargi
|
|
73
|
+
hasSectionMargin = _ref2$hasSectionMargi === void 0 ? true : _ref2$hasSectionMargi,
|
|
74
|
+
_ref2$enableMaxHeight = _ref2.enableMaxHeight,
|
|
75
|
+
enableMaxHeight = _ref2$enableMaxHeight === void 0 ? false : _ref2$enableMaxHeight;
|
|
71
76
|
return /*#__PURE__*/React.createElement(ToolbarDropdownMenuProvider, null, /*#__PURE__*/React.createElement(ToolbarDropdownMenuContent, {
|
|
72
77
|
iconBefore: iconBefore,
|
|
73
78
|
isDisabled: isDisabled,
|
|
74
79
|
testId: testId,
|
|
75
80
|
label: label
|
|
76
|
-
}, /*#__PURE__*/React.createElement(
|
|
77
|
-
|
|
81
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
82
|
+
xcss: cx(hasSectionMargin && styles.sectionMargin, enableMaxHeight && styles.scrollContainer, expValEquals('platform_editor_toolbar_migrate_loom', 'isEnabled', true) && styles.firstSectionSeparator)
|
|
78
83
|
}, children)));
|
|
79
84
|
};
|
|
@@ -14,7 +14,8 @@ export var ToolbarSection = function ToolbarSection(_ref) {
|
|
|
14
14
|
hasSeparator = _ref.hasSeparator;
|
|
15
15
|
return /*#__PURE__*/React.createElement(Box, {
|
|
16
16
|
xcss: cx(styles.container),
|
|
17
|
-
testId: testId
|
|
17
|
+
testId: testId,
|
|
18
|
+
"data-toolbar-component": "section"
|
|
18
19
|
}, hasSeparator && /*#__PURE__*/React.createElement("div", {
|
|
19
20
|
className: ax(["_195gu2gc _4t3igktf _1bsbt94y _bfhkmuej"])
|
|
20
21
|
}), children);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export { ToolbarSection } from './ui/ToolbarSection';
|
|
|
10
10
|
export { ToolbarTooltip } from './ui/ToolbarTooltip';
|
|
11
11
|
export { ToolbarColorSwatch } from './ui/ToolbarColorSwatch';
|
|
12
12
|
export { useToolbarDropdownMenu } from './ui/ToolbarDropdownMenuContext';
|
|
13
|
+
export { ResponsiveContainer } from './ui/ResponsiveContainer';
|
|
14
|
+
export { Show } from './ui/Show';
|
|
13
15
|
export { AIAdjustLengthIcon } from './ui/icons/AIAdjustLengthIcon';
|
|
14
16
|
export { AIChatIcon } from './ui/icons/AIChatIcon';
|
|
15
17
|
export { AIBriefcaseIcon } from './ui/icons/AIProfessionalIcon';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
export type ResponsiveContainerProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* This flag changes the breakpoint definitions, which reduces them to cater for smaller editor widths.
|
|
6
|
+
*
|
|
7
|
+
* Usages - for smaller editors such as comments
|
|
8
|
+
*/
|
|
9
|
+
reducedBreakpoints?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A responsive container that enables container query-based responsive design using CSS container queries.
|
|
13
|
+
* This component establishes a containment context named 'toolbar-container' that child components can
|
|
14
|
+
* reference for responsive behavior based on the container's width rather than the viewport width.
|
|
15
|
+
*
|
|
16
|
+
* The container defines breakpoints at:
|
|
17
|
+
* - sm: 410px
|
|
18
|
+
* - md: 476px
|
|
19
|
+
* - lg: 768px
|
|
20
|
+
* - xl: 1024px
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* Basic usage with Show component for responsive visibility:
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <ResponsiveContainer>
|
|
26
|
+
* <Show above="md">
|
|
27
|
+
* <Button>Only visible when container is wider than 476px</Button>
|
|
28
|
+
* </Show>
|
|
29
|
+
* <Show below="sm">
|
|
30
|
+
* <Icon>Only visible when container is narrower than 410px</Icon>
|
|
31
|
+
* </Show>
|
|
32
|
+
* </ResponsiveContainer>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* Combining multiple Show components for different breakpoints:
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <ResponsiveContainer>
|
|
39
|
+
* <Show above="lg">
|
|
40
|
+
* <FullToolbar />
|
|
41
|
+
* </Show>
|
|
42
|
+
* <Show below="lg" above="md">
|
|
43
|
+
* <CompactToolbar />
|
|
44
|
+
* </Show>
|
|
45
|
+
* <Show below="md">
|
|
46
|
+
* <MinimalToolbar />
|
|
47
|
+
* </Show>
|
|
48
|
+
* </ResponsiveContainer>
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @param children - React nodes to render within the responsive container context
|
|
52
|
+
* @returns A Box component with container query styles applied
|
|
53
|
+
*/
|
|
54
|
+
export declare const ResponsiveContainer: ({ children, reducedBreakpoints }: ResponsiveContainerProps) => React.JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
type Breakpoint = 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
+
type AboveProp = {
|
|
4
|
+
above: Breakpoint;
|
|
5
|
+
below?: never;
|
|
6
|
+
};
|
|
7
|
+
type BelowProp = {
|
|
8
|
+
above?: never;
|
|
9
|
+
below: Breakpoint;
|
|
10
|
+
};
|
|
11
|
+
type ShowProps = {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
} & (AboveProp | BelowProp);
|
|
14
|
+
/**
|
|
15
|
+
* Conditionally renders children based on responsive breakpoints.
|
|
16
|
+
* Use either `above` or `below` prop to control visibility.
|
|
17
|
+
*
|
|
18
|
+
* *note:* This component must be an ancestor of a ResponsiveContainer component to work correctly
|
|
19
|
+
* as it relies on CSS container queries.
|
|
20
|
+
*/
|
|
21
|
+
export declare const Show: ({ children, above, below }: ShowProps) => React.JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { ResponsiveContainerProps } from './ResponsiveContainer';
|
|
2
3
|
type ToolbarProps = {
|
|
3
4
|
children?: ReactNode;
|
|
4
5
|
/**
|
|
@@ -12,8 +13,9 @@ type ToolbarProps = {
|
|
|
12
13
|
* A simple component representing a toolbar with box shadows - used to represent a secondary/floating toolbar
|
|
13
14
|
*/
|
|
14
15
|
export declare const Toolbar: ({ children, label }: ToolbarProps) => React.JSX.Element;
|
|
16
|
+
type PrimaryToolbarProps = ToolbarProps & ResponsiveContainerProps;
|
|
15
17
|
/**
|
|
16
18
|
* A simple component representing a toolbar without box shadows - used to represent a primary toolbar
|
|
17
19
|
*/
|
|
18
|
-
export declare const PrimaryToolbar: ({ children, label }:
|
|
20
|
+
export declare const PrimaryToolbar: ({ children, label, reducedBreakpoints }: PrimaryToolbarProps) => React.JSX.Element;
|
|
19
21
|
export {};
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
import React, { type ReactNode } from 'react';
|
|
6
6
|
type ToolbarDropdownMenuProps = {
|
|
7
7
|
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Enforeces a max height of 320px for menus - when menu is larger a scroll is introduced
|
|
10
|
+
*/
|
|
11
|
+
enableMaxHeight?: boolean;
|
|
8
12
|
/**
|
|
9
13
|
* Whether to add margin around sections to align with 4px block padding existing in current editor dropdown
|
|
10
14
|
*/
|
|
@@ -14,5 +18,5 @@ type ToolbarDropdownMenuProps = {
|
|
|
14
18
|
label?: string;
|
|
15
19
|
testId?: string;
|
|
16
20
|
};
|
|
17
|
-
export declare const ToolbarDropdownMenu: ({ iconBefore, children, isDisabled, testId, label, hasSectionMargin, }: ToolbarDropdownMenuProps) => JSX.Element;
|
|
21
|
+
export declare const ToolbarDropdownMenu: ({ iconBefore, children, isDisabled, testId, label, hasSectionMargin, enableMaxHeight, }: ToolbarDropdownMenuProps) => JSX.Element;
|
|
18
22
|
export {};
|
|
@@ -10,6 +10,8 @@ export { ToolbarSection } from './ui/ToolbarSection';
|
|
|
10
10
|
export { ToolbarTooltip } from './ui/ToolbarTooltip';
|
|
11
11
|
export { ToolbarColorSwatch } from './ui/ToolbarColorSwatch';
|
|
12
12
|
export { useToolbarDropdownMenu } from './ui/ToolbarDropdownMenuContext';
|
|
13
|
+
export { ResponsiveContainer } from './ui/ResponsiveContainer';
|
|
14
|
+
export { Show } from './ui/Show';
|
|
13
15
|
export { AIAdjustLengthIcon } from './ui/icons/AIAdjustLengthIcon';
|
|
14
16
|
export { AIChatIcon } from './ui/icons/AIChatIcon';
|
|
15
17
|
export { AIBriefcaseIcon } from './ui/icons/AIProfessionalIcon';
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
export type ResponsiveContainerProps = {
|
|
3
|
+
children: ReactNode;
|
|
4
|
+
/**
|
|
5
|
+
* This flag changes the breakpoint definitions, which reduces them to cater for smaller editor widths.
|
|
6
|
+
*
|
|
7
|
+
* Usages - for smaller editors such as comments
|
|
8
|
+
*/
|
|
9
|
+
reducedBreakpoints?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A responsive container that enables container query-based responsive design using CSS container queries.
|
|
13
|
+
* This component establishes a containment context named 'toolbar-container' that child components can
|
|
14
|
+
* reference for responsive behavior based on the container's width rather than the viewport width.
|
|
15
|
+
*
|
|
16
|
+
* The container defines breakpoints at:
|
|
17
|
+
* - sm: 410px
|
|
18
|
+
* - md: 476px
|
|
19
|
+
* - lg: 768px
|
|
20
|
+
* - xl: 1024px
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* Basic usage with Show component for responsive visibility:
|
|
24
|
+
* ```tsx
|
|
25
|
+
* <ResponsiveContainer>
|
|
26
|
+
* <Show above="md">
|
|
27
|
+
* <Button>Only visible when container is wider than 476px</Button>
|
|
28
|
+
* </Show>
|
|
29
|
+
* <Show below="sm">
|
|
30
|
+
* <Icon>Only visible when container is narrower than 410px</Icon>
|
|
31
|
+
* </Show>
|
|
32
|
+
* </ResponsiveContainer>
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* Combining multiple Show components for different breakpoints:
|
|
37
|
+
* ```tsx
|
|
38
|
+
* <ResponsiveContainer>
|
|
39
|
+
* <Show above="lg">
|
|
40
|
+
* <FullToolbar />
|
|
41
|
+
* </Show>
|
|
42
|
+
* <Show below="lg" above="md">
|
|
43
|
+
* <CompactToolbar />
|
|
44
|
+
* </Show>
|
|
45
|
+
* <Show below="md">
|
|
46
|
+
* <MinimalToolbar />
|
|
47
|
+
* </Show>
|
|
48
|
+
* </ResponsiveContainer>
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
51
|
+
* @param children - React nodes to render within the responsive container context
|
|
52
|
+
* @returns A Box component with container query styles applied
|
|
53
|
+
*/
|
|
54
|
+
export declare const ResponsiveContainer: ({ children, reducedBreakpoints }: ResponsiveContainerProps) => React.JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React, { type ReactNode } from 'react';
|
|
2
|
+
type Breakpoint = 'sm' | 'md' | 'lg' | 'xl';
|
|
3
|
+
type AboveProp = {
|
|
4
|
+
above: Breakpoint;
|
|
5
|
+
below?: never;
|
|
6
|
+
};
|
|
7
|
+
type BelowProp = {
|
|
8
|
+
above?: never;
|
|
9
|
+
below: Breakpoint;
|
|
10
|
+
};
|
|
11
|
+
type ShowProps = {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
} & (AboveProp | BelowProp);
|
|
14
|
+
/**
|
|
15
|
+
* Conditionally renders children based on responsive breakpoints.
|
|
16
|
+
* Use either `above` or `below` prop to control visibility.
|
|
17
|
+
*
|
|
18
|
+
* *note:* This component must be an ancestor of a ResponsiveContainer component to work correctly
|
|
19
|
+
* as it relies on CSS container queries.
|
|
20
|
+
*/
|
|
21
|
+
export declare const Show: ({ children, above, below }: ShowProps) => React.JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { type ReactNode } from 'react';
|
|
2
|
+
import type { ResponsiveContainerProps } from './ResponsiveContainer';
|
|
2
3
|
type ToolbarProps = {
|
|
3
4
|
children?: ReactNode;
|
|
4
5
|
/**
|
|
@@ -12,8 +13,9 @@ type ToolbarProps = {
|
|
|
12
13
|
* A simple component representing a toolbar with box shadows - used to represent a secondary/floating toolbar
|
|
13
14
|
*/
|
|
14
15
|
export declare const Toolbar: ({ children, label }: ToolbarProps) => React.JSX.Element;
|
|
16
|
+
type PrimaryToolbarProps = ToolbarProps & ResponsiveContainerProps;
|
|
15
17
|
/**
|
|
16
18
|
* A simple component representing a toolbar without box shadows - used to represent a primary toolbar
|
|
17
19
|
*/
|
|
18
|
-
export declare const PrimaryToolbar: ({ children, label }:
|
|
20
|
+
export declare const PrimaryToolbar: ({ children, label, reducedBreakpoints }: PrimaryToolbarProps) => React.JSX.Element;
|
|
19
21
|
export {};
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
import React, { type ReactNode } from 'react';
|
|
6
6
|
type ToolbarDropdownMenuProps = {
|
|
7
7
|
children?: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Enforeces a max height of 320px for menus - when menu is larger a scroll is introduced
|
|
10
|
+
*/
|
|
11
|
+
enableMaxHeight?: boolean;
|
|
8
12
|
/**
|
|
9
13
|
* Whether to add margin around sections to align with 4px block padding existing in current editor dropdown
|
|
10
14
|
*/
|
|
@@ -14,5 +18,5 @@ type ToolbarDropdownMenuProps = {
|
|
|
14
18
|
label?: string;
|
|
15
19
|
testId?: string;
|
|
16
20
|
};
|
|
17
|
-
export declare const ToolbarDropdownMenu: ({ iconBefore, children, isDisabled, testId, label, hasSectionMargin, }: ToolbarDropdownMenuProps) => JSX.Element;
|
|
21
|
+
export declare const ToolbarDropdownMenu: ({ iconBefore, children, isDisabled, testId, label, hasSectionMargin, enableMaxHeight, }: ToolbarDropdownMenuProps) => JSX.Element;
|
|
18
22
|
export {};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"registry": "https://registry.npmjs.org/"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.6.0",
|
|
7
7
|
"description": "Common UI for Toolbars across the platform",
|
|
8
8
|
"atlassian": {
|
|
9
9
|
"team": "Editor: Jenga",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@atlaskit/logo": "^19.7.0",
|
|
31
31
|
"@atlaskit/popup": "^4.3.0",
|
|
32
32
|
"@atlaskit/primitives": "^14.12.0",
|
|
33
|
-
"@atlaskit/tmp-editor-statsig": "^11.
|
|
33
|
+
"@atlaskit/tmp-editor-statsig": "^11.11.0",
|
|
34
34
|
"@atlaskit/tokens": "^6.1.0",
|
|
35
35
|
"@atlaskit/tooltip": "^20.4.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|