@momentum-ui/web-components 2.23.49 → 2.24.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/index.js CHANGED
@@ -1 +1 @@
1
- require("./5757"),require("./7103"),require("./1890"),require("./6272"),require("./6325"),require("./6283"),require("./9217"),require("./5830"),require("./8889"),require("./8210"),require("./4977"),require("./3135"),require("./1598"),require("./1572"),require("./6366"),require("./7251"),require("./4974"),require("./2243"),require("./7919"),require("./3553"),require("./6877"),require("./6700"),require("./8004"),require("./6795"),require("./8923"),require("./4548"),require("./76"),require("./1392"),require("./9164"),require("./1214"),require("./1625"),require("./6067"),require("./3625"),require("./8841"),require("./3112"),require("./3866"),require("./1107"),require("./7330"),require("./7092"),require("./9719"),require("./6979"),require("./9130"),require("./6273"),require("./9618"),require("./8612"),require("./8521"),require("./2019"),require("./779"),require("./573"),require("./5801"),require("./2043"),require("./8171"),require("./2798"),require("./5467"),require("./2984"),require("./1869"),require("./2215"),require("./7997"),require("./4392"),require("./630"),require("./3604"),require("./8728"),require("./8227"),require("./1250"),require("./1705"),require("./6953"),require("./7875"),require("./7833"),require("./6400"),require("./587"),require("./6441"),require("./6015"),require("./3663"),module.exports=require("./index-entry");
1
+ require("./5757"),require("./7103"),require("./1890"),require("./6272"),require("./6325"),require("./6283"),require("./9217"),require("./5830"),require("./8889"),require("./8210"),require("./4977"),require("./3135"),require("./1598"),require("./1572"),require("./6366"),require("./7251"),require("./4974"),require("./2243"),require("./7919"),require("./3553"),require("./6877"),require("./6700"),require("./8004"),require("./6795"),require("./8923"),require("./4548"),require("./76"),require("./1392"),require("./9164"),require("./2019"),require("./1625"),require("./6067"),require("./3625"),require("./8841"),require("./3112"),require("./3866"),require("./1107"),require("./7330"),require("./7092"),require("./9719"),require("./6979"),require("./9130"),require("./6273"),require("./9618"),require("./8612"),require("./8521"),require("./4400"),require("./779"),require("./573"),require("./5801"),require("./2043"),require("./8171"),require("./2798"),require("./5467"),require("./2984"),require("./1869"),require("./2215"),require("./7997"),require("./4392"),require("./630"),require("./3604"),require("./8728"),require("./8227"),require("./1250"),require("./1705"),require("./6953"),require("./7875"),require("./7833"),require("./6400"),require("./587"),require("./6441"),require("./6015"),require("./3663"),module.exports=require("./index-entry");
@@ -6,7 +6,7 @@
6
6
  *
7
7
  */
8
8
  import { LitElement } from "lit-element";
