@eturnity/eturnity_reusable_components 9.28.3-EXP-11.0 → 9.28.3-EXP-11.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eturnity/eturnity_reusable_components",
3
- "version": "9.28.3-EXP-11.0",
3
+ "version": "9.28.3-EXP-11.2",
4
4
  "files": [
5
5
  "dist",
6
6
  "src"
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path transform="translate(1.04 1.5)" d="M13.3232 0C13.7327 4.6248e-05 14.022 0.401551 13.8926 0.790039L9.95896 12.5898C9.87726 12.8348 9.64784 13 9.38963 13H0.600565C0.191116 12.9999 -0.0982598 12.5984 0.0312292 12.21L3.96482 0.410156L4.00193 0.322266C4.10404 0.126506 4.30821 3.58696e-05 4.53416 0H13.3232ZM2.15623 9L1.15623 12H3.10154L4.10154 9H2.15623ZM5.15623 9L4.15623 12H6.10154L7.10154 9H5.15623ZM8.15623 9L7.15623 12H9.10154L10.1015 9H8.15623ZM2.48924 8H4.43455L5.43455 5H3.48924L2.48924 8ZM5.48924 8H7.43455L8.43455 5H6.48924L5.48924 8ZM8.48924 8H10.4345L11.4345 5H9.48924L8.48924 8ZM3.82224 4H5.76756L6.76756 1H4.82224L3.82224 4ZM6.82224 4H8.76756L9.76756 1H7.82224L6.82224 4ZM9.82224 4H11.7676L12.7676 1H10.8222L9.82224 4Z" fill="white"/>
3
+ </svg>
@@ -244,6 +244,18 @@
244
244
  default: '400px',
245
245
  type: String,
246
246
  },
247
+ // Floor for the measured popup width; lower it (e.g. '0') for short
248
+ // tooltip-style content.
249
+ minWidth: {
250
+ default: '230px',
251
+ type: String,
252
+ },
253
+ // Padding of the popup box; tighten (e.g. '6px 10px') for
254
+ // tooltip-style content.
255
+ contentPadding: {
256
+ default: '',
257
+ type: String,
258
+ },
247
259
  openTrigger: {
248
260
  type: String,
249
261
  default: 'onHover',
@@ -494,6 +506,7 @@
494
506
  width: '100%',
495
507
  maxWidth: props.maxWidth,
496
508
  overflowY: 'auto',
509
+ ...(props.contentPadding ? { padding: props.contentPadding } : {}),
497
510
  backgroundColor: props.contentBackgroundColor
498
511
  ? props.contentBackgroundColor
499
512
  : props.image
@@ -566,13 +579,21 @@
566
579
  clone.style.whiteSpace = 'nowrap' // Prevent text wrapping during measurement
567
580
  document.body.appendChild(clone)
568
581
 
569
- // Get fresh content width from clone
570
- const contentWidth = clone.offsetWidth
582
+ // Get fresh content width from clone. offsetWidth rounds to an
583
+ // integer, which can under-measure by <1px and wrap an exact-fit
584
+ // line — use the subpixel rect width, ceiled.
585
+ const contentWidth = Math.ceil(clone.getBoundingClientRect().width)
571
586
  document.body.removeChild(clone)
572
587
 
573
- // Calculate new width
588
+ // Calculate new width. The measured clone is the bare text span, but
589
+ // TextOverlay wraps it with 10px horizontal padding each side under
590
+ // border-box sizing — compensate or exact-fit content wraps.
591
+ const TEXT_OVERLAY_HORIZONTAL_PADDING_PX = 20
574
592
  const calculatedWidth = Math.min(
575
- Math.max(contentWidth, 230),
593
+ Math.max(
594
+ contentWidth + TEXT_OVERLAY_HORIZONTAL_PADDING_PX,
595
+ parseInt(props.minWidth, 10) || 0
596
+ ),
576
597
  parseInt(props.maxWidth, 10)
577
598
  )
578
599
 
@@ -79,6 +79,49 @@ describe('InfoText Component', () => {
79
79
  expect(wrapper.find('[data-test-id="infoText_dot"]').exists()).toBe(true)
80
80
  })
81
81
 
82
+ describe("popup width floor (minWidth)", () => {
83
+ const showPopup = async (w) => {
84
+ w.vm.isMobile = false
85
+ await w.vm.$nextTick()
86
+ // the hover listener sits on the component root
87
+ await w.trigger("mouseenter")
88
+ // updatePosition awaits two ticks before measuring
89
+ await new Promise((resolve) => setTimeout(resolve))
90
+ await w.vm.$nextTick()
91
+ }
92
+
93
+ it("keeps the 230px width floor by default", async () => {
94
+ const roomy = mount(InfoText, {
95
+ props: { ...defaultProps, maxWidth: "400px" },
96
+ global: { stubs: { teleport: true } },
97
+ })
98
+ await showPopup(roomy)
99
+ // jsdom measures content at 0px, so the floor is what remains
100
+ expect(roomy.vm.infoBoxWidth).toBe(230)
101
+ })
102
+
103
+ it("applies contentPadding to the popup box", async () => {
104
+ const padded = mount(InfoText, {
105
+ props: { ...defaultProps, contentPadding: "6px 10px" },
106
+ global: { stubs: { teleport: true } },
107
+ })
108
+ await showPopup(padded)
109
+ const box = padded.find('[data-test-id="info_text_wrapper"]')
110
+ .element.firstElementChild
111
+ expect(box.style.padding).toBe("6px 10px")
112
+ })
113
+
114
+ it("allows a lower minWidth for tooltip-style content", async () => {
115
+ const small = mount(InfoText, {
116
+ props: { ...defaultProps, minWidth: "0" },
117
+ global: { stubs: { teleport: true } },
118
+ })
119
+ await showPopup(small)
120
+ // jsdom content measures 0px; only the padding compensation remains
121
+ expect(small.vm.infoBoxWidth).toBe(20)
122
+ })
123
+ })
124
+
82
125
  test('iconTextContent slot is correctly rendered', async () => {
83
126
  // override
84
127
  const props = defaultProps.iconTextContent