@momentum-design/components 0.104.4 → 0.104.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 +356 -357
- package/dist/browser/index.js.map +4 -4
- package/dist/components/dialog/dialog.component.d.ts +1 -10
- package/dist/components/dialog/dialog.component.js +13 -45
- package/dist/components/menubar/menubar.component.js +1 -1
- package/dist/components/menupopover/menupopover.component.js +2 -1
- package/dist/components/popover/popover.component.d.ts +13 -5
- package/dist/components/popover/popover.component.js +25 -20
- package/dist/components/popover/popover.constants.d.ts +1 -0
- package/dist/components/popover/popover.constants.js +1 -0
- package/dist/components/popover/popover.utils.d.ts +0 -2
- package/dist/components/popover/popover.utils.js +0 -29
- package/dist/components/select/select.component.d.ts +13 -0
- package/dist/components/select/select.component.js +19 -0
- package/dist/components/select/select.styles.js +1 -0
- package/dist/components/slider/index.d.ts +7 -0
- package/dist/components/slider/index.js +4 -0
- package/dist/components/slider/slider.component.d.ts +120 -0
- package/dist/components/slider/slider.component.js +189 -0
- package/dist/components/slider/slider.constants.d.ts +2 -0
- package/dist/components/slider/slider.constants.js +3 -0
- package/dist/components/slider/slider.styles.d.ts +2 -0
- package/dist/components/slider/slider.styles.js +7 -0
- package/dist/components/slider/slider.types.d.ts +3 -0
- package/dist/components/slider/slider.types.js +2 -0
- package/dist/custom-elements.json +2640 -1659
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +3 -2
- package/dist/react/slider/index.d.ts +12 -0
- package/dist/react/slider/index.js +21 -0
- package/dist/utils/mixins/BackdropMixin.d.ts +14 -0
- package/dist/utils/mixins/BackdropMixin.js +99 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -74,6 +74,7 @@ import Toggle from './components/toggle';
|
|
74
74
|
import ToggleTip from './components/toggletip';
|
75
75
|
import Tooltip from './components/tooltip';
|
76
76
|
import VirtualizedList from './components/virtualizedlist';
|
77
|
+
import Slider from './components/slider';
|
77
78
|
import type { BadgeType } from './components/badge/badge.types';
|
78
79
|
import type { ButtonColor, ButtonVariant, IconButtonSize, PillButtonSize } from './components/button/button.types';
|
79
80
|
import type { PopoverPlacement } from './components/popover/popover.types';
|
@@ -87,6 +88,6 @@ import type { MenuSectionChangeEvent } from './components/menusection/menusectio
|
|
87
88
|
import { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES } from './components/button/button.constants';
|
88
89
|
import { SKELETON_VARIANTS } from './components/skeleton/skeleton.constants';
|
89
90
|
import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
|
90
|
-
export { Accordion, AccordionButton, AccordionGroup, AlertChip, Animation, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonGroup, ButtonLink, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, LinkButton, Linksimple, List, Listheader, ListItem, Marker, MenuBar, MenuItem, MenuItemCheckbox, MenuItemRadio, MenuPopover, MenuSection, NavMenuItem, OptGroup, Option, Password, Popover, Presence, Progressbar, Progressspinner, Radio, RadioGroup, ScreenreaderAnnouncer, Searchfield, Select, SelectListbox, SideNavigation, Skeleton, Spinner, StaticCheckbox, StaticRadio, StaticToggle, Stepper, StepperConnector, StepperItem, Tab, TabList, Text, Textarea, ThemeProvider, Toast, Toggle, Typewriter, ToggleTip, Tooltip, VirtualizedList, };
|
91
|
+
export { Accordion, AccordionButton, AccordionGroup, AlertChip, Animation, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonGroup, ButtonLink, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, LinkButton, Linksimple, List, Listheader, ListItem, Marker, MenuBar, MenuItem, MenuItemCheckbox, MenuItemRadio, MenuPopover, MenuSection, NavMenuItem, OptGroup, Option, Password, Popover, Presence, Progressbar, Progressspinner, Radio, RadioGroup, ScreenreaderAnnouncer, Searchfield, Select, SelectListbox, SideNavigation, Skeleton, Spinner, StaticCheckbox, StaticRadio, StaticToggle, Stepper, StepperConnector, StepperItem, Tab, TabList, Text, Textarea, ThemeProvider, Toast, Toggle, Typewriter, ToggleTip, Tooltip, VirtualizedList, Slider, };
|
91
92
|
export type { BadgeType, ButtonColor, ButtonVariant, IconButtonSize, MenuPopoverActionEvent, MenuPopoverChangeEvent, MenuSectionChangeEvent, PillButtonSize, PopoverPlacement, SkeletonVariant, SelectChangeEvent, SelectInputEvent, SpinnerSize, SpinnerVariant, TextType, TypewriterType, };
|
92
93
|
export { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, inMemoryCache, PILL_BUTTON_SIZES, SKELETON_VARIANTS, webAPIIconsCache, };
|
package/dist/index.js
CHANGED
@@ -76,11 +76,12 @@ import Toggle from './components/toggle';
|
|
76
76
|
import ToggleTip from './components/toggletip';
|
77
77
|
import Tooltip from './components/tooltip';
|
78
78
|
import VirtualizedList from './components/virtualizedlist';
|
79
|
+
import Slider from './components/slider';
|
79
80
|
// Constants / Utils Imports
|
80
81
|
import { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES, } from './components/button/button.constants';
|
81
82
|
import { SKELETON_VARIANTS } from './components/skeleton/skeleton.constants';
|
82
83
|
import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
|
83
84
|
// Components Exports
|
84
|
-
export { Accordion, AccordionButton, AccordionGroup, AlertChip, Animation, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonGroup, ButtonLink, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, LinkButton, Linksimple, List, Listheader, ListItem, Marker, MenuBar, MenuItem, MenuItemCheckbox, MenuItemRadio, MenuPopover, MenuSection, NavMenuItem, OptGroup, Option, Password, Popover, Presence, Progressbar, Progressspinner, Radio, RadioGroup, ScreenreaderAnnouncer, Searchfield, Select, SelectListbox, SideNavigation, Skeleton, Spinner, StaticCheckbox, StaticRadio, StaticToggle, Stepper, StepperConnector, StepperItem, Tab, TabList, Text, Textarea, ThemeProvider, Toast, Toggle, Typewriter, ToggleTip, Tooltip, VirtualizedList, };
|
85
|
+
export { Accordion, AccordionButton, AccordionGroup, AlertChip, Animation, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonGroup, ButtonLink, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, LinkButton, Linksimple, List, Listheader, ListItem, Marker, MenuBar, MenuItem, MenuItemCheckbox, MenuItemRadio, MenuPopover, MenuSection, NavMenuItem, OptGroup, Option, Password, Popover, Presence, Progressbar, Progressspinner, Radio, RadioGroup, ScreenreaderAnnouncer, Searchfield, Select, SelectListbox, SideNavigation, Skeleton, Spinner, StaticCheckbox, StaticRadio, StaticToggle, Stepper, StepperConnector, StepperItem, Tab, TabList, Text, Textarea, ThemeProvider, Toast, Toggle, Typewriter, ToggleTip, Tooltip, VirtualizedList, Slider, };
|
85
86
|
// Constants / Utils Exports
|
86
87
|
export { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, inMemoryCache, PILL_BUTTON_SIZES, SKELETON_VARIANTS, webAPIIconsCache, };
|
package/dist/react/index.d.ts
CHANGED
@@ -18,15 +18,15 @@ export { default as CardButton } from './cardbutton';
|
|
18
18
|
export { default as CardCheckbox } from './cardcheckbox';
|
19
19
|
export { default as CardRadio } from './cardradio';
|
20
20
|
export { default as Checkbox } from './checkbox';
|
21
|
-
export { default as Chip } from './chip';
|
22
21
|
export { default as Coachmark } from './coachmark';
|
22
|
+
export { default as Chip } from './chip';
|
23
23
|
export { default as Dialog } from './dialog';
|
24
24
|
export { default as Divider } from './divider';
|
25
25
|
export { default as FilterChip } from './filterchip';
|
26
26
|
export { default as FormfieldGroup } from './formfieldgroup';
|
27
|
-
export { default as FormfieldWrapper } from './formfieldwrapper';
|
28
27
|
export { default as Icon } from './icon';
|
29
28
|
export { default as IconProvider } from './iconprovider';
|
29
|
+
export { default as FormfieldWrapper } from './formfieldwrapper';
|
30
30
|
export { default as Input } from './input';
|
31
31
|
export { default as InputChip } from './inputchip';
|
32
32
|
export { default as Link } from './link';
|
@@ -58,6 +58,7 @@ export { default as Select } from './select';
|
|
58
58
|
export { default as Selectlistbox } from './selectlistbox';
|
59
59
|
export { default as SideNavigation } from './sidenavigation';
|
60
60
|
export { default as Skeleton } from './skeleton';
|
61
|
+
export { default as Slider } from './slider';
|
61
62
|
export { default as Spinner } from './spinner';
|
62
63
|
export { default as StaticCheckbox } from './staticcheckbox';
|
63
64
|
export { default as StaticRadio } from './staticradio';
|
package/dist/react/index.js
CHANGED
@@ -18,15 +18,15 @@ export { default as CardButton } from './cardbutton';
|
|
18
18
|
export { default as CardCheckbox } from './cardcheckbox';
|
19
19
|
export { default as CardRadio } from './cardradio';
|
20
20
|
export { default as Checkbox } from './checkbox';
|
21
|
-
export { default as Chip } from './chip';
|
22
21
|
export { default as Coachmark } from './coachmark';
|
22
|
+
export { default as Chip } from './chip';
|
23
23
|
export { default as Dialog } from './dialog';
|
24
24
|
export { default as Divider } from './divider';
|
25
25
|
export { default as FilterChip } from './filterchip';
|
26
26
|
export { default as FormfieldGroup } from './formfieldgroup';
|
27
|
-
export { default as FormfieldWrapper } from './formfieldwrapper';
|
28
27
|
export { default as Icon } from './icon';
|
29
28
|
export { default as IconProvider } from './iconprovider';
|
29
|
+
export { default as FormfieldWrapper } from './formfieldwrapper';
|
30
30
|
export { default as Input } from './input';
|
31
31
|
export { default as InputChip } from './inputchip';
|
32
32
|
export { default as Link } from './link';
|
@@ -58,6 +58,7 @@ export { default as Select } from './select';
|
|
58
58
|
export { default as Selectlistbox } from './selectlistbox';
|
59
59
|
export { default as SideNavigation } from './sidenavigation';
|
60
60
|
export { default as Skeleton } from './skeleton';
|
61
|
+
export { default as Slider } from './slider';
|
61
62
|
export { default as Spinner } from './spinner';
|
62
63
|
export { default as StaticCheckbox } from './staticcheckbox';
|
63
64
|
export { default as StaticRadio } from './staticradio';
|
@@ -0,0 +1,12 @@
|
|
1
|
+
import Component from '../../components/slider';
|
2
|
+
/**
|
3
|
+
* slider component, which ...
|
4
|
+
*
|
5
|
+
* @tagname mdc-slider
|
6
|
+
*
|
7
|
+
* @slot default - This is a default/unnamed slot
|
8
|
+
*
|
9
|
+
* @cssproperty --custom-property-name - Description of the CSS custom property
|
10
|
+
*/
|
11
|
+
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
|
12
|
+
export default reactWrapper;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { createComponent } from '@lit/react';
|
3
|
+
import Component from '../../components/slider';
|
4
|
+
import { TAG_NAME } from '../../components/slider/slider.constants';
|
5
|
+
/**
|
6
|
+
* slider component, which ...
|
7
|
+
*
|
8
|
+
* @tagname mdc-slider
|
9
|
+
*
|
10
|
+
* @slot default - This is a default/unnamed slot
|
11
|
+
*
|
12
|
+
* @cssproperty --custom-property-name - Description of the CSS custom property
|
13
|
+
*/
|
14
|
+
const reactWrapper = createComponent({
|
15
|
+
tagName: TAG_NAME,
|
16
|
+
elementClass: Component,
|
17
|
+
react: React,
|
18
|
+
events: {},
|
19
|
+
displayName: 'Slider',
|
20
|
+
});
|
21
|
+
export default reactWrapper;
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { LitElement } from 'lit';
|
2
|
+
import type { Component } from '../../models';
|
3
|
+
import type { Constructor } from './index.types';
|
4
|
+
export declare abstract class BackdropMixinInterface {
|
5
|
+
abstract zIndex: number;
|
6
|
+
protected backdropElement: HTMLElement | null;
|
7
|
+
protected isBackdropInvisible?: boolean;
|
8
|
+
protected backdropAppendTo?: string;
|
9
|
+
protected createBackdrop(classNamePrefix: string): void;
|
10
|
+
protected removeBackdrop(): void;
|
11
|
+
protected keepElementAboveBackdrop(element?: HTMLElement | null): void;
|
12
|
+
protected moveElementBackAfterBackdropRemoval(element?: HTMLElement | null): void;
|
13
|
+
}
|
14
|
+
export declare const BackdropMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<Component & BackdropMixinInterface> & T;
|
@@ -0,0 +1,99 @@
|
|
1
|
+
export const BackdropMixin = (superClass) => {
|
2
|
+
class Backdrop extends superClass {
|
3
|
+
constructor() {
|
4
|
+
super(...arguments);
|
5
|
+
/**
|
6
|
+
* Set this property to true to make the backdrop invisible.
|
7
|
+
* This is useful for components that do want a backdrop which stops interaction,
|
8
|
+
* but do not want the backdrop to be visible.
|
9
|
+
* @internal
|
10
|
+
*/
|
11
|
+
this.isBackdropInvisible = false;
|
12
|
+
/** @internal */
|
13
|
+
this.backdropElement = null;
|
14
|
+
}
|
15
|
+
/**
|
16
|
+
* Creates a backdrop element with the specified class name prefix.
|
17
|
+
*
|
18
|
+
* @param classNamePrefix - The prefix for the backdrop class name.
|
19
|
+
* @internal
|
20
|
+
*/
|
21
|
+
createBackdrop(classNamePrefix) {
|
22
|
+
const backdrop = document.createElement('div');
|
23
|
+
backdrop.classList.add(`${classNamePrefix}-backdrop`);
|
24
|
+
const styleElement = document.createElement('style');
|
25
|
+
styleElement.textContent = `
|
26
|
+
.${classNamePrefix}-backdrop {
|
27
|
+
position: fixed;
|
28
|
+
top: 0;
|
29
|
+
left: 0;
|
30
|
+
width: 100%;
|
31
|
+
height: 100%;
|
32
|
+
background: ${this.isBackdropInvisible ? `transparent` : `var(--mds-color-theme-common-overlays-secondary-normal)`};
|
33
|
+
z-index: ${this.zIndex - 1};
|
34
|
+
}
|
35
|
+
`;
|
36
|
+
backdrop.appendChild(styleElement);
|
37
|
+
const backdropAppendToElement = document.getElementById(this.backdropAppendTo);
|
38
|
+
const elementToAppendTo = backdropAppendToElement || this.parentElement;
|
39
|
+
elementToAppendTo === null || elementToAppendTo === void 0 ? void 0 : elementToAppendTo.appendChild(backdrop);
|
40
|
+
this.backdropElement = backdrop;
|
41
|
+
}
|
42
|
+
/**
|
43
|
+
* Removes the backdrop element if it exists.
|
44
|
+
* @internal
|
45
|
+
*/
|
46
|
+
removeBackdrop() {
|
47
|
+
if (this.backdropElement) {
|
48
|
+
this.backdropElement.remove();
|
49
|
+
this.backdropElement = null;
|
50
|
+
}
|
51
|
+
}
|
52
|
+
/**
|
53
|
+
* Keeps the specified element above the backdrop by adjusting its z-index and position.
|
54
|
+
*
|
55
|
+
* This method stores the original z-index and position of the element,
|
56
|
+
* and sets the z-index to the component's zIndex value.
|
57
|
+
* If the element's position is not already set to 'fixed' or 'absolute',
|
58
|
+
* it will be set to 'relative'.
|
59
|
+
* @param element - The element to keep above the backdrop.
|
60
|
+
* @internal
|
61
|
+
*/
|
62
|
+
keepElementAboveBackdrop(element) {
|
63
|
+
if (!element) {
|
64
|
+
return;
|
65
|
+
}
|
66
|
+
// Store the original z-index and position of the element
|
67
|
+
this.elementOriginalStyle = {
|
68
|
+
zIndex: element.style.zIndex,
|
69
|
+
position: element.style.position,
|
70
|
+
};
|
71
|
+
// Set the z-index and position to ensure the element is above the backdrop
|
72
|
+
element.style.zIndex = `${this.zIndex}`;
|
73
|
+
// Only set the position to relative if it is not already set to fixed or absolute
|
74
|
+
if (!['fixed', 'absolute'].includes(window.getComputedStyle(element).position)) {
|
75
|
+
element.style.position = 'relative';
|
76
|
+
}
|
77
|
+
}
|
78
|
+
/**
|
79
|
+
* Moves the element back to its original z-index and position after the backdrop is removed.
|
80
|
+
*
|
81
|
+
* This method restores the original z-index and position of the element
|
82
|
+
* that was kept above the backdrop (by using `keepElementAboveBackdrop`).
|
83
|
+
*
|
84
|
+
* @param element - The element which styling should be restored.
|
85
|
+
* @internal
|
86
|
+
*/
|
87
|
+
moveElementBackAfterBackdropRemoval(element) {
|
88
|
+
if (!element || !this.elementOriginalStyle) {
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
// Restore the original z-index and position of the element
|
92
|
+
element.style.zIndex = this.elementOriginalStyle.zIndex;
|
93
|
+
element.style.position = this.elementOriginalStyle.position;
|
94
|
+
// Clear the stored original style
|
95
|
+
this.elementOriginalStyle = undefined;
|
96
|
+
}
|
97
|
+
}
|
98
|
+
return Backdrop;
|
99
|
+
};
|