Fix TS exports of enums from BBUI, bump portal version

This commit is contained in:
Andrew Kingston 2025-01-21 14:46:26 +00:00
parent 3bd8becab1
commit b54a9fb462
No known key found for this signature in database
10 changed files with 49 additions and 50 deletions

View File

@ -80,7 +80,7 @@
"dayjs": "^1.10.8",
"easymde": "^2.16.1",
"svelte-dnd-action": "^0.9.8",
"svelte-portal": "^1.0.0"
"svelte-portal": "^2.2.1"
},
"resolutions": {
"loader-utils": "1.4.1"

View File

@ -1,4 +1,4 @@
import { PopoverAlignment } from "../Popover/Popover.svelte"
import { PopoverAlignment } from "../constants"
// Strategies are defined as [Popover]To[Anchor].
// They can apply for both horizontal and vertical alignment.

View File

@ -1,9 +1,6 @@
<script lang="ts">
import {
default as AbsTooltip,
TooltipPosition,
TooltipType,
} from "../Tooltip/AbsTooltip.svelte"
import AbsTooltip from "../Tooltip/AbsTooltip.svelte"
import { TooltipPosition, TooltipType } from "../constants"
export let name: string = "Add"
export let hidden: boolean = false

View File

@ -1,14 +1,4 @@
<script context="module" lang="ts">
export enum PopoverAlignment {
Left = "left",
Right = "right",
LeftOutside = "left-outside",
RightOutside = "right-outside",
Center = "center",
RightContextMenu = "right-context-menu",
LeftContextMenu = "left-context-menu",
}
export interface PopoverAPI {
show: () => void
hide: () => void
@ -23,6 +13,7 @@
import clickOutside from "../Actions/click_outside"
import { fly } from "svelte/transition"
import Context from "../context"
import { PopoverAlignment } from "../constants"
const dispatch = createEventDispatcher()
@ -86,13 +77,13 @@
}
}
const handleOutsideClick = e => {
const handleOutsideClick = (e: MouseEvent) => {
if (clickOutsideOverride) {
return
}
if (open) {
// Stop propagation if the source is the anchor
let node = e.target
let node = e.target as Node
let fromAnchor = false
while (!fromAnchor && node && node.parentNode) {
fromAnchor = node === anchor
@ -107,7 +98,7 @@
}
}
function handleEscape(e) {
function handleEscape(e: KeyboardEvent) {
if (!clickOutsideOverride) {
return
}

View File

@ -1,23 +1,9 @@
<script context="module" lang="ts">
export enum TooltipPosition {
Top = "top",
Right = "right",
Bottom = "bottom",
Left = "left",
}
export enum TooltipType {
Default = "default",
Info = "info",
Positive = "positive",
Negative = "negative",
}
</script>
<script lang="ts">
import Portal from "svelte-portal"
import { fade } from "svelte/transition"
import "@spectrum-css/tooltip/dist/index-vars.css"
import { onDestroy } from "svelte"
import { TooltipPosition, TooltipType } from "../constants"
export let position: TooltipPosition = TooltipPosition.Top
export let type: TooltipType = TooltipType.Default

View File

@ -0,0 +1,23 @@
export enum PopoverAlignment {
Left = "left",
Right = "right",
LeftOutside = "left-outside",
RightOutside = "right-outside",
Center = "center",
RightContextMenu = "right-context-menu",
LeftContextMenu = "left-context-menu",
}
export enum TooltipPosition {
Top = "top",
Right = "right",
Bottom = "bottom",
Left = "left",
}
export enum TooltipType {
Default = "default",
Info = "info",
Positive = "positive",
Negative = "negative",
}

View File

@ -1,8 +1,9 @@
import "./bbui.css"
// Spectrum icons
import "@spectrum-css/icon/dist/index-vars.css"
// Constants
export * from "./constants"
// Form components
export { default as Input } from "./Form/Input.svelte"
export { default as Stepper } from "./Form/Stepper.svelte"
@ -45,11 +46,7 @@ export { default as ClearButton } from "./ClearButton/ClearButton.svelte"
export { default as Icon } from "./Icon/Icon.svelte"
export { default as IconAvatar } from "./Icon/IconAvatar.svelte"
export { default as DetailSummary } from "./DetailSummary/DetailSummary.svelte"
export {
default as Popover,
PopoverAlignment,
type PopoverAPI,
} from "./Popover/Popover.svelte"
export { default as Popover, type PopoverAPI } from "./Popover/Popover.svelte"
export { default as ProgressBar } from "./ProgressBar/ProgressBar.svelte"
export { default as ProgressCircle } from "./ProgressCircle/ProgressCircle.svelte"
export { default as Label } from "./Label/Label.svelte"
@ -96,7 +93,6 @@ export { default as IconSideNav } from "./IconSideNav/IconSideNav.svelte"
export { default as IconSideNavItem } from "./IconSideNav/IconSideNavItem.svelte"
export { default as Accordion } from "./Accordion/Accordion.svelte"
export { default as AbsTooltip } from "./Tooltip/AbsTooltip.svelte"
export { TooltipPosition, TooltipType } from "./Tooltip/AbsTooltip.svelte"
// Renderers
export { default as BoldRenderer } from "./Table/BoldRenderer.svelte"

View File

@ -2,8 +2,8 @@
import {
Popover,
PopoverAlignment,
type PopoverAPI,
Icon,
type PopoverAPI,
} from "@budibase/bbui"
export let title: string = ""

View File

@ -1,10 +1,11 @@
<script context="module" lang="ts">
interface JSONViewerClickContext {
label: string | undefined
value: any
path: (string | number)[]
}
export interface JSONViewerClickEvent {
detail: {
label: string | undefined
value: any
path: (string | number)[]
}
detail: JSONViewerClickContext
}
</script>

View File

@ -18997,11 +18997,16 @@ svelte-loading-spinners@^0.1.1:
resolved "https://registry.yarnpkg.com/svelte-loading-spinners/-/svelte-loading-spinners-0.1.7.tgz#3fa6fa0ef67ab635773bf20b07d0b071debbadaa"
integrity sha512-EKCId1DjVL2RSUVJJsvtNcqQHox03XIgh4xh/4p7r6ST7d8mut6INY9/LqK4A17PFU64+3quZmqiSfOlf480CA==
svelte-portal@1.0.0, svelte-portal@^1.0.0:
svelte-portal@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/svelte-portal/-/svelte-portal-1.0.0.tgz#36a47c5578b1a4d9b4dc60fa32a904640ec4cdd3"
integrity sha512-nHf+DS/jZ6jjnZSleBMSaZua9JlG5rZv9lOGKgJuaZStfevtjIlUJrkLc3vbV8QdBvPPVmvcjTlazAzfKu0v3Q==
svelte-portal@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/svelte-portal/-/svelte-portal-2.2.1.tgz#b1d7bed78e56318db245996beb5483d8de6b9740"
integrity sha512-uF7is5sM4aq5iN7QF/67XLnTUvQCf2iiG/B1BHTqLwYVY1dsVmTeXZ/LeEyU6dLjApOQdbEG9lkqHzxiQtOLEQ==
svelte-spa-router@^4.0.1:
version "4.0.1"
resolved "https://registry.yarnpkg.com/svelte-spa-router/-/svelte-spa-router-4.0.1.tgz#720ef0cc9a4af33b155812496545c7999483878c"