@momentum-design/components 0.115.0 → 0.116.1
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 +386 -275
- package/dist/browser/index.js.map +4 -4
- package/dist/components/banner/banner.component.d.ts +79 -0
- package/dist/components/banner/banner.component.js +142 -0
- package/dist/components/banner/banner.constants.d.ts +28 -0
- package/dist/components/banner/banner.constants.js +29 -0
- package/dist/components/banner/banner.styles.d.ts +2 -0
- package/dist/components/banner/banner.styles.js +86 -0
- package/dist/components/banner/banner.types.d.ts +4 -0
- package/dist/components/banner/banner.types.js +1 -0
- package/dist/components/banner/banner.utils.d.ts +3 -0
- package/dist/components/banner/banner.utils.js +16 -0
- package/dist/components/banner/index.d.ts +9 -0
- package/dist/components/banner/index.js +6 -0
- package/dist/custom-elements.json +1444 -1284
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/banner/index.d.ts +40 -0
- package/dist/react/banner/index.js +49 -0
- package/dist/react/index.d.ts +3 -2
- package/dist/react/index.js +3 -2
- package/dist/utils/controllers/ElementStore.d.ts +21 -10
- package/dist/utils/controllers/ElementStore.js +9 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
@@ -78,6 +78,7 @@ import VirtualizedList from './components/virtualizedlist';
|
|
78
78
|
import Combobox from './components/combobox';
|
79
79
|
import Slider from './components/slider';
|
80
80
|
import ListBox from './components/listbox';
|
81
|
+
import Banner from './components/banner';
|
81
82
|
import type { BadgeType } from './components/badge/badge.types';
|
82
83
|
import type { ButtonColor, ButtonVariant, IconButtonSize, PillButtonSize } from './components/button/button.types';
|
83
84
|
import type { PopoverPlacement } from './components/popover/popover.types';
|
@@ -93,6 +94,6 @@ import type { VirtualizedListScrollEvent } from './components/virtualizedlist/vi
|
|
93
94
|
import { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES } from './components/button/button.constants';
|
94
95
|
import { SKELETON_VARIANTS } from './components/skeleton/skeleton.constants';
|
95
96
|
import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
|
96
|
-
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, StaticChip, StaticCheckbox, StaticRadio, StaticToggle, Stepper, StepperConnector, StepperItem, Tab, TabList, Text, Textarea, ThemeProvider, Toast, Toggle, Typewriter, ToggleTip, Tooltip, VirtualizedList, Combobox, Slider, ListBox, };
|
97
|
+
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, StaticChip, StaticCheckbox, StaticRadio, StaticToggle, Stepper, StepperConnector, StepperItem, Tab, TabList, Text, Textarea, ThemeProvider, Toast, Toggle, Typewriter, ToggleTip, Tooltip, VirtualizedList, Combobox, Slider, ListBox, Banner };
|
97
98
|
export type { BadgeType, ButtonColor, ButtonVariant, IconButtonSize, MenuPopoverActionEvent, MenuPopoverChangeEvent, MenuSectionChangeEvent, PillButtonSize, PopoverPlacement, SkeletonVariant, SelectChangeEvent, SelectInputEvent, SpinnerSize, SpinnerVariant, TextType, TypewriterType, InputInputEvent, InputChangeEvent, InputFocusEvent, InputBlurEvent, InputClearEvent, VirtualizedListScrollEvent, };
|
98
99
|
export { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, inMemoryCache, PILL_BUTTON_SIZES, SKELETON_VARIANTS, webAPIIconsCache, };
|
package/dist/index.js
CHANGED
@@ -80,11 +80,12 @@ import VirtualizedList from './components/virtualizedlist';
|
|
80
80
|
import Combobox from './components/combobox';
|
81
81
|
import Slider from './components/slider';
|
82
82
|
import ListBox from './components/listbox';
|
83
|
+
import Banner from './components/banner';
|
83
84
|
// Constants / Utils Imports
|
84
85
|
import { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES, } from './components/button/button.constants';
|
85
86
|
import { SKELETON_VARIANTS } from './components/skeleton/skeleton.constants';
|
86
87
|
import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
|
87
88
|
// Components Exports
|
88
|
-
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, StaticChip, StaticCheckbox, StaticRadio, StaticToggle, Stepper, StepperConnector, StepperItem, Tab, TabList, Text, Textarea, ThemeProvider, Toast, Toggle, Typewriter, ToggleTip, Tooltip, VirtualizedList, Combobox, Slider, ListBox, };
|
89
|
+
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, StaticChip, StaticCheckbox, StaticRadio, StaticToggle, Stepper, StepperConnector, StepperItem, Tab, TabList, Text, Textarea, ThemeProvider, Toast, Toggle, Typewriter, ToggleTip, Tooltip, VirtualizedList, Combobox, Slider, ListBox, Banner };
|
89
90
|
// Constants / Utils Exports
|
90
91
|
export { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, inMemoryCache, PILL_BUTTON_SIZES, SKELETON_VARIANTS, webAPIIconsCache, };
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import Component from '../../components/banner';
|
2
|
+
/**
|
3
|
+
* `mdc-banner` is a component that allows applications to communicate important messages to users
|
4
|
+
* and requires user action to dismiss them. It supports different message types with appropriate styling
|
5
|
+
* and icons, and provides flexibility for customization through label, secondary label, icons, and actions.
|
6
|
+
*
|
7
|
+
* They are designed to be noticeable yet non-intrusive, helping users stay informed without interrupting their workflow.
|
8
|
+
*
|
9
|
+
* This component supports both structured content via properties and flexible customization via slots:
|
10
|
+
* - Use the properties (`label`, `secondaryLabel`, `variant`) for standard banner layouts with automatic icon selection.
|
11
|
+
* - Use slots for custom content and complete layout control.
|
12
|
+
* - Combine both approaches for maximum flexibility.
|
13
|
+
* - Create custom orientations and actions using CSS parts and slots.
|
14
|
+
*
|
15
|
+
* @dependency mdc-icon
|
16
|
+
* @dependency mdc-text
|
17
|
+
*
|
18
|
+
* @slot content - Complete content override. When used, it replaces all default banner content including icon, label, secondary label, and actions.
|
19
|
+
* @slot leading-icon - Custom icon content. Overrides the default variant-based icon.
|
20
|
+
* @slot leading-text - Custom text content. Overrides the label and secondaryLabel properties.
|
21
|
+
* @slot trailing-actions - Custom action buttons and controls. Use this for dismiss buttons, reset buttons, or any other actions.
|
22
|
+
*
|
23
|
+
* @tagname mdc-banner
|
24
|
+
*
|
25
|
+
* @csspart leading - The leading section containing the icon and text.
|
26
|
+
* @csspart leading-icon - The icon displayed for variants or custom icon slot.
|
27
|
+
* @csspart leading-text - The leading section containing label and secondary label text.
|
28
|
+
* @csspart trailing - The trailing section containing action buttons and controls.
|
29
|
+
* @csspart leading-label - The label text of the banner.
|
30
|
+
* @csspart leading-secondary-label - The secondary label text of the banner.
|
31
|
+
*
|
32
|
+
* @cssproperty --mdc-banner-background-color - Background color of the banner.
|
33
|
+
* @cssproperty --mdc-banner-border-color - Border color of the banner.
|
34
|
+
* @cssproperty --mdc-banner-icon-color - Color of the icon in the banner.
|
35
|
+
* @cssproperty --mdc-banner-elevation - Elevation/shadow of the banner.
|
36
|
+
* @cssproperty --mdc-banner-padding - Padding inside the banner.
|
37
|
+
* @cssproperty --mdc-banner-gap - Gap between banner elements.
|
38
|
+
*/
|
39
|
+
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
|
40
|
+
export default reactWrapper;
|
@@ -0,0 +1,49 @@
|
|
1
|
+
import * as React from 'react';
|
2
|
+
import { createComponent } from '@lit/react';
|
3
|
+
import Component from '../../components/banner';
|
4
|
+
import { TAG_NAME } from '../../components/banner/banner.constants';
|
5
|
+
/**
|
6
|
+
* `mdc-banner` is a component that allows applications to communicate important messages to users
|
7
|
+
* and requires user action to dismiss them. It supports different message types with appropriate styling
|
8
|
+
* and icons, and provides flexibility for customization through label, secondary label, icons, and actions.
|
9
|
+
*
|
10
|
+
* They are designed to be noticeable yet non-intrusive, helping users stay informed without interrupting their workflow.
|
11
|
+
*
|
12
|
+
* This component supports both structured content via properties and flexible customization via slots:
|
13
|
+
* - Use the properties (`label`, `secondaryLabel`, `variant`) for standard banner layouts with automatic icon selection.
|
14
|
+
* - Use slots for custom content and complete layout control.
|
15
|
+
* - Combine both approaches for maximum flexibility.
|
16
|
+
* - Create custom orientations and actions using CSS parts and slots.
|
17
|
+
*
|
18
|
+
* @dependency mdc-icon
|
19
|
+
* @dependency mdc-text
|
20
|
+
*
|
21
|
+
* @slot content - Complete content override. When used, it replaces all default banner content including icon, label, secondary label, and actions.
|
22
|
+
* @slot leading-icon - Custom icon content. Overrides the default variant-based icon.
|
23
|
+
* @slot leading-text - Custom text content. Overrides the label and secondaryLabel properties.
|
24
|
+
* @slot trailing-actions - Custom action buttons and controls. Use this for dismiss buttons, reset buttons, or any other actions.
|
25
|
+
*
|
26
|
+
* @tagname mdc-banner
|
27
|
+
*
|
28
|
+
* @csspart leading - The leading section containing the icon and text.
|
29
|
+
* @csspart leading-icon - The icon displayed for variants or custom icon slot.
|
30
|
+
* @csspart leading-text - The leading section containing label and secondary label text.
|
31
|
+
* @csspart trailing - The trailing section containing action buttons and controls.
|
32
|
+
* @csspart leading-label - The label text of the banner.
|
33
|
+
* @csspart leading-secondary-label - The secondary label text of the banner.
|
34
|
+
*
|
35
|
+
* @cssproperty --mdc-banner-background-color - Background color of the banner.
|
36
|
+
* @cssproperty --mdc-banner-border-color - Border color of the banner.
|
37
|
+
* @cssproperty --mdc-banner-icon-color - Color of the icon in the banner.
|
38
|
+
* @cssproperty --mdc-banner-elevation - Elevation/shadow of the banner.
|
39
|
+
* @cssproperty --mdc-banner-padding - Padding inside the banner.
|
40
|
+
* @cssproperty --mdc-banner-gap - Gap between banner elements.
|
41
|
+
*/
|
42
|
+
const reactWrapper = createComponent({
|
43
|
+
tagName: TAG_NAME,
|
44
|
+
elementClass: Component,
|
45
|
+
react: React,
|
46
|
+
events: {},
|
47
|
+
displayName: 'Banner',
|
48
|
+
});
|
49
|
+
export default reactWrapper;
|
package/dist/react/index.d.ts
CHANGED
@@ -7,6 +7,7 @@ export { default as Appheader } from './appheader';
|
|
7
7
|
export { default as Avatar } from './avatar';
|
8
8
|
export { default as AvatarButton } from './avatarbutton';
|
9
9
|
export { default as Badge } from './badge';
|
10
|
+
export { default as Banner } from './banner';
|
10
11
|
export { default as Brandvisual } from './brandvisual';
|
11
12
|
export { default as Bullet } from './bullet';
|
12
13
|
export { default as Button } from './button';
|
@@ -55,8 +56,8 @@ export { default as Progressspinner } from './progressspinner';
|
|
55
56
|
export { default as Radio } from './radio';
|
56
57
|
export { default as RadioGroup } from './radiogroup';
|
57
58
|
export { default as ScreenreaderAnnouncer } from './screenreaderannouncer';
|
58
|
-
export { default as Searchfield } from './searchfield';
|
59
59
|
export { default as Select } from './select';
|
60
|
+
export { default as Searchfield } from './searchfield';
|
60
61
|
export { default as Selectlistbox } from './selectlistbox';
|
61
62
|
export { default as SideNavigation } from './sidenavigation';
|
62
63
|
export { default as Skeleton } from './skeleton';
|
@@ -71,11 +72,11 @@ export { default as StepperConnector } from './stepperconnector';
|
|
71
72
|
export { default as StepperItem } from './stepperitem';
|
72
73
|
export { default as Tab } from './tab';
|
73
74
|
export { default as TabList } from './tablist';
|
75
|
+
export { default as Text } from './text';
|
74
76
|
export { default as Textarea } from './textarea';
|
75
77
|
export { default as ThemeProvider } from './themeprovider';
|
76
78
|
export { default as Toast } from './toast';
|
77
79
|
export { default as Toggle } from './toggle';
|
78
|
-
export { default as Text } from './text';
|
79
80
|
export { default as ToggleTip } from './toggletip';
|
80
81
|
export { default as Tooltip } from './tooltip';
|
81
82
|
export { default as Typewriter } from './typewriter';
|
package/dist/react/index.js
CHANGED
@@ -7,6 +7,7 @@ export { default as Appheader } from './appheader';
|
|
7
7
|
export { default as Avatar } from './avatar';
|
8
8
|
export { default as AvatarButton } from './avatarbutton';
|
9
9
|
export { default as Badge } from './badge';
|
10
|
+
export { default as Banner } from './banner';
|
10
11
|
export { default as Brandvisual } from './brandvisual';
|
11
12
|
export { default as Bullet } from './bullet';
|
12
13
|
export { default as Button } from './button';
|
@@ -55,8 +56,8 @@ export { default as Progressspinner } from './progressspinner';
|
|
55
56
|
export { default as Radio } from './radio';
|
56
57
|
export { default as RadioGroup } from './radiogroup';
|
57
58
|
export { default as ScreenreaderAnnouncer } from './screenreaderannouncer';
|
58
|
-
export { default as Searchfield } from './searchfield';
|
59
59
|
export { default as Select } from './select';
|
60
|
+
export { default as Searchfield } from './searchfield';
|
60
61
|
export { default as Selectlistbox } from './selectlistbox';
|
61
62
|
export { default as SideNavigation } from './sidenavigation';
|
62
63
|
export { default as Skeleton } from './skeleton';
|
@@ -71,11 +72,11 @@ export { default as StepperConnector } from './stepperconnector';
|
|
71
72
|
export { default as StepperItem } from './stepperitem';
|
72
73
|
export { default as Tab } from './tab';
|
73
74
|
export { default as TabList } from './tablist';
|
75
|
+
export { default as Text } from './text';
|
74
76
|
export { default as Textarea } from './textarea';
|
75
77
|
export { default as ThemeProvider } from './themeprovider';
|
76
78
|
export { default as Toast } from './toast';
|
77
79
|
export { default as Toggle } from './toggle';
|
78
|
-
export { default as Text } from './text';
|
79
80
|
export { default as ToggleTip } from './toggletip';
|
80
81
|
export { default as Tooltip } from './tooltip';
|
81
82
|
export { default as Typewriter } from './typewriter';
|
@@ -1,11 +1,27 @@
|
|
1
1
|
import { ReactiveController } from 'lit';
|
2
2
|
import type { Component } from '../../models';
|
3
3
|
export type ElementStoreChangeTypes = 'added' | 'removed';
|
4
|
-
interface ElementStoreOptions {
|
4
|
+
interface ElementStoreOptions<TItem extends HTMLElement = HTMLElement> {
|
5
5
|
/**
|
6
|
-
*
|
6
|
+
* Checks if the item is valid.
|
7
|
+
* Invalid items will not be collected or processed.
|
8
|
+
* This method can be overridden by subclasses to define custom validation logic.
|
9
|
+
*
|
10
|
+
* @param item - The item to validate.
|
11
|
+
* @returns - True if the item is valid, false otherwise.
|
7
12
|
*/
|
8
13
|
isValidItem: (item: any) => boolean;
|
14
|
+
/**
|
15
|
+
* Callback function that is called before the store is updated.
|
16
|
+
*
|
17
|
+
* Not called when the store is reset.
|
18
|
+
*
|
19
|
+
* @param item - The item that is being added or removed.
|
20
|
+
* @param changeType - The type of change ('added' or 'removed').
|
21
|
+
* @param index - Index at which the item is added or removed.
|
22
|
+
* @param store - The current state of the store.
|
23
|
+
*/
|
24
|
+
onStoreUpdate?: (item: TItem, changeType: ElementStoreChangeTypes, index: number, store: TItem[]) => void;
|
9
25
|
}
|
10
26
|
/**
|
11
27
|
* ElementStore is a controller that manages a collection of elements.
|
@@ -35,15 +51,10 @@ interface ElementStoreOptions {
|
|
35
51
|
*/
|
36
52
|
export declare class ElementStore<TItem extends HTMLElement> implements ReactiveController {
|
37
53
|
private host;
|
38
|
-
/**
|
39
|
-
* Checks if the item is valid.
|
40
|
-
* Invalid items will not be collected or processed.
|
41
|
-
* This method can be overridden by subclasses to define custom validation logic.
|
42
|
-
*
|
43
|
-
* @param item - The item to validate.
|
44
|
-
* @returns - True if the item is valid, false otherwise.
|
45
|
-
*/
|
54
|
+
/** Checks if the item is valid. */
|
46
55
|
private readonly isValidItem;
|
56
|
+
/** Callback function that is called before the store is updated. */
|
57
|
+
private readonly onStoreUpdate;
|
47
58
|
/** Stored items */
|
48
59
|
private cache;
|
49
60
|
/** Access to stored items */
|
@@ -97,6 +97,7 @@ export class ElementStore {
|
|
97
97
|
this.host = host;
|
98
98
|
host.addController(this);
|
99
99
|
this.isValidItem = (options === null || options === void 0 ? void 0 : options.isValidItem) || defaultIsValidFn;
|
100
|
+
this.onStoreUpdate = options === null || options === void 0 ? void 0 : options.onStoreUpdate;
|
100
101
|
this.host.addEventListener(LIFE_CYCLE_EVENTS.CREATED, this.itemCreationHandler);
|
101
102
|
this.host.addEventListener(LIFE_CYCLE_EVENTS.DESTROYED, this.itemDestroyHandler);
|
102
103
|
}
|
@@ -136,9 +137,13 @@ export class ElementStore {
|
|
136
137
|
* @param index - The index at which to add the item. If `undefined`, the item is added automatically.
|
137
138
|
*/
|
138
139
|
addItem(item, index = undefined) {
|
140
|
+
var _a;
|
139
141
|
const newItem = item;
|
140
142
|
if (this.isValidItem(newItem) && !this.cache.includes(newItem)) {
|
141
143
|
const idx = index === undefined ? this.cache.findIndex(e => isBefore(newItem, e)) : index;
|
144
|
+
if (this.onStoreUpdate) {
|
145
|
+
(_a = this.onStoreUpdate) === null || _a === void 0 ? void 0 : _a.call(this, newItem, 'added', idx === -1 ? this.cache.length : idx, this.cache.slice());
|
146
|
+
}
|
142
147
|
if (idx === -1) {
|
143
148
|
this.cache.push(newItem);
|
144
149
|
}
|
@@ -153,8 +158,12 @@ export class ElementStore {
|
|
153
158
|
* @param item - The item to remove from the cache.
|
154
159
|
*/
|
155
160
|
delete(item) {
|
161
|
+
var _a;
|
156
162
|
const idx = this.cache.indexOf(item);
|
157
163
|
if (idx !== -1) {
|
164
|
+
if (this.onStoreUpdate) {
|
165
|
+
(_a = this.onStoreUpdate) === null || _a === void 0 ? void 0 : _a.call(this, item, 'removed', idx, this.cache.slice());
|
166
|
+
}
|
158
167
|
this.cache.splice(idx, 1);
|
159
168
|
}
|
160
169
|
}
|