diff --git a/packages/bbui/src/Actions/position_dropdown.js b/packages/bbui/src/Actions/position_dropdown.js
index f2018272f6..7c4f7e8a2a 100644
--- a/packages/bbui/src/Actions/position_dropdown.js
+++ b/packages/bbui/src/Actions/position_dropdown.js
@@ -39,11 +39,13 @@ export default function positionDropdown(element, opts) {
styles = customUpdate(anchorBounds, elementBounds, styles)
} else {
// Determine vertical styles
+ const topSpace = anchorBounds.top
+ const bottomSpace = window.innerHeight - anchorBounds.bottom
if (align === "right-outside") {
styles.top = anchorBounds.top
} else if (
- window.innerHeight - anchorBounds.bottom <
- (maxHeight || 100)
+ window.innerHeight - anchorBounds.bottom < (maxHeight || 100) &&
+ topSpace - bottomSpace > 100
) {
styles.top = anchorBounds.top - elementBounds.height - offset
styles.maxHeight = maxHeight || 240
diff --git a/packages/bbui/src/Form/Core/DatePicker/DatePicker.svelte b/packages/bbui/src/Form/Core/DatePicker/DatePicker.svelte
index ec1514718c..a03be24753 100644
--- a/packages/bbui/src/Form/Core/DatePicker/DatePicker.svelte
+++ b/packages/bbui/src/Form/Core/DatePicker/DatePicker.svelte
@@ -1,10 +1,15 @@
diff --git a/packages/bbui/src/Form/Core/DatePicker/SpectrumDatePicker.svelte b/packages/bbui/src/Form/Core/DatePicker/SpectrumDatePicker.svelte
index d01097d357..97774da51b 100644
--- a/packages/bbui/src/Form/Core/DatePicker/SpectrumDatePicker.svelte
+++ b/packages/bbui/src/Form/Core/DatePicker/SpectrumDatePicker.svelte
@@ -4,7 +4,7 @@
import "@spectrum-css/textfield/dist/index-vars.css"
import Popover from "../../../Popover/Popover.svelte"
import dayjs from "dayjs"
- import { createEventDispatcher } from "svelte"
+ import { createEventDispatcher, onMount } from "svelte"
import TimePicker from "./TimePicker.svelte"
import Calendar from "./Calendar.svelte"
import DateTimeInput from "./DateInput.svelte"
@@ -19,6 +19,9 @@
export let timeOnly = false
export let ignoreTimezones = false
export let useKeyboardShortcuts = true
+ export let appendTo = null
+ export let api = null
+ export let align = "left"
const dispatch = createEventDispatcher()
@@ -114,6 +117,13 @@
calendar?.setDate(now)
handleChange(now)
}
+
+ onMount(() => {
+ api = {
+ open: () => popover?.show(),
+ close: () => popover?.hide(),
+ }
+ })
{#if isOpen}
diff --git a/packages/frontend-core/src/components/grid/cells/DateCell.svelte b/packages/frontend-core/src/components/grid/cells/DateCell.svelte
index 53b159ee30..fae75277b4 100644
--- a/packages/frontend-core/src/components/grid/cells/DateCell.svelte
+++ b/packages/frontend-core/src/components/grid/cells/DateCell.svelte
@@ -10,7 +10,7 @@
export let readonly = false
export let api
- let flatpickr
+ let datePickerAPI
let isOpen
// Adding the 0- will turn a string like 00:00:00 into a valid ISO
@@ -41,7 +41,7 @@
// Ensure we close flatpickr when unselected
$: {
if (!focused) {
- flatpickr?.close()
+ datePickerAPI?.close()
}
}
@@ -52,8 +52,8 @@
onMount(() => {
api = {
onKeyDown,
- focus: () => flatpickr?.open(),
- blur: () => flatpickr?.close(),
+ focus: () => datePickerAPI?.open(),
+ blur: () => datePickerAPI?.close(),
isActive: () => isOpen,
}
})
@@ -75,12 +75,10 @@
onChange(e.detail)}
- appendTo={document.documentElement}
enableTime={!dateOnly}
{timeOnly}
- time24hr
ignoreTimezones={schema.ignoreTimezones}
- bind:flatpickr
+ bind:api={datePickerAPI}
on:open={() => (isOpen = true)}
on:close={() => (isOpen = false)}
useKeyboardShortcuts={false}
@@ -110,9 +108,6 @@
position: absolute;
opacity: 0;
}
- .picker :global(.flatpickr) {
- min-width: 0;
- }
.picker :global(.spectrum-Textfield-input) {
width: 100%;
}