@maggioli-design-system/mds-push-notification 5.2.0 → 5.2.2

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.
@@ -19,15 +19,17 @@ export class Locale {
19
19
  };
20
20
  this.update = (doc) => {
21
21
  const context = doc !== null && doc !== void 0 ? doc : this.element.shadowRoot;
22
- context && context.querySelectorAll('*').forEach(el => {
23
- if (el.tagName.toLowerCase().startsWith('mds-')) {
24
- // eslint-disable-next-line no-restricted-syntax
25
- if (el && 'updateLang' in el) {
26
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
27
- el.updateLang();
22
+ if (context) {
23
+ context.querySelectorAll('*').forEach(el => {
24
+ if (el.tagName.toLowerCase().startsWith('mds-')) {
25
+ // eslint-disable-next-line no-restricted-syntax
26
+ if (el && 'updateLang' in el) {
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+ el.updateLang();
29
+ }
28
30
  }
29
- }
30
- });
31
+ });
32
+ }
31
33
  };
32
34
  this.pluralize = (tag, context) => {
33
35
  const languagePhrase = this.config[this.language] ? this.config[this.language][tag] : this.config[this.rollbackLanguage][tag];
@@ -25,4 +25,13 @@ const hasSlotted = (el, name) => {
25
25
  }
26
26
  return false;
27
27
  };
28
- export { hasSlottedElements, hasSlottedNodes, hasSlotted, };
28
+ const hasSlottedContent = (el, name) => {
29
+ var _a;
30
+ const query = name ? `slot[name="${name}"]` : 'slot:not([name])';
31
+ const slot = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(query);
32
+ if (!slot)
33
+ return false;
34
+ const assignedNodes = slot.assignedNodes({ flatten: true });
35
+ return assignedNodes.some(node => { var _a; return node.nodeType === Node.TEXT_NODE && ((_a = node.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== ''; });
36
+ };
37
+ export { hasSlottedElements, hasSlottedNodes, hasSlottedContent, hasSlotted, };
@@ -30,14 +30,14 @@ const exampleNotifications = [
30
30
  },
31
31
  ];
32
32
  const PushNotificationElement = ({ index }) => {
33
- return h("mds-push-notification-item", { icon: "mi/baseline/attachment", subject: `Notification ${index + 1}`, message: "Sto preparando il documento che mi hai richiesto, dovrei finire in giornata, fammi sapere se hai altri aggiornamenti al riguardo cos\u00EC non mi perdo pezzi per la strada." });
33
+ return (h("mds-push-notification-item", { icon: "mi/baseline/attachment", subject: `Notification ${index + 1}`, message: "Sto preparando il documento che mi hai richiesto, dovrei finire in giornata, fammi sapere se hai altri aggiornamenti al riguardo cos\u00EC non mi perdo pezzi per la strada." }));
34
34
  };
35
35
  const GetNotifications = ({ notifications }) => {
36
36
  // console.log('getNotifications', notifications)
37
37
  if (notifications.length > 0) {
38
- return h(Fragment, null, notifications.map((n, i) => {
39
- return h("mds-push-notification-item", { key: i, preview: n.preview, src: n.src, subject: n.subject, message: n.message }, h("mds-button", { slot: "actions", variant: "primary", tone: "weak", size: "sm" }, "Rispondi"));
40
- }));
38
+ return (h(Fragment, null, notifications.map((n, i) => {
39
+ return (h("mds-push-notification-item", { key: i, preview: n.preview, src: n.src, subject: n.subject, message: n.message }, h("mds-button", { slot: "actions", variant: "primary", tone: "weak", size: "sm" }, "Rispondi")));
40
+ })));
41
41
  }
42
42
  };
43
43
  const Template = args => {
@@ -70,30 +70,36 @@ const Template = args => {
70
70
  setNotifications([...notifications, n]);
71
71
  // console.log(notifications)
72
72
  }
73
- return h("div", { class: "-m-600" }, h("div", { class: "fixed top-600 left-600 flex gap-100" }, visible
74
- ? h("mds-button", { class: "shadow-outline-50 shadow-tone-neutral", onClick: () => setVisible(false), icon: "mdi/eye-off-outline", variant: "error" }, "Hide notifications")
75
- : h("mds-button", { class: "shadow-outline-50 shadow-tone-neutral", onClick: () => setVisible(true), icon: "mi/baseline/remove-red-eye", variant: "primary" }, "Show notifications"), h("mds-button", { class: "shadow-outline-50 shadow-tone-neutral", variant: "success", onClick: pushN }, "Carica altre...")), h("mds-push-notification", { class: "mds-push-notification", visible: visible === false ? undefined : true, behavior: args.behavior }, h(GetNotifications, { notifications: notifications })), h("div", { class: "p-1200 flex justify-center" }, h("div", { class: "grid gap-600 grid-cols-3 mobile:grid-cols-1 max-w-screen-desktop" }, Array(18).fill(null).map((_item, index) => {
76
- return (h("div", { class: "grid gap-25", key: index }, h("mds-text", { typography: 'h5', tag: "h2" }, "This is a section title"), h("mds-text", null, "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus iure, ratione beatae quam optio cumque rerum modi consectetur odit eligendi omnis veniam fuga non ipsam voluptatum a ut neque illum.")));
77
- }))));
73
+ return (h("div", { class: "-m-600" }, h("div", { class: "fixed top-600 left-600 flex gap-100" }, visible ? (h("mds-button", { class: "shadow-outline-50 shadow-tone-neutral", onClick: () => setVisible(false), icon: "mdi/eye-off-outline", variant: "error" }, "Hide notifications")) : (h("mds-button", { class: "shadow-outline-50 shadow-tone-neutral", onClick: () => setVisible(true), icon: "mi/baseline/remove-red-eye", variant: "primary" }, "Show notifications")), h("mds-button", { class: "shadow-outline-50 shadow-tone-neutral", variant: "success", onClick: pushN }, "Carica altre...")), h("mds-push-notification", { class: "mds-push-notification", visible: visible === false ? undefined : true, behavior: args.behavior }, h(GetNotifications, { notifications: notifications })), h("div", { class: "p-1200 flex justify-center" }, h("div", { class: "grid gap-600 grid-cols-3 max-mobile:grid-cols-1 max-w-screen-desktop" }, Array(18)
74
+ .fill(null)
75
+ .map((_item, index) => {
76
+ return (h("div", { class: "grid gap-25", key: index }, h("mds-text", { typography: "h5", tag: "h2" }, "This is a section title"), h("mds-text", null, "Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus iure, ratione beatae quam optio cumque rerum modi consectetur odit eligendi omnis veniam fuga non ipsam voluptatum a ut neque illum.")));
77
+ })))));
78
78
  };
79
79
  const TemplateAddNotifications = () => {
80
80
  const [items, setItem] = useState(0);
81
- return h("div", null, h("mds-button", { onClick: () => setItem(items + 1) }, "Add notifications"), h("mds-push-notification", null, Array.from(Array(items).keys()).map((_item, index) => h(PushNotificationElement, { index: index }))));
81
+ return (h("div", null, h("mds-button", { onClick: () => setItem(items + 1) }, "Add notifications"), h("mds-push-notification", null, Array.from(Array(items).keys()).map((_item, index) => (h(PushNotificationElement, { index: index }))))));
82
82
  };
83
83
  const TemplateAddMultipleNotifications = args => {
84
84
  const [items, setItem] = useState(0);
85
85
  const addItems = () => {
86
86
  setItem(items + 3);
87
87
  };
88
- return h("div", null, h("mds-button", { onClick: addItems.bind(this) }, "Carica notifiche..."), h("mds-push-notification", Object.assign({}, args), h("mds-button", { slot: "top", variant: "dark", onClick: addItems.bind(this) }, "Carica notifiche..."), Array.from(Array(items).keys()).map((_item, index) => h(PushNotificationElement, { index: index })), h("mds-button", { slot: "bottom", variant: "dark" }, "Cancella notifiche")));
88
+ return (h("div", null, h("mds-button", { onClick: addItems.bind(this) }, "Carica notifiche..."), h("mds-push-notification", Object.assign({}, args), h("mds-button", { slot: "top", variant: "dark", onClick: addItems.bind(this) }, "Carica notifiche..."), Array.from(Array(items).keys()).map((_item, index) => (h(PushNotificationElement, { index: index }))), h("mds-button", { slot: "bottom", variant: "dark" }, "Cancella notifiche"))));
89
89
  };
90
- export const Default = Template.bind({});
91
- export const AddNotifications = TemplateAddNotifications.bind({});
92
- AddNotifications.args = {
93
- visible: true,
90
+ export const Default = {
91
+ render: Template,
94
92
  };
95
- export const AddMultipleNotifications = TemplateAddMultipleNotifications.bind({});
96
- AddMultipleNotifications.args = {
97
- visible: true,
93
+ export const AddNotifications = {
94
+ render: TemplateAddNotifications,
95
+ args: {
96
+ visible: true,
97
+ },
98
+ };
99
+ export const AddMultipleNotifications = {
100
+ render: TemplateAddMultipleNotifications,
101
+ args: {
102
+ visible: true,
103
+ },
98
104
  };
99
105
  export const ManualNotification = Template.bind({}, { behavior: 'manual' });
@@ -42,6 +42,10 @@ const buttonSizeDictionary = [
42
42
  'lg',
43
43
  'xl',
44
44
  ];
45
+ const tabSizeDictionary = [
46
+ 'sm',
47
+ 'md',
48
+ ];
45
49
  const buttonIconPositionDictionary = [
46
50
  'left',
47
51
  'right',
@@ -51,4 +55,4 @@ const buttonTypeDictionary = [
51
55
  'submit',
52
56
  'reset',
53
57
  ];
54
- export { buttonDropdownVariantDictionary, buttonIconPositionDictionary, buttonSizeDictionary, buttonTargetDictionary, buttonToneMinimalVariantDictionary, buttonToneVariantDictionary, buttonTypeDictionary, buttonVariantDictionary, };
58
+ export { buttonDropdownVariantDictionary, buttonIconPositionDictionary, buttonSizeDictionary, buttonTargetDictionary, buttonToneMinimalVariantDictionary, buttonToneVariantDictionary, buttonTypeDictionary, buttonVariantDictionary, tabSizeDictionary, };
@@ -1,5 +1,5 @@
1
1
  import jsonIconsDictionary from "../fixtures/icons.json";
2
- import jsonMggIconsDictionary from "../fixtures/iconsauce.json";
2
+ import jsonMggIconsDictionary from "@maggioli-design-system/svg-icons/dist/iconsauce.json";
3
3
  const iconsDictionary = jsonIconsDictionary;
4
4
  const mggIconsDictionary = jsonMggIconsDictionary;
5
5
  const svgIconsDictionary = [
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2025-06-23T15:01:25",
2
+ "timestamp": "2026-01-16T15:19:56",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.27.2",
package/dist/stats.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
- "timestamp": "2025-06-23T15:01:25",
2
+ "timestamp": "2026-01-16T15:19:56",
3
3
  "compiler": {
4
4
  "name": "node",
5
- "version": "22.11.0"
5
+ "version": "22.15.0"
6
6
  },
7
7
  "app": {
8
8
  "namespace": "MdsPushNotification",
@@ -804,8 +804,7 @@
804
804
  "./src/dictionary/file-extensions.ts": [],
805
805
  "./src/dictionary/floating-ui.ts": [],
806
806
  "./src/dictionary/icon.ts": [
807
- "./src/fixtures/icons.json",
808
- "./src/fixtures/iconsauce.json"
807
+ "./src/fixtures/icons.json"
809
808
  ],
810
809
  "./src/dictionary/input.ts": [],
811
810
  "./src/dictionary/keyboard.ts": [],
@@ -1,4 +1,5 @@
1
1
  declare const hasSlottedElements: (el: HTMLElement, name?: string) => boolean;
2
2
  declare const hasSlottedNodes: (el: HTMLElement, name?: string) => boolean;
3
3
  declare const hasSlotted: (el: HTMLElement, name?: string) => boolean;
4
- export { hasSlottedElements, hasSlottedNodes, hasSlotted, };
4
+ declare const hasSlottedContent: (el: HTMLElement, name?: string) => boolean;
5
+ export { hasSlottedElements, hasSlottedNodes, hasSlottedContent, hasSlotted, };
@@ -10,7 +10,19 @@ declare const _default: {
10
10
  };
11
11
  };
12
12
  export default _default;
13
- export declare const Default: any;
14
- export declare const AddNotifications: any;
15
- export declare const AddMultipleNotifications: any;
13
+ export declare const Default: {
14
+ render: (args: any) => any;
15
+ };
16
+ export declare const AddNotifications: {
17
+ render: () => any;
18
+ args: {
19
+ visible: boolean;
20
+ };
21
+ };
22
+ export declare const AddMultipleNotifications: {
23
+ render: (args: any) => any;
24
+ args: {
25
+ visible: boolean;
26
+ };
27
+ };
16
28
  export declare const ManualNotification: any;
@@ -4,6 +4,7 @@ declare const buttonToneVariantDictionary: string[];
4
4
  declare const buttonToneMinimalVariantDictionary: string[];
5
5
  declare const buttonTargetDictionary: string[];
6
6
  declare const buttonSizeDictionary: string[];
7
+ declare const tabSizeDictionary: string[];
7
8
  declare const buttonIconPositionDictionary: string[];
8
9
  declare const buttonTypeDictionary: string[];
9
- export { buttonDropdownVariantDictionary, buttonIconPositionDictionary, buttonSizeDictionary, buttonTargetDictionary, buttonToneMinimalVariantDictionary, buttonToneVariantDictionary, buttonTypeDictionary, buttonVariantDictionary, };
10
+ export { buttonDropdownVariantDictionary, buttonIconPositionDictionary, buttonSizeDictionary, buttonTargetDictionary, buttonToneMinimalVariantDictionary, buttonToneVariantDictionary, buttonTypeDictionary, buttonVariantDictionary, tabSizeDictionary, };
@@ -1,4 +1,4 @@
1
- declare const iconsDictionary: string[];
1
+ declare const iconsDictionary: any;
2
2
  declare const mggIconsDictionary: string[];
3
3
  declare const svgIconsDictionary: string[];
4
4
  export { iconsDictionary, mggIconsDictionary, svgIconsDictionary, };
@@ -1,6 +1,7 @@
1
1
  export type ButtonType = 'a' | 'button' | 'reset' | 'submit';
2
2
  export type ButtonTargetType = 'self' | 'blank';
3
3
  export type ButtonSizeType = 'sm' | 'md' | 'lg' | 'xl';
4
+ export type TabSizeType = 'sm' | 'md';
4
5
  export type ButtonIconPositionType = 'left' | 'right';
5
6
  export type ButtonVariantType = 'ai' | 'apple' | 'dark' | 'error' | 'google' | 'info' | 'light' | 'primary' | 'secondary' | 'success' | 'warning';
6
7
  export type ButtonDropdownVariantType = 'ai' | 'dark' | 'error' | 'info' | 'light' | 'primary' | 'secondary' | 'success' | 'warning';
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2025-06-23T13:28:32",
2
+ "timestamp": "2026-01-16T12:28:24",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.27.2",
@@ -425,7 +425,7 @@
425
425
  "path": "src/type/variant.ts"
426
426
  },
427
427
  "src/components/mds-chip/meta/interface.ts::MdsChipEvent": {
428
- "declaration": "interface MdsChipEvent {\n event: Event\n element: HTMLMdsChipElement\n}",
428
+ "declaration": "interface MdsChipEvent {\n event: Event\n selected?: boolean\n element: HTMLMdsChipElement\n}",
429
429
  "docstring": "",
430
430
  "path": "src/components/mds-chip/meta/interface.ts"
431
431
  },
@@ -679,6 +679,11 @@
679
679
  "docstring": "",
680
680
  "path": "src/components/mds-policy-ai/meta/types.ts"
681
681
  },
682
+ "src/type/button.ts::TabSizeType": {
683
+ "declaration": "export type TabSizeType =\n | 'sm'\n | 'md'",
684
+ "docstring": "",
685
+ "path": "src/type/button.ts"
686
+ },
682
687
  "src/components/mds-pref-animation/meta/types.ts::AnimationModeType": {
683
688
  "declaration": "export type AnimationModeType =\n | 'reduce'\n | 'no-preference'\n | 'system'",
684
689
  "docstring": "",
@@ -759,6 +764,11 @@
759
764
  "docstring": "",
760
765
  "path": "src/components/mds-radial-menu/meta/types.ts"
761
766
  },
767
+ "src/components.d.ts::ModalOverflowType": {
768
+ "declaration": "any",
769
+ "docstring": "",
770
+ "path": "src/components.d.ts"
771
+ },
762
772
  "src/components/mds-stepper-bar/meta/event-detail.ts::MdsStepperBarEventDetail": {
763
773
  "declaration": "export interface MdsStepperBarEventDetail {\n step: number\n value: string\n}",
764
774
  "docstring": "",
@@ -769,6 +779,11 @@
769
779
  "docstring": "",
770
780
  "path": "src/components/mds-stepper-bar-item/meta/event-detail.ts"
771
781
  },
782
+ "src/components/mds-tab/meta/type.ts::DirectionType": {
783
+ "declaration": "export type DirectionType =\n | 'horizontal'\n | 'vertical'",
784
+ "docstring": "",
785
+ "path": "src/components/mds-tab/meta/type.ts"
786
+ },
772
787
  "src/type/animation.ts::HorizontalActionsAnimationType": {
773
788
  "declaration": "export type HorizontalActionsAnimationType =\n | 'fade'\n | 'slide'",
774
789
  "docstring": "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maggioli-design-system/mds-push-notification",
3
- "version": "5.2.0",
3
+ "version": "5.2.2",
4
4
  "description": "mds-push-notification is a web-component from Magma Design System, built with StencilJS, TypeScript, Storybook. It's based on the web-component standard and it's designed to be agnostic from the JavaScript framework you are using.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -24,7 +24,7 @@
24
24
  "test": "stencil test --spec --e2e"
25
25
  },
26
26
  "dependencies": {
27
- "@maggioli-design-system/mds-push-notification-item": "1.2.0",
27
+ "@maggioli-design-system/mds-push-notification-item": "1.2.2",
28
28
  "@maggioli-design-system/styles": "15.11.0",
29
29
  "@stencil/core": "4.27.2",
30
30
  "clsx": "2.1.0"
@@ -41,15 +41,17 @@ export class Locale {
41
41
 
42
42
  update = (doc?: Document | ShadowRoot): void => {
43
43
  const context = doc ?? this.element.shadowRoot
44
- context && context.querySelectorAll('*').forEach(el => {
45
- if (el.tagName.toLowerCase().startsWith('mds-')) {
46
- // eslint-disable-next-line no-restricted-syntax
47
- if (el && 'updateLang' in el) {
48
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
- (el as any).updateLang()
44
+ if (context) {
45
+ context.querySelectorAll('*').forEach(el => {
46
+ if (el.tagName.toLowerCase().startsWith('mds-')) {
47
+ // eslint-disable-next-line no-restricted-syntax
48
+ if (el && 'updateLang' in el) {
49
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
+ (el as any).updateLang()
51
+ }
50
52
  }
51
- }
52
- })
53
+ })
54
+ }
53
55
  }
54
56
 
55
57
  private pluralize = (tag: string | string[], context: Record<string, string | number | boolean>): string => {
@@ -28,8 +28,20 @@ const hasSlotted = (el: HTMLElement, name?: string): boolean => {
28
28
  return false
29
29
  }
30
30
 
31
+ const hasSlottedContent = (el: HTMLElement, name?: string): boolean => {
32
+ const query = name ? `slot[name="${name}"]` : 'slot:not([name])'
33
+ const slot: HTMLSlotElement = el.shadowRoot?.querySelector(query) as HTMLSlotElement
34
+ if (!slot) return false
35
+
36
+ const assignedNodes = slot.assignedNodes({ flatten: true })
37
+ return assignedNodes.some(node =>
38
+ node.nodeType === Node.TEXT_NODE && node.textContent?.trim() !== '',
39
+ )
40
+ }
41
+
31
42
  export {
32
43
  hasSlottedElements,
33
44
  hasSlottedNodes,
45
+ hasSlottedContent,
34
46
  hasSlotted,
35
47
  }