@maggioli-design-system/mds-accordion-timer-item 4.2.0 → 4.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.
@@ -0,0 +1,7 @@
1
+ const isSafari = () => {
2
+ if (navigator) {
3
+ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
4
+ }
5
+ return false;
6
+ };
7
+ export { isSafari, };
@@ -65,6 +65,23 @@ export class FloatingController {
65
65
  return { transformOrigin: 'center top' };
66
66
  }
67
67
  };
68
+ this.convertToTransformOrigin = (position) => {
69
+ const positions = {
70
+ top: 'center bottom',
71
+ right: 'left center',
72
+ bottom: 'center top',
73
+ left: 'right center',
74
+ 'bottom-end': 'top right',
75
+ 'bottom-start': 'top left',
76
+ 'left-end': 'right bottom',
77
+ 'left-start': 'right top',
78
+ 'right-end': 'left bottom',
79
+ 'right-start': 'left top',
80
+ 'top-end': 'bottom right',
81
+ 'top-start': 'bottom left',
82
+ };
83
+ return positions[position];
84
+ };
68
85
  this.calculatePosition = () => {
69
86
  if (!this._caller)
70
87
  return;
@@ -99,6 +116,8 @@ export class FloatingController {
99
116
  Object.assign(this._host.style, {
100
117
  left: `${x}px`,
101
118
  top: `${y}px`,
119
+ transformOrigin: this.convertToTransformOrigin(placement),
120
+ position: this._host.strategy,
102
121
  });
103
122
  const arrowStyle = {};
104
123
  const arrowPosition = {
@@ -133,12 +152,14 @@ export class FloatingController {
133
152
  return caller;
134
153
  }
135
154
  updatePosition() {
136
- if (this.cleanupAutoUpdate)
137
- this.cleanupAutoUpdate();
138
- this.cleanupAutoUpdate = autoUpdate(this._caller, this._host, this.calculatePosition);
155
+ if (this._host.visible) {
156
+ this.dismiss(); // to clean the old update function before update function
157
+ this.cleanupAutoUpdate = autoUpdate(this._caller, this._host, this.calculatePosition);
158
+ }
139
159
  }
140
160
  dismiss() {
141
- this.cleanupAutoUpdate();
161
+ if (this.cleanupAutoUpdate)
162
+ this.cleanupAutoUpdate();
142
163
  }
143
164
  }
144
165
  export class Backdrop {
@@ -22,8 +22,9 @@ export class KeyboardManager {
22
22
  this.elements.delete(name);
23
23
  };
24
24
  this.attachClickBehavior = (name = 'element') => {
25
- var _a;
26
- (_a = this.elements.get(name)) === null || _a === void 0 ? void 0 : _a.addEventListener('keydown', this.handleClickBehaviorDispatchEvent);
25
+ var _a, _b;
26
+ (_a = this.elements.get(name)) === null || _a === void 0 ? void 0 : _a.removeEventListener('keydown', this.handleClickBehaviorDispatchEvent);
27
+ (_b = this.elements.get(name)) === null || _b === void 0 ? void 0 : _b.addEventListener('keydown', this.handleClickBehaviorDispatchEvent);
27
28
  };
28
29
  this.detachClickBehavior = (name = 'element') => {
29
30
  var _a;
@@ -7,6 +7,8 @@ const buttonVariantDictionary = [
7
7
  'secondary',
8
8
  'success',
9
9
  'warning',
10
+ 'google',
11
+ 'apple',
10
12
  ];
11
13
  const buttonToneVariantDictionary = [
12
14
  'strong',
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2025-03-05T16:35:56",
2
+ "timestamp": "2025-04-02T09:44:44",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.27.2",
package/dist/stats.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2025-03-05T16:35:56",
2
+ "timestamp": "2025-04-02T09:44:44",
3
3
  "compiler": {
4
4
  "name": "node",
5
5
  "version": "22.11.0"
@@ -9,13 +9,14 @@
9
9
  "fsNamespace": "mds-accordion-timer-item",
10
10
  "components": 1,
11
11
  "entries": 1,
12
- "bundles": 102,
12
+ "bundles": 104,
13
13
  "outputs": [
14
14
  {
15
15
  "name": "dist-collection",
16
- "files": 54,
16
+ "files": 56,
17
17
  "generatedFiles": [
18
18
  "./dist/collection/common/aria.js",
19
+ "./dist/collection/common/browser.js",
19
20
  "./dist/collection/common/date.js",
20
21
  "./dist/collection/common/device.js",
21
22
  "./dist/collection/common/file.js",
@@ -60,6 +61,7 @@
60
61
  "./dist/collection/type/floating-ui.js",
61
62
  "./dist/collection/type/form-rel.js",
62
63
  "./dist/collection/type/header-bar.js",
64
+ "./dist/collection/type/input-tip.js",
63
65
  "./dist/collection/type/input.js",
64
66
  "./dist/collection/type/keyboard.js",
65
67
  "./dist/collection/type/loading.js",
@@ -938,6 +940,7 @@
938
940
  },
939
941
  "sourceGraph": {
940
942
  "./src/common/aria.ts": [],
943
+ "./src/common/browser.ts": [],
941
944
  "./src/common/date.ts": [],
942
945
  "./src/common/device.ts": [],
943
946
  "./src/common/file.ts": [],
@@ -997,6 +1000,7 @@
997
1000
  "./src/type/floating-ui.ts": [],
998
1001
  "./src/type/form-rel.ts": [],
999
1002
  "./src/type/header-bar.ts": [],
1003
+ "./src/type/input-tip.ts": [],
1000
1004
  "./src/type/input.ts": [],
1001
1005
  "./src/type/keyboard.ts": [],
1002
1006
  "./src/type/loading.ts": [],
@@ -0,0 +1,2 @@
1
+ declare const isSafari: () => boolean;
2
+ export { isSafari, };
@@ -27,6 +27,7 @@ export declare class FloatingController {
27
27
  private readonly arrowInset;
28
28
  private readonly arrowTransform;
29
29
  private readonly arrowTransformOrigin;
30
+ private convertToTransformOrigin;
30
31
  private readonly calculatePosition;
31
32
  updatePosition(): void;
32
33
  dismiss(): void;
@@ -15,6 +15,6 @@ export declare class Locale {
15
15
  lang: (el: HTMLElement) => string;
16
16
  update: (doc?: Document | ShadowRoot) => void;
17
17
  private pluralize;
18
- get: (tag: string | string[], context?: Record<string, string | number>) => string;
18
+ get: (tag: string | string[], context?: Record<string, string | number | boolean>) => string;
19
19
  }
20
20
  export {};
@@ -2,4 +2,4 @@ export type ButtonType = 'a' | 'button' | 'reset' | 'submit';
2
2
  export type ButtonTargetType = 'self' | 'blank';
3
3
  export type ButtonSizeType = 'sm' | 'md' | 'lg' | 'xl';
4
4
  export type ButtonIconPositionType = 'left' | 'right';
5
- export type ButtonVariantType = 'primary' | 'secondary' | 'dark' | 'light' | 'error' | 'info' | 'success' | 'warning';
5
+ export type ButtonVariantType = 'primary' | 'secondary' | 'dark' | 'light' | 'error' | 'info' | 'success' | 'warning' | 'google' | 'apple';
@@ -0,0 +1 @@
1
+ export type InputTipItemVariantType = 'count-almost' | 'count-almost-full' | 'count-empty' | 'count-full' | 'count-incomplete' | 'disabled' | 'readonly' | 'required' | 'required-success' | 'text';
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2025-03-05T16:16:01",
2
+ "timestamp": "2025-04-02T08:30:40",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.27.2",
@@ -468,7 +468,7 @@
468
468
  "path": "src/type/button.ts"
469
469
  },
470
470
  "src/type/button.ts::ButtonVariantType": {
471
- "declaration": "export type ButtonVariantType =\n | 'primary'\n | 'secondary'\n | 'dark'\n | 'light'\n | 'error'\n | 'info'\n | 'success'\n | 'warning'",
471
+ "declaration": "export type ButtonVariantType =\n | 'primary'\n | 'secondary'\n | 'dark'\n | 'light'\n | 'error'\n | 'info'\n | 'success'\n | 'warning'\n | 'google'\n | 'apple'",
472
472
  "docstring": "",
473
473
  "path": "src/type/button.ts"
474
474
  },
@@ -567,6 +567,11 @@
567
567
  "docstring": "",
568
568
  "path": "src/components/mds-horizontal-scroll/meta/types.ts"
569
569
  },
570
+ "src/components/mds-horizontal-scroll/meta/types.ts::NavigationType": {
571
+ "declaration": "export type NavigationType =\n | 'none'\n | 'scrollbar'\n | 'position'",
572
+ "docstring": "",
573
+ "path": "src/components/mds-horizontal-scroll/meta/types.ts"
574
+ },
570
575
  "src/components/mds-horizontal-scroll/meta/types.ts::SnapType": {
571
576
  "declaration": "export type SnapType =\n | 'center'\n | 'end'\n | 'none'\n | 'start'",
572
577
  "docstring": "",
@@ -662,10 +667,10 @@
662
667
  "docstring": "",
663
668
  "path": "src/components/mds-input-tip/meta/types.ts"
664
669
  },
665
- "src/components/mds-input-tip-item/meta/types.ts::InputTipItemVariantType": {
666
- "declaration": "export type InputTipItemVariantType =\n | 'required'\n | 'required-success'\n | 'disabled'\n | 'readonly'\n | 'text'",
670
+ "src/type/input-tip.ts::InputTipItemVariantType": {
671
+ "declaration": "export type InputTipItemVariantType =\n | 'count-almost'\n | 'count-almost-full'\n | 'count-empty'\n | 'count-full'\n | 'count-incomplete'\n | 'disabled'\n | 'readonly'\n | 'required'\n | 'required-success'\n | 'text'",
667
672
  "docstring": "",
668
- "path": "src/components/mds-input-tip-item/meta/types.ts"
673
+ "path": "src/type/input-tip.ts"
669
674
  },
670
675
  "src/components/mds-input-upload/meta/types.ts::AttachmentSort": {
671
676
  "declaration": "type AttachmentSort =\n 'status' |\n 'date'",
@@ -707,6 +712,11 @@
707
712
  "docstring": "",
708
713
  "path": "src/components/mds-modal/meta/types.ts"
709
714
  },
715
+ "src/components/mds-modal/meta/types.ts::ModalAnimationStyleType": {
716
+ "declaration": "export type ModalAnimationStyleType =\n | 'slide'\n | 'custom'\n | '3d'",
717
+ "docstring": "",
718
+ "path": "src/components/mds-modal/meta/types.ts"
719
+ },
710
720
  "src/components/mds-modal/meta/types.ts::ModalOverflowType": {
711
721
  "declaration": "export type ModalOverflowType =\n | 'auto'\n | 'manual'",
712
722
  "docstring": "",
@@ -772,20 +782,25 @@
772
782
  "docstring": "",
773
783
  "path": "src/components/mds-progress/meta/types.ts"
774
784
  },
775
- "src/components/mds-push-notification/meta/types.ts::NotificationDateFormatType": {
785
+ "src/components/mds-push-notification/meta/event-detail.ts::MdsPushNotificationEventDetail": {
786
+ "declaration": "export interface MdsPushNotificationEventDetail {\n visible: boolean\n}",
787
+ "docstring": "",
788
+ "path": "src/components/mds-push-notification/meta/event-detail.ts"
789
+ },
790
+ "src/components/mds-push-notification-item/meta/types.ts::NotificationItemDateFormatType": {
776
791
  "declaration": "string",
777
792
  "docstring": "",
778
- "path": "src/components/mds-push-notification/meta/types.ts"
793
+ "path": "src/components/mds-push-notification-item/meta/types.ts"
779
794
  },
780
- "src/components/mds-push-notification/meta/types.ts::NotificationPreviewType": {
781
- "declaration": "export type NotificationPreviewType =\n | 'avatar'\n | 'image'",
795
+ "src/components/mds-push-notification-item/meta/types.ts::NotificationItemPreviewType": {
796
+ "declaration": "export type NotificationItemPreviewType =\n | 'avatar'\n | 'image'",
782
797
  "docstring": "",
783
- "path": "src/components/mds-push-notification/meta/types.ts"
798
+ "path": "src/components/mds-push-notification-item/meta/types.ts"
784
799
  },
785
- "src/components/mds-push-notification/meta/event-detail.ts::MdsPushNotificationEventDetail": {
786
- "declaration": "export interface MdsPushNotificationEventDetail {\n id: string;\n}",
800
+ "src/components/mds-push-notification-item/meta/event-detail.ts::MdsPushNotificationItemEventDetail": {
801
+ "declaration": "export interface MdsPushNotificationItemEventDetail {\n id: string;\n}",
787
802
  "docstring": "",
788
- "path": "src/components/mds-push-notification/meta/event-detail.ts"
803
+ "path": "src/components/mds-push-notification-item/meta/event-detail.ts"
789
804
  },
790
805
  "src/type/text.ts::TypographyHeadingTagType": {
791
806
  "declaration": "export type TypographyHeadingTagType =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'h4'\n | 'h5'\n | 'h6'",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maggioli-design-system/mds-accordion-timer-item",
3
- "version": "4.2.0",
3
+ "version": "4.2.2",
4
4
  "description": "mds-accordion-timer-item 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,9 +24,9 @@
24
24
  "test": "stencil test --spec --e2e"
25
25
  },
26
26
  "dependencies": {
27
- "@maggioli-design-system/mds-progress": "3.2.0",
28
- "@maggioli-design-system/mds-text": "4.7.0",
29
- "@maggioli-design-system/styles": "15.9.0",
27
+ "@maggioli-design-system/mds-progress": "3.2.1",
28
+ "@maggioli-design-system/mds-text": "4.7.2",
29
+ "@maggioli-design-system/styles": "15.9.1",
30
30
  "@stencil/core": "4.27.2"
31
31
  },
32
32
  "license": "MIT",
@@ -0,0 +1,10 @@
1
+ const isSafari = (): boolean => {
2
+ if (navigator) {
3
+ return /^((?!chrome|android).)*safari/i.test(navigator.userAgent)
4
+ }
5
+ return false
6
+ }
7
+
8
+ export {
9
+ isSafari,
10
+ }
@@ -7,6 +7,7 @@ import {
7
7
  Middleware,
8
8
  MiddlewareData,
9
9
  offset,
10
+ Placement,
10
11
  shift,
11
12
  } from '@floating-ui/dom'
12
13
  import { FloatingUIPlacement, FloatingUIStrategy } from '@type/floating-ui'
@@ -138,6 +139,24 @@ export class FloatingController {
138
139
  }
139
140
  }
140
141
 
142
+ private convertToTransformOrigin = (position: Placement): string => {
143
+ const positions = {
144
+ top: 'center bottom',
145
+ right: 'left center',
146
+ bottom: 'center top',
147
+ left: 'right center',
148
+ 'bottom-end': 'top right',
149
+ 'bottom-start': 'top left',
150
+ 'left-end': 'right bottom',
151
+ 'left-start': 'right top',
152
+ 'right-end': 'left bottom',
153
+ 'right-start': 'left top',
154
+ 'top-end': 'bottom right',
155
+ 'top-start': 'bottom left',
156
+ }
157
+ return positions[position]
158
+ }
159
+
141
160
  private readonly calculatePosition = (): void => {
142
161
  if (!this._caller) return
143
162
 
@@ -181,6 +200,8 @@ export class FloatingController {
181
200
  Object.assign(this._host.style, {
182
201
  left: `${x}px`,
183
202
  top: `${y}px`,
203
+ transformOrigin: this.convertToTransformOrigin(placement),
204
+ position: this._host.strategy,
184
205
  })
185
206
 
186
207
  const arrowStyle = {}
@@ -204,12 +225,14 @@ export class FloatingController {
204
225
  }
205
226
 
206
227
  updatePosition (): void {
207
- if (this.cleanupAutoUpdate) this.cleanupAutoUpdate()
208
- this.cleanupAutoUpdate = autoUpdate(this._caller, this._host, this.calculatePosition)
228
+ if (this._host.visible) {
229
+ this.dismiss() // to clean the old update function before update function
230
+ this.cleanupAutoUpdate = autoUpdate(this._caller, this._host, this.calculatePosition)
231
+ }
209
232
  }
210
233
 
211
234
  dismiss (): void {
212
- this.cleanupAutoUpdate()
235
+ if (this.cleanupAutoUpdate) this.cleanupAutoUpdate()
213
236
  }
214
237
  }
215
238
 
@@ -27,6 +27,7 @@ export class KeyboardManager {
27
27
  }
28
28
 
29
29
  attachClickBehavior = (name = 'element'): void => {
30
+ this.elements.get(name)?.removeEventListener('keydown', this.handleClickBehaviorDispatchEvent)
30
31
  this.elements.get(name)?.addEventListener('keydown', this.handleClickBehaviorDispatchEvent)
31
32
  }
32
33
 
@@ -52,7 +52,7 @@ export class Locale {
52
52
  })
53
53
  }
54
54
 
55
- private pluralize = (tag: string | string[], context: Record<string, string | number>): string => {
55
+ private pluralize = (tag: string | string[], context: Record<string, string | number | boolean>): string => {
56
56
 
57
57
  const languagePhrase: string | string[] = this.config[this.language] ? this.config[this.language][tag] : this.config[this.rollbackLanguage][tag]
58
58
  const phrases: string[] = []
@@ -81,7 +81,7 @@ export class Locale {
81
81
  return render(translatePhrase, context)
82
82
  }
83
83
 
84
- get = (tag: string | string[], context?: Record<string, string | number>): string => {
84
+ get = (tag: string | string[], context?: Record<string, string | number | boolean>): string => {
85
85
  if (context) {
86
86
  return this.pluralize(tag, context)
87
87
  }
@@ -7,6 +7,8 @@ const buttonVariantDictionary = [
7
7
  'secondary',
8
8
  'success',
9
9
  'warning',
10
+ 'google',
11
+ 'apple',
10
12
  ]
11
13
 
12
14
  const buttonToneVariantDictionary = [
@@ -1,5 +1,6 @@
1
1
  [
2
2
  "mdi/alien",
3
+ "mdi/apple",
3
4
  "mdi/apple-keyboard-shift",
4
5
  "mdi/barley",
5
6
  "mdi/baseball",
@@ -7,6 +8,7 @@
7
8
  "mdi/delete",
8
9
  "mdi/dots-vertical",
9
10
  "mdi/email",
11
+ "mdi/eye-off-outline",
10
12
  "mdi/file-document-remove-outline",
11
13
  "mdi/file-download-outline",
12
14
  "mdi/file-upload-outline",
@@ -52,6 +54,7 @@
52
54
  "mgg/ai-status-suspended",
53
55
  "mgg/alerts-pagopa",
54
56
  "mgg/anagrafe-nazionale",
57
+ "mgg/anist",
55
58
  "mgg/anpr",
56
59
  "mgg/ansc",
57
60
  "mgg/area-edificabile",
@@ -336,12 +339,14 @@
336
339
  "mi/baseline/audiotrack",
337
340
  "mi/baseline/auto-awesome",
338
341
  "mi/baseline/badge",
342
+ "mi/baseline/block",
339
343
  "mi/baseline/book",
340
344
  "mi/baseline/border-all",
341
345
  "mi/baseline/broken-image",
342
346
  "mi/baseline/call",
343
347
  "mi/baseline/cancel",
344
348
  "mi/baseline/category",
349
+ "mi/baseline/check",
345
350
  "mi/baseline/check-box",
346
351
  "mi/baseline/check-box-outline-blank",
347
352
  "mi/baseline/check-circle",
@@ -361,6 +366,7 @@
361
366
  "mi/baseline/eco",
362
367
  "mi/baseline/email",
363
368
  "mi/baseline/error",
369
+ "mi/baseline/expand-more",
364
370
  "mi/baseline/explore",
365
371
  "mi/baseline/favorite",
366
372
  "mi/baseline/favorite-border",
@@ -398,6 +404,7 @@
398
404
  "mi/baseline/radio-button-unchecked",
399
405
  "mi/baseline/remove",
400
406
  "mi/baseline/remove-circle",
407
+ "mi/baseline/remove-red-eye",
401
408
  "mi/baseline/route",
402
409
  "mi/baseline/send",
403
410
  "mi/baseline/settings",
@@ -408,6 +415,7 @@
408
415
  "mi/baseline/terminal",
409
416
  "mi/baseline/timer",
410
417
  "mi/baseline/tv",
418
+ "mi/baseline/undo",
411
419
  "mi/baseline/unfold-less",
412
420
  "mi/baseline/unfold-more",
413
421
  "mi/baseline/vertical-align-bottom",
@@ -32,6 +32,7 @@
32
32
  "mgg/ai-status-suspended",
33
33
  "mgg/alerts-pagopa",
34
34
  "mgg/anagrafe-nazionale",
35
+ "mgg/anist",
35
36
  "mgg/anpr",
36
37
  "mgg/ansc",
37
38
  "mgg/area-edificabile",
@@ -27,3 +27,5 @@ export type ButtonVariantType =
27
27
  | 'info'
28
28
  | 'success'
29
29
  | 'warning'
30
+ | 'google'
31
+ | 'apple'
@@ -0,0 +1,11 @@
1
+ export type InputTipItemVariantType =
2
+ | 'count-almost'
3
+ | 'count-almost-full'
4
+ | 'count-empty'
5
+ | 'count-full'
6
+ | 'count-incomplete'
7
+ | 'disabled'
8
+ | 'readonly'
9
+ | 'required'
10
+ | 'required-success'
11
+ | 'text'