@dosgato/dialog 1.1.21 → 1.1.23

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.
Files changed (50) hide show
  1. package/dist/Button.svelte.d.ts +6 -6
  2. package/dist/ButtonGroup.svelte.d.ts +4 -4
  3. package/dist/Checkbox.svelte.d.ts +4 -4
  4. package/dist/Container.svelte.d.ts +3 -3
  5. package/dist/Dialog.svelte.d.ts +9 -9
  6. package/dist/FieldAutocomplete.svelte.d.ts +8 -8
  7. package/dist/FieldCheckbox.svelte.d.ts +5 -5
  8. package/dist/FieldChoices.svelte.d.ts +5 -5
  9. package/dist/FieldChooserLink.svelte.d.ts +8 -8
  10. package/dist/FieldDate.svelte.d.ts +5 -5
  11. package/dist/FieldDateTime.svelte.d.ts +5 -5
  12. package/dist/FieldDualListbox.svelte.d.ts +7 -7
  13. package/dist/FieldHidden.svelte.d.ts +4 -4
  14. package/dist/FieldIdentifier.svelte.d.ts +1 -1
  15. package/dist/FieldMultiple.svelte.d.ts +7 -7
  16. package/dist/FieldMultiselect.svelte.d.ts +8 -8
  17. package/dist/FieldNumber.svelte.d.ts +6 -6
  18. package/dist/FieldRadio.svelte +1 -1
  19. package/dist/FieldRadio.svelte.d.ts +10 -10
  20. package/dist/FieldSelect.svelte.d.ts +12 -12
  21. package/dist/FieldStandard.svelte.d.ts +9 -9
  22. package/dist/FieldText.svelte +2 -1
  23. package/dist/FieldText.svelte.d.ts +11 -10
  24. package/dist/FieldTextArea.svelte +2 -1
  25. package/dist/FieldTextArea.svelte.d.ts +8 -7
  26. package/dist/FileIcon.svelte.d.ts +3 -3
  27. package/dist/Form.svelte.d.ts +41 -7
  28. package/dist/FormDialog.svelte.d.ts +8 -8
  29. package/dist/Icon.svelte.d.ts +1 -1
  30. package/dist/Input.svelte +2 -1
  31. package/dist/Input.svelte.d.ts +10 -9
  32. package/dist/Listbox.svelte.d.ts +6 -6
  33. package/dist/Radio.svelte.d.ts +4 -4
  34. package/dist/Switcher.svelte.d.ts +10 -10
  35. package/dist/Tabs.svelte.d.ts +3 -3
  36. package/dist/Tooltip.svelte.d.ts +5 -5
  37. package/dist/chooser/Chooser.svelte.d.ts +5 -5
  38. package/dist/chooser/Details.svelte.d.ts +1 -1
  39. package/dist/chooser/Thumbnail.svelte.d.ts +3 -3
  40. package/dist/chooser/UploadUI.svelte.d.ts +5 -5
  41. package/dist/code/CodeEditor.svelte.d.ts +4 -4
  42. package/dist/code/FieldCodeEditor.svelte.d.ts +9 -9
  43. package/dist/colorpicker/FieldColorPicker.svelte.d.ts +5 -5
  44. package/dist/cropper/FieldCropper.svelte.d.ts +4 -4
  45. package/dist/iconpicker/FieldIconPicker.svelte +7 -3
  46. package/dist/iconpicker/FieldIconPicker.svelte.d.ts +3 -3
  47. package/dist/imageposition/FieldImagePosition.svelte +70 -36
  48. package/dist/imageposition/FieldImagePosition.svelte.d.ts +3 -4
  49. package/dist/tree/Tree.svelte.d.ts +2 -2
  50. package/package.json +8 -9
@@ -1,14 +1,48 @@
1
1
  import { SvelteComponentTyped } from "svelte";
