@lumx/react 3.11.1-alpha.3 → 3.11.1-alpha.5
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/index.d.ts +2 -4
- package/index.js +2 -12
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/button/Button.tsx +3 -3
- package/src/components/button/ButtonRoot.tsx +0 -2
- package/src/components/popover/Popover.stories.tsx +5 -9
- package/src/components/popover/usePopoverStyle.tsx +2 -11
- package/src/components/tooltip/Tooltip.tsx +0 -1
package/package.json
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"url": "https://github.com/lumapps/design-system/issues"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@lumx/core": "^3.11.1-alpha.
|
|
10
|
-
"@lumx/icons": "^3.11.1-alpha.
|
|
9
|
+
"@lumx/core": "^3.11.1-alpha.5",
|
|
10
|
+
"@lumx/icons": "^3.11.1-alpha.5",
|
|
11
11
|
"@popperjs/core": "^2.5.4",
|
|
12
12
|
"body-scroll-lock": "^3.1.5",
|
|
13
13
|
"classnames": "^2.3.2",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"build:storybook": "storybook build"
|
|
111
111
|
},
|
|
112
112
|
"sideEffects": false,
|
|
113
|
-
"version": "3.11.1-alpha.
|
|
113
|
+
"version": "3.11.1-alpha.5"
|
|
114
114
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from 'react';
|
|
2
2
|
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import isEmpty from 'lodash/isEmpty';
|
|
@@ -21,14 +21,14 @@ export const ButtonEmphasis = Emphasis;
|
|
|
21
21
|
* Defines the props of the component.
|
|
22
22
|
*/
|
|
23
23
|
export interface ButtonProps extends BaseButtonProps {
|
|
24
|
-
/** Button content. */
|
|
25
|
-
children?: ReactNode;
|
|
26
24
|
/** Left icon (SVG path). */
|
|
27
25
|
leftIcon?: string;
|
|
28
26
|
/** Right icon (SVG path). */
|
|
29
27
|
rightIcon?: string;
|
|
30
28
|
/** When `true`, the button gets as large as possible. */
|
|
31
29
|
fullWidth?: boolean;
|
|
30
|
+
/** Children */
|
|
31
|
+
children?: React.ReactNode;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
/**
|
|
@@ -44,8 +44,6 @@ export interface BaseButtonProps
|
|
|
44
44
|
type?: HTMLButtonProps['type'];
|
|
45
45
|
/** Custom react component for the link (can be used to inject react router Link). */
|
|
46
46
|
linkAs?: 'a' | any;
|
|
47
|
-
/** Children */
|
|
48
|
-
children?: React.ReactNode;
|
|
49
47
|
}
|
|
50
48
|
|
|
51
49
|
export interface ButtonRootProps extends BaseButtonProps {
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
Elevation,
|
|
17
17
|
Message,
|
|
18
18
|
FlexBox,
|
|
19
|
-
FlexBoxProps,
|
|
20
19
|
IconButtonProps,
|
|
21
20
|
} from '@lumx/react';
|
|
22
21
|
import range from 'lodash/range';
|
|
@@ -165,28 +164,25 @@ export const TestUpdatingChildrenAndMovingAnchor = {
|
|
|
165
164
|
|
|
166
165
|
const [text, setText] = useState('Initial large span of text');
|
|
167
166
|
const [anchorSize, setAnchorSize] = useState<IconButtonProps['size']>('m');
|
|
168
|
-
const [anchorPosition, setAnchorPosition] = useState<FlexBoxProps['vAlign']>('center');
|
|
169
167
|
useEffect(() => {
|
|
170
168
|
if (isOpen) {
|
|
171
169
|
const timers = [
|
|
170
|
+
// Update popover size
|
|
172
171
|
setTimeout(() => setText('Text'), 1000),
|
|
173
|
-
|
|
174
|
-
setTimeout(() =>
|
|
172
|
+
// Update anchor size
|
|
173
|
+
setTimeout(() => setAnchorSize('s'), 1000),
|
|
175
174
|
];
|
|
176
175
|
return () => timers.forEach(clearTimeout);
|
|
177
176
|
}
|
|
178
177
|
setText('Initial large span of text');
|
|
179
178
|
setAnchorSize('m');
|
|
180
|
-
setAnchorPosition('center');
|
|
181
179
|
return undefined;
|
|
182
180
|
}, [isOpen]);
|
|
183
181
|
|
|
184
182
|
return (
|
|
185
183
|
<FlexBox orientation="vertical" gap="huge">
|
|
186
|
-
<Message kind="info">
|
|
187
|
-
|
|
188
|
-
</Message>
|
|
189
|
-
<FlexBox orientation="horizontal" vAlign={anchorPosition}>
|
|
184
|
+
<Message kind="info">Test popover text resize (after 1sec) and anchor resize (after 1.5sec)</Message>
|
|
185
|
+
<FlexBox orientation="horizontal" vAlign="center">
|
|
190
186
|
<IconButton
|
|
191
187
|
label="Notifications"
|
|
192
188
|
className="lumx-spacing-margin-right-huge"
|
|
@@ -141,19 +141,10 @@ export function usePopoverStyle({
|
|
|
141
141
|
if (!update || !popperElement || !anchorElement || !WINDOW?.ResizeObserver) {
|
|
142
142
|
return undefined;
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
// Only update once per frame
|
|
146
|
-
let frame: number | undefined;
|
|
147
|
-
function limitedUpdate() {
|
|
148
|
-
if (frame) return;
|
|
149
|
-
frame = requestAnimationFrame(() => {
|
|
150
|
-
update?.();
|
|
151
|
-
frame = undefined;
|
|
152
|
-
});
|
|
153
|
-
}
|
|
144
|
+
update();
|
|
154
145
|
|
|
155
146
|
// On anchor or popover resize
|
|
156
|
-
const resizeObserver = new ResizeObserver(
|
|
147
|
+
const resizeObserver = new ResizeObserver(update);
|
|
157
148
|
resizeObserver.observe(anchorElement);
|
|
158
149
|
resizeObserver.observe(popperElement);
|
|
159
150
|
return () => {
|