@dosgato/dialog 0.0.17 → 0.0.19
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/FieldIdentifier.svelte +9 -0
- package/FieldIdentifier.svelte.d.ts +17 -0
- package/Listbox.svelte +1 -0
- package/Tab.svelte +1 -1
- package/chooser/Chooser.svelte +1 -1
- package/chooser/Details.svelte +1 -1
- package/colorpicker/FieldColorPicker.svelte +43 -0
- package/colorpicker/FieldColorPicker.svelte.d.ts +28 -0
- package/colorpicker/colorpicker.d.ts +5 -0
- package/colorpicker/colorpicker.js +1 -0
- package/colorpicker/index.d.ts +1 -0
- package/colorpicker/index.js +1 -0
- package/fileIcons.js +34 -34
- package/iconpicker/FieldIconPicker.svelte +6 -6
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +7 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script>import { Field, nullableSerialize, nullableDeserialize } from '@txstate-mws/svelte-forms';
|
|
2
|
+
import { randomid } from 'txstate-utils';
|
|
3
|
+
export let path;
|
|
4
|
+
export let conditional = undefined;
|
|
5
|
+
</script>
|
|
6
|
+
|
|
7
|
+
<Field {path} {conditional} defaultValue={randomid()} serialize={nullableSerialize} deserialize={nullableDeserialize} let:value>
|
|
8
|
+
<input type="hidden" name={path} {value}>
|
|
9
|
+
</Field>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
declare const __propDef: {
|
|
3
|
+
props: {
|
|
4
|
+
path: string;
|
|
5
|
+
conditional?: boolean | undefined;
|
|
6
|
+
};
|
|
7
|
+
events: {
|
|
8
|
+
[evt: string]: CustomEvent<any>;
|
|
9
|
+
};
|
|
10
|
+
slots: {};
|
|
11
|
+
};
|
|
12
|
+
export declare type FieldIdentifierProps = typeof __propDef.props;
|
|
13
|
+
export declare type FieldIdentifierEvents = typeof __propDef.events;
|
|
14
|
+
export declare type FieldIdentifierSlots = typeof __propDef.slots;
|
|
15
|
+
export default class FieldIdentifier extends SvelteComponentTyped<FieldIdentifierProps, FieldIdentifierEvents, FieldIdentifierSlots> {
|
|
16
|
+
}
|
|
17
|
+
export {};
|
package/Listbox.svelte
CHANGED
|
@@ -122,6 +122,7 @@ function focusListbox() {
|
|
|
122
122
|
<span id={labelId}>{label}</span>
|
|
123
123
|
<ul bind:this={listboxElement} role="listbox" id={listId} class="listbox-items" tabindex="0" aria-describedby={descid} aria-labelledby={labelId} aria-multiselectable={multiselect} on:keydown={onkeydown} on:focus={focusListbox}>
|
|
124
124
|
{#each items as item, i (item.value)}
|
|
125
|
+
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
|
125
126
|
<li
|
|
126
127
|
bind:this={itemelements[i]}
|
|
127
128
|
id={`${listId}-${i}`}
|
package/Tab.svelte
CHANGED
|
@@ -13,7 +13,7 @@ const last = idx === $store.tabs.length - 1;
|
|
|
13
13
|
{#if $accordion}
|
|
14
14
|
<div bind:this={tabelements[idx]} id={$store.tabids[title]} class="tabs-tab" class:last aria-selected={active} aria-controls={$store.panelids[title]} role="tab" tabindex={0} on:click={onClick(idx)} on:keydown={onKeyDown(idx)}><Icon icon={$store.tabs[idx].icon} inline />{title}<i class="tabs-accordion-arrow" aria-hidden="true"></i></div>
|
|
15
15
|
{/if}
|
|
16
|
-
<div id={$store.panelids[title]} hidden={!active} role="tabpanel" tabindex="
|
|
16
|
+
<div id={$store.panelids[title]} hidden={!active} role="tabpanel" tabindex="-1" aria-labelledby={$store.tabids[title]} class="tabs-panel" class:accordion={$accordion}>
|
|
17
17
|
<slot />
|
|
18
18
|
</div>
|
|
19
19
|
|
package/chooser/Chooser.svelte
CHANGED
|
@@ -92,7 +92,7 @@ onMount(async () => {
|
|
|
92
92
|
</ul>
|
|
93
93
|
</Loading>
|
|
94
94
|
</section>
|
|
95
|
-
<section class="dialog-chooser-preview" tabindex=
|
|
95
|
+
<section class="dialog-chooser-preview" tabindex="-1">
|
|
96
96
|
{#if $preview}
|
|
97
97
|
<Thumbnail item={$preview} />
|
|
98
98
|
<Details item={$preview}>
|
package/chooser/Details.svelte
CHANGED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
<script>import FieldStandard from '../FieldStandard.svelte';
|
|
2
|
+
import { keyby } from 'txstate-utils';
|
|
3
|
+
export let id = undefined;
|
|
4
|
+
let className = '';
|
|
5
|
+
export { className as class };
|
|
6
|
+
export let path;
|
|
7
|
+
export let options;
|
|
8
|
+
export let label = '';
|
|
9
|
+
export let required = false;
|
|
10
|
+
export let disabled = false;
|
|
11
|
+
export let notNull = false;
|
|
12
|
+
export let defaultValue = notNull ? options[0].value : undefined;
|
|
13
|
+
export let conditional = undefined;
|
|
14
|
+
export let placeholder = 'Select' + (label ? ' ' + label : '');
|
|
15
|
+
export let inputelement = undefined;
|
|
16
|
+
const colorsByValue = keyby(options, 'value');
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<FieldStandard bind:id {path} {label} {required} {defaultValue} {conditional} let:id let:value let:valid let:invalid let:onBlur let:onChange>
|
|
20
|
+
<div class="flex-color-container">
|
|
21
|
+
<div class="selected-color" style="background-color: { value ? colorsByValue[value].color : 'transparent' }"/>
|
|
22
|
+
<select bind:this={inputelement} {id} name={path} {disabled} class="dialog-input dialog-select {className}" on:change={onChange} on:blur={onBlur} class:valid class:invalid>
|
|
23
|
+
{#if !notNull}<option value="" selected={!value}>{placeholder}</option>{/if}
|
|
24
|
+
{#each options as option (option.value) }
|
|
25
|
+
<option value={option.value} selected={value === option.value}>{option.name || option.value}</option>
|
|
26
|
+
{/each}
|
|
27
|
+
</select>
|
|
28
|
+
</div>
|
|
29
|
+
</FieldStandard>
|
|
30
|
+
|
|
31
|
+
<style>
|
|
32
|
+
.flex-color-container {
|
|
33
|
+
display: flex;
|
|
34
|
+
align-items: center;
|
|
35
|
+
}
|
|
36
|
+
.selected-color {
|
|
37
|
+
height: 2em;
|
|
38
|
+
width: 2em;
|
|
39
|
+
margin-right: 1em;
|
|
40
|
+
border: 1px solid #6d6d6d;
|
|
41
|
+
border-radius: 3px;
|
|
42
|
+
}
|
|
43
|
+
</style>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SvelteComponentTyped } from "svelte";
|
|
2
|
+
import type { ColorPickerOption } from './colorpicker';
|
|
3
|
+
declare const __propDef: {
|
|
4
|
+
props: {
|
|
5
|
+
id?: string | undefined;
|
|
6
|
+
class?: string;
|
|
7
|
+
path: string;
|
|
8
|
+
options: ColorPickerOption[];
|
|
9
|
+
label?: string;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
notNull?: boolean;
|
|
13
|
+
defaultValue?: any;
|
|
14
|
+
conditional?: boolean | undefined;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
inputelement?: HTMLSelectElement;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export declare type FieldColorPickerProps = typeof __propDef.props;
|
|
24
|
+
export declare type FieldColorPickerEvents = typeof __propDef.events;
|
|
25
|
+
export declare type FieldColorPickerSlots = typeof __propDef.slots;
|
|
26
|
+
export default class FieldColorPicker extends SvelteComponentTyped<FieldColorPickerProps, FieldColorPickerEvents, FieldColorPickerSlots> {
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as FieldColorPicker } from './FieldColorPicker.svelte';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as FieldColorPicker } from './FieldColorPicker.svelte';
|
package/fileIcons.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
1
|
+
import archiveLight from '@iconify-icons/ph/archive-light.js';
|
|
2
|
+
import fileCodeLight from '@iconify-icons/ph/file-code-light.js';
|
|
3
|
+
import fileTextLight from '@iconify-icons/ph/file-text-light.js';
|
|
4
|
+
import fileAudioLight from '@iconify-icons/ph/file-audio-light.js';
|
|
5
|
+
import filePdfLight from '@iconify-icons/ph/file-pdf-light';
|
|
6
|
+
import fileLight from '@iconify-icons/ph/file-light.js';
|
|
7
|
+
import fileCsvLight from '@iconify-icons/ph/file-csv-light.js';
|
|
8
|
+
import fileVideoLight from '@iconify-icons/ph/file-video-light.js';
|
|
9
|
+
import fileImageLight from '@iconify-icons/ph/file-image-light.js';
|
|
10
|
+
import microsoftExcel from '@iconify-icons/ph/file-xls-light.js';
|
|
11
|
+
import microsoftWord from '@iconify-icons/ph/file-doc-light.js';
|
|
12
12
|
const fileIconsByMime = {
|
|
13
13
|
'application/vnd.ms-excel': microsoftExcel,
|
|
14
14
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': microsoftExcel,
|
|
15
15
|
'application/vnd.oasis.opendocument.spreadsheet': microsoftExcel,
|
|
16
|
-
'text/csv':
|
|
16
|
+
'text/csv': fileCsvLight,
|
|
17
17
|
'application/msword': microsoftWord,
|
|
18
18
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': microsoftWord,
|
|
19
19
|
'application/vnd.oasis.opendocument.text': microsoftWord,
|
|
20
20
|
'application/rtf': microsoftWord,
|
|
21
|
-
'application/pdf':
|
|
22
|
-
'application/json':
|
|
23
|
-
'application/x-httpd-php':
|
|
24
|
-
'application/x-sh':
|
|
25
|
-
'application/xml':
|
|
26
|
-
'text/css':
|
|
27
|
-
'text/html':
|
|
28
|
-
'text/javascript':
|
|
29
|
-
'application/gzip':
|
|
30
|
-
'application/java-archive':
|
|
31
|
-
'application/zip':
|
|
32
|
-
'application/vnd.apple.installer+xml':
|
|
33
|
-
'application/vnd.rar':
|
|
34
|
-
'application/x-7z-compressed':
|
|
35
|
-
'application/x-bzip':
|
|
36
|
-
'application/x-bzip2':
|
|
37
|
-
'application/x-tar':
|
|
21
|
+
'application/pdf': filePdfLight,
|
|
22
|
+
'application/json': fileCodeLight,
|
|
23
|
+
'application/x-httpd-php': fileCodeLight,
|
|
24
|
+
'application/x-sh': fileCodeLight,
|
|
25
|
+
'application/xml': fileCodeLight,
|
|
26
|
+
'text/css': fileCodeLight,
|
|
27
|
+
'text/html': fileCodeLight,
|
|
28
|
+
'text/javascript': fileCodeLight,
|
|
29
|
+
'application/gzip': archiveLight,
|
|
30
|
+
'application/java-archive': archiveLight,
|
|
31
|
+
'application/zip': archiveLight,
|
|
32
|
+
'application/vnd.apple.installer+xml': archiveLight,
|
|
33
|
+
'application/vnd.rar': archiveLight,
|
|
34
|
+
'application/x-7z-compressed': archiveLight,
|
|
35
|
+
'application/x-bzip': archiveLight,
|
|
36
|
+
'application/x-bzip2': archiveLight,
|
|
37
|
+
'application/x-tar': archiveLight
|
|
38
38
|
};
|
|
39
39
|
const prefixes = {
|
|
40
|
-
image:
|
|
41
|
-
text:
|
|
42
|
-
video:
|
|
43
|
-
audio:
|
|
40
|
+
image: fileImageLight,
|
|
41
|
+
text: fileTextLight,
|
|
42
|
+
video: fileVideoLight,
|
|
43
|
+
audio: fileAudioLight
|
|
44
44
|
};
|
|
45
45
|
export function iconForMime(mime) {
|
|
46
|
-
return fileIconsByMime[mime] ?? prefixes[mime.split('/', 2)[0]] ??
|
|
46
|
+
return fileIconsByMime[mime] ?? prefixes[mime.split('/', 2)[0]] ?? fileLight;
|
|
47
47
|
}
|
|
@@ -73,10 +73,10 @@ function onSelectCategory() {
|
|
|
73
73
|
}
|
|
74
74
|
function onKeyDown(e) {
|
|
75
75
|
const currentSelectionIndex = visibleIcons.findIndex(i => i.class === selected.icon);
|
|
76
|
-
let newIndex;
|
|
77
76
|
if (modifierKey(e))
|
|
78
77
|
return;
|
|
79
|
-
|
|
78
|
+
let newIndex;
|
|
79
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowRight') {
|
|
80
80
|
e.preventDefault();
|
|
81
81
|
if (currentSelectionIndex === visibleIcons.length - 1) {
|
|
82
82
|
newIndex = 0;
|
|
@@ -124,11 +124,11 @@ function onKeyDown(e) {
|
|
|
124
124
|
{/each}
|
|
125
125
|
</select>
|
|
126
126
|
</div>
|
|
127
|
-
<fieldset
|
|
127
|
+
<fieldset>
|
|
128
128
|
<ScreenReaderOnly><legend class="sr-only">Icons</legend></ScreenReaderOnly>
|
|
129
|
-
<div class="icon-picker-items" role="radiogroup"
|
|
129
|
+
<div class="icon-picker-items" role="radiogroup">
|
|
130
130
|
{#each visibleIcons as icon, idx (icon.class)}
|
|
131
|
-
<div bind:this={iconElements[idx]} id={icon.class} class="icon-picker-item" role="radio" aria-checked={icon.class === selected.icon} tabindex={icon.class === selected.icon ? 0 : -1} data-index={idx} on:click={() => onSelectIcon(icon.class)}>
|
|
131
|
+
<div bind:this={iconElements[idx]} id={icon.class} class="icon-picker-item" role="radio" aria-checked={icon.class === selected.icon} tabindex={icon.class === selected.icon ? 0 : -1} data-index={idx} on:click={() => onSelectIcon(icon.class)} on:keydown={onKeyDown}>
|
|
132
132
|
<Icon icon={`${iconToPrefix[icon.class] === 'fab' ? 'fa-brands' : 'fa-solid'}:${icon.class.slice(3)}`}/>
|
|
133
133
|
<ScreenReaderOnly>{icon.label}</ScreenReaderOnly>
|
|
134
134
|
</div>
|
|
@@ -253,4 +253,4 @@ function onKeyDown(e) {
|
|
|
253
253
|
line-height: 250px;
|
|
254
254
|
color: #999;
|
|
255
255
|
}
|
|
256
|
-
</style>
|
|
256
|
+
</style>
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dosgato/dialog",
|
|
3
3
|
"description": "A component library for building forms that edit a JSON document.",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.19",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@txstate-mws/svelte-components": "^1.3.0",
|
|
7
|
-
"@txstate-mws/svelte-forms": "
|
|
7
|
+
"@txstate-mws/svelte-forms": ">=0.0.22",
|
|
8
8
|
"@iconify/svelte": "^2.2.1",
|
|
9
9
|
"@iconify-icons/mdi": "^1.2.22",
|
|
10
|
+
"@iconify-icons/ph": "^1.2.2",
|
|
10
11
|
"txstate-utils": "^1.7.3"
|
|
11
12
|
},
|
|
12
13
|
"devDependencies": {
|
|
@@ -36,6 +37,7 @@
|
|
|
36
37
|
"./FieldDateTime.svelte": "./FieldDateTime.svelte",
|
|
37
38
|
"./FieldDualListbox.svelte": "./FieldDualListbox.svelte",
|
|
38
39
|
"./FieldHidden.svelte": "./FieldHidden.svelte",
|
|
40
|
+
"./FieldIdentifier.svelte": "./FieldIdentifier.svelte",
|
|
39
41
|
"./FieldMultiple.svelte": "./FieldMultiple.svelte",
|
|
40
42
|
"./FieldMultiselect.svelte": "./FieldMultiselect.svelte",
|
|
41
43
|
"./FieldNumber.svelte": "./FieldNumber.svelte",
|
|
@@ -64,6 +66,9 @@
|
|
|
64
66
|
"./chooser/Page.svelte": "./chooser/Page.svelte",
|
|
65
67
|
"./chooser/Thumbnail.svelte": "./chooser/Thumbnail.svelte",
|
|
66
68
|
"./chooser": "./chooser/index.js",
|
|
69
|
+
"./colorpicker/FieldColorPicker.svelte": "./colorpicker/FieldColorPicker.svelte",
|
|
70
|
+
"./colorpicker/colorpicker": "./colorpicker/colorpicker.js",
|
|
71
|
+
"./colorpicker": "./colorpicker/index.js",
|
|
67
72
|
"./fileIcons": "./fileIcons.js",
|
|
68
73
|
"./iconpicker/FieldIconPicker.svelte": "./iconpicker/FieldIconPicker.svelte",
|
|
69
74
|
"./iconpicker/iconpicker": "./iconpicker/iconpicker.js",
|