@nanoporetech-digital/components 4.10.0 → 5.0.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 (164) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/cjs/{form-control-2e900f54.js → form-control-443e90bf.js} +2 -3
  3. package/dist/cjs/form-control-443e90bf.js.map +1 -0
  4. package/dist/cjs/index-71f899a7.js +6 -2
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/nano-components.cjs.js +1 -1
  7. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +2 -2
  8. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
  9. package/dist/cjs/nano-grid-item.cjs.entry.js +29 -0
  10. package/dist/cjs/nano-grid-item.cjs.entry.js.map +1 -0
  11. package/dist/cjs/nano-grid_2.cjs.entry.js +436 -0
  12. package/dist/cjs/nano-grid_2.cjs.entry.js.map +1 -0
  13. package/dist/cjs/nano-hero.cjs.entry.js +4 -10
  14. package/dist/cjs/nano-hero.cjs.entry.js.map +1 -1
  15. package/dist/cjs/nano-icon-button_2.cjs.entry.js +2 -2
  16. package/dist/cjs/nano-icon-button_2.cjs.entry.js.map +1 -1
  17. package/dist/cjs/nano-input.cjs.entry.js +2 -2
  18. package/dist/cjs/nano-input.cjs.entry.js.map +1 -1
  19. package/dist/cjs/nano-range.cjs.entry.js +1 -1
  20. package/dist/cjs/nano-range.cjs.entry.js.map +1 -1
  21. package/dist/cjs/nano-sortable.cjs.entry.js +1 -0
  22. package/dist/cjs/nano-sortable.cjs.entry.js.map +1 -1
  23. package/dist/cjs/{nano-table-ff33dc43.js → nano-table-11052a34.js} +37 -30
  24. package/dist/cjs/nano-table-11052a34.js.map +1 -0
  25. package/dist/cjs/nano-table.cjs.entry.js +1 -1
  26. package/dist/cjs/{table.worker-0a6bc962.js → table.worker-83433a8b.js} +2 -2
  27. package/dist/cjs/table.worker-83433a8b.js.map +1 -0
  28. package/dist/collection/components/form-control/form-control.js +1 -2
  29. package/dist/collection/components/form-control/form-control.js.map +1 -1
  30. package/dist/collection/components/grid/grid-item.js +11 -136
  31. package/dist/collection/components/grid/grid-item.js.map +1 -1
  32. package/dist/collection/components/grid/grid.css +9 -242
  33. package/dist/collection/components/grid/grid.js +248 -240
  34. package/dist/collection/components/grid/grid.js.map +1 -1
  35. package/dist/collection/components/hero/hero.css +42 -89
  36. package/dist/collection/components/hero/hero.js +4 -11
  37. package/dist/collection/components/hero/hero.js.map +1 -1
  38. package/dist/collection/components/icon-button/icon-button.css +12 -0
  39. package/dist/collection/components/icon-button/icon-button.js +1 -1
  40. package/dist/collection/components/icon-button/icon-button.js.map +1 -1
  41. package/dist/collection/components/input/input.css +8 -9
  42. package/dist/collection/components/range/range.css +0 -3
  43. package/dist/collection/components/select/select.css +8 -9
  44. package/dist/collection/components/sortable/sortable.js +2 -1
  45. package/dist/collection/components/sortable/sortable.js.map +1 -1
  46. package/dist/collection/components/table/table.css +6 -0
  47. package/dist/collection/components/table/table.js +25 -18
  48. package/dist/collection/components/table/table.js.map +1 -1
  49. package/dist/collection/components/table/table.row.js +7 -7
  50. package/dist/collection/components/table/table.row.js.map +1 -1
  51. package/dist/collection/utils/constructible-style.js +129 -0
  52. package/dist/collection/utils/constructible-style.js.map +1 -0
  53. package/dist/components/form-control.js +1 -2
  54. package/dist/components/form-control.js.map +1 -1
  55. package/dist/components/grid.js +268 -183
  56. package/dist/components/grid.js.map +1 -1
  57. package/dist/components/icon-button.js +2 -2
  58. package/dist/components/icon-button.js.map +1 -1
  59. package/dist/components/input.js +1 -1
  60. package/dist/components/input.js.map +1 -1
  61. package/dist/components/nano-grid-item.js +33 -1
  62. package/dist/components/nano-grid-item.js.map +1 -1
  63. package/dist/components/nano-hero.js +6 -19
  64. package/dist/components/nano-hero.js.map +1 -1
  65. package/dist/components/nano-range.js +1 -1
  66. package/dist/components/nano-range.js.map +1 -1
  67. package/dist/components/nano-sortable.js +1 -0
  68. package/dist/components/nano-sortable.js.map +1 -1
  69. package/dist/components/select.js +1 -1
  70. package/dist/components/select.js.map +1 -1
  71. package/dist/components/table.js +36 -29
  72. package/dist/components/table.js.map +1 -1
  73. package/dist/esm/{form-control-269ba84f.js → form-control-e8739b2e.js} +2 -3
  74. package/dist/esm/form-control-e8739b2e.js.map +1 -0
  75. package/dist/esm/index-dad5627b.js +6 -2
  76. package/dist/esm/loader.js +1 -1
  77. package/dist/esm/nano-components.js +1 -1
  78. package/dist/esm/nano-global-nav-user-profile_3.entry.js +2 -2
  79. package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
  80. package/dist/esm/nano-grid-item.entry.js +25 -0
  81. package/dist/esm/nano-grid-item.entry.js.map +1 -0
  82. package/dist/esm/nano-grid_2.entry.js +431 -0
  83. package/dist/esm/nano-grid_2.entry.js.map +1 -0
  84. package/dist/esm/nano-hero.entry.js +4 -10
  85. package/dist/esm/nano-hero.entry.js.map +1 -1
  86. package/dist/esm/nano-icon-button_2.entry.js +2 -2
  87. package/dist/esm/nano-icon-button_2.entry.js.map +1 -1
  88. package/dist/esm/nano-input.entry.js +2 -2
  89. package/dist/esm/nano-input.entry.js.map +1 -1
  90. package/dist/esm/nano-range.entry.js +1 -1
  91. package/dist/esm/nano-range.entry.js.map +1 -1
  92. package/dist/esm/nano-sortable.entry.js +1 -0
  93. package/dist/esm/nano-sortable.entry.js.map +1 -1
  94. package/dist/esm/{nano-table-ec980076.js → nano-table-ba637f26.js} +37 -30
  95. package/dist/esm/nano-table-ba637f26.js.map +1 -0
  96. package/dist/esm/nano-table.entry.js +1 -1
  97. package/dist/esm/{table.worker-b53db58e.js → table.worker-1cae39c9.js} +2 -2
  98. package/dist/esm/table.worker-1cae39c9.js.map +1 -0
  99. package/dist/nano-components/nano-components.css +1 -1
  100. package/dist/nano-components/nano-components.esm.js +1 -1
  101. package/dist/nano-components/nano-components.esm.js.map +1 -1
  102. package/dist/nano-components/p-00cf8021.entry.js +5 -0
  103. package/dist/nano-components/p-00cf8021.entry.js.map +1 -0
  104. package/dist/nano-components/{p-f591400b.entry.js → p-158c73b0.entry.js} +2 -2
  105. package/dist/nano-components/p-365c997a.js +5 -0
  106. package/dist/nano-components/p-553acf24.entry.js +5 -0
  107. package/dist/nano-components/{p-58b53239.entry.js.map → p-553acf24.entry.js.map} +1 -1
  108. package/dist/nano-components/p-6975f110.entry.js +5 -0
  109. package/dist/nano-components/p-6975f110.entry.js.map +1 -0
  110. package/dist/nano-components/p-71057181.js +5 -0
  111. package/dist/nano-components/p-71057181.js.map +1 -0
  112. package/dist/nano-components/p-ad6209ec.entry.js +5 -0
  113. package/dist/nano-components/p-ad6209ec.entry.js.map +1 -0
  114. package/dist/nano-components/p-bdef618c.entry.js +5 -0
  115. package/dist/nano-components/p-bdef618c.entry.js.map +1 -0
  116. package/dist/nano-components/{p-241baff8.entry.js → p-d79c6862.entry.js} +2 -2
  117. package/dist/nano-components/p-d79c6862.entry.js.map +1 -0
  118. package/dist/nano-components/p-deb0799c.entry.js +5 -0
  119. package/dist/nano-components/{p-6a3a29c6.entry.js.map → p-deb0799c.entry.js.map} +1 -1
  120. package/dist/nano-components/p-ebb98a9e.entry.js +5 -0
  121. package/dist/nano-components/p-ebb98a9e.entry.js.map +1 -0
  122. package/dist/nano-components/p-fc585ea2.js +5 -0
  123. package/dist/nano-components/p-fc585ea2.js.map +1 -0
  124. package/dist/types/components/grid/grid-item.d.ts +3 -11
  125. package/dist/types/components/grid/grid.d.ts +44 -68
  126. package/dist/types/components/hero/hero.d.ts +1 -3
  127. package/dist/types/components/table/table.d.ts +5 -0
  128. package/dist/types/components.d.ts +85 -61
  129. package/dist/types/utils/constructible-style.d.ts +31 -0
  130. package/docs-json.json +147 -88
  131. package/docs-vscode.json +28 -21
  132. package/hydrate/index.js +340 -306
  133. package/package.json +2 -2
  134. package/dist/cjs/form-control-2e900f54.js.map +0 -1
  135. package/dist/cjs/nano-grid_3.cjs.entry.js +0 -431
  136. package/dist/cjs/nano-grid_3.cjs.entry.js.map +0 -1
  137. package/dist/cjs/nano-table-ff33dc43.js.map +0 -1
  138. package/dist/cjs/table.worker-0a6bc962.js.map +0 -1
  139. package/dist/collection/components/grid/grid-item.css +0 -15
  140. package/dist/components/grid-item.js +0 -107
  141. package/dist/components/grid-item.js.map +0 -1
  142. package/dist/esm/form-control-269ba84f.js.map +0 -1
  143. package/dist/esm/nano-grid_3.entry.js +0 -425
  144. package/dist/esm/nano-grid_3.entry.js.map +0 -1
  145. package/dist/esm/nano-table-ec980076.js.map +0 -1
  146. package/dist/esm/table.worker-b53db58e.js.map +0 -1
  147. package/dist/nano-components/p-064af7d0.js +0 -5
  148. package/dist/nano-components/p-064af7d0.js.map +0 -1
  149. package/dist/nano-components/p-107d4549.entry.js +0 -5
  150. package/dist/nano-components/p-107d4549.entry.js.map +0 -1
  151. package/dist/nano-components/p-239d343a.entry.js +0 -5
  152. package/dist/nano-components/p-239d343a.entry.js.map +0 -1
  153. package/dist/nano-components/p-241baff8.entry.js.map +0 -1
  154. package/dist/nano-components/p-58b53239.entry.js +0 -5
  155. package/dist/nano-components/p-5ac74848.js +0 -5
  156. package/dist/nano-components/p-5ac74848.js.map +0 -1
  157. package/dist/nano-components/p-6a3a29c6.entry.js +0 -5
  158. package/dist/nano-components/p-806bcd46.js +0 -5
  159. package/dist/nano-components/p-d3de231c.entry.js +0 -5
  160. package/dist/nano-components/p-d3de231c.entry.js.map +0 -1
  161. package/dist/nano-components/p-d792f692.entry.js +0 -5
  162. package/dist/nano-components/p-d792f692.entry.js.map +0 -1
  163. /package/dist/nano-components/{p-806bcd46.js.map → p-158c73b0.entry.js.map} +0 -0
  164. /package/dist/nano-components/{p-f591400b.entry.js.map → p-365c997a.js.map} +0 -0
