@dosgato/dialog 1.1.13 → 1.1.14

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.
@@ -39,7 +39,7 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
39
39
  </script>
40
40
 
41
41
  <Modal {escapable} {initialfocus} hidefocus={false} includeselector=".ck-body-wrapper" on:escape>
42
- <section class="{expanded ? 'xl' : size}" use:eq>
42
+ <section class="{expanded ? 'xl expanded' : size}" use:eq>
43
43
  {#if title || icon}
44
44
  <header id={labelid}>
45
45
  <Icon width="1.4em" {icon} inline />{title}
@@ -118,7 +118,7 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
118
118
  width: 95vw;
119
119
  max-width: 2000px;
120
120
  }
121
- @media (max-width: 2000px) { section.xl button.expand { display: none; } }
121
+ @media (max-width: 2000px) { section.xl:not(.expanded) button.expand { display: none; } }
122
122
  @media (max-width: 800px) { section.xl { width: 97vw; } }
123
123
 
124
124
  header {
@@ -148,8 +148,8 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
148
148
  max-height: calc(100vh - 7.5em);
149
149
  max-height: calc(100dvh - 7.5em);
150
150
  }
151
- @media (max-width: 800px) { .dialog-content { padding: 1.2em; } }
152
- @media (max-width: 430px) { .dialog-content { padding: 0.6em; } }
151
+ @media (max-width: 800px) { .dialog-content { padding: 2rem 1.2em; } }
152
+ @media (max-width: 430px) { .dialog-content { padding: 2rem 0.6em; } }
153
153
 
154
154
  section.tiny .dialog-content, section.small .dialog-content {
155
155
  padding: 0 1em;
@@ -1,7 +1,8 @@
1
- <script>import { onMount } from 'svelte';
2
- import { randomid, shouldUseWhiteText } from 'txstate-utils';
3
- import FieldStandard from '../FieldStandard.svelte';
1
+ <script>import { FORM_CONTEXT, FORM_INHERITED_PATH } from '@txstate-mws/svelte-forms';
2
+ import { getContext, onMount } from 'svelte';
3
+ import { get, isNotBlank, randomid, shouldUseWhiteText } from 'txstate-utils';
4
4
  import { Radio } from '..';
5
+ import FieldStandard from '../FieldStandard.svelte';
5
6
  export let id = undefined;
6
7
  let className = '';
7
8
  export { className as class };
@@ -15,25 +16,23 @@ export let defaultValue = notNull ? (addAllOption ? 'alternating' : options[0].v
15
16
  export let conditional = undefined;
16
17
  export let helptext = undefined;
17
18
  const groupid = randomid();
18
- let val, stVal;
19
- function updateValue(valu, sVal) {
20
- val = valu;
21
- stVal = sVal;
22
- }
23
- function reactToOptions(..._) {
24
- if (!stVal)
19
+ const store = getContext(FORM_CONTEXT);
20
+ const inheritedPath = getContext(FORM_INHERITED_PATH);
21
+ const finalPath = [inheritedPath, path].filter(isNotBlank).join('.');
22
+ async function reactToOptions(..._) {
23
+ const val = get($store.data, finalPath);
24
+ if (!val)
25
25
  return;
26
26
  if (!options.length)
27
- stVal(addAllOption ? 'alternating' : undefined, true);
28
- if (val !== 'alternating' && !options.some(o => o.value === val))
29
- stVal(notNull ? options[0].value : (addAllOption ? 'alternating' : undefined), true);
27
+ await store.setField(finalPath, addAllOption ? 'alternating' : undefined);
28
+ else if (val !== 'alternating' && !options.some(o => o.value === val))
29
+ await store.setField(finalPath, notNull ? options[0].value : (addAllOption ? 'alternating' : undefined));
30
30
  }
31
- $: reactToOptions(options);
31
+ $: reactToOptions(options).catch(console.error);
32
32
  onMount(reactToOptions);
33
33
  </script>
34
34
 
35
35
  <FieldStandard bind:id descid={groupid} {path} {label} {required} {defaultValue} {conditional} {helptext} let:value let:valid let:invalid let:onBlur let:onChange let:messagesid let:helptextid let:setVal>
36
- {@const _ = void updateValue(value, setVal)}
37
36
  <div class="container-query-wrapper">
38
37
  <div class="color-container {className}" role="radiogroup" aria-labelledby={groupid} class:invalid class:valid>
39
38
  {#if addAllOption}
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.13",
4
+ "version": "1.1.14",
5
5
  "scripts": {
6
6
  "prepublishOnly": "svelte-package",
7
7
  "dev": "vite dev --force",