@dosgato/dialog 1.1.16 → 1.1.18

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.
@@ -9,9 +9,9 @@ declare const __propDef: {
9
9
  notNull?: boolean | undefined;
10
10
  disabled?: boolean | undefined;
11
11
  choices: {
12
- label?: string | undefined;
12
+ label?: string;
13
13
  value: string;
14
- disabled?: boolean | undefined;
14
+ disabled?: boolean;
15
15
  }[];
16
16
  defaultValue?: string | undefined;
17
17
  conditional?: boolean | undefined;
@@ -6,9 +6,9 @@ declare const __propDef: {
6
6
  path: string;
7
7
  label?: string | undefined;
8
8
  choices: {
9
- label?: string | undefined;
9
+ label?: string;
10
10
  value: any;
11
- disabled?: boolean | undefined;
11
+ disabled?: boolean;
12
12
  }[];
13
13
  defaultValue?: any;
14
14
  conditional?: boolean | undefined;
@@ -4,7 +4,7 @@ declare const __propDef: {
4
4
  props: {
5
5
  path: string;
6
6
  label: string;
7
- initialState?: any;
7
+ initialState?: any | ((index: number) => any);
8
8
  minLength?: number | undefined;
9
9
  maxLength?: number | undefined;
10
10
  compact?: boolean | undefined;
@@ -35,7 +35,7 @@ async function reactToChoices(..._) {
35
35
  if (!choices.length) {
36
36
  return await store.setField(finalPath, finalDeserialize(''));
37
37
  }
38
- const val = get($store, finalPath);
38
+ const val = get($store.data, finalPath);
39
39
  if (!choices.some(o => o.value === finalDeserialize(val)))
40
40
  await store.setField(finalPath, notNull ? defaultValue : finalDeserialize(''));
41
41
  }
@@ -7,9 +7,9 @@ declare const __propDef: {
7
7
  label?: string | undefined;
8
8
  notNull?: boolean | undefined;
9
9
  choices: {
10
- label?: string | undefined;
10
+ label?: string;
11
11
  value: any;
12
- disabled?: boolean | undefined;
12
+ disabled?: boolean;
13
13
  }[];
14
14
  defaultValue?: any;
15
15
  conditional?: boolean | undefined;
@@ -9,9 +9,9 @@ declare const __propDef: {
9
9
  notNull?: boolean | undefined;
10
10
  disabled?: boolean | undefined;
11
11
  choices: {
12
- label?: string | undefined;
12
+ label?: string;
13
13
  value: any;
14
- disabled?: boolean | undefined;
14
+ disabled?: boolean;
15
15
  }[];
16
16
  defaultValue?: any;
17
17
  conditional?: boolean | undefined;
package/dist/Form.svelte CHANGED
@@ -18,6 +18,7 @@ setContext(CHOOSER_API_CONTEXT, chooserClient);
18
18
  <slot {messages} {saved} {validating} {submitting} {valid} {invalid} {data} {allMessages} {showingInlineErrors} />
19
19
  {@const errorMessages = messages.filter(m => m.type === 'error' || m.type === 'system')}
20
20
  {@const warningMessages = messages.filter(m => m.type === 'warning')}
21
+ {@const infoMessages = messages.filter(m => m.type === 'info')}
21
22
  {@const successMessages = messages.filter(m => m.type === 'success')}
22
23
  {#if errorMessages.length || showingInlineErrors}
23
24
  <ul class="form-errors" aria-live='assertive'>
@@ -36,6 +37,13 @@ setContext(CHOOSER_API_CONTEXT, chooserClient);
36
37
  {/each}
37
38
  </ul>
38
39
  {/if}
40
+ {#if infoMessages.length}
41
+ <ul class="form-info" aria-live='assertive'>
42
+ {#each infoMessages as message}
43
+ <li><Icon icon={messageIcons.info} inline hiddenLabel="info"/> {message.message}</li>
44
+ {/each}
45
+ </ul>
46
+ {/if}
39
47
  {#if successMessages.length}
40
48
  <ul class="form-successes" aria-live='assertive'>
41
49
  {#each successMessages as message}
@@ -68,6 +76,10 @@ setContext(CHOOSER_API_CONTEXT, chooserClient);
68
76
  background-color: var(--dg-warning-bg, #ffc107);
69
77
  color: var(--dg-warning-text, black);
70
78
  }
79
+ .form-info {
80
+ background-color: var(--dg-info-bg, #619bff);
81
+ color: var(--dg-info-text, black);
82
+ }
71
83
  .form-successes {
72
84
  background-color: var(--dg-success-bg, #218739);
73
85
  color: var(--dg-success-text, white);
@@ -2,20 +2,11 @@
2
2
  The purpose of this component is to provide common `Feedback` message styling with icons that support screen readers.
3
3
  -->
4
4
  <script>import { htmlEncode } from 'txstate-utils';
5
- import { messageIcons } from './';
5
+ import { messageIcons, messageLabels } from './';
6
6
  import Icon from './Icon.svelte';
7
7
  export let message;
8
8
  $: icon = messageIcons[message.type] ?? messageIcons.error;
9
- // Would we like to add something like the following for non-Error message types being used in aria descriptions?
10
- /*
11
- const ariaLables = {
12
- error: 'Error',
13
- warning: 'Warning',
14
- success: 'Success',
15
- system: 'System'
16
- }
17
- $: hiddenLabel = ariaLables[message.type] ?? 'Error'
18
- */
9
+ $: iconLabel = messageLabels[message.type] ?? messageLabels.error;
19
10
  function addMarkup(msg) {
20
11
  const lines = msg.split(/\r?\n/);
21
12
  const output = [];
@@ -43,7 +34,7 @@ function addMarkup(msg) {
43
34
  }
44
35
  </script>
45
36
 
46
- <div class={message.type}><Icon width='1.5em' {icon} inline hiddenLabel='Error' /><span>{@html addMarkup(message.message)}</span></div>
37
+ <div class={message.type}><Icon width='1.5em' {icon} inline hiddenLabel={iconLabel} /><span>{@html addMarkup(message.message)}</span></div>
47
38
 
48
39
  <style>
49
40
  div {
@@ -7,9 +7,9 @@ declare const __propDef: {
7
7
  path?: string | undefined;
8
8
  name?: string | undefined;
9
9
  choices: {
10
- label?: string | undefined;
10
+ label?: string;
11
11
  value: string;
12
- disabled?: boolean | undefined;
12
+ disabled?: boolean;
13
13
  }[];
14
14
  horizontal?: boolean | undefined;
15
15
  label: string;
@@ -3,4 +3,12 @@ export declare const messageIcons: {
3
3
  warning: import("@iconify/types").IconifyIcon;
4
4
  success: import("@iconify/types").IconifyIcon;
5
5
  system: import("@iconify/types").IconifyIcon;
6
+ info: import("@iconify/types").IconifyIcon;
7
+ };
8
+ export declare const messageLabels: {
9
+ readonly error: "error";
10
+ readonly warning: "warning";
11
+ readonly success: "success";
12
+ readonly info: "info";
13
+ readonly system: "error";
6
14
  };
@@ -6,5 +6,13 @@ export const messageIcons = {
6
6
  error: alertCircleOutline,
7
7
  warning: informationOutline,
8
8
  success: checkCircleOutline,
9
- system: closeOctagonOutline
9
+ system: closeOctagonOutline,
10
+ info: informationOutline
11
+ };
12
+ export const messageLabels = {
13
+ error: 'error',
14
+ warning: 'warning',
15
+ success: 'success',
16
+ info: 'info',
17
+ system: 'error'
10
18
  };
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.1.16",
4
+ "version": "1.1.18",
5
5
  "scripts": {
6
6
  "prepublishOnly": "svelte-package",
7
7
  "dev": "vite dev --force",
@@ -10,12 +10,11 @@
10
10
  "check:watch": "svelte-check --tsconfig ./tsconfig.json --watch",
11
11
  "lint": "eslint --ignore-path .gitignore ."
12
12
  },
13
- "main": "./dist/index.js",
14
13
  "exports": {
15
14
  ".": {
16
15
  "types": "./dist/index.d.ts",
17
16
  "svelte": "./dist/index.js",
18
- "import": "./dist/index.js"
17
+ "default": "./dist/index.js"
19
18
  },
20
19
  "./package.json": "./package.json"
21
20
  },
@@ -27,7 +26,7 @@
27
26
  "@iconify-icons/mdi": "^1.2.22",
28
27
  "@iconify-icons/ph": "^1.2.2",
29
28
  "@txstate-mws/svelte-components": "^1.5.5",
30
- "@txstate-mws/svelte-forms": "^1.3.17",
29
+ "@txstate-mws/svelte-forms": "^1.4.2",
31
30
  "codemirror": "^6.0.1",
32
31
  "txstate-utils": "^1.8.0"
33
32
  },