@atlaskit/navigation-system 11.4.1 → 11.4.3
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 +16 -0
- package/dist/cjs/ui/page-layout/panel-splitter/get-panel-growth-side.js +19 -0
- package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.compiled.css +2 -0
- package/dist/cjs/ui/page-layout/panel-splitter/panel-splitter.js +25 -7
- package/dist/es2019/ui/page-layout/panel-splitter/get-panel-growth-side.js +14 -0
- package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.compiled.css +2 -0
- package/dist/es2019/ui/page-layout/panel-splitter/panel-splitter.js +22 -6
- package/dist/esm/ui/page-layout/panel-splitter/get-panel-growth-side.js +13 -0
- package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.compiled.css +2 -0
- package/dist/esm/ui/page-layout/panel-splitter/panel-splitter.js +25 -7
- package/dist/types/ui/page-layout/panel-splitter/get-panel-growth-side.d.ts +10 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlassian/navigation-system
|
|
2
2
|
|
|
3
|
+
## 11.4.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e3025d3052440`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e3025d3052440) -
|
|
8
|
+
PanelSplitter: behind `platform-dst-panel-splitter-resize-direction`, the tooltip side and the
|
|
9
|
+
keyboard arrow keys follow the panel's resize direction, which comes from `position` and the text
|
|
10
|
+
direction. For `position="start"` in left-to-right languages, the tooltip shows on the left and
|
|
11
|
+
ArrowLeft increases the width.
|
|
12
|
+
|
|
13
|
+
## 11.4.2
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 11.4.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getPanelGrowthSide = getPanelGrowthSide;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the physical side the panel grows towards when the splitter is dragged away from it.
|
|
9
|
+
*
|
|
10
|
+
* `position: 'end'` grows towards the inline-end, which is the right in left-to-right languages, and
|
|
11
|
+
* `position: 'start'` grows towards the inline-start.
|
|
12
|
+
*/
|
|
13
|
+
function getPanelGrowthSide(_ref) {
|
|
14
|
+
var position = _ref.position,
|
|
15
|
+
textDirection = _ref.textDirection;
|
|
16
|
+
var isGrowingTowardsInlineEnd = position === 'end';
|
|
17
|
+
var isInlineEndOnTheRight = textDirection === 'ltr';
|
|
18
|
+
return isGrowingTowardsInlineEnd === isInlineEndOnTheRight ? 'right' : 'left';
|
|
19
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
._12ji1r31{outline-color:currentColor}
|
|
2
|
+
._12l2196n{margin-inline-end:var(--ds-space-negative-075,-6px)}
|
|
2
3
|
._12y31o36{outline-width:medium}
|
|
3
4
|
._152tidpf{inset-block-start:0}
|
|
4
5
|
._1bsb1l7b{width:3px}
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
._6fl41ytf{transition-timing-function:ease-in-out}
|
|
18
19
|
._85i5ze3t{padding-block-end:var(--ds-space-0,0)}
|
|
19
20
|
._ahbq196n{margin-inline-start:var(--ds-space-negative-075,-6px)}
|
|
21
|
+
._ahbqze3t{margin-inline-start:var(--ds-space-0,0)}
|
|
20
22
|
._bfhk1j28{background-color:transparent}
|
|
21
23
|
._bfhk1r31{background-color:currentColor}
|
|
22
24
|
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
@@ -36,6 +36,7 @@ var _visuallyHidden = _interopRequireDefault(require("@atlaskit/visually-hidden/
|
|
|
36
36
|
var _constants = require("../constants");
|
|
37
37
|
var _layoutAreaSizingContext = require("../layout-area-sizing-context");
|
|
38
38
|
var _convertResizeBoundToPixels = require("./convert-resize-bound-to-pixels");
|
|
39
|
+
var _getPanelGrowthSide = require("./get-panel-growth-side");
|
|
39
40
|
var _getPercentageWithinPixelBounds = require("./get-percentage-within-pixel-bounds");
|
|
40
41
|
var _getPixelWidth = require("./get-pixel-width");
|
|
41
42
|
var _getWidthFromDragLocation = require("./get-width-from-drag-location");
|
|
@@ -64,7 +65,8 @@ var lineStyles = {
|
|
|
64
65
|
root: "_kqswstnw _1e0c1ule _1bsb1l7b _4t3i1osq _syaz1kw7 _bfhk1r31 _1e021v6z"
|
|
65
66
|
};
|
|
66
67
|
var tooltipStyles = {
|
|
67
|
-
root: "_ahbq196n _1bsb1ris"
|
|
68
|
+
root: "_ahbq196n _1bsb1ris",
|
|
69
|
+
placedLeft: "_ahbqze3t _12l2196n"
|
|
68
70
|
};
|
|
69
71
|
var PanelSplitterTooltip = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, ref) {
|
|
70
72
|
var children = _ref.children,
|
|
@@ -102,7 +104,7 @@ var PanelSplitterTooltip = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, r
|
|
|
102
104
|
// Must be statically passed
|
|
103
105
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides
|
|
104
106
|
,
|
|
105
|
-
className: (0, _runtime.ax)([tooltipStyles.root, className])
|
|
107
|
+
className: (0, _runtime.ax)([tooltipStyles.root, props.placement === 'left' && tooltipStyles.placedLeft, className])
|
|
106
108
|
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
|
|
107
109
|
,
|
|
108
110
|
|
|
@@ -117,6 +119,7 @@ var PanelSplitterTooltip = /*#__PURE__*/(0, _react.forwardRef)(function (_ref, r
|
|
|
117
119
|
var MaybeTooltip = function MaybeTooltip(_ref2) {
|
|
118
120
|
var tooltipContent = _ref2.tooltipContent,
|
|
119
121
|
shortcut = _ref2.shortcut,
|
|
122
|
+
mousePosition = _ref2.mousePosition,
|
|
120
123
|
children = _ref2.children,
|
|
121
124
|
testId = _ref2.testId;
|
|
122
125
|
if (tooltipContent) {
|
|
@@ -125,7 +128,7 @@ var MaybeTooltip = function MaybeTooltip(_ref2) {
|
|
|
125
128
|
content: tooltipContent,
|
|
126
129
|
shortcut: shortcut,
|
|
127
130
|
position: "mouse-y",
|
|
128
|
-
mousePosition:
|
|
131
|
+
mousePosition: mousePosition,
|
|
129
132
|
isScreenReaderAnnouncementDisabled: true,
|
|
130
133
|
component: PanelSplitterTooltip,
|
|
131
134
|
shouldAlwaysFadeIn: true,
|
|
@@ -134,6 +137,13 @@ var MaybeTooltip = function MaybeTooltip(_ref2) {
|
|
|
134
137
|
}
|
|
135
138
|
return children;
|
|
136
139
|
};
|
|
140
|
+
|
|
141
|
+
// Browsers increase an RTL range input's value on ArrowLeft, so the arrow key pointing towards the
|
|
142
|
+
// panel's growth side widens it.
|
|
143
|
+
var rangeInputDirs = {
|
|
144
|
+
left: 'rtl',
|
|
145
|
+
right: 'ltr'
|
|
146
|
+
};
|
|
137
147
|
function getTextDirection(element) {
|
|
138
148
|
var _window$getComputedSt = window.getComputedStyle(element),
|
|
139
149
|
direction = _window$getComputedSt.direction;
|
|
@@ -169,6 +179,12 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
169
179
|
unregisterSplitter.current = element && prepareResize ? registerSplitter === null || registerSplitter === void 0 ? void 0 : registerSplitter(element) : undefined;
|
|
170
180
|
}, [prepareResize, registerSplitter]);
|
|
171
181
|
var labelId = (0, _useId.useId)();
|
|
182
|
+
var panelGrowthSide = (0, _react.useMemo)(function () {
|
|
183
|
+
return (0, _fg.fg)('platform-dst-panel-splitter-resize-direction') ? (0, _getPanelGrowthSide.getPanelGrowthSide)({
|
|
184
|
+
position: position,
|
|
185
|
+
textDirection: getTextDirection(panel)
|
|
186
|
+
}) : undefined;
|
|
187
|
+
}, [position, panel]);
|
|
172
188
|
// Separate state used for the input range width to remove the UI's dependency on the "persisted" layout state value being updated
|
|
173
189
|
var _useState = (0, _react.useState)(panelWidth),
|
|
174
190
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -422,7 +438,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
422
438
|
var pendingKeyboardWidth = (0, _react.useRef)(null);
|
|
423
439
|
var handleSliderInputChange = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
424
440
|
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(event, pendingKey) {
|
|
425
|
-
var isManagedResize, sequence, value, bounds, min, max, _pendingKeyboardWidth, current,
|
|
441
|
+
var isManagedResize, sequence, value, bounds, min, max, _pendingKeyboardWidth, current, doesArrowRightIncrease, increase, step, _t2, _t3;
|
|
426
442
|
return _regenerator.default.wrap(function (_context2) {
|
|
427
443
|
while (1) switch (_context2.prev = _context2.next) {
|
|
428
444
|
case 0:
|
|
@@ -466,8 +482,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
466
482
|
// Native range inputs would apply these keys to the placeholder bounds.
|
|
467
483
|
// Preserve the intent until the chunk provides the real bounds instead.
|
|
468
484
|
current = (_pendingKeyboardWidth = pendingKeyboardWidth.current) !== null && _pendingKeyboardWidth !== void 0 ? _pendingKeyboardWidth : (0, _getPixelWidth.getPixelWidth)(panel);
|
|
469
|
-
|
|
470
|
-
increase = pendingKey === 'ArrowUp' || pendingKey === (
|
|
485
|
+
doesArrowRightIncrease = panelGrowthSide ? panelGrowthSide === 'right' : getTextDirection(panel) === 'ltr';
|
|
486
|
+
increase = pendingKey === 'ArrowUp' || pendingKey === (doesArrowRightIncrease ? 'ArrowRight' : 'ArrowLeft') || pendingKey === 'PageUp';
|
|
471
487
|
step = pendingKey.startsWith('Page') ? Math.max(20, (max - min) / 10) : 20;
|
|
472
488
|
value = pendingKey === 'End' ? max : pendingKey === 'Home' ? min : current + (increase ? step : -step);
|
|
473
489
|
}
|
|
@@ -498,7 +514,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
498
514
|
return function (_x, _x2) {
|
|
499
515
|
return _ref8.apply(this, arguments);
|
|
500
516
|
};
|
|
501
|
-
}(), [getResizeBounds, onCompleteResize, onResizeInternal, panelWidth, keyboardResizeManager, panel, prepareResize]);
|
|
517
|
+
}(), [getResizeBounds, onCompleteResize, onResizeInternal, panelWidth, keyboardResizeManager, panel, prepareResize, panelGrowthSide]);
|
|
502
518
|
var handleSliderKeyDown = (0, _react.useCallback)(function (event) {
|
|
503
519
|
if (prepareResize && !keyboardBoundsReady.current && ['Home', 'End', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'PageUp', 'PageDown'].includes(event.key)) {
|
|
504
520
|
event.preventDefault();
|
|
@@ -610,6 +626,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
610
626
|
}, /*#__PURE__*/React.createElement(MaybeTooltip, {
|
|
611
627
|
tooltipContent: tooltipContent,
|
|
612
628
|
shortcut: shortcut,
|
|
629
|
+
mousePosition: panelGrowthSide !== null && panelGrowthSide !== void 0 ? panelGrowthSide : 'right',
|
|
613
630
|
testId: testId ? "".concat(testId, "-tooltip") : undefined
|
|
614
631
|
}, /*#__PURE__*/React.createElement("div", {
|
|
615
632
|
ref: setSplitterRef,
|
|
@@ -618,6 +635,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
618
635
|
className: (0, _runtime.ax)([grabAreaStyles.root, (0, _fg.fg)('platform-dst-tokens-finesse') && grabAreaStyles.rootFinesse])
|
|
619
636
|
}, /*#__PURE__*/React.createElement(_visuallyHidden.default, null, /*#__PURE__*/React.createElement("input", {
|
|
620
637
|
type: "range",
|
|
638
|
+
dir: panelGrowthSide ? rangeInputDirs[panelGrowthSide] : undefined,
|
|
621
639
|
value: rangeInputValue,
|
|
622
640
|
step: 20,
|
|
623
641
|
min: rangeInputBounds.min,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the physical side the panel grows towards when the splitter is dragged away from it.
|
|
3
|
+
*
|
|
4
|
+
* `position: 'end'` grows towards the inline-end, which is the right in left-to-right languages, and
|
|
5
|
+
* `position: 'start'` grows towards the inline-start.
|
|
6
|
+
*/
|
|
7
|
+
export function getPanelGrowthSide({
|
|
8
|
+
position,
|
|
9
|
+
textDirection
|
|
10
|
+
}) {
|
|
11
|
+
const isGrowingTowardsInlineEnd = position === 'end';
|
|
12
|
+
const isInlineEndOnTheRight = textDirection === 'ltr';
|
|
13
|
+
return isGrowingTowardsInlineEnd === isInlineEndOnTheRight ? 'right' : 'left';
|
|
14
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
._12ji1r31{outline-color:currentColor}
|
|
2
|
+
._12l2196n{margin-inline-end:var(--ds-space-negative-075,-6px)}
|
|
2
3
|
._12y31o36{outline-width:medium}
|
|
3
4
|
._152tidpf{inset-block-start:0}
|
|
4
5
|
._1bsb1l7b{width:3px}
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
._6fl41ytf{transition-timing-function:ease-in-out}
|
|
18
19
|
._85i5ze3t{padding-block-end:var(--ds-space-0,0)}
|
|
19
20
|
._ahbq196n{margin-inline-start:var(--ds-space-negative-075,-6px)}
|
|
21
|
+
._ahbqze3t{margin-inline-start:var(--ds-space-0,0)}
|
|
20
22
|
._bfhk1j28{background-color:transparent}
|
|
21
23
|
._bfhk1r31{background-color:currentColor}
|
|
22
24
|
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
@@ -23,6 +23,7 @@ import VisuallyHidden from '@atlaskit/visually-hidden/visually-hidden';
|
|
|
23
23
|
import { contentInsetBlockStart } from '../constants';
|
|
24
24
|
import { LayoutAreaSizingContext } from '../layout-area-sizing-context';
|
|
25
25
|
import { convertResizeBoundToPixels } from './convert-resize-bound-to-pixels';
|
|
26
|
+
import { getPanelGrowthSide } from './get-panel-growth-side';
|
|
26
27
|
import { getPercentageWithinPixelBounds } from './get-percentage-within-pixel-bounds';
|
|
27
28
|
import { getPixelWidth } from './get-pixel-width';
|
|
28
29
|
import { getWidthFromDragLocation } from './get-width-from-drag-location';
|
|
@@ -50,7 +51,8 @@ const lineStyles = {
|
|
|
50
51
|
root: "_kqswstnw _1e0c1ule _1bsb1l7b _4t3i1osq _syaz1kw7 _bfhk1r31 _1e021v6z"
|
|
51
52
|
};
|
|
52
53
|
const tooltipStyles = {
|
|
53
|
-
root: "_ahbq196n _1bsb1ris"
|
|
54
|
+
root: "_ahbq196n _1bsb1ris",
|
|
55
|
+
placedLeft: "_ahbqze3t _12l2196n"
|
|
54
56
|
};
|
|
55
57
|
const PanelSplitterTooltip = /*#__PURE__*/forwardRef(({
|
|
56
58
|
children,
|
|
@@ -87,7 +89,7 @@ const PanelSplitterTooltip = /*#__PURE__*/forwardRef(({
|
|
|
87
89
|
// Must be statically passed
|
|
88
90
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides
|
|
89
91
|
,
|
|
90
|
-
className: ax([tooltipStyles.root, className])
|
|
92
|
+
className: ax([tooltipStyles.root, props.placement === 'left' && tooltipStyles.placedLeft, className])
|
|
91
93
|
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
|
|
92
94
|
,
|
|
93
95
|
|
|
@@ -102,6 +104,7 @@ const PanelSplitterTooltip = /*#__PURE__*/forwardRef(({
|
|
|
102
104
|
const MaybeTooltip = ({
|
|
103
105
|
tooltipContent,
|
|
104
106
|
shortcut,
|
|
107
|
+
mousePosition,
|
|
105
108
|
children,
|
|
106
109
|
testId
|
|
107
110
|
}) => {
|
|
@@ -111,7 +114,7 @@ const MaybeTooltip = ({
|
|
|
111
114
|
content: tooltipContent,
|
|
112
115
|
shortcut: shortcut,
|
|
113
116
|
position: "mouse-y",
|
|
114
|
-
mousePosition:
|
|
117
|
+
mousePosition: mousePosition,
|
|
115
118
|
isScreenReaderAnnouncementDisabled: true,
|
|
116
119
|
component: PanelSplitterTooltip,
|
|
117
120
|
shouldAlwaysFadeIn: true,
|
|
@@ -120,6 +123,13 @@ const MaybeTooltip = ({
|
|
|
120
123
|
}
|
|
121
124
|
return children;
|
|
122
125
|
};
|
|
126
|
+
|
|
127
|
+
// Browsers increase an RTL range input's value on ArrowLeft, so the arrow key pointing towards the
|
|
128
|
+
// panel's growth side widens it.
|
|
129
|
+
const rangeInputDirs = {
|
|
130
|
+
left: 'rtl',
|
|
131
|
+
right: 'ltr'
|
|
132
|
+
};
|
|
123
133
|
function getTextDirection(element) {
|
|
124
134
|
const {
|
|
125
135
|
direction
|
|
@@ -157,6 +167,10 @@ const PortaledPanelSplitter = ({
|
|
|
157
167
|
unregisterSplitter.current = element && prepareResize ? registerSplitter === null || registerSplitter === void 0 ? void 0 : registerSplitter(element) : undefined;
|
|
158
168
|
}, [prepareResize, registerSplitter]);
|
|
159
169
|
const labelId = useId();
|
|
170
|
+
const panelGrowthSide = useMemo(() => fg('platform-dst-panel-splitter-resize-direction') ? getPanelGrowthSide({
|
|
171
|
+
position,
|
|
172
|
+
textDirection: getTextDirection(panel)
|
|
173
|
+
}) : undefined, [position, panel]);
|
|
160
174
|
// Separate state used for the input range width to remove the UI's dependency on the "persisted" layout state value being updated
|
|
161
175
|
const [rangeInputValue, setRangeInputValue] = useState(panelWidth);
|
|
162
176
|
|
|
@@ -387,8 +401,8 @@ const PortaledPanelSplitter = ({
|
|
|
387
401
|
// Native range inputs would apply these keys to the placeholder bounds.
|
|
388
402
|
// Preserve the intent until the chunk provides the real bounds instead.
|
|
389
403
|
const current = (_pendingKeyboardWidth = pendingKeyboardWidth.current) !== null && _pendingKeyboardWidth !== void 0 ? _pendingKeyboardWidth : getPixelWidth(panel);
|
|
390
|
-
const
|
|
391
|
-
const increase = pendingKey === 'ArrowUp' || pendingKey === (
|
|
404
|
+
const doesArrowRightIncrease = panelGrowthSide ? panelGrowthSide === 'right' : getTextDirection(panel) === 'ltr';
|
|
405
|
+
const increase = pendingKey === 'ArrowUp' || pendingKey === (doesArrowRightIncrease ? 'ArrowRight' : 'ArrowLeft') || pendingKey === 'PageUp';
|
|
392
406
|
const step = pendingKey.startsWith('Page') ? Math.max(20, (max - min) / 10) : 20;
|
|
393
407
|
value = pendingKey === 'End' ? max : pendingKey === 'Home' ? min : current + (increase ? step : -step);
|
|
394
408
|
}
|
|
@@ -410,7 +424,7 @@ const PortaledPanelSplitter = ({
|
|
|
410
424
|
initialWidth: panelWidth,
|
|
411
425
|
finalWidth: value
|
|
412
426
|
});
|
|
413
|
-
}, [getResizeBounds, onCompleteResize, onResizeInternal, panelWidth, keyboardResizeManager, panel, prepareResize]);
|
|
427
|
+
}, [getResizeBounds, onCompleteResize, onResizeInternal, panelWidth, keyboardResizeManager, panel, prepareResize, panelGrowthSide]);
|
|
414
428
|
const handleSliderKeyDown = useCallback(event => {
|
|
415
429
|
if (prepareResize && !keyboardBoundsReady.current && ['Home', 'End', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'PageUp', 'PageDown'].includes(event.key)) {
|
|
416
430
|
event.preventDefault();
|
|
@@ -491,6 +505,7 @@ const PortaledPanelSplitter = ({
|
|
|
491
505
|
}, /*#__PURE__*/React.createElement(MaybeTooltip, {
|
|
492
506
|
tooltipContent: tooltipContent,
|
|
493
507
|
shortcut: shortcut,
|
|
508
|
+
mousePosition: panelGrowthSide !== null && panelGrowthSide !== void 0 ? panelGrowthSide : 'right',
|
|
494
509
|
testId: testId ? `${testId}-tooltip` : undefined
|
|
495
510
|
}, /*#__PURE__*/React.createElement("div", {
|
|
496
511
|
ref: setSplitterRef,
|
|
@@ -499,6 +514,7 @@ const PortaledPanelSplitter = ({
|
|
|
499
514
|
className: ax([grabAreaStyles.root, fg('platform-dst-tokens-finesse') && grabAreaStyles.rootFinesse])
|
|
500
515
|
}, /*#__PURE__*/React.createElement(VisuallyHidden, null, /*#__PURE__*/React.createElement("input", {
|
|
501
516
|
type: "range",
|
|
517
|
+
dir: panelGrowthSide ? rangeInputDirs[panelGrowthSide] : undefined,
|
|
502
518
|
value: rangeInputValue,
|
|
503
519
|
step: 20,
|
|
504
520
|
min: rangeInputBounds.min,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the physical side the panel grows towards when the splitter is dragged away from it.
|
|
3
|
+
*
|
|
4
|
+
* `position: 'end'` grows towards the inline-end, which is the right in left-to-right languages, and
|
|
5
|
+
* `position: 'start'` grows towards the inline-start.
|
|
6
|
+
*/
|
|
7
|
+
export function getPanelGrowthSide(_ref) {
|
|
8
|
+
var position = _ref.position,
|
|
9
|
+
textDirection = _ref.textDirection;
|
|
10
|
+
var isGrowingTowardsInlineEnd = position === 'end';
|
|
11
|
+
var isInlineEndOnTheRight = textDirection === 'ltr';
|
|
12
|
+
return isGrowingTowardsInlineEnd === isInlineEndOnTheRight ? 'right' : 'left';
|
|
13
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
._12ji1r31{outline-color:currentColor}
|
|
2
|
+
._12l2196n{margin-inline-end:var(--ds-space-negative-075,-6px)}
|
|
2
3
|
._12y31o36{outline-width:medium}
|
|
3
4
|
._152tidpf{inset-block-start:0}
|
|
4
5
|
._1bsb1l7b{width:3px}
|
|
@@ -17,6 +18,7 @@
|
|
|
17
18
|
._6fl41ytf{transition-timing-function:ease-in-out}
|
|
18
19
|
._85i5ze3t{padding-block-end:var(--ds-space-0,0)}
|
|
19
20
|
._ahbq196n{margin-inline-start:var(--ds-space-negative-075,-6px)}
|
|
21
|
+
._ahbqze3t{margin-inline-start:var(--ds-space-0,0)}
|
|
20
22
|
._bfhk1j28{background-color:transparent}
|
|
21
23
|
._bfhk1r31{background-color:currentColor}
|
|
22
24
|
._bozgze3t{padding-inline-start:var(--ds-space-0,0)}
|
|
@@ -31,6 +31,7 @@ import VisuallyHidden from '@atlaskit/visually-hidden/visually-hidden';
|
|
|
31
31
|
import { contentInsetBlockStart } from '../constants';
|
|
32
32
|
import { LayoutAreaSizingContext } from '../layout-area-sizing-context';
|
|
33
33
|
import { convertResizeBoundToPixels } from './convert-resize-bound-to-pixels';
|
|
34
|
+
import { getPanelGrowthSide } from './get-panel-growth-side';
|
|
34
35
|
import { getPercentageWithinPixelBounds } from './get-percentage-within-pixel-bounds';
|
|
35
36
|
import { getPixelWidth } from './get-pixel-width';
|
|
36
37
|
import { getWidthFromDragLocation } from './get-width-from-drag-location';
|
|
@@ -55,7 +56,8 @@ var lineStyles = {
|
|
|
55
56
|
root: "_kqswstnw _1e0c1ule _1bsb1l7b _4t3i1osq _syaz1kw7 _bfhk1r31 _1e021v6z"
|
|
56
57
|
};
|
|
57
58
|
var tooltipStyles = {
|
|
58
|
-
root: "_ahbq196n _1bsb1ris"
|
|
59
|
+
root: "_ahbq196n _1bsb1ris",
|
|
60
|
+
placedLeft: "_ahbqze3t _12l2196n"
|
|
59
61
|
};
|
|
60
62
|
var PanelSplitterTooltip = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
61
63
|
var children = _ref.children,
|
|
@@ -93,7 +95,7 @@ var PanelSplitterTooltip = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
93
95
|
// Must be statically passed
|
|
94
96
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop, @atlaskit/design-system/no-unsafe-style-overrides
|
|
95
97
|
,
|
|
96
|
-
className: ax([tooltipStyles.root, className])
|
|
98
|
+
className: ax([tooltipStyles.root, props.placement === 'left' && tooltipStyles.placedLeft, className])
|
|
97
99
|
// eslint-disable-next-line @atlaskit/design-system/no-unsafe-style-overrides
|
|
98
100
|
,
|
|
99
101
|
|
|
@@ -108,6 +110,7 @@ var PanelSplitterTooltip = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
108
110
|
var MaybeTooltip = function MaybeTooltip(_ref2) {
|
|
109
111
|
var tooltipContent = _ref2.tooltipContent,
|
|
110
112
|
shortcut = _ref2.shortcut,
|
|
113
|
+
mousePosition = _ref2.mousePosition,
|
|
111
114
|
children = _ref2.children,
|
|
112
115
|
testId = _ref2.testId;
|
|
113
116
|
if (tooltipContent) {
|
|
@@ -116,7 +119,7 @@ var MaybeTooltip = function MaybeTooltip(_ref2) {
|
|
|
116
119
|
content: tooltipContent,
|
|
117
120
|
shortcut: shortcut,
|
|
118
121
|
position: "mouse-y",
|
|
119
|
-
mousePosition:
|
|
122
|
+
mousePosition: mousePosition,
|
|
120
123
|
isScreenReaderAnnouncementDisabled: true,
|
|
121
124
|
component: PanelSplitterTooltip,
|
|
122
125
|
shouldAlwaysFadeIn: true,
|
|
@@ -125,6 +128,13 @@ var MaybeTooltip = function MaybeTooltip(_ref2) {
|
|
|
125
128
|
}
|
|
126
129
|
return children;
|
|
127
130
|
};
|
|
131
|
+
|
|
132
|
+
// Browsers increase an RTL range input's value on ArrowLeft, so the arrow key pointing towards the
|
|
133
|
+
// panel's growth side widens it.
|
|
134
|
+
var rangeInputDirs = {
|
|
135
|
+
left: 'rtl',
|
|
136
|
+
right: 'ltr'
|
|
137
|
+
};
|
|
128
138
|
function getTextDirection(element) {
|
|
129
139
|
var _window$getComputedSt = window.getComputedStyle(element),
|
|
130
140
|
direction = _window$getComputedSt.direction;
|
|
@@ -160,6 +170,12 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
160
170
|
unregisterSplitter.current = element && prepareResize ? registerSplitter === null || registerSplitter === void 0 ? void 0 : registerSplitter(element) : undefined;
|
|
161
171
|
}, [prepareResize, registerSplitter]);
|
|
162
172
|
var labelId = useId();
|
|
173
|
+
var panelGrowthSide = useMemo(function () {
|
|
174
|
+
return fg('platform-dst-panel-splitter-resize-direction') ? getPanelGrowthSide({
|
|
175
|
+
position: position,
|
|
176
|
+
textDirection: getTextDirection(panel)
|
|
177
|
+
}) : undefined;
|
|
178
|
+
}, [position, panel]);
|
|
163
179
|
// Separate state used for the input range width to remove the UI's dependency on the "persisted" layout state value being updated
|
|
164
180
|
var _useState = useState(panelWidth),
|
|
165
181
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -413,7 +429,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
413
429
|
var pendingKeyboardWidth = useRef(null);
|
|
414
430
|
var handleSliderInputChange = useCallback( /*#__PURE__*/function () {
|
|
415
431
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(event, pendingKey) {
|
|
416
|
-
var isManagedResize, sequence, value, bounds, min, max, _pendingKeyboardWidth, current,
|
|
432
|
+
var isManagedResize, sequence, value, bounds, min, max, _pendingKeyboardWidth, current, doesArrowRightIncrease, increase, step, _t2, _t3;
|
|
417
433
|
return _regeneratorRuntime.wrap(function (_context2) {
|
|
418
434
|
while (1) switch (_context2.prev = _context2.next) {
|
|
419
435
|
case 0:
|
|
@@ -457,8 +473,8 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
457
473
|
// Native range inputs would apply these keys to the placeholder bounds.
|
|
458
474
|
// Preserve the intent until the chunk provides the real bounds instead.
|
|
459
475
|
current = (_pendingKeyboardWidth = pendingKeyboardWidth.current) !== null && _pendingKeyboardWidth !== void 0 ? _pendingKeyboardWidth : getPixelWidth(panel);
|
|
460
|
-
|
|
461
|
-
increase = pendingKey === 'ArrowUp' || pendingKey === (
|
|
476
|
+
doesArrowRightIncrease = panelGrowthSide ? panelGrowthSide === 'right' : getTextDirection(panel) === 'ltr';
|
|
477
|
+
increase = pendingKey === 'ArrowUp' || pendingKey === (doesArrowRightIncrease ? 'ArrowRight' : 'ArrowLeft') || pendingKey === 'PageUp';
|
|
462
478
|
step = pendingKey.startsWith('Page') ? Math.max(20, (max - min) / 10) : 20;
|
|
463
479
|
value = pendingKey === 'End' ? max : pendingKey === 'Home' ? min : current + (increase ? step : -step);
|
|
464
480
|
}
|
|
@@ -489,7 +505,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
489
505
|
return function (_x, _x2) {
|
|
490
506
|
return _ref8.apply(this, arguments);
|
|
491
507
|
};
|
|
492
|
-
}(), [getResizeBounds, onCompleteResize, onResizeInternal, panelWidth, keyboardResizeManager, panel, prepareResize]);
|
|
508
|
+
}(), [getResizeBounds, onCompleteResize, onResizeInternal, panelWidth, keyboardResizeManager, panel, prepareResize, panelGrowthSide]);
|
|
493
509
|
var handleSliderKeyDown = useCallback(function (event) {
|
|
494
510
|
if (prepareResize && !keyboardBoundsReady.current && ['Home', 'End', 'ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'PageUp', 'PageDown'].includes(event.key)) {
|
|
495
511
|
event.preventDefault();
|
|
@@ -601,6 +617,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
601
617
|
}, /*#__PURE__*/React.createElement(MaybeTooltip, {
|
|
602
618
|
tooltipContent: tooltipContent,
|
|
603
619
|
shortcut: shortcut,
|
|
620
|
+
mousePosition: panelGrowthSide !== null && panelGrowthSide !== void 0 ? panelGrowthSide : 'right',
|
|
604
621
|
testId: testId ? "".concat(testId, "-tooltip") : undefined
|
|
605
622
|
}, /*#__PURE__*/React.createElement("div", {
|
|
606
623
|
ref: setSplitterRef,
|
|
@@ -609,6 +626,7 @@ var PortaledPanelSplitter = function PortaledPanelSplitter(_ref3) {
|
|
|
609
626
|
className: ax([grabAreaStyles.root, fg('platform-dst-tokens-finesse') && grabAreaStyles.rootFinesse])
|
|
610
627
|
}, /*#__PURE__*/React.createElement(VisuallyHidden, null, /*#__PURE__*/React.createElement("input", {
|
|
611
628
|
type: "range",
|
|
629
|
+
dir: panelGrowthSide ? rangeInputDirs[panelGrowthSide] : undefined,
|
|
612
630
|
value: rangeInputValue,
|
|
613
631
|
step: 20,
|
|
614
632
|
min: rangeInputBounds.min,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the physical side the panel grows towards when the splitter is dragged away from it.
|
|
3
|
+
*
|
|
4
|
+
* `position: 'end'` grows towards the inline-end, which is the right in left-to-right languages, and
|
|
5
|
+
* `position: 'start'` grows towards the inline-start.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getPanelGrowthSide({ position, textDirection, }: {
|
|
8
|
+
position: 'start' | 'end';
|
|
9
|
+
textDirection: 'ltr' | 'rtl';
|
|
10
|
+
}): 'left' | 'right';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/navigation-system",
|
|
3
|
-
"version": "11.4.
|
|
3
|
+
"version": "11.4.3",
|
|
4
4
|
"description": "The latest navigation system for Atlassian apps.",
|
|
5
5
|
"repository": "https://bitbucket.org/atlassian/atlassian-frontend-mirror",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -69,14 +69,14 @@
|
|
|
69
69
|
"@atlaskit/motion": "^9.5.0",
|
|
70
70
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
71
71
|
"@atlaskit/platform-feature-flags-react": "^1.2.0",
|
|
72
|
-
"@atlaskit/popup": "^10.
|
|
72
|
+
"@atlaskit/popup": "^10.2.0",
|
|
73
73
|
"@atlaskit/pragmatic-drag-and-drop": "^4.0.0",
|
|
74
74
|
"@atlaskit/primitives": "^22.6.0",
|
|
75
75
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
76
76
|
"@atlaskit/side-nav-items": "^2.6.0",
|
|
77
77
|
"@atlaskit/tokens": "^20.8.0",
|
|
78
78
|
"@atlaskit/tooltip": "^24.4.0",
|
|
79
|
-
"@atlaskit/top-layer": "^
|
|
79
|
+
"@atlaskit/top-layer": "^7.1.0",
|
|
80
80
|
"@atlaskit/visually-hidden": "^4.4.0",
|
|
81
81
|
"@babel/runtime": "^7.0.0",
|
|
82
82
|
"@compiled/react": "^1.0.2",
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
"@atlaskit/link": "^5.1.0",
|
|
108
108
|
"@atlaskit/lozenge": "^17.0.0",
|
|
109
109
|
"@atlaskit/menu": "^11.0.0",
|
|
110
|
-
"@atlaskit/modal-dialog": "^17.
|
|
110
|
+
"@atlaskit/modal-dialog": "^17.2.0",
|
|
111
111
|
"@atlaskit/onboarding": "^15.4.0",
|
|
112
112
|
"@atlaskit/page-header": "^13.3.0",
|
|
113
113
|
"@atlaskit/page-layout": "^5.5.0",
|
|
@@ -122,14 +122,14 @@
|
|
|
122
122
|
"@atlaskit/spotlight": "^4.2.0",
|
|
123
123
|
"@atlaskit/tabs": "^21.3.0",
|
|
124
124
|
"@atlaskit/tag": "^17.0.0",
|
|
125
|
-
"@atlaskit/textarea": "^10.
|
|
126
|
-
"@atlaskit/textfield": "^10.
|
|
125
|
+
"@atlaskit/textarea": "^10.3.0",
|
|
126
|
+
"@atlaskit/textfield": "^10.3.0",
|
|
127
127
|
"@atlassian/feature-flags-test-utils": "^1.3.0",
|
|
128
128
|
"@atlassian/gemini": "^1.54.0",
|
|
129
129
|
"@atlassian/panel-system": "^2.0.0",
|
|
130
130
|
"@atlassian/react-async": "^0.23.0",
|
|
131
131
|
"@atlassian/react-entrypoint": "^1.1.0",
|
|
132
|
-
"@atlassian/search-dialog": "^10.
|
|
132
|
+
"@atlassian/search-dialog": "^10.28.0",
|
|
133
133
|
"@atlassian/ssr-tests": "workspace:^",
|
|
134
134
|
"@atlassian/test-utils": "^1.1.0",
|
|
135
135
|
"@atlassian/testing-library": "^0.12.0",
|