@morscherlab/mint-sdk 1.4.0-beta.20 → 1.4.0-beta.21

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 (97) hide show
  1. package/dist/{AlertBox-CzLg0UaL.js → AlertBox-DwgNTEqf.js} +3 -3
  2. package/dist/{AlertBox-CzLg0UaL.js.map → AlertBox-DwgNTEqf.js.map} +1 -1
  3. package/dist/{AppSidebar-6oTT-gPO.js → AppSidebar-CZZaxni0.js} +7 -7
  4. package/dist/{AppSidebar-6oTT-gPO.js.map → AppSidebar-CZZaxni0.js.map} +1 -1
  5. package/dist/{ConfirmDialog-CSls2Nuv.js → ConfirmDialog-CjWoxAD1.js} +2 -2
  6. package/dist/{ConfirmDialog-CSls2Nuv.js.map → ConfirmDialog-CjWoxAD1.js.map} +1 -1
  7. package/dist/{ExperimentPopover-9l4QZlvQ.js → ExperimentPopover-DujiuQIO.js} +5 -5
  8. package/dist/{ExperimentPopover-9l4QZlvQ.js.map → ExperimentPopover-DujiuQIO.js.map} +1 -1
  9. package/dist/{ExperimentSelectorModal-pR5fK3pA.js → ExperimentSelectorModal-B4j4eUOJ.js} +5 -5
  10. package/dist/{ExperimentSelectorModal-pR5fK3pA.js.map → ExperimentSelectorModal-B4j4eUOJ.js.map} +1 -1
  11. package/dist/{SegmentedControl-CJ7EAmOq.js → SegmentedControl-DyUPH3I5.js} +2 -2
  12. package/dist/{SegmentedControl-CJ7EAmOq.js.map → SegmentedControl-DyUPH3I5.js.map} +1 -1
  13. package/dist/{SettingsModal-Dyitgzfp.js → SettingsModal-D2MOOtuO.js} +7 -7
  14. package/dist/{SettingsModal-Dyitgzfp.js.map → SettingsModal-D2MOOtuO.js.map} +1 -1
  15. package/dist/__tests__/components/FloatingPanelsInModal.test.d.ts +1 -0
  16. package/dist/__tests__/composables/useFloatingPanel.test.d.ts +1 -0
  17. package/dist/components/SmartGroupFieldRecipe.vue.d.ts +2 -2
  18. package/dist/components/internal/AutoGroupModalInternal.vue.d.ts +2 -2
  19. package/dist/composables/useFileImport.d.ts +7 -0
  20. package/dist/composables/useFloatingPanel.d.ts +29 -0
  21. package/dist/{controlSchemaModel-DCUOx8ll.js → controlSchemaModel-Bsg0t5Ab.js} +2 -2
  22. package/dist/{controlSchemaModel-DCUOx8ll.js.map → controlSchemaModel-Bsg0t5Ab.js.map} +1 -1
  23. package/dist/{data-DBnmeBZX.js → data-Boeh4uPI.js} +12 -11
  24. package/dist/{data-DBnmeBZX.js.map → data-Boeh4uPI.js.map} +1 -1
  25. package/dist/data.d.ts +1 -1
  26. package/dist/data.js +9 -9
  27. package/dist/{experimentStatus-BFrKpHAH.js → experimentStatus-DCn2QKG7.js} +2 -2
  28. package/dist/{experimentStatus-BFrKpHAH.js.map → experimentStatus-DCn2QKG7.js.map} +1 -1
  29. package/dist/index.js +18 -18
  30. package/dist/{install-qjELyNwc.js → install-BEHp7Mo-.js} +15 -15
  31. package/dist/{install-qjELyNwc.js.map → install-BEHp7Mo-.js.map} +1 -1
  32. package/dist/install.js +1 -1
  33. package/dist/{lab-UyTbokQC.js → lab-D61eaX6f.js} +10 -10
  34. package/dist/{lab-UyTbokQC.js.map → lab-D61eaX6f.js.map} +1 -1
  35. package/dist/lab.js +4 -4
  36. package/dist/{records-CR_pYzIP.js → records-D4aQXyZu.js} +132 -72
  37. package/dist/records-D4aQXyZu.js.map +1 -0
  38. package/dist/{runtime-CoHhBP10.js → runtime-q-R0CNLh.js} +9 -9
  39. package/dist/{runtime-CoHhBP10.js.map → runtime-q-R0CNLh.js.map} +1 -1
  40. package/dist/runtime.js +6 -6
  41. package/dist/{shell-BDuZf2zb.js → shell-6CGFvUUw.js} +5 -5
  42. package/dist/{shell-BDuZf2zb.js.map → shell-6CGFvUUw.js.map} +1 -1
  43. package/dist/shell.js +5 -5
  44. package/dist/styles.css +36 -33
  45. package/dist/{useDropdownState-Bb2N4m40.js → useDropdownState-uFIz6Yv8.js} +2 -2
  46. package/dist/useDropdownState-uFIz6Yv8.js.map +1 -0
  47. package/dist/{useExperimentSamples-Dno1fFMq.js → useExperimentSamples-QEFoq4tf.js} +47 -5
  48. package/dist/useExperimentSamples-QEFoq4tf.js.map +1 -0
  49. package/dist/{useListReorder-CQ9OCScc.js → useListReorder-DsuzwWGS.js} +47 -97
  50. package/dist/useListReorder-DsuzwWGS.js.map +1 -0
  51. package/dist/{useRackEditor-wL3kPrRT.js → useRackEditor-KpZ4iJ6o.js} +20 -30
  52. package/dist/useRackEditor-KpZ4iJ6o.js.map +1 -0
  53. package/dist/{useRealtime-C3whhVvb.js → useRealtime-B58Lo-Tm.js} +3 -3
  54. package/dist/{useRealtime-C3whhVvb.js.map → useRealtime-B58Lo-Tm.js.map} +1 -1
  55. package/dist/{useRequest-CDkrXNU7.js → useRequest-BuDmW8Jc.js} +7 -36
  56. package/dist/useRequest-BuDmW8Jc.js.map +1 -0
  57. package/package.json +3 -2
  58. package/src/__tests__/components/ActionMenu.test.ts +2 -2
  59. package/src/__tests__/components/BaseModal.test.ts +13 -0
  60. package/src/__tests__/components/FloatingPanelsInModal.test.ts +94 -0
  61. package/src/__tests__/composables/useFileImport.test.ts +36 -0
  62. package/src/__tests__/composables/useFloatingPanel.test.ts +68 -0
  63. package/src/__tests__/fixtures/table-import/cells.xlsx +0 -0
  64. package/src/__tests__/fixtures/table-import/samples.xlsx +0 -0
  65. package/src/components/ActionMenu.vue +6 -37
  66. package/src/components/BaseModal.vue +2 -1
  67. package/src/components/Tooltip.vue +9 -32
  68. package/src/components/internal/DatePickerDateInternal.vue +7 -45
  69. package/src/components/internal/DatePickerDateTimeInternal.vue +7 -1
  70. package/src/components/internal/DatePickerTimeInternal.vue +8 -1
  71. package/src/components/internal/NumberUnitInputInternal.vue +4 -18
  72. package/src/components/internal/SelectMultipleInternal.vue +6 -1
  73. package/src/components/internal/SelectSearchableInternal.vue +6 -1
  74. package/src/components/internal/WellEditPopupInternal.vue +11 -22
  75. package/src/composables/useFileImport.ts +51 -1
  76. package/src/composables/useFloatingPanel.ts +107 -0
  77. package/src/data.ts +1 -0
  78. package/src/styles/components/action-menu.css +1 -1
  79. package/src/styles/components/app-layout.css +3 -1
  80. package/src/styles/components/date-picker.css +4 -2
  81. package/src/styles/components/datetime-picker.css +4 -4
  82. package/src/styles/components/jobs-status-tray.css +3 -3
  83. package/src/styles/components/modal.css +1 -1
  84. package/src/styles/components/onboarding.css +2 -2
  85. package/src/styles/components/searchable-select.css +3 -7
  86. package/src/styles/components/time-picker.css +3 -6
  87. package/src/styles/components/toast.css +1 -1
  88. package/src/styles/components/tooltip.css +2 -2
  89. package/src/styles/components/unit-input.css +1 -1
  90. package/src/styles/components/well-edit-popup.css +2 -2
  91. package/src/styles/variables.css +6 -0
  92. package/dist/records-CR_pYzIP.js.map +0 -1
  93. package/dist/useDropdownState-Bb2N4m40.js.map +0 -1
  94. package/dist/useExperimentSamples-Dno1fFMq.js.map +0 -1
  95. package/dist/useListReorder-CQ9OCScc.js.map +0 -1
  96. package/dist/useRackEditor-wL3kPrRT.js.map +0 -1
  97. package/dist/useRequest-CDkrXNU7.js.map +0 -1
