@maggioli-design-system/mds-paginator-item 2.1.0 → 2.2.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 (63) hide show
  1. package/dist/cjs/{index-788f9a49.js → index-969219be.js} +58 -1
  2. package/dist/cjs/loader.cjs.js +3 -3
  3. package/dist/cjs/mds-paginator-item.cjs.entry.js +59 -4
  4. package/dist/cjs/mds-paginator-item.cjs.js +3 -3
  5. package/dist/collection/collection-manifest.json +1 -1
  6. package/dist/collection/common/keyboard-manager.js +40 -0
  7. package/dist/collection/components/mds-paginator-item/mds-paginator-item.css +38 -26
  8. package/dist/collection/components/mds-paginator-item/mds-paginator-item.js +19 -3
  9. package/dist/collection/dictionary/icon.js +3 -1
  10. package/dist/collection/dictionary/typography.js +5 -1
  11. package/dist/components/mds-paginator-item.js +59 -4
  12. package/dist/esm/{index-21e2f636.js → index-43abfe8a.js} +58 -2
  13. package/dist/esm/loader.js +4 -4
  14. package/dist/esm/mds-paginator-item.entry.js +59 -4
  15. package/dist/esm/mds-paginator-item.js +4 -4
  16. package/dist/esm-es5/index-43abfe8a.js +2 -0
  17. package/dist/esm-es5/loader.js +1 -1
  18. package/dist/esm-es5/mds-paginator-item.entry.js +1 -1
  19. package/dist/esm-es5/mds-paginator-item.js +1 -1
  20. package/dist/mds-paginator-item/mds-paginator-item.esm.js +1 -1
  21. package/dist/mds-paginator-item/mds-paginator-item.js +1 -1
  22. package/dist/mds-paginator-item/p-043d636e.system.js +1 -0
  23. package/dist/mds-paginator-item/p-545e4388.system.js +2 -0
  24. package/dist/mds-paginator-item/p-632f225a.system.entry.js +1 -0
  25. package/dist/mds-paginator-item/p-6f0a5176.entry.js +1 -0
  26. package/dist/mds-paginator-item/p-cd35cb31.js +2 -0
  27. package/dist/stats.json +113 -38
  28. package/dist/types/common/keyboard-manager.d.ts +11 -0
  29. package/dist/types/dictionary/icon.d.ts +2 -1
  30. package/dist/types/dictionary/typography.d.ts +2 -1
  31. package/dist/types/stencil-public-runtime.d.ts +11 -0
  32. package/dist/types/types/typography.d.ts +1 -0
  33. package/package.json +3 -3
  34. package/readme.md +20 -0
  35. package/src/common/keyboard-manager.ts +46 -0
  36. package/src/components/mds-paginator-item/mds-paginator-item.css +17 -4
  37. package/src/components/mds-paginator-item/mds-paginator-item.tsx +25 -8
  38. package/src/components/mds-paginator-item/readme.md +20 -0
  39. package/src/dictionary/icon.ts +4 -0
  40. package/src/dictionary/typography.ts +9 -3
  41. package/src/fixtures/icons.json +174 -0
  42. package/src/fixtures/iconsauce.json +175 -0
  43. package/src/tailwind/components.css +1 -0
  44. package/src/types/typography.ts +4 -0
  45. package/www/build/mds-paginator-item.esm.js +1 -1
  46. package/www/build/mds-paginator-item.js +1 -1
  47. package/www/build/p-043d636e.system.js +1 -0
  48. package/www/build/p-545e4388.system.js +2 -0
  49. package/www/build/p-632f225a.system.entry.js +1 -0
  50. package/www/build/p-6f0a5176.entry.js +1 -0
  51. package/www/build/p-cd35cb31.js +2 -0
  52. package/dist/esm-es5/index-21e2f636.js +0 -2
  53. package/dist/mds-paginator-item/p-27de097c.js +0 -2
  54. package/dist/mds-paginator-item/p-4b44f6c6.system.entry.js +0 -1
  55. package/dist/mds-paginator-item/p-50a19f7a.system.js +0 -2
  56. package/dist/mds-paginator-item/p-dd301d2d.system.js +0 -1
  57. package/dist/mds-paginator-item/p-fb4c9e4e.entry.js +0 -1
  58. package/dist/types/components/mds-paginator-item/mds-paginator-item.d.ts +0 -15
  59. package/www/build/p-27de097c.js +0 -2
  60. package/www/build/p-4b44f6c6.system.entry.js +0 -1
  61. package/www/build/p-50a19f7a.system.js +0 -2
  62. package/www/build/p-dd301d2d.system.js +0 -1
  63. package/www/build/p-fb4c9e4e.entry.js +0 -1
@@ -133,6 +133,14 @@ const h = (nodeName, vnodeData, ...children) => {
133
133
  }
134
134
  return vnode;
135
135
  };
