@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
@@ -1 +1 @@
1
- {"file":"dropdown.js","mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,8tDAA8tD;;ACiBlvD,IAAI,WAAW,GAAG,CAAC,CAAC;MAaP,QAAQ;;;;;;;;;IACX,eAAU,GAAG,YAAY,WAAW,EAAE,EAAE,CAAC;IACzC,YAAO,GAAG,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;IACrC,sBAAiB,GAAG,KAAK,CAAC;IAM1B,YAAO,GAAG,KAAK,CAAC;IAuOhB,gBAAW,GAAG;MACpB,IAAI,CAAC,IAAI,CAAC,QAAQ;QAAE,OAAO;MAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;KACvC,CAAC;IAgFM,yBAAoB,GAAG,CAAC,KAAoB;;MAElD,IAAI,CAAC,WAAW,EAAE,SAAS,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QACrD,IAAI,CAAC,IAAI,EAAE,CAAC;QACZ,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,KAAK,CAAC,eAAe,EAAE,CAAC;QAExB,IAAI,IAAI,CAAC,IAAI;UAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;OACrC;KACF,CAAC;IAEM,4BAAuB,GAAG;MAChC,IAAI,CAAC,uBAAuB,EAAE,CAAC;KAChC,CAAC;oBA/TiB,IAAI;gBAGwB,KAAK;yBAsB5B,IAAI;;oBAWI,IAAI;qBAYE,cAAc;oBAKjC,CAAC;oBAKD,CAA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AY,CAAC,MAAM,CAAC,KAAK,OAAO;UACtC,SAAS;UACT,QAAQ,IAGb,IAAI,CAAC,WAAW,CACZ,CACR,EACD,eAAQ,CACJ,CACF,CACF,EACN;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/dropdown/dropdown.scss?tag=nano-dropdown&encapsulation=shadow","./src/components/dropdown/dropdown.tsx"],"sourcesContent":["@import '../../global/style/utilities/globals';\n@import '../../global/style/nano-theme/layers';\n\n:host {\n /**\n * @prop --width: width of the dropdown. Defaults to 'auto'\n * @prop --border: Defaults to #{$layer-border-style}\n * @prop --border-radius: Defaults to #{$layer-bg-color};\n * @prop --background: Defaults to #{$layer-bg-color};\n * @prop --padding: padding of the drop down. Default to '10px 0';\n * @prop --overflow: `nano-menu` with nested `nav-item` requires hidden overflow. This can be overidden;\n * @prop --dropdown-z-index: Defaults to #{$layer-index-dropdown};\n * @prop --min-width: Defaults to 0;\n * @prop --box-shadow: #{$layer-shadow-large};\n */\n\n --width: auto;\n --border: #{$layer-border-style};\n --border-radius: #{$layer-border-radius};\n --background: #{$layer-bg-color};\n --padding: 10px 0;\n --overflow: hidden;\n --dropdown-z-index: #{$layer-index-dropdown};\n --min-width: 0;\n --box-shadow: #{$layer-shadow-large};\n --menu-height: var(--max-menu-height, 50vh);\n\n display: flex;\n}\n\n.dropdown {\n position: relative;\n\n &__trigger {\n display: block;\n }\n\n &__positioner {\n position: absolute;\n z-index: var(--dropdown-z-index);\n min-inline-size: var(--min-width);\n\n @media (max-width: 35.9375em) {\n z-index: 100;\n }\n }\n\n &__panel {\n padding: var(--padding);\n background: var(--background);\n min-inline-size: var(--min-width);\n inline-size: var(--width);\n border: var(--border);\n border-radius: var(--border-radius);\n color: currentcolor;\n box-shadow: var(--box-shadow);\n opacity: 0;\n transition: 0.2s ease opacity, 0.2s ease transform, 0.2s ease min-block-size;\n min-block-size: 20px;\n overflow: var(--overflow);\n box-sizing: content-box !important;\n\n &.loading {\n overflow-y: hidden;\n }\n\n &.top {\n transform: translateY(-20px) translateZ(0);\n }\n\n &.bottom {\n transform: translateY(20px) translateZ(0);\n }\n\n .dropdown__positioner.popover-visible & {\n opacity: 1;\n transform: translateY(0) translateZ(0);\n }\n\n ::slotted(nano-menu) {\n max-block-size: var(--menu-height);\n }\n }\n\n &__accessible-title {\n @include visually-hide();\n }\n}\n","import {\n Component,\n Element,\n Event,\n Method,\n Prop,\n Watch,\n h,\n Listen,\n ComponentInterface,\n EventEmitter,\n} from '@stencil/core';\nimport { getActiveElement } from '../../utils/active-element';\nimport Popover, { PopoverPlacement } from '../../utils/popover';\nimport { getNearestTabbableElement } from '../../utils/tabbable';\nimport type { NavItemEventDetail } from '../../interface';\n\nlet dropDownIds = 0;\n\n/**\n * Dropdowns show additional content in a panel.\n * Designed to work well with nano-menu components to provide a list of options (`nano-nav-items` / `nano-option`).\n * @slot trigger - The dropdown's trigger.\n * @slot - The dropdown's content.\n */\n@Component({\n tag: 'nano-dropdown',\n styleUrl: 'dropdown.scss',\n shadow: true,\n})\nexport class Dropdown implements ComponentInterface {\n private dropdownId = `dropdown-${dropDownIds++}`;\n private labelId = this.dropdownId + '-title';\n private ignoreOpenWatcher = false;\n private panel: HTMLElement;\n private popover: Popover;\n private trigger: HTMLElement;\n private positioner: HTMLElement;\n private accessibleTrigger: HTMLElement;\n private didLoad = false;\n private get menu() {\n return this.host.querySelector('nano-menu') as HTMLNanoMenuElement;\n }\n\n @Element() host: HTMLNanoDropdownElement;\n\n /** Determines if the dropdown should open automatically when the trigger is clicked */\n @Prop() autoOpen = true;\n\n /** Indicates whether or not the dropdown is open. You can use this in lieu of the show/hide methods. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n @Watch('open')\n handleOpenChange() {\n if (this.ignoreOpenWatcher) return;\n\n this.open ? this.show() : this.hide();\n\n if (this.accessibleTrigger) {\n this.accessibleTrigger.setAttribute(\n 'aria-expanded',\n this.open.toString()\n );\n return;\n }\n\n this.updateAccessibleTrigger();\n }\n\n /**\n * Determines whether the dropdown should hide when a menu item is selected.\n */\n @Prop() closeOnSelect = true;\n\n /**\n * The dropdown will close when the user interacts outside of this element (e.g. clicking).\n */\n @Prop({ mutable: true }) containingElement: HTMLElement;\n\n /**\n * If you don't want to use the trigger slot, you can use this to 'tether' the dropdown to another element.\n * And you will still need to control when the component is opened (using show() / hide() or the `open` prop)\n */\n @Prop() tetherTo: HTMLElement = null;\n\n @Watch('tetherTo')\n handleTetherToChange() {\n this.createPopover();\n this.updateAccessibleTrigger();\n }\n\n /**\n * The preferred placement of the dropdown panel. Note that the actual placement may vary as needed to keep the panel\n * inside of the viewport.\n */\n @Prop() placement: PopoverPlacement = 'bottom-start';\n\n /**\n * The distance in pixels from which to offset the panel away from its trigger.\n */\n @Prop() distance = 2;\n\n /**\n * The distance in pixels from which to offset the panel along its trigger.\n */\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 @Watch('placement')\n @Watch('distance')\n @Watch('skidding')\n @Watch('hoist')\n handlePopoverOptionsChange() {\n if (!this.popover) return;\n\n this.popover.setOptions({\n strategy: this.hoist ? 'fixed' : 'absolute',\n placement: this.placement,\n skidding: this.skidding,\n distance: this.distance,\n });\n }\n\n /**\n * Title used to describe the dropdown content for accessibility\n */\n @Prop() dialogTitle!: string;\n\n // Events\n\n /**\n * Emitted when the dropdown opens. Calling `event.preventDefault()` will prevent it from being opened.\n */\n @Event() nanoShow: EventEmitter;\n\n /**\n * Emitted after the dropdown opens and all transitions are complete.\n */\n @Event() nanoAfterShow: EventEmitter;\n\n /**\n * Emitted when the dropdown closes. Calling `event.preventDefault()` will prevent it from being closed.\n */\n @Event() nanoHide: EventEmitter;\n\n /**\n * Emitted after the dropdown closes and all transitions are complete.\n */\n @Event() nanoAfterHide: EventEmitter;\n\n // this is a massive hack to make stencil expose the `EventEmitter` type in the final build\n // because the `Dropdown` class is used as a type in `nano-datalist`\n /** @internal */\n @Prop() eventType: EventEmitter;\n\n // Listeners\n\n @Listen('nanoOpen')\n secondaryOpen(ev: CustomEvent) {\n if (!(ev.detail as NavItemEventDetail).secondaryMenu) return;\n ev.stopPropagation();\n\n this.panel.classList.add('loading');\n this.panel.addEventListener(\n 'transitionend',\n () => {\n this.panel.classList.remove('loading');\n },\n { once: true }\n );\n\n this.panel.style.minHeight =\n (ev.detail as NavItemEventDetail).secondaryMenu.scrollHeight + 'px';\n }\n\n @Listen('nanoClose')\n secondaryClose(ev: CustomEvent) {\n if (!(ev.detail as NavItemEventDetail).secondaryMenu) return;\n ev.stopPropagation();\n if (!(ev.target as HTMLElement).parentElement) return;\n this.panel.style.minHeight =\n (ev.target as HTMLElement).parentElement.scrollHeight + 'px';\n }\n\n @Listen('nanoSelect')\n handlePanelSelect(event: CustomEvent) {\n const target = event.target as HTMLElement;\n\n // Hide the dropdown when a menu item is selected\n if (this.closeOnSelect && target.tagName.toLowerCase() === 'nano-menu')\n this.hide();\n }\n\n // Methods\n\n /** Shows the dropdown panel */\n @Method()\n async show() {\n this.ignoreOpenWatcher = true;\n this.open = true;\n\n const nanoShow = this.nanoShow.emit();\n\n if (nanoShow.defaultPrevented) {\n this.open = false;\n this.ignoreOpenWatcher = false;\n return;\n }\n\n this.popover.show();\n this.ignoreOpenWatcher = false;\n\n document.addEventListener('mousedown', this.handleDocumentMouseDown);\n document.addEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n /** Hides the dropdown panel */\n @Method()\n async hide() {\n this.ignoreOpenWatcher = true;\n this.open = false;\n\n const nanoHide = this.nanoHide.emit();\n\n if (nanoHide.defaultPrevented) {\n this.open = true;\n this.ignoreOpenWatcher = false;\n return;\n }\n\n if (this.popover) this.popover.hide();\n this.ignoreOpenWatcher = false;\n\n document.removeEventListener('mousedown', this.handleDocumentMouseDown);\n document.removeEventListener('keydown', this.handleDocumentKeyDown);\n\n if (this.accessibleTrigger && this.focusEleInDropDwn()) {\n this.accessibleTrigger.focus();\n }\n }\n\n // Private methods\n\n /**\n * Decides if the current active element or element\n * connected to the current event is connected to the Dropdown\n * @param e\n * @returns whether the current focus is within the dropdown\n */\n private focusEleInDropDwn(e?: Event) {\n const activeElement = getActiveElement();\n\n if (e && e.composedPath()?.length) {\n const ddInPath = e.composedPath().includes(this.containingElement);\n return !e.composedPath().includes(this.accessibleTrigger) && ddInPath;\n }\n\n return (\n activeElement &&\n activeElement.closest(this.containingElement.tagName.toLowerCase()) ===\n this.containingElement &&\n activeElement !== this.accessibleTrigger\n );\n }\n\n private togglePanel = () => {\n if (!this.autoOpen) return;\n this.open ? this.hide() : this.show();\n };\n\n // Slotted triggers can be arbitrary content, but we need to link them to the dropdown panel with `aria-haspopup` and\n // `aria-expanded`. These must be applied to the \"accessible trigger\" (the tabbable portion of the trigger element\n // that gets slotted in) so screen readers will understand them. The accessible trigger could be the slotted element,\n private updateAccessibleTrigger() {\n if (!this.didLoad) return;\n\n let accessibleTrigger: HTMLElement;\n this.accessibleTrigger = null;\n\n if (!this.tetherTo) {\n const assignedElements = Array.from(\n this.host.querySelectorAll('[slot=\"trigger\"]')\n );\n accessibleTrigger = assignedElements.map(getNearestTabbableElement)[0];\n } else {\n accessibleTrigger = getNearestTabbableElement(this.tetherTo);\n }\n\n if (accessibleTrigger) {\n accessibleTrigger.setAttribute('aria-haspopup', 'true');\n accessibleTrigger.setAttribute(\n 'aria-expanded',\n this.open ? 'true' : 'false'\n );\n this.accessibleTrigger = accessibleTrigger;\n }\n }\n\n // Handlers\n\n private handleDocumentKeyDown(event: KeyboardEvent) {\n // Close when escape is pressed\n if (event.key === 'Escape') {\n this.hide();\n return;\n }\n\n // Close when tabbing results in the focus leaving the close element\n if (event.key === 'Tab') {\n setTimeout(() => {\n if (\n document.activeElement &&\n document.activeElement.closest(\n this.containingElement.tagName.toLowerCase()\n ) !== this.containingElement\n ) {\n this.hide();\n return;\n }\n });\n }\n\n // If a menu is present, focus on it when certain keys are pressed\n if (this.menu && ['ArrowDown', 'ArrowUp'].includes(event.key)) {\n // must have menu item, must have pressed down, must be open and must not have focus within dd\n if (!this.open || this.focusEleInDropDwn(event)) return;\n event.preventDefault();\n this.menu.setFocus();\n return;\n }\n\n // All other keys focus the menu and pass the event through to menu (necessary for type-to-search to work)\n const ePath = event.composedPath();\n if (this.menu && ePath.length && !ePath.find((el) => el !== this.menu)) {\n this.menu.dispatchEvent(new KeyboardEvent(event.type, event));\n return;\n }\n }\n\n private handleDocumentMouseDown(event: MouseEvent) {\n // Close when clicking outside of the close element\n\n if (!this.focusEleInDropDwn(event)) {\n this.hide();\n return;\n }\n }\n\n private handleTriggerKeyDown = (event: KeyboardEvent) => {\n // Open the panel when pressing down or up while focused on the trigger\n if (['ArrowDown', 'ArrowUp', ' '].includes(event.key)) {\n this.show();\n event.preventDefault();\n event.stopPropagation();\n\n if (this.menu) this.menu.setFocus();\n }\n };\n\n private handleTriggerSlotChange = () => {\n this.updateAccessibleTrigger();\n };\n\n private createPopover() {\n if ((!this.tetherTo && !this.trigger) || !this.positioner) return;\n\n if (this.popover) {\n if (this.open) this.hide();\n this.popover.destroy();\n this.popover = null;\n }\n\n this.popover = new Popover(this.tetherTo || this.trigger, this.positioner, {\n strategy: this.hoist ? 'fixed' : 'absolute',\n placement: this.placement,\n distance: this.distance,\n skidding: this.skidding,\n transitionElement: this.panel,\n onAfterHide: () => this.nanoAfterHide.emit(),\n onAfterShow: () => this.nanoAfterShow.emit(),\n onTransitionEnd: () => {\n if (!this.open) {\n this.panel.scrollTop = 0;\n } else if (this.menu) {\n this.menu.showActiveElement();\n }\n },\n });\n // Show on init if open\n if (this.open) {\n this.show();\n }\n }\n\n // Stencil hooks\n\n connectedCallback() {\n this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);\n this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);\n\n if (!this.containingElement) this.containingElement = this.host;\n }\n\n componentDidLoad() {\n this.didLoad = true;\n this.createPopover();\n setTimeout(() => this.updateAccessibleTrigger(), 100);\n }\n\n disconnectedCallback() {\n if (this.host.isConnected) this.hide();\n if (this.popover) this.popover.destroy();\n }\n\n render() {\n return (\n <div\n part=\"base\"\n id={this.dropdownId}\n class={{\n dropdown: true,\n 'dropdown--open': this.open,\n }}\n >\n <span\n part=\"trigger\"\n class=\"dropdown__trigger\"\n ref={(el) => (this.trigger = el)}\n onKeyDown={this.handleTriggerKeyDown}\n onClick={this.togglePanel}\n >\n <slot name=\"trigger\" onSlotchange={this.handleTriggerSlotChange} />\n </span>\n\n <div ref={(el) => (this.positioner = el)} class=\"dropdown__positioner\">\n <div\n ref={(el) => (this.panel = el)}\n part=\"panel\"\n class={`dropdown__panel ${this.placement.split('-').join(' ')}`}\n aria-hidden={!this.open}\n role={\n this.host.getAttribute('role') === 'group' ? 'group' : 'dialog'\n }\n aria-modal={\n this.host.getAttribute('role') === 'group' ? undefined : 'true'\n }\n aria-labelledby={this.dialogTitle ? this.labelId : undefined}\n >\n {this.dialogTitle && (\n <span\n id={this.labelId}\n class=\"dropdown__accessible-title\"\n aria-live={\n this.host.getAttribute('role') === 'group'\n ? undefined\n : 'polite'\n }\n >\n {this.dialogTitle}\n </span>\n )}\n <slot />\n </div>\n </div>\n </div>\n );\n }\n}\n"],"version":3}
1
+ {"file":"dropdown.js","mappings":";;;;;;;;AAAA,MAAM,WAAW,GAAG,4tDAA4tD;;ACiBhvD,IAAI,WAAW,GAAG,CAAC,CAAC;MAaP,QAAQ;;;;;;;;;IACX,eAAU,GAAG,YAAY,WAAW,EAAE,EAAE,CAAC;IACzC,YAAO,GAAG,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;IACrC,sBAAiB,GAAG,KAAK,CAAC;IAM1B,YAAO,GAAG,KAAK,CAAC;IAuOhB,gBAAW,GAAG;MACpB,IAAI,CAAC,IAAI,CAAC,QAAQ;QAAE,OAAO;MAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CA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C9B,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,mBAAmB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,iBAClD,CAAC,IAAI,CAAC,IAAI,EACvB,IAAI,EACF,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,OAAO,GAAG,OAAO,GAAG,QAAQ,gBAG/D,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,OAAO,GAAG,SAAS,GAAG,MAAM,qBAEhD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,OAAO,GAAG,SAAS,IAE3D,IAAI,CAAC,WAAW,KACf,YACE,EAAE,EAAE,IAAI,CAAC,OAAO,EAChB,KAAK,EAAC,4BAA4B,eAEhC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,OAAO;UACtC,SAAS;UACT,QAAQ,IAGb,IAAI,CAAC,WAAW,CACZ,CACR,EACD,eAAQ,CACJ,CACF,CACF,EACN;GACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/dropdown/dropdown.scss?tag=nano-dropdown&encapsulation=shadow","./src/components/dropdown/dropdown.tsx"],"sourcesContent":["@import '../../global/style/utilities/globals';\n@import '../../global/style/nano-theme/layers';\n\n:host {\n /**\n * @prop --width: width of the dropdown. Defaults to 'auto'\n * @prop --border: Defaults to #{$layer-border-style}\n * @prop --border-radius: Defaults to #{$layer-bg-color};\n * @prop --background: Defaults to #{$layer-bg-color};\n * @prop --padding: padding of the drop down. Default to '10px 0';\n * @prop --overflow: `nano-menu` with nested `nav-item` requires hidden overflow. This can be overidden;\n * @prop --dropdown-z-index: Defaults to #{$layer-index-dropdown};\n * @prop --min-width: Defaults to 0;\n * @prop --box-shadow: #{$layer-shadow-large};\n * @prop --max-menu-height: max height of a slotted menu. defaults to 50vh\n */\n\n --width: auto;\n --border: #{$layer-border-style};\n --border-radius: #{$layer-border-radius};\n --background: #{$layer-bg-color};\n --padding: 10px 0;\n --overflow: auto;\n --dropdown-z-index: #{$layer-index-dropdown};\n --min-width: 0;\n --box-shadow: #{$layer-shadow-large};\n --menu-height: var(--max-menu-height, 50vh);\n\n display: flex;\n}\n\n.dropdown {\n position: relative;\n\n &__trigger {\n display: block;\n }\n\n &__positioner {\n position: absolute;\n z-index: var(--dropdown-z-index);\n min-inline-size: var(--min-width);\n\n @media (max-width: 35.9375em) {\n z-index: 100;\n }\n }\n\n &__panel {\n padding: var(--padding);\n background: var(--background);\n min-inline-size: var(--min-width);\n inline-size: var(--width);\n border: var(--border);\n border-radius: var(--border-radius);\n color: currentcolor;\n box-shadow: var(--box-shadow);\n opacity: 0;\n transition: 0.2s ease opacity, 0.2s ease transform, 0.2s ease min-block-size;\n min-block-size: 20px;\n overflow: var(--overflow);\n box-sizing: content-box !important;\n\n &.loading {\n overflow-y: hidden;\n }\n\n &.top {\n transform: translateY(-20px) translateZ(0);\n }\n\n &.bottom {\n transform: translateY(20px) translateZ(0);\n }\n\n .dropdown__positioner.popover-visible & {\n opacity: 1;\n transform: translateY(0) translateZ(0);\n }\n\n ::slotted(nano-menu) {\n max-block-size: var(--menu-height);\n }\n }\n\n &__accessible-title {\n @include visually-hide();\n }\n}\n","import {\n Component,\n Element,\n Event,\n Method,\n Prop,\n Watch,\n h,\n Listen,\n ComponentInterface,\n EventEmitter,\n} from '@stencil/core';\nimport { getActiveElement } from '../../utils/active-element';\nimport Popover, { PopoverPlacement } from '../../utils/popover';\nimport { getNearestTabbableElement } from '../../utils/tabbable';\nimport type { NavItemEventDetail } from '../../interface';\n\nlet dropDownIds = 0;\n\n/**\n * Dropdowns show additional content in a panel.\n * Designed to work well with nano-menu components to provide a list of options (`nano-nav-items` / `nano-option`).\n * @slot trigger - The dropdown's trigger.\n * @slot - The dropdown's content.\n */\n@Component({\n tag: 'nano-dropdown',\n styleUrl: 'dropdown.scss',\n shadow: true,\n})\nexport class Dropdown implements ComponentInterface {\n private dropdownId = `dropdown-${dropDownIds++}`;\n private labelId = this.dropdownId + '-title';\n private ignoreOpenWatcher = false;\n private panel: HTMLElement;\n private popover: Popover;\n private trigger: HTMLElement;\n private positioner: HTMLElement;\n private accessibleTrigger: HTMLElement;\n private didLoad = false;\n private get menu() {\n return this.host.querySelector('nano-menu') as HTMLNanoMenuElement;\n }\n\n @Element() host: HTMLNanoDropdownElement;\n\n /** Determines if the dropdown should open automatically when the trigger is clicked */\n @Prop() autoOpen = true;\n\n /** Indicates whether or not the dropdown is open. You can use this in lieu of the show/hide methods. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n @Watch('open')\n handleOpenChange() {\n if (this.ignoreOpenWatcher) return;\n\n this.open ? this.show() : this.hide();\n\n if (this.accessibleTrigger) {\n this.accessibleTrigger.setAttribute(\n 'aria-expanded',\n this.open.toString()\n );\n return;\n }\n\n this.updateAccessibleTrigger();\n }\n\n /**\n * Determines whether the dropdown should hide when a menu item is selected.\n */\n @Prop() closeOnSelect = true;\n\n /**\n * The dropdown will close when the user interacts outside of this element (e.g. clicking).\n */\n @Prop({ mutable: true }) containingElement: HTMLElement;\n\n /**\n * If you don't want to use the trigger slot, you can use this to 'tether' the dropdown to another element.\n * And you will still need to control when the component is opened (using show() / hide() or the `open` prop)\n */\n @Prop() tetherTo: HTMLElement = null;\n\n @Watch('tetherTo')\n handleTetherToChange() {\n this.createPopover();\n this.updateAccessibleTrigger();\n }\n\n /**\n * The preferred placement of the dropdown panel. Note that the actual placement may vary as needed to keep the panel\n * inside of the viewport.\n */\n @Prop() placement: PopoverPlacement = 'bottom-start';\n\n /**\n * The distance in pixels from which to offset the panel away from its trigger.\n */\n @Prop() distance = 2;\n\n /**\n * The distance in pixels from which to offset the panel along its trigger.\n */\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 @Watch('placement')\n @Watch('distance')\n @Watch('skidding')\n @Watch('hoist')\n handlePopoverOptionsChange() {\n if (!this.popover) return;\n\n this.popover.setOptions({\n strategy: this.hoist ? 'fixed' : 'absolute',\n placement: this.placement,\n skidding: this.skidding,\n distance: this.distance,\n });\n }\n\n /**\n * Title used to describe the dropdown content for accessibility\n */\n @Prop() dialogTitle!: string;\n\n // Events\n\n /**\n * Emitted when the dropdown opens. Calling `event.preventDefault()` will prevent it from being opened.\n */\n @Event() nanoShow: EventEmitter;\n\n /**\n * Emitted after the dropdown opens and all transitions are complete.\n */\n @Event() nanoAfterShow: EventEmitter;\n\n /**\n * Emitted when the dropdown closes. Calling `event.preventDefault()` will prevent it from being closed.\n */\n @Event() nanoHide: EventEmitter;\n\n /**\n * Emitted after the dropdown closes and all transitions are complete.\n */\n @Event() nanoAfterHide: EventEmitter;\n\n // this is a massive hack to make stencil expose the `EventEmitter` type in the final build\n // because the `Dropdown` class is used as a type in `nano-datalist`\n /** @internal */\n @Prop() eventType: EventEmitter;\n\n // Listeners\n\n @Listen('nanoOpen')\n secondaryOpen(ev: CustomEvent) {\n if (!(ev.detail as NavItemEventDetail).secondaryMenu) return;\n ev.stopPropagation();\n\n this.panel.classList.add('loading');\n this.panel.addEventListener(\n 'transitionend',\n () => {\n this.panel.classList.remove('loading');\n },\n { once: true }\n );\n\n this.panel.style.minHeight =\n (ev.detail as NavItemEventDetail).secondaryMenu.scrollHeight + 'px';\n }\n\n @Listen('nanoClose')\n secondaryClose(ev: CustomEvent) {\n if (!(ev.detail as NavItemEventDetail).secondaryMenu) return;\n ev.stopPropagation();\n if (!(ev.target as HTMLElement).parentElement) return;\n this.panel.style.minHeight =\n (ev.target as HTMLElement).parentElement.scrollHeight + 'px';\n }\n\n @Listen('nanoSelect')\n handlePanelSelect(event: CustomEvent) {\n const target = event.target as HTMLElement;\n\n // Hide the dropdown when a menu item is selected\n if (this.closeOnSelect && target.tagName.toLowerCase() === 'nano-menu')\n this.hide();\n }\n\n // Methods\n\n /** Shows the dropdown panel */\n @Method()\n async show() {\n this.ignoreOpenWatcher = true;\n this.open = true;\n\n const nanoShow = this.nanoShow.emit();\n\n if (nanoShow.defaultPrevented) {\n this.open = false;\n this.ignoreOpenWatcher = false;\n return;\n }\n\n this.popover.show();\n this.ignoreOpenWatcher = false;\n\n document.addEventListener('mousedown', this.handleDocumentMouseDown);\n document.addEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n /** Hides the dropdown panel */\n @Method()\n async hide() {\n this.ignoreOpenWatcher = true;\n this.open = false;\n\n const nanoHide = this.nanoHide.emit();\n\n if (nanoHide.defaultPrevented) {\n this.open = true;\n this.ignoreOpenWatcher = false;\n return;\n }\n\n if (this.popover) this.popover.hide();\n this.ignoreOpenWatcher = false;\n\n document.removeEventListener('mousedown', this.handleDocumentMouseDown);\n document.removeEventListener('keydown', this.handleDocumentKeyDown);\n\n if (this.accessibleTrigger && this.focusEleInDropDwn()) {\n this.accessibleTrigger.focus();\n }\n }\n\n // Private methods\n\n /**\n * Decides if the current active element or element\n * connected to the current event is connected to the Dropdown\n * @param e\n * @returns whether the current focus is within the dropdown\n */\n private focusEleInDropDwn(e?: Event) {\n const activeElement = getActiveElement();\n\n if (e && e.composedPath()?.length) {\n const ddInPath = e.composedPath().includes(this.containingElement);\n return !e.composedPath().includes(this.accessibleTrigger) && ddInPath;\n }\n\n return (\n activeElement &&\n activeElement.closest(this.containingElement.tagName.toLowerCase()) ===\n this.containingElement &&\n activeElement !== this.accessibleTrigger\n );\n }\n\n private togglePanel = () => {\n if (!this.autoOpen) return;\n this.open ? this.hide() : this.show();\n };\n\n // Slotted triggers can be arbitrary content, but we need to link them to the dropdown panel with `aria-haspopup` and\n // `aria-expanded`. These must be applied to the \"accessible trigger\" (the tabbable portion of the trigger element\n // that gets slotted in) so screen readers will understand them. The accessible trigger could be the slotted element,\n private updateAccessibleTrigger() {\n if (!this.didLoad) return;\n\n let accessibleTrigger: HTMLElement;\n this.accessibleTrigger = null;\n\n if (!this.tetherTo) {\n const assignedElements = Array.from(\n this.host.querySelectorAll('[slot=\"trigger\"]')\n );\n accessibleTrigger = assignedElements.map(getNearestTabbableElement)[0];\n } else {\n accessibleTrigger = getNearestTabbableElement(this.tetherTo);\n }\n\n if (accessibleTrigger) {\n accessibleTrigger.setAttribute('aria-haspopup', 'true');\n accessibleTrigger.setAttribute(\n 'aria-expanded',\n this.open ? 'true' : 'false'\n );\n this.accessibleTrigger = accessibleTrigger;\n }\n }\n\n // Handlers\n\n private handleDocumentKeyDown(event: KeyboardEvent) {\n // Close when escape is pressed\n if (event.key === 'Escape') {\n this.hide();\n return;\n }\n\n // Close when tabbing results in the focus leaving the close element\n if (event.key === 'Tab') {\n setTimeout(() => {\n if (\n document.activeElement &&\n document.activeElement.closest(\n this.containingElement.tagName.toLowerCase()\n ) !== this.containingElement\n ) {\n this.hide();\n return;\n }\n });\n }\n\n // If a menu is present, focus on it when certain keys are pressed\n if (this.menu && ['ArrowDown', 'ArrowUp'].includes(event.key)) {\n // must have menu item, must have pressed down, must be open and must not have focus within dd\n if (!this.open || this.focusEleInDropDwn(event)) return;\n event.preventDefault();\n this.menu.setFocus();\n return;\n }\n\n // All other keys focus the menu and pass the event through to menu (necessary for type-to-search to work)\n const ePath = event.composedPath();\n if (this.menu && ePath.length && !ePath.find((el) => el !== this.menu)) {\n this.menu.dispatchEvent(new KeyboardEvent(event.type, event));\n return;\n }\n }\n\n private handleDocumentMouseDown(event: MouseEvent) {\n // Close when clicking outside of the close element\n\n if (!this.focusEleInDropDwn(event)) {\n this.hide();\n return;\n }\n }\n\n private handleTriggerKeyDown = (event: KeyboardEvent) => {\n // Open the panel when pressing down or up while focused on the trigger\n if (['ArrowDown', 'ArrowUp', ' '].includes(event.key)) {\n this.show();\n event.preventDefault();\n event.stopPropagation();\n\n if (this.menu) this.menu.setFocus();\n }\n };\n\n private handleTriggerSlotChange = () => {\n this.updateAccessibleTrigger();\n };\n\n private createPopover() {\n if ((!this.tetherTo && !this.trigger) || !this.positioner) return;\n\n if (this.popover) {\n if (this.open) this.hide();\n this.popover.destroy();\n this.popover = null;\n }\n\n this.popover = new Popover(this.tetherTo || this.trigger, this.positioner, {\n strategy: this.hoist ? 'fixed' : 'absolute',\n placement: this.placement,\n distance: this.distance,\n skidding: this.skidding,\n transitionElement: this.panel,\n onAfterHide: () => this.nanoAfterHide.emit(),\n onAfterShow: () => this.nanoAfterShow.emit(),\n onTransitionEnd: () => {\n if (!this.open) {\n this.panel.scrollTop = 0;\n } else if (this.menu) {\n this.menu.showActiveElement();\n }\n },\n });\n // Show on init if open\n if (this.open) {\n this.show();\n }\n }\n\n // Stencil hooks\n\n connectedCallback() {\n this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);\n this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);\n\n if (!this.containingElement) this.containingElement = this.host;\n }\n\n componentDidLoad() {\n this.didLoad = true;\n this.createPopover();\n setTimeout(() => this.updateAccessibleTrigger(), 100);\n }\n\n disconnectedCallback() {\n if (this.host.isConnected) this.hide();\n if (this.popover) this.popover.destroy();\n }\n\n render() {\n return (\n <div\n part=\"base\"\n id={this.dropdownId}\n class={{\n dropdown: true,\n 'dropdown--open': this.open,\n }}\n >\n <span\n part=\"trigger\"\n class=\"dropdown__trigger\"\n ref={(el) => (this.trigger = el)}\n onKeyDown={this.handleTriggerKeyDown}\n onClick={this.togglePanel}\n >\n <slot name=\"trigger\" onSlotchange={this.handleTriggerSlotChange} />\n </span>\n\n <div ref={(el) => (this.positioner = el)} class=\"dropdown__positioner\">\n <div\n ref={(el) => (this.panel = el)}\n part=\"panel\"\n class={`dropdown__panel ${this.placement.split('-').join(' ')}`}\n aria-hidden={!this.open}\n role={\n this.host.getAttribute('role') === 'group' ? 'group' : 'dialog'\n }\n aria-modal={\n this.host.getAttribute('role') === 'group' ? undefined : 'true'\n }\n aria-labelledby={this.dialogTitle ? this.labelId : undefined}\n >\n {this.dialogTitle && (\n <span\n id={this.labelId}\n class=\"dropdown__accessible-title\"\n aria-live={\n this.host.getAttribute('role') === 'group'\n ? undefined\n : 'polite'\n }\n >\n {this.dialogTitle}\n </span>\n )}\n <slot />\n </div>\n </div>\n </div>\n );\n }\n}\n"],"version":3}
@@ -31,8 +31,7 @@ const renderLabel = ({ label, hasLabelSlot, controlId, labelId, floatLabel, plac
31
31
  };
32
32
  const FormControlWrap = (props, children) => {
33
33
  const { rtl, floatLabel, label, moreId, helperEndId, type, hasHelperSlot, showInlineError, errorMessage, hasHelperEndSlot, } = props;
34
- const MainTag = hasHelperEndSlot ? 'nano-resize-observe' : 'div';
35
- return (h(MainTag, { states: "350w has-enough-width", class: {
34
+ return (h("div", { class: {
36
35
  'has-label': label !== null && !floatLabel,
37
36
  'has-float-label': label !== null && floatLabel,
38
37
  'has-helper-end': hasHelperEndSlot,
@@ -1 +1 @@
1
- {"file":"form-control.js","mappings":";;;;;AAyCA,MAAM,WAAW,GAAG,CAAC,EACnB,KAAK,EACL,YAAY,EACZ,SAAS,EACT,OAAO,EACP,UAAU,EACV,WAAW,EACX,SAAS,EACT,QAAQ,EACR,GAAG,EACH,aAAa,EACb,SAAS,EACT,SAAS,GACE;EACX,IAAI,CAAC,KAAK,IAAI,CAAC,YAAY;IAAE,OAAO;EACpC,IAAI,UAAU,EAAE;IACd,QACE,aAAO,KAAK,EAAC,wBAAwB,EAAC,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO;MAClE,KAAK,IAAI,KAAK;MACd,CAAC,KAAK,IAAI,YAAY,IAAI,YAAM,IAAI,EAAC,OAAO,GAAG;MAC/C,aAAa,KACZ,YAAM,KAAK,EAAC,4BAA4B,IACrC,SAAS,GAAG,IAAI,SAAS,IAAI,SAAS,EAAE,GAAG,IAAI,SAAS,EAAE,CACtD,CACR,CACK,EACR;GACH;OAAM;IACL,QACE,aACE,KAAK,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,eAAe,EAAE,SAAS,EAAE,EAC/D,OAAO,EAAE,SAAS,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M,KAAK,EAAC,2BAA2B,EAAC,OAAO,EAAE,YAAY;MAC3D,YAAM,IAAI,EAAC,WAAW,GAAG;MACxB,YAAY,CACR;IACP,YAAM,KAAK,EAAC,qBAAqB;MAC/B,YAAM,IAAI,EAAC,KAAK,GAAG;MAClB,OAAO,CACH,CACH,EACN;AACJ;;;;","names":[],"sources":["./src/components/form-control/form-control.tsx"],"sourcesContent":["import { FunctionalComponent, h, VNode } from '@stencil/core';\nimport type { TextFieldTypes } from '../../interface';\n\ninterface FormControlWrapProps {\n rtl: boolean;\n floatLabel: boolean;\n labelId: string;\n label: string;\n moreId: string;\n helperEndId: string;\n type?: TextFieldTypes;\n showInlineError: boolean;\n hasHelperSlot: boolean;\n errorMessage: string;\n controlId: string;\n hasLabelSlot: boolean;\n hideLabel: boolean;\n placeholder: string;\n hasValue: boolean;\n showCharCount?: boolean;\n maxlength?: number;\n charCount?: number;\n hasHelperEndSlot?: boolean;\n}\n\ninterface FormControlProps {\n clearControl: boolean;\n onClearText?: () => void;\n readonly: boolean;\n disabled: boolean;\n control: HTMLNanoInputElement | HTMLNanoSelectElement;\n ref?: (elm?: HTMLElement) => void;\n endSlot?: VNode;\n endValueSlot?: VNode;\n startSlot?: VNode;\n}\n\ninterface LabelProps extends FormControlWrapProps {\n rtl: boolean;\n}\n\nconst renderLabel = ({\n label,\n hasLabelSlot,\n controlId,\n labelId,\n floatLabel,\n placeholder,\n hideLabel,\n hasValue,\n rtl,\n showCharCount,\n maxlength,\n charCount,\n}: LabelProps) => {\n if (!label && !hasLabelSlot) return;\n if (floatLabel) {\n return (\n <label class=\"form-ctrl__float-label\" htmlFor={controlId} id={labelId}>\n {label && label}\n {!label && hasLabelSlot && <slot name=\"label\" />}\n {showCharCount && (\n <span class=\"form-ctrl__label-charcount\">\n {maxlength ? ` ${charCount}/${maxlength}` : ` ${charCount}`}\n </span>\n )}\n </label>\n );\n } else {\n return (\n <label\n class={{ 'form-ctrl__label': true, 'visually-hide': hideLabel }}\n htmlFor={controlId}\n id={labelId}\n >\n <div class=\"form-ctrl__label-wrap\">\n {placeholder && hasValue && rtl && (\n <span class=\"form-ctrl__label-placeholder\">{placeholder} / </span>\n )}\n <span class=\"form-ctrl__labeltext\">\n {label && label}\n {!label && hasLabelSlot && <slot name=\"label\" />}\n </span>\n {placeholder && hasValue && !rtl && (\n <span class=\"form-ctrl__label-placeholder\"> / {placeholder}</span>\n )}\n </div>\n {showCharCount && (\n <span class=\"form-ctrl__label-charcount\">\n {maxlength\n ? maxlength - charCount + ' left'\n : charCount + ' characters'}\n </span>\n )}\n </label>\n );\n }\n};\n\nexport const FormControlWrap: FunctionalComponent<FormControlWrapProps> = (\n props: FormControlWrapProps,\n children\n) => {\n const {\n rtl,\n floatLabel,\n label,\n moreId,\n helperEndId,\n type,\n hasHelperSlot,\n showInlineError,\n errorMessage,\n hasHelperEndSlot,\n } = props;\n\n const MainTag = hasHelperEndSlot ? 'nano-resize-observe' : 'div';\n\n return (\n <MainTag\n states=\"350w has-enough-width\"\n class={{\n 'has-label': label !== null && !floatLabel,\n 'has-float-label': label !== null && floatLabel,\n 'has-helper-end': hasHelperEndSlot,\n rtl,\n 'form-ctrl': true,\n }}\n >\n <div class=\"form-ctrl__wrapper\">\n {!floatLabel ? renderLabel({ ...props }) : ''}\n <div\n class={{\n 'form-ctrl__input': true,\n 'form-ctrl__textarea': type === 'textarea',\n }}\n >\n {floatLabel && renderLabel({ ...props, rtl })}\n {children}\n </div>\n {showInlineError || hasHelperSlot ? (\n <div class=\"form-ctrl__more\" id={moreId}>\n {!!showInlineError ? (\n <div class=\"form-ctrl__error\" aria-live=\"polite\">\n {errorMessage}\n </div>\n ) : (\n ''\n )}\n <div class=\"form-ctrl__helper\">\n <slot name=\"helper\" />\n </div>\n </div>\n ) : (\n ''\n )}\n </div>\n {hasHelperEndSlot ? (\n <div class=\"form-ctrl__helper-end\" id={helperEndId}>\n <slot name=\"helper-end\" />\n </div>\n ) : (\n ''\n )}\n </MainTag>\n );\n};\n\nexport const FormControl: FunctionalComponent<FormControlProps> = (\n props: FormControlProps,\n children\n) => {\n const {\n clearControl,\n onClearText,\n readonly,\n disabled,\n control,\n ref,\n endSlot,\n endValueSlot,\n startSlot,\n } = props;\n const clickThrough = () => {\n control.setFocus();\n };\n\n return (\n <div\n class=\"form-ctrl__input-wrap\"\n ref={(el) => {\n if (ref) ref(el);\n }}\n >\n <span class=\"form-ctrl__slot-start\">\n <slot name=\"start\" />\n {startSlot}\n </span>\n {children}\n {clearControl && !readonly && !disabled && (\n <button\n type=\"button\"\n class=\"icon form-ctrl__clear-btn\"\n tabindex=\"-1\"\n onTouchStart={onClearText}\n onMouseDown={onClearText}\n >\n <nano-icon name=\"light/times\"></nano-icon>\n </button>\n )}\n <span class=\"form-ctrl__slot-value-end\" onClick={clickThrough}>\n <slot name=\"value-end\" />\n {endValueSlot}\n </span>\n <span class=\"form-ctrl__slot-end\">\n <slot name=\"end\" />\n {endSlot}\n </span>\n </div>\n );\n};\n"],"version":3}
1
+ {"file":"form-control.js","mappings":";;;;;AAyCA,MAAM,WAAW,GAAG,CAAC,EACnB,KAAK,EACL,YAAY,EACZ,SAAS,EACT,OAAO,EACP,UAAU,EACV,WAAW,EACX,SAAS,EACT,QAAQ,EACR,GAAG,EACH,aAAa,EACb,SAAS,EACT,SAAS,GACE;EACX,IAAI,CAAC,KAAK,IAAI,CAAC,YAAY;IAAE,OAAO;EACpC,IAAI,UAAU,EAAE;IACd,QACE,aAAO,KAAK,EAAC,wBAAwB,EAAC,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO;MAClE,KAAK,IAAI,KAAK;MACd,CAAC,KAAK,IAAI,YAAY,IAAI,YAAM,IAAI,EAAC,OAAO,GAAG;MAC/C,aAAa,KACZ,YAAM,KAAK,EAAC,4BAA4B,IACrC,SAAS,GAAG,IAAI,SAAS,IAAI,SAAS,EAAE,GAAG,IAAI,SAAS,EAAE,CACtD,CACR,CACK,EACR;GACH;OAAM;IACL,QACE,aACE,KA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2BAA2B,EAAC,OAAO,EAAE,YAAY;MAC3D,YAAM,IAAI,EAAC,WAAW,GAAG;MACxB,YAAY,CACR;IACP,YAAM,KAAK,EAAC,qBAAqB;MAC/B,YAAM,IAAI,EAAC,KAAK,GAAG;MAClB,OAAO,CACH,CACH,EACN;AACJ;;;;","names":[],"sources":["./src/components/form-control/form-control.tsx"],"sourcesContent":["import { FunctionalComponent, h, VNode } from '@stencil/core';\nimport type { TextFieldTypes } from '../../interface';\n\ninterface FormControlWrapProps {\n rtl: boolean;\n floatLabel: boolean;\n labelId: string;\n label: string;\n moreId: string;\n helperEndId: string;\n type?: TextFieldTypes;\n showInlineError: boolean;\n hasHelperSlot: boolean;\n errorMessage: string;\n controlId: string;\n hasLabelSlot: boolean;\n hideLabel: boolean;\n placeholder: string;\n hasValue: boolean;\n showCharCount?: boolean;\n maxlength?: number;\n charCount?: number;\n hasHelperEndSlot?: boolean;\n}\n\ninterface FormControlProps {\n clearControl: boolean;\n onClearText?: () => void;\n readonly: boolean;\n disabled: boolean;\n control: HTMLNanoInputElement | HTMLNanoSelectElement;\n ref?: (elm?: HTMLElement) => void;\n endSlot?: VNode;\n endValueSlot?: VNode;\n startSlot?: VNode;\n}\n\ninterface LabelProps extends FormControlWrapProps {\n rtl: boolean;\n}\n\nconst renderLabel = ({\n label,\n hasLabelSlot,\n controlId,\n labelId,\n floatLabel,\n placeholder,\n hideLabel,\n hasValue,\n rtl,\n showCharCount,\n maxlength,\n charCount,\n}: LabelProps) => {\n if (!label && !hasLabelSlot) return;\n if (floatLabel) {\n return (\n <label class=\"form-ctrl__float-label\" htmlFor={controlId} id={labelId}>\n {label && label}\n {!label && hasLabelSlot && <slot name=\"label\" />}\n {showCharCount && (\n <span class=\"form-ctrl__label-charcount\">\n {maxlength ? ` ${charCount}/${maxlength}` : ` ${charCount}`}\n </span>\n )}\n </label>\n );\n } else {\n return (\n <label\n class={{ 'form-ctrl__label': true, 'visually-hide': hideLabel }}\n htmlFor={controlId}\n id={labelId}\n >\n <div class=\"form-ctrl__label-wrap\">\n {placeholder && hasValue && rtl && (\n <span class=\"form-ctrl__label-placeholder\">{placeholder} / </span>\n )}\n <span class=\"form-ctrl__labeltext\">\n {label && label}\n {!label && hasLabelSlot && <slot name=\"label\" />}\n </span>\n {placeholder && hasValue && !rtl && (\n <span class=\"form-ctrl__label-placeholder\"> / {placeholder}</span>\n )}\n </div>\n {showCharCount && (\n <span class=\"form-ctrl__label-charcount\">\n {maxlength\n ? maxlength - charCount + ' left'\n : charCount + ' characters'}\n </span>\n )}\n </label>\n );\n }\n};\n\nexport const FormControlWrap: FunctionalComponent<FormControlWrapProps> = (\n props: FormControlWrapProps,\n children\n) => {\n const {\n rtl,\n floatLabel,\n label,\n moreId,\n helperEndId,\n type,\n hasHelperSlot,\n showInlineError,\n errorMessage,\n hasHelperEndSlot,\n } = props;\n\n return (\n <div\n class={{\n 'has-label': label !== null && !floatLabel,\n 'has-float-label': label !== null && floatLabel,\n 'has-helper-end': hasHelperEndSlot,\n rtl,\n 'form-ctrl': true,\n }}\n >\n <div class=\"form-ctrl__wrapper\">\n {!floatLabel ? renderLabel({ ...props }) : ''}\n <div\n class={{\n 'form-ctrl__input': true,\n 'form-ctrl__textarea': type === 'textarea',\n }}\n >\n {floatLabel && renderLabel({ ...props, rtl })}\n {children}\n </div>\n {showInlineError || hasHelperSlot ? (\n <div class=\"form-ctrl__more\" id={moreId}>\n {!!showInlineError ? (\n <div class=\"form-ctrl__error\" aria-live=\"polite\">\n {errorMessage}\n </div>\n ) : (\n ''\n )}\n <div class=\"form-ctrl__helper\">\n <slot name=\"helper\" />\n </div>\n </div>\n ) : (\n ''\n )}\n </div>\n {hasHelperEndSlot ? (\n <div class=\"form-ctrl__helper-end\" id={helperEndId}>\n <slot name=\"helper-end\" />\n </div>\n ) : (\n ''\n )}\n </div>\n );\n};\n\nexport const FormControl: FunctionalComponent<FormControlProps> = (\n props: FormControlProps,\n children\n) => {\n const {\n clearControl,\n onClearText,\n readonly,\n disabled,\n control,\n ref,\n endSlot,\n endValueSlot,\n startSlot,\n } = props;\n const clickThrough = () => {\n control.setFocus();\n };\n\n return (\n <div\n class=\"form-ctrl__input-wrap\"\n ref={(el) => {\n if (ref) ref(el);\n }}\n >\n <span class=\"form-ctrl__slot-start\">\n <slot name=\"start\" />\n {startSlot}\n </span>\n {children}\n {clearControl && !readonly && !disabled && (\n <button\n type=\"button\"\n class=\"icon form-ctrl__clear-btn\"\n tabindex=\"-1\"\n onTouchStart={onClearText}\n onMouseDown={onClearText}\n >\n <nano-icon name=\"light/times\"></nano-icon>\n </button>\n )}\n <span class=\"form-ctrl__slot-value-end\" onClick={clickThrough}>\n <slot name=\"value-end\" />\n {endValueSlot}\n </span>\n <span class=\"form-ctrl__slot-end\">\n <slot name=\"end\" />\n {endSlot}\n </span>\n </div>\n );\n};\n"],"version":3}