@@ -0,0 +1,107 @@
1
+ import {
2
+ autoUpdate,
3
+ computePosition,
4
+ flip,
5
+ hide,
6
+ offset,
7
+ shift,
8
+ size,
9
+ type Placement,
10
+ type ReferenceElement,
11
+ } from '@floating-ui/dom'
12
+ import { onScopeDispose, ref, toValue, watch, type MaybeRefOrGetter, type Ref } from 'vue'
13
+
14
+ // Internal: not exported from the package entry points.
15
+
16
+ export interface UseFloatingPanelOptions {
17
+ /** Default `'bottom-start'`. */
18
+ placement?: MaybeRefOrGetter<Placement>
19
+ /** Gap to the reference in px. Default 4. */
20
+ offset?: number
21
+ /** At least the reference width, at most 28rem (selects). */
22
+ matchWidth?: boolean
23
+ /** Re-place on scroll, resize and layout shift while open. Default `true`. */
24
+ follow?: boolean
25
+ }
26
+
27
+ export interface UseFloatingPanelReturn {
28
+ /** Bind to the panel: `position: fixed`, `left`, `top`, and `visibility: hidden` while the reference is scrolled out of view. */
29
+ style: Ref<Record<string, string>>
30
+ /** The placement after flip, for arrows and transitions. */
31
+ placement: Ref<Placement>
32
+ update: () => Promise<void>
33
+ }
34
+
35
+ /**
36
+ * Places `floating` next to `reference` with fixed positioning (offset, flip,
37
+ * shift, size, hide). A fixed panel escapes the `overflow` of its ancestors (a
38
+ * modal body) unless one of them has a transform, so it can stay in the DOM right
39
+ * after its trigger: Tab order, focus traps and outside-click checks are those of
40
+ * an in-place panel. The size middleware publishes the free height as
41
+ * `--mint-floating-available-height`; a panel whose list scrolls caps its
42
+ * `max-height` with it.
43
+ */
44
+ export function useFloatingPanel(
45
+ reference: MaybeRefOrGetter<ReferenceElement | null>,
46
+ floating: Ref<HTMLElement | null>,
47
+ open: Ref<boolean>,
48
+ options: UseFloatingPanelOptions = {},
49
+ ): UseFloatingPanelReturn {
50
+ const style = ref<Record<string, string>>({ position: 'fixed', left: '0px', top: '0px' })
51
+ const placement = ref<Placement>(toValue(options.placement) ?? 'bottom-start')
52
+
53
+ async function update(): Promise<void> {
54
+ const referenceEl = toValue(reference)
55
+ const floatingEl = floating.value
56
+ if (!referenceEl || !floatingEl) return
57
+ const result = await computePosition(referenceEl, floatingEl, {
58
+ placement: toValue(options.placement) ?? 'bottom-start',
59
+ strategy: 'fixed',
60
+ middleware: [
61
+ offset(options.offset ?? 4),
62
+ flip(),
63
+ shift({ padding: 8 }),
64
+ size({
65
+ padding: 8,
66
+ // Written to the element, not the reactive style: floating-ui measures again right after.
67
+ apply({ availableHeight, rects, elements }) {
68
+ const target = elements.floating.style
69
+ target.setProperty('--mint-floating-available-height', `${Math.max(0, availableHeight)}px`)
70
+ if (options.matchWidth) {
71
+ target.minWidth = `${rects.reference.width}px`
72
+ target.maxWidth = '28rem'
73
+ }
74
+ },
75
+ }),
76
+ hide(),
77
+ ],
78
+ })
79
+ const next: Record<string, string> = { position: 'fixed', left: `${result.x}px`, top: `${result.y}px` }
80
+ // The trigger scrolled out of its scroll container: keep the panel open, but not floating detached.
81
+ if (result.middlewareData.hide?.referenceHidden) next.visibility = 'hidden'
82
+ // autoUpdate fires on every scroll; re-render only when the panel changes.
83
+ const current = style.value
84
+ if (current.left !== next.left || current.top !== next.top || current.visibility !== next.visibility) style.value = next
85
+ placement.value = result.placement
86
+ }
87
+
88
+ let stop: (() => void) | undefined
89
+ function release(): void {
90
+ stop?.()
91
+ stop = undefined
92
+ }
93
+
94
+ watch(
95
+ [open, () => toValue(reference), floating],
96
+ ([isOpen, referenceEl, floatingEl]) => {
97
+ release()
98
+ if (!isOpen || !referenceEl || !floatingEl) return
99
+ if (options.follow ?? true) stop = autoUpdate(referenceEl, floatingEl, () => void update())
100
+ else void update()
101
+ },
102
+ { flush: 'post', immediate: true },
103
+ )
104
+ onScopeDispose(release)
105
+
106
+ return { style, placement, update }
107
+ }
package/src/data.ts CHANGED
@@ -122,6 +122,7 @@ export {
122
122
  export {
123
123
  detectDelimiter,
124
124
  readFileAsText,
125
+ readTableFileAsCsv,
125
126
  useFileImport,
126
127
  validateImportFile,
127
128
  type FileImportOptions,
@@ -9,7 +9,7 @@
9
9
 
10
10
  .mint-action-menu__panel {
11
11
  position: fixed;
12
- z-index: 1000;
12
+ z-index: var(--mint-z-popover);
13
13
  min-width: 10rem;
14
14
  max-width: min(18rem, calc(100vw - 1rem));
15
15
  }
@@ -124,8 +124,10 @@
124
124
  transform: translateX(calc(100% + 1rem));
125
125
  }
126
126
 
127
+ /* `none`, not translateX(0): any transform makes the sidebar the containing
128
+ block of its fixed dropdown panels, and its overflow would clip them. */
127
129
  .mint-layout--responsive-sidebar.mint-layout--sidebar-open .mint-layout__sidebar {
128
- transform: translateX(0);
130
+ transform: none;
129
131
  }
130
132
 
131
133
  .mint-layout--responsive-sidebar .mint-layout__sidebar-toggle {
@@ -130,11 +130,13 @@
130
130
  height: 0.875rem;
131
131
  }
132
132
 
133
- /* Calendar dropdown (teleported to body, positioned via JS). */
133
+ /* Calendar dropdown (teleported to body, positioned by useFloatingPanel). */
134
134
  .mint-date-picker__dropdown {
135
135
  position: fixed;
136
- z-index: 9999;
136
+ z-index: var(--mint-z-popover);
137
137
  width: 252px;
138
+ max-height: var(--mint-floating-available-height, none);
139
+ overflow-y: auto;
138
140
  padding: 0.5rem;
139
141
  }
140
142
 
@@ -97,12 +97,12 @@
97
97
  color: var(--text-muted);
98
98
  }
