@dosgato/dialog 1.4.3 → 1.4.5
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/dist/Button.svelte +3 -2
- package/dist/Icon.svelte +4 -1
- package/dist/Icon.svelte.d.ts +2 -0
- package/dist/Tooltip.svelte +10 -14
- package/dist/Tooltip.svelte.d.ts +2 -0
- package/package.json +1 -1
package/dist/Button.svelte
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
|
|
20
20
|
<style>
|
|
21
21
|
button.reset {
|
|
22
|
-
padding: 0.5em
|
|
22
|
+
padding: 0.5em 15px;
|
|
23
23
|
border: 0;
|
|
24
24
|
border-radius: 0.25em;
|
|
25
25
|
background-color: var(--dg-button-bg, #501214);
|
|
@@ -30,7 +30,8 @@
|
|
|
30
30
|
line-height: 1;
|
|
31
31
|
}
|
|
32
32
|
button.reset.compact {
|
|
33
|
-
padding: 0.1em;
|
|
33
|
+
padding: 0.2em 5px 0.1em 5px;
|
|
34
|
+
font-size: 0.9em;
|
|
34
35
|
}
|
|
35
36
|
button.reset[disabled] {
|
|
36
37
|
opacity: 0.6;
|
package/dist/Icon.svelte
CHANGED
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
-->
|
|
6
6
|
<script lang="ts">
|
|
7
7
|
import type { IconifyIcon } from '@iconify/svelte'
|
|
8
|
+
import type { GlueAlignOpts } from '@txstate-mws/svelte-components'
|
|
8
9
|
import { randomid } from 'txstate-utils'
|
|
9
10
|
import Tooltip from './Tooltip.svelte'
|
|
11
|
+
|
|
10
12
|
export let icon: IconifyIcon | undefined
|
|
11
13
|
/** Label used in a `<ScreenReaderOnly>`. */
|
|
12
14
|
export let hiddenLabel: string | undefined = undefined
|
|
@@ -14,6 +16,7 @@
|
|
|
14
16
|
export let width: string | number | undefined = undefined
|
|
15
17
|
export let height: string | number | undefined = undefined
|
|
16
18
|
export let tooltip: string | undefined = undefined
|
|
19
|
+
export let tooltipAlign: GlueAlignOpts = 'automiddle'
|
|
17
20
|
let className: string | undefined = undefined
|
|
18
21
|
export { className as class }
|
|
19
22
|
|
|
@@ -48,7 +51,7 @@
|
|
|
48
51
|
</script>
|
|
49
52
|
|
|
50
53
|
{#if icon}
|
|
51
|
-
<Tooltip tip={tooltip}
|
|
54
|
+
<Tooltip tip={tooltip} align={tooltipAlign}>
|
|
52
55
|
<svg role="img" class={className} viewBox="{icon.left ?? 0} {icon.top ?? 0} {icon.width ?? 256} {icon.height ?? 256}" class:vFlip={icon.vFlip} class:hFlip={icon.hFlip} class:inline {width} {height} aria-hidden={!hiddenLabel} aria-label={hiddenLabel} xmlns="http://www.w3.org/2000/svg">
|
|
53
56
|
{@html svgBody(icon)}
|
|
54
57
|
</svg>
|
package/dist/Icon.svelte.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
2
|
import type { IconifyIcon } from '@iconify/svelte';
|
|
3
|
+
import type { GlueAlignOpts } from '@txstate-mws/svelte-components';
|
|
3
4
|
declare const __propDef: {
|
|
4
5
|
props: {
|
|
5
6
|
icon: IconifyIcon | undefined;
|
|
@@ -8,6 +9,7 @@ declare const __propDef: {
|
|
|
8
9
|
width?: string | number | undefined;
|
|
9
10
|
height?: string | number | undefined;
|
|
10
11
|
tooltip?: string | undefined;
|
|
12
|
+
tooltipAlign?: GlueAlignOpts;
|
|
11
13
|
class?: string | undefined;
|
|
12
14
|
};
|
|
13
15
|
events: {
|
package/dist/Tooltip.svelte
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { tick } from 'svelte'
|
|
3
|
-
import { ScreenReaderOnly } from '@txstate-mws/svelte-components'
|
|
3
|
+
import { glue, ScreenReaderOnly, type GlueAlignOpts } from '@txstate-mws/svelte-components'
|
|
4
4
|
import { randomid } from 'txstate-utils'
|
|
5
5
|
|
|
6
6
|
export let tip: string | undefined = undefined
|
|
@@ -8,16 +8,20 @@
|
|
|
8
8
|
export let right: boolean = false
|
|
9
9
|
export let bottom: boolean = false
|
|
10
10
|
export let left: boolean = false
|
|
11
|
+
export let align: GlueAlignOpts | undefined = undefined
|
|
11
12
|
export let active: boolean = false
|
|
12
13
|
|
|
13
14
|
const tooltipId = randomid()
|
|
14
|
-
|
|
15
|
+
const anchorName = `--tip-${tooltipId}`
|
|
16
|
+
let slotwrapper: HTMLSpanElement
|
|
17
|
+
|
|
15
18
|
let hasFocusableChild = false
|
|
19
|
+
$: resolvedAlign = align ?? (top ? 'top' : right ? 'right' : bottom ? 'bottom' : left ? 'left' : 'auto') as GlueAlignOpts
|
|
16
20
|
|
|
17
21
|
async function reactToTip (..._: any[]) {
|
|
18
22
|
await tick()
|
|
19
|
-
if (!
|
|
20
|
-
const focusable =
|
|
23
|
+
if (!slotwrapper) return
|
|
24
|
+
const focusable = slotwrapper.querySelector('a[href], button, input, select, textarea, [tabindex]')
|
|
21
25
|
if (focusable) {
|
|
22
26
|
hasFocusableChild = true
|
|
23
27
|
focusable.setAttribute('aria-describedby', tooltipId)
|
|
@@ -30,7 +34,7 @@
|
|
|
30
34
|
|
|
31
35
|
{#if tip}
|
|
32
36
|
<div class="tooltip-wrapper">
|
|
33
|
-
<span class="tooltip-slot"
|
|
37
|
+
<span bind:this={slotwrapper} class="tooltip-slot">
|
|
34
38
|
<slot />
|
|
35
39
|
{#if !hasFocusableChild}<ScreenReaderOnly>tooltip: {tip}</ScreenReaderOnly>{/if}
|
|
36
40
|
</span>
|
|
@@ -39,10 +43,7 @@
|
|
|
39
43
|
role="tooltip"
|
|
40
44
|
class="tooltip"
|
|
41
45
|
class:active
|
|
42
|
-
|
|
43
|
-
class:right
|
|
44
|
-
class:bottom
|
|
45
|
-
class:top>
|
|
46
|
+
use:glue={{ target: slotwrapper, align: resolvedAlign, gap: 5 }}>
|
|
46
47
|
<div class="default-tip tip">{tip}</div>
|
|
47
48
|
</div>
|
|
48
49
|
</div>
|
|
@@ -53,7 +54,6 @@
|
|
|
53
54
|
<style>
|
|
54
55
|
.tooltip {
|
|
55
56
|
opacity: 0;
|
|
56
|
-
position: absolute;
|
|
57
57
|
z-index: 1;
|
|
58
58
|
visibility: hidden;
|
|
59
59
|
transition: opacity 150ms, visibility 150ms;
|
|
@@ -63,10 +63,6 @@
|
|
|
63
63
|
border-radius: 6px;
|
|
64
64
|
color: inherit;
|
|
65
65
|
}
|
|
66
|
-
.tooltip.top {
|
|
67
|
-
transform: translate(-40%, -100%);
|
|
68
|
-
margin-top: -20px;
|
|
69
|
-
}
|
|
70
66
|
.tooltip.active {
|
|
71
67
|
opacity: 1;
|
|
72
68
|
visibility: initial;
|
package/dist/Tooltip.svelte.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import { type GlueAlignOpts } from '@txstate-mws/svelte-components';
|
|
2
3
|
declare const __propDef: {
|
|
3
4
|
props: {
|
|
4
5
|
tip?: string | undefined;
|
|
@@ -6,6 +7,7 @@ declare const __propDef: {
|
|
|
6
7
|
right?: boolean;
|
|
7
8
|
bottom?: boolean;
|
|
8
9
|
left?: boolean;
|
|
10
|
+
align?: GlueAlignOpts | undefined;
|
|
9
11
|
active?: boolean;
|
|
10
12
|
};
|
|
11
13
|
events: {
|
package/package.json
CHANGED