@dosgato/dialog 1.3.8 → 1.3.9
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/FieldChooserLink.svelte +7 -5
- package/dist/FieldChooserLink.svelte.d.ts +1 -0
- package/dist/chooser/AssetTabs.svelte +2 -1
- package/dist/chooser/AssetTabs.svelte.d.ts +1 -0
- package/dist/cropper/FieldCropper.svelte +26 -35
- package/dist/cropper/cropper.js +44 -1
- package/dist/iconpicker/FieldIconPicker.svelte +2 -2
- package/dist/iconpicker/iconpicker.js +417 -355
- package/dist/imageposition/FieldImagePosition.svelte +16 -25
- package/package.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import arrowsIn from '@iconify-icons/ph/arrows-in'
|
|
3
|
+
import { modifierKey, ScreenReaderOnly } from '@txstate-mws/svelte-components'
|
|
4
|
+
import { FORM_CONTEXT, FORM_INHERITED_PATH, type FormStore } from '@txstate-mws/svelte-forms'
|
|
5
|
+
import { getContext } from 'svelte'
|
|
2
6
|
import { isNotBlank, randomid } from 'txstate-utils'
|
|
3
7
|
import FieldStandard from '../FieldStandard.svelte'
|
|
4
8
|
import Button from '../Button.svelte'
|
|
5
|
-
import arrowsIn from '@iconify-icons/ph/arrows-in'
|
|
6
9
|
import { Dialog, type ImagePositionOutput } from '..'
|
|
7
|
-
import { modifierKey, ScreenReaderOnly } from '@txstate-mws/svelte-components'
|
|
8
10
|
|
|
9
11
|
export let id: string | undefined = undefined
|
|
10
12
|
export let path: string
|
|
@@ -15,22 +17,22 @@
|
|
|
15
17
|
export let helptext: string | undefined = undefined
|
|
16
18
|
export let defaultValue: ImagePositionOutput = { x: 50, y: 50 }
|
|
17
19
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} else {
|
|
23
|
-
initialVal = defaultValue
|
|
24
|
-
}
|
|
25
|
-
}
|
|
20
|
+
const inheritedPath = getContext<string>(FORM_INHERITED_PATH)
|
|
21
|
+
const finalPath = [inheritedPath, path].filter(isNotBlank).join('.')
|
|
22
|
+
const store = getContext<FormStore>(FORM_CONTEXT)
|
|
23
|
+
const val = store.getField<ImagePositionOutput>(finalPath)
|
|
26
24
|
|
|
27
25
|
const boxes: HTMLDivElement[] = []
|
|
28
26
|
|
|
29
27
|
const descid = randomid()
|
|
30
28
|
const labelid = randomid()
|
|
31
|
-
let modalOpen: boolean = false
|
|
32
29
|
|
|
30
|
+
let modalOpen: boolean = false
|
|
33
31
|
function showModal () {
|
|
32
|
+
if (!modalOpen) {
|
|
33
|
+
x = ($val?.x ?? 50) / 25
|
|
34
|
+
y = ($val?.y ?? 50) / 25
|
|
35
|
+
}
|
|
34
36
|
modalOpen = true
|
|
35
37
|
}
|
|
36
38
|
|
|
@@ -38,7 +40,7 @@
|
|
|
38
40
|
modalOpen = false
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
let x, y
|
|
43
|
+
let x: number, y: number
|
|
42
44
|
|
|
43
45
|
function onSave (setVal) {
|
|
44
46
|
setVal({ x: x * 25, y: y * 25 })
|
|
@@ -108,28 +110,17 @@
|
|
|
108
110
|
}
|
|
109
111
|
}
|
|
110
112
|
|
|
111
|
-
let dialogWasOpened = false
|
|
112
|
-
function onDialogOpen () {
|
|
113
|
-
if (!dialogWasOpened) {
|
|
114
|
-
x = (initialVal.x ?? 50) / 25
|
|
115
|
-
y = (initialVal.y ?? 50) / 25
|
|
116
|
-
dialogWasOpened = true
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
113
|
function resetPosition () {
|
|
121
114
|
x = 2
|
|
122
115
|
y = 2
|
|
123
116
|
}
|
|
124
117
|
</script>
|
|
125
118
|
|
|
126
|
-
<FieldStandard bind:id {label} {path} {required} {defaultValue} conditional={conditional && isNotBlank(imageSrc)} {helptext} {descid} let:
|
|
127
|
-
{@const _ = init(value)}
|
|
119
|
+
<FieldStandard bind:id {label} {path} {required} {defaultValue} conditional={conditional && isNotBlank(imageSrc)} {helptext} {descid} let:setVal let:helptextid>
|
|
128
120
|
{#if isNotBlank(imageSrc)}
|
|
129
121
|
<Button icon={arrowsIn} on:click={showModal}>Adjust Image Position</Button>
|
|
130
122
|
{#if modalOpen}
|
|
131
123
|
<Dialog size="large" title={label} on:escape={hideModal} continueText="Save" cancelText="Cancel" on:continue={() => onSave(setVal)} {labelid}>
|
|
132
|
-
{@const _dialogopen = onDialogOpen()}
|
|
133
124
|
<section class="info">
|
|
134
125
|
<p>This image is in a responsive layout, meaning the size and shape of the image may change based on the viewer’s browser window and device.</p>
|
|
135
126
|
<div class="warning">
|
|
@@ -155,6 +146,7 @@
|
|
|
155
146
|
class:bottom={col === 4}
|
|
156
147
|
role="radio"
|
|
157
148
|
aria-checked={row === x && col === y}
|
|
149
|
+
aria-describedby={helptextid}
|
|
158
150
|
tabindex={row === x && col === y ? 0 : -1}
|
|
159
151
|
on:click={() => onSelectBox(row, col)} on:keydown={onKeyDown}><ScreenReaderOnly>{positionText[row][col]}</ScreenReaderOnly></div>
|
|
160
152
|
{/each}
|
|
@@ -233,4 +225,3 @@
|
|
|
233
225
|
background-color: var(--dg-button-cancel-hover-bg, #595959);
|
|
234
226
|
}
|
|
235
227
|
</style>
|
|
236
|
-
|
package/package.json
CHANGED