@momentum-design/components 0.137.7 → 0.138.0
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 +394 -369
- package/dist/browser/index.js.map +4 -4
- package/dist/components/checkbox/checkbox.component.d.ts +6 -1
- package/dist/components/checkbox/checkbox.component.js +34 -4
- package/dist/components/checkboxtree/checkboxtree.component.d.ts +99 -0
- package/dist/components/checkboxtree/checkboxtree.component.js +213 -0
- package/dist/components/checkboxtree/checkboxtree.constants.d.ts +2 -0
- package/dist/components/checkboxtree/checkboxtree.constants.js +3 -0
- package/dist/components/checkboxtree/checkboxtree.styles.d.ts +2 -0
- package/dist/components/checkboxtree/checkboxtree.styles.js +25 -0
- package/dist/components/checkboxtree/index.d.ts +13 -0
- package/dist/components/checkboxtree/index.js +10 -0
- package/dist/components/listitem/listitem.component.d.ts +1 -1
- package/dist/components/tab/tab.component.d.ts +1 -1
- package/dist/custom-elements.json +759 -9
- package/dist/index.d.ts +2 -1
- package/dist/index.js +2 -1
- package/dist/react/checkboxtree/index.d.ts +50 -0
- package/dist/react/checkboxtree/index.js +40 -0
- package/dist/react/index.d.ts +1 -0
- package/dist/react/index.js +1 -0
- package/dist/utils/mixins/lifecycle/LifeCycleMixin.d.ts +2 -9
- package/dist/utils/mixins/lifecycle/LifeCycleMixin.js +2 -9
- package/dist/utils/mixins/lifecycle/ModifiedEventMixin.d.ts +12 -0
- package/dist/utils/mixins/lifecycle/ModifiedEventMixin.js +15 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -92,6 +92,7 @@ import Buttonsimple from './components/buttonsimple';
|
|
|
92
92
|
import Verticaltablist from './components/verticaltablist';
|
|
93
93
|
import StatusMessage from './components/statusmessage';
|
|
94
94
|
import FocusTrap from './components/focustrap';
|
|
95
|
+
import CheckboxTree from './components/checkboxtree';
|
|
95
96
|
import type { AvatarSize } from './components/avatar/avatar.types';
|
|
96
97
|
import type { BadgeType } from './components/badge/badge.types';
|
|
97
98
|
import type { ColorType as ChipColorType } from './components/staticchip/staticchip.types';
|
|
@@ -122,6 +123,6 @@ import type { TimePickerChangeEvent, TimePickerInputEvent } from './components/t
|
|
|
122
123
|
import type { DatePickerChangeEvent, DatePickerInputEvent } from './components/datepicker/datepicker.types';
|
|
123
124
|
import type { CalendarDateSelectedEvent, CalendarMonthChangedEvent } from './components/calendar/calendar.types';
|
|
124
125
|
import type { ListBoxChangeEvent } from './components/listbox/listbox.types';
|
|
125
|
-
export { Accordion, AccordionButton, AccordionGroup, AlertChip, Animation, AnnouncementDialog, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonGroup, ButtonLink, Calendar, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, ControlTypeProvider, DatePicker, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Illustration, IllustrationProvider, 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, ResponsiveSettingsProvider, ScreenreaderAnnouncer, Searchfield, Searchpopover, Select, SelectListbox, SideNavigation, Skeleton, Spinner, StaticChip, StaticCheckbox, StaticRadio, StaticToggle, Stepper, StepperConnector, StepperItem, Tab, TabList, Text, Textarea, TimePicker, ThemeProvider, Toast, Toggle, Typewriter, ToggleTip, Tooltip, VirtualizedList, Combobox, Slider, ListBox, Banner, Buttonsimple, Verticaltablist, StatusMessage, FocusTrap, };
|
|
126
|
+
export { Accordion, AccordionButton, AccordionGroup, AlertChip, Animation, AnnouncementDialog, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonGroup, ButtonLink, Calendar, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, ControlTypeProvider, DatePicker, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Illustration, IllustrationProvider, 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, ResponsiveSettingsProvider, ScreenreaderAnnouncer, Searchfield, Searchpopover, Select, SelectListbox, SideNavigation, Skeleton, Spinner, StaticChip, StaticCheckbox, StaticRadio, StaticToggle, Stepper, StepperConnector, StepperItem, Tab, TabList, Text, Textarea, TimePicker, ThemeProvider, Toast, Toggle, Typewriter, ToggleTip, Tooltip, VirtualizedList, Combobox, Slider, ListBox, Banner, Buttonsimple, Verticaltablist, StatusMessage, FocusTrap, CheckboxTree, };
|
|
126
127
|
export type { AvatarSize, BadgeType, ChipColorType, ButtonColor, ButtonVariant, IconButtonSize, MenuPopoverActionEvent, MenuPopoverChangeEvent, MenuSectionChangeEvent, PillButtonSize, PopoverPlacement, PresenceType, SkeletonVariant, SelectChangeEvent, SelectInputEvent, SpinnerSize, SpinnerVariant, SliderChangeEvent, StatusMessageSeverity, TextType, TypewriterType, InputInputEvent, InputChangeEvent, InputFocusEvent, InputBlurEvent, InputClearEvent, VirtualizedListScrollEvent, TablistChangeEvent, TextareaInputEvent, TextareaChangeEvent, TextareaFocusEvent, TextareaBlurEvent, TextareaLimitExceededEvent, ToggleOnChangeEvent, CheckboxOnChangeEvent, LinkButtonSize, TimePickerChangeEvent, TimePickerInputEvent, DatePickerChangeEvent, DatePickerInputEvent, CalendarDateSelectedEvent, CalendarMonthChangedEvent, VerticaltablistChangeEvent, ListBoxChangeEvent, };
|
|
127
128
|
export { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, inMemoryCache, PILL_BUTTON_SIZES, SKELETON_VARIANTS, webAPIAssetsCache, };
|
package/dist/index.js
CHANGED
|
@@ -94,11 +94,12 @@ import Buttonsimple from './components/buttonsimple';
|
|
|
94
94
|
import Verticaltablist from './components/verticaltablist';
|
|
95
95
|
import StatusMessage from './components/statusmessage';
|
|
96
96
|
import FocusTrap from './components/focustrap';
|
|
97
|
+
import CheckboxTree from './components/checkboxtree';
|
|
97
98
|
// Constants / Utils Imports
|
|
98
99
|
import { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES, } from './components/button/button.constants';
|
|
99
100
|
import { SKELETON_VARIANTS } from './components/skeleton/skeleton.constants';
|
|
100
101
|
import { inMemoryCache, webAPIAssetsCache } from './utils/assets-cache';
|
|
101
102
|
// Components Exports
|
|
102
|
-
export { Accordion, AccordionButton, AccordionGroup, AlertChip, Animation, AnnouncementDialog, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonGroup, ButtonLink, Calendar, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, ControlTypeProvider, DatePicker, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Illustration, IllustrationProvider, 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, ResponsiveSettingsProvider, ScreenreaderAnnouncer, Searchfield, Searchpopover, Select, SelectListbox, SideNavigation, Skeleton, Spinner, StaticChip, StaticCheckbox, StaticRadio, StaticToggle, Stepper, StepperConnector, StepperItem, Tab, TabList, Text, Textarea, TimePicker, ThemeProvider, Toast, Toggle, Typewriter, ToggleTip, Tooltip, VirtualizedList, Combobox, Slider, ListBox, Banner, Buttonsimple, Verticaltablist, StatusMessage, FocusTrap, };
|
|
103
|
+
export { Accordion, AccordionButton, AccordionGroup, AlertChip, Animation, AnnouncementDialog, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonGroup, ButtonLink, Calendar, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, ControlTypeProvider, DatePicker, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Illustration, IllustrationProvider, 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, ResponsiveSettingsProvider, ScreenreaderAnnouncer, Searchfield, Searchpopover, Select, SelectListbox, SideNavigation, Skeleton, Spinner, StaticChip, StaticCheckbox, StaticRadio, StaticToggle, Stepper, StepperConnector, StepperItem, Tab, TabList, Text, Textarea, TimePicker, ThemeProvider, Toast, Toggle, Typewriter, ToggleTip, Tooltip, VirtualizedList, Combobox, Slider, ListBox, Banner, Buttonsimple, Verticaltablist, StatusMessage, FocusTrap, CheckboxTree, };
|
|
103
104
|
// Constants / Utils Exports
|
|
104
105
|
export { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, inMemoryCache, PILL_BUTTON_SIZES, SKELETON_VARIANTS, webAPIAssetsCache, };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import Component from '../../components/checkboxtree';
|
|
2
|
+
/**
|
|
3
|
+
* The checkbox tree lets people select related options at different levels while parent choices summarize and control
|
|
4
|
+
* their descendants. It supports hierarchical choice sets that would be difficult to understand as one flat group.
|
|
5
|
+
*
|
|
6
|
+
* **When to use**
|
|
7
|
+
*
|
|
8
|
+
* - Use `mdc-checkboxtree` when options belong to categories and people need to select any number of categories or
|
|
9
|
+
* individual descendants.
|
|
10
|
+
* - Use `mdc-checkboxtree` when a parent choice must select or clear every available option in its branch.
|
|
11
|
+
* - Use `mdc-checkboxtree` when mixed parent states help people understand that only part of a category is selected.
|
|
12
|
+
*
|
|
13
|
+
* **When not to use**
|
|
14
|
+
*
|
|
15
|
+
* - Do not use a checkbox tree for a flat list of unrelated options. Use `mdc-formfieldgroup` with direct `mdc-checkbox`
|
|
16
|
+
* children instead.
|
|
17
|
+
* - Do not use a checkbox tree when exactly one option can be selected. Use `mdc-radiogroup` with `mdc-radio` children
|
|
18
|
+
* instead.
|
|
19
|
+
* - Do not use a deeply nested checkbox tree when the hierarchy can be split into smaller steps or filtered lists.
|
|
20
|
+
* Shallower choices are easier to scan and use on small screens.
|
|
21
|
+
*
|
|
22
|
+
* @tagname mdc-checkboxtree
|
|
23
|
+
*
|
|
24
|
+
* @dependency mdc-button
|
|
25
|
+
* @dependency mdc-checkbox
|
|
26
|
+
* @dependency mdc-icon
|
|
27
|
+
* @dependency mdc-statusmessage
|
|
28
|
+
* @dependency mdc-text
|
|
29
|
+
* @dependency mdc-toggletip
|
|
30
|
+
*
|
|
31
|
+
* @slot default - Direct `mdc-checkbox` children and nested `mdc-checkboxtree` descendants. A nested tree belongs to the checkbox immediately before it.
|
|
32
|
+
* @slot label - Slot for the visible group label. If omitted, the `label` property is used.
|
|
33
|
+
* @slot toggletip - Slot for the label's information button and toggletip.
|
|
34
|
+
* @slot help-icon - Slot for the helper or validation icon.
|
|
35
|
+
* @slot help-text - Slot for the helper or validation text.
|
|
36
|
+
*
|
|
37
|
+
* @csspart group-header - Container for the outer tree's label and helper text.
|
|
38
|
+
* @csspart label - The outer tree's label.
|
|
39
|
+
* @csspart label-text - Container for the label, required indicator, and information button.
|
|
40
|
+
* @csspart required-indicator - Required indicator displayed next to the label.
|
|
41
|
+
* @csspart info-icon-btn - Information button displayed next to the label.
|
|
42
|
+
* @csspart label-toggletip - Toggletip associated with the information button.
|
|
43
|
+
* @csspart help-text - Helper or validation text.
|
|
44
|
+
* @csspart helper-icon - Helper or validation icon.
|
|
45
|
+
* @csspart help-text-container - Container for helper or validation content.
|
|
46
|
+
*
|
|
47
|
+
* @cssproperty --mdc-checkboxtree-indent - Inline indentation added by each nested tree.
|
|
48
|
+
*/
|
|
49
|
+
declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {}>;
|
|
50
|
+
export default reactWrapper;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { createComponent } from '@lit/react';
|
|
3
|
+
import Component from '../../components/checkboxtree';
|
|
4
|
+
import { TAG_NAME } from '../../components/checkboxtree/checkboxtree.constants';
|
|
5
|
+
/**
|
|
6
|
+
* @tagname mdc-checkboxtree
|
|
7
|
+
*
|
|
8
|
+
* @dependency mdc-button
|
|
9
|
+
* @dependency mdc-checkbox
|
|
10
|
+
* @dependency mdc-icon
|
|
11
|
+
* @dependency mdc-statusmessage
|
|
12
|
+
* @dependency mdc-text
|
|
13
|
+
* @dependency mdc-toggletip
|
|
14
|
+
*
|
|
15
|
+
* @slot default - Direct `mdc-checkbox` children and nested `mdc-checkboxtree` descendants. A nested tree belongs to the checkbox immediately before it.
|
|
16
|
+
* @slot label - Slot for the visible group label. If omitted, the `label` property is used.
|
|
17
|
+
* @slot toggletip - Slot for the label's information button and toggletip.
|
|
18
|
+
* @slot help-icon - Slot for the helper or validation icon.
|
|
19
|
+
* @slot help-text - Slot for the helper or validation text.
|
|
20
|
+
*
|
|
21
|
+
* @csspart group-header - Container for the outer tree's label and helper text.
|
|
22
|
+
* @csspart label - The outer tree's label.
|
|
23
|
+
* @csspart label-text - Container for the label, required indicator, and information button.
|
|
24
|
+
* @csspart required-indicator - Required indicator displayed next to the label.
|
|
25
|
+
* @csspart info-icon-btn - Information button displayed next to the label.
|
|
26
|
+
* @csspart label-toggletip - Toggletip associated with the information button.
|
|
27
|
+
* @csspart help-text - Helper or validation text.
|
|
28
|
+
* @csspart helper-icon - Helper or validation icon.
|
|
29
|
+
* @csspart help-text-container - Container for helper or validation content.
|
|
30
|
+
*
|
|
31
|
+
* @cssproperty --mdc-checkboxtree-indent - Inline indentation added by each nested tree.
|
|
32
|
+
*/
|
|
33
|
+
const reactWrapper = createComponent({
|
|
34
|
+
tagName: TAG_NAME,
|
|
35
|
+
elementClass: Component,
|
|
36
|
+
react: React,
|
|
37
|
+
events: {},
|
|
38
|
+
displayName: 'CheckboxTree',
|
|
39
|
+
});
|
|
40
|
+
export default reactWrapper;
|
package/dist/react/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { default as CardButton } from './cardbutton';
|
|
|
21
21
|
export { default as CardCheckbox } from './cardcheckbox';
|
|
22
22
|
export { default as CardRadio } from './cardradio';
|
|
23
23
|
export { default as Checkbox } from './checkbox';
|
|
24
|
+
export { default as CheckboxTree } from './checkboxtree';
|
|
24
25
|
export { default as Chip } from './chip';
|
|
25
26
|
export { default as Coachmark } from './coachmark';
|
|
26
27
|
export { default as Combobox } from './combobox';
|
package/dist/react/index.js
CHANGED
|
@@ -21,6 +21,7 @@ export { default as CardButton } from './cardbutton';
|
|
|
21
21
|
export { default as CardCheckbox } from './cardcheckbox';
|
|
22
22
|
export { default as CardRadio } from './cardradio';
|
|
23
23
|
export { default as Checkbox } from './checkbox';
|
|
24
|
+
export { default as CheckboxTree } from './checkboxtree';
|
|
24
25
|
export { default as Chip } from './chip';
|
|
25
26
|
export { default as Coachmark } from './coachmark';
|
|
26
27
|
export { default as Combobox } from './combobox';
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import type { LitElement } from 'lit';
|
|
2
2
|
import type { Constructor } from '../index.types';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Dispatches a 'LifeCycleModifiedEvent' event for the passed changed type.
|
|
6
|
-
*
|
|
7
|
-
* @param change - The type of change that occurred, e.g., 'disabled'.
|
|
8
|
-
*/
|
|
9
|
-
protected dispatchModifiedEvent(change: string): void;
|
|
10
|
-
}
|
|
3
|
+
import { ModifiedEventMixinInterface } from './ModifiedEventMixin';
|
|
11
4
|
/**
|
|
12
5
|
* Mixin to create Lifecycle Manager compatible events for the component.
|
|
13
6
|
*
|
|
@@ -30,4 +23,4 @@ export declare class LifeCycleMixinInterface {
|
|
|
30
23
|
* }
|
|
31
24
|
* ```
|
|
32
25
|
*/
|
|
33
|
-
export declare const LifeCycleMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<
|
|
26
|
+
export declare const LifeCycleMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<ModifiedEventMixinInterface> & T;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LIFE_CYCLE_EVENTS } from './lifecycle.contants';
|
|
2
|
+
import { ModifiedEventMixin } from './ModifiedEventMixin';
|
|
2
3
|
/**
|
|
3
4
|
* Mixin to create Lifecycle Manager compatible events for the component.
|
|
4
5
|
*
|
|
@@ -22,7 +23,7 @@ import { LIFE_CYCLE_EVENTS } from './lifecycle.contants';
|
|
|
22
23
|
* ```
|
|
23
24
|
*/
|
|
24
25
|
export const LifeCycleMixin = (superClass) => {
|
|
25
|
-
class InnerMixinClass extends superClass {
|
|
26
|
+
class InnerMixinClass extends ModifiedEventMixin(superClass) {
|
|
26
27
|
connectedCallback() {
|
|
27
28
|
super.connectedCallback();
|
|
28
29
|
this.dispatchEvent(new CustomEvent(LIFE_CYCLE_EVENTS.CREATED, { bubbles: true, composed: true, detail: { lifecycle: true } }));
|
|
@@ -39,14 +40,6 @@ export const LifeCycleMixin = (superClass) => {
|
|
|
39
40
|
super.disconnectedCallback();
|
|
40
41
|
this.dispatchEvent(new CustomEvent(LIFE_CYCLE_EVENTS.DESTROYED, { bubbles: true, composed: true, detail: { lifecycle: true } }));
|
|
41
42
|
}
|
|
42
|
-
/** @see LifeCycleMixinInterface.dispatchModifiedEvent */
|
|
43
|
-
dispatchModifiedEvent(change) {
|
|
44
|
-
this.dispatchEvent(new CustomEvent(LIFE_CYCLE_EVENTS.MODIFIED, {
|
|
45
|
-
detail: { change, lifecycle: true },
|
|
46
|
-
bubbles: true,
|
|
47
|
-
composed: true,
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
43
|
}
|
|
51
44
|
// Cast return type to your mixin's interface intersected with the superClass type
|
|
52
45
|
return InnerMixinClass;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { LitElement } from 'lit';
|
|
2
|
+
import type { Constructor } from '../index.types';
|
|
3
|
+
export declare class ModifiedEventMixinInterface {
|
|
4
|
+
/**
|
|
5
|
+
* Dispatches a lifecycle `modified` event for the passed change type.
|
|
6
|
+
*
|
|
7
|
+
* @param change - The type of change that occurred.
|
|
8
|
+
*/
|
|
9
|
+
protected dispatchModifiedEvent(change: string): void;
|
|
10
|
+
}
|
|
11
|
+
/** Adds support for dispatching lifecycle `modified` events without emitting connection events. */
|
|
12
|
+
export declare const ModifiedEventMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<ModifiedEventMixinInterface> & T;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LIFE_CYCLE_EVENTS } from './lifecycle.contants';
|
|
2
|
+
/** Adds support for dispatching lifecycle `modified` events without emitting connection events. */
|
|
3
|
+
export const ModifiedEventMixin = (superClass) => {
|
|
4
|
+
class InnerMixinClass extends superClass {
|
|
5
|
+
/** @see ModifiedEventMixinInterface.dispatchModifiedEvent */
|
|
6
|
+
dispatchModifiedEvent(change) {
|
|
7
|
+
this.dispatchEvent(new CustomEvent(LIFE_CYCLE_EVENTS.MODIFIED, {
|
|
8
|
+
detail: { change, lifecycle: true },
|
|
9
|
+
bubbles: true,
|
|
10
|
+
composed: true,
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return InnerMixinClass;
|
|
15
|
+
};
|