@maggioli-design-system/mds-table-row 5.0.0 → 5.0.1

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 (57) hide show
  1. package/dist/cjs/{index-41069a63.js → index-cb928c36.js} +161 -66
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/mds-table-row.cjs.entry.js +2 -7
  4. package/dist/cjs/mds-table-row.cjs.js +2 -2
  5. package/dist/collection/collection-manifest.json +1 -1
  6. package/dist/collection/common/floating-controller.js +180 -0
  7. package/dist/collection/common/slot.js +10 -4
  8. package/dist/collection/components/mds-table-row/mds-table-row.js +11 -6
  9. package/dist/collection/dictionary/tree.js +13 -0
  10. package/dist/collection/type/tree.js +1 -0
  11. package/dist/components/mds-table-row.js +1 -6
  12. package/dist/documentation.d.ts +8 -0
  13. package/dist/documentation.json +17 -7
  14. package/dist/esm/{index-b3683315.js → index-8134a00a.js} +161 -66
  15. package/dist/esm/loader.js +2 -2
  16. package/dist/esm/mds-table-row.entry.js +2 -7
  17. package/dist/esm/mds-table-row.js +3 -3
  18. package/dist/esm-es5/index-8134a00a.js +1 -0
  19. package/dist/esm-es5/loader.js +1 -1
  20. package/dist/esm-es5/mds-table-row.entry.js +2 -2
  21. package/dist/esm-es5/mds-table-row.js +1 -1
  22. package/dist/mds-table-row/mds-table-row.esm.js +1 -1
  23. package/dist/mds-table-row/mds-table-row.js +1 -1
  24. package/dist/mds-table-row/p-11048c96.system.js +1 -0
  25. package/dist/mds-table-row/p-22d4881a.js +2 -0
  26. package/dist/mds-table-row/p-827e2f31.entry.js +6 -0
  27. package/dist/mds-table-row/p-88f814c9.system.js +2 -0
  28. package/{www/build/p-6e0586ed.system.entry.js → dist/mds-table-row/p-ed03fa5e.system.entry.js} +2 -2
  29. package/dist/stats.json +72 -42
  30. package/dist/types/common/floating-controller.d.ts +46 -0
  31. package/dist/types/common/slot.d.ts +2 -1
  32. package/dist/types/dictionary/tree.d.ts +4 -0
  33. package/dist/types/type/tree.d.ts +3 -0
  34. package/documentation.json +42 -12
  35. package/package.json +4 -4
  36. package/src/common/floating-controller.ts +263 -0
  37. package/src/common/slot.ts +12 -3
  38. package/src/dictionary/tree.ts +21 -0
  39. package/src/fixtures/icons.json +20 -0
  40. package/src/fixtures/iconsauce.json +6 -0
  41. package/src/type/tree.ts +12 -0
  42. package/www/build/mds-table-row.esm.js +1 -1
  43. package/www/build/mds-table-row.js +1 -1
  44. package/www/build/p-11048c96.system.js +1 -0
  45. package/www/build/p-22d4881a.js +2 -0
  46. package/www/build/p-827e2f31.entry.js +6 -0
  47. package/www/build/p-88f814c9.system.js +2 -0
  48. package/{dist/mds-table-row/p-6e0586ed.system.entry.js → www/build/p-ed03fa5e.system.entry.js} +2 -2
  49. package/dist/esm-es5/index-b3683315.js +0 -1
  50. package/dist/mds-table-row/p-883b6082.entry.js +0 -6
  51. package/dist/mds-table-row/p-94f5e1a3.system.js +0 -2
  52. package/dist/mds-table-row/p-953317ff.js +0 -2
  53. package/dist/mds-table-row/p-ca6821e0.system.js +0 -1
  54. package/www/build/p-883b6082.entry.js +0 -6
  55. package/www/build/p-94f5e1a3.system.js +0 -2
  56. package/www/build/p-953317ff.js +0 -2
  57. package/www/build/p-ca6821e0.system.js +0 -1
