@momentum-design/components 0.66.3 → 0.67.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.
Files changed (53) hide show
  1. package/dist/browser/index.js +456 -238
  2. package/dist/browser/index.js.map +4 -4
  3. package/dist/components/card/card.component.d.ts +4 -35
  4. package/dist/components/card/card.component.js +9 -79
  5. package/dist/components/dialog/dialog.component.d.ts +150 -0
  6. package/dist/components/dialog/dialog.component.js +340 -0
  7. package/dist/components/dialog/dialog.constants.d.ts +18 -0
  8. package/dist/components/dialog/dialog.constants.js +19 -0
  9. package/dist/components/dialog/dialog.events.d.ts +34 -0
  10. package/dist/components/dialog/dialog.events.js +47 -0
  11. package/dist/components/dialog/dialog.styles.d.ts +2 -0
  12. package/dist/components/dialog/dialog.styles.js +108 -0
  13. package/dist/components/dialog/dialog.types.d.ts +12 -0
  14. package/dist/components/dialog/dialog.types.js +1 -0
  15. package/dist/components/dialog/dialog.utils.d.ts +7 -0
  16. package/dist/components/dialog/dialog.utils.js +33 -0
  17. package/dist/components/dialog/index.d.ts +9 -0
  18. package/dist/components/dialog/index.js +6 -0
  19. package/dist/components/menuitemcheckbox/index.d.ts +12 -0
  20. package/dist/components/menuitemcheckbox/index.js +9 -0
  21. package/dist/components/menuitemcheckbox/menuitemcheckbox.component.d.ts +54 -0
  22. package/dist/components/menuitemcheckbox/menuitemcheckbox.component.js +137 -0
  23. package/dist/components/menuitemcheckbox/menuitemcheckbox.constants.d.ts +15 -0
  24. package/dist/components/menuitemcheckbox/menuitemcheckbox.constants.js +16 -0
  25. package/dist/components/menuitemcheckbox/menuitemcheckbox.styles.d.ts +2 -0
  26. package/dist/components/menuitemcheckbox/menuitemcheckbox.styles.js +13 -0
  27. package/dist/components/menuitemcheckbox/menuitemcheckbox.types.d.ts +10 -0
  28. package/dist/components/menuitemcheckbox/menuitemcheckbox.types.js +1 -0
  29. package/dist/components/menuitemradio/index.d.ts +10 -0
  30. package/dist/components/menuitemradio/index.js +7 -0
  31. package/dist/components/menuitemradio/menuitemradio.component.d.ts +34 -0
  32. package/dist/components/menuitemradio/menuitemradio.component.js +70 -0
  33. package/dist/components/menuitemradio/menuitemradio.constants.d.ts +6 -0
  34. package/dist/components/menuitemradio/menuitemradio.constants.js +7 -0
  35. package/dist/components/menuitemradio/menuitemradio.types.d.ts +9 -0
  36. package/dist/components/menuitemradio/menuitemradio.types.js +1 -0
  37. package/dist/components/popover/popover.styles.js +5 -0
  38. package/dist/components/toggletip/toggletip.styles.js +8 -0
  39. package/dist/custom-elements.json +5152 -2804
  40. package/dist/index.d.ts +6 -3
  41. package/dist/index.js +6 -3
  42. package/dist/react/dialog/index.d.ts +51 -0
  43. package/dist/react/dialog/index.js +59 -0
  44. package/dist/react/index.d.ts +3 -0
  45. package/dist/react/index.js +3 -0
  46. package/dist/react/menuitemcheckbox/index.d.ts +42 -0
  47. package/dist/react/menuitemcheckbox/index.js +50 -0
  48. package/dist/react/menuitemradio/index.d.ts +30 -0
  49. package/dist/react/menuitemradio/index.js +38 -0
  50. package/dist/utils/mixins/CardAndDialogFooterMixin.d.ts +11 -0
  51. package/dist/utils/mixins/CardAndDialogFooterMixin.js +102 -0
  52. package/dist/utils/mixins/FocusTrapMixin.js +4 -5
  53. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -14,6 +14,7 @@ import CardRadio from './components/cardradio';
14
14
  import Checkbox from './components/checkbox';
15
15
  import Chip from './components/chip';
16
16
  import Coachmark from './components/coachmark';
17
+ import Dialog from './components/dialog';
17
18
  import Divider from './components/divider';