9
- import { BadgeCircleSize, BadgeSize } from "./badge.constant";
9
+ import { BadgeCircleSize, BadgeSize } from "./badge.constants";
10
10
  export declare namespace Badge {
11
11
  type BadgeCircleSize = (typeof BadgeCircleSize)[keyof typeof BadgeCircleSize];
12
12
  type BadgeSize = (typeof BadgeSize)[keyof typeof BadgeSize];
@@ -0,0 +1,116 @@
1
+ import type { CSSResult, CSSResultArray, PropertyValues, TemplateResult } from "lit-element";
2
+ import { LitElement } from "lit-element";
3
+ import "../icon/Icon";
4
+ import type { BadgeType, IconVariant } from "./badge.types";
5
+ /**
6
+ * The `md-notification-badge` component is a versatile UI element used to
7
+ * display dot, icons, counters, success, warning and error type badge.
8
+ *
9
+ * Supported badge types:
10
+ * - `dot`: Displays a dot notification badge with a blue color.
11
+ * - `icon`: Displays a badge with a specified icon using the `icon-name` attribute.
12
+ * - `counter`: Displays a badge with a counter value. If the counter exceeds the `max-counter`,
13
+ * it shows `maxCounter+`. The maximum value of the counter is 999 and anything above that will be set to `999+`.
14
+ * - `success`: Displays a success badge with a check circle icon and green color.
15
+ * - `warning`: Displays a warning badge with a warning icon and yellow color.
16
+ * - `error`: Displays a error badge with a error legacy icon and red color.
17
+ *
18
+ * For `icon`, `success`, `warning` and `error` types, the `md-notification-icon` component is used to render the icon.
19
+ *
20
+ * For the `counter` type, a div is used to render the counter value.
21
+ *
22
+ * @dependency md-icon
23
+ *
24
+ * @tagname md-notification-badge
25
+ *
26
+ */
27
+ export declare class NotificationBadge extends LitElement {
28
+ static get styles(): CSSResult | CSSResultArray;
29
+ /**
30
+ * Type of the badge
31
+ * Can be `dot` (notification) , `icon`, `counter`, `success`, `warning` or `error`.
32
+ */
33
+ type?: BadgeType;
34
+ /**
35
+ * Type of the variant can be `primary` or `secondary`.
36
+ * It defines the background and foreground color of the icon.
37
+ * @default primary
38
+ */
39
+ variant: IconVariant;
40
+ /**
41
+ * Counter is the number which can be provided in the badge.
42
+ */
43
+ counter?: number;
44
+ /**
45
+ * The maximum number can be set up to 999, anything above that will be rendered as _999+_.
46
+ * The max counter can be `9`, `99` or `999`.
47
+ * @default 99
48
+ */
49
+ maxCounter: number;
50
+ /**
51
+ * Overlay is to add a thin outline to the badge.
52
+ * This will help distinguish between the badge and the button,
53
+ * where the badge will be layered on top of a button.
54
+ * @default false
55
+ */
56
+ overlay: boolean;
57
+ /**
58
+ * Name of the icon (= filename).
59
+ *
60
+ * If no `icon-name` is provided, no icon will be rendered.
61
+ */
62
+ iconName?: string;
63
+ /**
64
+ * Aria-label attribute to be set for accessibility
65
+ * @default null
66
+ */
67
+ ariaLabel: string | null;
68
+ /**
69
+ * If `type` is set to `counter` and if `counter` is greater than `maxCounter`,
70
+ * then it will return a string the maxCounter value as string.
71
+ * Otherwise, it will return a string representation of `counter`.
72
+ * If `counter` is not a number, it will return an empty string.
73
+ * @param maxCounter - the maximum limit which can be displayed on the badge
74
+ * @param counter - the number to be displayed on the badge
75
+ * @returns the string representation of the counter
76
+ */
77
+ private getCounterText;
78
+ /**
79
+ * Method to generate the badge icon.
80
+ * @param iconName - the name of the icon from the icon set
81
+ * @param backgroundClassPostfix - postfix for the class to style the badge icon.
82
+ * @returns the template result of the icon.
83
+ */
84
+ private getBadgeIcon;
85
+ /**
86
+ * Method to generate the badge dot template.
87
+ * @returns the template result of the dot with md-notification-badge-dot class.
88
+ */
89
+ private getBadgeDot;
90
+ /**
91
+ * Method to generate the badge text and counter template.
92
+ * @returns the template result of the text.
93
+ */
94
+ private getBadgeCounterText;
95
+ /**
96
+ * Method to set the role based on the aria-label provided.
97
+ * If the aria-label is provided, the role of the element will be 'img'.
98
+ * Otherwise, the role will be null.
99
+ */
100
+ private setRoleByAriaLabel;
101
+ /**
102
+ * Generates the badge content based on the badge type.
103
+ * Utilizes various helper methods to create the appropriate badge template based on the
104
+ * current badge type. Supports 'dot', 'icon', 'counter', 'success', 'warning', and 'error'
105
+ * types, returning the corresponding template result for each type.
106
+ * @returns the TemplateResult for the current badge type.
107
+ */
108
+ private getBadgeContentBasedOnType;
109
+ update(changedProperties: PropertyValues): void;
110
+ render(): TemplateResult;
111
+ }
112
+ declare global {
113
+ interface HTMLElementTagNameMap {
114
+ "md-notification-badge": NotificationBadge;
115
+ }
116
+ }
@@ -0,0 +1,53 @@
1
+ declare const BadgeCircleSize: {
2
+ readonly 24: 24;
3
+ readonly 32: 32;
4
+ readonly 36: 36;
5
+ readonly 40: 40;
6
+ readonly 48: 48;
7
+ readonly 64: 64;
8
+ readonly 72: 72;
9
+ readonly 88: 88;
10
+ readonly 124: 124;
11
+ };
12
+ declare const BadgeSize: {
13
+ readonly 24: 24;
14
+ readonly 32: 32;
15
+ readonly 36: 36;
16
+ };
17
+ declare const TYPE: {
18
+ readonly DOT: "dot";
19
+ readonly ICON: "icon";
20
+ readonly COUNTER: "counter";
21
+ readonly SUCCESS: "success";
22
+ readonly WARNING: "warning";
23
+ readonly ERROR: "error";
24
+ };
25
+ declare const ICON_NAMES_LIST: {
26
+ readonly SUCCESS_ICON_NAME: "check-circle-badge-filled";
27
+ readonly WARNING_ICON_NAME: "warning-badge-filled";
28
+ readonly ERROR_ICON_NAME: "error-legacy-badge-filled";
29
+ };
30
+ declare const ICON_VARIANT: {
31
+ readonly PRIMARY: "primary";
32
+ readonly SECONDARY: "secondary";
33
+ };
34
+ declare const ICON_STATE: {
35
+ readonly SUCCESS: "success";
36
+ readonly WARNING: "warning";
37
+ readonly ERROR: "error";
38
+ };
39
+ declare const BACKGROUND_STYLES: {
40
+ readonly SUCCESS: "success";
41
+ readonly WARNING: "warning";
42
+ readonly ERROR: "error";
43
+ readonly PRIMARY: "primary";
44
+ readonly SECONDARY: "secondary";
45
+ };
46
+ declare const DEFAULTS: {
47
+ readonly TYPE: "dot";
48
+ readonly MAX_COUNTER: 99;
49
+ readonly MAX_COUNTER_LIMIT: 999;
50
+ readonly VARIANT: "primary";
51
+ readonly ICON_SIZE: 12;
52
+ };
53
+ export { BACKGROUND_STYLES, BadgeCircleSize, BadgeSize, DEFAULTS, ICON_NAMES_LIST, ICON_STATE, ICON_VARIANT, TYPE };
@@ -0,0 +1,5 @@
1
+ import { ICON_VARIANT, TYPE } from "./badge.constants";
2
+ type ValueOf<T> = T[keyof T];
3
+ type IconVariant = ValueOf<typeof ICON_VARIANT>;
4
+ type BadgeType = ValueOf<typeof TYPE>;
5
+ export type { BadgeType, IconVariant };
@@ -16,6 +16,7 @@ export { Avatar } from "./components/avatar/Avatar";
16
16
  export { AvatarType } from "./components/avatar/Avatar.constants";
17
17
  export { CompositeAvatar } from "./components/avatar/CompositeAvatar";
18
18
  export { Badge } from "./components/badge/Badge";
19
+ export { NotificationBadge } from "./components/badge/NotificationBadge";
19
20
  export { Breadcrumb } from "./components/breadcrumb/Breadcrumb";
20
21
  export { ButtonGroup } from "./components/button-group/ButtonGroup";
21
22
  export { Button } from "./components/button/Button";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@momentum-ui/web-components",
3
- "version": "2.23.49",
3
+ "version": "2.24.0",
4
4
  "author": "Yana Harris",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/momentum-design/momentum-ui.git",
package/dist/1214.js DELETED
@@ -1 +0,0 @@
1
- "use strict";(self["momentum-web-components-[id]"]=self["momentum-web-components-[id]"]||[]).push([[1214],{42532:(o,r,e)=>{e.d(r,{z:()=>a});const a={24:24,32:32,36:36,40:40,48:48,64:64,72:72,88:88,124:124}},92019:(o,r,e)=>{e.d(r,{A:()=>a});const a=e(41488).css`.md-badge{align-items:center;display:inline-flex;font-family:var(--brand-font-regular, "CiscoSansTT Regular", "Helvetica Neue", Helvetica, Arial, sans-serif);font-weight:400;height:2rem;justify-content:flex-start;line-height:1rem;margin-bottom:auto;overflow:hidden;position:relative;text-align:center;text-decoration:none;white-space:nowrap;padding:.25rem 1rem;font-size:var(--font-size-body-midsize,.75rem);background-color:var(--badge-default-bg-color);color:var(--badge-default-text-color);gap:.5rem}.md-badge{border-radius:6.25rem}.md-badge:focus{outline:2px solid var(--button-focus-ring-color);outline-offset:2px}.md-badge--small{padding:.1875rem .75rem;font-size:var(--font-size-body-midsize,.75rem);height:1.5rem;min-width:auto}.md-badge--size-36{height:2.25rem;padding:.5rem .75rem .5rem .75rem}.md-badge--compact,.md-badge--split{padding:.25rem 1rem .25rem .25rem;font-size:var(--body-secondary,.75rem)}.md-badge--circle{padding:.75rem .75rem;font-size:.75rem;height:2.5rem;justify-content:center;min-width:auto;width:2.5rem}.md-badge--circle ::slotted(md-icon){margin:0!important}.md-badge--circle-24{height:1.5rem;width:1.5rem}.md-badge--circle-32{height:2rem;width:2rem}.md-badge--circle-48{height:3rem;width:3rem}.md-badge--circle-64{height:4rem;width:4rem}.md-badge--circle-72{height:4.5rem;width:4.5rem}.md-badge--circle-88{height:5.5rem;width:5.5rem}.md-badge--circle-124{height:7.75rem;width:7.75rem}.md-badge--outline{color:var(--badge-outline-color);border:2px solid var(--badge-outline-color);background-color:rgba(0,0,0,0);border:1px solid;min-width:auto}.md-badge--gray{background-color:var(--badge-gray-bg-color);color:var(--badge-gray-text-color)}.md-badge--gold{background-color:var(--badge-gold-bg-color);color:var(--badge-gold-text-color)}.md-badge--lime{background-color:var(--badge-lime-bg-color);color:var(--badge-lime-text-color)}.md-badge--blue,.md-badge--cobalt{background-color:var(--badge-blue-bg-color);color:var(--badge-blue-text-color)}.md-badge--mint{background-color:var(--badge-mint-bg-color);color:var(--badge-mint-text-color)}.md-badge--darkmint{background-color:var(--badge-darkmint-bg-color);color:var(--badge-darkmint-text-color)}.md-badge--green{background-color:var(--badge-green-bg-color);color:var(--badge-green-text-color)}.md-badge--yellow{background-color:var(--badge-yellow-bg-color);color:var(--badge-yellow-text-color)}.md-badge--red{background-color:var(--badge-red-bg-color);color:var(--badge-red-text-color)}.md-badge--darkred{background-color:var(--badge-darkred-bg-color);color:var(--badge-darkred-text-color)}.md-badge--unreadcount{background-color:var(--badge-unreadcount-bg-color,var(--badge-darkred-bg-color));color:var(--badge-unreadcount-text-color,var(--button-primary-text-color));font-family:var(--brand-font-medium);font-size:.75rem;font-weight:500;padding:0 .25rem;min-width:1rem;height:1rem;justify-content:center}.md-badge--unreadcount.md-badge--outline{border:1px solid;min-width:1.125rem;height:1.125rem;border-color:var(--md-primary-bg-color)}.md-badge--orange{background-color:var(--badge-orange-bg-color);color:var(--badge-orange-text-color)}.md-badge--purple{background-color:var(--badge-purple-bg-color);color:var(--badge-purple-text-color)}.md-badge--violet{background-color:var(--badge-violet-bg-color);color:var(--badge-violet-text-color)}.md-badge--cyan{background-color:var(--badge-cyan-bg-color);color:var(--badge-cyan-text-color)}.md-badge--pink{background-color:var(--badge-pink-bg-color);color:var(--badge-pink-text-color)}.md-badge--hold{background-color:var(--badge-hold-bg-color);color:var(--badge-hold-text-color)}.md-badge--status-negative{padding:0 4px;padding-right:6px;font-weight:400;font-family:var(--brand-font-regular);background-color:var(--badge-status-negative-bg-color);color:var(--badge-status-negative-text-color);gap:.25rem}.md-badge--status-negative:hover{background-color:var(--badge-status-negative-bg-color)}.md-badge--status-negative:active{background-color:var(--badge-status-negative-bg-color)}.md-badge--status-positive{padding:0 4px;padding-right:6px;font-weight:400;font-family:var(--brand-font-regular);background-color:var(--badge-status-positive-bg-color);color:var(--badge-status-positive-text-color);gap:.25rem}.md-badge--status-positive:hover{background-color:var(--badge-status-positive-bg-color)}.md-badge--status-positive:active{background-color:var(--badge-status-positive-bg-color)}.md-badge--status-warning{padding:0 4px;padding-right:6px;font-weight:400;font-family:var(--brand-font-regular);background-color:var(--badge-status-warning-bg-color);color:var(--badge-status-warning-text-color);gap:.25rem}.md-badge--status-warning:hover{background-color:var(--badge-status-warning-bg-color)}.md-badge--status-warning:active{background-color:var(--badge-status-warning-bg-color)}.md-badge--status-accent{padding:0 4px;padding-right:6px;font-weight:400;font-family:var(--brand-font-regular);background-color:var(--badge-status-accent-bg-color);color:var(--badge-status-accent-text-color);gap:.25rem}.md-badge--status-accent:hover{background-color:var(--badge-status-accent-bg-color)}.md-badge--status-accent:active{background-color:var(--badge-status-accent-bg-color)}.md-badge--status-orange{padding:0 4px;padding-right:6px;font-weight:400;font-family:var(--brand-font-regular);background-color:var(--badge-status-orange-bg-color);color:var(--badge-status-orange-text-color);gap:.25rem}.md-badge--status-orange:hover{background-color:var(--badge-status-orange-bg-color)}.md-badge--status-orange:active{background-color:var(--badge-status-orange-bg-color)}.md-badge--disabled{background-color:var(--badge-disabled-bg-color);color:var(--badge-disabled-text-color);border:1px solid var(--badge-disabled-border-color)}.md-badge--disabled ::slotted(md-icon){color:var(--badge-disabled-text-color)}.md-badge--small.md-badge--circle{height:1.5rem;width:1.5rem}.badge-counter{font-weight:700;margin-left:.5rem}::slotted(md-icon){height:1rem;width:1rem}::slotted(md-badge){height:1rem;width:1rem}::slotted(span){align-items:center;display:inline-flex;height:1rem;justify-content:center}.split-separator{margin:0 0;opacity:.4}@media(forced-colors:active){.md-badge{forced-color-adjust:none;background-color:Canvas!important;color:CanvasText!important;outline:1px solid CanvasText!important}}`}}]);
@@ -1,17 +0,0 @@
1
- declare const BadgeCircleSize: {
2
- readonly 24: 24;
3
- readonly 32: 32;
4
- readonly 36: 36;
5
- readonly 40: 40;
6
- readonly 48: 48;
7
- readonly 64: 64;
8
- readonly 72: 72;
9
- readonly 88: 88;
10
- readonly 124: 124;
11
- };
12
- declare const BadgeSize: {
13
- readonly 24: 24;
14
- readonly 32: 32;
15
- readonly 36: 36;
16
- };
17
- export { BadgeCircleSize, BadgeSize };