@@ -0,0 +1,180 @@
1
+ import { arrow, autoPlacement, autoUpdate, computePosition, flip, offset, shift, } from "@floating-ui/dom";
2
+ import { cssDurationToMilliseconds } from "./unit";
3
+ import { setAttributeIfEmpty } from "./aria";
4
+ export class FloatingController {
5
+ constructor(host, arrowEl) {
6
+ this.arrowInset = (middleware, arrowPosition) => {
7
+ const { arrow } = middleware;
8
+ const inset = { bottom: '', left: '', right: '', top: '' };
9
+ if (arrow === undefined) {
10
+ return {};
11
+ }
12
+ switch (arrowPosition) {
13
+ case 'bottom':
14
+ inset.left = arrow.x !== null ? `${arrow.x}px` : '';
15
+ inset.top = '100%';
16
+ break;
17
+ case 'left':
18
+ inset.right = '100%';
19
+ inset.top = arrow.y !== null ? `${arrow.y}px` : '';
20
+ break;
21
+ case 'right':
22
+ inset.left = '100%';
23
+ inset.top = arrow.y !== null ? `${arrow.y}px` : '';
24
+ break;
25
+ case 'top':
26
+ inset.left = arrow.x !== null ? `${arrow.x}px` : '';
27
+ inset.top = '';
28
+ break;
29
+ default:
30
+ break;
31
+ }
32
+ return inset;
33
+ };
34
+ this.arrowTransform = (arrowPosition) => {
35
+ let transformProps = this._host.arrow && this._host.visible ? 'scale(1)' : 'scale(0)';
36
+ switch (arrowPosition) {
37
+ case 'bottom':
38
+ transformProps = `rotate(180deg) ${transformProps} translate(0, -100%)`;
39
+ break;
40
+ case 'left':
41
+ transformProps = `rotate(-90deg) ${transformProps} translate(50%, -50%)`;
42
+ break;
43
+ case 'right':
44
+ transformProps = `rotate(90deg) ${transformProps} translate(-50%, -50%)`;
45
+ break;
46
+ case 'top':
47
+ transformProps = `rotate(0deg) ${transformProps} translate(0, 0)`;
48
+ break;
49
+ default:
50
+ break;
51
+ }
52
+ return { transform: transformProps };
53
+ };
54
+ this.arrowTransformOrigin = (arrowPosition) => {
55
+ switch (arrowPosition) {
56
+ case 'bottom':
57
+ return { transformOrigin: 'center top' };
58
+ case 'left':
59
+ return { transformOrigin: 'right center' };
60
+ case 'right':
61
+ return { transformOrigin: 'left center' };
62
+ case 'top':
63
+ return { transformOrigin: 'center bottom' };
64
+ default:
65
+ return { transformOrigin: 'center top' };
66
+ }
67
+ };
68
+ this.calculatePosition = () => {
69
+ if (!this._caller)
70
+ return;
71
+ const middleware = new Array();
72
+ const config = {};
73
+ if (this._host.shiftPadding) {
74
+ config.padding = this._host.shiftPadding;
75
+ }
76
+ if (this._host.autoPlacement) {
77
+ middleware.push(autoPlacement());
78
+ }
79
+ if (this._host.offset) {
80
+ middleware.push(offset(this._host.offset));
81
+ }
82
+ if (!this._host.autoPlacement && this._host.flip) {
83
+ middleware.push(flip(config));
84
+ }
85
+ if (this._host.shift) {
86
+ middleware.push(shift(config));
87
+ }
88
+ if (this.arrowEl && this._host.arrow) {
89
+ middleware.push(arrow({
90
+ element: this.arrowEl,
91
+ padding: this._host.arrowPadding,
92
+ }));
93
+ }
94
+ computePosition(this._caller, this._host, {
95
+ middleware,
96
+ placement: this._host.placement,
97
+ strategy: this._host.strategy,
98
+ }).then(({ x, y, placement, middlewareData }) => {
99
+ Object.assign(this._host.style, {
100
+ left: `${x}px`,
101
+ top: `${y}px`,
102
+ });
103
+ const arrowStyle = {};
104
+ const arrowPosition = {
105
+ top: 'bottom',
106
+ right: 'left',
107
+ bottom: 'top',
108
+ left: 'right',
109
+ }[placement.split('-')[0]];
110
+ if (arrowPosition && this.arrowEl) {
111
+ Object.assign(arrowStyle, this.arrowTransform(arrowPosition));
112
+ Object.assign(arrowStyle, this.arrowInset(middlewareData, arrowPosition));
113
+ Object.assign(arrowStyle, this.arrowTransformOrigin(arrowPosition));
114
+ Object.assign(this.arrowEl.style, arrowStyle);
115
+ }
116
+ });
117
+ };
118
+ this._host = host;
119
+ this.arrowEl = arrowEl;
120
+ }
121
+ updateCaller(target) {
122
+ var _a, _b, _c;
123
+ // search caller in document or rootNode of host (if target is in shadowDOM)
124
+ const caller = (_c = (_b = (_a = this._host.parentElement) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector(target)) !== null && _c !== void 0 ? _c : this._host.getRootNode().querySelector(target);
125
+ if (!caller) {
126
+ throw Error(`Target not found: ${target}`);
127
+ }
128
+ this._caller = caller;
129
+ setAttributeIfEmpty(this._caller, 'aria-haspopup', 'true');
130
+ setAttributeIfEmpty(this._caller, 'aria-controls', target);
131
+ setAttributeIfEmpty(this._host, 'role', 'menu');
132
+ setAttributeIfEmpty(this._host, 'aria-labelledby', target);
133
+ return caller;
134
+ }
135
+ updatePosition() {
136
+ if (this.cleanupAutoUpdate)
137
+ this.cleanupAutoUpdate();
138
+ this.cleanupAutoUpdate = autoUpdate(this._caller, this._host, this.calculatePosition);
139
+ }
140
+ dismiss() {
141
+ this.cleanupAutoUpdate();
142
+ }
143
+ }
144
+ export class Backdrop {
145
+ constructor(backdropId) {
146
+ this.defaultBackdropId = 'mds-backdrop';
147
+ this.backdropBackgroundVisible = 'rgba(var(--magma-backdrop-color, 0 0 0) / var(--magma-backdrop-opacity, 0.1))';
148
+ this.backdropBackgroundHidden = 'rgba(var(--magma-backdrop-color, 0 0 0) / 0)';
149
+ this.backdropId = backdropId !== null && backdropId !== void 0 ? backdropId : this.defaultBackdropId;
150
+ this.cssBackdropZIndex = `var(--${this.backdropId}-z-index)`;
151
+ this.cssBackdropDuration = `var(--${this.backdropId}-duration)`;
152
+ }
153
+ attachBackdrop() {
154
+ if (!this.backdropEl) {
155
+ this.backdropEl = document.createElement('div');
156
+ this.backdropEl.className = this.backdropId;
157
+ this.backdropEl.style.inset = '0';
158
+ this.backdropEl.style.pointerEvents = 'none';
159
+ this.backdropEl.style.position = 'fixed';
160
+ this.backdropEl.style.transition = `background-color ${this.cssBackdropDuration} ease-out`;
161
+ this.backdropEl.style.zIndex = this.cssBackdropZIndex;
162
+ }
163
+ this.backdropEl.style.backgroundColor = this.backdropBackgroundHidden;
164
+ document.body.appendChild(this.backdropEl);
165
+ clearTimeout(this.backdropTimer);
166
+ this.backdropTimer = setTimeout(() => {
167
+ this.backdropEl.style.backgroundColor = this.backdropBackgroundVisible;
168
+ }, 1);
169
+ }
170
+ detachBackdrop() {
171
+ if (!this.backdropEl) {
172
+ return;
173
+ }
174
+ this.backdropEl.style.backgroundColor = 'transparent';
175
+ clearTimeout(this.backdropTimer);
176
+ this.backdropTimer = setTimeout(() => {
177
+ this.backdropEl.remove();
178
+ }, cssDurationToMilliseconds(this.cssBackdropDuration));
179
+ }
180
+ }
@@ -1,13 +1,19 @@
1
1
  const hasSlottedElements = (el, name) => {
2
2
  var _a;
3
- let query = 'slot';
4
- if (name) {
5
- query = `slot[name=${name}]`;
3
+ const query = name ? `slot[name="${name}"]` : 'slot:not([name])';
4
+ const slot = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(query);
5
+ if (slot) {
6
+ return slot.assignedElements({ flatten: true }).length > 0;
6
7
  }
8
+ return false;
9
+ };
10
+ const hasSlottedNodes = (el, name) => {
11
+ var _a;
12
+ const query = name ? `slot[name="${name}"]` : 'slot:not([name])';
7
13
  const slot = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector(query);
8
14
  if (slot) {
9
15
  return slot.assignedNodes().length > 0;
10
16
  }
11
17
  return false;
12
18
  };
13
- export { hasSlottedElements, };
19
+ export { hasSlottedElements, hasSlottedNodes, };
@@ -15,17 +15,12 @@ export class MdsTableRow {
15
15
  es: localeEs,
16
16
  it: localeIt,
17
17
  });
18
+ this.selectable = undefined;
18
19
  this.handleSelectionChange = (e) => {
19
20
  var _a;
20
21
  this.selected = e.detail.checked;
21
22
  (_a = this.host.closest('mds-table')) === null || _a === void 0 ? void 0 : _a.updateSelection();
22
23
  };
23
- this.language = undefined;
24
- this.interactive = undefined;
25
- this.overlayActions = undefined;
26
- this.selectable = undefined;
27
- this.selected = undefined;
28
- this.value = undefined;
29
24
  }