@@ -1,27 +1,204 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
5
- import { d as debounce } from './throttle.js';
4
+ import { h, Host, getElement, proxyCustomElement, HTMLElement as HTMLElement$1 } from '@stencil/core/internal/client';
6
5
 
7
- const gridCss = ":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--grid-col-gap:var(--nano-spacing-medium, 16px);--grid-row-gap:var(--nano-spacing-medium, 16px);--current-grid-size:\"'grid size: sm'\";display:block;opacity:0;transition:0.2s ease opacity;max-width:100%}:host .grid{display:grid;grid-gap:var(--grid-row-gap) var(--grid-col-gap);block-size:inherit;min-block-size:inherit}:host(.ready){opacity:1}:host(.has-grid) .grid{display:grid}:host(.has-grid) .grid ::slotted(.nano-grid-col-start-1){grid-column-start:1 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-start-1){grid-row-start:1 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-span-1){grid-column-end:span 1 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-span-1){grid-row-end:span 1 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-start-2){grid-column-start:2 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-start-2){grid-row-start:2 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-span-2){grid-column-end:span 2 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-span-2){grid-row-end:span 2 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-start-3){grid-column-start:3 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-start-3){grid-row-start:3 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-span-3){grid-column-end:span 3 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-span-3){grid-row-end:span 3 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-start-4){grid-column-start:4 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-start-4){grid-row-start:4 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-span-4){grid-column-end:span 4 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-span-4){grid-row-end:span 4 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-start-5){grid-column-start:5 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-start-5){grid-row-start:5 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-span-5){grid-column-end:span 5 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-span-5){grid-row-end:span 5 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-start-6){grid-column-start:6 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-start-6){grid-row-start:6 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-span-6){grid-column-end:span 6 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-span-6){grid-row-end:span 6 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-start-7){grid-column-start:7 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-start-7){grid-row-start:7 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-span-7){grid-column-end:span 7 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-span-7){grid-row-end:span 7 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-start-8){grid-column-start:8 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-start-8){grid-row-start:8 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-span-8){grid-column-end:span 8 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-span-8){grid-row-end:span 8 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-start-9){grid-column-start:9 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-start-9){grid-row-start:9 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-span-9){grid-column-end:span 9 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-span-9){grid-row-end:span 9 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-start-10){grid-column-start:10 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-start-10){grid-row-start:10 !important}:host(.has-grid) .grid ::slotted(.nano-grid-col-span-10){grid-column-end:span 10 !important}:host(.has-grid) .grid ::slotted(.nano-grid-row-span-10){grid-row-end:span 10 !important}:host([content-panel]:not([content-panel=false])) .grid{grid-template-rows:auto 1fr}:host([full-height]:not([full-height=false])){block-size:100%}:host([full-height]:not([full-height=false])) .grid{grid-template-rows:1fr}:host([show-helper]:not([show-helper=false])) .grid{position:relative}:host([show-helper]:not([show-helper=false])) .grid::after{content:\"\";position:absolute;inset:0;pointer-events:none;background-image:repeating-linear-gradient(to right, rgba(126, 195, 241, 0.25), rgba(126, 195, 241, 0.25) var(--col-width), transparent var(--col-width), transparent var(--repeat-width));background-size:calc(100% + var(--grid-col-gap)) 100%;z-index:100}:host([show-helper]:not([show-helper=false])) .grid::before{content:var(--current-grid-size);font-size:30px;position:absolute;inline-size:100%;inset-inline-start:0;text-align:center;inset-block-start:50%;transform:translateY(-50%);color:rgba(0, 0, 0, 0.2);text-transform:uppercase;z-index:99;pointer-events:none}:host(.nano-grid-1){--current-grid-size:\"grid size: 1\";--col-width:calc(100% - var(--grid-col-gap));--repeat-width:calc(100% / 1)}:host(.nano-grid-1) .grid{grid-template-columns:repeat(1, minmax(var(--col-width), 1fr))}:host(.nano-grid-2){--current-grid-size:\"grid size: 2\";--col-width:calc(50% - var(--grid-col-gap));--repeat-width:calc(100% / 2)}:host(.nano-grid-2) .grid{grid-template-columns:repeat(2, minmax(var(--col-width), 1fr))}:host(.nano-grid-3){--current-grid-size:\"grid size: 3\";--col-width:calc(33.3333333333% - var(--grid-col-gap));--repeat-width:calc(100% / 3)}:host(.nano-grid-3) .grid{grid-template-columns:repeat(3, minmax(var(--col-width), 1fr))}:host(.nano-grid-4){--current-grid-size:\"grid size: 4\";--col-width:calc(25% - var(--grid-col-gap));--repeat-width:calc(100% / 4)}:host(.nano-grid-4) .grid{grid-template-columns:repeat(4, minmax(var(--col-width), 1fr))}:host(.nano-grid-5){--current-grid-size:\"grid size: 5\";--col-width:calc(20% - var(--grid-col-gap));--repeat-width:calc(100% / 5)}:host(.nano-grid-5) .grid{grid-template-columns:repeat(5, minmax(var(--col-width), 1fr))}:host(.nano-grid-6){--current-grid-size:\"grid size: 6\";--col-width:calc(16.6666666667% - var(--grid-col-gap));--repeat-width:calc(100% / 6)}:host(.nano-grid-6) .grid{grid-template-columns:repeat(6, minmax(var(--col-width), 1fr))}:host(.nano-grid-7){--current-grid-size:\"grid size: 7\";--col-width:calc(14.2857142857% - var(--grid-col-gap));--repeat-width:calc(100% / 7)}:host(.nano-grid-7) .grid{grid-template-columns:repeat(7, minmax(var(--col-width), 1fr))}:host(.nano-grid-8){--current-grid-size:\"grid size: 8\";--col-width:calc(12.5% - var(--grid-col-gap));--repeat-width:calc(100% / 8)}:host(.nano-grid-8) .grid{grid-template-columns:repeat(8, minmax(var(--col-width), 1fr))}:host(.nano-grid-9){--current-grid-size:\"grid size: 9\";--col-width:calc(11.1111111111% - var(--grid-col-gap));--repeat-width:calc(100% / 9)}:host(.nano-grid-9) .grid{grid-template-columns:repeat(9, minmax(var(--col-width), 1fr))}:host(.nano-grid-10){--current-grid-size:\"grid size: 10\";--col-width:calc(10% - var(--grid-col-gap));--repeat-width:calc(100% / 10)}:host(.nano-grid-10) .grid{grid-template-columns:repeat(10, minmax(var(--col-width), 1fr))}";
6
+ // import type { VNode, HTMLStencilElement } from "@stencil/core";
7
+ const supportsConstructibleStylesheets = (() => {
8
+ try {
9
+ return !!new CSSStyleSheet();
10
+ }
11
+ catch (e) {
12
+ return false;
13
+ }
14
+ })();
15
+ const cacheKeys = new WeakMap();
16
+ /**
17
+ * Dynamically create a constructible stylesheet which is applied to the component.
18
+ * The stylesheet is then cached for future instances of the component.
19
+ * @usage
20
+ As a string:
21
+ ```
22
+ @ConstructableStyle() style = `.bg { background: url('assets/${ this.mode }/bg.png'); }`;
23
+ ```
24
+ As a function:
25
+ ```
26
+ @ConstructableStyle() style = () => `.bg { background: url('assets/${ this.mode }/bg.png'); }`;
27
+ ```
28
+ * @param opts - optional `cacheKeyProperty` - in case an instance of a component could produce different styles based on variables.
29
+ * @returns `@ConstructableStyle` decorator
30
+ */
31
+ function ConstructibleStyle(opts = {}) {
32
+ return (target, propertyKey) => {
33
+ if (!opts.cacheKeyProperty) {
34
+ opts.cacheKeyProperty = propertyKey;
35
+ }
36
+ const { componentWillLoad, render, componentWillRender } = target;
37
+ if (!componentWillLoad)
38
+ console.warn(`ConstructibleStyle requires you to have a \`componentWillLoad\` lifecycle method in \`${target.constructor.name}\`. Failure to add this function may cause ConstructibleStyle to fail due to StencilJS build optimizations.`);
39
+ if (supportsConstructibleStylesheets) {
40
+ const addStylesheet = (instance) => {
41
+ if (!instance[opts.cacheKeyProperty] ||
42
+ (cacheKeys.get(instance) &&
43
+ cacheKeys.get(instance) === instance[opts.cacheKeyProperty]))
44
+ return;
45
+ cacheKeys.set(instance, instance[opts.cacheKeyProperty]);
46
+ const host = getElement(instance);
47
+ const cssText = typeof instance[propertyKey] === 'function'
48
+ ? instance[propertyKey]()
49
+ : instance[propertyKey];
50
+ const root = (host.shadowRoot || document);
51
+ root.adoptedStyleSheets = [
52
+ ...(root.adoptedStyleSheets || []),
53
+ getOrCreateStylesheet(instance, target, cssText, opts),
54
+ ];
55
+ };
56
+ target.componentWillLoad = function () {
57
+ const willLoadResult = componentWillLoad && componentWillLoad.call(this);
58
+ addStylesheet(this);
59
+ return willLoadResult;
60
+ };
61
+ target.componentWillRender = function () {
62
+ const willRenderResult = componentWillRender && componentWillRender.call(this);
63
+ addStylesheet(this);
64
+ return willRenderResult;
65
+ };
66
+ }
67
+ else {
68
+ target.render = function () {
69
+ const cssText = typeof this[propertyKey] === 'function'
70
+ ? this[propertyKey]()
71
+ : this[propertyKey];
72
+ let renderedNode = render.call(this);
73
+ if (isHost(renderedNode)) {
74
+ appendStyleToHost(renderedNode, target.constructor.name, cssText);
75
+ }
76
+ else {
77
+ renderedNode = h(Host, null, renderedNode);
78
+ if (!('attachShadow' in HTMLElement.prototype)) {
79
+ appendStyleToHost(renderedNode, target.constructor.name, cssText);
80
+ }
81
+ else {
82
+ if (!target.__constructableStyle) {
83
+ const style = document.createElement('style');
84
+ style.setAttribute('type', 'text/css');
85
+ style.setAttribute('constructible-style', target.constructor.name);
86
+ style.innerHTML = cssText;
87
+ target.__constructableStyle = style;
88
+ document.head.appendChild(style);
89
+ }
90
+ }
91
+ }
92
+ return renderedNode;
93
+ };
94
+ }
95
+ };
96
+ }
97
+ function appendStyleToHost(node, targetName, cssText) {
98
+ (getHostChildren(node) || []).push(h("style", { type: "text/css", "constructible-style": targetName }, cssText));
99
+ }
100
+ function getOrCreateStylesheet(instance, target, cssText, opts) {
101
+ if (!target.__constructableStyle) {
102
+ target.__constructableStyle = {};
103
+ }
104
+ const key = instance[opts.cacheKeyProperty];
105
+ if (!target.__constructableStyle[key]) {
106
+ target.__constructableStyle[key] = new CSSStyleSheet();
107
+ target.__constructableStyle[key].replace(cssText);
108
+ }
109
+ return target.__constructableStyle[key];
110
+ }
111
+ function isHost(node) {
112
+ for (const prop in node) {
113
+ if (node.hasOwnProperty(prop)) {
114
+ if (node[prop] === Host) {
115
+ return true;
116
+ }
117
+ }
118
+ }
119
+ return false;
120
+ }
121
+ function getHostChildren(node) {
122
+ for (const prop in node) {
123
+ if (node.hasOwnProperty(prop)) {
124
+ if (Array.isArray(node[prop])) {
125
+ return node[prop];
126
+ }
127
+ }
128
+ }
129
+ }
130
+
131
+ const gridCss = ":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--grid-col-gap:var(--nano-spacing-medium, 16px);--grid-row-gap:var(--nano-spacing-medium, 16px);--current-grid-size:\"grid size: s\";container-type:inline-size;display:block}:host .grid{display:grid;gap:var(--grid-row-gap) var(--grid-col-gap);block-size:inherit;min-block-size:inherit}:host([show-helper]:not([show-helper=false])){position:relative}:host([show-helper]:not([show-helper=false])) .grid--helper{position:absolute;inset:0;pointer-events:none}:host([show-helper]:not([show-helper=false])) .grid--helper::before{content:var(--current-grid-size);font-size:30px;position:absolute;inline-size:100%;inset-inline-start:0;text-align:center;inset-block-start:50%;transform:translateY(-50%);color:rgba(0, 0, 0, 0.2);text-transform:uppercase;z-index:99;pointer-events:none}:host([show-helper]:not([show-helper=false])) .grid__helper-item{display:none;background:rgba(126, 195, 241, 0.25)}";
8
132
 
