@nanoporetech-digital/components 2.2.0 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/cjs/loader.cjs.js +1 -1
  3. package/dist/cjs/nano-components.cjs.js +1 -1
  4. package/dist/cjs/nano-dropdown.cjs.entry.js +2 -1
  5. package/dist/cjs/nano-dropdown.cjs.entry.js.map +1 -1
  6. package/dist/cjs/nano-global-nav.cjs.entry.js +62 -33
  7. package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
  8. package/dist/cjs/nano-nav-item_2.cjs.entry.js +1 -1
  9. package/dist/cjs/nano-nav-item_2.cjs.entry.js.map +1 -1
  10. package/dist/cjs/nano-split-pane.cjs.entry.js +8 -14
  11. package/dist/cjs/nano-split-pane.cjs.entry.js.map +1 -1
  12. package/dist/cjs/nano-tooltip.cjs.entry.js +2 -1
  13. package/dist/cjs/nano-tooltip.cjs.entry.js.map +1 -1
  14. package/dist/cjs/{popover-55c687c2.js → popover-848d73ea.js} +4 -2
  15. package/dist/cjs/popover-848d73ea.js.map +1 -0
  16. package/dist/collection/components/accordion/accordion.js +1 -1
  17. package/dist/collection/components/alert/alert.js +1 -1
  18. package/dist/collection/components/algolia/algolia-filter.js +2 -2
  19. package/dist/collection/components/algolia/algolia-input.js +5 -5
  20. package/dist/collection/components/algolia/algolia-results.js +1 -1
  21. package/dist/collection/components/algolia/algolia.js +6 -6
  22. package/dist/collection/components/checkbox/checkbox-group.js +2 -2
  23. package/dist/collection/components/checkbox/checkbox.js +3 -3
  24. package/dist/collection/components/datalist/datalist.js +1 -1
  25. package/dist/collection/components/date-input/date-input.js +7 -7
  26. package/dist/collection/components/date-picker/date-picker.js +5 -5
  27. package/dist/collection/components/details/details.js +1 -1
  28. package/dist/collection/components/dialog/dialog.js +1 -1
  29. package/dist/collection/components/file-upload/file-upload.js +4 -4
  30. package/dist/collection/components/global-nav/global-nav.css +11 -6
  31. package/dist/collection/components/global-nav/global-nav.js +67 -38
  32. package/dist/collection/components/global-nav/global-nav.js.map +1 -1
  33. package/dist/collection/components/grid/grid-item.js +1 -1
  34. package/dist/collection/components/icon/icon.js +1 -1
  35. package/dist/collection/components/input/input.js +5 -5
  36. package/dist/collection/components/nav-item/nav-item.css +4 -1
  37. package/dist/collection/components/nav-item/nav-item.js +4 -4
  38. package/dist/collection/components/range/range.js +4 -4
  39. package/dist/collection/components/resize-observe/resize-observe.js +1 -1
  40. package/dist/collection/components/select/select.js +7 -7
  41. package/dist/collection/components/slides/slides.js +7 -7
  42. package/dist/collection/components/split-pane/split-pane.js +22 -37
  43. package/dist/collection/components/split-pane/split-pane.js.map +1 -1
  44. package/dist/collection/components/tabs/tab-group.js +2 -2
  45. package/dist/collection/utils/popover.js +2 -1
  46. package/dist/collection/utils/popover.js.map +1 -1
  47. package/dist/components/nano-global-nav.js +62 -33
  48. package/dist/components/nano-global-nav.js.map +1 -1
  49. package/dist/components/nano-split-pane.js +9 -16
  50. package/dist/components/nano-split-pane.js.map +1 -1
  51. package/dist/components/nav-item.js +1 -1
  52. package/dist/components/nav-item.js.map +1 -1
  53. package/dist/components/popover.js +3 -1
  54. package/dist/components/popover.js.map +1 -1
  55. package/dist/custom-elements/index.js +73 -50
  56. package/dist/custom-elements/index.js.map +1 -1
  57. package/dist/esm/loader.js +1 -1
  58. package/dist/esm/nano-components.js +1 -1
  59. package/dist/esm/nano-dropdown.entry.js +2 -1
  60. package/dist/esm/nano-dropdown.entry.js.map +1 -1
  61. package/dist/esm/nano-global-nav.entry.js +62 -33
  62. package/dist/esm/nano-global-nav.entry.js.map +1 -1
  63. package/dist/esm/nano-nav-item_2.entry.js +1 -1
  64. package/dist/esm/nano-nav-item_2.entry.js.map +1 -1
  65. package/dist/esm/nano-split-pane.entry.js +8 -14
  66. package/dist/esm/nano-split-pane.entry.js.map +1 -1
  67. package/dist/esm/nano-tooltip.entry.js +2 -1
  68. package/dist/esm/nano-tooltip.entry.js.map +1 -1
  69. package/dist/esm/{popover-d9dc8e13.js → popover-46b5193d.js} +4 -2
  70. package/dist/{nano-components/p-3c3e9fec.system.js.map → esm/popover-46b5193d.js.map} +1 -1
  71. package/dist/esm-es5/loader.js +1 -1
  72. package/dist/esm-es5/loader.js.map +1 -1
  73. package/dist/esm-es5/nano-components.js +1 -1
  74. package/dist/esm-es5/nano-components.js.map +1 -1
  75. package/dist/esm-es5/nano-dropdown.entry.js +1 -1
  76. package/dist/esm-es5/nano-dropdown.entry.js.map +1 -1
  77. package/dist/esm-es5/nano-global-nav.entry.js +1 -1
  78. package/dist/esm-es5/nano-global-nav.entry.js.map +1 -1
  79. package/dist/esm-es5/nano-nav-item_2.entry.js +1 -1
  80. package/dist/esm-es5/nano-nav-item_2.entry.js.map +1 -1
  81. package/dist/esm-es5/nano-split-pane.entry.js +1 -1
  82. package/dist/esm-es5/nano-split-pane.entry.js.map +1 -1
  83. package/dist/esm-es5/nano-tooltip.entry.js +1 -1
  84. package/dist/esm-es5/nano-tooltip.entry.js.map +1 -1
  85. package/dist/esm-es5/popover-46b5193d.js +5 -0
  86. package/dist/esm-es5/popover-46b5193d.js.map +1 -0
  87. package/dist/nano-components/nano-components.esm.js +1 -1
  88. package/dist/nano-components/nano-components.esm.js.map +1 -1
  89. package/dist/nano-components/p-094ab6f8.entry.js +5 -0
  90. package/dist/nano-components/{p-a0515a0f.entry.js.map → p-094ab6f8.entry.js.map} +1 -1
  91. package/dist/nano-components/p-096682d9.system.js +1 -1
  92. package/dist/nano-components/p-096682d9.system.js.map +1 -1
  93. package/dist/nano-components/p-12f70017.system.entry.js +5 -0
  94. package/dist/nano-components/p-12f70017.system.entry.js.map +1 -0
  95. package/dist/nano-components/p-4b7cd30c.js +5 -0
  96. package/dist/nano-components/p-4b7cd30c.js.map +1 -0
  97. package/dist/nano-components/p-6dd58c39.entry.js +5 -0
  98. package/dist/nano-components/p-6dd58c39.entry.js.map +1 -0
  99. package/dist/nano-components/p-8b3ee91b.system.entry.js +5 -0
  100. package/dist/nano-components/{p-ca466250.system.entry.js.map → p-8b3ee91b.system.entry.js.map} +1 -1
  101. package/dist/nano-components/p-8de6e276.entry.js +5 -0
  102. package/dist/nano-components/p-8de6e276.entry.js.map +1 -0
  103. package/dist/nano-components/p-9ca5e023.system.entry.js +5 -0
  104. package/dist/nano-components/p-9ca5e023.system.entry.js.map +1 -0
  105. package/dist/nano-components/p-d35d468b.system.js +5 -0
  106. package/dist/{cjs/popover-55c687c2.js.map → nano-components/p-d35d468b.system.js.map} +1 -1
  107. package/dist/nano-components/p-d9f2dda5.entry.js +5 -0
  108. package/dist/nano-components/p-d9f2dda5.entry.js.map +1 -0
  109. package/dist/nano-components/p-e01adaa3.entry.js +5 -0
  110. package/dist/nano-components/{p-17bf76c4.entry.js.map → p-e01adaa3.entry.js.map} +1 -1
  111. package/dist/nano-components/p-f9e30f31.system.entry.js +5 -0
  112. package/dist/nano-components/p-f9e30f31.system.entry.js.map +1 -0
  113. package/dist/nano-components/p-fd1a86d2.system.entry.js +5 -0
  114. package/dist/nano-components/{p-7fcbc27f.system.entry.js.map → p-fd1a86d2.system.entry.js.map} +1 -1
  115. package/dist/types/components/global-nav/global-nav.d.ts +1 -0
  116. package/dist/types/components/split-pane/split-pane.d.ts +2 -4
  117. package/dist/types/components.d.ts +2 -6
  118. package/docs-json.json +10 -25
  119. package/docs-vscode.json +0 -4
  120. package/package.json +2 -2
  121. package/dist/esm/popover-d9dc8e13.js.map +0 -1
  122. package/dist/esm-es5/popover-d9dc8e13.js +0 -5
  123. package/dist/esm-es5/popover-d9dc8e13.js.map +0 -1
  124. package/dist/nano-components/p-17bf76c4.entry.js +0 -5
  125. package/dist/nano-components/p-1ec44caf.entry.js +0 -5
  126. package/dist/nano-components/p-1ec44caf.entry.js.map +0 -1
  127. package/dist/nano-components/p-3c3e9fec.system.js +0 -5
  128. package/dist/nano-components/p-58419bed.system.entry.js +0 -5
  129. package/dist/nano-components/p-58419bed.system.entry.js.map +0 -1
  130. package/dist/nano-components/p-625d3733.js +0 -5
  131. package/dist/nano-components/p-625d3733.js.map +0 -1
  132. package/dist/nano-components/p-7fcbc27f.system.entry.js +0 -5
  133. package/dist/nano-components/p-a0515a0f.entry.js +0 -5
  134. package/dist/nano-components/p-b19e0775.system.entry.js +0 -5
  135. package/dist/nano-components/p-b19e0775.system.entry.js.map +0 -1
  136. package/dist/nano-components/p-c954c040.entry.js +0 -5
  137. package/dist/nano-components/p-c954c040.entry.js.map +0 -1
  138. package/dist/nano-components/p-ca466250.system.entry.js +0 -5
  139. package/dist/nano-components/p-d628547b.entry.js +0 -5
  140. package/dist/nano-components/p-d628547b.entry.js.map +0 -1
  141. package/dist/nano-components/p-d87ebf95.system.entry.js +0 -5
  142. package/dist/nano-components/p-d87ebf95.system.entry.js.map +0 -1