30
25
  async updateLang() {
31
26
  this.language = this.t.lang(this.host);
@@ -81,6 +76,8 @@ export class MdsTableRow {
81
76
  "tags": [],
82
77
  "text": ""
83
78
  },
79
+ "getter": false,
80
+ "setter": false,
84
81
  "attribute": "interactive",
85
82
  "reflect": true
86
83
  },
@@ -98,6 +95,8 @@ export class MdsTableRow {
98
95
  "tags": [],
99
96
  "text": ""
100
97
  },
98
+ "getter": false,
99
+ "setter": false,
101
100
  "attribute": "overlay-actions",
102
101
  "reflect": true
103
102
  },
@@ -115,6 +114,8 @@ export class MdsTableRow {
115
114
  "tags": [],
116
115
  "text": ""
117
116
  },
117
+ "getter": false,
118
+ "setter": false,
118
119
  "attribute": "selectable",
119
120
  "reflect": true,
120
121
  "defaultValue": "undefined"
@@ -133,6 +134,8 @@ export class MdsTableRow {
133
134
  "tags": [],
134
135
  "text": ""
135
136
  },
137
+ "getter": false,
138
+ "setter": false,
136
139
  "attribute": "selected",
137
140
  "reflect": true
138
141
  },
@@ -150,6 +153,8 @@ export class MdsTableRow {
150
153
  "tags": [],
151
154
  "text": ""
152
155
  },
