@dosgato/dialog 1.4.3 → 1.4.4

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.
@@ -19,7 +19,7 @@
19
19
 
20
20
  <style>
21
21
  button.reset {
22
- padding: 0.5em 1em;
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} top>
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>
@@ -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: {
@@ -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,11 +8,16 @@
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()
15
+ const anchorName = `--tip-${tooltipId}`
14
16
  let triggerEl: HTMLSpanElement
17
+ let slotwrapper: HTMLSpanElement
18
+
15
19
  let hasFocusableChild = false
20
+ $: resolvedAlign = align ?? (top ? 'top' : right ? 'right' : bottom ? 'bottom' : left ? 'left' : 'auto') as GlueAlignOpts
16
21
 
17
22
  async function reactToTip (..._: any[]) {
18
23
  await tick()
@@ -30,7 +35,7 @@
30
35
 
31
36
  {#if tip}
32
37
  <div class="tooltip-wrapper">
33
- <span class="tooltip-slot" bind:this={triggerEl}>
38
+ <span bind:this={slotwrapper} class="tooltip-slot" style:anchor-name={anchorName} bind:this={triggerEl}>
34
39
  <slot />
35
40
  {#if !hasFocusableChild}<ScreenReaderOnly>tooltip: {tip}</ScreenReaderOnly>{/if}
36
41
  </span>
@@ -39,10 +44,7 @@
39
44
  role="tooltip"
40
45
  class="tooltip"
41
46
  class:active
42
- class:left
43
- class:right
44
- class:bottom
45
- class:top>
47
+ use:glue={{ target: slotwrapper, align: resolvedAlign, gap: 5 }}>
46
48
  <div class="default-tip tip">{tip}</div>
47
49
  </div>
48
50
  </div>
@@ -53,7 +55,6 @@
53
55
  <style>
54
56
  .tooltip {
55
57
  opacity: 0;
56
- position: absolute;
57
58
  z-index: 1;
58
59
  visibility: hidden;
59
60
  transition: opacity 150ms, visibility 150ms;
@@ -63,10 +64,6 @@
63
64
  border-radius: 6px;
64
65
  color: inherit;
65
66
  }
66
- .tooltip.top {
67
- transform: translate(-40%, -100%);
68
- margin-top: -20px;
69
- }
70
67
  .tooltip.active {
71
68
  opacity: 1;
72
69
  visibility: initial;
@@ -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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dosgato/dialog",
3
3
  "description": "A component library for building forms that edit a JSON document.",
4
- "version": "1.4.3",
4
+ "version": "1.4.4",
5
5
  "scripts": {
6
6
  "prepublishOnly": "svelte-package",
7
7
  "dev": "vite dev --force",