99
99
 
100
- /* Dropdown — placement only; the look is .mint-popover. */
100
+ /* Dropdown — the look is .mint-popover; useFloatingPanel sets the fixed position. */
101
101
  .mint-datetime-picker__dropdown {
102
- position: absolute;
103
- z-index: 50;
104
- margin-top: 0.25rem;
102
+ z-index: var(--mint-z-popover);
105
103
  width: 18rem;
104
+ max-height: var(--mint-floating-available-height, none);
105
+ overflow-y: auto;
106
106
  padding: 0.625rem;
107
107
  }
108
108
 
@@ -14,14 +14,14 @@
14
14
  .mint-jobs-tray__scrim {
15
15
  position: fixed;
16
16
  inset: 0;
17
- z-index: 999;
17
+ z-index: calc(var(--mint-z-tray) - 1);
18
18
  }
19
19
 
20
20
  .mint-jobs-tray__panel {
21
21
  position: fixed;
22
22
  top: calc(4.5rem + env(safe-area-inset-top));
23
23
  right: max(1rem, env(safe-area-inset-right));
24
- z-index: 1000;
24
+ z-index: var(--mint-z-tray);
25
25
  display: flex;
26
26
  width: min(360px, calc(100vw - 2rem));
27
27
  max-height: 75vh;
@@ -281,5 +281,5 @@
281
281
 
282
282
  /* The tray's confirm dialog sits above the tray and its scrim (BaseModal drops class fallthrough). */
283
283
  .mint-modal:has(.mint-jobs-tray__confirm) {
284
- z-index: 1001;
284
+ z-index: calc(var(--mint-z-tray) + 1);
285
285
  }
@@ -11,7 +11,7 @@
11
11
  .mint-modal {
12
12
  position: fixed;
13
13
  inset: 0;
14
- z-index: 50;
14
+ z-index: var(--mint-z-modal);
15
15
  display: flex;
16
16
  padding: 1rem;
17
17
  }
@@ -94,7 +94,7 @@ html.dark {
94
94
 
95
95
  .mint-onboarding-help__panel {
96
96
  position: fixed;
97
- z-index: 1000;
97
+ z-index: var(--mint-z-tray);
98
98
  width: 18rem;
99
99
  padding: 0 0 4px;
100
100
  overflow: hidden;
@@ -229,7 +229,7 @@ html.dark {
229
229
  .mint-onboarding {
230
230
  position: fixed;
231
231
  inset: 0;
232
- z-index: 1100;
232
+ z-index: var(--mint-z-tour);
233
233
  pointer-events: none;
234
234
  }
235
235
 
@@ -30,14 +30,10 @@
30
30
  .mint-searchable-select__value { flex: 1; min-width: 0; overflow: hidden; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
31
31
  .mint-searchable-select__value--placeholder { color: var(--text-muted); }
32
32
 
33
- /* Surface = .mint-popover (2d); this alias keeps only placement. */
33
+ /* Surface = .mint-popover (2d). useFloatingPanel sets the fixed position and width. */
34
34
  .mint-searchable-select__panel {
35
- position: absolute;
36
- top: calc(100% + 0.25rem);
37
- right: 0;
38
- left: 0;
39
- z-index: 30;
40
- max-height: min(38rem, 80vh);
35
+ z-index: var(--mint-z-popover);
36
+ max-height: min(38rem, 80vh, var(--mint-floating-available-height, 100vh));
41
37
  overflow: hidden;
42
38
  }
43
39
 
@@ -124,13 +124,10 @@
124
124
  height: 0.875rem;
125
125
  }
126
126
 
127
- /* Dropdown — placement only; the look is .mint-popover. Spans the field width. */
127
+ /* Dropdown — the look is .mint-popover; useFloatingPanel sets the fixed position and the field width. */
128
128
  .mint-time-picker__dropdown {
129
- position: absolute;
130
- z-index: 50;
131
- margin-top: 0.25rem;
132
- width: 100%;
133
- min-width: 100%;
129
+ z-index: var(--mint-z-popover);
130
+ max-height: var(--mint-floating-available-height, none);
134
131
  overflow: hidden;
135
132
  }
136
133
 
@@ -5,7 +5,7 @@
5
5
  /* AppTopBar publishes its bottom edge + 1rem so toasts clear its controls. */
6
6
  top: var(--mint-toast-offset-top, 1rem);
7
7
  right: 1rem;
8
- z-index: 9999;
8
+ z-index: var(--mint-z-toast);
9
9
  display: flex;
10
10
  flex-direction: column;
11
11
  gap: 0.5rem;
@@ -5,8 +5,8 @@
5
5
  }
6
6
 
7
7
  .mint-tooltip__content {
8
- position: absolute;
9
- z-index: 9999;
8
+ position: fixed;
9
+ z-index: var(--mint-z-toast);
10
10
  display: inline-flex;
11
11
  align-items: center;
12
12
  gap: 0.5rem;
@@ -140,7 +140,7 @@ button.mint-unit-input__unit:focus-visible {
140
140
 
141
141
  .mint-unit-input__menu {
142
142
  position: fixed;
143
- z-index: 1000;
143
+ z-index: var(--mint-z-popover);
144
144
  width: 148px;
145
145
  }
146
146
 
@@ -5,12 +5,12 @@
5
5
  .mint-well-edit-popup__backdrop {
6
6
  position: fixed;
7
7
  inset: 0;
8
- z-index: 40;
8
+ z-index: calc(var(--mint-z-popover) - 1);
9
9
  }
10
10
 
11
11
  .mint-well-edit-popup {
12
12
  position: fixed;
13
- z-index: 50;
13
+ z-index: var(--mint-z-popover);
14
14
  width: 300px;
15
15
  padding: 0;
16
16
  overflow: hidden;
@@ -192,6 +192,12 @@
192
192
  --mint-border-focus: var(--color-primary);
193
193
  /* Colour-only transitions; no lift, bounce or glow. */
194
194
  --mint-transition: 120ms ease;
195
+ /* Stacking layers: modal < jobs tray < onboarding tour < floating panels < tooltips and toasts. */
196
+ --mint-z-modal: 50;
197
+ --mint-z-tray: 1000;
198
+ --mint-z-tour: 1100;
199
+ --mint-z-popover: 1200;
200
+ --mint-z-toast: 9999;
195
201
  }
196
202
 
197
203
  /* ==========================================================================