@@ -423,7 +423,7 @@ export class Input {
423
423
  "references": {
424
424
  "Color": {
425
425
  "location": "import",
426
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
426
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
427
427
  }
428
428
  }
429
429
  },
@@ -994,7 +994,7 @@ export class Input {
994
994
  "references": {
995
995
  "TextFieldTypes": {
996
996
  "location": "import",
997
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
997
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
998
998
  }
999
999
  }
1000
1000
  },
@@ -1153,7 +1153,7 @@ export class Input {
1153
1153
  "references": {
1154
1154
  "InputChangeEventDetail": {
1155
1155
  "location": "import",
1156
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
1156
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
1157
1157
  }
1158
1158
  }
1159
1159
  }
@@ -1242,7 +1242,7 @@ export class Input {
1242
1242
  "references": {
1243
1243
  "ControlValidityEventDetail": {
1244
1244
  "location": "import",
1245
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
1245
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
1246
1246
  }
1247
1247
  }
1248
1248
  }
@@ -1264,7 +1264,7 @@ export class Input {
1264
1264
  },
1265
1265
  "ControlValidity": {
1266
1266
  "location": "import",
1267
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
1267
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
1268
1268
  }
1269
1269
  },
1270
1270
  "return": "Promise<ControlValidity>"
@@ -25,6 +25,7 @@
25
25
  :host button {
26
26
  background: none;
27
27
  border: none;
28
+ margin: 0;
28
29
  }
29
30
  :host ::slotted(button),
30
31
  :host ::slotted(a),
@@ -445,6 +446,7 @@
445
446
  -ms-flex-align: center;
446
447
  align-items: center;
447
448
  cursor: pointer;
449
+ font-stretch: expanded;
448
450
  }
449
451
  :host(.nano-global-nav-bar) .text {
450
452
  -webkit-box-flex: 1;
@@ -494,12 +496,13 @@
494
496
 
495
497
  :host(.nano-global-nav-bar.has-secondary) button {
496
498
  position: relative;
499
+ font-stretch: expanded;
497
500
  }
498
501
  :host(.nano-global-nav-bar.has-secondary) button::before {
499
502
  content: "";
500
503
  background: #86bee2;
501
504
  height: 3px;
502
- left: 5px;
505
+ left: 0;
503
506
  bottom: -14px;
504
507
  right: 5px;
505
508
  position: absolute;
@@ -488,7 +488,7 @@ export class NavItem {
488
488
  "references": {
489
489
  "NavItemEventDetail": {
490
490
  "location": "import",
491
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
491
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
492
492
  }
493
493
  }
494
494
  }
@@ -508,7 +508,7 @@ export class NavItem {
508
508
  "references": {
509
509
  "NavItemEventDetail": {
510
510
  "location": "import",
511
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
511
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
512
512
  }
513
513
  }
514
514
  }
@@ -528,7 +528,7 @@ export class NavItem {
528
528
  "references": {
529
529
  "NavItemEventDetail": {
530
530
  "location": "import",
531
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
531
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
532
532
  }
533
533
  }
534
534
  }
@@ -548,7 +548,7 @@ export class NavItem {
548
548
  "references": {
549
549
  "NavItemEventDetail": {
550
550
  "location": "import",
551
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
551
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
552
552
  }
553
553
  }
554
554
  }
@@ -370,7 +370,7 @@ export class Range {
370
370
  "references": {
371
371
  "Color": {
372
372
  "location": "import",
373
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
373
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
374
374
  }
375
375
  }
376
376
  },
@@ -594,7 +594,7 @@ export class Range {
594
594
  "references": {
595
595
  "RangeValue": {
596
596
  "location": "import",
597
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
597
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
598
598
  }
599
599
  }
600
600
  },
@@ -632,7 +632,7 @@ export class Range {
632
632
  "references": {
633
633
  "RangeChangeEventDetail": {
634
634
  "location": "import",
635
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
635
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
636
636
  }
637
637
  }
638
638
  }
@@ -655,7 +655,7 @@ export class Range {
655
655
  "references": {
656
656
  "StyleEventDetail": {
657
657
  "location": "import",
658
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
658
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
659
659
  }
660
660
  }
661
661
  }
@@ -176,7 +176,7 @@ export class ResizeObserve {
176
176
  "references": {
177
177
  "ResizeStateChangeEventDetail": {
178
178
  "location": "import",
179
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
179
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
180
180
  }
181
181
  }
182
182
  }
@@ -624,7 +624,7 @@ export class Select {
624
624
  "references": {
625
625
  "Color": {
626
626
  "location": "import",
627
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
627
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
628
628
  }
629
629
  }
630
630
  },
@@ -1005,7 +1005,7 @@ export class Select {
1005
1005
  },
1006
1006
  "OptionInterface": {
1007
1007
  "location": "import",
1008
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/components/option/option-interface.ts"
1008
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/components/option/option-interface.ts"
1009
1009
  }
1010
1010
  }
1011
1011
  },
