@thinkpixellab-public/px-vue 3.0.26 → 3.0.28

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.
@@ -230,7 +230,7 @@ export default {
230
230
 
231
231
  return {
232
232
  // prettier-ignore
233
- gridTemplateColumns: `repeat(${colCount}, 1fr)`,
233
+ gridTemplateColumns: `repeat(${colCount}, minmax(0, ${1 / colCount}fr))`,
234
234
  maxWidth: this.cssPx(maxGridWidth),
235
235
  '--gap': this.cssPx(this.gap),
236
236
  '--aspect': defAspect,
@@ -487,8 +487,10 @@ export default {
487
487
  justify-content: stretch;
488
488
  position: relative;
489
489
  flex: 1;
490
+ grid-template-columns: 100%;
491
+ grid-template-rows: auto;
490
492
  > * {
491
- @include abs();
493
+ width: 100%;
492
494
  }
493
495
  }
494
496
 
@@ -66,7 +66,7 @@
66
66
  import PxBaseVariants from './PxBaseVariants.vue';
67
67
  import PxPortal from './PxPortal.vue';
68
68
 
69
- import { computePosition, autoUpdate, flip, shift, offset } from '@floating-ui/dom';
69
+ import { computePosition, autoUpdate, flip, shift, offset, size } from '@floating-ui/dom';
70
70
  import { disableBodyScroll, clearAllBodyScrollLocks } from 'body-scroll-lock';
71
71
 
72
72
  const FOCUS_ELEMENTS = [
@@ -171,6 +171,10 @@ export default {
171
171
  // like flip but for the start/end direction
172
172
  shift: { default: true },
173
173
 
174
+ // uses the size middleware to keep the float on screen, resizing when necessary
175
+ sizeToView: { default: false },
176
+ sizeToViewPadding: { type: Number, default: 10 },
177
+
174
178
  // NOT IMPLEMENTED
175
179
  // hiddenClass: { type: String, default: null },
176
180
 
@@ -461,6 +465,18 @@ export default {
461
465
  middleware.push(flip(this.flip));
462
466
  }
463
467
 
468
+ let maxHeight = null;
469
+ if (this.sizeToView) {
470
+ let padding = this.sizeToViewPadding || 0;
471
+ middleware.push(
472
+ size({
473
+ apply({ availableHeight }) {
474
+ maxHeight = availableHeight - padding;
475
+ },
476
+ })
477
+ );
478
+ }
479
+
464
480
  if (this.placement && this.$refs.popup && reference) {
465
481
  computePosition(reference, this.$refs.popup, {
466
482
  placement: this.placement,
@@ -470,11 +486,13 @@ export default {
470
486
  if (this.useTranslate) {
471
487
  this.positionCss = {
472
488
  transform: `translate(${this.cssPx(x)},${this.cssPx(y)})`,
489
+ maxHeight: this.cssPx(maxHeight),
473
490
  };
474
491
  } else {
475
492
  this.positionCss = {
476
493
  left: this.cssPx(x),
477
494
  top: this.cssPx(y),
495
+ maxHeight: this.cssPx(maxHeight),
478
496
  };
479
497
  }
480
498
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkpixellab-public/px-vue",
3
- "version": "3.0.26",
3
+ "version": "3.0.28",
4
4
  "description": "General purpose Vue components and helpers that can be used across projects.",
5
5
  "author": "Pixel Lab",
6
6
  "license": "MIT",
@@ -1,8 +1,15 @@
1
1
  export default val => {
2
2
  if (!process.server) {
3
- var div = document.createElement('div');
3
+ val = val.replace(/<\/p>/g, '</p> ');
4
+ val = val.replace(/<\/li>/g, '</li> ');
5
+ val = val.replace(/<\/div>/g, '</div> ');
6
+
7
+ let div = document.createElement('div');
4
8
  div.innerHTML = val;
5
- var text = div.textContent || div.innerText || '';
9
+
10
+ let text = div.innerText || '';
11
+ text = text.replace(/(\n)+/g, ' ');
12
+
6
13
  return text;
7
14
  } else {
8
15
  return '';