136
+ /**
137
+ * A utility function for creating a virtual DOM node from a tag and some
138
+ * possible text content.
139
+ *
140
+ * @param tag the tag for this element
141
+ * @param text possible text content for the node
142
+ * @returns a newly-minted virtual DOM node
143
+ */
136
144
  const newVNode = (tag, text) => {
137
145
  const vnode = {
138
146
  $flags$: 0,
@@ -147,6 +155,12 @@ const newVNode = (tag, text) => {
147
155
  return vnode;
148
156
  };
149
157
  const Host = {};
158
+ /**
159
+ * Check whether a given node is a Host node or not
160
+ *
161
+ * @param node the virtual DOM node to check
162
+ * @returns whether it's a Host node or not
163
+ */
150
164
  const isHost = (node) => node && node.$tag$ === Host;
151
165
  /**
152
166
  * Parse a new property value for a given property type.
@@ -191,6 +205,7 @@ const parsePropertyValue = (propValue, propType) => {
191
205
  // so no need to change to a different type
192
206
  return propValue;
193
207
  };
208
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
194
209
  /**
195
210
  * Helper function to create & dispatch a custom Event on a provided target
196
211
  * @param elm the target of the Event
@@ -405,6 +420,21 @@ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
405
420
  }
406
421
  return elm;
407
422
  };
423
+ /**
424
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
425
+ * add them to the DOM in the appropriate place.
426
+ *
427
+ * @param parentElm the DOM node which should be used as a parent for the new
428
+ * DOM nodes
429
+ * @param before a child of the `parentElm` which the new children should be
430
+ * inserted before (optional)
431
+ * @param parentVNode the parent virtual DOM node
432
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
433
+ * @param startIdx the index in the child virtual DOM nodes at which to start
434
+ * creating DOM nodes (inclusive)
435
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
436
+ * creating DOM nodes (inclusive)
437
+ */
408
438
  const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
409
439
  let containerElm = (parentElm);
410
440
  let childNode;
@@ -421,6 +451,19 @@ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) =>
421
451
  }
422
452
  }
423
453
  };
454
+ /**
455
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
456
+ * This can be used to, for instance, clean up after a list of children which
457
+ * should no longer be shown.
458
+ *
459
+ * This function also handles some of Stencil's slot relocation logic.
460
+ *
461
+ * @param vnodes a list of virtual DOM nodes to remove
462
+ * @param startIdx the index at which to start removing nodes (inclusive)
463
+ * @param endIdx the index at which to stop removing nodes (inclusive)
464
+ * @param vnode a VNode
465
+ * @param elm an element
466
+ */
424
467
  const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
