typescript conversions of bbui components
This commit is contained in:
parent
8db13bfb32
commit
fd100c3ec4
|
@ -1,24 +1,24 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import Field from "./Field.svelte"
|
import Field from "./Field.svelte"
|
||||||
import Checkbox from "./Core/Checkbox.svelte"
|
import Checkbox from "./Core/Checkbox.svelte"
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte"
|
||||||
|
|
||||||
export let value = null
|
export let value: boolean | undefined = undefined
|
||||||
export let label = null
|
export let label: string | undefined = undefined
|
||||||
export let labelPosition = "above"
|
export let labelPosition: "above" | "below" = "above"
|
||||||
export let text = null
|
export let text: string | undefined = undefined
|
||||||
export let disabled = false
|
export let disabled: boolean = false
|
||||||
export let error = null
|
export let error: string | undefined = undefined
|
||||||
export let size = "M"
|
export let size: "S" | "M" | "L" | "XL" = "M"
|
||||||
export let helpText = null
|
export let helpText: string | undefined = undefined
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
const onChange = e => {
|
const onChange = (e: CustomEvent<boolean>) => {
|
||||||
value = e.detail
|
value = e.detail
|
||||||
dispatch("change", e.detail)
|
dispatch("change", e.detail)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Field {helpText} {label} {labelPosition} {error}>
|
<Field {helpText} {label} {labelPosition} {error}>
|
||||||
<Checkbox {error} {disabled} {text} {value} {size} on:change={onChange} />
|
<Checkbox {disabled} {text} {value} {size} on:change={onChange} />
|
||||||
</Field>
|
</Field>
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
export let secondary: boolean = false
|
export let secondary: boolean = false
|
||||||
export let overBackground: boolean = false
|
export let overBackground: boolean = false
|
||||||
export let target: string | undefined = undefined
|
export let target: string | undefined = undefined
|
||||||
export let download: boolean | undefined = undefined
|
export let download: string | undefined = undefined
|
||||||
export let disabled: boolean = false
|
export let disabled: boolean = false
|
||||||
export let tooltip: string | null = null
|
export let tooltip: string | null = null
|
||||||
|
|
||||||
|
|
|
@ -7,17 +7,26 @@ export const BANNER_TYPES = {
|
||||||
WARNING: "warning",
|
WARNING: "warning",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface BannerConfig {
|
||||||
|
message?: string
|
||||||
|
type?: string
|
||||||
|
extraButtonText?: string
|
||||||
|
extraButtonAction?: () => void
|
||||||
|
onChange?: () => void
|
||||||
|
}
|
||||||
|
|
||||||
|
interface DefaultConfig {
|
||||||
|
messages: BannerConfig[]
|
||||||
|
}
|
||||||
|
|
||||||
export function createBannerStore() {
|
export function createBannerStore() {
|
||||||
const DEFAULT_CONFIG = {
|
const DEFAULT_CONFIG: DefaultConfig = {
|
||||||
messages: [],
|
messages: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
const banner = writable(DEFAULT_CONFIG)
|
const banner = writable<DefaultConfig>(DEFAULT_CONFIG)
|
||||||
|
|
||||||
const show = async (
|
const show = async (config: BannerConfig = {}) => {
|
||||||
// eslint-disable-next-line
|
|
||||||
config = { message, type, extraButtonText, extraButtonAction, onChange }
|
|
||||||
) => {
|
|
||||||
banner.update(store => {
|
banner.update(store => {
|
||||||
return {
|
return {
|
||||||
...store,
|
...store,
|
||||||
|
@ -27,7 +36,7 @@ export function createBannerStore() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const showStatus = async () => {
|
const showStatus = async () => {
|
||||||
const config = {
|
const config: BannerConfig = {
|
||||||
message: "Some systems are experiencing issues",
|
message: "Some systems are experiencing issues",
|
||||||
type: BANNER_TYPES.NEGATIVE,
|
type: BANNER_TYPES.NEGATIVE,
|
||||||
extraButtonText: "View Status",
|
extraButtonText: "View Status",
|
||||||
|
@ -37,18 +46,24 @@ export function createBannerStore() {
|
||||||
await queue([config])
|
await queue([config])
|
||||||
}
|
}
|
||||||
|
|
||||||
const queue = async entries => {
|
const queue = async (entries: Array<BannerConfig>) => {
|
||||||
const priority = {
|
const priority: Record<string, number> = {
|
||||||
[BANNER_TYPES.NEGATIVE]: 0,
|
[BANNER_TYPES.NEGATIVE]: 0,
|
||||||
[BANNER_TYPES.WARNING]: 1,
|
[BANNER_TYPES.WARNING]: 1,
|
||||||
[BANNER_TYPES.INFO]: 2,
|
[BANNER_TYPES.INFO]: 2,
|
||||||
}
|
}
|
||||||
banner.update(store => {
|
banner.update(store => {
|
||||||
const sorted = [...store.messages, ...entries].sort((a, b) => {
|
const sorted = [...store.messages, ...entries].sort((a, b) => {
|
||||||
if (priority[a.type] == priority[b.type]) {
|
if (
|
||||||
|
priority[a.type as keyof typeof priority] ===
|
||||||
|
priority[b.type as keyof typeof priority]
|
||||||
|
) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return priority[a.type] < priority[b.type] ? -1 : 1
|
return priority[a.type as keyof typeof priority] <
|
||||||
|
priority[b.type as keyof typeof priority]
|
||||||
|
? -1
|
||||||
|
: 1
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
...store,
|
...store,
|
|
@ -2,9 +2,21 @@ import { writable } from "svelte/store"
|
||||||
|
|
||||||
const NOTIFICATION_TIMEOUT = 3000
|
const NOTIFICATION_TIMEOUT = 3000
|
||||||
|
|
||||||
|
interface Notification {
|
||||||
|
id: string
|
||||||
|
type: string
|
||||||
|
message: string
|
||||||
|
icon: string
|
||||||
|
dismissable: boolean
|
||||||
|
action: (() => void) | null
|
||||||
|
actionMessage: string | null
|
||||||
|
wide: boolean
|
||||||
|
dismissTimeout: number
|
||||||
|
}
|
||||||
|
|
||||||
export const createNotificationStore = () => {
|
export const createNotificationStore = () => {
|
||||||
const timeoutIds = new Set()
|
const timeoutIds = new Set<NodeJS.Timeout>()
|
||||||
const _notifications = writable([], () => {
|
const _notifications = writable<Notification[]>([], () => {
|
||||||
return () => {
|
return () => {
|
||||||
// clear all the timers
|
// clear all the timers
|
||||||
timeoutIds.forEach(timeoutId => {
|
timeoutIds.forEach(timeoutId => {
|
||||||
|
@ -21,7 +33,7 @@ export const createNotificationStore = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const send = (
|
const send = (
|
||||||
message,
|
message: string,
|
||||||
{
|
{
|
||||||
type = "default",
|
type = "default",
|
||||||
icon = "",
|
icon = "",
|
||||||
|
@ -30,7 +42,15 @@ export const createNotificationStore = () => {
|
||||||
actionMessage = null,
|
actionMessage = null,
|
||||||
wide = false,
|
wide = false,
|
||||||
dismissTimeout = NOTIFICATION_TIMEOUT,
|
dismissTimeout = NOTIFICATION_TIMEOUT,
|
||||||
}
|
}: {
|
||||||
|
type?: string
|
||||||
|
icon?: string
|
||||||
|
autoDismiss?: boolean
|
||||||
|
action?: (() => void) | null
|
||||||
|
actionMessage?: string | null
|
||||||
|
wide?: boolean
|
||||||
|
dismissTimeout?: number
|
||||||
|
} = {}
|
||||||
) => {
|
) => {
|
||||||
if (block) {
|
if (block) {
|
||||||
return
|
return
|
||||||
|
@ -60,7 +80,7 @@ export const createNotificationStore = () => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const dismissNotification = id => {
|
const dismissNotification = (id: string) => {
|
||||||
_notifications.update(state => {
|
_notifications.update(state => {
|
||||||
return state.filter(n => n.id !== id)
|
return state.filter(n => n.id !== id)
|
||||||
})
|
})
|
||||||
|
@ -71,17 +91,18 @@ export const createNotificationStore = () => {
|
||||||
return {
|
return {
|
||||||
subscribe,
|
subscribe,
|
||||||
send,
|
send,
|
||||||
info: msg => send(msg, { type: "info", icon: "Info" }),
|
info: (msg: string) => send(msg, { type: "info", icon: "Info" }),
|
||||||
error: msg =>
|
error: (msg: string) =>
|
||||||
send(msg, { type: "error", icon: "Alert", autoDismiss: false }),
|
send(msg, { type: "error", icon: "Alert", autoDismiss: false }),
|
||||||
warning: msg => send(msg, { type: "warning", icon: "Alert" }),
|
warning: (msg: string) => send(msg, { type: "warning", icon: "Alert" }),
|
||||||
success: msg => send(msg, { type: "success", icon: "CheckmarkCircle" }),
|
success: (msg: string) =>
|
||||||
|
send(msg, { type: "success", icon: "CheckmarkCircle" }),
|
||||||
blockNotifications,
|
blockNotifications,
|
||||||
dismiss: dismissNotification,
|
dismiss: dismissNotification,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function id() {
|
function id(): string {
|
||||||
return "_" + Math.random().toString(36).slice(2, 9)
|
return "_" + Math.random().toString(36).slice(2, 9)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import "@spectrum-css/label/dist/index-vars.css"
|
import "@spectrum-css/label/dist/index-vars.css"
|
||||||
import Badge from "../Badge/Badge.svelte"
|
import Badge from "../Badge/Badge.svelte"
|
||||||
|
|
||||||
export let value
|
export let value: string | string[]
|
||||||
|
|
||||||
const displayLimit = 5
|
const displayLimit = 5
|
||||||
|
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import Link from "../Link/Link.svelte"
|
import Link from "../Link/Link.svelte"
|
||||||
|
|
||||||
export let value
|
export let value: { name: string; url: string; extension: string }[]
|
||||||
|
|
||||||
const displayLimit = 5
|
const displayLimit = 5
|
||||||
$: attachments = value?.slice(0, displayLimit) ?? []
|
$: attachments = value?.slice(0, displayLimit) ?? []
|
||||||
$: leftover = (value?.length ?? 0) - attachments.length
|
$: leftover = (value?.length ?? 0) - attachments.length
|
||||||
|
|
||||||
const imageExtensions = ["png", "tiff", "gif", "raw", "jpg", "jpeg"]
|
const imageExtensions: string[] = ["png", "tiff", "gif", "raw", "jpg", "jpeg"]
|
||||||
const isImage = extension => {
|
const isImage = (extension: string | undefined): boolean => {
|
||||||
return imageExtensions.includes(extension?.toLowerCase())
|
return imageExtensions.includes(extension?.toLowerCase() ?? "")
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
export let value
|
export let value: string
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="bold">{value}</div>
|
<div class="bold">{value}</div>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import "@spectrum-css/checkbox/dist/index-vars.css"
|
import "@spectrum-css/checkbox/dist/index-vars.css"
|
||||||
|
|
||||||
export let value
|
export let value: boolean
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<label
|
<label
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import StringRenderer from "./StringRenderer.svelte"
|
import StringRenderer from "./StringRenderer.svelte"
|
||||||
import BooleanRenderer from "./BooleanRenderer.svelte"
|
import BooleanRenderer from "./BooleanRenderer.svelte"
|
||||||
import DateTimeRenderer from "./DateTimeRenderer.svelte"
|
import DateTimeRenderer from "./DateTimeRenderer.svelte"
|
||||||
|
@ -8,14 +8,14 @@
|
||||||
import InternalRenderer from "./InternalRenderer.svelte"
|
import InternalRenderer from "./InternalRenderer.svelte"
|
||||||
import { processStringSync } from "@budibase/string-templates"
|
import { processStringSync } from "@budibase/string-templates"
|
||||||
|
|
||||||
export let row
|
export let row: any
|
||||||
export let schema
|
export let schema: any
|
||||||
export let value
|
export let value: any
|
||||||
export let customRenderers = []
|
export let customRenderers: { column: string; component: any }[] = []
|
||||||
export let snippets
|
export let snippets: any
|
||||||
|
|
||||||
let renderer
|
let renderer: any
|
||||||
const typeMap = {
|
const typeMap: Record<string, any> = {
|
||||||
boolean: BooleanRenderer,
|
boolean: BooleanRenderer,
|
||||||
datetime: DateTimeRenderer,
|
datetime: DateTimeRenderer,
|
||||||
link: RelationshipRenderer,
|
link: RelationshipRenderer,
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
$: renderer = customRenderer?.component ?? typeMap[type] ?? StringRenderer
|
$: renderer = customRenderer?.component ?? typeMap[type] ?? StringRenderer
|
||||||
$: cellValue = getCellValue(value, schema.template)
|
$: cellValue = getCellValue(value, schema.template)
|
||||||
|
|
||||||
const getType = schema => {
|
const getType = (schema: any): string => {
|
||||||
// Use a string renderer for dates if we use a custom template
|
// Use a string renderer for dates if we use a custom template
|
||||||
if (schema?.type === "datetime" && schema?.template) {
|
if (schema?.type === "datetime" && schema?.template) {
|
||||||
return "string"
|
return "string"
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
return schema?.type || "string"
|
return schema?.type || "string"
|
||||||
}
|
}
|
||||||
|
|
||||||
const getCellValue = (value, template) => {
|
const getCellValue = (value: any, template: string | undefined): any => {
|
||||||
if (!template) {
|
if (!template) {
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
export let value
|
export let value: string
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<code>{value}</code>
|
<code>{value}</code>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import dayjs from "dayjs"
|
import dayjs from "dayjs"
|
||||||
|
|
||||||
export let value
|
export let value: string | Date
|
||||||
export let schema
|
export let schema: { timeOnly?: boolean; dateOnly?: boolean }
|
||||||
|
|
||||||
// adding the 0- will turn a string like 00:00:00 into a valid ISO
|
// adding the 0- will turn a string like 00:00:00 into a valid ISO
|
||||||
// date, but will make actual ISO dates invalid
|
// date, but will make actual ISO dates invalid
|
||||||
$: time = new Date(`0-${value}`)
|
$: time = new Date(`0-${value}`)
|
||||||
$: isTimeOnly = !isNaN(time) || schema?.timeOnly
|
$: isTimeOnly = !isNaN(time.getTime()) || schema?.timeOnly
|
||||||
$: isDateOnly = schema?.dateOnly
|
$: isDateOnly = schema?.dateOnly
|
||||||
$: format = isTimeOnly
|
$: format = isTimeOnly
|
||||||
? "HH:mm:ss"
|
? "HH:mm:ss"
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import Icon from "../Icon/Icon.svelte"
|
import Icon from "../Icon/Icon.svelte"
|
||||||
import { copyToClipboard } from "../helpers"
|
import { copyToClipboard } from "../helpers"
|
||||||
import { notifications } from "../Stores/notifications"
|
import { notifications } from "../Stores/notifications"
|
||||||
|
|
||||||
export let value
|
export let value: string
|
||||||
|
|
||||||
const onClick = async e => {
|
const onClick = async (e: MouseEvent): Promise<void> => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
try {
|
try {
|
||||||
await copyToClipboard(value)
|
await copyToClipboard(value)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import "@spectrum-css/label/dist/index-vars.css"
|
import "@spectrum-css/label/dist/index-vars.css"
|
||||||
import { createEventDispatcher } from "svelte"
|
import { createEventDispatcher } from "svelte"
|
||||||
import Badge from "../Badge/Badge.svelte"
|
import Badge from "../Badge/Badge.svelte"
|
||||||
|
|
||||||
export let row
|
export let row: { tableId: string; _id: string }
|
||||||
export let value
|
export let value: { primaryDisplay?: string }[] | undefined
|
||||||
export let schema
|
export let schema: { name?: string }
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
const displayLimit = 5
|
const displayLimit = 5
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
$: relationships = value?.slice(0, displayLimit) ?? []
|
$: relationships = value?.slice(0, displayLimit) ?? []
|
||||||
$: leftover = (value?.length ?? 0) - relationships.length
|
$: leftover = (value?.length ?? 0) - relationships.length
|
||||||
|
|
||||||
const onClick = e => {
|
const onClick = (e: MouseEvent) => {
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
dispatch("clickrelationship", {
|
dispatch("clickrelationship", {
|
||||||
tableId: row.tableId,
|
tableId: row.tableId,
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import Checkbox from "../Form/Checkbox.svelte"
|
import Checkbox from "../Form/Checkbox.svelte"
|
||||||
import ActionButton from "../ActionButton/ActionButton.svelte"
|
import ActionButton from "../ActionButton/ActionButton.svelte"
|
||||||
|
|
||||||
export let selected
|
export let selected: boolean | undefined
|
||||||
export let onEdit
|
export let onEdit: () => void
|
||||||
export let allowSelectRows = false
|
export let allowSelectRows: boolean = false
|
||||||
export let allowEditRows = false
|
export let allowEditRows: boolean = false
|
||||||
export let data
|
export let data: Record<string, any>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
export let value
|
export let value: string | object
|
||||||
export let schema
|
export let schema: { capitalise?: boolean }
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class:capitalise={schema?.capitalise}>
|
<div class:capitalise={schema?.capitalise}>
|
||||||
|
|
|
@ -1,28 +1,48 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import "@spectrum-css/tabs/dist/index-vars.css"
|
import "@spectrum-css/tabs/dist/index-vars.css"
|
||||||
import { writable } from "svelte/store"
|
import { writable } from "svelte/store"
|
||||||
import { onMount, setContext, createEventDispatcher } from "svelte"
|
import { onMount, setContext, createEventDispatcher } from "svelte"
|
||||||
|
|
||||||
export let selected
|
interface TabInfo {
|
||||||
export let vertical = false
|
width?: number
|
||||||
export let noPadding = false
|
height?: number
|
||||||
// added as a separate option as noPadding is used for vertical padding
|
left?: number
|
||||||
export let noHorizPadding = false
|
top?: number
|
||||||
export let quiet = false
|
}
|
||||||
export let emphasized = false
|
|
||||||
export let onTop = false
|
|
||||||
export let size = "M"
|
|
||||||
export let beforeSwitch = null
|
|
||||||
|
|
||||||
let thisSelected = undefined
|
interface TabState {
|
||||||
|
title: string
|
||||||
|
id: string
|
||||||
|
emphasized: boolean
|
||||||
|
info?: TabInfo
|
||||||
|
}
|
||||||
|
|
||||||
|
export let selected: string
|
||||||
|
export let vertical: boolean = false
|
||||||
|
export let noPadding: boolean = false
|
||||||
|
// added as a separate option as noPadding is used for vertical padding
|
||||||
|
export let noHorizPadding: boolean = false
|
||||||
|
export let quiet: boolean = false
|
||||||
|
export let emphasized: boolean = false
|
||||||
|
export let onTop: boolean = false
|
||||||
|
export let size: "S" | "M" | "L" = "M"
|
||||||
|
export let beforeSwitch: ((_title: string) => boolean) | null = null
|
||||||
|
|
||||||
|
let thisSelected: string | undefined = undefined
|
||||||
|
let container: HTMLElement | undefined
|
||||||
|
|
||||||
let _id = id()
|
let _id = id()
|
||||||
const tab = writable({ title: selected, id: _id, emphasized })
|
const tab = writable<TabState>({ title: selected, id: _id, emphasized })
|
||||||
setContext("tab", tab)
|
setContext("tab", tab)
|
||||||
|
|
||||||
let container
|
let top: string | undefined
|
||||||
|
let left: string | undefined
|
||||||
|
let width: string | undefined
|
||||||
|
let height: string | undefined
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher<{
|
||||||
|
select: string
|
||||||
|
}>()
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
if (thisSelected !== selected) {
|
if (thisSelected !== selected) {
|
||||||
|
@ -44,29 +64,34 @@
|
||||||
}
|
}
|
||||||
if ($tab.title !== thisSelected) {
|
if ($tab.title !== thisSelected) {
|
||||||
tab.update(state => {
|
tab.update(state => {
|
||||||
state.title = thisSelected
|
state.title = thisSelected as string
|
||||||
return state
|
return state
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let top, left, width, height
|
$: $tab && calculateIndicatorLength()
|
||||||
$: calculateIndicatorLength($tab)
|
$: $tab && calculateIndicatorOffset()
|
||||||
$: calculateIndicatorOffset($tab)
|
|
||||||
|
|
||||||
function calculateIndicatorLength() {
|
function calculateIndicatorLength() {
|
||||||
if (!vertical) {
|
if (!vertical) {
|
||||||
width = $tab.info?.width + "px"
|
width = ($tab.info?.width ?? 0) + "px"
|
||||||
} else {
|
} else {
|
||||||
height = $tab.info?.height + 4 + "px"
|
height = ($tab.info?.height ?? 0) + 4 + "px"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculateIndicatorOffset() {
|
function calculateIndicatorOffset() {
|
||||||
if (!vertical) {
|
if (!vertical) {
|
||||||
left = $tab.info?.left - container?.getBoundingClientRect().left + "px"
|
left =
|
||||||
|
($tab.info?.left ?? 0) -
|
||||||
|
(container?.getBoundingClientRect().left ?? 0) +
|
||||||
|
"px"
|
||||||
} else {
|
} else {
|
||||||
top = $tab.info?.top - container?.getBoundingClientRect().top + "px"
|
top =
|
||||||
|
($tab.info?.top ?? 0) -
|
||||||
|
(container?.getBoundingClientRect().top ?? 0) +
|
||||||
|
"px"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +100,7 @@
|
||||||
calculateIndicatorOffset()
|
calculateIndicatorOffset()
|
||||||
})
|
})
|
||||||
|
|
||||||
function id() {
|
function id(): string {
|
||||||
return "_" + Math.random().toString(36).slice(2, 9)
|
return "_" + Math.random().toString(36).slice(2, 9)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import "@spectrum-css/tags/dist/index-vars.css"
|
import "@spectrum-css/tags/dist/index-vars.css"
|
||||||
import Avatar from "../Avatar/Avatar.svelte"
|
import Avatar from "../Avatar/Avatar.svelte"
|
||||||
import ClearButton from "../ClearButton/ClearButton.svelte"
|
import ClearButton from "../ClearButton/ClearButton.svelte"
|
||||||
|
|
||||||
export let icon = ""
|
export let icon: string = ""
|
||||||
export let avatar = ""
|
export let avatar: string = ""
|
||||||
export let invalid = false
|
export let invalid: boolean = false
|
||||||
export let disabled = false
|
export let disabled: boolean = false
|
||||||
export let closable = false
|
export let closable: boolean = false
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import "@spectrum-css/tags/dist/index-vars.css"
|
import "@spectrum-css/tags/dist/index-vars.css"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import Icon from "../Icon/Icon.svelte"
|
import Icon from "../Icon/Icon.svelte"
|
||||||
import AbsTooltip from "./AbsTooltip.svelte"
|
import AbsTooltip from "./AbsTooltip.svelte"
|
||||||
|
|
||||||
export let tooltip = ""
|
export let tooltip: string = ""
|
||||||
export let size = "M"
|
export let size: "S" | "M" = "M"
|
||||||
export let disabled = true
|
export let disabled: boolean = true
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class:container={!!tooltip}>
|
<div class:container={!!tooltip}>
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
export let selected = false
|
export let selected: boolean = false
|
||||||
export let open = false
|
export let open: boolean = false
|
||||||
export let href = false
|
export let href: string | null = null
|
||||||
export let title
|
export let title: string
|
||||||
export let icon
|
export let icon: string | undefined
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<li
|
<li
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import "@spectrum-css/treeview/dist/index-vars.css"
|
import "@spectrum-css/treeview/dist/index-vars.css"
|
||||||
|
|
||||||
export let quiet = false
|
export let quiet: boolean = false
|
||||||
export let standalone = true
|
export let standalone: boolean = true
|
||||||
export let width = "250px"
|
export let width: string = "250px"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<ul
|
<ul
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import "@spectrum-css/typography/dist/index-vars.css"
|
import "@spectrum-css/typography/dist/index-vars.css"
|
||||||
|
|
||||||
// Sizes
|
// Sizes
|
||||||
export let size = "M"
|
export let size: "S" | "M" | "L" = "M"
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<code class="spectrum-Code spectrum-Code--size{size}">
|
<code class="spectrum-Code spectrum-Code--size{size}">
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
<script>
|
<script lang="ts">
|
||||||
import "@spectrum-css/typography/dist/index-vars.css"
|
import "@spectrum-css/typography/dist/index-vars.css"
|
||||||
|
|
||||||
export let size = "M"
|
export let size: "S" | "M" | "L" = "M"
|
||||||
export let serif = false
|
export let serif: boolean = false
|
||||||
export let weight = 600
|
export let weight: number | null = null
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<p
|
<p
|
||||||
|
|
Loading…
Reference in New Issue