@nanoporetech-digital/components 4.10.0 → 5.1.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 (174) hide show
  1. package/CHANGELOG.md +46 -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-dropdown.cjs.entry.js +1 -1
  8. package/dist/cjs/nano-dropdown.cjs.entry.js.map +1 -1
  9. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +2 -2
  10. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
  11. package/dist/cjs/nano-grid-item.cjs.entry.js +29 -0
  12. package/dist/cjs/nano-grid-item.cjs.entry.js.map +1 -0
  13. package/dist/cjs/nano-grid_2.cjs.entry.js +443 -0
  14. package/dist/cjs/nano-grid_2.cjs.entry.js.map +1 -0
  15. package/dist/cjs/nano-hero.cjs.entry.js +4 -10
  16. package/dist/cjs/nano-hero.cjs.entry.js.map +1 -1
  17. package/dist/cjs/nano-icon-button_2.cjs.entry.js +2 -2
  18. package/dist/cjs/nano-icon-button_2.cjs.entry.js.map +1 -1
  19. package/dist/cjs/nano-input.cjs.entry.js +2 -2
  20. package/dist/cjs/nano-input.cjs.entry.js.map +1 -1
  21. package/dist/cjs/nano-range.cjs.entry.js +1 -1
  22. package/dist/cjs/nano-range.cjs.entry.js.map +1 -1
  23. package/dist/cjs/nano-sortable.cjs.entry.js +1 -0
  24. package/dist/cjs/nano-sortable.cjs.entry.js.map +1 -1
  25. package/dist/cjs/{nano-table-ff33dc43.js → nano-table-5587101f.js} +37 -30
  26. package/dist/cjs/nano-table-5587101f.js.map +1 -0
  27. package/dist/cjs/nano-table.cjs.entry.js +1 -1
  28. package/dist/cjs/{table.worker-0a6bc962.js → table.worker-abba820e.js} +2 -2
  29. package/dist/cjs/table.worker-abba820e.js.map +1 -0
  30. package/dist/collection/components/dropdown/dropdown.css +2 -1
  31. package/dist/collection/components/form-control/form-control.js +1 -2
  32. package/dist/collection/components/form-control/form-control.js.map +1 -1
  33. package/dist/collection/components/grid/grid-item.js +11 -136
  34. package/dist/collection/components/grid/grid-item.js.map +1 -1
  35. package/dist/collection/components/grid/grid.css +9 -242
  36. package/dist/collection/components/grid/grid.js +255 -240
  37. package/dist/collection/components/grid/grid.js.map +1 -1
  38. package/dist/collection/components/hero/hero.css +42 -89
  39. package/dist/collection/components/hero/hero.js +4 -11
  40. package/dist/collection/components/hero/hero.js.map +1 -1
  41. package/dist/collection/components/icon-button/icon-button.css +12 -0
  42. package/dist/collection/components/icon-button/icon-button.js +1 -1
  43. package/dist/collection/components/icon-button/icon-button.js.map +1 -1
  44. package/dist/collection/components/input/input.css +8 -9
  45. package/dist/collection/components/range/range.css +0 -3
  46. package/dist/collection/components/select/select.css +8 -9
  47. package/dist/collection/components/sortable/sortable.js +2 -1
  48. package/dist/collection/components/sortable/sortable.js.map +1 -1
  49. package/dist/collection/components/table/table.css +6 -0
  50. package/dist/collection/components/table/table.js +25 -18
  51. package/dist/collection/components/table/table.js.map +1 -1
  52. package/dist/collection/components/table/table.row.js +7 -7
  53. package/dist/collection/components/table/table.row.js.map +1 -1
  54. package/dist/collection/utils/constructible-style.js +129 -0
  55. package/dist/collection/utils/constructible-style.js.map +1 -0
  56. package/dist/components/dropdown.js +1 -1
  57. package/dist/components/dropdown.js.map +1 -1
  58. package/dist/components/form-control.js +1 -2
  59. package/dist/components/form-control.js.map +1 -1
  60. package/dist/components/grid.js +275 -183
  61. package/dist/components/grid.js.map +1 -1
  62. package/dist/components/icon-button.js +2 -2
  63. package/dist/components/icon-button.js.map +1 -1
  64. package/dist/components/input.js +1 -1
  65. package/dist/components/input.js.map +1 -1
  66. package/dist/components/nano-grid-item.js +33 -1
  67. package/dist/components/nano-grid-item.js.map +1 -1
  68. package/dist/components/nano-hero.js +6 -19
  69. package/dist/components/nano-hero.js.map +1 -1
  70. package/dist/components/nano-range.js +1 -1
  71. package/dist/components/nano-range.js.map +1 -1
  72. package/dist/components/nano-sortable.js +1 -0
  73. package/dist/components/nano-sortable.js.map +1 -1
  74. package/dist/components/select.js +1 -1
  75. package/dist/components/select.js.map +1 -1
  76. package/dist/components/table.js +36 -29
  77. package/dist/components/table.js.map +1 -1
  78. package/dist/esm/{form-control-269ba84f.js → form-control-e8739b2e.js} +2 -3
  79. package/dist/esm/form-control-e8739b2e.js.map +1 -0
  80. package/dist/esm/index-dad5627b.js +6 -2
  81. package/dist/esm/loader.js +1 -1
  82. package/dist/esm/nano-components.js +1 -1
  83. package/dist/esm/nano-dropdown.entry.js +1 -1
  84. package/dist/esm/nano-dropdown.entry.js.map +1 -1
  85. package/dist/esm/nano-global-nav-user-profile_3.entry.js +2 -2
  86. package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
  87. package/dist/esm/nano-grid-item.entry.js +25 -0
  88. package/dist/esm/nano-grid-item.entry.js.map +1 -0
  89. package/dist/esm/nano-grid_2.entry.js +438 -0
  90. package/dist/esm/nano-grid_2.entry.js.map +1 -0
  91. package/dist/esm/nano-hero.entry.js +4 -10
  92. package/dist/esm/nano-hero.entry.js.map +1 -1
  93. package/dist/esm/nano-icon-button_2.entry.js +2 -2
  94. package/dist/esm/nano-icon-button_2.entry.js.map +1 -1
  95. package/dist/esm/nano-input.entry.js +2 -2
  96. package/dist/esm/nano-input.entry.js.map +1 -1
  97. package/dist/esm/nano-range.entry.js +1 -1
  98. package/dist/esm/nano-range.entry.js.map +1 -1
  99. package/dist/esm/nano-sortable.entry.js +1 -0
  100. package/dist/esm/nano-sortable.entry.js.map +1 -1
  101. package/dist/esm/{nano-table-ec980076.js → nano-table-fb6b3bcb.js} +37 -30
  102. package/dist/esm/nano-table-fb6b3bcb.js.map +1 -0
  103. package/dist/esm/nano-table.entry.js +1 -1
  104. package/dist/esm/{table.worker-b53db58e.js → table.worker-43365547.js} +2 -2
  105. package/dist/esm/table.worker-43365547.js.map +1 -0
  106. package/dist/nano-components/nano-components.css +1 -1
  107. package/dist/nano-components/nano-components.esm.js +1 -1
  108. package/dist/nano-components/nano-components.esm.js.map +1 -1
  109. package/dist/nano-components/p-17b099cc.entry.js +5 -0
  110. package/dist/nano-components/p-17b099cc.entry.js.map +1 -0
  111. package/dist/nano-components/p-553acf24.entry.js +5 -0
  112. package/dist/nano-components/{p-58b53239.entry.js.map → p-553acf24.entry.js.map} +1 -1
  113. package/dist/nano-components/p-6975f110.entry.js +5 -0
  114. package/dist/nano-components/p-6975f110.entry.js.map +1 -0
  115. package/dist/nano-components/p-71057181.js +5 -0
  116. package/dist/nano-components/p-71057181.js.map +1 -0
  117. package/dist/nano-components/{p-f591400b.entry.js → p-913cf45f.entry.js} +2 -2
  118. package/dist/nano-components/p-99914796.js +5 -0
  119. package/dist/nano-components/p-99914796.js.map +1 -0
  120. package/dist/nano-components/p-9b5429e1.entry.js +5 -0
  121. package/dist/nano-components/p-9b5429e1.entry.js.map +1 -0
  122. package/dist/nano-components/p-ad6209ec.entry.js +5 -0
  123. package/dist/nano-components/p-ad6209ec.entry.js.map +1 -0
  124. package/dist/nano-components/p-bdef618c.entry.js +5 -0
  125. package/dist/nano-components/p-bdef618c.entry.js.map +1 -0
  126. package/dist/nano-components/{p-241baff8.entry.js → p-d79c6862.entry.js} +2 -2
  127. package/dist/nano-components/p-d79c6862.entry.js.map +1 -0
  128. package/dist/nano-components/{p-806bcd46.js → p-daa6f834.js} +2 -2
  129. package/dist/nano-components/p-deb0799c.entry.js +5 -0
  130. package/dist/nano-components/{p-6a3a29c6.entry.js.map → p-deb0799c.entry.js.map} +1 -1
  131. package/dist/nano-components/p-ebb98a9e.entry.js +5 -0
  132. package/dist/nano-components/p-ebb98a9e.entry.js.map +1 -0
  133. package/dist/types/components/grid/grid-item.d.ts +3 -11
  134. package/dist/types/components/grid/grid.d.ts +44 -68
  135. package/dist/types/components/hero/hero.d.ts +1 -3
  136. package/dist/types/components/table/table.d.ts +5 -0
  137. package/dist/types/components.d.ts +85 -61
  138. package/dist/types/utils/constructible-style.d.ts +31 -0
  139. package/docs-json.json +152 -88
  140. package/docs-vscode.json +28 -21
  141. package/hydrate/index.js +348 -307
  142. package/package.json +2 -2
  143. package/dist/cjs/form-control-2e900f54.js.map +0 -1
  144. package/dist/cjs/nano-grid_3.cjs.entry.js +0 -431
  145. package/dist/cjs/nano-grid_3.cjs.entry.js.map +0 -1
  146. package/dist/cjs/nano-table-ff33dc43.js.map +0 -1
  147. package/dist/cjs/table.worker-0a6bc962.js.map +0 -1
  148. package/dist/collection/components/grid/grid-item.css +0 -15
  149. package/dist/components/grid-item.js +0 -107
  150. package/dist/components/grid-item.js.map +0 -1
  151. package/dist/esm/form-control-269ba84f.js.map +0 -1
  152. package/dist/esm/nano-grid_3.entry.js +0 -425
  153. package/dist/esm/nano-grid_3.entry.js.map +0 -1
  154. package/dist/esm/nano-table-ec980076.js.map +0 -1
  155. package/dist/esm/table.worker-b53db58e.js.map +0 -1
  156. package/dist/nano-components/p-064af7d0.js +0 -5
  157. package/dist/nano-components/p-064af7d0.js.map +0 -1
  158. package/dist/nano-components/p-107d4549.entry.js +0 -5
  159. package/dist/nano-components/p-107d4549.entry.js.map +0 -1
  160. package/dist/nano-components/p-239d343a.entry.js +0 -5
  161. package/dist/nano-components/p-239d343a.entry.js.map +0 -1
  162. package/dist/nano-components/p-241baff8.entry.js.map +0 -1
  163. package/dist/nano-components/p-58b53239.entry.js +0 -5
  164. package/dist/nano-components/p-5ac74848.js +0 -5
  165. package/dist/nano-components/p-5ac74848.js.map +0 -1
  166. package/dist/nano-components/p-6a3a29c6.entry.js +0 -5
  167. package/dist/nano-components/p-87bc66b5.entry.js +0 -5
  168. package/dist/nano-components/p-87bc66b5.entry.js.map +0 -1
  169. package/dist/nano-components/p-d3de231c.entry.js +0 -5
  170. package/dist/nano-components/p-d3de231c.entry.js.map +0 -1
  171. package/dist/nano-components/p-d792f692.entry.js +0 -5
  172. package/dist/nano-components/p-d792f692.entry.js.map +0 -1
  173. /package/dist/nano-components/{p-806bcd46.js.map → p-913cf45f.entry.js.map} +0 -0
  174. /package/dist/nano-components/{p-f591400b.entry.js.map → p-daa6f834.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"names":["iconButtonCss","IconButton","this","handleClick","ev","type","formEl","findForm","preventDefault","fakeButton","document","createElement","style","display","appendChild","click","remove","async","button","focus","form","host","closest","HTMLFormElement","el","getElementById","componentDidLoad","focusVisible","observe","connectedCallback","disconnectedCallback","unobserve","content","TagType","href","undefined","h","Host","disabled","onClick","part","ref","class","name","value","target","rel","label","iconName","src","iconSrc","lazy","render","showTooltip","tooltipCss","Tooltip","isVisible","handleBlur","hasTrigger","hide","open","show","handleFocus","handleKeyDown","event","key","stopPropagation","handleMouseOver","handleMouseOut","handleSlotChange","getTarget","_target","newTarget","removeAttribute","setAttribute","setLabel","contentSlotNodes","Array","from","querySelectorAll","textContent","map","node","join","trim","handleOpenChange","slShow","nanoShow","emit","defaultPrevented","popover","slHide","nanoHide","children","find","tagName","toLowerCase","getAttribute","Error","triggerType","triggers","trigger","split","includes","syncOptions","setOptions","strategy","hoist","placement","distance","skidding","transitionElement","tooltip","onAfterHide","nanoAfterHide","onAfterShow","nanoAfterShow","Popover","tooltipPositioner","hidden","componentDidUpdate","destroy","onKeyDown","onMouseOver","onMouseOut","onBlur","onFocus","onSlotchange","role"],"sources":["./src/components/icon-button/icon-button.scss?tag=nano-icon-button&encapsulation=shadow","./src/components/icon-button/icon-button.tsx","./src/components/tooltip/tooltip.scss?tag=nano-tooltip&encapsulation=shadow","./src/components/tooltip/tooltip.tsx"],"sourcesContent":["@use 'sass:map';\n@use 'sass:list';\n\n@import '../../global/style/nano-theme/base';\n@import '../../global/style/nano-theme/colours';\n@import '../../global/style/nano-theme/form';\n\n:host {\n /**\n * @prop --color: defaults to #{map.get($colors, palegrey)};\n * @prop --active-color: defaults to #{map.get($colors, darkblue--faded)};\n * @prop --hover-color: defaults to #{map.get($colors, blue)};\n * @prop --background: defaults to transparent;\n * @prop --padding: defaults to #{$spacing-small};\n * @prop --box-shadow: defaults to none;\n */\n\n --border-radius: #{$border-radius-medium};\n --active-color: #{map.get($colors, darkblue--faded)};\n --hover-color: #{map.get($colors, blue)};\n --nano-color-base: var(--color, #{map.get($colors, mediumgrey)});\n --background: transparent;\n --padding: #{$spacing-small};\n --box-shadow: none;\n\n border-radius: var(--border-radius);\n display: inline-block;\n}\n\n.icon-button {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n border: none;\n border-radius: inherit;\n background: var(--background);\n font-size: inherit;\n color: var(--color);\n padding: var(--padding);\n cursor: pointer;\n appearance: none;\n transition: box-shadow #{$transition-xfast} ease-in-out;\n box-shadow: var(--box-shadow);\n\n &:hover:not(.icon-button--disabled),\n &:focus:not(.icon-button--disabled) {\n color: var(--hover-color);\n\n --nano-color-base: var(--hover-color);\n }\n\n &:active:not(.icon-button--disabled) {\n color: var(--active-color);\n\n --nano-color-base: var(--active-color);\n }\n\n &:focus {\n outline: none;\n }\n}\n\n.icon-button__label {\n @include visually-hide();\n}\n\n.icon-button--disabled {\n opacity: 0.5;\n cursor: not-allowed;\n pointer-events: none;\n}\n\n.focus-visible.icon-button:focus {\n box-shadow: #{$control-focus-style};\n}\n","import {\n Component,\n Prop,\n h,\n ComponentInterface,\n Method,\n Element,\n Host,\n} from '@stencil/core';\nimport { focusVisible } from '../../utils/focus-visible';\n\n/** Icons buttons are simple, icon-only buttons that can be used for actions and in toolbars.\n *\n * @part base - the main control (either `<a />` or `<button />`)\n * @part icon - a `<nano-icon />` component\n */\n@Component({\n tag: 'nano-icon-button',\n styleUrl: 'icon-button.scss',\n shadow: true,\n})\nexport class IconButton implements ComponentInterface {\n private button: HTMLButtonElement;\n\n @Element() host: HTMLNanoIconButtonElement;\n\n /** The name of the icon to draw. */\n @Prop() iconName?: string;\n\n /** An external URL of an SVG file. */\n @Prop() iconSrc?: string;\n\n /** The default behavior of the button. */\n @Prop({ reflect: true }) type: 'submit' | 'reset' | 'button' = 'button';\n\n /** The name of the button, submitted as a pair with the button’s value as part of the form data. */\n @Prop({ reflect: true }) name?: string;\n\n /** Defines the value associated with the button’s name when it’s submitted with the form data. */\n @Prop({ reflect: true }) value?: string;\n\n /** A description that gets read by screen readers and other assistive devices. For optimal accessibility, you should\n * always include a label that describes what the icon button does. */\n @Prop() label!: string;\n\n /** display the label as a `<nano-tooltip />` */\n @Prop() showTooltip: boolean = false;\n\n /** Set to true to disable the button. */\n @Prop({ reflect: true }) disabled = false;\n\n /** Contains a URL or a URL fragment that the hyperlink points to.\n * If this property is set, an anchor tag will be rendered. */\n @Prop() href: string | undefined;\n\n /** Specifies the relationship of the target object to the link object.\n * The value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types) */\n @Prop() rel: string | undefined;\n\n /** Specifies where to display the linked URL. Only applies when an `href` is provided.\n * Special keywords: `\"_blank\"`, `\"_self\"`, `\"_parent\"`, `\"_top\"`. */\n @Prop() target: string | undefined;\n\n /** The HTML form element or form element id.\n * Used to submit a form when the button is not a child of the form. */\n @Prop() form: HTMLFormElement | string;\n\n /** Sets focus on the internal button */\n @Method()\n async setFocus() {\n this.button.focus();\n }\n\n /**\n * Finds the form element based on the provided `form` selector\n * or element reference provided.\n * @returns the found form element (if found)\n */\n private findForm(): HTMLFormElement | null {\n const { form, host } = this;\n if (!form) return host.closest('form');\n\n if (form instanceof HTMLFormElement) {\n return form;\n }\n if (typeof form === 'string') {\n const el = document.getElementById(form);\n if (el instanceof HTMLFormElement) {\n return el;\n }\n }\n return null;\n }\n\n private handleClick = (ev: Event) => {\n if (this.type === 'button') return;\n const formEl = this.findForm();\n\n if (formEl) {\n ev.preventDefault();\n\n const fakeButton = document.createElement('button');\n fakeButton.type = this.type;\n fakeButton.style.display = 'none';\n formEl.appendChild(fakeButton);\n fakeButton.click();\n fakeButton.remove();\n }\n };\n\n componentDidLoad() {\n focusVisible.observe(this.button);\n }\n\n connectedCallback() {\n if (this.button) focusVisible.observe(this.button);\n }\n\n disconnectedCallback() {\n focusVisible.unobserve(this.button);\n }\n\n private content() {\n const TagType: 'a' | 'button' = this.href === undefined ? 'button' : 'a';\n\n return (\n <Host aria-disabled={this.disabled ? 'true' : null}>\n <TagType\n onClick={this.handleClick}\n part=\"base\"\n ref={(el) => (this.button = el)}\n class={{\n 'icon-button': true,\n 'icon-button--disabled': this.disabled,\n }}\n name={this.name}\n value={this.value}\n href={this.href || undefined}\n target={this.href && this.target ? this.target : undefined}\n rel={this.rel || undefined}\n type={!this.href && this.type ? this.type : undefined}\n >\n <span class=\"icon-button__label\">{this.label}</span>\n <nano-icon\n name={this.iconName}\n src={this.iconSrc}\n aria-hidden=\"true\"\n lazy={false}\n part=\"icon\"\n />\n </TagType>\n </Host>\n );\n }\n\n render() {\n if (this.showTooltip) {\n return <nano-tooltip content={this.label}>{this.content()}</nano-tooltip>;\n }\n return this.content();\n }\n}\n","@import '../../global/style/nano-theme/components';\n@import '../../global/style/nano-theme/layers';\n\n/**\n * @prop --hide-delay: The amount of time to wait before hiding the tooltip.\n * @prop --hide-duration: The amount of time the hide transition takes to complete.\n * @prop --hide-timing-function: The timing function (easing) to use for the hide transition.\n * @prop --max-width: The maximum width of the tooltip.\n * @prop --show-delay: The amount of time to wait before showing the tooltip.\n * @prop --show-duration: The amount of time the show transition takes to complete.\n * @prop --show-timing-function: The timing function (easing) to use for the show transition.\n */\n:host {\n --max-width: 20rem;\n --hide-delay: 0s;\n --hide-duration: 0.125s;\n --hide-timing-function: ease;\n --show-delay: 0.125s;\n --show-duration: 0.125s;\n --show-timing-function: ease;\n\n /* autoprefixer: ignore next */\n display: contents;\n}\n\n.tooltip {\n $self: &;\n\n max-inline-size: var(--max-width);\n border-radius: #{$tooltip-border-radius};\n background-color: black;\n font-size: #{$tooltip-fontsize};\n line-height: 1.5;\n color: white;\n opacity: 0;\n padding: #{$tooltip-padding};\n transform: translateY(10px) translateZ(0);\n transform-origin: bottom;\n transition: opacity, transform var(--hide-duration) var(--hide-timing-function) var(--hide-delay);\n white-space: normal;\n\n &-arrow {\n content: '';\n position: absolute;\n inline-size: 0;\n block-size: 0;\n color: black;\n transition: 0.2s ease transform;\n }\n\n &-positioner {\n position: absolute;\n z-index: #{$layer-index-tooltip};\n\n &[data-popper-placement^='top'] #{$self} {\n transform-origin: bottom;\n transform: translateY(-10px) translateZ(0);\n }\n\n &[data-popper-placement^='bottom'] #{$self} {\n transform-origin: top;\n }\n\n &[data-popper-placement^='left'] #{$self} {\n transform-origin: right;\n }\n\n &[data-popper-placement^='right'] #{$self} {\n transform-origin: left;\n }\n\n &.popover-visible #{$self} {\n opacity: 1;\n transform: none;\n transition-delay: var(--show-delay);\n transition-duration: var(--show-duration);\n transition-timing-function: var(--show-timing-function);\n }\n\n // Arrow + bottom\n &[data-popper-placement^='bottom'] #{$self}-arrow {\n inset-block-end: 100%;\n inset-inline-start: calc(50% - #{$tooltip-arrow-size});\n border-block-end: #{$tooltip-arrow-size} solid;\n border-inline-start: #{$tooltip-arrow-size} solid transparent;\n border-inline-end: #{$tooltip-arrow-size} solid transparent;\n }\n\n &[data-popper-placement='bottom-start'] #{$self}-arrow {\n inset-inline-start: #{$tooltip-arrow-offset};\n }\n\n &[data-popper-placement='bottom-end'] #{$self}-arrow {\n inset-inline: auto #{$tooltip-arrow-offset};\n }\n\n // Arrow + top\n &[data-popper-placement^='top'] #{$self}-arrow {\n inset-block-start: 100%;\n inset-inline-start: calc(50% - #{$tooltip-arrow-size});\n border-block-start: #{$tooltip-arrow-size} solid;\n border-inline-start: #{$tooltip-arrow-size} solid transparent;\n border-inline-end: #{$tooltip-arrow-size} solid transparent;\n }\n\n &[data-popper-placement='top-start'] #{$self}-arrow {\n inset-inline-start: #{$tooltip-arrow-offset};\n }\n\n &[data-popper-placement='top-end'] #{$self}-arrow {\n inset-inline: auto #{$tooltip-arrow-offset};\n }\n\n // Arrow + left\n &[data-popper-placement^='left'] #{$self}-arrow {\n inset-block-start: calc(50% - #{$tooltip-arrow-size});\n inset-inline-start: 100%;\n border-inline-start: #{$tooltip-arrow-size} solid;\n border-block-start: #{$tooltip-arrow-size} solid transparent;\n border-block-end: #{$tooltip-arrow-size} solid transparent;\n }\n\n &[data-popper-placement='left-start'] #{$self}-arrow {\n inset-block-start: #{$tooltip-arrow-offset};\n }\n\n &[data-popper-placement='left-end'] #{$self}-arrow {\n inset-block: auto #{$tooltip-arrow-offset};\n }\n\n // Arrow + right\n &[data-popper-placement^='right'] #{$self}-arrow {\n inset-block-start: calc(50% - #{$tooltip-arrow-size});\n inset-inline-end: 100%;\n border-inline-end: #{$tooltip-arrow-size} solid;\n border-block-start: #{$tooltip-arrow-size} solid transparent;\n border-block-end: #{$tooltip-arrow-size} solid transparent;\n }\n\n &[data-popper-placement='right-start'] #{$self}-arrow {\n inset-block-start: #{$tooltip-arrow-offset};\n }\n\n &[data-popper-placement='right-end'] #{$self}-arrow {\n inset-block: auto #{$tooltip-arrow-offset};\n }\n }\n}\n","import {\n Component,\n Element,\n Event,\n EventEmitter,\n Host,\n Method,\n Prop,\n Watch,\n h,\n} from '@stencil/core';\nimport Popover from '../../utils/popover';\n\n/**\n * Tooltips display additional information based on a specific action.\n * @slot - The tooltip's target element. Only the first element will be used as the target.\n * @slot content - The tooltip's content. Alternatively, you can use the content prop.\n */\n@Component({\n tag: 'nano-tooltip',\n styleUrl: 'tooltip.scss',\n shadow: true,\n})\nexport class Tooltip {\n private isVisible = false;\n private popover: Popover;\n private tooltipPositioner: HTMLElement;\n private tooltip: any;\n\n private _target: HTMLElement;\n private get target() {\n return this._target;\n }\n private set target(newTarget) {\n if (newTarget !== this._target && this._target) {\n this._target.removeAttribute('aria-label');\n }\n newTarget.setAttribute('aria-label', this.label);\n this._target = newTarget;\n }\n\n private label = '';\n\n @Element() host: HTMLNanoTooltipElement;\n\n /** The tooltip's content. Alternatively, you can use the content slot. */\n @Prop() content = '';\n\n @Watch('content')\n setLabel() {\n const contentSlotNodes = Array.from(\n this.host.querySelectorAll('[slot=\"content\"]')\n );\n const textContent = contentSlotNodes\n .map((node) => node.textContent)\n .join(' ')\n .trim();\n\n if (!this.target) {\n this.target = this.getTarget();\n\n if (!this.target) return;\n }\n\n this.label = textContent || this.content;\n this.target.setAttribute('aria-label', this.label);\n }\n\n /**\n * The preferred placement of the tooltip. Note that the actual placement may vary as needed to keep the tooltip\n * inside of the viewport.\n */\n @Prop() placement:\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end' = 'top';\n\n /** Set to true to disable the tooltip so it won't show when triggered. */\n @Prop() disabled = false;\n\n /** The distance in pixels from which to offset the tooltip away from its target. */\n @Prop() distance = 10;\n\n /** Indicates whether or not the tooltip is open. You can use this in lieu of the show/hide methods. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n /** The distance in pixels from which to offset the tooltip along its target. */\n @Prop() skidding = 0;\n\n /**\n * Enable this option to prevent the panel from being clipped when the component is placed inside a container with\n * `overflow: auto|scroll`.\n */\n @Prop() hoist = false;\n\n /**\n * Controls how the tooltip is activated. Possible options include `click`, `hover`, `focus`, and `manual`. Multiple\n * options can be passed by separating them with a space. When manual is used, the tooltip must be activated\n * programmatically.\n */\n @Prop() trigger: string = 'hover focus';\n\n @Watch('open')\n handleOpenChange() {\n this.open ? this.show() : this.hide();\n }\n\n // Events\n\n /** Emitted when the tooltip begins to show. Calling `event.preventDefault()` will prevent it from being shown. */\n @Event() nanoShow: EventEmitter;\n\n /** Emitted after the tooltip has shown and all transitions are complete. */\n @Event() nanoAfterShow: EventEmitter;\n\n /** Emitted when the tooltip begins to hide. Calling `event.preventDefault()` will prevent it from being hidden. */\n @Event() nanoHide: EventEmitter;\n\n /** Emitted after the tooltip has hidden and all transitions are complete. */\n @Event() nanoAfterHide: EventEmitter;\n\n // Public methods\n\n /** Shows the tooltip. */\n @Method()\n async show() {\n // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher\n if (this.isVisible || this.disabled) {\n return;\n }\n const slShow = this.nanoShow.emit();\n if (slShow.defaultPrevented) {\n this.open = false;\n return;\n }\n\n this.isVisible = true;\n this.open = true;\n this.popover.show();\n }\n\n /** Hides the tooltip. */\n @Method()\n async hide() {\n // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher\n if (!this.isVisible) {\n return;\n }\n\n const slHide = this.nanoHide.emit();\n if (slHide.defaultPrevented) {\n this.open = true;\n return;\n }\n\n this.isVisible = false;\n this.open = false;\n this.popover.hide();\n }\n\n // Private methods\n\n private getTarget() {\n // Get the first child that isn't a <style> or content slot\n const target = [...Array.from(this.host.children)].find(\n (el) =>\n el.tagName.toLowerCase() !== 'style' &&\n el.getAttribute('slot') !== 'content'\n ) as HTMLElement;\n\n if (!target) {\n throw new Error('Invalid tooltip target: no child element was found.');\n }\n\n return target;\n }\n\n private hasTrigger(triggerType: string) {\n const triggers = this.trigger.split(' ');\n return triggers.includes(triggerType);\n }\n\n private syncOptions() {\n this.popover.setOptions({\n strategy: this.hoist ? 'fixed' : 'absolute',\n placement: this.placement,\n distance: this.distance,\n skidding: this.skidding,\n transitionElement: this.tooltip,\n onAfterHide: () => this.nanoAfterHide.emit(),\n onAfterShow: () => this.nanoAfterShow.emit(),\n });\n }\n\n // Event Handlers\n\n private handleBlur = () => {\n if (this.hasTrigger('focus')) {\n this.hide();\n }\n };\n\n private handleClick = () => {\n if (this.hasTrigger('click')) {\n this.open ? this.hide() : this.show();\n }\n };\n\n private handleFocus = () => {\n if (this.hasTrigger('focus')) {\n this.show();\n }\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n // Pressing escape when the target element has focus should dismiss the tooltip\n if (this.open && event.key === 'Escape') {\n event.stopPropagation();\n this.hide();\n }\n };\n\n private handleMouseOver = () => {\n if (this.hasTrigger('hover')) {\n this.show();\n }\n };\n\n private handleMouseOut = () => {\n if (this.hasTrigger('hover')) {\n this.hide();\n }\n };\n\n private handleSlotChange = () => {\n this.target = this.getTarget();\n };\n\n // Stencil hooks\n\n componentDidLoad() {\n this.target = this.getTarget();\n this.popover = new Popover(this.target, this.tooltipPositioner);\n this.syncOptions();\n this.setLabel();\n\n // Show on init if open\n this.tooltipPositioner.hidden = !this.open;\n if (this.open) {\n this.show();\n }\n }\n\n componentDidUpdate() {\n this.syncOptions();\n }\n\n disconnectedCallback() {\n if (this.popover) this.popover.destroy();\n }\n\n render() {\n return (\n <Host\n onKeyDown={this.handleKeyDown}\n onMouseOver={this.handleMouseOver}\n onMouseOut={this.handleMouseOut}\n onBlur={this.handleBlur}\n onFocus={this.handleFocus}\n onClick={this.handleClick}\n >\n <slot onSlotchange={this.handleSlotChange} />\n <div\n ref={(el) => (this.tooltipPositioner = el)}\n class=\"tooltip-positioner\"\n >\n <div\n part=\"base\"\n ref={(el) => (this.tooltip = el)}\n class={{\n tooltip: true,\n 'tooltip--open': this.open,\n }}\n role=\"tooltip\"\n aria-hidden={this.open ? 'false' : 'true'}\n >\n <slot name=\"content\" onSlotchange={() => this.setLabel()}>\n {this.content}\n </slot>\n <div class=\"tooltip-arrow\" data-popper-arrow></div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"mappings":";;;wIAAA,MAAMA,EAAgB,g6C,MCqBTC,EAAU,M,yBAyEbC,KAAAC,YAAeC,IACrB,GAAIF,KAAKG,OAAS,SAAU,OAC5B,MAAMC,EAASJ,KAAKK,WAEpB,GAAID,EAAQ,CACVF,EAAGI,iBAEH,MAAMC,EAAaC,SAASC,cAAc,UAC1CF,EAAWJ,KAAOH,KAAKG,KACvBI,EAAWG,MAAMC,QAAU,OAC3BP,EAAOQ,YAAYL,GACnBA,EAAWM,QACXN,EAAWO,Q,4DAzEgD,S,+EAahC,M,cAGK,M,iFAoBpCC,iBACEf,KAAKgB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E,WAGLzE,KAAKoH,kBAAkBC,QAAUrH,KAAK0D,KACtC,GAAI1D,KAAK0D,KAAM,CACb1D,KAAK2D,M,EAIT2D,qBACEtH,KAAKsG,a,CAGP1E,uBACE,GAAI5B,KAAKwF,QAASxF,KAAKwF,QAAQ+B,S,CAGjCrE,SACE,OACEhB,EAACC,EAAI,CACHqF,UAAWxH,KAAK6D,cAChB4D,YAAazH,KAAKiE,gBAClByD,WAAY1H,KAAKkE,eACjByD,OAAQ3H,KAAKuD,WACbqE,QAAS5H,KAAK4D,YACdvB,QAASrC,KAAKC,aAEdiC,EAAA,QAAM2F,aAAc7H,KAAKmE,mBACzBjC,EAAA,OACEK,IAAMjB,GAAQtB,KAAKoH,kBAAoB9F,EACvCkB,MAAM,sBAENN,EAAA,OACEI,KAAK,OACLC,IAAMjB,GAAQtB,KAAK8G,QAAUxF,EAC7BkB,MAAO,CACLsE,QAAS,KACT,gBAAiB9G,KAAK0D,MAExBoE,KAAK,UAAS,cACD9H,KAAK0D,KAAO,QAAU,QAEnCxB,EAAA,QAAMO,KAAK,UAAUoF,aAAc,IAAM7H,KAAKyE,YAC3CzE,KAAK8B,SAERI,EAAA,OAAKM,MAAM,gBAAe,6B"}
@@ -1,10 +1,10 @@
1
- import type { GridSizes } from '../../interface';
2
1
  /**
2
+ * @deprecated - you can now use `grid-states="..."`
3
+ * on any direct `nano-grid` descendent without limitation rendering `nano-grid-item` obsolete.
4
+ *
3
5
  * Grid items to be used with [grid](/story/nano-components-grid) elements
4
6
  */
5
7
  export declare class GridItem {
6
- private currGridSizes;
7
- private el;
8
8
  /**
9
9
  * How to position this item within it's parent grid at different break points. Examples:
10
10
  * xl-col-span-2
@@ -12,13 +12,5 @@ export declare class GridItem {
12
12
  * xxl-row-span-2
13
13
  * m-row-start-2
14
14
  */
15
- gridStates: string;
16
- updateGridClasses(): void;
17
- /**
18
- * Called by parent grid to trigger new classes
19
- * @internal
20
- */
21
- changeBP(newGridSizes: GridSizes[]): Promise<void>;
22
- private applyChildrenClasses;
23
15
  render(): any;
24
16
  }
@@ -1,80 +1,56 @@
1
- import { EventEmitter } from '../../stencil-public-runtime';
2
1
  /**
3
- * A context-aware CSS grid implementation.
4
- * Uses it's own width to choose column number - not screen width.
2
+ * A lightweight, context-aware CSS grid implementation.
3
+ *
4
+ * - Define multiple grids templates at different breakpoints
5
+ * - Uses `@container` queries to select the correct grid depending on the current dimensions
6
+ * - Use `grid-states="..."` on direct descendants for `column` / `row` - `start` / `end`
7
+ * - SSR optimised
8
+
9
+ * @part grid - the main grid element.
10
+ * Use this to set css such as `justify-items|content` / `align-items|content` / `place-content`
11
+ * @part helper - a replica grid showed when `show-helper` is true
12
+ *
13
+ * @slot - default slot. Use this to place grid items. Use `grid-states="..."` attribute to opt-out of auto / sequential placement.
5
14
  */
6
15
  export declare class Grid {
7
- private el;
8
- private ro;
9
- private generalClasses;
10
- private gridClass;
11
- private isSizes;
12
- private currentWidth;
13
- constructor();
14
- ready: boolean;
15
- isSmall: boolean;
16
- isMedium: boolean;
17
- isLarge: boolean;
18
- isXL: boolean;
19
- isXXL: boolean;
20
- /**
21
- * the component's small breakpoint. Note - all breakpoints are based on component width, not screen width.
22
- */
23
- sSize: number;
24
- /**
25
- * the component's medium breakpoint. Note - all breakpoints are based on component width, not screen width.
26
- */
27
- mSize: number;
28
- /**
29
- * the component's large breakpoint. Note - all breakpoints are based on component width, not screen width.
30
- */
31
- lSize: number;
32
- /**
33
- * the component's xl breakpoint. Note - all breakpoints are based on component width, not screen width.
34
- */
35
- xlSize: number;
36
- /**
37
- * the number of columns the grid has at the small breakpoint.
38
- */
16
+ private grids;
17
+ cacheKey: string;
18
+ /** the component's small breakpoint. Note - all breakpoints are based on component width, not screen width.
19
+ * Will default to `px` if no unit supplied e.g. `20rem` */
20
+ sSize: number | string;
21
+ /** the component's medium breakpoint. Note - all breakpoints are based on component width, not screen width.
22
+ * Will default to `px` if no unit supplied e.g. `20rem` */
23
+ mSize: number | string;
24
+ /** the component's large breakpoint. Note - all breakpoints are based on component width, not screen width.
25
+ * Will default to `px` if no unit supplied e.g. `20rem` */
26
+ lSize: number | string;
27
+ /** the component's xl breakpoint. Note - all breakpoints are based on component width, not screen width.
28
+ * Will default to `px` if no unit supplied e.g. `20rem` */
29
+ xlSize: number | string;
30
+ /** the number of columns the grid has at the small breakpoint. */
39
31
  sCols: number;
40
- /**
41
- * the number of columns the grid has at the medium breakpoint.
42
- */
32
+ /** the number of columns the grid has at the medium breakpoint. */
43
33
  mCols: number;
44
- /**
45
- * the number of columns the grid has at the large breakpoint.
46
- */
34
+ /** the number of columns the grid has at the large breakpoint. */
47
35
  lCols: number;
48
- /**
49
- * the number of columns the grid has at the xl breakpoint.
50
- */
36
+ /** the number of columns the grid has at the xl breakpoint. */
51
37
  xlCols: number;
52
- /**
53
- * the number of columns the grid has at the xxl breakpoint (anything greater than the xl breakpoint)
54
- */
38
+ /** the number of columns the grid has at the xxl breakpoint (anything greater than the xl breakpoint) */
55
39
  xxlCols: number;
56
- /**
57
- * shows a grid helper to visualise where columns are
58
- */
40
+ /** Optional small `grid-template`. *Note* - you must set `sCols` for this to take affect */
41
+ sTpl?: string;
42
+ /** Optional medium `grid-template`. *Note* - you must set `mCols` for this to take affect */
43
+ mTpl?: string;
44
+ /** Optional large `grid-template`. *Note* - you must set `lCols` for this to take affect */
45
+ lTpl?: string;
46
+ /** Optional xl `grid-template`. *Note* - you must set `xlCols` for this to take affect */
47
+ xlTpl?: string;
48
+ /** Optional xxl `grid-template`. *Note* - you must set `xxlCols` for this to take affect */
49
+ xxlTpl?: string;
50
+ /** shows a grid helper to visualise where columns are */
59
51
  showHelper: boolean;
60
- /**
61
- * 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.
62
- */
63
- contentPanel: boolean;
64
- /**
65
- * Helper to make grid items expand to full height in IE11
66
- */
67
- fullHeight: boolean;
68
- /**
69
- * Emitted when the `nano-grid` changes breakpoint
70
- */
71
- nanoBpChange: EventEmitter<string[]>;
72
- propChanged(): void;
73
- private applySizeClasses;
74
- stateChange(): void;
75
- private applyChildrenClasses;
52
+ constructSizeArray(): void;
53
+ protected styles: () => string;
76
54
  componentWillLoad(): void;
77
- componentDidLoad(): void;
78
- disconnectedCallback(): void;
79
55
  render(): any;
80
56
  }
@@ -16,7 +16,6 @@ import { ComponentInterface } from '../../stencil-public-runtime';
16
16
  export declare class Hero implements ComponentInterface {
17
17
  private mo?;
18
18
  host: HTMLNanoHeroElement;
19
- gridSizes: string[];
20
19
  hasIconBox: boolean;
21
20
  hasScrim: boolean;
22
21
  hasSecondaryContent: boolean;
@@ -28,7 +27,7 @@ export declare class Hero implements ComponentInterface {
28
27
  breadCrumbChange(): void;
29
28
  iconBoxItems: Element[];
30
29
  iconBoxItemChange(): void;
31
- /** src for backgronund image. For more control use the `background` slot instead. */
30
+ /** src for background image. For more control use the `background` slot instead. */
32
31
  imgSrc?: string;
33
32
  /** Optional list string providing media sizes with corresponding image srcs.
34
33
  * i.e. show img-x at 300px wide. Format `srcSet="200w src/imgSmall.jpg, 500h src/imgMed.png"` */
@@ -41,7 +40,6 @@ export declare class Hero implements ComponentInterface {
41
40
  level: 'top' | 'sub';
42
41
  private slotChangeObserver;
43
42
  private processSlottedContent;
44
- private handleGridChange;
45
43
  disconnectedCallback(): void;
46
44
  componentDidLoad(): void;
47
45
  componentWillLoad(): void;
@@ -227,6 +227,11 @@ export declare class Table implements ComponentInterface {
227
227
  private getBlockHeight;
228
228
  /** cache the height for all active blocks for later renders */
229
229
  private setBlockHeight;
230
+ /**
231
+ * On scroll, loop through all blocks' heights and cumulatively, add them together.
232
+ * When we find that the scroll position is less than this cumulative block height -
233
+ * stop loop - it's on the current active block.
234
+ */
230
235
  private scrollHandler;
231
236
  /** Process slotted content */
232
237
  private processSlots;
@@ -5,7 +5,7 @@
5
5
  * It contains typing information for all components that exist in this project.
6
6
  */
7
7
  import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
8
- import { AlgoliaNetworkError, AloliaSearchResultDetail, CheckboxChangeEventDetail, Color, ControlValidity, ControlValidityEventDetail, DateDisabledPredicate, DateInputChangeEventDetail, DragEvent, DuetLocalizedText, FileInputChangeEventDetail, FileWithUrl, FilterChangeEventDetail, Flickity, FlickityOptions, GridSizes, IndexResult, InputChangeEventDetail, LocalDateOpts, MyAccountData, MyAccountUser, NanoFormEles, NavItemEventDetail, OptionInterface, PageChangeEventDetail, PickerChangeEvent, PlainFormEles, RangeChangeEventDetail, RangeValue, ResizeStateChangeEventDetail, SearchIndex, SelectChangeEventDetail, SlideAnimation, StyleEventDetail, TableTypes, TextFieldTypes, ValidationState, ValidatorValueStore } from "./interface";
8
+ import { AlgoliaNetworkError, AloliaSearchResultDetail, CheckboxChangeEventDetail, Color, ControlValidity, ControlValidityEventDetail, DateDisabledPredicate, DateInputChangeEventDetail, DragEvent, DuetLocalizedText, FileInputChangeEventDetail, FileWithUrl, FilterChangeEventDetail, Flickity, FlickityOptions, IndexResult, InputChangeEventDetail, LocalDateOpts, MyAccountData, MyAccountUser, NanoFormEles, NavItemEventDetail, OptionInterface, PageChangeEventDetail, PickerChangeEvent, PlainFormEles, RangeChangeEventDetail, RangeValue, ResizeStateChangeEventDetail, SearchIndex, SelectChangeEventDetail, SlideAnimation, StyleEventDetail, TableTypes, TextFieldTypes, ValidationState, ValidatorValueStore } from "./interface";
9
9
  import { StorageMethods } from "./utils/store/component-store";
10
10
  import { DaysOfWeek } from "./utils/date-utils";
11
11
  import { PopoverPlacement } from "./utils/popover";
@@ -1118,42 +1118,49 @@ export namespace Components {
1118
1118
  interface NanoGlobalSearchResults {
1119
1119
  }
1120
1120
  /**
1121
- * A context-aware CSS grid implementation.
1122
- * Uses it's own width to choose column number - not screen width.
1121
+ * A lightweight, context-aware CSS grid implementation.
1122
+ * - Define multiple grids templates at different breakpoints
1123
+ * - Uses `@container` queries to select the correct grid depending on the current dimensions
1124
+ * - Use `grid-states="..."` on direct descendants for `column` / `row` - `start` / `end`
1125
+ * - SSR optimised
1123
1126
  */
1124
1127
  interface NanoGrid {
1125
- /**
1126
- * 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.
1127
- */
1128
- "contentPanel": boolean;
1129
- /**
1130
- * Helper to make grid items expand to full height in IE11
1131
- */
1132
- "fullHeight": boolean;
1133
1128
  /**
1134
1129
  * the number of columns the grid has at the large breakpoint.
1135
1130
  */
1136
1131
  "lCols": number;
1137
1132
  /**
1138
- * the component's large breakpoint. Note - all breakpoints are based on component width, not screen width.
1133
+ * the component's large breakpoint. Note - all breakpoints are based on component width, not screen width. Will default to `px` if no unit supplied e.g. `20rem`
1139
1134
  */
1140
- "lSize": number;
1135
+ "lSize": number | string;
1136
+ /**
1137
+ * Optional large `grid-template`. *Note* - you must set `lCols` for this to take affect
1138
+ */
1139
+ "lTpl"?: string;
1141
1140
  /**
1142
1141
  * the number of columns the grid has at the medium breakpoint.
1143
1142
  */
1144
1143
  "mCols": number;
1145
1144
  /**
1146
- * the component's medium breakpoint. Note - all breakpoints are based on component width, not screen width.
1145
+ * the component's medium breakpoint. Note - all breakpoints are based on component width, not screen width. Will default to `px` if no unit supplied e.g. `20rem`
1146
+ */
1147
+ "mSize": number | string;
1148
+ /**
1149
+ * Optional medium `grid-template`. *Note* - you must set `mCols` for this to take affect
1147
1150
  */
1148
- "mSize": number;
1151
+ "mTpl"?: string;
1149
1152
  /**
1150
1153
  * the number of columns the grid has at the small breakpoint.
1151
1154
  */
1152
1155
  "sCols": number;
1153
1156
  /**
1154
- * the component's small breakpoint. Note - all breakpoints are based on component width, not screen width.
1157
+ * the component's small breakpoint. Note - all breakpoints are based on component width, not screen width. Will default to `px` if no unit supplied e.g. `20rem`
1155
1158
  */
1156
- "sSize": number;
1159
+ "sSize": number | string;
1160
+ /**
1161
+ * Optional small `grid-template`. *Note* - you must set `sCols` for this to take affect
1162
+ */
1163
+ "sTpl"?: string;
1157
1164
  /**
1158
1165
  * shows a grid helper to visualise where columns are
1159
1166
  */
@@ -1163,33 +1170,35 @@ export namespace Components {
1163
1170
  */
1164
1171
  "xlCols": number;
1165
1172
  /**
1166
- * the component's xl breakpoint. Note - all breakpoints are based on component width, not screen width.
1173
+ * the component's xl breakpoint. Note - all breakpoints are based on component width, not screen width. Will default to `px` if no unit supplied e.g. `20rem`
1174
+ */
1175
+ "xlSize": number | string;
1176
+ /**
1177
+ * Optional xl `grid-template`. *Note* - you must set `xlCols` for this to take affect
1167
1178
  */
1168
- "xlSize": number;
1179
+ "xlTpl"?: string;
1169
1180
  /**
1170
1181
  * the number of columns the grid has at the xxl breakpoint (anything greater than the xl breakpoint)
1171
1182
  */
1172
1183
  "xxlCols": number;
1184
+ /**
1185
+ * Optional xxl `grid-template`. *Note* - you must set `xxlCols` for this to take affect
1186
+ */
1187
+ "xxlTpl"?: string;
1173
1188
  }
1174
1189
  /**
1190
+ * @deprecated - you can now use `grid-states="..."`
1191
+ * on any direct `nano-grid` descendent without limitation rendering `nano-grid-item` obsolete.
1175
1192
  * Grid items to be used with [grid](/story/nano-components-grid) elements
1176
1193
  */
1177
1194
  interface NanoGridItem {
1178
- /**
1179
- * Called by parent grid to trigger new classes
1180
- */
1181
- "changeBP": (newGridSizes: GridSizes[]) => Promise<void>;
1182
- /**
1183
- * How to position this item within it's parent grid at different break points. Examples: xl-col-span-2 l-col-start-2 xxl-row-span-2 m-row-start-2
1184
- */
1185
- "gridStates": string;
1186
1195
  }
1187
1196
  /**
1188
1197
  * Hero components are designed to be used once per content page to add visual impact to the introductory section of a page.
1189
1198
  */
1190
1199
  interface NanoHero {
1191
1200
  /**
1192
- * src for backgronund image. For more control use the `background` slot instead.
1201
+ * src for background image. For more control use the `background` slot instead.
1193
1202
  */
1194
1203
  "imgSrc"?: string;
1195
1204
  /**
@@ -2622,10 +2631,6 @@ export interface NanoGlobalSearchResultsCustomEvent<T> extends CustomEvent<T> {
2622
2631
  detail: T;
2623
2632
  target: HTMLNanoGlobalSearchResultsElement;
2624
2633
  }
2625
- export interface NanoGridCustomEvent<T> extends CustomEvent<T> {
2626
- detail: T;
2627
- target: HTMLNanoGridElement;
2628
- }
2629
2634
  export interface NanoImgCustomEvent<T> extends CustomEvent<T> {
2630
2635
  detail: T;
2631
2636
  target: HTMLNanoImgElement;
@@ -2932,8 +2937,11 @@ declare global {
2932
2937
  new (): HTMLNanoGlobalSearchResultsElement;
2933
2938
  };
2934
2939
  /**
2935
- * A context-aware CSS grid implementation.
2936
- * Uses it's own width to choose column number - not screen width.
2940
+ * A lightweight, context-aware CSS grid implementation.
2941
+ * - Define multiple grids templates at different breakpoints
2942
+ * - Uses `@container` queries to select the correct grid depending on the current dimensions
2943
+ * - Use `grid-states="..."` on direct descendants for `column` / `row` - `start` / `end`
2944
+ * - SSR optimised
2937
2945
  */
2938
2946
  interface HTMLNanoGridElement extends Components.NanoGrid, HTMLStencilElement {
2939
2947
  }
@@ -2942,6 +2950,8 @@ declare global {
2942
2950
  new (): HTMLNanoGridElement;
2943
2951
  };
2944
2952
  /**
2953
+ * @deprecated - you can now use `grid-states="..."`
2954
+ * on any direct `nano-grid` descendent without limitation rendering `nano-grid-item` obsolete.
2945
2955
  * Grid items to be used with [grid](/story/nano-components-grid) elements
2946
2956
  */
2947
2957
  interface HTMLNanoGridItemElement extends Components.NanoGridItem, HTMLStencilElement {
@@ -4438,46 +4448,49 @@ declare namespace LocalJSX {
4438
4448
  "onNanoSearchGoBack"?: (event: NanoGlobalSearchResultsCustomEvent<any>) => void;
4439
4449
  }
4440
4450
  /**
4441
- * A context-aware CSS grid implementation.
4442
- * Uses it's own width to choose column number - not screen width.
4451
+ * A lightweight, context-aware CSS grid implementation.
4452
+ * - Define multiple grids templates at different breakpoints
4453
+ * - Uses `@container` queries to select the correct grid depending on the current dimensions
4454
+ * - Use `grid-states="..."` on direct descendants for `column` / `row` - `start` / `end`
4455
+ * - SSR optimised
4443
4456
  */
4444
4457
  interface NanoGrid {
4445
- /**
4446
- * 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.
4447
- */
4448
- "contentPanel"?: boolean;
4449
- /**
4450
- * Helper to make grid items expand to full height in IE11
4451
- */
4452
- "fullHeight"?: boolean;
4453
4458
  /**
4454
4459
  * the number of columns the grid has at the large breakpoint.
4455
4460
  */
4456
4461
  "lCols"?: number;
4457
4462
  /**
4458
- * the component's large breakpoint. Note - all breakpoints are based on component width, not screen width.
4463
+ * the component's large breakpoint. Note - all breakpoints are based on component width, not screen width. Will default to `px` if no unit supplied e.g. `20rem`
4464
+ */
4465
+ "lSize"?: number | string;
4466
+ /**
4467
+ * Optional large `grid-template`. *Note* - you must set `lCols` for this to take affect
4459
4468
  */
4460
- "lSize"?: number;
4469
+ "lTpl"?: string;
4461
4470
  /**
4462
4471
  * the number of columns the grid has at the medium breakpoint.
4463
4472
  */
4464
4473
  "mCols"?: number;
4465
4474
  /**
4466
- * the component's medium breakpoint. Note - all breakpoints are based on component width, not screen width.
4475
+ * the component's medium breakpoint. Note - all breakpoints are based on component width, not screen width. Will default to `px` if no unit supplied e.g. `20rem`
4467
4476
  */
4468
- "mSize"?: number;
4477
+ "mSize"?: number | string;
4469
4478
  /**
4470
- * Emitted when the `nano-grid` changes breakpoint
4479
+ * Optional medium `grid-template`. *Note* - you must set `mCols` for this to take affect
4471
4480
  */
4472
- "onNanoBpChange"?: (event: NanoGridCustomEvent<string[]>) => void;
4481
+ "mTpl"?: string;
4473
4482
  /**
4474
4483
  * the number of columns the grid has at the small breakpoint.
4475
4484
  */
4476
4485
  "sCols"?: number;
4477
4486
  /**
4478
- * the component's small breakpoint. Note - all breakpoints are based on component width, not screen width.
4487
+ * the component's small breakpoint. Note - all breakpoints are based on component width, not screen width. Will default to `px` if no unit supplied e.g. `20rem`
4479
4488
  */
4480
- "sSize"?: number;
4489
+ "sSize"?: number | string;
4490
+ /**
4491
+ * Optional small `grid-template`. *Note* - you must set `sCols` for this to take affect
4492
+ */
4493
+ "sTpl"?: string;
4481
4494
  /**
4482
4495
  * shows a grid helper to visualise where columns are
4483
4496
  */
@@ -4487,29 +4500,35 @@ declare namespace LocalJSX {
4487
4500
  */
4488
4501
  "xlCols"?: number;
4489
4502
  /**
4490
- * the component's xl breakpoint. Note - all breakpoints are based on component width, not screen width.
4503
+ * the component's xl breakpoint. Note - all breakpoints are based on component width, not screen width. Will default to `px` if no unit supplied e.g. `20rem`
4504
+ */
4505
+ "xlSize"?: number | string;
4506
+ /**
4507
+ * Optional xl `grid-template`. *Note* - you must set `xlCols` for this to take affect
4491
4508
  */
4492
- "xlSize"?: number;
4509
+ "xlTpl"?: string;
4493
4510
  /**
4494
4511
  * the number of columns the grid has at the xxl breakpoint (anything greater than the xl breakpoint)
4495
4512
  */
4496
4513
  "xxlCols"?: number;
4514
+ /**
4515
+ * Optional xxl `grid-template`. *Note* - you must set `xxlCols` for this to take affect
4516
+ */
4517
+ "xxlTpl"?: string;
4497
4518
  }
4498
4519
  /**
4520
+ * @deprecated - you can now use `grid-states="..."`
4521
+ * on any direct `nano-grid` descendent without limitation rendering `nano-grid-item` obsolete.
4499
4522
  * Grid items to be used with [grid](/story/nano-components-grid) elements
4500
4523
  */
4501
4524
  interface NanoGridItem {
4502
- /**
4503
- * How to position this item within it's parent grid at different break points. Examples: xl-col-span-2 l-col-start-2 xxl-row-span-2 m-row-start-2
4504
- */
4505
- "gridStates"?: string;
4506
4525
  }
4507
4526
  /**
4508
4527
  * Hero components are designed to be used once per content page to add visual impact to the introductory section of a page.
4509
4528
  */
4510
4529
  interface NanoHero {
4511
4530
  /**
4512
- * src for backgronund image. For more control use the `background` slot instead.
4531
+ * src for background image. For more control use the `background` slot instead.
4513
4532
  */
4514
4533
  "imgSrc"?: string;
4515
4534
  /**
@@ -6119,11 +6138,16 @@ declare module "@stencil/core" {
6119
6138
  */
6120
6139
  "nano-global-search-results": LocalJSX.NanoGlobalSearchResults & JSXBase.HTMLAttributes<HTMLNanoGlobalSearchResultsElement>;
6121
6140
  /**
6122
- * A context-aware CSS grid implementation.
6123
- * Uses it's own width to choose column number - not screen width.
6141
+ * A lightweight, context-aware CSS grid implementation.
6142
+ * - Define multiple grids templates at different breakpoints
6143
+ * - Uses `@container` queries to select the correct grid depending on the current dimensions
6144
+ * - Use `grid-states="..."` on direct descendants for `column` / `row` - `start` / `end`
6145
+ * - SSR optimised
6124
6146
  */
6125
6147
  "nano-grid": LocalJSX.NanoGrid & JSXBase.HTMLAttributes<HTMLNanoGridElement>;
6126
6148
  /**
6149
+ * @deprecated - you can now use `grid-states="..."`
6150
+ * on any direct `nano-grid` descendent without limitation rendering `nano-grid-item` obsolete.
6127
6151
  * Grid items to be used with [grid](/story/nano-components-grid) elements
6128
6152
  */
6129
6153
  "nano-grid-item": LocalJSX.NanoGridItem & JSXBase.HTMLAttributes<HTMLNanoGridItemElement>;
@@ -0,0 +1,31 @@
1
+ import { ComponentInterface } from '../stencil-public-runtime';
2
+ declare type ConstructibleStyleDecorator = (target: ComponentInterface, propertyKey: string) => void;
3
+ /**
4
+ * Dynamically create a constructible stylesheet which is applied to the component.
5
+ * The stylesheet is then cached for future instances of the component.
6
+ * @usage
7
+ As a string:
8
+ ```
9
+ @ConstructableStyle() style = `.bg { background: url('assets/${ this.mode }/bg.png'); }`;
10
+ ```
11
+ As a function:
12
+ ```
13
+ @ConstructableStyle() style = () => `.bg { background: url('assets/${ this.mode }/bg.png'); }`;
14
+ ```
15
+ * @param opts - optional `cacheKeyProperty` - in case an instance of a component could produce different styles based on variables.
16
+ * @returns `@ConstructableStyle` decorator
17
+ */
18
+ export declare function ConstructibleStyle(opts?: ConstructibleStyleOptions): ConstructibleStyleDecorator;
19
+ export interface ConstructibleStyleOptions {
20
+ /**
21
+ * Set this in case an instance of a component could produce different styles based on variables.
22
+ * This will ensure that you get new styles for each mode.
23
+ * @example
24
+ ```
25
+ @Prop() mode: string;
26
+ @ConstructableStyle({ cacheKeyProperty: "mode" }) style = `.bg { background: url('assets/${ this.mode }/bg.png'); }`;
27
+ ```
28
+ */
29
+ cacheKeyProperty?: string;
30
+ }
31
+ export {};