@@ -1090,7 +1090,7 @@ export class Select {
1090
1090
  },
1091
1091
  "Dropdown": {
1092
1092
  "location": "import",
1093
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/components/dropdown/dropdown.tsx"
1093
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/components/dropdown/dropdown.tsx"
1094
1094
  }
1095
1095
  }
1096
1096
  },
@@ -1131,7 +1131,7 @@ export class Select {
1131
1131
  "references": {
1132
1132
  "SelectChangeEventDetail": {
1133
1133
  "location": "import",
1134
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
1134
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
1135
1135
  }
1136
1136
  }
1137
1137
  }
@@ -1217,7 +1217,7 @@ export class Select {
1217
1217
  "references": {
1218
1218
  "InputChangeEventDetail": {
1219
1219
  "location": "import",
1220
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
1220
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
1221
1221
  }
1222
1222
  }
1223
1223
  }
@@ -1240,7 +1240,7 @@ export class Select {
1240
1240
  "references": {
1241
1241
  "ControlValidityEventDetail": {
1242
1242
  "location": "import",
1243
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
1243
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
1244
1244
  }
1245
1245
  }
1246
1246
  }
@@ -1262,7 +1262,7 @@ export class Select {
1262
1262
  },
1263
1263
  "ControlValidity": {
1264
1264
  "location": "import",
1265
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
1265
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
1266
1266
  }
1267
1267
  },
1268
1268
  "return": "Promise<ControlValidity>"
@@ -453,7 +453,7 @@ export class Slides {
453
453
  "references": {
454
454
  "FlickityOptions": {
455
455
  "location": "import",
456
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
456
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
457
457
  }
458
458
  }
459
459
  },
@@ -556,7 +556,7 @@ export class Slides {
556
556
  "references": {
557
557
  "SlideAnimation": {
558
558
  "location": "import",
559
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
559
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
560
560
  }
561
561
  }
562
562
  },
@@ -747,7 +747,7 @@ export class Slides {
747
747
  "references": {
748
748
  "DragEvent": {
749
749
  "location": "import",
750
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
750
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
751
751
  }
752
752
  }
753
753
  }
@@ -767,7 +767,7 @@ export class Slides {
767
767
  "references": {
768
768
  "DragEvent": {
769
769
  "location": "import",
770
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
770
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
771
771
  }
772
772
  }
773
773
  }
@@ -787,7 +787,7 @@ export class Slides {
787
787
  "references": {
788
788
  "DragEvent": {
789
789
  "location": "import",
790
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
790
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
791
791
  }
792
792
  }
793
793
  }
@@ -807,7 +807,7 @@ export class Slides {
807
807
  "references": {
808
808
  "DragEvent": {
809
809
  "location": "import",
810
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
810
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
811
811
  }
812
812
  }
813
813
  }
@@ -1114,7 +1114,7 @@ export class Slides {
1114
1114
  },
1115
1115
  "Flickity": {
1116
1116
  "location": "import",
1117
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
1117
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
1118
1118
  }
1119
1119
  },
1120
1120
  "return": "Promise<Flickity>"