18
19
  import FilterChip from './components/filterchip';
19
20
  import FormfieldGroup from './components/formfieldgroup';
@@ -26,6 +27,7 @@ import Linksimple from './components/linksimple';
26
27
  import List from './components/list';
27
28
  import ListItem from './components/listitem';
28
29
  import Marker from './components/marker';
30
+ import MenuItem from './components/menuitem';
29
31
  import OptGroup from './components/optgroup';
30
32
  import Option from './components/option';
31
33
  import Popover from './components/popover';
@@ -47,10 +49,11 @@ import Text from './components/text';
47
49
  import Textarea from './components/textarea';
48
50
  import ThemeProvider from './components/themeprovider';
49
51
  import Toggle from './components/toggle';
50
- import Tooltip from './components/tooltip';
51
52
  import ToggleTip from './components/toggletip';
53
+ import Tooltip from './components/tooltip';
52
54
  import VirtualizedList from './components/virtualizedlist';
53
- import MenuItem from './components/menuitem';
55
+ import MenuItemRadio from './components/menuitemradio';
56
+ import MenuItemCheckbox from './components/menuitemcheckbox';
54
57
  import type { BadgeType } from './components/badge/badge.types';
55
58
  import type { ButtonColor, ButtonVariant, IconButtonSize, PillButtonSize } from './components/button/button.types';
56
59
  import type { PopoverPlacement } from './components/popover/popover.types';
@@ -58,6 +61,6 @@ import type { SpinnerSize, SpinnerVariant } from './components/spinner/spinner.t
58
61
  import type { TextType } from './components/text/text.types';
59
62
  import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
60
63
  import { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES } from './components/button/button.constants';
61
- export { AlertChip, Avatar, AvatarButton, Badge, Bullet, Button, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, List, ListItem, Marker, Popover, Presence, Radio, RadioGroup, Spinner, Tab, Text, ThemeProvider, Toggle, VirtualizedList, Option, OptGroup, Progressbar, ScreenreaderAnnouncer, StaticCheckbox, StaticRadio, StaticToggle, Textarea, ToggleTip, Tooltip, Searchfield, Brandvisual, Appheader, Select, TabList, Progressspinner, ButtonLink, Linksimple, MenuItem, };
64
+ export { AlertChip, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonLink, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, Linksimple, List, ListItem, Marker, MenuItem, OptGroup, Option, Popover, Presence, Progressbar, Progressspinner, Radio, RadioGroup, ScreenreaderAnnouncer, Searchfield, Select, Spinner, Tab, TabList, Text, Textarea, ThemeProvider, Toggle, VirtualizedList, StaticCheckbox, StaticRadio, StaticToggle, ToggleTip, Tooltip, MenuItemRadio, MenuItemCheckbox, };
62
65
  export type { TextType, SpinnerSize, SpinnerVariant, PopoverPlacement, BadgeType, IconButtonSize, PillButtonSize, ButtonVariant, ButtonColor, };
63
66
  export { inMemoryCache, webAPIIconsCache, BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES };
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ import CardRadio from './components/cardradio';
15
15
  import Checkbox from './components/checkbox';
16
16
  import Chip from './components/chip';
17
17
  import Coachmark from './components/coachmark';
18
+ import Dialog from './components/dialog';
18
19
  import Divider from './components/divider';
19
20
  import FilterChip from './components/filterchip';
20
21
  import FormfieldGroup from './components/formfieldgroup';
@@ -27,6 +28,7 @@ import Linksimple from './components/linksimple';
27
28
  import List from './components/list';
28
29
  import ListItem from './components/listitem';
29
30
  import Marker from './components/marker';
31
+ import MenuItem from './components/menuitem';
30
32
  import OptGroup from './components/optgroup';
31
33
  import Option from './components/option';
32
34
  import Popover from './components/popover';
@@ -48,14 +50,15 @@ import Text from './components/text';
48
50
  import Textarea from './components/textarea';
49
51
  import ThemeProvider from './components/themeprovider';
50
52
  import Toggle from './components/toggle';
51
- import Tooltip from './components/tooltip';
52
53
  import ToggleTip from './components/toggletip';
54
+ import Tooltip from './components/tooltip';
53
55
  import VirtualizedList from './components/virtualizedlist';