9
- const STATEOPTS = ['col-span', 'col-start', 'row-span', 'row-start'];
10
- const Grid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
133
+ var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
134
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
135
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
136
+ r = Reflect.decorate(decorators, target, key, desc);
137
+ else
138
+ for (var i = decorators.length - 1; i >= 0; i--)
139
+ if (d = decorators[i])
140
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
141
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
142
+ };
143
+ var __metadata = (undefined && undefined.__metadata) || function (k, v) {
144
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
145
+ return Reflect.metadata(k, v);
146
+ };
147
+ const Grid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement$1 {
11
148
  constructor() {
12
149
  super();
13
150
  this.__registerHost();
14
151
  this.__attachShadow();
15
- this.nanoBpChange = createEvent(this, "nanoBpChange", 7);
16
- this.generalClasses = [''];
17
- this.gridClass = null;
18
- this.isSizes = [null];
19
- this.ready = false;
20
- this.isSmall = false;
21
- this.isMedium = false;
22
- this.isLarge = false;
23
- this.isXL = false;
24
- this.isXXL = false;
152
+ this.grids = [];
153
+ this.styles = () => {
154
+ const css = /* css */ `
155
+ ${this.grids
156
+ .map((bp) => /* css */ `
157
+ @container (min-width: ${typeof bp.breakpoint === 'number'
158
+ ? bp.breakpoint + 1 + 'px'
159
+ : bp.breakpoint}) {
160
+ .grid {
161
+ --current-grid-size: "grid size: ${bp.name}";
162
+ ${bp.template
163
+ ? `grid-template: ${bp.template};`
164
+ : `grid-template-columns: repeat(${bp.cols}, 1fr);`}
165
+ }
166
+ ${[...Array(bp.cols)]
167
+ .map((_, i) => {
168
+ const gItm = i + 1;
169
+ return /* css */ `
170
+ .grid > [grid-states~="${bp.name}-col-start-${gItm}"],
171
+ ::slotted([grid-states~="${bp.name}-col-start-${gItm}"]) {
172
+ grid-column-start: ${gItm} !important;
173
+ }
174
+ .grid > [grid-states~="${bp.name}-row-start-${gItm}"],
175
+ ::slotted([grid-states~="${bp.name}-row-start-${gItm}"]) {
176
+ grid-row-start: ${gItm} !important;
177
+ }
178
+ .grid > [grid-states~="${bp.name}-col-span-${gItm}"],
179
+ ::slotted([grid-states~="${bp.name}-col-span-${gItm}"]) {
180
+ grid-column-end: span ${gItm} !important;
181
+ }
182
+ .grid > [grid-states~="${bp.name}-row-span-${gItm}"],
183
+ ::slotted([grid-states~="${bp.name}-row-span-${gItm}"]) {
184
+ grid-row-end: span ${gItm} !important;
185
+ }
186
+ `;
187
+ })
188
+ .join('')}
189
+ ${this.showHelper &&
190
+ /* css */ `
191
+ .grid--helper :nth-child(-n+${bp.cols}) {
192
+ display: block !important;
193
+ }
194
+ `}
195
+ }
196
+ `)
197
+ .join('')}
198
+ `;
199
+ return css;
200
+ };
201
+ this.cacheKey = undefined;
25
202
  this.sSize = 300;
26
203
  this.mSize = 550;
27
204
  this.lSize = 800;
@@ -31,195 +208,103 @@ const Grid = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
31
208
  this.lCols = undefined;
32
209
  this.xlCols = undefined;
33
210
  this.xxlCols = undefined;
211
+ this.sTpl = undefined;
212
+ this.mTpl = undefined;
213
+ this.lTpl = undefined;
214
+ this.xlTpl = undefined;
215
+ this.xxlTpl = undefined;
34
216
  this.showHelper = false;
35
- this.contentPanel = false;
36
- this.fullHeight = false;
37
- this.stateChange = debounce(this.stateChange.bind(this), 100);
38
- }
39
- propChanged() {
40
- this.applySizeClasses();
41
217
  }
42
- applySizeClasses() {
43
- const size = this.currentWidth;
44
- this.isSmall = false;
45
- this.isMedium = false;
46
- this.isLarge = false;
47
- this.isXL = false;
48
- this.isXXL = false;
49
- this.generalClasses = [];
50
- this.gridClass = null;
51
- this.isSizes = [null];
52
- this.isSmall = true;
53
- this.generalClasses.push('is-small');
218
+ constructSizeArray() {
219
+ this.grids = [];
54
220
  if (this.sCols)
55
- this.gridClass = `nano-grid-${this.sCols}`;
56
- this.isSizes.push({ size: 's', active: true });
57
- if (size > this.sSize) {
58
- this.isMedium = true;
59
- this.generalClasses.push('is-medium');
60
- if (this.mCols)
61
- this.gridClass = `nano-grid-${this.mCols}`;
62
- this.isSizes.push({ size: 'm', active: true });
63
- }
64
- if (size > this.mSize) {
65
- this.isLarge = true;
66
- this.generalClasses.push('is-large');
67
- if (this.lCols)
68
- this.gridClass = `nano-grid-${this.lCols}`;
69
- this.isSizes.push({ size: 'l', active: true });
70
- }
71
- if (size > this.lSize) {
72
- this.isXL = true;
73
- this.generalClasses.push('is-xl');
74
- if (this.xlCols)
75
- this.gridClass = `nano-grid-${this.xlCols}`;
76
- this.isSizes.push({ size: 'xl', active: true });
77
- }
78
- if (size > this.xlSize) {
79
- this.isXXL = true;
80
- this.generalClasses.push('is-xxl');
81
- if (this.xxlCols)
82
- this.gridClass = `nano-grid-${this.xxlCols}`;
83
- this.isSizes.push({ size: 'xxl', active: true });
84
- }
85
- this.el.style.setProperty('--current-grid-size', `'grid size: ${this.isSizes.slice().pop().size}'`);
86
- this.applyChildrenClasses();
87
- setTimeout(() => (this.ready = true), 0);
88
- }
89
- stateChange() {
90
- this.nanoBpChange.emit(this.generalClasses);
91
- }
92
- applyChildrenClasses() {
93
- const gridItems = this.el.querySelectorAll('nano-grid-item');
94
- if (gridItems.length) {
95
- gridItems.forEach((gridItem) => {
96
- gridItem.changeBP(this.isSizes);
221
+ this.grids.push({
222
+ cols: this.sCols,
223
+ breakpoint: 0,
224
+ name: 's',
225
+ template: this.sTpl,
97
226
  });
98
- return;
99
- }
100
- // this logic has been put into grid-item. Keep here for legacy for now
101
- let stateArr = [''];
102
- let itemState = '';
103
- let found;
104
- let classes;
105
- const ctx = this.el;
106
- // item states come in 4 possible flavours at every breakpoint. E.g.
107
- // xl-col-span-2
108
- // xl-col-start-2
109
- // xl-row-span-2
110
- // xl-row-start-2
111
- // loop through all grid items with states.
112
- [].map.call(ctx.children, (gItem) => {
113
- if (!gItem.hasAttribute('grid-states'))
114
- return;
115
- // gridItems.forEach(gItem => {
116
- // clear all previous grid state classnames
117
- classes = gItem.className
118
- .split(' ')
119
- .filter((c) => !c.startsWith('nano-grid-'));
120
- gItem.className = classes.join(' ').trim();
121
- // get all potential states this element can have
122
- const itemStates = gItem.getAttribute('grid-states').split(' ');
123
- // loop through all potential state options: col & row span & start
124
- STATEOPTS.forEach((stateOpt) => {
125
- // reset found flag
126
- found = false;
127
- // loop through all the current valid breakpoints / sizes backwards because
128
- // we only care about the item's state at the largest current breakpoint.
129
- this.isSizes
130
- .slice()
131
- .reverse()
132
- .forEach(function (size) {
133
- if (found || !size)
134
- return;
135
- found = itemStates.find((state) => state.indexOf(`${size.size}-${stateOpt}`) === 0);
136
- // found a state at this current size. apply class.
137
- if (found) {
138
- // clear previous grid state classname
139
- classes = gItem.className
140
- .split(' ')
141
- .filter((c) => !c.includes('nano-grid-${stateOpt}'));
142
- gItem.className = classes.join(' ').trim();
143
- stateArr = found.split('-');
144
- // remove the size of the state
145
- stateArr.shift();
146
- itemState = stateArr.join('-');
147
- // add new class
148
- gItem.classList.add(`nano-grid-${itemState}`);
149
- }
150
- });
227
+ if (this.mCols)
228
+ this.grids.push({
229
+ cols: this.mCols,
230
+ breakpoint: this.sSize,
231
+ name: 'm',
232
+ template: this.mTpl,
233
+ });
234
+ if (this.lSize)
235
+ this.grids.push({
236
+ cols: this.lCols,
237
+ breakpoint: this.mSize,
238
+ name: 'l',
239
+ template: this.lTpl,
240
+ });
241
+ if (this.xlCols)
242
+ this.grids.push({
243
+ cols: this.xlCols,
244
+ breakpoint: this.lSize,
245
+ name: 'xl',
246
+ template: this.xlTpl,
151
247
  });
152
- });
248
+ if (this.xxlCols)
249
+ this.grids.push({
250
+ cols: this.xxlCols,
251
+ breakpoint: this.xlSize,
252
+ name: 'xxl',
253
+ template: this.xxlTpl,
254
+ });
255
+ this.cacheKey =
256
+ this.grids
257
+ .map((bp) => `${bp.cols}-${bp.breakpoint}-${bp.template || ''}`)
258
+ .join('') +
259
+ '-helper-' +
260
+ this.showHelper;
153
261
  }
154
262
  componentWillLoad() {
155
- const ctx = this.el;
156
- [].map.call(ctx.children, (ele) => ele.classList.add('nano-griditem'));
157
- }
158
- componentDidLoad() {
159
- if (!window['ResizeObserver'])
160
- return;
161
- this.ro = new ResizeObserver((entries) => {
162
- for (const entry of entries) {
163
- if (!entry.contentRect.width)
164
- return;
165
- this.currentWidth = entry.contentRect.width;
166
- this.applySizeClasses();
167
- }
168
- });
169
- this.ro.observe(this.el);
170
- }
171
- disconnectedCallback() {
172
- if (this.ro)
173
- this.ro.disconnect();
263
+ this.constructSizeArray();
174
264
  }
175
265
  render() {
176
- return (h(Host, { class: {
177
- [this.generalClasses.join(' ')]: true,
178
- 'has-grid': !!this.gridClass,
179
- ready: this.ready,
180
- [this.gridClass]: true,
181
- } }, h("div", { class: {
182
- grid: true,
183
- } }, h("slot", null))));
266
+ return (h(Host, null, h("div", { part: "grid", class: "grid" }, h("slot", null)), this.showHelper && (h("div", { class: "grid grid--helper", part: "helper" }, [...Array(24)].map(() => (h("div", { class: "grid__helper-item" })))))));
184
267
  }
185
- get el() { return this; }
186
268
  static get watchers() { return {
187
- "sSize": ["propChanged"],
188
- "mSize": ["propChanged"],
189
- "lSize": ["propChanged"],
190
- "xlSize": ["propChanged"],
191
- "sCols": ["propChanged"],
192
- "mCols": ["propChanged"],
193
- "lCols": ["propChanged"],
194
- "xlCols": ["propChanged"],
195
- "xxlCols": ["propChanged"],
196
- "isSmall": ["stateChange"],
197
- "isMedium": ["stateChange"],
198
- "isLarge": ["stateChange"],
199
- "isXL": ["stateChange"],
200
- "isXXL": ["stateChange"]
269
+ "sTpl": ["constructSizeArray"],
270
+ "mTpl": ["constructSizeArray"],
271
+ "lTpl": ["constructSizeArray"],
272
+ "xlTpl": ["constructSizeArray"],
273
+ "xxlTpl": ["constructSizeArray"],
274
+ "sSize": ["constructSizeArray"],
275
+ "mSize": ["constructSizeArray"],
276
+ "lSize": ["constructSizeArray"],
277
+ "xlSize": ["constructSizeArray"],
278
+ "sCols": ["constructSizeArray"],
279
+ "mCols": ["constructSizeArray"],
280
+ "lCols": ["constructSizeArray"],
281
+ "xlCols": ["constructSizeArray"],
282
+ "xxlCols": ["constructSizeArray"],
283
+ "showHelper": ["constructSizeArray"]
201
284
  }; }
202
285
  static get style() { return gridCss; }
203
286
  }, [1, "nano-grid", {
204
- "sSize": [2, "s-size"],
205
- "mSize": [2, "m-size"],
206
- "lSize": [2, "l-size"],
207
- "xlSize": [2, "xl-size"],
287
+ "sSize": [8, "s-size"],
288
+ "mSize": [8, "m-size"],
289
+ "lSize": [8, "l-size"],
290
+ "xlSize": [8, "xl-size"],
208
291
  "sCols": [2, "s-cols"],
209
292
  "mCols": [2, "m-cols"],
210
293
  "lCols": [2, "l-cols"],
211
294
  "xlCols": [2, "xl-cols"],
212
295
  "xxlCols": [2, "xxl-cols"],
296
+ "sTpl": [1, "s-tpl"],
297
+ "mTpl": [1, "m-tpl"],
298
+ "lTpl": [1, "l-tpl"],
299
+ "xlTpl": [1, "xl-tpl"],
300
+ "xxlTpl": [1, "xxl-tpl"],
213
301
  "showHelper": [516, "show-helper"],
214
- "contentPanel": [516, "content-panel"],
215
- "fullHeight": [516, "full-height"],
216
- "ready": [32],
217
- "isSmall": [32],
218
- "isMedium": [32],
219
- "isLarge": [32],
220
- "isXL": [32],
221
- "isXXL": [32]
302
+ "cacheKey": [32]
222
303
  }]);
304
+ __decorate([
305
+ ConstructibleStyle({ cacheKeyProperty: 'cacheKey' }),
306
+ __metadata("design:type", Object)
307
+ ], Grid.prototype, "styles", void 0);
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I,CAAC,SAAS,GAAG,IAAI;OACvB,IAED,WACE,KAAK,EAAE;QACL,IAAI,EAAE,IAAI;OACX,IAED,eAAQ,CACJ,CACD,EACP;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/grid/grid.scss?tag=nano-grid&encapsulation=shadow","./src/components/grid/grid.tsx"],"sourcesContent":["@use 'sass:math';\n\n@import '../../global/style/nano-theme/base';\n\n// ie 11 fixes ... maximum numbers we can place on the grid ... upping this number decreases performance a lot.\n$max-grid-cols: 10;\n\n@mixin grid($size: 1) {\n @at-root :host(.nano-grid-#{$size}) {\n --current-grid-size: 'grid size: #{$size}';\n --col-width: calc(#{math.div(100, $size)}% - var(--grid-col-gap));\n --repeat-width: calc(100% / #{$size});\n\n .grid {\n grid-template-columns: repeat(#{$size}, minmax(var(--col-width), 1fr));\n\n $current-column: 1;\n $current-row: 1;\n\n @for $i from 1 through ($max-grid-cols * 2) {\n @if $current-column > $size {\n $current-column: 1;\n $current-row: $current-row + 1;\n }\n $current-column: $current-column + 1;\n }\n }\n }\n}\n\n@mixin grid-spans {\n @for $i from 1 through $max-grid-cols {\n ::slotted(.nano-grid-col-start-#{$i}) {\n grid-column-start: #{$i} !important;\n }\n\n ::slotted(.nano-grid-row-start-#{$i}) {\n grid-row-start: #{$i} !important;\n }\n\n ::slotted(.nano-grid-col-span-#{$i}) {\n grid-column-end: span #{$i} !important;\n }\n\n ::slotted(.nano-grid-row-span-#{$i}) {\n grid-row-end: span #{$i} !important;\n }\n }\n}\n\n:host {\n /**\n * @prop --grid-col-gap: gap between all columns. Defaults to theme's global padding\n * @prop --grid-row-gap: gap between all rows. Defaults to theme's global padding\n */\n\n --grid-col-gap: #{$spacing-medium};\n --grid-row-gap: #{$spacing-medium};\n --current-grid-size: \"'grid size: sm'\";\n\n display: block;\n opacity: 0;\n transition: 0.2s ease opacity;\n max-width: 100%;\n\n .grid {\n /* autoprefixer: ignore next */\n display: grid;\n\n /* autoprefixer: ignore next */\n grid-gap: var(--grid-row-gap) var(--grid-col-gap);\n block-size: inherit;\n min-block-size: inherit;\n }\n}\n\n:host(.ready) {\n opacity: 1;\n}\n\n:host(.has-grid) {\n .grid {\n display: grid;\n\n @include grid-spans;\n }\n}\n\n:host([content-panel]:not([content-panel='false'])) {\n .grid {\n grid-template-rows: auto 1fr;\n }\n}\n\n:host([full-height]:not([full-height='false'])) {\n block-size: 100%;\n\n .grid {\n grid-template-rows: 1fr;\n }\n}\n\n:host([show-helper]:not([show-helper='false'])) {\n .grid {\n position: relative;\n\n &::after {\n content: '';\n position: absolute;\n inset: 0;\n pointer-events: none;\n background-image:\n repeating-linear-gradient(\n to right,\n hsl(204deg 80% 72% / 25%),\n hsl(204deg 80% 72% / 25%) var(--col-width),\n transparent var(--col-width),\n transparent var(--repeat-width)\n );\n background-size: calc(100% + var(--grid-col-gap)) 100%;\n z-index: 100;\n }\n\n &::before {\n content: var(--current-grid-size);\n font-size: 30px;\n position: absolute;\n inline-size: 100%;\n inset-inline-start: 0;\n text-align: center;\n inset-block-start: 50%;\n transform: translateY(-50%);\n color: rgb(0 0 0 / 20%);\n text-transform: uppercase;\n z-index: 99;\n pointer-events: none;\n }\n }\n}\n\n@for $i from 1 through $max-grid-cols {\n @include grid($i);\n}\n","import {\n Component,\n h,\n Prop,\n Element,\n Host,\n State,\n Watch,\n Event,\n EventEmitter,\n} from '@stencil/core';\nimport { debounce } from '../../utils/throttle';\nimport type { GridSizes } from '../../interface';\n\nconst STATEOPTS = ['col-span', 'col-start', 'row-span', 'row-start'];\n\n/**\n * A context-aware CSS grid implementation.\n * Uses it's own width to choose column number - not screen width.\n */\n@Component({\n tag: 'nano-grid',\n styleUrl: 'grid.scss',\n shadow: true,\n})\nexport class Grid {\n @Element() private el: HTMLNanoGridElement;\n private ro: ResizeObserver;\n private generalClasses: Array<string> = [''];\n private gridClass: string = null;\n private isSizes: GridSizes[] = [null];\n private currentWidth: number;\n\n constructor() {\n this.stateChange = debounce(this.stateChange.bind(this), 100);\n }\n\n @State() ready: boolean = false;\n @State() isSmall = false;\n @State() isMedium = false;\n @State() isLarge = false;\n @State() isXL = false;\n @State() isXXL = false;\n\n /**\n * the component's small breakpoint. Note - all breakpoints are based on component width, not screen width.\n */\n @Prop() sSize: number = 300;\n\n /**\n * the component's medium breakpoint. Note - all breakpoints are based on component width, not screen width.\n */\n @Prop() mSize: number = 550;\n\n /**\n * the component's large breakpoint. Note - all breakpoints are based on component width, not screen width.\n */\n @Prop() lSize: number = 800;\n\n /**\n * the component's xl breakpoint. Note - all breakpoints are based on component width, not screen width.\n */\n @Prop() xlSize: number = 1000;\n\n /**\n * the number of columns the grid has at the small breakpoint.\n */\n @Prop() sCols: number;\n\n /**\n * the number of columns the grid has at the medium breakpoint.\n */\n @Prop() mCols: number;\n\n /**\n * the number of columns the grid has at the large breakpoint.\n */\n @Prop() lCols: number;\n\n /**\n * the number of columns the grid has at the xl breakpoint.\n */\n @Prop() xlCols: number;\n\n /**\n * the number of columns the grid has at the xxl breakpoint (anything greater than the xl breakpoint)\n */\n @Prop() xxlCols: number;\n\n /**\n * shows a grid helper to visualise where columns are\n */\n @Prop({ reflect: true }) showHelper: boolean = false;\n\n /**\n * shortcut for a traditional website like grid (requires more than one row). The second row will auto expand to fill the grid height. The first row and > 2nd row will be the size of their content. e.g. header, body and footer.\n */\n @Prop({ reflect: true }) contentPanel: boolean = false;\n\n /**\n * Helper to make grid items expand to full height in IE11\n */\n @Prop({ reflect: true }) fullHeight: boolean = false;\n\n /**\n * Emitted when the `nano-grid` changes breakpoint\n */\n @Event() nanoBpChange: EventEmitter<string[]>;\n\n @Watch('sSize')\n @Watch('mSize')\n @Watch('lSize')\n @Watch('xlSize')\n @Watch('sCols')\n @Watch('mCols')\n @Watch('lCols')\n @Watch('xlCols')\n @Watch('xxlCols')\n propChanged() {\n this.applySizeClasses();\n }\n\n private applySizeClasses() {\n const size = this.currentWidth;\n\n this.isSmall = false;\n this.isMedium = false;\n this.isLarge = false;\n this.isXL = false;\n this.isXXL = false;\n\n this.generalClasses = [];\n this.gridClass = null;\n this.isSizes = [null];\n\n this.isSmall = true;\n this.generalClasses.push('is-small');\n if (this.sCols) this.gridClass = `nano-grid-${this.sCols}`;\n this.isSizes.push({ size: 's', active: true });\n\n if (size > this.sSize) {\n this.isMedium = true;\n this.generalClasses.push('is-medium');\n if (this.mCols) this.gridClass = `nano-grid-${this.mCols}`;\n this.isSizes.push({ size: 'm', active: true });\n }\n\n if (size > this.mSize) {\n this.isLarge = true;\n this.generalClasses.push('is-large');\n if (this.lCols) this.gridClass = `nano-grid-${this.lCols}`;\n this.isSizes.push({ size: 'l', active: true });\n }\n\n if (size > this.lSize) {\n this.isXL = true;\n this.generalClasses.push('is-xl');\n if (this.xlCols) this.gridClass = `nano-grid-${this.xlCols}`;\n this.isSizes.push({ size: 'xl', active: true });\n }\n\n if (size > this.xlSize) {\n this.isXXL = true;\n this.generalClasses.push('is-xxl');\n if (this.xxlCols) this.gridClass = `nano-grid-${this.xxlCols}`;\n this.isSizes.push({ size: 'xxl', active: true });\n }\n\n this.el.style.setProperty(\n '--current-grid-size',\n `'grid size: ${this.isSizes.slice().pop().size}'`\n );\n this.applyChildrenClasses();\n setTimeout(() => (this.ready = true), 0);\n }\n\n @Watch('isSmall')\n @Watch('isMedium')\n @Watch('isLarge')\n @Watch('isXL')\n @Watch('isXXL')\n stateChange() {\n this.nanoBpChange.emit(this.generalClasses);\n }\n\n private applyChildrenClasses() {\n const gridItems = this.el.querySelectorAll('nano-grid-item');\n if (gridItems.length) {\n gridItems.forEach((gridItem: HTMLNanoGridItemElement) => {\n gridItem.changeBP(this.isSizes);\n });\n return;\n }\n\n // this logic has been put into grid-item. Keep here for legacy for now\n let stateArr: Array<string> = [''];\n let itemState: string = '';\n let found: any;\n let classes: Array<string>;\n\n const ctx = this.el;\n\n // item states come in 4 possible flavours at every breakpoint. E.g.\n // xl-col-span-2\n // xl-col-start-2\n // xl-row-span-2\n // xl-row-start-2\n\n // loop through all grid items with states.\n [].map.call(ctx.children, (gItem: HTMLElement) => {\n if (!gItem.hasAttribute('grid-states')) return;\n\n // gridItems.forEach(gItem => {\n\n // clear all previous grid state classnames\n classes = gItem.className\n .split(' ')\n .filter((c) => !c.startsWith('nano-grid-'));\n gItem.className = classes.join(' ').trim();\n\n // get all potential states this element can have\n const itemStates = gItem.getAttribute('grid-states').split(' ');\n\n // loop through all potential state options: col & row span & start\n STATEOPTS.forEach((stateOpt) => {\n // reset found flag\n found = false;\n\n // loop through all the current valid breakpoints / sizes backwards because\n // we only care about the item's state at the largest current breakpoint.\n this.isSizes\n .slice()\n .reverse()\n .forEach(function (size) {\n if (found || !size) return;\n found = itemStates.find(\n (state) => state.indexOf(`${size.size}-${stateOpt}`) === 0\n );\n\n // found a state at this current size. apply class.\n if (found) {\n // clear previous grid state classname\n classes = gItem.className\n .split(' ')\n .filter((c) => !c.includes('nano-grid-${stateOpt}'));\n gItem.className = classes.join(' ').trim();\n\n stateArr = found.split('-');\n\n // remove the size of the state\n stateArr.shift();\n itemState = stateArr.join('-');\n\n // add new class\n gItem.classList.add(`nano-grid-${itemState}`);\n }\n });\n });\n });\n }\n\n componentWillLoad() {\n const ctx = this.el;\n [].map.call(ctx.children, (ele: HTMLElement) =>\n ele.classList.add('nano-griditem')\n );\n }\n\n componentDidLoad() {\n if (!window['ResizeObserver']) return;\n\n this.ro = new ResizeObserver((entries) => {\n for (const entry of entries) {\n if (!entry.contentRect.width) return;\n this.currentWidth = entry.contentRect.width;\n this.applySizeClasses();\n }\n });\n this.ro.observe(this.el);\n }\n\n disconnectedCallback() {\n if (this.ro) this.ro.disconnect();\n }\n\n render() {\n return (\n <Host\n class={{\n [this.generalClasses.join(' ')]: true,\n 'has-grid': !!this.gridClass,\n ready: this.ready,\n [this.gridClass]: true,\n }}\n >\n <div\n class={{\n grid: true,\n }}\n >\n <slot />\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":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id.scss?tag=nano-grid&encapsulation=shadow","./src/components/grid/grid.tsx"],"sourcesContent":["import { h, Host, getElement, VNode, ComponentInterface } from '@stencil/core';\n// import type { VNode, HTMLStencilElement } from \"@stencil/core\";\n\nconst supportsConstructibleStylesheets = (() => {\n try {\n return !!new CSSStyleSheet();\n } catch (e) {\n return false;\n }\n})();\n\nconst cacheKeys: WeakMap<ComponentInterface, string> = new WeakMap();\n\ndeclare type ConstructibleStyleDecorator = (\n target: ComponentInterface,\n propertyKey: string\n) => void;\n\n/**\n * Dynamically create a constructible stylesheet which is applied to the component.\n * The stylesheet is then cached for future instances of the component.\n * @usage\nAs a string:\n```\n@ConstructableStyle() style = `.bg { background: url('assets/${ this.mode }/bg.png'); }`;\n```\nAs a function:\n```\n@ConstructableStyle() style = () => `.bg { background: url('assets/${ this.mode }/bg.png'); }`;\n```\n * @param opts - optional `cacheKeyProperty` - in case an instance of a component could produce different styles based on variables.\n * @returns `@ConstructableStyle` decorator\n */\nexport function ConstructibleStyle(\n opts: ConstructibleStyleOptions = {}\n): ConstructibleStyleDecorator {\n return (target: ComponentInterface, propertyKey: string) => {\n if (!opts.cacheKeyProperty) {\n opts.cacheKeyProperty = propertyKey;\n }\n\n const { componentWillLoad, render, componentWillRender } = target;\n if (!componentWillLoad)\n console.warn(\n `ConstructibleStyle requires you to have a \\`componentWillLoad\\` lifecycle method in \\`${target.constructor.name}\\`. Failure to add this function may cause ConstructibleStyle to fail due to StencilJS build optimizations.`\n );\n\n if (supportsConstructibleStylesheets) {\n const addStylesheet = (instance: ComponentInterface) => {\n if (\n !instance[opts.cacheKeyProperty] ||\n (cacheKeys.get(instance) &&\n cacheKeys.get(instance) === instance[opts.cacheKeyProperty])\n )\n return;\n\n cacheKeys.set(instance, instance[opts.cacheKeyProperty]);\n const host = getElement(instance);\n const cssText =\n typeof instance[propertyKey] === 'function'\n ? instance[propertyKey]()\n : instance[propertyKey];\n const root = (host.shadowRoot || document) as any;\n root.adoptedStyleSheets = [\n ...(root.adoptedStyleSheets || []),\n getOrCreateStylesheet(instance, target, cssText, opts),\n ];\n };\n\n target.componentWillLoad = function () {\n const willLoadResult =\n componentWillLoad && componentWillLoad.call(this);\n addStylesheet(this);\n return willLoadResult;\n };\n\n target.componentWillRender = function () {\n const willRenderResult =\n componentWillRender && componentWillRender.call(this);\n addStylesheet(this);\n return willRenderResult;\n };\n } else {\n target.render = function () {\n const cssText =\n typeof this[propertyKey] === 'function'\n ? this[propertyKey]()\n : this[propertyKey];\n let renderedNode: VNode = render.call(this);\n\n if (isHost(renderedNode)) {\n appendStyleToHost(renderedNode, target.constructor.name, cssText);\n } else {\n renderedNode = <Host>{renderedNode}</Host>;\n\n if (!('attachShadow' in HTMLElement.prototype)) {\n appendStyleToHost(renderedNode, target.constructor.name, cssText);\n } else {\n if (!target.__constructableStyle) {\n const style = document.createElement('style');\n style.setAttribute('type', 'text/css');\n style.setAttribute(\n 'constructible-style',\n target.constructor.name\n );\n style.innerHTML = cssText;\n target.__constructableStyle = style;\n document.head.appendChild(style);\n }\n }\n }\n\n return renderedNode;\n };\n }\n };\n}\n\nfunction appendStyleToHost(node, targetName, cssText) {\n (getHostChildren(node) || []).push(\n <style type=\"text/css\" constructible-style={targetName}>\n {cssText}\n </style>\n );\n}\n\nfunction getOrCreateStylesheet(\n instance: ComponentInterface,\n target: ComponentInterface,\n cssText: string,\n opts: ConstructibleStyleOptions\n): CSSStyleSheet {\n if (!target.__constructableStyle) {\n target.__constructableStyle = {};\n }\n\n const key = instance[opts.cacheKeyProperty];\n\n if (!target.__constructableStyle[key]) {\n target.__constructableStyle[key] = new CSSStyleSheet();\n target.__constructableStyle[key].replace(cssText);\n }\n\n return target.__constructableStyle[key];\n}\n\nfunction isHost(node): boolean {\n for (const prop in node) {\n if (node.hasOwnProperty(prop)) {\n if (node[prop] === Host) {\n return true;\n }\n }\n }\n return false;\n}\n\nfunction getHostChildren(node): Array<VNode> {\n for (const prop in node) {\n if (node.hasOwnProperty(prop)) {\n if (Array.isArray(node[prop])) {\n return node[prop];\n }\n }\n }\n}\n\nexport interface ConstructibleStyleOptions {\n /**\n * Set this in case an instance of a component could produce different styles based on variables.\n * This will ensure that you get new styles for each mode.\n * @example\n```\n@Prop() mode: string;\n@ConstructableStyle({ cacheKeyProperty: \"mode\" }) style = `.bg { background: url('assets/${ this.mode }/bg.png'); }`;\n```\n */\n cacheKeyProperty?: string;\n}\n","@use 'sass:math';\n\n@import '../../global/style/nano-theme/base';\n\n:host {\n /**\n * @prop --grid-col-gap: gap between all columns. Defaults to theme's global padding\n * @prop --grid-row-gap: gap between all rows. Defaults to theme's global padding\n */\n\n --grid-col-gap: #{$spacing-medium};\n --grid-row-gap: #{$spacing-medium};\n --current-grid-size: \"grid size: s\";\n\n container-type: inline-size;\n display: block;\n\n .grid {\n display: grid;\n gap: var(--grid-row-gap) var(--grid-col-gap);\n block-size: inherit;\n min-block-size: inherit;\n }\n}\n\n:host([show-helper]:not([show-helper='false'])) {\n position: relative;\n\n .grid--helper {\n position: absolute;\n inset: 0;\n pointer-events: none;\n\n &::before {\n content: var(--current-grid-size);\n font-size: 30px;\n position: absolute;\n inline-size: 100%;\n inset-inline-start: 0;\n text-align: center;\n inset-block-start: 50%;\n transform: translateY(-50%);\n color: rgb(0 0 0 / 20%);\n text-transform: uppercase;\n z-index: 99;\n pointer-events: none;\n }\n }\n\n .grid__helper-item {\n display: none;\n background: hsl(204deg 80% 72% / 25%);\n }\n}\n","import { Component, h, Prop, Host, State, Watch } from '@stencil/core';\nimport { ConstructibleStyle } from '../../utils/constructible-style';\n\n/**\n * A lightweight, context-aware CSS grid implementation.\n *\n * - Define multiple grids templates at different breakpoints\n * - Uses `@container` queries to select the correct grid depending on the current dimensions\n * - Use `grid-states=\"...\"` on direct descendants for `column` / `row` - `start` / `end`\n * - SSR optimised\n\n * @part grid - the main grid element.\n * Use this to set css such as `justify-items|content` / `align-items|content` / `place-content`\n * @part helper - a replica grid showed when `show-helper` is true\n *\n * @slot - default slot. Use this to place grid items. Use `grid-states=\"...\"` attribute to opt-out of auto / sequential placement.\n */\n@Component({\n tag: 'nano-grid',\n styleUrl: 'grid.scss',\n shadow: true,\n})\nexport class Grid {\n private grids: {\n cols: number;\n breakpoint: number | string;\n name: string;\n template?: string;\n }[] = [];\n @State() cacheKey: string;\n\n /** the component's small breakpoint. Note - all breakpoints are based on component width, not screen width.\n * Will default to `px` if no unit supplied e.g. `20rem` */\n @Prop() sSize: number | string = 300;\n\n /** the component's medium breakpoint. Note - all breakpoints are based on component width, not screen width.\n * Will default to `px` if no unit supplied e.g. `20rem` */\n @Prop() mSize: number | string = 550;\n\n /** the component's large breakpoint. Note - all breakpoints are based on component width, not screen width.\n * Will default to `px` if no unit supplied e.g. `20rem` */\n @Prop() lSize: number | string = 800;\n\n /** the component's xl breakpoint. Note - all breakpoints are based on component width, not screen width.\n * Will default to `px` if no unit supplied e.g. `20rem` */\n @Prop() xlSize: number | string = 1000;\n\n /** the number of columns the grid has at the small breakpoint. */\n @Prop() sCols: number;\n\n /** the number of columns the grid has at the medium breakpoint. */\n @Prop() mCols: number;\n\n /** the number of columns the grid has at the large breakpoint. */\n @Prop() lCols: number;\n\n /** the number of columns the grid has at the xl breakpoint. */\n @Prop() xlCols: number;\n\n /** the number of columns the grid has at the xxl breakpoint (anything greater than the xl breakpoint) */\n @Prop() xxlCols: number;\n\n /** Optional small `grid-template`. *Note* - you must set `sCols` for this to take affect */\n @Prop() sTpl?: string;\n\n /** Optional medium `grid-template`. *Note* - you must set `mCols` for this to take affect */\n @Prop() mTpl?: string;\n\n /** Optional large `grid-template`. *Note* - you must set `lCols` for this to take affect */\n @Prop() lTpl?: string;\n\n /** Optional xl `grid-template`. *Note* - you must set `xlCols` for this to take affect */\n @Prop() xlTpl?: string;\n\n /** Optional xxl `grid-template`. *Note* - you must set `xxlCols` for this to take affect */\n @Prop() xxlTpl?: string;\n\n /** shows a grid helper to visualise where columns are */\n @Prop({ reflect: true }) showHelper: boolean = false;\n\n @Watch('sTpl')\n @Watch('mTpl')\n @Watch('lTpl')\n @Watch('xlTpl')\n @Watch('xxlTpl')\n @Watch('sSize')\n @Watch('mSize')\n @Watch('lSize')\n @Watch('xlSize')\n @Watch('sCols')\n @Watch('mCols')\n @Watch('lCols')\n @Watch('xlCols')\n @Watch('xxlCols')\n @Watch('showHelper')\n constructSizeArray() {\n this.grids = [];\n\n if (this.sCols)\n this.grids.push({\n cols: this.sCols,\n breakpoint: 0,\n name: 's',\n template: this.sTpl,\n });\n if (this.mCols)\n this.grids.push({\n cols: this.mCols,\n breakpoint: this.sSize,\n name: 'm',\n template: this.mTpl,\n });\n if (this.lSize)\n this.grids.push({\n cols: this.lCols,\n breakpoint: this.mSize,\n name: 'l',\n template: this.lTpl,\n });\n if (this.xlCols)\n this.grids.push({\n cols: this.xlCols,\n breakpoint: this.lSize,\n name: 'xl',\n template: this.xlTpl,\n });\n if (this.xxlCols)\n this.grids.push({\n cols: this.xxlCols,\n breakpoint: this.xlSize,\n name: 'xxl',\n template: this.xxlTpl,\n });\n\n this.cacheKey =\n this.grids\n .map((bp) => `${bp.cols}-${bp.breakpoint}-${bp.template || ''}`)\n .join('') +\n '-helper-' +\n this.showHelper;\n }\n\n @ConstructibleStyle({ cacheKeyProperty: 'cacheKey' }) protected styles =\n () => {\n const css = /* css */ `\n ${this.grids\n .map(\n (bp) => /* css */ `\n @container (min-width: ${\n typeof bp.breakpoint === 'number'\n ? bp.breakpoint + 1 + 'px'\n : bp.breakpoint\n }) {\n .grid {\n --current-grid-size: \"grid size: ${bp.name}\";\n ${\n bp.template\n ? `grid-template: ${bp.template};`\n : `grid-template-columns: repeat(${bp.cols}, 1fr);`\n }\n }\n ${[...Array(bp.cols)]\n .map((_, i) => {\n const gItm = i + 1;\n return /* css */ `\n .grid > [grid-states~=\"${bp.name}-col-start-${gItm}\"],\n ::slotted([grid-states~=\"${bp.name}-col-start-${gItm}\"]) {\n grid-column-start: ${gItm} !important;\n }\n .grid > [grid-states~=\"${bp.name}-row-start-${gItm}\"],\n ::slotted([grid-states~=\"${bp.name}-row-start-${gItm}\"]) {\n grid-row-start: ${gItm} !important;\n }\n .grid > [grid-states~=\"${bp.name}-col-span-${gItm}\"],\n ::slotted([grid-states~=\"${bp.name}-col-span-${gItm}\"]) {\n grid-column-end: span ${gItm} !important;\n }\n .grid > [grid-states~=\"${bp.name}-row-span-${gItm}\"],\n ::slotted([grid-states~=\"${bp.name}-row-span-${gItm}\"]) {\n grid-row-end: span ${gItm} !important;\n }\n `;\n })\n .join('')}\n ${\n this.showHelper &&\n /* css */ `\n .grid--helper :nth-child(-n+${bp.cols}) {\n display: block !important;\n }\n `\n }\n }\n `\n )\n .join('')}\n `;\n return css;\n };\n\n componentWillLoad() {\n this.constructSizeArray();\n }\n\n render() {\n return (\n <Host>\n <div part=\"grid\" class=\"grid\">\n <slot />\n </div>\n {this.showHelper && (\n <div class=\"grid grid--helper\" part=\"helper\">\n {[...Array(24)].map(() => (\n <div class=\"grid__helper-item\" />\n ))}\n </div>\n )}\n </Host>\n );\n }\n}\n"],"version":3}
@@ -6,7 +6,7 @@ import { f as focusVisible } from './focus-visible.js';
6
6
  import { d as defineCustomElement$2 } from './icon.js';
7
7
  import { d as defineCustomElement$1 } from './tooltip.js';
8
8
 
9
- const iconButtonCss = ":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--border-radius:var(--nano-border-radius-medium, 4px);--active-color:#005c75;--hover-color:#007495;--nano-color-base:var(--color, #687576);--background:transparent;--padding:var(--nano-spacing-small, 8px);--box-shadow:none;border-radius:var(--border-radius);display:inline-block}.icon-button{flex:0 0 auto;display:flex;align-items:center;border:none;border-radius:inherit;background:var(--background);font-size:inherit;color:var(--color);padding:var(--padding);cursor:pointer;-webkit-appearance:none;appearance:none;transition:box-shadow var(--nano-transition-fast, 0.1s) ease-in-out;box-shadow:var(--box-shadow)}.icon-button:hover:not(.icon-button--disabled),.icon-button:focus:not(.icon-button--disabled){color:var(--hover-color);--nano-color-base:var(--hover-color)}.icon-button:active:not(.icon-button--disabled){color:var(--active-color);--nano-color-base:var(--active-color)}.icon-button:focus{outline:none}.icon-button--disabled{opacity:0.5;cursor:not-allowed;pointer-events:none}.focus-visible.icon-button:focus{box-shadow:var(--nano-control-focus-shadow, 0 0 0 0.1875rem var(--nano-control-focus-color, rgba(144, 198, 231, 0.8)))}";
9
+ const iconButtonCss = ":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--border-radius:var(--nano-border-radius-medium, 4px);--active-color:#005c75;--hover-color:#007495;--nano-color-base:var(--color, #687576);--background:transparent;--padding:var(--nano-spacing-small, 8px);--box-shadow:none;border-radius:var(--border-radius);display:inline-block}.icon-button{flex:0 0 auto;display:flex;align-items:center;border:none;border-radius:inherit;background:var(--background);font-size:inherit;color:var(--color);padding:var(--padding);cursor:pointer;-webkit-appearance:none;appearance:none;transition:box-shadow var(--nano-transition-fast, 0.1s) ease-in-out;box-shadow:var(--box-shadow)}.icon-button:hover:not(.icon-button--disabled),.icon-button:focus:not(.icon-button--disabled){color:var(--hover-color);--nano-color-base:var(--hover-color)}.icon-button:active:not(.icon-button--disabled){color:var(--active-color);--nano-color-base:var(--active-color)}.icon-button:focus{outline:none}.icon-button__label{clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute}.icon-button--disabled{opacity:0.5;cursor:not-allowed;pointer-events:none}.focus-visible.icon-button:focus{box-shadow:var(--nano-control-focus-shadow, 0 0 0 0.1875rem var(--nano-control-focus-color, rgba(144, 198, 231, 0.8)))}";
10
10
 
11
11
  const IconButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
12
12
  constructor() {
@@ -79,7 +79,7 @@ const IconButton = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
79
79
  return (h(Host, { "aria-disabled": this.disabled ? 'true' : null }, h(TagType, { onClick: this.handleClick, part: "base", ref: (el) => (this.button = el), class: {
80
80
  'icon-button': true,
81
81
  'icon-button--disabled': this.disabled,
82
- }, "aria-label": this.label, name: this.name, value: this.value, href: this.href || undefined, target: this.href && this.target ? this.target : undefined, rel: this.rel || undefined, type: !this.href && this.type ? this.type : undefined }, h("nano-icon", { name: this.iconName, src: this.iconSrc, "aria-hidden": "true", lazy: false, part: "icon" }))));
82
+ }, name: this.name, value: this.value, href: this.href || undefined, target: this.href && this.target ? this.target : undefined, rel: this.rel || undefined, type: !this.href && this.type ? this.type : undefined }, h("span", { class: "icon-button__label" }, this.label), h("nano-icon", { name: this.iconName, src: this.iconSrc, "aria-hidden": "true", lazy: false, part: "icon" }))));
83
83
  }
84
84
  render() {
85
85
  if (this.showTooltip) {