@dosgato/dialog 0.0.61 → 0.0.63
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/FileIcon.svelte +1 -2
- package/dist/FileIcon.svelte.d.ts +0 -1
- package/dist/Icon.svelte +5 -2
- package/dist/Icon.svelte.d.ts +1 -1
- package/dist/Tooltip.svelte +60 -0
- package/dist/Tooltip.svelte.d.ts +24 -0
- package/dist/chooser/Chooser.svelte +3 -3
- package/dist/chooser/Chooser.svelte.d.ts +0 -1
- package/dist/chooser/UploadUI.svelte +2 -0
- package/dist/tree/TreeCell.svelte +6 -3
- package/dist/tree/treestore.d.ts +7 -1
- package/package.json +1 -1
package/dist/FileIcon.svelte
CHANGED
|
@@ -5,8 +5,7 @@ export let hiddenLabel = undefined;
|
|
|
5
5
|
export let inline = false;
|
|
6
6
|
export let width = '1em';
|
|
7
7
|
export let height = width;
|
|
8
|
-
export let vAlign = 'middle';
|
|
9
8
|
$: icon = iconForMime(mime);
|
|
10
9
|
</script>
|
|
11
10
|
|
|
12
|
-
<Icon {icon} {hiddenLabel} {inline} {width} {height}
|
|
11
|
+
<Icon {icon} {hiddenLabel} {inline} {width} {height} />
|
package/dist/Icon.svelte
CHANGED
|
@@ -5,17 +5,20 @@
|
|
|
5
5
|
-->
|
|
6
6
|
<script>import Icon from '@iconify/svelte/dist/OfflineIcon.svelte';
|
|
7
7
|
import { ScreenReaderOnly } from '@txstate-mws/svelte-components';
|
|
8
|
+
import Tooltip from './Tooltip.svelte';
|
|
8
9
|
export let icon;
|
|
9
10
|
/** Label used in a `<ScreenReaderOnly>`. */
|
|
10
11
|
export let hiddenLabel = undefined;
|
|
11
12
|
export let inline = false;
|
|
12
13
|
export let width = '1em';
|
|
13
14
|
export let height = width;
|
|
14
|
-
export let
|
|
15
|
+
export let tooltip = undefined;
|
|
15
16
|
</script>
|
|
16
17
|
|
|
17
18
|
{#if icon}
|
|
18
|
-
<
|
|
19
|
+
<Tooltip tip={tooltip} top>
|
|
20
|
+
<Icon {icon} {inline} {width} {height} aria-hidden={!hiddenLabel} />
|
|
21
|
+
</Tooltip>
|
|
19
22
|
{#if hiddenLabel}
|
|
20
23
|
<ScreenReaderOnly>{hiddenLabel}</ScreenReaderOnly>
|
|
21
24
|
{/if}
|
package/dist/Icon.svelte.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ declare const __propDef: {
|
|
|
7
7
|
inline?: boolean | undefined;
|
|
8
8
|
width?: string | number | undefined;
|
|
9
9
|
height?: string | number | undefined;
|
|
10
|
-
|
|
10
|
+
tooltip?: string | undefined;
|
|
11
11
|
};
|
|
12
12
|
events: {
|
|
13
13
|
[evt: string]: CustomEvent<any>;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<script>export let tip = undefined;
|
|
2
|
+
export let top = false;
|
|
3
|
+
export let right = false;
|
|
4
|
+
export let bottom = false;
|
|
5
|
+
export let left = false;
|
|
6
|
+
export let active = false;
|
|
7
|
+
export let color = "#fff";
|
|
8
|
+
let style = `background-color: ${color}; border: 1px solid black;`;
|
|
9
|
+
</script>
|
|
10
|
+
|
|
11
|
+
<style>
|
|
12
|
+
.tooltip {
|
|
13
|
+
opacity: 0;
|
|
14
|
+
position: absolute;
|
|
15
|
+
z-index: 1;
|
|
16
|
+
visibility: hidden;
|
|
17
|
+
transition: opacity 150ms, visibility 150ms;
|
|
18
|
+
}
|
|
19
|
+
.default-tip {
|
|
20
|
+
padding: 4px 8px;
|
|
21
|
+
border-radius: 6px;
|
|
22
|
+
color: inherit;
|
|
23
|
+
}
|
|
24
|
+
.tooltip.top {
|
|
25
|
+
transform: translate(-40%, -100%);
|
|
26
|
+
margin-top: -20px;
|
|
27
|
+
}
|
|
28
|
+
.tooltip.active {
|
|
29
|
+
opacity: 1;
|
|
30
|
+
visibility: initial;
|
|
31
|
+
}
|
|
32
|
+
.tooltip-slot:hover + .tooltip {
|
|
33
|
+
opacity: 1;
|
|
34
|
+
visibility: initial;
|
|
35
|
+
}
|
|
36
|
+
.tip {
|
|
37
|
+
border: 1px solid #000;
|
|
38
|
+
background-color: #fff;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
</style>
|
|
42
|
+
|
|
43
|
+
{#if tip}
|
|
44
|
+
<div class="tooltip-wrapper">
|
|
45
|
+
<span class="tooltip-slot">
|
|
46
|
+
<slot />
|
|
47
|
+
</span>
|
|
48
|
+
<div
|
|
49
|
+
class="tooltip"
|
|
50
|
+
class:active
|
|
51
|
+
class:left
|
|
52
|
+
class:right
|
|
53
|
+
class:bottom
|
|
54
|
+
class:top>
|
|
55
|
+
<div class="default-tip tip">{tip}</div>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
{:else}
|
|
59
|
+
<slot />
|
|
60
|
+
{/if}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
tip?: string | undefined;
|
|
5
|
+
top?: boolean | undefined;
|
|
6
|
+
right?: boolean | undefined;
|
|
7
|
+
bottom?: boolean | undefined;
|
|
8
|
+
left?: boolean | undefined;
|
|
9
|
+
active?: boolean | undefined;
|
|
10
|
+
color?: string | undefined;
|
|
11
|
+
};
|
|
12
|
+
events: {
|
|
13
|
+
[evt: string]: CustomEvent<any>;
|
|
14
|
+
};
|
|
15
|
+
slots: {
|
|
16
|
+
default: {};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type TooltipProps = typeof __propDef.props;
|
|
20
|
+
export type TooltipEvents = typeof __propDef.events;
|
|
21
|
+
export type TooltipSlots = typeof __propDef.slots;
|
|
22
|
+
export default class Tooltip extends SvelteComponentTyped<TooltipProps, TooltipEvents, TooltipSlots> {
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -80,7 +80,7 @@ onMount(async () => {
|
|
|
80
80
|
const previewId = randomid();
|
|
81
81
|
</script>
|
|
82
82
|
|
|
83
|
-
<Dialog size="xl" ignoreTabs title={label} on:escape continueText="Choose" disabled={!$preview && required} cancelText="Cancel"
|
|
83
|
+
<Dialog size="xl" ignoreTabs title={label} on:escape continueText="Choose" disabled={!$preview && required} cancelText="Cancel">
|
|
84
84
|
<section class="dialog-chooser-window">
|
|
85
85
|
<header class="dialog-chooser-controls">
|
|
86
86
|
{#if $sources.length > 1}
|
|
@@ -90,7 +90,7 @@ const previewId = randomid();
|
|
|
90
90
|
<section class="dialog-chooser-chooser">
|
|
91
91
|
{#if $store.initialized}
|
|
92
92
|
<Tree headers={[
|
|
93
|
-
{ label: 'Path', id: 'name', grow: 4, icon: item => item.type === 'asset' ? iconForMime(item.mime) : (item.type === 'folder' ? (item.open ? folderNotchOpen : folderIcon) : applicationOutline), get: 'name' }
|
|
93
|
+
{ label: 'Path', id: 'name', grow: 4, icon: item => item.type === 'asset' ? { icon: iconForMime(item.mime) } : (item.type === 'folder' ? (item.open ? { icon: folderNotchOpen } : { icon: folderIcon }) : { icon: applicationOutline }), get: 'name' }
|
|
94
94
|
]} singleSelect store={treeStore} on:deselect={onDeselect} on:choose={onChoose} />
|
|
95
95
|
{/if}
|
|
96
96
|
</section>
|
|
@@ -106,7 +106,7 @@ const previewId = randomid();
|
|
|
106
106
|
<Button class="upload" disabled={$selected?.type !== 'folder' || !(chooserClient.mayUpload?.($selected) ?? true)} on:click={() => { showuploader = true }}>Upload</Button>
|
|
107
107
|
{/if}
|
|
108
108
|
<Button cancel {describedby} on:click={() => dispatch('escape')}>Cancel</Button>
|
|
109
|
-
<Button class="primary" disabled={!$preview && required} describedby={previewId} on:click={
|
|
109
|
+
<Button class="primary" disabled={!$preview && required} describedby={previewId} on:click={onChoose}>Choose</Button>
|
|
110
110
|
</svelte:fragment>
|
|
111
111
|
{#if showuploader && $selected?.type === 'folder' && chooserClient.upload}
|
|
112
112
|
<UploadUI title="Upload to {$selected.path}" folder={$selected} uploader={chooserClient.upload.bind(chooserClient)} on:escape={() => { showuploader = false }} on:saved={onUploadComplete}/>
|
|
@@ -47,6 +47,8 @@ async function onUploadSubmit() {
|
|
|
47
47
|
for (let i = 0; i < uploadList.length; i++) {
|
|
48
48
|
data.append('file' + i, uploadList[i]);
|
|
49
49
|
}
|
|
50
|
+
// TODO: accept new list of children from uploader function and feed it
|
|
51
|
+
// to the tree instead of refreshing the tree
|
|
50
52
|
await uploader(folder, uploadList, ratio => { uploadProgress = ratio; });
|
|
51
53
|
uploadList = [];
|
|
52
54
|
uploadError = undefined;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
<script>import { get } from 'txstate-utils';
|
|
1
|
+
<script>import { get, titleCase } from 'txstate-utils';
|
|
2
2
|
import { Icon } from '..';
|
|
3
3
|
export let header;
|
|
4
4
|
export let item;
|
|
5
|
-
$: icon = typeof header.icon === 'function' ? header.icon(item) : header.icon;
|
|
5
|
+
$: icon = typeof header.icon === 'function' ? header.icon(item).icon : header.icon?.icon;
|
|
6
|
+
$: iconLabel = typeof header.icon === 'function' ? header.icon(item).label : header.icon?.label;
|
|
6
7
|
$: headerComponent = header.component;
|
|
7
8
|
</script>
|
|
8
9
|
|
|
9
10
|
{#if header.icon}
|
|
10
|
-
<span class="icon"
|
|
11
|
+
<span class="icon">
|
|
12
|
+
<Icon {icon} tooltip={iconLabel} inline width="1.5em" hiddenLabel={iconLabel} />
|
|
13
|
+
</span>
|
|
11
14
|
{/if}
|
|
12
15
|
{#if header.component}
|
|
13
16
|
<svelte:component this={headerComponent} {item} {header} />
|
package/dist/tree/treestore.d.ts
CHANGED
|
@@ -39,7 +39,13 @@ export interface TreeHeader<T extends TreeItemFromDB> {
|
|
|
39
39
|
label: string;
|
|
40
40
|
fixed?: string;
|
|
41
41
|
grow?: number;
|
|
42
|
-
icon?:
|
|
42
|
+
icon?: {
|
|
43
|
+
icon: IconifyIcon;
|
|
44
|
+
label?: string | undefined;
|
|
45
|
+
} | ((item: TypedTreeItem<T>) => {
|
|
46
|
+
icon: IconifyIcon;
|
|
47
|
+
label?: string;
|
|
48
|
+
});
|
|
43
49
|
get?: string;
|
|
44
50
|
render?: (item: TypedTreeItem<T>) => string;
|
|
45
51
|
component?: SvelteComponent;
|
package/package.json
CHANGED