54
- import MenuItem from './components/menuitem';
56
+ import MenuItemRadio from './components/menuitemradio';
57
+ import MenuItemCheckbox from './components/menuitemcheckbox';
55
58
  import { inMemoryCache, webAPIIconsCache } from './utils/icon-cache';
56
59
  // Constants / Utils Imports
57
60
  import { BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES, } from './components/button/button.constants';
58
61
  // Components Exports
59
- export { AlertChip, Avatar, AvatarButton, Badge, Bullet, Button, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, List, ListItem, Marker, Popover, Presence, Radio, RadioGroup, Spinner, Tab, Text, ThemeProvider, Toggle, VirtualizedList, Option, OptGroup, Progressbar, ScreenreaderAnnouncer, StaticCheckbox, StaticRadio, StaticToggle, Textarea, ToggleTip, Tooltip, Searchfield, Brandvisual, Appheader, Select, TabList, Progressspinner, ButtonLink, Linksimple, MenuItem, };
62
+ export { AlertChip, Appheader, Avatar, AvatarButton, Badge, Brandvisual, Bullet, Button, ButtonLink, Card, CardButton, CardCheckbox, CardRadio, Checkbox, Chip, Coachmark, Dialog, Divider, FilterChip, FormfieldGroup, Icon, IconProvider, Input, InputChip, Link, Linksimple, List, ListItem, Marker, MenuItem, OptGroup, Option, Popover, Presence, Progressbar, Progressspinner, Radio, RadioGroup, ScreenreaderAnnouncer, Searchfield, Select, Spinner, Tab, TabList, Text, Textarea, ThemeProvider, Toggle, VirtualizedList, StaticCheckbox, StaticRadio, StaticToggle, ToggleTip, Tooltip, MenuItemRadio, MenuItemCheckbox, };
60
63
  // Constants / Utils Exports
61
64
  export { inMemoryCache, webAPIIconsCache, BUTTON_COLORS, BUTTON_VARIANTS, ICON_BUTTON_SIZES, PILL_BUTTON_SIZES };