@@ -29,10 +29,6 @@ export class SplitPane {
29
29
  this.snapThreshold = 12;
30
30
  /** When changing `position` via property, the pane will animate into position. Make `animationDuration` 0 to disable. */
31
31
  this.animationDuration = 0.6;
32
- this._isDragging = false;
33
- this.handleIsDragging = (dragging) => {
34
- this._isDragging = dragging;
35
- };
36
32
  // Event handlers
37
33
  this.handleDrag = (e) => {
38
34
  if (this.disabled) {
@@ -41,8 +37,8 @@ export class SplitPane {
41
37
  // Prevent text selection when dragging
42
38
  e.preventDefault();
43
39
  drag(this.host, (x, y) => {
44
- this.handleIsDragging(true);
45
40
  let newPositionInPixels = this.vertical ? y : x;
41
+ this.nanoDragging.emit(newPositionInPixels);
46
42
  // Flip for end panels
47
43
  if (this.primary === 'end') {
48
44
  newPositionInPixels = this.size - newPositionInPixels;
@@ -67,7 +63,6 @@ export class SplitPane {
67
63
  this.shouldAnimate = false;
68
64
  this.position = clamp(this.pixelsToPercentage(newPositionInPixels), 0, 100);
69
65
  raf(() => (this.shouldAnimate = true));
70
- this.handleIsDragging(false);
71
66
  });
72
67
  };
73
68
  this.handleKeyDown = (event) => {
@@ -115,7 +110,6 @@ export class SplitPane {
115
110
  }
116
111
  };
117
112
  this.handlePositionChange = debounce(this.handlePositionChange.bind(this), 100);
118
- this.handleIsDragging = debounce(this.handleIsDragging, 200);
119
113
  }
120
114
  get size() {
121
115
  const { width, height } = this.host.getBoundingClientRect();
@@ -139,7 +133,9 @@ export class SplitPane {
139
133
  pos = Math.min(Math.max(pos, 0), 100);
140
134
  if (isNaN(pos) || pos === this._position)
141
135
  return;
142
- if (this.shouldAnimate && this.animationDuration > 0) {
136
+ if (this.shouldAnimate &&
137
+ this.animationDuration > 0 &&
138
+ !isNaN(this.position)) {
143
139
  this.animatePosition(pos);
144
140
  return;
145
141
  }
@@ -154,10 +150,6 @@ export class SplitPane {
154
150
  handlePositionInPixelsChange() {
155
151
  this.position = this.pixelsToPercentage(this.positionInPixels);
156
152
  }
157
- /** @readonly - hook to know if the pane is currently being dragged */
158
- get isDragging() {
159
- return this._isDragging;
160
- }
161
153
  // Private logic
162
154
  animatePosition(end) {
163
155
  if (this.isAnimating)
@@ -225,12 +217,13 @@ export class SplitPane {
225
217
  // if we set a default position in the class, this causes the divider to jump (from default to user set position)
226
218
  // so - wait a render, see if there's a position passed in via attribute, *then* set default if not
227
219
  raf(() => {
228
- if (this.position === undefined)
220
+ if (typeof this.position === 'undefined') {
229
221
  this.position = 50;
222
+ }
230
223
  });
231
224
  }
232
225
  render() {
233
- if (!this.position)
226
+ if (typeof this.position === 'undefined')
234
227
  return;
235
228
  const styles = {};
236
229
  const gridTemplate = this.vertical
@@ -426,29 +419,6 @@ export class SplitPane {
426
419
  "attribute": "animation-duration",
427
420
  "reflect": false,
428
421
  "defaultValue": "0.6"
429
- },
430
- "isDragging": {
431
- "type": "boolean",
432
- "mutable": false,
433
- "complexType": {
434
- "original": "boolean",
435
- "resolved": "boolean",
436
- "references": {}
437
- },
438
- "required": false,
439
- "optional": false,
440
- "docs": {
441
- "tags": [{
442
- "name": "readonly",
443
- "text": "- hook to know if the pane is currently being dragged"
444
- }],
445
- "text": ""
446
- },
447
- "getter": true,
448
- "setter": false,
449
- "attribute": "is-dragging",
450
- "reflect": true,
451
- "defaultValue": "false"
452
422
  }
453
423
  }; }
454
424
  static get events() { return [{
@@ -466,6 +436,21 @@ export class SplitPane {
466
436
  "resolved": "any",
467
437
  "references": {}
468
438
  }
439
+ }, {
440
+ "method": "nanoDragging",
441
+ "name": "nanoDragging",
442
+ "bubbles": true,
443
+ "cancelable": true,
444
+ "composed": true,
445
+ "docs": {
446
+ "tags": [],
447
+ "text": "Emitted when the divider is being dragged."
448
+ },
449
+ "complexType": {
450
+ "original": "number",
451
+ "resolved": "number",
452
+ "references": {}
453
+ }
469
454
  }]; }
470
455
  static get elementRef() { return "host"; }
471
456
  static get watchers() { return [{
@@ -1 +1 @@
1
- {"version":3,"file":"split-pane.js","sourceRoot":"","sources":["../../../src/components/split-pane/split-pane.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,SAAS,EACT,KAAK,EACL,KAAK,EAGL,OAAO,EACP,IAAI,EACJ,CAAC,GACF,MAAM,eAAe,CAAC;AACvB,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component,\n Watch,\n Event,\n EventEmitter,\n ComponentInterface,\n Element,\n Host,\n h,\n} from '@stencil/core';\nimport { clamp, raf, debounce } from '../../utils';\nimport { drag } from '../../utils/drag';\n\n/**\n * Split panes display two adjacent panels, allowing the user to reposition them.\n *\n * @part start - The start panel.\n * @part end - The end panel.\n * @part panel - Targets both the start and end panels.\n * @part divider - The divider that separates the start and end panels.\n *\n * @slot start - The start panel.\n * @slot end - The end panel.\n * @slot handle - An optional handle to render at the center of the divider.\n */\n@Component({\n tag: 'nano-split-pane',\n styleUrl: 'split-pane.scss',\n shadow: true,\n})\nexport class SplitPane implements ComponentInterface {\n @Element() host: HTMLNanoSplitPaneElement;\n private cachedPositionInPixels: number;\n private ro: ResizeObserver;\n private isAnimating = false;\n private didLoad = false;\n\n private get size() {\n const { width, height } = this.host.getBoundingClientRect();\n return this.vertical ? height : width;\n }\n\n private get shouldAnimate() {\n return this.didLoad && this._shouldAnimate;\n }\n private set shouldAnimate(sa: boolean) {\n this._shouldAnimate = sa;\n }\n private _shouldAnimate: boolean = true;\n\n constructor() {\n this.handlePositionChange = debounce(\n this.handlePositionChange.bind(this),\n 100\n );\n this.handleIsDragging = debounce(this.handleIsDragging, 200);\n }\n\n /**\n * The current position of the divider from the primary panel's edge as a percentage 0-100. Defaults to 50% of the\n * container's initial size.\n */\n @Prop()\n get position() {\n return this._position;\n }\n set position(pos: number) {\n // override too high / low\n pos = Math.min(Math.max(pos, 0), 100);\n if (isNaN(pos) || pos === this._position) return;\n\n if (this.shouldAnimate && this.animationDuration > 0) {\n this.animatePosition(pos);\n return;\n }\n this._position = pos;\n }\n private _position: number;\n\n // eslint-disable-next-line @stencil/no-unused-watch\n @Watch('position')\n handlePositionChange() {\n this.cachedPositionInPixels = this.percentageToPixels(this.position);\n this.positionInPixels = this.percentageToPixels(this.position);\n this.nanoReposition.emit();\n }\n\n /**\n * The current position of the divider from the primary panel's edge in pixels.\n */\n @Prop({ mutable: true }) positionInPixels: number;\n\n @Watch('positionInPixels')\n handlePositionInPixelsChange() {\n this.position = this.pixelsToPercentage(this.positionInPixels);\n }\n\n /** Draws the split panel in a vertical orientation with the start and end panels stacked. */\n @Prop({ reflect: true }) vertical = false;\n\n /** Disables resizing. Note that the position may still change as a result of resizing the host element. */\n @Prop({ reflect: true }) disabled = false;\n\n /**\n * If no primary panel is designated, both panels will resize proportionally when the host element is resized. If a\n * primary panel is designated, it will maintain its size and the other panel will grow or shrink as needed when the\n * host element is resized.\n */\n @Prop() primary?: 'start' | 'end';\n\n /**\n * One or more space-separated values at which the divider should snap. Values can be in pixels or percentages, e.g.\n * `\"100px 50%\"`.\n */\n @Prop() snap?: string;\n\n /** How close the divider must be to a snap point until snapping occurs. */\n @Prop() snapThreshold = 12;\n\n /** When changing `position` via property, the pane will animate into position. Make `animationDuration` 0 to disable. */\n @Prop() animationDuration = 0.6;\n\n /** @readonly - hook to know if the pane is currently being dragged */\n @Prop({ reflect: true }) get isDragging() {\n return this._isDragging;\n }\n private _isDragging = false;\n\n /** Emitted when the divider's position changes. */\n @Event() nanoReposition: EventEmitter;\n\n // Private logic\n\n private animatePosition(end: number) {\n if (this.isAnimating) return;\n\n const duration = this.animationDuration; // seconds\n const fps = 60;\n const start = this.position;\n const distance = end - start;\n\n let position = start;\n let time = 0;\n\n function easeInOutQuad(t: number, s: number, e: number, d: number) {\n if ((t /= d / 2) < 1) return (e / 2) * t * t + s;\n else return (-e / 2) * (--t * (t - 2) - 1) + s;\n }\n\n const go = () => {\n time += 1 / fps;\n position = easeInOutQuad(time, start, distance, duration);\n\n if (\n (end > start && position >= end) ||\n (end < start && position <= end)\n ) {\n this.position = end;\n this.shouldAnimate = true;\n this.isAnimating = false;\n return;\n }\n this.position = position;\n raf(go);\n };\n\n this.shouldAnimate = false;\n this.isAnimating = true;\n raf(go);\n }\n\n private percentageToPixels(value: number) {\n return this.size * (value / 100);\n }\n\n private pixelsToPercentage(value: number) {\n return (value / this.size) * 100;\n }\n\n private attachRO() {\n this.detachRO();\n this.ro = new ResizeObserver(() => this.handleResize());\n this.ro.observe(this.host);\n }\n\n private detachRO() {\n if (!this.ro) return;\n this.ro.unobserve(this.host);\n this.ro = undefined;\n }\n\n private handleIsDragging = (dragging?: boolean) => {\n this._isDragging = dragging;\n };\n\n // Event handlers\n\n private handleDrag = (e: Event) => {\n if (this.disabled) {\n return;\n }\n\n // Prevent text selection when dragging\n e.preventDefault();\n\n drag(this.host, (x, y) => {\n this.handleIsDragging(true);\n let newPositionInPixels = this.vertical ? y : x;\n\n // Flip for end panels\n if (this.primary === 'end') {\n newPositionInPixels = this.size - newPositionInPixels;\n }\n\n // Check snap points\n if (this.snap) {\n const snaps = this.snap.split(' ');\n\n snaps.forEach((value) => {\n let snapPoint: number;\n\n if (value.endsWith('%')) {\n snapPoint = this.size * (parseFloat(value) / 100);\n } else {\n snapPoint = parseFloat(value);\n }\n\n if (\n newPositionInPixels >= snapPoint - this.snapThreshold &&\n newPositionInPixels <= snapPoint + this.snapThreshold\n ) {\n newPositionInPixels = snapPoint;\n }\n });\n }\n this.shouldAnimate = false;\n this.position = clamp(\n this.pixelsToPercentage(newPositionInPixels),\n 0,\n 100\n );\n raf(() => (this.shouldAnimate = true));\n this.handleIsDragging(false);\n });\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (this.disabled) {\n return;\n }\n\n if (\n [\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n 'Home',\n 'End',\n ].includes(event.key)\n ) {\n let newPosition = this.position;\n const incr =\n (event.shiftKey ? 10 : 1) * (this.primary === 'end' ? -1 : 1);\n\n event.preventDefault();\n\n if (\n (event.key === 'ArrowLeft' && !this.vertical) ||\n (event.key === 'ArrowUp' && this.vertical)\n ) {\n newPosition -= incr;\n }\n\n if (\n (event.key === 'ArrowRight' && !this.vertical) ||\n (event.key === 'ArrowDown' && this.vertical)\n ) {\n newPosition += incr;\n }\n\n if (event.key === 'Home') {\n newPosition = this.primary === 'end' ? 100 : 0;\n }\n\n if (event.key === 'End') {\n newPosition = this.primary === 'end' ? 0 : 100;\n }\n\n this.shouldAnimate = false;\n\n this.position = clamp(newPosition, 0, 100);\n raf(() => (this.shouldAnimate = true));\n }\n };\n\n private handleResize = () => {\n if (!this.didLoad || this.isAnimating) return;\n\n // Resize when a primary panel is set\n if (this.primary) {\n this.shouldAnimate = false;\n this.position = this.pixelsToPercentage(this.cachedPositionInPixels);\n raf(() => (this.shouldAnimate = true));\n }\n };\n\n componentDidLoad(): void {\n if (this.positionInPixels) this.handlePositionInPixelsChange();\n setTimeout(() => (this.didLoad = true));\n }\n\n connectedCallback() {\n this.cachedPositionInPixels = this.percentageToPixels(this.position);\n this.attachRO();\n }\n\n disconnectedCallback() {\n this.detachRO();\n }\n\n componentDidRender(): void {\n // bit hacky ... because we use getter / setter for position, there's a render *before* `position` is passed in via attribute\n // if we set a default position in the class, this causes the divider to jump (from default to user set position)\n // so - wait a render, see if there's a position passed in via attribute, *then* set default if not\n raf(() => {\n if (this.position === undefined) this.position = 50;\n });\n }\n\n render() {\n if (!this.position) return;\n const styles: { gridTemplateRows?: string; gridTemplateColumns?: string } =\n {};\n const gridTemplate = this.vertical\n ? 'gridTemplateRows'\n : 'gridTemplateColumns';\n const primary = `\n clamp(\n 0%,\n clamp(\n var(--min),\n ${this.position}% - var(--divider-width) / 2,\n var(--max)\n ),\n calc(100% - var(--divider-width))\n )\n `;\n const secondary = 'auto';\n\n if (this.primary === 'end') {\n styles[gridTemplate] = `${secondary} var(--divider-width) ${primary}`;\n } else {\n styles[gridTemplate] = `${primary} var(--divider-width) ${secondary}`;\n }\n\n return (\n <Host style={styles}>\n <div part=\"panel start\" class=\"start\">\n <slot name=\"start\"></slot>\n </div>\n <div\n part=\"divider\"\n class=\"divider\"\n tabindex={this.disabled ? undefined : '0'}\n role=\"separator\"\n aria-label=\"Resize\"\n onKeyDown={this.handleKeyDown}\n onMouseDown={this.handleDrag}\n onTouchStart={this.handleDrag}\n >\n <slot name=\"handle\">\n {!this.disabled && this.vertical ? (\n <nano-icon slot=\"handle\" name=\"solid/grip-lines\" />\n ) : (\n <nano-icon slot=\"handle\" name=\"solid/grip-lines-vertical\" />\n )}\n </slot>\n </div>\n <div part=\"panel end\" class=\"end\">\n <slot name=\"end\"></slot>\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"split-pane.js","sourceRoot":"","sources":["../../../src/components/split-pane/split-pane.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,SAAS,EACT,KAAK,EACL,KAAK,EAGL,OAAO,EACP,IAAI,EACJ,CAAC,GACF,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;;;;;;;;;GAWG;AAMH,MAAM,OAAO,SAAS;EAoBpB;IAhBQ,gBAAW,GAAG,KAAK,CAAC;IACpB,YAAO,GAAG,KAAK,CAAC;IAahB,mBAAc,GAAY,IAAI,CAAC;IAoDvC,6FAA6F;IACpE,aAAQ,GAAG,KAAK,CAAC;IAE1C,2GAA2G;IAClF,aAAQ,GAAG,KAAK,CAAC;IAe1C,2EAA2E;IACnE,kBAAa,GAAG,EAAE,CAAC;IAE3B,yHAAyH;IACjH,sBAAiB,GAAG,GAAG,CAAC;IAoEhC,iBAAiB;IAET,eAAU,GAAG,CAAC,CAAQ,EAAE,EAAE;MAChC,IAAI,IAAI,CAAC,QAAQ,EAAE;QACjB,OAAO;OACR;MAED,uCAAuC;MACvC,CAAC,CAAC,cAAc,EAAE,CAAC;MAEnB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACvB,IAAI,mBAAmB,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEhD,IAAI,CAAC,YAAY,CAAC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Prop,\n Component,\n Watch,\n Event,\n EventEmitter,\n ComponentInterface,\n Element,\n Host,\n h,\n} from '@stencil/core';\nimport { clamp, raf, debounce } from '../../utils';\nimport { drag } from '../../utils/drag';\n\n/**\n * Split panes display two adjacent panels, allowing the user to reposition them.\n *\n * @part start - The start panel.\n * @part end - The end panel.\n * @part panel - Targets both the start and end panels.\n * @part divider - The divider that separates the start and end panels.\n *\n * @slot start - The start panel.\n * @slot end - The end panel.\n * @slot handle - An optional handle to render at the center of the divider.\n */\n@Component({\n tag: 'nano-split-pane',\n styleUrl: 'split-pane.scss',\n shadow: true,\n})\nexport class SplitPane implements ComponentInterface {\n @Element() host: HTMLNanoSplitPaneElement;\n private cachedPositionInPixels: number;\n private ro: ResizeObserver;\n private isAnimating = false;\n private didLoad = false;\n\n private get size() {\n const { width, height } = this.host.getBoundingClientRect();\n return this.vertical ? height : width;\n }\n\n private get shouldAnimate() {\n return this.didLoad && this._shouldAnimate;\n }\n private set shouldAnimate(sa: boolean) {\n this._shouldAnimate = sa;\n }\n private _shouldAnimate: boolean = true;\n\n constructor() {\n this.handlePositionChange = debounce(\n this.handlePositionChange.bind(this),\n 100\n );\n }\n\n /**\n * The current position of the divider from the primary panel's edge as a percentage 0-100. Defaults to 50% of the\n * container's initial size.\n */\n @Prop()\n get position() {\n return this._position;\n }\n set position(pos: number) {\n // override too high / low\n pos = Math.min(Math.max(pos, 0), 100);\n if (isNaN(pos) || pos === this._position) return;\n\n if (\n this.shouldAnimate &&\n this.animationDuration > 0 &&\n !isNaN(this.position)\n ) {\n this.animatePosition(pos);\n return;\n }\n this._position = pos;\n }\n private _position: number;\n\n // eslint-disable-next-line @stencil/no-unused-watch\n @Watch('position')\n handlePositionChange() {\n this.cachedPositionInPixels = this.percentageToPixels(this.position);\n this.positionInPixels = this.percentageToPixels(this.position);\n this.nanoReposition.emit();\n }\n\n /**\n * The current position of the divider from the primary panel's edge in pixels.\n */\n @Prop({ mutable: true }) positionInPixels: number;\n\n @Watch('positionInPixels')\n handlePositionInPixelsChange() {\n this.position = this.pixelsToPercentage(this.positionInPixels);\n }\n\n /** Draws the split panel in a vertical orientation with the start and end panels stacked. */\n @Prop({ reflect: true }) vertical = false;\n\n /** Disables resizing. Note that the position may still change as a result of resizing the host element. */\n @Prop({ reflect: true }) disabled = false;\n\n /**\n * If no primary panel is designated, both panels will resize proportionally when the host element is resized. If a\n * primary panel is designated, it will maintain its size and the other panel will grow or shrink as needed when the\n * host element is resized.\n */\n @Prop() primary?: 'start' | 'end';\n\n /**\n * One or more space-separated values at which the divider should snap. Values can be in pixels or percentages, e.g.\n * `\"100px 50%\"`.\n */\n @Prop() snap?: string;\n\n /** How close the divider must be to a snap point until snapping occurs. */\n @Prop() snapThreshold = 12;\n\n /** When changing `position` via property, the pane will animate into position. Make `animationDuration` 0 to disable. */\n @Prop() animationDuration = 0.6;\n\n /** Emitted when the divider's position changes. */\n @Event() nanoReposition: EventEmitter;\n\n /** Emitted when the divider is being dragged. */\n @Event() nanoDragging: EventEmitter<number>;\n\n // Private logic\n\n private animatePosition(end: number) {\n if (this.isAnimating) return;\n\n const duration = this.animationDuration; // seconds\n const fps = 60;\n const start = this.position;\n const distance = end - start;\n\n let position = start;\n let time = 0;\n\n function easeInOutQuad(t: number, s: number, e: number, d: number) {\n if ((t /= d / 2) < 1) return (e / 2) * t * t + s;\n else return (-e / 2) * (--t * (t - 2) - 1) + s;\n }\n\n const go = () => {\n time += 1 / fps;\n position = easeInOutQuad(time, start, distance, duration);\n\n if (\n (end > start && position >= end) ||\n (end < start && position <= end)\n ) {\n this.position = end;\n this.shouldAnimate = true;\n this.isAnimating = false;\n return;\n }\n this.position = position;\n raf(go);\n };\n\n this.shouldAnimate = false;\n this.isAnimating = true;\n raf(go);\n }\n\n private percentageToPixels(value: number) {\n return this.size * (value / 100);\n }\n\n private pixelsToPercentage(value: number) {\n return (value / this.size) * 100;\n }\n\n private attachRO() {\n this.detachRO();\n this.ro = new ResizeObserver(() => this.handleResize());\n this.ro.observe(this.host);\n }\n\n private detachRO() {\n if (!this.ro) return;\n this.ro.unobserve(this.host);\n this.ro = undefined;\n }\n\n // Event handlers\n\n private handleDrag = (e: Event) => {\n if (this.disabled) {\n return;\n }\n\n // Prevent text selection when dragging\n e.preventDefault();\n\n drag(this.host, (x, y) => {\n let newPositionInPixels = this.vertical ? y : x;\n\n this.nanoDragging.emit(newPositionInPixels);\n\n // Flip for end panels\n if (this.primary === 'end') {\n newPositionInPixels = this.size - newPositionInPixels;\n }\n\n // Check snap points\n if (this.snap) {\n const snaps = this.snap.split(' ');\n\n snaps.forEach((value) => {\n let snapPoint: number;\n\n if (value.endsWith('%')) {\n snapPoint = this.size * (parseFloat(value) / 100);\n } else {\n snapPoint = parseFloat(value);\n }\n\n if (\n newPositionInPixels >= snapPoint - this.snapThreshold &&\n newPositionInPixels <= snapPoint + this.snapThreshold\n ) {\n newPositionInPixels = snapPoint;\n }\n });\n }\n this.shouldAnimate = false;\n this.position = clamp(\n this.pixelsToPercentage(newPositionInPixels),\n 0,\n 100\n );\n raf(() => (this.shouldAnimate = true));\n });\n };\n\n private handleKeyDown = (event: KeyboardEvent) => {\n if (this.disabled) {\n return;\n }\n\n if (\n [\n 'ArrowLeft',\n 'ArrowRight',\n 'ArrowUp',\n 'ArrowDown',\n 'Home',\n 'End',\n ].includes(event.key)\n ) {\n let newPosition = this.position;\n const incr =\n (event.shiftKey ? 10 : 1) * (this.primary === 'end' ? -1 : 1);\n\n event.preventDefault();\n\n if (\n (event.key === 'ArrowLeft' && !this.vertical) ||\n (event.key === 'ArrowUp' && this.vertical)\n ) {\n newPosition -= incr;\n }\n\n if (\n (event.key === 'ArrowRight' && !this.vertical) ||\n (event.key === 'ArrowDown' && this.vertical)\n ) {\n newPosition += incr;\n }\n\n if (event.key === 'Home') {\n newPosition = this.primary === 'end' ? 100 : 0;\n }\n\n if (event.key === 'End') {\n newPosition = this.primary === 'end' ? 0 : 100;\n }\n\n this.shouldAnimate = false;\n\n this.position = clamp(newPosition, 0, 100);\n raf(() => (this.shouldAnimate = true));\n }\n };\n\n private handleResize = () => {\n if (!this.didLoad || this.isAnimating) return;\n\n // Resize when a primary panel is set\n if (this.primary) {\n this.shouldAnimate = false;\n this.position = this.pixelsToPercentage(this.cachedPositionInPixels);\n raf(() => (this.shouldAnimate = true));\n }\n };\n\n componentDidLoad(): void {\n if (this.positionInPixels) this.handlePositionInPixelsChange();\n setTimeout(() => (this.didLoad = true));\n }\n\n connectedCallback() {\n this.cachedPositionInPixels = this.percentageToPixels(this.position);\n this.attachRO();\n }\n\n disconnectedCallback() {\n this.detachRO();\n }\n\n componentDidRender(): void {\n // bit hacky ... because we use getter / setter for position, there's a render *before* `position` is passed in via attribute\n // if we set a default position in the class, this causes the divider to jump (from default to user set position)\n // so - wait a render, see if there's a position passed in via attribute, *then* set default if not\n raf(() => {\n if (typeof this.position === 'undefined') {\n this.position = 50;\n }\n });\n }\n\n render() {\n if (typeof this.position === 'undefined') return;\n const styles: { gridTemplateRows?: string; gridTemplateColumns?: string } =\n {};\n const gridTemplate = this.vertical\n ? 'gridTemplateRows'\n : 'gridTemplateColumns';\n const primary = `\n clamp(\n 0%,\n clamp(\n var(--min),\n ${this.position}% - var(--divider-width) / 2,\n var(--max)\n ),\n calc(100% - var(--divider-width))\n )\n `;\n const secondary = 'auto';\n\n if (this.primary === 'end') {\n styles[gridTemplate] = `${secondary} var(--divider-width) ${primary}`;\n } else {\n styles[gridTemplate] = `${primary} var(--divider-width) ${secondary}`;\n }\n\n return (\n <Host style={styles}>\n <div part=\"panel start\" class=\"start\">\n <slot name=\"start\"></slot>\n </div>\n <div\n part=\"divider\"\n class=\"divider\"\n tabindex={this.disabled ? undefined : '0'}\n role=\"separator\"\n aria-label=\"Resize\"\n onKeyDown={this.handleKeyDown}\n onMouseDown={this.handleDrag}\n onTouchStart={this.handleDrag}\n >\n <slot name=\"handle\">\n {!this.disabled && this.vertical ? (\n <nano-icon slot=\"handle\" name=\"solid/grip-lines\" />\n ) : (\n <nano-icon slot=\"handle\" name=\"solid/grip-lines-vertical\" />\n )}\n </slot>\n </div>\n <div part=\"panel end\" class=\"end\">\n <slot name=\"end\"></slot>\n </div>\n </Host>\n );\n }\n}\n"]}
@@ -502,7 +502,7 @@ export class TabGroup {
502
502
  "references": {
503
503
  "Color": {
504
504
  "location": "import",
505
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/interface.d.ts"
505
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/interface.d.ts"
506
506
  }
507
507
  }
508
508
  },
@@ -545,7 +545,7 @@ export class TabGroup {
545
545
  "references": {
546
546
  "StorageMethods": {
547
547
  "location": "import",
548
- "path": "/builds/zfg2rJd-/0/Digital/nano-components/packages/components/src/utils/store/component-store.ts"
548
+ "path": "/builds/ebUaUX1h/0/Digital/nano-components/packages/components/src/utils/store/component-store.ts"
549
549
  }
550
550
  }
551
551
  },
@@ -18,6 +18,7 @@
18
18
  // undesired effect when the element is shown and when its placement changes.
19
19
  //
20
20
  import { createPopper } from '@popperjs/core';
21
+ import { raf } from './index';
21
22
  export default class Popover {
22
23
  constructor(anchor, popover, options) {
23
24
  this.handleTransitionEnd = this.handleTransitionEnd.bind(this);
@@ -65,7 +66,7 @@ export default class Popover {
65
66
  this.isVisible = true;
66
67
  this.popover.hidden = false;
67
68
  this.popover.clientWidth; // force reflow
68
- requestAnimationFrame(() => this.popover.classList.add(this.options.visibleClass));
69
+ raf(() => this.popover.classList.add(this.options.visibleClass));
69
70
  if (this.popper) {
70
71
  this.popper.destroy();
71
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"popover.js","sourceRoot":"","sources":["../../src/utils/popover.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,wGAAwG;AACxG,EAAE;AACF,wBAAwB;AACxB,EAAE;AACF,QAAQ;AAC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AAO,CAAC,CAAC;IACpD,IAAI,CAAC,SAAS;MACZ,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC;MACvD,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IAE7D,wBAAwB;IACxB,IAAI,IAAI,CAAC,MAAM,EAAE;MACf,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;QACrB,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS;QACjC,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ;OAChC,CAAC,CAAC;MAEH,qBAAqB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;KACnD;EACH,CAAC;CACF","sourcesContent":["//\n// A positioning utility for popovers that handles show/hide/transitionEnd events with simple callbacks.\n//\n// Powered by Popper.js.\n//\n// NOTE:\n//\n// - The popover MUST have at least one property that transitions, otherwise transitionEnd won't fire and the popover\n// won't be hidden. If transitions are delegated to a child element, set the `transitionElement` property accordingly.\n//\n// - When the popover is shown, it's assigned `PopoverOptions.visibleClass`. You can use this class to provide different\n// transitions for show/hide.\n//\n// - Popper uses `translate3d` to position elements, so adding a transition to the `transform` property may have an\n// undesired effect when the element is shown and when its placement changes.\n//\nimport { Instance as PopperInstance, createPopper } from '@popperjs/core';\n\nexport default class Popover {\n anchor: HTMLElement;\n isVisible: boolean;\n popover: HTMLElement;\n popper: PopperInstance;\n options: PopoverOptions;\n\n constructor(\n anchor: HTMLElement,\n popover: HTMLElement,\n options?: PopoverOptions\n ) {\n this.handleTransitionEnd = this.handleTransitionEnd.bind(this);\n\n this.anchor = anchor;\n this.popover = popover;\n this.options = Object.assign(\n {\n skidding: 0,\n distance: 0,\n placement: 'bottom-start',\n strategy: 'absolute',\n transitionElement: this.popover,\n visibleClass: 'popover-visible',\n onAfterShow: () => {},\n onAfterHide: () => {},\n onTransitionEnd: () => {},\n },\n options\n );\n\n // this.isVisible = false;\n this.popover.hidden = true;\n this.popover.classList.remove(this.options.visibleClass);\n\n this.popover.addEventListener('transitionend', this.handleTransitionEnd);\n }\n\n private handleTransitionEnd(event: TransitionEvent) {\n const target = event.target as HTMLElement;\n\n // Make sure the transition event originates from from the correct element, and not one that has bubbled up\n if (target === this.options.transitionElement) {\n // This is called before the element is hidden so users can do things like reset scroll. It will fire once for\n // every transition property. Use `event.propertyName` to determine which property has finished transitioning.\n this.options.onTransitionEnd.call(this, event);\n\n // Make sure we only do this once, since transitionend will fire for every transition\n if (this.isVisible === false && !this.popover.hidden) {\n this.popover.hidden = true;\n this.popover.classList.remove(this.options.visibleClass);\n this.options.onAfterHide.call(this);\n }\n }\n }\n\n destroy() {\n this.popover.removeEventListener('transitionend', this.handleTransitionEnd);\n if (this.popper) {\n this.popper.destroy();\n this.popper = null;\n }\n }\n\n show() {\n this.isVisible = true;\n this.popover.hidden = false;\n this.popover.clientWidth; // force reflow\n\n requestAnimationFrame(() =>\n this.popover.classList.add(this.options.visibleClass)\n );\n\n if (this.popper) {\n this.popper.destroy();\n }\n\n this.popper = createPopper(this.anchor, this.popover, {\n placement: this.options.placement,\n strategy: this.options.strategy,\n modifiers: [\n {\n name: 'sameWidth',\n enabled: true,\n fn: ({ state }) => {\n state.styles.popper.minWidth = `${state.rects.reference.width}px`;\n },\n phase: 'beforeWrite',\n requires: ['computeStyles'],\n },\n {\n name: 'flip',\n options: {\n boundary: 'viewport',\n },\n },\n {\n name: 'offset',\n options: {\n padding: 5,\n offset: [this.options.skidding, this.options.distance],\n },\n },\n ],\n });\n\n this.popover.addEventListener(\n 'transitionend',\n () => this.options.onAfterShow.call(this),\n { once: true }\n );\n\n // Reposition the menu after it appears in case a modifier kicked in\n requestAnimationFrame(() => this.popper.update());\n }\n\n hide() {\n // Apply the hidden styles and wait for the transition before hiding completely\n this.isVisible = false;\n this.popover.classList.remove(this.options.visibleClass);\n }\n\n setOptions(options: PopoverOptions) {\n this.options = Object.assign(this.options, options);\n this.isVisible\n ? this.popover.classList.add(this.options.visibleClass)\n : this.popover.classList.remove(this.options.visibleClass);\n\n // Update popper options\n if (this.popper) {\n this.popper.setOptions({\n placement: this.options.placement,\n strategy: this.options.strategy,\n });\n\n requestAnimationFrame(() => this.popper.update());\n }\n }\n}\n\ninterface PopoverOptions {\n distance?: number;\n placement?:\n | 'auto'\n | 'auto-start'\n | 'auto-end'\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'left'\n | 'left-start'\n | 'left-end';\n skidding?: number;\n strategy?: 'absolute' | 'fixed';\n transitionElement?: HTMLElement;\n visibleClass?: string;\n onAfterShow?: () => any;\n onAfterHide?: () => any;\n onTransitionEnd?: (event: TransitionEvent) => any;\n}\n"]}
1
+ {"version":3,"file":"popover.js","sourceRoot":"","sources":["../../src/utils/popover.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,wGAAwG;AACxG,EAAE;AACF,wBAAwB;AACxB,EAAE;AACF,QAAQ;AACR,EAAE;AACF,qHAAqH;AACrH,wHAAwH;AACxH,EAAE;AACF,wHAAwH;AACxH,+BAA+B;AAC/B,EAAE;AACF,mHAAmH;AACnH,+EAA+E;AAC/E,EAAE;AACF,OAAO,EAA8B,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC1E,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAE9B,MAAM,CAAC,OAAO,OAAO,OAAO;EAO1B,YACE,MAAmB,EACnB,OAAoB,EACpB,OAAwB;IAExB,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE/D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACrB,IAAI,CAAC,OAAO,GAAG,OAAO,C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,QAAQ;OAChC,CAAC,CAAC;MAEH,qBAAqB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;KACnD;EACH,CAAC;CACF","sourcesContent":["//\n// A positioning utility for popovers that handles show/hide/transitionEnd events with simple callbacks.\n//\n// Powered by Popper.js.\n//\n// NOTE:\n//\n// - The popover MUST have at least one property that transitions, otherwise transitionEnd won't fire and the popover\n// won't be hidden. If transitions are delegated to a child element, set the `transitionElement` property accordingly.\n//\n// - When the popover is shown, it's assigned `PopoverOptions.visibleClass`. You can use this class to provide different\n// transitions for show/hide.\n//\n// - Popper uses `translate3d` to position elements, so adding a transition to the `transform` property may have an\n// undesired effect when the element is shown and when its placement changes.\n//\nimport { Instance as PopperInstance, createPopper } from '@popperjs/core';\nimport { raf } from './index';\n\nexport default class Popover {\n anchor: HTMLElement;\n isVisible: boolean;\n popover: HTMLElement;\n popper: PopperInstance;\n options: PopoverOptions;\n\n constructor(\n anchor: HTMLElement,\n popover: HTMLElement,\n options?: PopoverOptions\n ) {\n this.handleTransitionEnd = this.handleTransitionEnd.bind(this);\n\n this.anchor = anchor;\n this.popover = popover;\n this.options = Object.assign(\n {\n skidding: 0,\n distance: 0,\n placement: 'bottom-start',\n strategy: 'absolute',\n transitionElement: this.popover,\n visibleClass: 'popover-visible',\n onAfterShow: () => {},\n onAfterHide: () => {},\n onTransitionEnd: () => {},\n },\n options\n );\n\n // this.isVisible = false;\n this.popover.hidden = true;\n this.popover.classList.remove(this.options.visibleClass);\n\n this.popover.addEventListener('transitionend', this.handleTransitionEnd);\n }\n\n private handleTransitionEnd(event: TransitionEvent) {\n const target = event.target as HTMLElement;\n\n // Make sure the transition event originates from from the correct element, and not one that has bubbled up\n if (target === this.options.transitionElement) {\n // This is called before the element is hidden so users can do things like reset scroll. It will fire once for\n // every transition property. Use `event.propertyName` to determine which property has finished transitioning.\n this.options.onTransitionEnd.call(this, event);\n\n // Make sure we only do this once, since transitionend will fire for every transition\n if (this.isVisible === false && !this.popover.hidden) {\n this.popover.hidden = true;\n this.popover.classList.remove(this.options.visibleClass);\n this.options.onAfterHide.call(this);\n }\n }\n }\n\n destroy() {\n this.popover.removeEventListener('transitionend', this.handleTransitionEnd);\n if (this.popper) {\n this.popper.destroy();\n this.popper = null;\n }\n }\n\n show() {\n this.isVisible = true;\n this.popover.hidden = false;\n this.popover.clientWidth; // force reflow\n\n raf(() => this.popover.classList.add(this.options.visibleClass));\n\n if (this.popper) {\n this.popper.destroy();\n }\n\n this.popper = createPopper(this.anchor, this.popover, {\n placement: this.options.placement,\n strategy: this.options.strategy,\n modifiers: [\n {\n name: 'sameWidth',\n enabled: true,\n fn: ({ state }) => {\n state.styles.popper.minWidth = `${state.rects.reference.width}px`;\n },\n phase: 'beforeWrite',\n requires: ['computeStyles'],\n },\n {\n name: 'flip',\n options: {\n boundary: 'viewport',\n },\n },\n {\n name: 'offset',\n options: {\n padding: 5,\n offset: [this.options.skidding, this.options.distance],\n },\n },\n ],\n });\n\n this.popover.addEventListener(\n 'transitionend',\n () => this.options.onAfterShow.call(this),\n { once: true }\n );\n\n // Reposition the menu after it appears in case a modifier kicked in\n requestAnimationFrame(() => this.popper.update());\n }\n\n hide() {\n // Apply the hidden styles and wait for the transition before hiding completely\n this.isVisible = false;\n this.popover.classList.remove(this.options.visibleClass);\n }\n\n setOptions(options: PopoverOptions) {\n this.options = Object.assign(this.options, options);\n this.isVisible\n ? this.popover.classList.add(this.options.visibleClass)\n : this.popover.classList.remove(this.options.visibleClass);\n\n // Update popper options\n if (this.popper) {\n this.popper.setOptions({\n placement: this.options.placement,\n strategy: this.options.strategy,\n });\n\n requestAnimationFrame(() => this.popper.update());\n }\n }\n}\n\ninterface PopoverOptions {\n distance?: number;\n placement?:\n | 'auto'\n | 'auto-start'\n | 'auto-end'\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'left'\n | 'left-start'\n | 'left-end';\n skidding?: number;\n strategy?: 'absolute' | 'fixed';\n transitionElement?: HTMLElement;\n visibleClass?: string;\n onAfterShow?: () => any;\n onAfterHide?: () => any;\n onTransitionEnd?: (event: TransitionEvent) => any;\n}\n"]}