@momentum-design/components 0.118.5 → 0.118.6
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/dist/browser/index.js +198 -198
- package/dist/browser/index.js.map +4 -4
- package/dist/components/popover/index.js +2 -0
- package/dist/components/popover/popover.component.d.ts +44 -8
- package/dist/components/popover/popover.component.js +53 -11
- package/dist/components/popover/popover.portal.component.d.ts +29 -0
- package/dist/components/popover/popover.portal.component.js +37 -0
- package/dist/components/popover/popover.utils.d.ts +15 -0
- package/dist/components/popover/popover.utils.js +32 -3
- package/dist/custom-elements.json +432 -412
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -2
- package/dist/react/popover/index.d.ts +43 -7
- package/dist/react/popover/index.js +43 -7
- package/package.json +1 -1
package/dist/react/index.d.ts
CHANGED
@@ -8,8 +8,8 @@ export { default as Appheader } from './appheader';
|
|
8
8
|
export { default as Avatar } from './avatar';
|
9
9
|
export { default as AvatarButton } from './avatarbutton';
|
10
10
|
export { default as Badge } from './badge';
|
11
|
-
export { default as Brandvisual } from './brandvisual';
|
12
11
|
export { default as Banner } from './banner';
|
12
|
+
export { default as Brandvisual } from './brandvisual';
|
13
13
|
export { default as Bullet } from './bullet';
|
14
14
|
export { default as Button } from './button';
|
15
15
|
export { default as ButtonGroup } from './buttongroup';
|
@@ -52,8 +52,8 @@ export { default as NavMenuItem } from './navmenuitem';
|
|
52
52
|
export { default as OptGroup } from './optgroup';
|
53
53
|
export { default as Option } from './option';
|
54
54
|
export { default as Password } from './password';
|
55
|
-
export { default as Popover } from './popover';
|
56
55
|
export { default as Presence } from './presence';
|
56
|
+
export { default as Popover } from './popover';
|
57
57
|
export { default as Progressbar } from './progressbar';
|
58
58
|
export { default as Progressspinner } from './progressspinner';
|
59
59
|
export { default as Radio } from './radio';
|
package/dist/react/index.js
CHANGED
@@ -8,8 +8,8 @@ export { default as Appheader } from './appheader';
|
|
8
8
|
export { default as Avatar } from './avatar';
|
9
9
|
export { default as AvatarButton } from './avatarbutton';
|
10
10
|
export { default as Badge } from './badge';
|
11
|
-
export { default as Brandvisual } from './brandvisual';
|
12
11
|
export { default as Banner } from './banner';
|
12
|
+
export { default as Brandvisual } from './brandvisual';
|
13
13
|
export { default as Bullet } from './bullet';
|
14
14
|
export { default as Button } from './button';
|
15
15
|
export { default as ButtonGroup } from './buttongroup';
|
@@ -52,8 +52,8 @@ export { default as NavMenuItem } from './navmenuitem';
|
|
52
52
|
export { default as OptGroup } from './optgroup';
|
53
53
|
export { default as Option } from './option';
|
54
54
|
export { default as Password } from './password';
|
55
|
-
export { default as Popover } from './popover';
|
56
55
|
export { default as Presence } from './presence';
|
56
|
+
export { default as Popover } from './popover';
|
57
57
|
export { default as Progressbar } from './progressbar';
|
58
58
|
export { default as Progressspinner } from './progressspinner';
|
59
59
|
export { default as Radio } from './radio';
|
@@ -2,20 +2,56 @@ import { type EventName } from '@lit/react';
|
|
2
2
|
import Component from '../../components/popover';
|
3
3
|
import type { Events } from '../../components/popover/popover.types';
|
4
4
|
/**
|
5
|
-
* Popover
|
6
|
-
*
|
5
|
+
* Popover is genric overlay which can be trigered by any actinable element.
|
6
|
+
*
|
7
|
+
* It can be used for tooltips, dropdowns, menus or any showing any other contextual content.
|
8
|
+
*
|
7
9
|
* The popover automatically positions itself based on available space and
|
8
|
-
* supports dynamic height adjustments with scrollable content when needed
|
10
|
+
* supports dynamic height adjustments with scrollable content when needed.
|
11
|
+
* It uses [Floating UI](https://floating-ui.com/) for maintaining the position of the popover.
|
12
|
+
*
|
13
|
+
* ## Limitations
|
14
|
+
*
|
15
|
+
* ### On trigger for multiple popovers
|
16
|
+
*
|
17
|
+
* A component (button, etc.) can trigger more than one popover, but only one of them should change the
|
18
|
+
* aria-expanded and aria-haspopup attributes on the trigger.
|
9
19
|
*
|
10
|
-
*
|
11
|
-
*
|
12
|
-
*
|
20
|
+
* To prevent unexpected attribute changes on the trigger `disable-aria-expanded` attribute must be set on all linked
|
21
|
+
* Popoers except one.
|
22
|
+
*
|
23
|
+
* ### React Popover with append-to attribute
|
24
|
+
*
|
25
|
+
* React mounts the popover based on the virtual DOM, but when the append-to attribute is set, the popover removes itself
|
26
|
+
* and mounts to the specified element. React will not know about the move and will not know about the
|
27
|
+
* newly created mdc-popoverportal element either. This throws a `NotFoundError` error when the Popover is directly
|
28
|
+
* added/removed by React, for example:
|
29
|
+
*
|
30
|
+
* ```tsx
|
31
|
+
* const SomeComponent = () => {
|
32
|
+
* const [isOpen, setIsOpen] = useState(false);
|
33
|
+
* return (<div>
|
34
|
+
* {isOpen && <Popover append-to="some-element-id">...</mdc-popover>}
|
35
|
+
* </div>);
|
36
|
+
* }
|
37
|
+
* ```
|
38
|
+
* As a workaround Popover need to wrap with any other element/component, for example:
|
39
|
+
* ```tsx
|
40
|
+
* const SomeComponent = () => {
|
41
|
+
* const [isOpen, setIsOpen] = useState(false);
|
42
|
+
* return (<div>
|
43
|
+
* {isOpen && <div>
|
44
|
+
* <Popover append-to="some-element-id">...</mdc-popover>
|
45
|
+
* <div>}
|
46
|
+
* </div>);
|
47
|
+
* }
|
48
|
+
* ```
|
49
|
+
* Note the wrapper <div> around the Popover component (React.Fragment does not work).
|
13
50
|
*
|
14
51
|
* @dependency mdc-button
|
15
52
|
*
|
16
53
|
* @tagname mdc-popover
|
17
54
|
*
|
18
|
-
*
|
19
55
|
* @event shown - (React: onShown) This event is dispatched when the popover is shown
|
20
56
|
* @event hidden - (React: onHidden) This event is dispatched when the popover is hidden
|
21
57
|
* @event created - (React: onCreated) This event is dispatched when the popover is created (added to the DOM)
|
@@ -3,20 +3,56 @@ import { createComponent } from '@lit/react';
|
|
3
3
|
import Component from '../../components/popover';
|
4
4
|
import { TAG_NAME } from '../../components/popover/popover.constants';
|
5
5
|
/**
|
6
|
-
* Popover
|
7
|
-
*
|
6
|
+
* Popover is genric overlay which can be trigered by any actinable element.
|
7
|
+
*
|
8
|
+
* It can be used for tooltips, dropdowns, menus or any showing any other contextual content.
|
9
|
+
*
|
8
10
|
* The popover automatically positions itself based on available space and
|
9
|
-
* supports dynamic height adjustments with scrollable content when needed
|
11
|
+
* supports dynamic height adjustments with scrollable content when needed.
|
12
|
+
* It uses [Floating UI](https://floating-ui.com/) for maintaining the position of the popover.
|
13
|
+
*
|
14
|
+
* ## Limitations
|
15
|
+
*
|
16
|
+
* ### On trigger for multiple popovers
|
17
|
+
*
|
18
|
+
* A component (button, etc.) can trigger more than one popover, but only one of them should change the
|
19
|
+
* aria-expanded and aria-haspopup attributes on the trigger.
|
10
20
|
*
|
11
|
-
*
|
12
|
-
*
|
13
|
-
*
|
21
|
+
* To prevent unexpected attribute changes on the trigger `disable-aria-expanded` attribute must be set on all linked
|
22
|
+
* Popoers except one.
|
23
|
+
*
|
24
|
+
* ### React Popover with append-to attribute
|
25
|
+
*
|
26
|
+
* React mounts the popover based on the virtual DOM, but when the append-to attribute is set, the popover removes itself
|
27
|
+
* and mounts to the specified element. React will not know about the move and will not know about the
|
28
|
+
* newly created mdc-popoverportal element either. This throws a `NotFoundError` error when the Popover is directly
|
29
|
+
* added/removed by React, for example:
|
30
|
+
*
|
31
|
+
* ```tsx
|
32
|
+
* const SomeComponent = () => {
|
33
|
+
* const [isOpen, setIsOpen] = useState(false);
|
34
|
+
* return (<div>
|
35
|
+
* {isOpen && <Popover append-to="some-element-id">...</mdc-popover>}
|
36
|
+
* </div>);
|
37
|
+
* }
|
38
|
+
* ```
|
39
|
+
* As a workaround Popover need to wrap with any other element/component, for example:
|
40
|
+
* ```tsx
|
41
|
+
* const SomeComponent = () => {
|
42
|
+
* const [isOpen, setIsOpen] = useState(false);
|
43
|
+
* return (<div>
|
44
|
+
* {isOpen && <div>
|
45
|
+
* <Popover append-to="some-element-id">...</mdc-popover>
|
46
|
+
* <div>}
|
47
|
+
* </div>);
|
48
|
+
* }
|
49
|
+
* ```
|
50
|
+
* Note the wrapper <div> around the Popover component (React.Fragment does not work).
|
14
51
|
*
|
15
52
|
* @dependency mdc-button
|
16
53
|
*
|
17
54
|
* @tagname mdc-popover
|
18
55
|
*
|
19
|
-
*
|
20
56
|
* @event shown - (React: onShown) This event is dispatched when the popover is shown
|
21
57
|
* @event hidden - (React: onHidden) This event is dispatched when the popover is hidden
|
22
58
|
* @event created - (React: onCreated) This event is dispatched when the popover is created (added to the DOM)
|