@@ -0,0 +1,51 @@
1
+ import { type EventName } from '@lit/react';
2
+ import Component from '../../components/dialog';
3
+ /**
4
+ * Dialog component is a modal dialog that can be used to display information or prompt the user for input.
5
+ * It can be used to create custom dialogs where content for the body and footer actions is provided by the consumer.
6
+ * The dialog is available in three sizes: small, medium, and large. It may also receive custom styling/sizing.
7
+ * The dialog interrupts the user and will block interaction with the rest of the application until it is closed.
8
+ *
9
+ * Dialog component have 2 variants: default and promotional.
10
+ *
11
+ * **Accessibility notes for consuming (have to be explicitly set when you consume the component)**
12
+ *
13
+ * - The dialog should have an aria-label or aria-labelledby attribute to provide a label for screen readers.
14
+ * - Use aria-labelledby to reference the ID of the element that labels the dialog when there is no visible title.
15
+ *
16
+ * **Note: Programmatic show/hide requires the ? prefix on the visible attribute**
17
+ * - Use `?visible=true/false` as an attribute instead of `visible=true/false`
18
+ * - Reference docs for more info: https://lit.dev/docs/templates/expressions/#boolean-attribute-expressions
19
+ *
20
+ * @dependency mdc-button
21
+ * @dependency mdc-text
22
+ *
23
+ * @tagname mdc-dialog
24
+ *
25
+ * @event shown - (React: onShown) Dispatched when the dialog is shown
26
+ * @event hidden - (React: onHidden) Dispatched when the dialog is hidden
27
+ * @event created - (React: onCreated) Dispatched when the dialog is created (added to the DOM)
28
+ * @event destroyed - (React: onDestroyed) Dispatched when the dialog is destroyed (removed from the DOM)
29
+ *
30
+ * @cssproperty --mdc-dialog-primary-background-color - primary background color of the dialog
31
+ * @cssproperty --mdc-dialog-border-color - border color of the dialog
32
+ * @cssproperty --mdc-dialog-header-text-color - text color of the header/title of the dialog
33
+ * @cssproperty --mdc-dialog-description-text-color - text color of the below header description of the dialog
34
+ * @cssproperty --mdc-dialog-elevation-3 - elevation of the dialog
35
+ * @cssproperty --mdc-dialog-width - width of the dialog
36
+ *
37
+ * @slot dialog-body - Slot for the dialog body content
38
+ * @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
39
+ * @slot footer-button-secondary - This slot is for passing secondary variant of `mdc-button` component
40
+ * within the footer section.
41
+ * @slot footer-button-primary - This slot is for passing primary variant of
42
+ * `mdc-button` component within the footer section.
43
+ *
44
+ */
45
+ declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {
46
+ onShown: EventName<Event>;
47
+ onHidden: EventName<Event>;
48
+ onCreated: EventName<Event>;
49
+ onDestroyed: EventName<Event>;
50
+ }>;
51
+ export default reactWrapper;
@@ -0,0 +1,59 @@
1
+ import * as React from 'react';
2
+ import { createComponent } from '@lit/react';
3
+ import Component from '../../components/dialog';
4
+ import { TAG_NAME } from '../../components/dialog/dialog.constants';
5
+ /**
6
+ * Dialog component is a modal dialog that can be used to display information or prompt the user for input.
7
+ * It can be used to create custom dialogs where content for the body and footer actions is provided by the consumer.
8
+ * The dialog is available in three sizes: small, medium, and large. It may also receive custom styling/sizing.
9
+ * The dialog interrupts the user and will block interaction with the rest of the application until it is closed.
10
+ *
11
+ * Dialog component have 2 variants: default and promotional.
12
+ *
13
+ * **Accessibility notes for consuming (have to be explicitly set when you consume the component)**
14
+ *
15
+ * - The dialog should have an aria-label or aria-labelledby attribute to provide a label for screen readers.
16
+ * - Use aria-labelledby to reference the ID of the element that labels the dialog when there is no visible title.
17
+ *
18
+ * **Note: Programmatic show/hide requires the ? prefix on the visible attribute**
19
+ * - Use `?visible=true/false` as an attribute instead of `visible=true/false`
20
+ * - Reference docs for more info: https://lit.dev/docs/templates/expressions/#boolean-attribute-expressions
21
+ *
22
+ * @dependency mdc-button
23
+ * @dependency mdc-text
24
+ *
25
+ * @tagname mdc-dialog
26
+ *
27
+ * @event shown - (React: onShown) Dispatched when the dialog is shown
28
+ * @event hidden - (React: onHidden) Dispatched when the dialog is hidden
29
+ * @event created - (React: onCreated) Dispatched when the dialog is created (added to the DOM)
30
+ * @event destroyed - (React: onDestroyed) Dispatched when the dialog is destroyed (removed from the DOM)
31
+ *
32
+ * @cssproperty --mdc-dialog-primary-background-color - primary background color of the dialog
33
+ * @cssproperty --mdc-dialog-border-color - border color of the dialog
34
+ * @cssproperty --mdc-dialog-header-text-color - text color of the header/title of the dialog
35
+ * @cssproperty --mdc-dialog-description-text-color - text color of the below header description of the dialog
36
+ * @cssproperty --mdc-dialog-elevation-3 - elevation of the dialog
37
+ * @cssproperty --mdc-dialog-width - width of the dialog
38
+ *
39
+ * @slot dialog-body - Slot for the dialog body content
40
+ * @slot footer-link - This slot is for passing `mdc-link` component within the footer section.
41
+ * @slot footer-button-secondary - This slot is for passing secondary variant of `mdc-button` component
42
+ * within the footer section.
43
+ * @slot footer-button-primary - This slot is for passing primary variant of
44
+ * `mdc-button` component within the footer section.
45
+ *
46
+ */
47
+ const reactWrapper = createComponent({
48
+ tagName: TAG_NAME,
49
+ elementClass: Component,
50
+ react: React,
51
+ events: {
52
+ onShown: 'shown',
53
+ onHidden: 'hidden',
54
+ onCreated: 'created',
55
+ onDestroyed: 'destroyed',
56
+ },
57
+ displayName: 'Dialog',
58
+ });
59
+ export default reactWrapper;
@@ -15,6 +15,7 @@ export { default as CardRadio } from './cardradio';
15
15
  export { default as Checkbox } from './checkbox';
16
16
  export { default as Chip } from './chip';
17
17
  export { default as Coachmark } from './coachmark';
18
+ export { default as Dialog } from './dialog';
18
19
  export { default as Divider } from './divider';
19
20
  export { default as FilterChip } from './filterchip';
20
21
  export { default as FormfieldGroup } from './formfieldgroup';