2
- declare class __sveltets_Render<T extends any, F extends any> {
3
- props(): any;
2
+ import { type FormStore, type Feedback, type SubmitResponse } from '@txstate-mws/svelte-forms';
3
+ import { type Client } from './';
4
+ declare class __sveltets_Render<T extends Record<string, any>, F extends any> {
5
+ props(): {
6
+ class?: string;
7
+ submit?: ((state: T) => Promise<SubmitResponse<T>>) | undefined;
8
+ validate?: ((state: T) => Promise<Feedback[]>) | undefined;
9
+ store?: FormStore<T> | undefined;
10
+ chooserClient?: Client<F> | undefined;
11
+ autocomplete?: string | undefined;
12
+ name?: string | undefined;
13
+ preload?: T | undefined;
14
+ };
4
15
  events(): {
16
+ saved: any;
17
+ } & {
5
18
  [evt: string]: CustomEvent<any>;
6
19
  };
7
- slots(): any;
20
+ slots(): {
21
+ default: {
22
+ messages: Feedback[];
23
+ allMessages: Feedback[];
24
+ saved: boolean;
25
+ validating: boolean;
26
+ submitting: boolean;
27
+ valid: boolean;
28
+ invalid: boolean;
29
+ showingInlineErrors: boolean;
30
+ data: Partial<T>;
31
+ };
32
+ submit: {
33
+ saved: boolean;
34
+ validating: boolean;
35
+ submitting: boolean;
36
+ allMessages: Feedback[];
37
+ valid: boolean;
38
+ invalid: boolean;
39
+ showingInlineErrors: boolean;
40
+ };
41
+ };
8
42
  }
9
- export type FormProps<T extends any, F extends any> = ReturnType<__sveltets_Render<T, F>['props']>;
10
- export type FormEvents<T extends any, F extends any> = ReturnType<__sveltets_Render<T, F>['events']>;
11
- export type FormSlots<T extends any, F extends any> = ReturnType<__sveltets_Render<T, F>['slots']>;
12
- export default class Form<T extends any, F extends any> extends SvelteComponentTyped<FormProps<T, F>, FormEvents<T, F>, FormSlots<T, F>> {
43
+ export type FormProps<T extends Record<string, any>, F extends any> = ReturnType<__sveltets_Render<T, F>['props']>;
44
+ export type FormEvents<T extends Record<string, any>, F extends any> = ReturnType<__sveltets_Render<T, F>['events']>;
45
+ export type FormSlots<T extends Record<string, any>, F extends any> = ReturnType<__sveltets_Render<T, F>['slots']>;
46
+ export default class Form<T extends Record<string, any>, F extends any> extends SvelteComponentTyped<FormProps<T, F>, FormEvents<T, F>, FormSlots<T, F>> {
13
47
  }
14
48
  export {};
@@ -2,17 +2,17 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import type { IconifyIcon } from '@iconify/svelte';
3
3
  import type { Feedback, FormStore, SubmitResponse } from '@txstate-mws/svelte-forms';
4
4
  import { type Client } from './';
5
- declare class __sveltets_Render<T extends any> {
5
+ declare class __sveltets_Render<T extends Record<string, any>> {
6
6
  props(): {
7
7
  submit: (state: T) => Promise<SubmitResponse<T>>;
8
8
  validate?: ((state: T) => Promise<Feedback[]>) | undefined;
9
9
  store?: FormStore<T> | undefined;
10
- chooserClient?: Client<any> | undefined;
10
+ chooserClient?: Client | undefined;
11
11
  autocomplete?: string | undefined;
12
12
  name?: string | undefined;
13
- title?: string | undefined;
13
+ title?: string;
14
14
  icon?: IconifyIcon | undefined;
15
- size?: "small" | "normal" | "tiny" | "large" | undefined;
15
+ size?: "tiny" | "small" | "normal" | "large";
16
16
  preload?: T | undefined;
17
17
  };
18
18
  events(): {
@@ -33,9 +33,9 @@ declare class __sveltets_Render<T extends any> {
33
33
  };
34
34
  };
35
35
  }
36
- export type FormDialogProps<T extends any> = ReturnType<__sveltets_Render<T>['props']>;
37
- export type FormDialogEvents<T extends any> = ReturnType<__sveltets_Render<T>['events']>;
38
- export type FormDialogSlots<T extends any> = ReturnType<__sveltets_Render<T>['slots']>;
39
- export default class FormDialog<T extends any> extends SvelteComponentTyped<FormDialogProps<T>, FormDialogEvents<T>, FormDialogSlots<T>> {
36
+ export type FormDialogProps<T extends Record<string, any>> = ReturnType<__sveltets_Render<T>['props']>;
37
+ export type FormDialogEvents<T extends Record<string, any>> = ReturnType<__sveltets_Render<T>['events']>;
38
+ export type FormDialogSlots<T extends Record<string, any>> = ReturnType<__sveltets_Render<T>['slots']>;
39
+ export default class FormDialog<T extends Record<string, any>> extends SvelteComponentTyped<FormDialogProps<T>, FormDialogEvents<T>, FormDialogSlots<T>> {
40
40
  }
41
41
  export {};
@@ -4,7 +4,7 @@ declare const __propDef: {
4
4
  props: {
5
5
  icon: IconifyIcon | undefined;
6
6
  /** Label used in a `<ScreenReaderOnly>`. */ hiddenLabel?: string | undefined;
7
- inline?: boolean | undefined;
7
+ inline?: boolean;
8
8
  width?: string | number | undefined;
9
9
  height?: string | number | undefined;
10
10
  tooltip?: string | undefined;
package/dist/Input.svelte CHANGED
@@ -7,6 +7,7 @@ export let name;
7
7
  export let value;
8
8
  export let type = 'text';
9
9
  export let allowlastpass = false;
10
+ export let placeholder = undefined;
10
11
  export let maxlength = undefined;
11
12
  export let min = undefined;
12
13
  export let max = undefined;
@@ -39,4 +40,4 @@ $: maxStr = resolveMinMax(max);
39
40
  </script>
40
41
 
41
42
  <!-- svelte-ignore a11y-autocomplete-valid -->
42
- <input bind:this={inputelement} {type} {id} {autocomplete} class={className} data-lpignore={!allowlastpass} {name} {value} {disabled} {maxlength} min={minStr} max={maxStr} {step} class:valid class:invalid aria-invalid={invalid} aria-describedby={isNotBlank(descby) ? descby : null} on:change={onChange} on:select={onSelect} on:blur={onBlur} on:keyup={onChange} use:passActions={use}>
43
+ <input bind:this={inputelement} {type} {id} {autocomplete} {placeholder} class={className} data-lpignore={!allowlastpass} {name} {value} {disabled} {maxlength} min={minStr} max={maxStr} {step} class:valid class:invalid aria-invalid={invalid} aria-describedby={isNotBlank(descby) ? descby : null} on:change={onChange} on:select={onSelect} on:blur={onBlur} on:keyup={onChange} use:passActions={use}>
@@ -2,11 +2,12 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import { type HTMLActionEntry } from '@txstate-mws/svelte-components';
3
3
  declare const __propDef: {
4
4
  props: {
5
- class?: string | undefined;
5
+ class?: string;
6
6
  name: string;
7
7
  value: string;
8
- type?: string | undefined;
9
- allowlastpass?: boolean | undefined;
8
+ type?: string;
9
+ allowlastpass?: boolean;
10
+ placeholder?: string | undefined;
10
11
  maxlength?: number | undefined;
11
12
  min?: string | Date | {
12
13
  toJSDate: () => Date;
@@ -16,18 +17,18 @@ declare const __propDef: {
16
17
  } | number | undefined;
17
18
  step?: number | undefined;
18
19
  id?: string | undefined;
19
- disabled?: boolean | undefined;
20
- autocomplete?: string | undefined;
20
+ disabled?: boolean;
21
+ autocomplete?: string;
21
22
  extradescid?: string | undefined;
22
23
  messagesid?: string | undefined;
23
24
  helptextid?: string | undefined;
24
- valid?: boolean | undefined;
25
- invalid?: boolean | undefined;
25
+ valid?: boolean;
26
+ invalid?: boolean;
26
27
  onChange: any;
27
28
  onBlur: any;
28
29
  onSelect?: any;
29
- use?: HTMLActionEntry[] | undefined;
30
- inputelement?: HTMLInputElement | undefined;
30
+ use?: HTMLActionEntry[];
31
+ inputelement?: HTMLInputElement;
31
32
  };
32
33
  events: {
33
34
  [evt: string]: CustomEvent<any>;
@@ -2,16 +2,16 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import { type PopupMenuItem } from '@txstate-mws/svelte-components';
3
3
  declare const __propDef: {
4
4
  props: {
5
- items?: PopupMenuItem[] | undefined;
5
+ items?: PopupMenuItem[];
6
6
  label: string;
7
- multiselect?: boolean | undefined;
7
+ multiselect?: boolean;
8
8
  selected?: {
9
9
  value: string;
10
- label?: string | undefined;
11
- }[] | undefined;
10
+ label?: string;
11
+ }[];
12
12
  descid?: string | undefined;
13
- valid?: boolean | undefined;
14
- invalid?: boolean | undefined;
13
+ valid?: boolean;
14
+ invalid?: boolean;
15
15
  };
16
16
  events: {
17
17
  change: CustomEvent<any>;
@@ -4,15 +4,15 @@ declare const __propDef: {
4
4
  id?: string | undefined;
5
5
  name: string;
6
6
  value: string;
7
- selected?: boolean | undefined;
7
+ selected?: boolean;
8
8
  onChange?: any;
9
9
  onBlur?: any;
10
10
  messagesid?: string | undefined;
11
11
  helptextid?: string | undefined;
12
12
  extradescid?: string | undefined;
13
- disabled?: boolean | undefined;
14
- valid?: boolean | undefined;
15
- invalid?: boolean | undefined;
13
+ disabled?: boolean;
14
+ valid?: boolean;
15
+ invalid?: boolean;
16
16
  };
17
17
  events: {
18
18
  [evt: string]: CustomEvent<any>;
@@ -2,25 +2,25 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import type { Feedback } from '@txstate-mws/svelte-forms';
3
3
  declare const __propDef: {
4
4
  props: {
5
- class?: string | undefined;
5
+ class?: string;
6
6
  id?: string | undefined;
7
- path?: string | undefined;
8
- name?: string | undefined;
7
+ path?: string;
8
+ name?: string;
9
9
  choices: {
10
10
  label?: string;
11
11
  value: string;
12
12
  disabled?: boolean;
13
13
  }[];
14
- horizontal?: boolean | undefined;
14
+ horizontal?: boolean;
15
15
  label: string;
16
- required?: boolean | undefined;
17
- related?: number | true | undefined;
16
+ required?: boolean;
17
+ related?: true | number;
18
18
  extradescid?: string | undefined;
19
19
  helptext?: string | undefined;
20
- messages?: Feedback[] | undefined;
21
- iptValue?: string | undefined;
22
- valid?: boolean | undefined;
23
- invalid?: boolean | undefined;
20
+ messages?: Feedback[];
21
+ iptValue?: string;
22
+ valid?: boolean;
23
+ invalid?: boolean;
24
24
  onBlur?: (() => void | Promise<void>) | undefined;
25
25
  };
26
26
  events: {
@@ -4,9 +4,9 @@ declare const __propDef: {
4
4
  props: {
5
5
  tabs: TabDef[];
6
6
  active?: string | undefined;
7
- store?: TabStore | undefined;
8
- disableDialogControl?: boolean | undefined;
9
- accordionOnMobile?: boolean | undefined;
7
+ store?: TabStore;
8
+ disableDialogControl?: boolean;
9
+ accordionOnMobile?: boolean;
10
10
  /**
11
11
  * Takes the width of the tabs area, in pixels, and returns the number of tabs that should be
12
12
  * displayed at that width.
@@ -2,11 +2,11 @@ import { SvelteComponentTyped } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  tip?: string | undefined;
5
- top?: boolean | undefined;
6
- right?: boolean | undefined;
7
- bottom?: boolean | undefined;
8
- left?: boolean | undefined;
9
- active?: boolean | undefined;
5
+ top?: boolean;
6
+ right?: boolean;
7
+ bottom?: boolean;
8
+ left?: boolean;
9
+ active?: boolean;
10
10
  };
11
11
  events: {
12
12
  [evt: string]: CustomEvent<any>;
@@ -4,11 +4,11 @@ import { ChooserStore } from './ChooserStore';
4
4
  declare class __sveltets_Render<F> {
5
5
  props(): {
6
6
  label?: string | undefined;
7
- images?: boolean | undefined;
8
- pages?: boolean | undefined;
9
- assets?: boolean | undefined;
10
- folders?: boolean | undefined;
11
- required?: boolean | undefined;
7
+ images?: boolean;
8
+ pages?: boolean;
9
+ assets?: boolean;
10
+ folders?: boolean;
11
+ required?: boolean;
12
12
  initialSource?: string | undefined;
13
13
  initialPath?: string | undefined;
14
14
  activeSources?: string[] | undefined;
@@ -4,7 +4,7 @@ import { type BrokenURL, type RawURL } from './ChooserStore';
4
4
  declare const __propDef: {
5
5
  props: {
6
6
  item: AnyItem | RawURL | BrokenURL;
7
- singleLine?: boolean | undefined;
7
+ singleLine?: boolean;
8
8
  };
9
9
  events: {
10
10
  [evt: string]: CustomEvent<any>;
@@ -4,9 +4,9 @@ import type { BrokenURL, RawURL } from './ChooserStore';
4
4
  declare const __propDef: {
5
5
  props: {
6
6
  item: AnyItem | RawURL | BrokenURL;
7
- larger?: boolean | undefined;
8
- expandable?: boolean | undefined;
9
- expanded?: boolean | undefined;
7
+ larger?: boolean;
8
+ expandable?: boolean;
9
+ expanded?: boolean;
10
10
  };
11
11
  events: {
12
12
  thumbnailsizechange: CustomEvent<any>;
@@ -4,11 +4,11 @@ declare const __propDef: {
4
4
  props: {
5
5
  title: string;
6
6
  folder: Folder;
7
- maxFiles?: number | undefined;
8
- escapable?: boolean | undefined;
9
- mimeWhitelist?: string[] | undefined;
10
- mimeBlacklist?: string[] | undefined;
11
- uploader: NonNullable<Client['upload']>;
7
+ maxFiles?: number;
8
+ escapable?: boolean;
9
+ mimeWhitelist?: string[];
10
+ mimeBlacklist?: string[];
11
+ uploader: NonNullable<Client["upload"]>;
12
12
  };
13
13
  events: {
14
14
  saved: CustomEvent<any>;
@@ -2,11 +2,11 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import { type HTMLActionEntry } from '@txstate-mws/svelte-components';
3
3
  declare const __propDef: {
4
4
  props: {
5
- class?: string | undefined;
5
+ class?: string;
6
6
  id?: string | undefined;
7
- rows?: number | undefined;
8
- language: 'js' | 'css' | 'html';
9
- use?: HTMLActionEntry[] | undefined;
7
+ rows?: number;
8
+ language: "js" | "css" | "html";
9
+ use?: HTMLActionEntry[];
10
10
  inputelement?: HTMLElement | undefined;
11
11
  extradescid?: string | undefined;
12
12
  helptextid?: string | undefined;
@@ -2,21 +2,21 @@ import { SvelteComponentTyped } from "svelte";
2
2
  import type { HTMLActionEntry } from '@txstate-mws/svelte-components';
3
3
  declare const __propDef: {
4
4
  props: {
5
- class?: string | undefined;
5
+ class?: string;
6
6
  id?: string | undefined;
7
7
  path: string;
8
- label?: string | undefined;
9
- notNull?: boolean | undefined;
8
+ label?: string;
9
+ notNull?: boolean;
10
10
  defaultValue?: any;
11
- rows?: number | undefined;
11
+ rows?: number;
12
12
  conditional?: boolean | undefined;
13
- required?: boolean | undefined;
14
- use?: HTMLActionEntry[] | undefined;
15
- inputelement?: HTMLElement | undefined;
16
- related?: number | true | undefined;
13
+ required?: boolean;
14
+ use?: HTMLActionEntry[];
15
+ inputelement?: HTMLElement;
16
+ related?: true | number;
17
17
  extradescid?: string | undefined;
18
18
  helptext?: string | undefined;
19
- language: 'js' | 'css' | 'html';
19
+ language: "js" | "css" | "html";
20
20
  };
21
21
  events: {
22
22
  paste: ClipboardEvent;
@@ -3,13 +3,13 @@ import type { ColorPickerOption } from './colorpicker';
3
3
  declare const __propDef: {
4
4
  props: {
5
5
  id?: string | undefined;
6
- class?: string | undefined;
6
+ class?: string;
7
7
  path: string;
8
8
  options: ColorPickerOption[];
9
- addAllOption?: boolean | undefined;
10
- label?: string | undefined;
11
- required?: boolean | undefined;
12
- notNull?: boolean | undefined;
9
+ addAllOption?: boolean;
10
+ label?: string;
11
+ required?: boolean;
12
+ notNull?: boolean;
13
13
  defaultValue?: any;
14
14
  conditional?: boolean | undefined;
15
15
  helptext?: string | undefined;
@@ -4,10 +4,10 @@ declare const __propDef: {
4
4
  id?: string | undefined;
5
5
  path: string;
6
6
  imageSrc: string | undefined;
7
- selectionAspectRatio?: number | undefined;
8
- minSelection?: number | undefined;
9
- label?: string | undefined;
10
- required?: boolean | undefined;
7
+ selectionAspectRatio?: number;
8
+ minSelection?: number;
9
+ label?: string;
10
+ required?: boolean;
11
11
  conditional?: boolean | undefined;
12
12
  helptext?: string | undefined;
13
13
  };
@@ -48,10 +48,11 @@ function onCancel(val) {
48
48
  }
49
49
  function onSearch() {
50
50
  visibleIcons = FontAwesomeIcons.filter(i => {
51
- if (i.class.includes(searchVal))
51
+ const searchValLC = searchVal.toLowerCase();
52
+ if (i.class.toLowerCase().includes(searchValLC))
52
53
  return true;
53
54
  for (const term of i.search.terms) {
54
- if (term.includes(searchVal))
55
+ if (term.toLowerCase().includes(searchValLC))
55
56
  return true;
56
57
  }
57
58
  return false;
@@ -128,7 +129,7 @@ function onKeyDown(e) {
128
129
  </div>
129
130
  <fieldset>
130
131
  <ScreenReaderOnly><legend class="sr-only">Icons</legend></ScreenReaderOnly>
131
- <div class="icon-picker-items" role="radiogroup">
132
+ <div class="icon-picker-items" role="radiogroup" class:empty={visibleIcons.length === 0}>
132
133
  {#each visibleIcons as icon, idx (icon.class)}
133
134
 
134
135
  <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}>
@@ -244,6 +245,9 @@ function onKeyDown(e) {
244
245
  justify-items: center;
245
246
  align-items: center;
246
247
  }
248
+ .icon-picker-items.empty {
249
+ display: block;
250
+ }
247
251
 
248
252
  @media (max-width: 800px) {
249
253
  .icon-picker-items {
@@ -3,12 +3,12 @@ declare const __propDef: {
3
3
  props: {
4
4
  id?: string | undefined;
5
5
  path: string;
6
- label?: string | undefined;
7
- required?: boolean | undefined;
6
+ label?: string;
7
+ required?: boolean;
8
8
  defaultValue?: {
9
9
  icon: string;
10
10
  prefix: string;
11
- } | undefined;
11
+ };
12
12
  conditional?: boolean | undefined;
13
13
  helptext?: string | undefined;
14
14
  };
@@ -3,7 +3,6 @@ import FieldStandard from '../FieldStandard.svelte';
3
3
  import Button from '../Button.svelte';
4
4
  import arrowsIn from '@iconify-icons/ph/arrows-in';
5
5
  import { Dialog } from '..';
6
- import { onMount } from 'svelte';
7
6
  import { modifierKey, ScreenReaderOnly } from '@txstate-mws/svelte-components';
8
7
  export let id = undefined;
9
8
  export let path;
@@ -12,7 +11,6 @@ export let label = '';
12
11
  export let required = false;
13
12
  export let conditional = undefined;
14
13
  export let helptext = undefined;
15
- export let info = undefined;
16
14
  export let defaultValue = { x: 50, y: 50 };
17
15
  let initialVal;
18
16
  function init(v) {
@@ -34,10 +32,6 @@ function hideModal() {
34
32
  modalOpen = false;
35
33
  }
36
34
  let x, y;
37
- onMount(() => {
38
- x = initialVal?.x / 25;
39
- y = initialVal?.y / 25;
40
- });
41
35
  function onSave(setVal) {
42
36
  setVal({ x: x * 25, y: y * 25 });
43
37
  hideModal();
@@ -105,50 +99,79 @@ const positionText = {
105
99
  4: 'Bottom Right Corner'
106
100
  }
107
101
  };
102
+ let dialogWasOpened = false;
103
+ function onDialogOpen() {
104
+ if (!dialogWasOpened) {
105
+ x = (initialVal.x ?? 50) / 25;
106
+ y = (initialVal.y ?? 50) / 25;
107
+ dialogWasOpened = true;
108
+ }
109
+ }
110
+ function resetPosition() {
111
+ x = 2;
112
+ y = 2;
113
+ }
108
114
  </script>
109
115
 
110
116
  <FieldStandard bind:id {label} {path} {required} {defaultValue} conditional={conditional && isNotBlank(imageSrc)} {helptext} {descid} let:value let:setVal let:helptextid>
111
117
  {@const _ = init(value)}
112
118
  {#if isNotBlank(imageSrc)}
113
119
  <Button icon={arrowsIn} on:click={showModal}>Adjust Image Position</Button>
114
- {#if modalOpen}
115
- <Dialog size="large" title={label} on:escape={hideModal} continueText="Save" cancelText="Cancel" on:continue={() => onSave(setVal)} {labelid}>
116
- {#if info}
117
- <section class="info">
118
- {info}
119
- </section>
120
- <section class="position">
121
- <p>
122
- Using the grid overlays, select a focal point in your image to determine how Gato will align, position, and scale your image
123
- in the section. This will help ensure the focal point of your image is always in frame. By default, Gato will
124
- use the center of the image.
125
- </p>
126
- <div class="image-container">
127
- <img class="crop-image" src={imageSrc} alt="" />
128
- <div class="overlay" role="radiogroup" aria-labelledby={labelid}>
129
- {#each Array.from(Array(5).keys()) as col}
130
- {#each Array.from(Array(5).keys()) as row}
131
- <div
132
- bind:this={boxes[col + row * 5]}
133
- class="box"
134
- class:side={row === 4}
135
- class:bottom={col === 4}
136
- role="radio"
137
- aria-checked={row === x && col === y}
138
- tabindex={row === x && col === y ? 0 : -1}
139
- on:click={() => onSelectBox(row, col)} on:keydown={onKeyDown}><ScreenReaderOnly>{positionText[row][col]}</ScreenReaderOnly></div>
140
- {/each}
120
+ {#if modalOpen}
121
+ <Dialog size="large" title={label} on:escape={hideModal} continueText="Save" cancelText="Cancel" on:continue={() => onSave(setVal)} {labelid}>
122
+ {@const _dialogopen = onDialogOpen()}
123
+ <section class="info">
124
+ <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>
125
+ <div class="warning">
126
+ <div class="icon">
127
+ <svg width="100%" height="100%" viewBox="0 0 24 23" fill="none" xmlns="http://www.w3.org/2000/svg">
128
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M21.7931 17.9114C22.0668 18.4197 22.0668 19.0061 21.7931 19.4752C21.5195 19.9834 21.0112 20.2571 20.4639 20.2571H3.57518C2.98876 20.2571 2.48054 19.9834 2.20688 19.4752C1.93322 19.0061 1.93322 18.4197 2.20688 17.9114L10.6512 3.52473C10.9249 3.05559 11.4331 2.74284 12.0195 2.74284C12.5669 2.74284 13.0751 3.05559 13.3488 3.52473L21.7931 17.9114ZM15.0762 2.51348L15.0777 2.51616L23.538 16.93L23.5555 16.9625C24.1294 18.0283 24.1722 19.3444 23.5393 20.454C22.8879 21.637 21.6838 22.2587 20.4639 22.2587H3.57518C2.34516 22.2587 1.12477 21.6603 0.460681 20.4539C-0.172198 19.3444 -0.129382 18.0282 0.444499 16.9625L0.461978 16.93L8.92228 2.51616L8.92396 2.51329C9.54626 1.44877 10.7019 0.741211 12.0195 0.741211C13.326 0.741211 14.4684 1.47375 15.0762 2.51348ZM12.9067 13.3785C12.9398 13.2815 12.9578 13.1759 12.9578 13.0637V8.68517C12.9578 8.17695 12.5278 7.74691 12.0195 7.74691C11.4722 7.74691 11.0813 8.17695 11.0813 8.68517V13.0637C11.0813 13.1745 11.0973 13.2788 11.1274 13.3748C11.2459 13.7532 11.583 14.002 12.0195 14.002C12.4236 14.002 12.7783 13.7548 12.9067 13.3785ZM10.9757 15.8208C10.8443 16.0203 10.7685 16.2567 10.7685 16.504C10.7685 17.2077 11.3158 17.7551 12.0195 17.7551C12.6842 17.7551 13.2706 17.2077 13.2706 16.504C13.2706 16.2554 13.1885 16.0178 13.051 15.8177C12.8209 15.4828 12.4355 15.253 12.0195 15.253C11.5777 15.253 11.1975 15.4842 10.9757 15.8208Z" fill="black"/>
129
+ </svg>
130
+ </div>
131
+ <p>If there is sensitive content in the image that should never be visible to the audience, crop or edit the file in an editing software before uploading. </p>
132
+ </div>
133
+ <p>Using the grid overlays, select a focal point in your image to determine how Gato will align, position, and scale your image in the section. This will help ensure the focal point of your image is always in frame. By default, Gato will use the center of the image.</p>
134
+ </section>
135
+ <section class="position">
136
+ <div class="image-container">
137
+ <img class="crop-image" src={imageSrc} alt="" />
138
+ <div class="overlay" role="radiogroup" aria-labelledby={labelid}>
139
+ {#each Array.from(Array(5).keys()) as col}
140
+ {#each Array.from(Array(5).keys()) as row}
141
+ <div
142
+ bind:this={boxes[col + row * 5]}
143
+ class="box"
144
+ class:side={row === 4}
145
+ class:bottom={col === 4}
146
+ role="radio"
147
+ aria-checked={row === x && col === y}
148
+ tabindex={row === x && col === y ? 0 : -1}
149
+ on:click={() => onSelectBox(row, col)} on:keydown={onKeyDown}><ScreenReaderOnly>{positionText[row][col]}</ScreenReaderOnly></div>
141
150
  {/each}
142
- </div>
151
+ {/each}
143
152
  </div>
144
- </section>
145
- {/if}
153
+ </div>
154
+ <div class="button-container">
155
+ <Button type="button" class="reset-position" on:click={resetPosition}>Reset Position</Button>
156
+ </div>
157
+ </section>
146
158
  </Dialog>
147
159
  {/if}
148
160
  {/if}
149
161
  </FieldStandard>
150
162
 
151
163
  <style>
164
+ .warning {
165
+ display: flex;
166
+ gap: 1.5em;
167
+ background-color: #F3D690;
168
+ padding: 0.5em;
169
+ border-radius: 6px;
170
+ }
171
+ .warning .icon {
172
+ font-size: 3em;
173
+ width: 1em;
174
+ }
152
175
  section.position {
153
176
  border: 1px dashed #767676;
154
177
  padding: 1em;
@@ -159,6 +182,7 @@ const positionText = {
159
182
  .image-container {
160
183
  width: 75%;
161
184
  position: relative;
185
+ margin-bottom: 1em;
162
186
  }
163
187
  .crop-image {
164
188
  width: 100%;
@@ -188,6 +212,16 @@ const positionText = {
188
212
  .overlay .box.bottom {
189
213
  border-bottom-width: 0;
190
214
  }
215
+ .button-container {
216
+ width: 100%;
217
+ }
218
+ :global(button.reset-position.reset-position) {
219
+ background-color: var(--dg-button-cancel-bg, #808080);
220
+ color: var(--dg-button-cancel-text, #fff);
221
+ }
222
+ :global(button.reset-position.reset-position):not([disabled]):hover {
223
+ background-color: var(--dg-button-cancel-hover-bg, #595959);
224
+ }
191
225
 
192
226
  </style>
193
227
 
@@ -5,12 +5,11 @@ declare const __propDef: {
5
5
  id?: string | undefined;
6
6
  path: string;
7
7
  imageSrc: string | undefined;
8
- label?: string | undefined;
9
- required?: boolean | undefined;
8
+ label?: string;
9
+ required?: boolean;
10
10
  conditional?: boolean | undefined;
11
11
  helptext?: string | undefined;
12
- info?: string | undefined;
13
- defaultValue?: ImagePositionOutput | undefined;
12
+ defaultValue?: ImagePositionOutput;
14
13
  };
15
14
  events: {
16
15
  [evt: string]: CustomEvent<any>;