425
468
  for (; startIdx <= endIdx; ++startIdx) {
426
469
  if ((vnode = vnodes[startIdx])) {
@@ -612,7 +655,8 @@ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
612
655
  *
613
656
  * So, in other words, if `key` attrs are not set on VNodes which may be
614
657
  * changing order within a `children` array or something along those lines then
615
- * we could obtain a false positive and then have to do needless re-rendering.
658
+ * we could obtain a false negative and then have to do needless re-rendering
659
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
616
660
  *
617
661
  * @param leftVNode the first VNode to check
618
662
  * @param rightVNode the second VNode to check
@@ -676,6 +720,18 @@ const patch = (oldVNode, newVNode) => {
676
720
  elm.data = text;
677
721
  }
678
722
  };
723
+ /**
724
+ * The main entry point for Stencil's virtual DOM-based rendering engine
725
+ *
726
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
727
+ * function will handle creating a virtual DOM tree with a single root, patching
728
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
729
+ * relocation, and reflecting attributes.
730
+ *
731
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
732
+ * the DOM node into which it should be rendered.
733
+ * @param renderFnResults the virtual DOM nodes to be rendered
734
+ */
679
735
  const renderVdom = (hostRef, renderFnResults) => {
680
736
  const hostElm = hostRef.$hostElement$;
681
737
  const cmpMeta = hostRef.$cmpMeta$;
@@ -1290,6 +1346,7 @@ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1290
1346
 
1291
1347
  exports.Host = Host;
1292
1348
  exports.bootstrapLazy = bootstrapLazy;
1349
+ exports.getElement = getElement;
1293
1350
  exports.h = h;
1294
1351
  exports.promiseResolve = promiseResolve;
1295
1352
  exports.registerInstance = registerInstance;
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-788f9a49.js');
5
+ const index = require('./index-969219be.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Esm v2.22.1 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Esm v2.22.2 | MIT Licensed | https://stenciljs.com
9
9
  */
10
10
  const patchEsm = () => {
11
11
  return index.promiseResolve();
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["mds-paginator-item.cjs",[[1,"mds-paginator-item",{"icon":[1],"active":[516],"disabled":[516]}]]]], options);
17
+ return index.bootstrapLazy([["mds-paginator-item.cjs",[[1,"mds-paginator-item",{"icon":[513],"active":[516],"disabled":[516]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -2,24 +2,79 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-788f9a49.js');
5
+ const index = require('./index-969219be.js');
6
6
 
7
- function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
7
+ class KeyboardManager {
8
+ constructor() {
9
+ this.elements = [];
10
+ this.handleClickBehaviorDispatchEvent = (event) => {
11
+ if (event.code === 'Space' || event.code === 'Enter' || event.code === 'NumpadEnter') {
12
+ event.target.click();
13
+ }
14
+ };
15
+ this.handleEscapeBehaviorDispatchEvent = (event) => {
16
+ if (event.code === 'Escape' && this.escapeCallback) {
17
+ this.escapeCallback();
18
+ }
19
+ };
20
+ this.addElement = (el, name = 'element') => {
21
+ this.elements[name] = el;
22
+ };
23
+ this.attachClickBehavior = (name = 'element') => {
24
+ if (this.elements[name]) {
25
+ this.elements[name].addEventListener('keydown', this.handleClickBehaviorDispatchEvent);
26
+ }
27
+ };
28
+ this.detachClickBehavior = (name = 'element') => {
29
+ if (this.elements[name]) {
30
+ this.elements[name].removeEventListener('keydown', this.handleClickBehaviorDispatchEvent);
31
+ }
32
+ };
33
+ this.attachEscapeBehavior = (callBack) => {
34
+ this.escapeCallback = callBack;
35
+ if (typeof window !== undefined) {
36
+ window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
37
+ }
38
+ };
39
+ this.detachEscapeBehavior = () => {
40
+ this.escapeCallback = null;
41
+ if (typeof window !== undefined) {
42
+ window.removeEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
43
+ }
44
+ };
45
+ }
46
+ }
8
47
 
9
- const mdsPaginatorItemCss = ".fixed{position:fixed}.absolute{position:absolute}.border{border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host{--mds-paginator-item-background-disabled:rgb(var(--tone-neutral-09));--mds-paginator-item-background-hover:rgb(var(--tone-neutral-08));--mds-paginator-item-background-selected:rgb(var(--brand-maggioli-03));--mds-paginator-item-background:rgb(var(--tone-neutral-09));--mds-paginator-item-color-disabled:rgb(var(--tone-neutral-06));--mds-paginator-item-color-hover:rgb(var(--tone-neutral-02));--mds-paginator-item-color-selected:rgb(var(--tone-neutral));--mds-paginator-item-color:rgb(var(--tone-neutral-02));--mds-paginator-item-radius:200px;--mds-paginator-item-shadow-disabled:none;--mds-paginator-item-shadow-hover:none;--mds-paginator-item-shadow-selected:0 0 1px 1px rgba(0, 0, 0, 0.06), 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--mds-paginator-item-shadow:none;--mds-paginator-item-size:2.25rem;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-negative:0;flex-shrink:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding-left:0.75rem;padding-right:0.75rem;-webkit-transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:150ms;transition-duration:150ms;background-color:var(--mds-paginator-item-background);border-radius:var(--mds-paginator-item-radius);-webkit-box-shadow:var(--mds-paginator-item-shadow);box-shadow:var(--mds-paginator-item-shadow);color:var(--mds-paginator-item-color);height:var(--mds-paginator-item-size);min-width:var(--mds-paginator-item-size)}:host(:hover){background-color:var(--mds-paginator-item-background-hover);-webkit-box-shadow:var(--mds-paginator-item-shadow-hover);box-shadow:var(--mds-paginator-item-shadow-hover);color:var(--mds-paginator-item-color-hover);fill:var(--mds-paginator-item-color-hover)}:host([active]){pointer-events:none;background-color:var(--mds-paginator-item-background-selected);-webkit-box-shadow:var(--mds-paginator-item-shadow-selected);box-shadow:var(--mds-paginator-item-shadow-selected);color:var(--mds-paginator-item-color-selected);fill:var(--mds-paginator-item-color-selected)}:host([disabled]){pointer-events:none;background-color:var(--mds-paginator-item-background-disabled);-webkit-box-shadow:var(--mds-paginator-item-shadow-disabled);box-shadow:var(--mds-paginator-item-shadow-disabled);color:var(--mds-paginator-item-color-disabled);fill:var(--mds-paginator-item-color-disabled)}.icon{padding-left:0px;padding-right:0px}";
48
+ const mdsPaginatorItemCss = "@tailwind components; .fixed{position:fixed}.absolute{position:absolute}.border{border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host{--mds-paginator-item-background-disabled:rgb(var(--tone-neutral-09));--mds-paginator-item-background-hover:rgb(var(--tone-neutral-08));--mds-paginator-item-background-selected:rgb(var(--brand-maggioli-03));--mds-paginator-item-background:transparent;--mds-paginator-item-color-disabled:rgb(var(--tone-neutral-06));--mds-paginator-item-color-hover:rgb(var(--tone-neutral-02));--mds-paginator-item-color-selected:rgb(var(--tone-neutral));--mds-paginator-item-color:rgb(var(--tone-neutral-02));--mds-paginator-item-radius:200px;--mds-paginator-item-shadow-disabled:none;--mds-paginator-item-shadow-hover:none;--mds-paginator-item-shadow-selected:0 0 1px 1px rgba(0, 0, 0, 0.06), 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--mds-paginator-item-shadow:none;--mds-paginator-item-size:2.25rem;outline-offset:var(--magma-outline-blur-offset);outline:var(--magma-outline-blur);-webkit-transition-property:background-color, border-color, color, fill, outline, outline-offset, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, outline, outline-offset, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, outline, outline-offset, transform;transition-property:background-color, border-color, box-shadow, color, fill, outline, outline-offset, transform, -webkit-box-shadow, -webkit-transform;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-negative:0;flex-shrink:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding-left:0.75rem;padding-right:0.75rem;-webkit-transition-duration:200ms;transition-duration:200ms;-webkit-transition-timing-function:cubic-bezier(0, 0, 0.2, 1);transition-timing-function:cubic-bezier(0, 0, 0.2, 1);background-color:var(--mds-paginator-item-background);border-radius:var(--mds-paginator-item-radius);-webkit-box-shadow:var(--mds-paginator-item-shadow);box-shadow:var(--mds-paginator-item-shadow);color:var(--mds-paginator-item-color);height:var(--mds-paginator-item-size);min-width:var(--mds-paginator-item-size);-webkit-transition-property:background-color, color, outline, outline-offset, -webkit-box-shadow;transition-property:background-color, color, outline, outline-offset, -webkit-box-shadow;transition-property:background-color, box-shadow, color, outline, outline-offset;transition-property:background-color, box-shadow, color, outline, outline-offset, -webkit-box-shadow}:host(:focus-visible){--magma-outline-blur-offset:var(--magma-outline-focus-offset);--magma-outline-blur:var(--magma-outline-focus)}:host(:hover){background-color:var(--mds-paginator-item-background-hover);-webkit-box-shadow:var(--mds-paginator-item-shadow-hover);box-shadow:var(--mds-paginator-item-shadow-hover);color:var(--mds-paginator-item-color-hover);fill:var(--mds-paginator-item-color-hover)}:host([icon]){padding:0px}:host([active]){pointer-events:none;background-color:var(--mds-paginator-item-background-selected);-webkit-box-shadow:var(--mds-paginator-item-shadow-selected);box-shadow:var(--mds-paginator-item-shadow-selected);color:var(--mds-paginator-item-color-selected);fill:var(--mds-paginator-item-color-selected)}:host([disabled]){pointer-events:none;background-color:var(--mds-paginator-item-background-disabled);-webkit-box-shadow:var(--mds-paginator-item-shadow-disabled);box-shadow:var(--mds-paginator-item-shadow-disabled);color:var(--mds-paginator-item-color-disabled);fill:var(--mds-paginator-item-color-disabled)}.icon{padding-left:0px;padding-right:0px}";
10
49
 
11
50
  const MdsPaginatorItem = class {
12
51
  constructor(hostRef) {
13
52
  index.registerInstance(this, hostRef);
53
+ this.km = new KeyboardManager();
54
+ this.componentDidLoad = () => {
55
+ this.km.addElement(this.host);
56
+ this.km.attachClickBehavior();
57
+ };
58
+ this.componentDidUpdate = () => {
59
+ if (!this.disabled && !this.active) {
60
+ this.km.attachClickBehavior();
61
+ return;
62
+ }
63
+ this.km.detachClickBehavior();
64
+ };
65
+ this.disconnectedCallback = () => {
66
+ this.km.detachClickBehavior();
67
+ };
14
68
  this.icon = undefined;
15
69
  this.active = undefined;
16
70
  this.disabled = undefined;
17
71
  }
18
72
  render() {
19
- return (index.h(index.Host, { class: clsx(this.active && 'active', this.disabled && 'disabled', this.icon && 'icon') }, this.icon !== undefined
73
+ return (index.h(index.Host, { tabindex: "0" }, this.icon !== undefined
20
74
  ? index.h("mds-icon", { name: this.icon })
21
75
  : index.h("mds-text", { class: "text", typography: "detail" }, index.h("slot", null))));
22
76
  }
77
+ get host() { return index.getElement(this); }
23
78
  };
24
79
  MdsPaginatorItem.style = mdsPaginatorItemCss;
25
80
 
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-788f9a49.js');
5
+ const index = require('./index-969219be.js');
6
6
 
7
7
  /*
8
- Stencil Client Patch Browser v2.22.1 | MIT Licensed | https://stenciljs.com
8
+ Stencil Client Patch Browser v2.22.2 | MIT Licensed | https://stenciljs.com
9
9
  */
10
10
  const patchBrowser = () => {
11
11
  const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('mds-paginator-item.cjs.js', document.baseURI).href));
@@ -17,7 +17,7 @@ const patchBrowser = () => {
17
17
  };
18
18
 
19
19
  patchBrowser().then(options => {
20
- return index.bootstrapLazy([["mds-paginator-item.cjs",[[1,"mds-paginator-item",{"icon":[1],"active":[516],"disabled":[516]}]]]], options);
20
+ return index.bootstrapLazy([["mds-paginator-item.cjs",[[1,"mds-paginator-item",{"icon":[513],"active":[516],"disabled":[516]}]]]], options);
21
21
  });
22
22
 
23
23
  exports.setNonce = index.setNonce;
@@ -4,7 +4,7 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "2.22.1",
7
+ "version": "2.22.2",
8
8
  "typescriptVersion": "4.9.4"
9
9
  },
10
10
  "collections": [],
@@ -0,0 +1,40 @@
1
+ export class KeyboardManager {
2
+ constructor() {
3
+ this.elements = [];
4
+ this.handleClickBehaviorDispatchEvent = (event) => {
5
+ if (event.code === 'Space' || event.code === 'Enter' || event.code === 'NumpadEnter') {
6
+ event.target.click();
7
+ }
8
+ };
9
+ this.handleEscapeBehaviorDispatchEvent = (event) => {
10
+ if (event.code === 'Escape' && this.escapeCallback) {
11
+ this.escapeCallback();
12
+ }
13
+ };
14
+ this.addElement = (el, name = 'element') => {
15
+ this.elements[name] = el;
16
+ };
17
+ this.attachClickBehavior = (name = 'element') => {
18
+ if (this.elements[name]) {
19
+ this.elements[name].addEventListener('keydown', this.handleClickBehaviorDispatchEvent);
20
+ }
21
+ };
22
+ this.detachClickBehavior = (name = 'element') => {
23
+ if (this.elements[name]) {
24
+ this.elements[name].removeEventListener('keydown', this.handleClickBehaviorDispatchEvent);
25
+ }
26
+ };
27
+ this.attachEscapeBehavior = (callBack) => {
28
+ this.escapeCallback = callBack;
29
+ if (typeof window !== undefined) {
30
+ window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
31
+ }
32
+ };
33
+ this.detachEscapeBehavior = () => {
34
+ this.escapeCallback = null;
35
+ if (typeof window !== undefined) {
36
+ window.removeEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
37
+ }
38
+ };
39
+ }
40
+ }
@@ -1,19 +1,17 @@
1
- .fixed {
1
+ @tailwind components;
2
+ .fixed{
2
3
 
3
4
  position: fixed;
4
5
  }
5
-
6
- .absolute {
6
+ .absolute{
7
7
 
8
8
  position: absolute;
9
9
  }
10
-
11
- .border {
10
+ .border{
12
11
 
13
12
  border-width: 1px;
14
13
  }
15
-
16
- .shadow {
14
+ .shadow{
17
15
 
18
16
  --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
19
17
 
@@ -22,7 +20,7 @@
22
20
  box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
23
21
  }
24
22
 
25
- /*
23
+ /**
26
24
  * @prop --mds-paginator-item-background-disabled: Sets the background-color of the item when is disabled
27
25
  * @prop --mds-paginator-item-background-hover: Sets the background-color of the item when the mouse is over it
28
26
  * @prop --mds-paginator-item-background-selected: Sets the background-color of the item when is selected
@@ -44,7 +42,7 @@
44
42
  --mds-paginator-item-background-disabled: rgb(var(--tone-neutral-09));
45
43
  --mds-paginator-item-background-hover: rgb(var(--tone-neutral-08));
46
44
  --mds-paginator-item-background-selected: rgb(var(--brand-maggioli-03));
47
- --mds-paginator-item-background: rgb(var(--tone-neutral-09));
45
+ --mds-paginator-item-background: transparent;
48
46
  --mds-paginator-item-color-disabled: rgb(var(--tone-neutral-06));
49
47
  --mds-paginator-item-color-hover: rgb(var(--tone-neutral-02));
50
48
  --mds-paginator-item-color-selected: rgb(var(--tone-neutral));
@@ -55,20 +53,23 @@
55
53
  --mds-paginator-item-shadow-selected: 0 0 1px 1px rgba(0, 0, 0, 0.06), 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
56
54
  --mds-paginator-item-shadow: none;
57
55
  --mds-paginator-item-size: 2.25rem;
58
- box-sizing: border-box;
59
- display: inline-flex;
60
- flex-shrink: 0;
61
- cursor: pointer;
62
- -webkit-user-select: none;
63
- -moz-user-select: none;
64
- user-select: none;
65
- align-items: center;
66
- justify-content: center;
67
- padding-left: 0.75rem;
68
- padding-right: 0.75rem;
69
- transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
70
- transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
71
- transition-duration: 150ms;
56
+
57
+ outline-offset: var(--magma-outline-blur-offset);
58
+ outline: var(--magma-outline-blur);
59
+ transition-property: background-color, border-color, box-shadow, color, fill, outline, outline-offset, transform;
60
+ box-sizing: border-box;
61
+ display: inline-flex;
62
+ flex-shrink: 0;
63
+ cursor: pointer;
64
+ -webkit-user-select: none;
65
+ -moz-user-select: none;
66
+ user-select: none;
67
+ align-items: center;
68
+ justify-content: center;
69
+ padding-left: 0.75rem;
70
+ padding-right: 0.75rem;
71
+ transition-duration: 200ms;
72
+ transition-timing-function: cubic-bezier(0, 0, 0.2, 1);
72
73
 
73
74
  background-color: var(--mds-paginator-item-background);
74
75
  border-radius: var(--mds-paginator-item-radius);
@@ -76,8 +77,14 @@
76
77
  color: var(--mds-paginator-item-color);
77
78
  height: var(--mds-paginator-item-size);
78
79
  min-width: var(--mds-paginator-item-size);
80
+ transition-property: background-color, box-shadow, color, outline, outline-offset;
79
81
  }
80
82
 
83
+ :host( :focus-visible ) {
84
+ --magma-outline-blur-offset: var(--magma-outline-focus-offset);
85
+ --magma-outline-blur: var(--magma-outline-focus);
86
+ }
87
+
81
88
  :host( :hover ) {
82
89
  background-color: var(--mds-paginator-item-background-hover);
83
90
  box-shadow: var(--mds-paginator-item-shadow-hover);
@@ -85,7 +92,12 @@
85
92
  fill: var(--mds-paginator-item-color-hover);
86
93
  }
87
94
 
88
- :host ( [active]) {
95
+ :host ( [icon]){
96
+
97
+ padding: 0px;
98
+ }
99
+
100
+ :host ( [active]){
89
101
 
90
102
  pointer-events: none;
91
103
 
@@ -95,7 +107,7 @@
95
107
  fill: var(--mds-paginator-item-color-selected);
96
108
  }
97
109
 
98
- :host ( [disabled]) {
110
+ :host ( [disabled]){
99
111
 
100
112
  pointer-events: none;
101
113
 
@@ -105,7 +117,7 @@
105
117
  fill: var(--mds-paginator-item-color-disabled);
106
118
  }
107
119
 
108
- .icon {
120
+ .icon{
109
121
 
110
122
  padding-left: 0px;
111
123
 
@@ -1,13 +1,28 @@
1
1
  import { Host, h } from '@stencil/core';
2
- import clsx from 'clsx';
2
+ import { KeyboardManager } from '@common/keyboard-manager';
3
3
  export class MdsPaginatorItem {
4
4
  constructor() {
5
+ this.km = new KeyboardManager();
6
+ this.componentDidLoad = () => {
7
+ this.km.addElement(this.host);
8
+ this.km.attachClickBehavior();
9
+ };
10
+ this.componentDidUpdate = () => {
11
+ if (!this.disabled && !this.active) {
12
+ this.km.attachClickBehavior();
13
+ return;
14
+ }
15
+ this.km.detachClickBehavior();
16
+ };
17
+ this.disconnectedCallback = () => {
18
+ this.km.detachClickBehavior();
19
+ };
5
20
  this.icon = undefined;
6
21
  this.active = undefined;
7
22
  this.disabled = undefined;
8
23
  }
9
24
  render() {
10
- return (h(Host, { class: clsx(this.active && 'active', this.disabled && 'disabled', this.icon && 'icon') }, this.icon !== undefined
25
+ return (h(Host, { tabindex: "0" }, this.icon !== undefined
11
26
  ? h("mds-icon", { name: this.icon })
12
27
  : h("mds-text", { class: "text", typography: "detail" }, h("slot", null))));
13
28
  }
@@ -40,7 +55,7 @@ export class MdsPaginatorItem {
40
55
  "text": "Specifies the icon used inside the paginator item"
41
56
  },
42
57
  "attribute": "icon",
43
- "reflect": false
58
+ "reflect": true
44
59
  },
45
60
  "active": {
46
61
  "type": "boolean",
@@ -78,4 +93,5 @@ export class MdsPaginatorItem {
78
93
  }
79
94
  };
80
95
  }
96
+ static get elementRef() { return "host"; }
81
97
  }
@@ -1,3 +1,5 @@
1
1
  import jsonIconsDictionary from '../fixtures/icons.json';
2
+ import jsonMggIconsDictionary from '../fixtures/iconsauce.json';
2
3
  const iconsDictionary = jsonIconsDictionary;
3
- export { iconsDictionary, };
4
+ const mggIconsDictionary = jsonMggIconsDictionary;
5
+ export { iconsDictionary, mggIconsDictionary, };
@@ -21,6 +21,10 @@ const typographyVariationsDictionary = [
21
21
  'read',
22
22
  'code',
23
23
  ];
24
+ const typographyReadingVariationsDictionary = [
25
+ 'info',
26
+ 'read',
27
+ ];
24
28
  const typographyMonoDictionary = [
25
29
  'snippet',
26
30
  'hack',
@@ -56,4 +60,4 @@ const typographyTooltipDictionary = [
56
60
  'detail',
57
61
  'tip',
58
62
  ];
59
- export { typographyDictionary, typographyVariationsDictionary, typographyMonoDictionary, typographyTitleDictionary, typographyInfoDictionary, typographyReadDictionary, typographySmallerDictionary, typographyTooltipDictionary, };
63
+ export { typographyDictionary, typographyInfoDictionary, typographyReadingVariationsDictionary, typographyMonoDictionary, typographyReadDictionary, typographySmallerDictionary, typographyTitleDictionary, typographyTooltipDictionary, typographyVariationsDictionary, };
@@ -1,26 +1,81 @@
1
1
  import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
2
2
 
3
- function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
3
+ class KeyboardManager {
4
+ constructor() {
5
+ this.elements = [];
6
+ this.handleClickBehaviorDispatchEvent = (event) => {
7
+ if (event.code === 'Space' || event.code === 'Enter' || event.code === 'NumpadEnter') {
8
+ event.target.click();
9
+ }
10
+ };
11
+ this.handleEscapeBehaviorDispatchEvent = (event) => {
12
+ if (event.code === 'Escape' && this.escapeCallback) {
13
+ this.escapeCallback();
14
+ }
15
+ };
16
+ this.addElement = (el, name = 'element') => {
17
+ this.elements[name] = el;
18
+ };
19
+ this.attachClickBehavior = (name = 'element') => {
20
+ if (this.elements[name]) {
21
+ this.elements[name].addEventListener('keydown', this.handleClickBehaviorDispatchEvent);
22
+ }
23
+ };
24
+ this.detachClickBehavior = (name = 'element') => {
25
+ if (this.elements[name]) {
26
+ this.elements[name].removeEventListener('keydown', this.handleClickBehaviorDispatchEvent);
27
+ }
28
+ };
29
+ this.attachEscapeBehavior = (callBack) => {
30
+ this.escapeCallback = callBack;
31
+ if (typeof window !== undefined) {
32
+ window.addEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
33
+ }
34
+ };
35
+ this.detachEscapeBehavior = () => {
36
+ this.escapeCallback = null;
37
+ if (typeof window !== undefined) {
38
+ window.removeEventListener('keydown', this.handleEscapeBehaviorDispatchEvent.bind(this));
39
+ }
40
+ };
41
+ }
42
+ }
4
43
 
5
- const mdsPaginatorItemCss = ".fixed{position:fixed}.absolute{position:absolute}.border{border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host{--mds-paginator-item-background-disabled:rgb(var(--tone-neutral-09));--mds-paginator-item-background-hover:rgb(var(--tone-neutral-08));--mds-paginator-item-background-selected:rgb(var(--brand-maggioli-03));--mds-paginator-item-background:rgb(var(--tone-neutral-09));--mds-paginator-item-color-disabled:rgb(var(--tone-neutral-06));--mds-paginator-item-color-hover:rgb(var(--tone-neutral-02));--mds-paginator-item-color-selected:rgb(var(--tone-neutral));--mds-paginator-item-color:rgb(var(--tone-neutral-02));--mds-paginator-item-radius:200px;--mds-paginator-item-shadow-disabled:none;--mds-paginator-item-shadow-hover:none;--mds-paginator-item-shadow-selected:0 0 1px 1px rgba(0, 0, 0, 0.06), 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--mds-paginator-item-shadow:none;--mds-paginator-item-size:2.25rem;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-negative:0;flex-shrink:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding-left:0.75rem;padding-right:0.75rem;-webkit-transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;transition-property:color, background-color, border-color, fill, stroke, -webkit-text-decoration-color;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, -webkit-text-decoration-color;-webkit-transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);-webkit-transition-duration:150ms;transition-duration:150ms;background-color:var(--mds-paginator-item-background);border-radius:var(--mds-paginator-item-radius);-webkit-box-shadow:var(--mds-paginator-item-shadow);box-shadow:var(--mds-paginator-item-shadow);color:var(--mds-paginator-item-color);height:var(--mds-paginator-item-size);min-width:var(--mds-paginator-item-size)}:host(:hover){background-color:var(--mds-paginator-item-background-hover);-webkit-box-shadow:var(--mds-paginator-item-shadow-hover);box-shadow:var(--mds-paginator-item-shadow-hover);color:var(--mds-paginator-item-color-hover);fill:var(--mds-paginator-item-color-hover)}:host([active]){pointer-events:none;background-color:var(--mds-paginator-item-background-selected);-webkit-box-shadow:var(--mds-paginator-item-shadow-selected);box-shadow:var(--mds-paginator-item-shadow-selected);color:var(--mds-paginator-item-color-selected);fill:var(--mds-paginator-item-color-selected)}:host([disabled]){pointer-events:none;background-color:var(--mds-paginator-item-background-disabled);-webkit-box-shadow:var(--mds-paginator-item-shadow-disabled);box-shadow:var(--mds-paginator-item-shadow-disabled);color:var(--mds-paginator-item-color-disabled);fill:var(--mds-paginator-item-color-disabled)}.icon{padding-left:0px;padding-right:0px}";
44
+ const mdsPaginatorItemCss = "@tailwind components; .fixed{position:fixed}.absolute{position:absolute}.border{border-width:1px}.shadow{--tw-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 1px 3px 0 var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);-webkit-box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}:host{--mds-paginator-item-background-disabled:rgb(var(--tone-neutral-09));--mds-paginator-item-background-hover:rgb(var(--tone-neutral-08));--mds-paginator-item-background-selected:rgb(var(--brand-maggioli-03));--mds-paginator-item-background:transparent;--mds-paginator-item-color-disabled:rgb(var(--tone-neutral-06));--mds-paginator-item-color-hover:rgb(var(--tone-neutral-02));--mds-paginator-item-color-selected:rgb(var(--tone-neutral));--mds-paginator-item-color:rgb(var(--tone-neutral-02));--mds-paginator-item-radius:200px;--mds-paginator-item-shadow-disabled:none;--mds-paginator-item-shadow-hover:none;--mds-paginator-item-shadow-selected:0 0 1px 1px rgba(0, 0, 0, 0.06), 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);--mds-paginator-item-shadow:none;--mds-paginator-item-size:2.25rem;outline-offset:var(--magma-outline-blur-offset);outline:var(--magma-outline-blur);-webkit-transition-property:background-color, border-color, color, fill, outline, outline-offset, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, color, fill, outline, outline-offset, -webkit-box-shadow, -webkit-transform;transition-property:background-color, border-color, box-shadow, color, fill, outline, outline-offset, transform;transition-property:background-color, border-color, box-shadow, color, fill, outline, outline-offset, transform, -webkit-box-shadow, -webkit-transform;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-negative:0;flex-shrink:0;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;padding-left:0.75rem;padding-right:0.75rem;-webkit-transition-duration:200ms;transition-duration:200ms;-webkit-transition-timing-function:cubic-bezier(0, 0, 0.2, 1);transition-timing-function:cubic-bezier(0, 0, 0.2, 1);background-color:var(--mds-paginator-item-background);border-radius:var(--mds-paginator-item-radius);-webkit-box-shadow:var(--mds-paginator-item-shadow);box-shadow:var(--mds-paginator-item-shadow);color:var(--mds-paginator-item-color);height:var(--mds-paginator-item-size);min-width:var(--mds-paginator-item-size);-webkit-transition-property:background-color, color, outline, outline-offset, -webkit-box-shadow;transition-property:background-color, color, outline, outline-offset, -webkit-box-shadow;transition-property:background-color, box-shadow, color, outline, outline-offset;transition-property:background-color, box-shadow, color, outline, outline-offset, -webkit-box-shadow}:host(:focus-visible){--magma-outline-blur-offset:var(--magma-outline-focus-offset);--magma-outline-blur:var(--magma-outline-focus)}:host(:hover){background-color:var(--mds-paginator-item-background-hover);-webkit-box-shadow:var(--mds-paginator-item-shadow-hover);box-shadow:var(--mds-paginator-item-shadow-hover);color:var(--mds-paginator-item-color-hover);fill:var(--mds-paginator-item-color-hover)}:host([icon]){padding:0px}:host([active]){pointer-events:none;background-color:var(--mds-paginator-item-background-selected);-webkit-box-shadow:var(--mds-paginator-item-shadow-selected);box-shadow:var(--mds-paginator-item-shadow-selected);color:var(--mds-paginator-item-color-selected);fill:var(--mds-paginator-item-color-selected)}:host([disabled]){pointer-events:none;background-color:var(--mds-paginator-item-background-disabled);-webkit-box-shadow:var(--mds-paginator-item-shadow-disabled);box-shadow:var(--mds-paginator-item-shadow-disabled);color:var(--mds-paginator-item-color-disabled);fill:var(--mds-paginator-item-color-disabled)}.icon{padding-left:0px;padding-right:0px}";
6
45
 
7
46
  const MdsPaginatorItem$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
8
47
  constructor() {
9
48
  super();
10
49
  this.__registerHost();
11
50
  this.__attachShadow();
51
+ this.km = new KeyboardManager();
52
+ this.componentDidLoad = () => {
53
+ this.km.addElement(this.host);
54
+ this.km.attachClickBehavior();
55
+ };
56
+ this.componentDidUpdate = () => {
57
+ if (!this.disabled && !this.active) {
58
+ this.km.attachClickBehavior();
59
+ return;
60
+ }
61
+ this.km.detachClickBehavior();
62
+ };
63
+ this.disconnectedCallback = () => {
64
+ this.km.detachClickBehavior();
65
+ };
12
66
  this.icon = undefined;
13
67
  this.active = undefined;
14
68
  this.disabled = undefined;
15
69
  }
16
70
  render() {
17
- return (h(Host, { class: clsx(this.active && 'active', this.disabled && 'disabled', this.icon && 'icon') }, this.icon !== undefined
71
+ return (h(Host, { tabindex: "0" }, this.icon !== undefined
18
72
  ? h("mds-icon", { name: this.icon })
19
73
  : h("mds-text", { class: "text", typography: "detail" }, h("slot", null))));
20
74
  }
75
+ get host() { return this; }
21
76
  static get style() { return mdsPaginatorItemCss; }
22
77
  }, [1, "mds-paginator-item", {
23
- "icon": [1],
78
+ "icon": [513],
24
79
  "active": [516],
25
80
  "disabled": [516]
26
81
  }]);