@@ -29,6 +30,8 @@ export { default as List } from './list';
29
30
  export { default as ListItem } from './listitem';
30
31
  export { default as Marker } from './marker';
31
32
  export { default as MenuItem } from './menuitem';
33
+ export { default as MenuItemCheckbox } from './menuitemcheckbox';
34
+ export { default as MenuItemRadio } from './menuitemradio';
32
35
  export { default as OptGroup } from './optgroup';
33
36
  export { default as Option } from './option';
34
37
  export { default as Popover } from './popover';
@@ -15,6 +15,7 @@ export { default as CardRadio } from './cardradio';
15
15
  export { default as Checkbox } from './checkbox';
16
16
  export { default as Chip } from './chip';
17
17
  export { default as Coachmark } from './coachmark';
18
+ export { default as Dialog } from './dialog';
18
19
  export { default as Divider } from './divider';
19
20
  export { default as FilterChip } from './filterchip';
20
21
  export { default as FormfieldGroup } from './formfieldgroup';
@@ -29,6 +30,8 @@ export { default as List } from './list';
29
30
  export { default as ListItem } from './listitem';
30
31
  export { default as Marker } from './marker';
31
32
  export { default as MenuItem } from './menuitem';
33
+ export { default as MenuItemCheckbox } from './menuitemcheckbox';
34
+ export { default as MenuItemRadio } from './menuitemradio';
32
35
  export { default as OptGroup } from './optgroup';
33
36
  export { default as Option } from './option';
34
37
  export { default as Popover } from './popover';