156
+ "getter": false,
157
+ "setter": false,
153
158
  "attribute": "value",
154
159
  "reflect": true
155
160
  }
@@ -0,0 +1,13 @@
1
+ const treeActionsDictionary = [
2
+ 'auto',
3
+ 'visible',
4
+ ];
5
+ const treeAppearanceDictionary = [
6
+ 'depth',
7
+ 'none',
8
+ ];
9
+ const treeIconDictionary = [
10
+ 'folder',
11
+ 'chevron',
12
+ ];
13
+ export { treeActionsDictionary, treeAppearanceDictionary, treeIconDictionary, };
@@ -0,0 +1 @@
1
+ export {};
@@ -884,17 +884,12 @@ const MdsTableRow$1 = /*@__PURE__*/ proxyCustomElement(class MdsTableRow extends
884
884
  es: localeEs,
885
885
  it: localeIt,
886
886
  });
887
+ this.selectable = undefined;
887
888
  this.handleSelectionChange = (e) => {
888
889
  var _a;
889
890
  this.selected = e.detail.checked;
890
891
  (_a = this.host.closest('mds-table')) === null || _a === void 0 ? void 0 : _a.updateSelection();
891
892
  };
892
- this.language = undefined;
893
- this.interactive = undefined;
894
- this.overlayActions = undefined;
895
- this.selectable = undefined;
896
- this.selected = undefined;
897
- this.value = undefined;
898
893
  }
899
894
  async updateLang() {
900
895
  this.language = this.t.lang(this.host);
@@ -316,6 +316,14 @@ export interface JsonDocsProp {
316
316
  * ```
317
317
  */
318
318
  required: boolean;
319
+ /**
320
+ * `true` if the prop has a `get()`. `false` otherwise
321
+ */
322
+ getter: boolean;
323
+ /**
324
+ * `true` if the prop has a `set()`. `false` otherwise
325
+ */
326
+ setter: boolean;
319
327
  }
320
328
  export interface JsonDocsMethod {
321
329
  name: string;
@@ -1,8 +1,8 @@
1
1
  {
2
- "timestamp": "2024-12-19T14:55:54",
2
+ "timestamp": "2025-02-06T10:06:36",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
- "version": "4.22.2",
5
+ "version": "4.25.1",
6
6
  "typescriptVersion": "5.5.4"
7
7
  },
8
8
  "components": [
@@ -41,7 +41,9 @@
41
41
  }
42
42
  ],
43
43
  "optional": true,
44
- "required": false
44
+ "required": false,
45
+ "getter": false,
46
+ "setter": false
45
47
  },
46
48
  {
47
49
  "name": "overlayActions",
@@ -62,7 +64,9 @@
62
64
  }
63
65
  ],
64
66
  "optional": false,
65
- "required": false
67
+ "required": false,
68
+ "getter": false,
69
+ "setter": false
66
70
  },
67
71
  {
68
72
  "name": "selectable",
@@ -87,7 +91,9 @@
87
91
  }
88
92
  ],
89
93
  "optional": true,
90
- "required": false
94
+ "required": false,
95
+ "getter": false,
96
+ "setter": false
91
97
  },
92
98
  {
93
99
  "name": "selected",
@@ -111,7 +117,9 @@
111
117
  }
112
118
  ],
113
119
  "optional": true,
114
- "required": false
120
+ "required": false,
121
+ "getter": false,
122
+ "setter": false
115
123
  },
116
124
  {
117
125
  "name": "value",
@@ -138,7 +146,9 @@
138
146
  }
139
147
  ],
140
148
  "optional": true,
141
- "required": false
149
+ "required": false,
150
+ "getter": false,
151
+ "setter": false
142
152
  }
143
153
  ],
144
154
  "methods": [