@instructure/ui-position 11.7.8 → 11.7.9-pr-snapshot-1792147648392
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 +13 -0
- package/es/Position/index.js +211 -248
- package/es/Position/props.js +19 -26
- package/es/Position/styles.js +9 -43
- package/es/Position/theme.js +9 -40
- package/es/PositionPropTypes.js +33 -58
- package/es/calculateElementPosition.js +473 -573
- package/es/executeMirrorFunction.js +4 -28
- package/es/index.js +1 -24
- package/es/mirrorHorizontalPlacement.js +9 -49
- package/es/mirrorPlacement.js +7 -52
- package/es/parsePlacement.js +1 -24
- package/package.json +14 -17
- package/tsconfig.build.json +0 -3
- package/tsconfig.build.tsbuildinfo +1 -1
- package/lib/Position/index.js +0 -281
- package/lib/Position/props.js +0 -31
- package/lib/Position/styles.js +0 -50
- package/lib/Position/theme.js +0 -47
- package/lib/PositionPropTypes.js +0 -64
- package/lib/calculateElementPosition.js +0 -617
- package/lib/executeMirrorFunction.js +0 -37
- package/lib/index.js +0 -47
- package/lib/mirrorHorizontalPlacement.js +0 -60
- package/lib/mirrorPlacement.js +0 -63
- package/lib/package.json +0 -1
- package/lib/parsePlacement.js +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,19 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [11.7.9-pr-snapshot-1792147648392](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-pr-snapshot-1792147648392) (2026-10-16)
|
|
7
|
+
|
|
8
|
+
### Build System
|
|
9
|
+
|
|
10
|
+
* **many:** replace babel with swc ([7e36c54](https://github.com/instructure/instructure-ui/commit/7e36c54d240b4fa483801c03ab18e7f860f561e2))
|
|
11
|
+
|
|
12
|
+
### BREAKING CHANGES
|
|
13
|
+
|
|
14
|
+
* **many:** `@instructure/ui-babel-preset` and
|
|
15
|
+
`@instructure/browserslist-config-instui` are removed and will no longer be
|
|
16
|
+
published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
20
|
|
|
8
21
|
**Note:** Version bump only for package @instructure/ui-position
|
package/es/Position/index.js
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
* The MIT License (MIT)
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) 2015 - present Instructure, Inc.
|
|
6
|
-
*
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
*
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
*
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
|
|
1
|
+
import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
|
|
26
3
|
import { Component } from 'react';
|
|
27
4
|
import { callRenderProp, ensureSingleChild, safeCloneElement, withDeterministicId } from '@instructure/ui-react-utils';
|
|
28
5
|
import { addPositionChangeListener, findDOMNode } from '@instructure/ui-dom-utils';
|
|
@@ -34,237 +11,223 @@ import generateStyle from './styles.js';
|
|
|
34
11
|
import generateComponentTheme from './theme.js';
|
|
35
12
|
import { allowedProps } from './props.js';
|
|
36
13
|
import { calculateElementPosition } from '../calculateElementPosition.js';
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
category: components/Util Components
|
|
41
|
-
---
|
|
42
|
-
**/
|
|
43
|
-
let Position = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class = class Position extends Component {
|
|
44
|
-
static displayName = 'Position';
|
|
45
|
-
static componentId = 'Position';
|
|
46
|
-
static allowedProps = allowedProps;
|
|
47
|
-
static defaultProps = {
|
|
48
|
-
placement: 'bottom center',
|
|
49
|
-
mountNode: null,
|
|
50
|
-
insertAt: 'bottom',
|
|
51
|
-
constrain: 'window',
|
|
52
|
-
offsetX: 0,
|
|
53
|
-
offsetY: 0,
|
|
54
|
-
shouldTrackPosition: true,
|
|
55
|
-
shouldPositionOverTarget: false,
|
|
56
|
-
children: null
|
|
57
|
-
};
|
|
58
|
-
static locatorAttribute = 'data-position';
|
|
59
|
-
static targetLocatorAttribute = 'data-position-target';
|
|
60
|
-
static contentLocatorAttribute = 'data-position-content';
|
|
61
|
-
constructor(props) {
|
|
62
|
-
super(props);
|
|
63
|
-
const initial = this.calculatePosition(props);
|
|
64
|
-
this._availableHeight = initial.availableHeight;
|
|
65
|
-
this._availableWidth = initial.availableWidth;
|
|
66
|
-
this.state = {
|
|
67
|
-
positioned: false,
|
|
68
|
-
placement: initial.placement,
|
|
69
|
-
style: initial.style
|
|
70
|
-
};
|
|
71
|
-
this.position = debounce(this.position, 0, {
|
|
72
|
-
leading: false,
|
|
73
|
-
trailing: true
|
|
74
|
-
});
|
|
75
|
-
this._id = this.props.id || props.deterministicId();
|
|
76
|
-
}
|
|
77
|
-
ref = null;
|
|
78
|
-
_id;
|
|
79
|
-
_timeouts = [];
|
|
80
|
-
_listener = null;
|
|
81
|
-
_content;
|
|
82
|
-
_target;
|
|
83
|
-
_availableHeight;
|
|
84
|
-
_availableWidth;
|
|
85
|
-
handleRef = el => {
|
|
86
|
-
const {
|
|
87
|
-
elementRef
|
|
88
|
-
} = this.props;
|
|
89
|
-
this.ref = el;
|
|
90
|
-
if (typeof elementRef === 'function') {
|
|
91
|
-
elementRef(el);
|
|
14
|
+
class Position extends Component {
|
|
15
|
+
static{
|
|
16
|
+
this.displayName = 'Position';
|
|
92
17
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return !deepEqual(this.state, nextState) || !shallowEqual(this.props, nextProps) || !shallowEqual(this.context, nextContext);
|
|
96
|
-
}
|
|
97
|
-
componentDidMount() {
|
|
98
|
-
this.toggleLocatorAttributes(true);
|
|
99
|
-
this.props.makeStyles?.();
|
|
100
|
-
}
|
|
101
|
-
componentDidUpdate(prevProps, prevState) {
|
|
102
|
-
this.position();
|
|
103
|
-
this.toggleLocatorAttributes(true);
|
|
104
|
-
if (this.props.shouldTrackPosition !== prevProps.shouldTrackPosition) {
|
|
105
|
-
this.props.shouldTrackPosition ? this.startTracking() : this.stopTracking();
|
|
18
|
+
static{
|
|
19
|
+
this.componentId = 'Position';
|
|
106
20
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
placement
|
|
110
|
-
} = this.state;
|
|
111
|
-
if (style && prevState.style && (placement !== prevState.placement || style.top !== prevState.style.top || style.left !== prevState.style.left) && typeof this.props.onPositionChanged === 'function') {
|
|
112
|
-
this.props.onPositionChanged({
|
|
113
|
-
top: style.top,
|
|
114
|
-
left: style.left,
|
|
115
|
-
placement
|
|
116
|
-
});
|
|
21
|
+
static{
|
|
22
|
+
this.allowedProps = allowedProps;
|
|
117
23
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
24
|
+
static{
|
|
25
|
+
this.defaultProps = {
|
|
26
|
+
placement: 'bottom center',
|
|
27
|
+
mountNode: null,
|
|
28
|
+
insertAt: 'bottom',
|
|
29
|
+
constrain: 'window',
|
|
30
|
+
offsetX: 0,
|
|
31
|
+
offsetY: 0,
|
|
32
|
+
shouldTrackPosition: true,
|
|
33
|
+
shouldPositionOverTarget: false,
|
|
34
|
+
children: null
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
static{
|
|
38
|
+
this.locatorAttribute = 'data-position';
|
|
39
|
+
}
|
|
40
|
+
static{
|
|
41
|
+
this.targetLocatorAttribute = 'data-position-target';
|
|
42
|
+
}
|
|
43
|
+
static{
|
|
44
|
+
this.contentLocatorAttribute = 'data-position-content';
|
|
45
|
+
}
|
|
46
|
+
constructor(props){
|
|
47
|
+
super(props), this.ref = null, this._timeouts = [], this._listener = null, this.handleRef = (el)=>{
|
|
48
|
+
const { elementRef } = this.props;
|
|
49
|
+
this.ref = el;
|
|
50
|
+
if (typeof elementRef === 'function') {
|
|
51
|
+
elementRef(el);
|
|
52
|
+
}
|
|
53
|
+
}, this.handlePortalOpen = ()=>{
|
|
54
|
+
this.position();
|
|
55
|
+
if (this.props.shouldTrackPosition) {
|
|
56
|
+
this.startTracking();
|
|
57
|
+
}
|
|
58
|
+
this._timeouts.push(setTimeout(()=>{
|
|
59
|
+
if (this.state.positioned && typeof this.props.onPositioned === 'function') {
|
|
60
|
+
this.props.onPositioned({
|
|
61
|
+
top: this.state.style.top,
|
|
62
|
+
left: this.state.style.left,
|
|
63
|
+
placement: this.state.placement
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
}, 0));
|
|
67
|
+
}, this.position = ()=>{
|
|
68
|
+
const { placement, style, availableHeight, availableWidth } = this.calculatePosition(this.props);
|
|
69
|
+
this._availableHeight = availableHeight;
|
|
70
|
+
this._availableWidth = availableWidth;
|
|
71
|
+
this.applyAvailableSpaceCustomProperties();
|
|
72
|
+
this.setState({
|
|
73
|
+
positioned: true,
|
|
74
|
+
placement,
|
|
75
|
+
style
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
const initial = this.calculatePosition(props);
|
|
79
|
+
this._availableHeight = initial.availableHeight;
|
|
80
|
+
this._availableWidth = initial.availableWidth;
|
|
81
|
+
this.state = {
|
|
82
|
+
positioned: false,
|
|
83
|
+
placement: initial.placement,
|
|
84
|
+
style: initial.style
|
|
85
|
+
};
|
|
86
|
+
this.position = debounce(this.position, 0, {
|
|
87
|
+
leading: false,
|
|
88
|
+
trailing: true
|
|
89
|
+
});
|
|
90
|
+
this._id = this.props.id || props.deterministicId();
|
|
91
|
+
}
|
|
92
|
+
shouldComponentUpdate(nextProps, nextState, nextContext) {
|
|
93
|
+
return !deepEqual(this.state, nextState) || !shallowEqual(this.props, nextProps) || !shallowEqual(this.context, nextContext);
|
|
94
|
+
}
|
|
95
|
+
componentDidMount() {
|
|
96
|
+
this.toggleLocatorAttributes(true);
|
|
97
|
+
this.props.makeStyles?.();
|
|
98
|
+
}
|
|
99
|
+
componentDidUpdate(prevProps, prevState) {
|
|
100
|
+
this.position();
|
|
101
|
+
this.toggleLocatorAttributes(true);
|
|
102
|
+
if (this.props.shouldTrackPosition !== prevProps.shouldTrackPosition) {
|
|
103
|
+
this.props.shouldTrackPosition ? this.startTracking() : this.stopTracking();
|
|
104
|
+
}
|
|
105
|
+
const { style, placement } = this.state;
|
|
106
|
+
if (style && prevState.style && (placement !== prevState.placement || style.top !== prevState.style.top || style.left !== prevState.style.left) && typeof this.props.onPositionChanged === 'function') {
|
|
107
|
+
this.props.onPositionChanged({
|
|
108
|
+
top: style.top,
|
|
109
|
+
left: style.left,
|
|
110
|
+
placement
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
this.props.makeStyles?.();
|
|
114
|
+
}
|
|
115
|
+
componentWillUnmount() {
|
|
141
116
|
;
|
|
142
|
-
|
|
143
|
-
|
|
117
|
+
this.position.cancel();
|
|
118
|
+
this.stopTracking();
|
|
119
|
+
this._timeouts.forEach((timeout)=>clearTimeout(timeout));
|
|
120
|
+
this.toggleLocatorAttributes(false);
|
|
121
|
+
}
|
|
122
|
+
toggleLocatorAttributes(set) {
|
|
123
|
+
this.toggleLocatorAttribute(findDOMNode(this._content), Position.contentLocatorAttribute, set);
|
|
124
|
+
this.toggleLocatorAttribute(findDOMNode(this._target), Position.targetLocatorAttribute, set);
|
|
125
|
+
}
|
|
126
|
+
toggleLocatorAttribute(node, locator, set) {
|
|
127
|
+
if (node && node.hasAttribute) {
|
|
128
|
+
if (set && !node.hasAttribute(locator)) {
|
|
129
|
+
;
|
|
130
|
+
node.setAttribute(locator, this._id);
|
|
131
|
+
}
|
|
132
|
+
if (!set && node.hasAttribute(locator)) {
|
|
133
|
+
;
|
|
134
|
+
node.removeAttribute(locator);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
144
137
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
138
|
+
applyAvailableSpaceCustomProperties() {
|
|
139
|
+
const node = findDOMNode(this._content);
|
|
140
|
+
if (!node?.style) return;
|
|
141
|
+
const set = (name, value)=>{
|
|
142
|
+
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
143
|
+
node.style.setProperty(name, `${value}px`);
|
|
144
|
+
} else {
|
|
145
|
+
node.style.removeProperty(name);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
148
|
+
set('--ui-position-available-height', this._availableHeight);
|
|
149
|
+
set('--ui-position-available-width', this._availableWidth);
|
|
150
150
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
151
|
+
calculatePosition(props) {
|
|
152
|
+
return calculateElementPosition(this._content, this._target, {
|
|
153
|
+
placement: props.placement,
|
|
154
|
+
offsetX: props.offsetX,
|
|
155
|
+
offsetY: props.offsetY,
|
|
156
|
+
constrain: props.constrain,
|
|
157
|
+
container: props.mountNode,
|
|
158
|
+
over: props.shouldPositionOverTarget
|
|
157
159
|
});
|
|
158
|
-
}
|
|
159
|
-
}, 0));
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
// Write `--ui-position-available-{height,width}` directly on the content
|
|
163
|
-
// node's inline style
|
|
164
|
-
applyAvailableSpaceCustomProperties() {
|
|
165
|
-
const node = findDOMNode(this._content);
|
|
166
|
-
if (!node?.style) return;
|
|
167
|
-
const set = (name, value) => {
|
|
168
|
-
if (typeof value === 'number' && Number.isFinite(value)) {
|
|
169
|
-
node.style.setProperty(name, `${value}px`);
|
|
170
|
-
} else {
|
|
171
|
-
node.style.removeProperty(name);
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
set('--ui-position-available-height', this._availableHeight);
|
|
175
|
-
set('--ui-position-available-width', this._availableWidth);
|
|
176
|
-
}
|
|
177
|
-
calculatePosition(props) {
|
|
178
|
-
return calculateElementPosition(this._content, this._target, {
|
|
179
|
-
placement: props.placement,
|
|
180
|
-
offsetX: props.offsetX,
|
|
181
|
-
offsetY: props.offsetY,
|
|
182
|
-
constrain: props.constrain,
|
|
183
|
-
container: props.mountNode,
|
|
184
|
-
over: props.shouldPositionOverTarget
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
position = () => {
|
|
188
|
-
const {
|
|
189
|
-
placement,
|
|
190
|
-
style,
|
|
191
|
-
availableHeight,
|
|
192
|
-
availableWidth
|
|
193
|
-
} = this.calculatePosition(this.props);
|
|
194
|
-
this._availableHeight = availableHeight;
|
|
195
|
-
this._availableWidth = availableWidth;
|
|
196
|
-
this.applyAvailableSpaceCustomProperties();
|
|
197
|
-
this.setState({
|
|
198
|
-
positioned: true,
|
|
199
|
-
placement,
|
|
200
|
-
style
|
|
201
|
-
});
|
|
202
|
-
};
|
|
203
|
-
startTracking() {
|
|
204
|
-
this._listener = this._listener || addPositionChangeListener(this._target, this.position);
|
|
205
|
-
}
|
|
206
|
-
stopTracking() {
|
|
207
|
-
if (this._listener) {
|
|
208
|
-
this._listener.remove();
|
|
209
|
-
this._listener = null;
|
|
210
160
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
// content that needs to be positioned relative to the target
|
|
214
|
-
renderContent() {
|
|
215
|
-
let content = ensureSingleChild(this.props.children);
|
|
216
|
-
if (content) {
|
|
217
|
-
content = safeCloneElement(content, {
|
|
218
|
-
ref: el => {
|
|
219
|
-
this._content = el;
|
|
220
|
-
},
|
|
221
|
-
style: {
|
|
222
|
-
boxSizing: 'border-box',
|
|
223
|
-
zIndex: this.props.styles?.zIndex,
|
|
224
|
-
...content.props.style,
|
|
225
|
-
...this.state.style
|
|
226
|
-
},
|
|
227
|
-
...(content.props.className && {
|
|
228
|
-
className: content.props.className
|
|
229
|
-
}),
|
|
230
|
-
[Position.contentLocatorAttribute]: this._id
|
|
231
|
-
});
|
|
232
|
-
content = _jsx(Portal, {
|
|
233
|
-
open: true,
|
|
234
|
-
onOpen: this.handlePortalOpen,
|
|
235
|
-
mountNode: this.props.mountNode,
|
|
236
|
-
insertAt: this.props.insertAt,
|
|
237
|
-
children: content
|
|
238
|
-
});
|
|
161
|
+
startTracking() {
|
|
162
|
+
this._listener = this._listener || addPositionChangeListener(this._target, this.position);
|
|
239
163
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
164
|
+
stopTracking() {
|
|
165
|
+
if (this._listener) {
|
|
166
|
+
this._listener.remove();
|
|
167
|
+
this._listener = null;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
renderContent() {
|
|
171
|
+
let content = ensureSingleChild(this.props.children);
|
|
172
|
+
if (content) {
|
|
173
|
+
content = safeCloneElement(content, {
|
|
174
|
+
ref: (el)=>{
|
|
175
|
+
this._content = el;
|
|
176
|
+
},
|
|
177
|
+
style: {
|
|
178
|
+
boxSizing: 'border-box',
|
|
179
|
+
zIndex: this.props.styles?.zIndex,
|
|
180
|
+
...content.props.style,
|
|
181
|
+
...this.state.style
|
|
182
|
+
},
|
|
183
|
+
...content.props.className && {
|
|
184
|
+
className: content.props.className
|
|
185
|
+
},
|
|
186
|
+
[Position.contentLocatorAttribute]: this._id
|
|
187
|
+
});
|
|
188
|
+
content = /*#__PURE__*/ _jsx(Portal, {
|
|
189
|
+
open: true,
|
|
190
|
+
onOpen: this.handlePortalOpen,
|
|
191
|
+
mountNode: this.props.mountNode,
|
|
192
|
+
insertAt: this.props.insertAt,
|
|
193
|
+
children: content
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
return content;
|
|
197
|
+
}
|
|
198
|
+
renderTarget() {
|
|
199
|
+
const target = callRenderProp(this.props.renderTarget);
|
|
200
|
+
if (target) {
|
|
201
|
+
return safeCloneElement(target, {
|
|
202
|
+
ref: (el)=>{
|
|
203
|
+
this._target = el;
|
|
204
|
+
},
|
|
205
|
+
[Position.targetLocatorAttribute]: this._id
|
|
206
|
+
});
|
|
207
|
+
} else if (this.props.target) {
|
|
208
|
+
this._target = callRenderProp(this.props.target);
|
|
209
|
+
}
|
|
210
|
+
return null;
|
|
211
|
+
}
|
|
212
|
+
render() {
|
|
213
|
+
const props = {
|
|
214
|
+
[Position.locatorAttribute]: this._id
|
|
215
|
+
};
|
|
216
|
+
return /*#__PURE__*/ _jsxs("span", {
|
|
217
|
+
...props,
|
|
218
|
+
css: this.props.styles?.position,
|
|
219
|
+
ref: this.handleRef,
|
|
220
|
+
"data-cid": combineDataCid('Position', this.props),
|
|
221
|
+
children: [
|
|
222
|
+
this.renderTarget(),
|
|
223
|
+
this.renderContent()
|
|
224
|
+
]
|
|
225
|
+
});
|
|
253
226
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
};
|
|
260
|
-
return _jsxs("span", {
|
|
261
|
-
...props,
|
|
262
|
-
css: this.props.styles?.position,
|
|
263
|
-
ref: this.handleRef,
|
|
264
|
-
"data-cid": combineDataCid('Position', this.props),
|
|
265
|
-
children: [this.renderTarget(), this.renderContent()]
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
}) || _class) || _class);
|
|
227
|
+
}
|
|
228
|
+
Position = _ts_decorate([
|
|
229
|
+
withDeterministicId(),
|
|
230
|
+
withStyle(generateStyle, generateComponentTheme)
|
|
231
|
+
], Position);
|
|
269
232
|
export default Position;
|
|
270
|
-
export { Position };
|
|
233
|
+
export { Position };
|
package/es/Position/props.js
CHANGED
|
@@ -1,26 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
const allowedProps = ['renderTarget', 'target', 'placement', 'mountNode', 'insertAt', 'constrain', 'offsetX', 'offsetY', 'id', 'shouldTrackPosition', 'shouldPositionOverTarget', 'onPositionChanged', 'onPositioned', 'children', 'containerDisplay', 'elementRef'];
|
|
26
|
-
export { allowedProps };
|
|
1
|
+
const allowedProps = [
|
|
2
|
+
'renderTarget',
|
|
3
|
+
'target',
|
|
4
|
+
'placement',
|
|
5
|
+
'mountNode',
|
|
6
|
+
'insertAt',
|
|
7
|
+
'constrain',
|
|
8
|
+
'offsetX',
|
|
9
|
+
'offsetY',
|
|
10
|
+
'id',
|
|
11
|
+
'shouldTrackPosition',
|
|
12
|
+
'shouldPositionOverTarget',
|
|
13
|
+
'onPositionChanged',
|
|
14
|
+
'onPositioned',
|
|
15
|
+
'children',
|
|
16
|
+
'containerDisplay',
|
|
17
|
+
'elementRef'
|
|
18
|
+
];
|
|
19
|
+
export { allowedProps };
|
package/es/Position/styles.js
CHANGED
|
@@ -1,44 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* ---
|
|
27
|
-
* private: true
|
|
28
|
-
* ---
|
|
29
|
-
* Generates the style object from the theme and provided additional information
|
|
30
|
-
* @param {Object} componentTheme The theme variable object.
|
|
31
|
-
* @param {Object} props the props of the component, the style is applied to
|
|
32
|
-
* @param {Object} state the state of the component, the style is applied to
|
|
33
|
-
* @return {Object} The final style object, which will be used in the component
|
|
34
|
-
*/
|
|
35
|
-
const generateStyle = (componentTheme, props) => {
|
|
36
|
-
return {
|
|
37
|
-
position: {
|
|
38
|
-
label: 'position',
|
|
39
|
-
display: props.containerDisplay
|
|
40
|
-
},
|
|
41
|
-
zIndex: componentTheme.zIndex
|
|
42
|
-
};
|
|
1
|
+
const generateStyle = (componentTheme, props)=>{
|
|
2
|
+
return {
|
|
3
|
+
position: {
|
|
4
|
+
label: 'position',
|
|
5
|
+
display: props.containerDisplay
|
|
6
|
+
},
|
|
7
|
+
zIndex: componentTheme.zIndex
|
|
8
|
+
};
|
|
43
9
|
};
|
|
44
|
-
export default generateStyle;
|
|
10
|
+
export default generateStyle;
|
package/es/Position/theme.js
CHANGED
|
@@ -1,41 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
-
* furnished to do so, subject to the following conditions:
|
|
12
|
-
*
|
|
13
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
-
* copies or substantial portions of the Software.
|
|
15
|
-
*
|
|
16
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
-
* SOFTWARE.
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Generates the theme object for the component from the theme and provided additional information
|
|
27
|
-
* @param {Object} theme The actual theme object.
|
|
28
|
-
* @return {Object} The final theme object with the overrides and component variables
|
|
29
|
-
*/
|
|
30
|
-
const generateComponentTheme = theme => {
|
|
31
|
-
const {
|
|
32
|
-
stacking
|
|
33
|
-
} = theme;
|
|
34
|
-
const componentVariables = {
|
|
35
|
-
zIndex: stacking?.topmost
|
|
36
|
-
};
|
|
37
|
-
return {
|
|
38
|
-
...componentVariables
|
|
39
|
-
};
|
|
1
|
+
const generateComponentTheme = (theme)=>{
|
|
2
|
+
const { stacking } = theme;
|
|
3
|
+
const componentVariables = {
|
|
4
|
+
zIndex: stacking?.topmost
|
|
5
|
+
};
|
|
6
|
+
return {
|
|
7
|
+
...componentVariables
|
|
8
|
+
};
|
|
40
9
|
};
|
|
41
|
-
export default generateComponentTheme;
|
|
10
|
+
export default generateComponentTheme;
|