@@ -0,0 +1,42 @@
1
+ import { type EventName } from '@lit/react';
2
+ import Component from '../../components/menuitemcheckbox';
3
+ /**
4
+ * A menuitemcheckbox component is a checkable menuitem.
5
+ * There should be no focusable descendants inside this menuitemcheckbox component.
6
+ *
7
+ * The `aria-checked` attribute indicates whether the menuitemcheckbox is checked or not.
8
+ *
9
+ * The `indicator` attribute is used to differentiate between <b>checkbox</b>, <b>checkmark</b> and <b>toggle</b>.
10
+ * By default the `indicator` is set to <b>checkbox</b>.<br/>
11
+ *
12
+ * The checkbox will always be positioned on the leading side of the menuitem label and
13
+ * the toggle and checkmark will always be positioned on the trailing side.
14
+ *
15
+ * The checkbox will have the possible states of `true` or `false`.
16
+ * If the indicator is set to <b>checkmark</b> and if the `aria-checked` attribute is set to `true`,
17
+ * then the checkmark will be displayed. if not, then no indicator will be displayed.
18
+ *
19
+ * If you want only one item in a group to be checked, consider using menuitemradio component.
20
+ *
21
+ * If a menuitemcheckbox is disabled, then the `aria-disabled` attribute is set to `true`.
22
+ *
23
+ * @dependency mdc-staticcheckbox
24
+ * @dependency mdc-statictoggle
25
+ * @dependency mdc-icon
26
+ *
27
+ * @tagname mdc-menuitemcheckbox
28
+ *
29
+ * @cssproperty --mdc-checkmark-indicator-color - Allows customization of the checkmark indicator color
30
+ *
31
+ * @event change - (React: onChange) This event is dispatched when the menuitemcheckbox changes.
32
+ * @event click - (React: onClick) This event is dispatched when the menuitemcheckbox is clicked.
33
+ * @event focus - (React: onFocus) This event is dispatched when the menuitemcheckbox receives focus.
34
+ */
35
+ declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {
36
+ onChange: EventName<Event>;
37
+ onClick: EventName<MouseEvent>;
38
+ onFocus: EventName<FocusEvent>;
39
+ onKeyDown: EventName<KeyboardEvent>;
40
+ onKeyUp: EventName<KeyboardEvent>;
41
+ }>;
42
+ export default reactWrapper;
@@ -0,0 +1,50 @@
1
+ import * as React from 'react';
2
+ import { createComponent } from '@lit/react';
3
+ import Component from '../../components/menuitemcheckbox';
4
+ import { TAG_NAME } from '../../components/menuitemcheckbox/menuitemcheckbox.constants';
5
+ /**
6
+ * A menuitemcheckbox component is a checkable menuitem.
7
+ * There should be no focusable descendants inside this menuitemcheckbox component.
8
+ *
9
+ * The `aria-checked` attribute indicates whether the menuitemcheckbox is checked or not.
10
+ *
11
+ * The `indicator` attribute is used to differentiate between <b>checkbox</b>, <b>checkmark</b> and <b>toggle</b>.
12
+ * By default the `indicator` is set to <b>checkbox</b>.<br/>
13
+ *
14
+ * The checkbox will always be positioned on the leading side of the menuitem label and
15
+ * the toggle and checkmark will always be positioned on the trailing side.
16
+ *
17
+ * The checkbox will have the possible states of `true` or `false`.
18
+ * If the indicator is set to <b>checkmark</b> and if the `aria-checked` attribute is set to `true`,
19
+ * then the checkmark will be displayed. if not, then no indicator will be displayed.
20
+ *
21
+ * If you want only one item in a group to be checked, consider using menuitemradio component.
22
+ *
23
+ * If a menuitemcheckbox is disabled, then the `aria-disabled` attribute is set to `true`.
24
+ *
25
+ * @dependency mdc-staticcheckbox
26
+ * @dependency mdc-statictoggle
27
+ * @dependency mdc-icon
28
+ *
29
+ * @tagname mdc-menuitemcheckbox
30
+ *
31
+ * @cssproperty --mdc-checkmark-indicator-color - Allows customization of the checkmark indicator color
32
+ *
33
+ * @event change - (React: onChange) This event is dispatched when the menuitemcheckbox changes.
34
+ * @event click - (React: onClick) This event is dispatched when the menuitemcheckbox is clicked.
35
+ * @event focus - (React: onFocus) This event is dispatched when the menuitemcheckbox receives focus.
36
+ */
37
+ const reactWrapper = createComponent({
38
+ tagName: TAG_NAME,
39
+ elementClass: Component,
40
+ react: React,
41
+ events: {
42
+ onChange: 'change',
43
+ onClick: 'click',
44
+ onFocus: 'focus',
45
+ onKeyDown: 'keydown',
46
+ onKeyUp: 'keyup',
47
+ },
48
+ displayName: 'MenuItemCheckbox',
49
+ });
50
+ export default reactWrapper;
@@ -0,0 +1,30 @@
1
+ import { type EventName } from '@lit/react';
2
+ import Component from '../../components/menuitemradio';
3
+ /**
4
+ * A menuitemradio component is a checkable menuitem that is used in a menu.
5
+ * A menuitemradio should be checked only one at a time. <br/>
6
+ * There should be no focusable descendants inside this menuitemradio component.
7
+ *
8
+ * The `aria-checked` menuitemradio attribute is used to indicate that the menuitemradio is checked or not.
9
+ *
10
+ * If you want more than one item in a group to be checked, consider using menuitemcheckbox component.
11
+ *
12
+ * If a menuitemradio is disabled, then the `aria-disabled` attribute is set to `true`.
13
+ *
14
+ * @dependency mdc-staticradio
15
+ * @dependency mdc-text
16
+ *
17
+ * @tagname mdc-menuitemradio
18
+ *
19
+ * @event change - (React: onChange) This event is dispatched when the menuitemradio changes.
20
+ * @event click - (React: onClick) This event is dispatched when the menuitemradio is clicked.
21
+ * @event focus - (React: onFocus) This event is dispatched when the menuitemradio receives focus.
22
+ */
23
+ declare const reactWrapper: import("@lit/react").ReactWebComponent<Component, {
24
+ onChange: EventName<Event>;
25
+ onClick: EventName<MouseEvent>;
26
+ onFocus: EventName<FocusEvent>;
27
+ onKeyDown: EventName<KeyboardEvent>;
28
+ onKeyUp: EventName<KeyboardEvent>;
29
+ }>;
30
+ export default reactWrapper;
@@ -0,0 +1,38 @@
1
+ import * as React from 'react';
2
+ import { createComponent } from '@lit/react';
3
+ import Component from '../../components/menuitemradio';
4
+ import { TAG_NAME } from '../../components/menuitemradio/menuitemradio.constants';
5
+ /**
6
+ * A menuitemradio component is a checkable menuitem that is used in a menu.
7
+ * A menuitemradio should be checked only one at a time. <br/>
8
+ * There should be no focusable descendants inside this menuitemradio component.
9
+ *
10
+ * The `aria-checked` menuitemradio attribute is used to indicate that the menuitemradio is checked or not.
11
+ *
12
+ * If you want more than one item in a group to be checked, consider using menuitemcheckbox component.
13
+ *
14
+ * If a menuitemradio is disabled, then the `aria-disabled` attribute is set to `true`.
15
+ *
16
+ * @dependency mdc-staticradio
17
+ * @dependency mdc-text
18
+ *
19
+ * @tagname mdc-menuitemradio
20
+ *
21
+ * @event change - (React: onChange) This event is dispatched when the menuitemradio changes.
22
+ * @event click - (React: onClick) This event is dispatched when the menuitemradio is clicked.
23
+ * @event focus - (React: onFocus) This event is dispatched when the menuitemradio receives focus.
24
+ */
25
+ const reactWrapper = createComponent({
26
+ tagName: TAG_NAME,
27
+ elementClass: Component,
28
+ react: React,
29
+ events: {
30
+ onChange: 'change',
31
+ onClick: 'click',
32
+ onFocus: 'focus',
33
+ onKeyDown: 'keydown',
34
+ onKeyUp: 'keyup',
35
+ },
36
+ displayName: 'MenuItemRadio',
37
+ });
38
+ export default reactWrapper;
@@ -0,0 +1,11 @@
1
+ import { LitElement, TemplateResult } from 'lit';
2
+ import type { Constructor } from './index.types';
3
+ export declare class CardAndDialogFooterMixinInterface {
4
+ footerLink?: Array<HTMLElement>;
5
+ footerButtonPrimary?: Array<HTMLElement>;
6
+ footerButtonSecondary?: Array<HTMLElement>;
7
+ protected updateFooterButtonColors(variant: string): void;
8
+ protected handleFooterSlot(tagname: string, variant?: string): void;
9
+ protected renderFooter(): TemplateResult;
10
+ }
11
+ export declare const CardAndDialogFooterMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<CardAndDialogFooterMixinInterface> & T;
@@ -0,0 +1,102 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ /* eslint-disable max-classes-per-file */
11
+ import { html } from 'lit';
12
+ import { queryAssignedElements } from 'lit/decorators.js';
13
+ import { DEFAULTS, VARIANTS } from '../../components/card/card.constants';
14
+ import { BUTTON_COLORS, BUTTON_VARIANTS } from '../../components/button/button.constants';
15
+ export const CardAndDialogFooterMixin = (superClass) => {
16
+ class InnerMixinClass extends superClass {
17
+ /**
18
+ * Updates the color of the footer buttons based on the variant.
19
+ * If the variant is promotional, the color is promotional, else default.
20
+ *
21
+ * @internal
22
+ */
23
+ updateFooterButtonColors(variant) {
24
+ const footerButtons = [...(this.footerButtonPrimary || []), ...(this.footerButtonSecondary || [])];
25
+ footerButtons === null || footerButtons === void 0 ? void 0 : footerButtons.forEach((button) => {
26
+ if (variant === VARIANTS.PROMOTIONAL) {
27
+ button.setAttribute('color', BUTTON_COLORS.PROMOTIONAL);
28
+ }
29
+ else {
30
+ button.setAttribute('color', BUTTON_COLORS.DEFAULT);
31
+ }
32
+ });
33
+ }
34
+ /**
35
+ * Filters and renders only the following content into the footer section and removes anything other than it
36
+ * - One mdc-link element in the footer-link slot
37
+ * - One secondary variant of the mdc-button element in the footer-button-secondary slot
38
+ * - One primary variant of the mdc-button element in the footer-button-primary slot
39
+ *
40
+ * @internal
41
+ */
42
+ handleFooterSlot(tagname, variant) {
43
+ var _a, _b, _c;
44
+ let arrayItems = [];
45
+ if (tagname === DEFAULTS.LINK && ((_a = this.footerLink) === null || _a === void 0 ? void 0 : _a.length)) {
46
+ arrayItems = this.footerLink;
47
+ }
48
+ else if (tagname === DEFAULTS.BUTTON
49
+ && variant === BUTTON_VARIANTS.PRIMARY
50
+ && ((_b = this.footerButtonPrimary) === null || _b === void 0 ? void 0 : _b.length)) {
51
+ arrayItems = this.footerButtonPrimary;
52
+ }
53
+ else if (tagname === DEFAULTS.BUTTON
54
+ && variant === BUTTON_VARIANTS.SECONDARY
55
+ && ((_c = this.footerButtonSecondary) === null || _c === void 0 ? void 0 : _c.length)) {
56
+ arrayItems = this.footerButtonSecondary;
57
+ }
58
+ // if there are more than one instance, remove them.
59
+ for (let i = 1; i < arrayItems.length; i += 1) {
60
+ arrayItems[i].remove();
61
+ }
62
+ arrayItems.forEach((element) => {
63
+ // remove the element if it doesn't match with the tagname
64
+ if (!element.matches(tagname)) {
65
+ element.remove();
66
+ }
67
+ // set the variant if it is provided
68
+ if (variant) {
69
+ element.setAttribute('variant', variant);
70
+ }
71
+ });
72
+ }
73
+ /**
74
+ * Renders the footer of the card if footer-link,
75
+ * footer-button-primary, or footer-button-secondary slots are provided
76
+ * @returns The footer element
77
+ */
78
+ renderFooter() {
79
+ return html `<div part="footer">
80
+ <slot name="footer-link" @slotchange=${() => this.handleFooterSlot(DEFAULTS.LINK)}></slot>
81
+ <slot name="footer-button-secondary"
82
+ @slotchange=${() => this.handleFooterSlot(DEFAULTS.BUTTON, BUTTON_VARIANTS.SECONDARY)}></slot>
83
+ <slot name="footer-button-primary"
84
+ @slotchange=${() => this.handleFooterSlot(DEFAULTS.BUTTON, BUTTON_VARIANTS.PRIMARY)}></slot>
85
+ </div>`;
86
+ }
87
+ }
88
+ __decorate([
89
+ queryAssignedElements({ slot: 'footer-link' }),
90
+ __metadata("design:type", Array)
91
+ ], InnerMixinClass.prototype, "footerLink", void 0);
92
+ __decorate([
93
+ queryAssignedElements({ slot: 'footer-button-primary' }),
94
+ __metadata("design:type", Array)
95
+ ], InnerMixinClass.prototype, "footerButtonPrimary", void 0);
96
+ __decorate([
97
+ queryAssignedElements({ slot: 'footer-button-secondary' }),
98
+ __metadata("design:type", Array)
99
+ ], InnerMixinClass.prototype, "footerButtonSecondary", void 0);
100
+ // Cast return type to your mixin's interface intersected with the superClass type
101
+ return InnerMixinClass;
102
+ };
@@ -9,7 +9,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
9
9
  };
10
10
  /* eslint-disable max-classes-per-file */
11
11
  import { property } from 'lit/decorators.js';
12
- import { DEFAULTS as POPOVER_DEFAULTS } from '../../components/popover/popover.constants';
13
12
  export const FocusTrapMixin = (superClass) => {
14
13
  class FocusTrap extends superClass {
15
14
  constructor(...args) {
@@ -19,12 +18,12 @@ export const FocusTrapMixin = (superClass) => {
19
18
  * If true, focus will be restricted to the content within this component.
20
19
  * @default false
21
20
  */
22
- this.enabledFocusTrap = POPOVER_DEFAULTS.FOCUS_TRAP;
21
+ this.enabledFocusTrap = false;
23
22
  /**
24
- * Prevent outside scrolling when popover show.
23
+ * Prevent outside scrolling when element is shown.
25
24
  * @default false
26
25
  */
27
- this.enabledPreventScroll = POPOVER_DEFAULTS.PREVENT_SCROLL;
26
+ this.enabledPreventScroll = false;
28
27
  /** @internal */
29
28
  this.focusTrapIndex = -1;
30
29
  /** @internal */
@@ -199,7 +198,7 @@ export const FocusTrapMixin = (superClass) => {
199
198
  /**
200
199
  * Sets the initial focus within the container.
201
200
  *
202
- * @param prefferableElement - The index of the prefferable element to focus.
201
+ * @param prefferableElement - The index of the preferable element to focus.
203
202
  */
204
203
  setInitialFocus(prefferableElement = 0) {
205
204
  if (this.focusableElements.length === 0)
package/package.json CHANGED
@@ -39,5 +39,5 @@
39
39
  "lit": "^3.2.0",
40
40
  "uuid": "^11.0.5"
41
41
  },
42
- "version": "0.66.3"
42
+ "version": "0.67.0"
43
43
  }