@dosgato/dialog 1.1.1 → 1.1.3

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.
@@ -1,7 +1,7 @@
1
1
  <script context="module">export const DIALOG_TABS_CONTEXT = {};
2
2
  </script>
3
- <script>import arrowLeftLight from '@iconify-icons/ph/arrow-left-light';
4
- import arrowRightLight from '@iconify-icons/ph/arrow-right-light';
3
+ <script>import arrowLeft from '@iconify-icons/ph/arrow-left';
4
+ import arrowRight from '@iconify-icons/ph/arrow-right';
5
5
  import xLight from '@iconify-icons/ph/x-light';
6
6
  import arrowsOutSimple from '@iconify-icons/ph/arrows-out-simple';
7
7
  import arrowsInSimple from '@iconify-icons/ph/arrows-in-simple';
@@ -59,7 +59,7 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
59
59
  <footer class="actions">
60
60
  <slot name="buttons" {nextTitle} {prevTitle} hasRequired={hasRequired && !ignoreTabs} onPrev={onPrev} onNext={onNext} {describedby}>
61
61
  {#if prevTitle && !ignoreTabs}
62
- <Button class="prev" disabled={!prevTitle} on:click={onPrev}><Icon icon={arrowLeftLight} inline /> Previous<ScreenReaderOnly> Tab ({prevTitle})</ScreenReaderOnly></Button>
62
+ <Button class="prev" disabled={!prevTitle} on:click={onPrev}><Icon icon={arrowLeft} inline /> <span class="prev-next" aria-hidden="true">Previous</span><ScreenReaderOnly>Previous Tab ({prevTitle})</ScreenReaderOnly></Button>
63
63
  {/if}
64
64
  {#if isNotBlank(cancelText)}
65
65
  <Button cancel {describedby} on:click={() => dispatch('escape')}>{cancelText}</Button>
@@ -68,7 +68,7 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
68
68
  <Button class="primary" disabled={disabled || (hasRequired && !ignoreTabs)} {describedby} on:click={() => dispatch('continue')}><Icon icon={continueIcon} inline /> {continueText}</Button>
69
69
  {/if}
70
70
  {#if nextTitle && !ignoreTabs}
71
- <Button class="next" disabled={!nextTitle} on:click={onNext}>Next<ScreenReaderOnly> Tab ({nextTitle})</ScreenReaderOnly> <Icon width="1.2em" icon={arrowRightLight} inline /></Button>
71
+ <Button class="next" disabled={!nextTitle} on:click={onNext}><span class="prev-next" aria-hidden="true">Next</span><ScreenReaderOnly> Next Tab ({nextTitle})</ScreenReaderOnly> <Icon icon={arrowRight} inline /></Button>
72
72
  {/if}
73
73
  </slot>
74
74
  </footer>
@@ -167,9 +167,21 @@ $: describedby = [title ? labelid : undefined, descid].filter(isNotBlank).join('
167
167
  border-bottom: 0px !important;
168
168
  }
169
169
 
170
+ footer.actions {
171
+ container-type: inline-size;
172
+ container-name: dosgato-dialog-actions
173
+ }
174
+
170
175
  footer.actions :global(.prev) {
171
176
  margin-right: auto;
172
177
  }
178
+
179
+ @container dosgato-dialog-actions (max-width: 450px) {
180
+ footer.actions :global(button span.prev-next) {
181
+ display: none;
182
+ }
183
+ }
184
+
173
185
  .header-buttons {
174
186
  position: absolute;
175
187
  top: 0.1em;
@@ -243,15 +243,26 @@ $: void updateSelected($value);
243
243
  align-items: flex-start;
244
244
  margin-top: 0.2em;
245
245
  }
246
+ :global([data-eq~="400px"]) .dialog-chooser-entry {
247
+ flex-direction: column;
248
+ align-items: center;
249
+ }
246
250
  .dialog-chooser-entry > button {
247
251
  border-radius: 0.25em;
248
- border: 1px solid #808080;
249
- color: black;
252
+ border: 0;
253
+ background-color: var(--dg-button-bg, #501214);
254
+ color: var(--dg-button-text, #fff);
255
+ padding: 0.5em 1em;
256
+ font-size: 0.8em;
250
257
  }
251
258
  .dialog-chooser-entry-input {
252
259
  position: relative;
253
260
  flex-grow: 1;
254
261
  }
262
+ :global([data-eq~="400px"]) .dialog-chooser-entry-input {
263
+ margin-bottom: 0.2em;
264
+ width: 100%;
265
+ }
255
266
  .dialog-chooser-entry-input input {
256
267
  width: 100%;
257
268
  padding-right: 1.4em;
package/dist/Tabs.svelte CHANGED
@@ -11,6 +11,11 @@ export let active = undefined;
11
11
  export let store = new TabStore(tabs, active);
12
12
  export let disableDialogControl = false;
13
13
  export let accordionOnMobile = true;
14
+ /**
15
+ * Takes the width of the tabs area, in pixels, and returns the number of tabs that should be
16
+ * displayed at that width.
17
+ */
18
+ export let columnsShown = undefined;
14
19
  $: store.update(v => ({ ...v, tabs, accordionOnMobile }));
15
20
  const activeStore = new Store({});
16
21
  const tabelements = [];
@@ -30,7 +35,7 @@ if (!disableDialogControl)
30
35
  const currentName = store.currentName();
31
36
  const currentIdx = store.currentIdx();
32
37
  const accordion = store.accordion();
33
- $: cols = Math.min(Math.floor(($store.clientWidth ?? 1024) / 90), $store.tabs.length);
38
+ $: cols = (typeof columnsShown === 'function') ? columnsShown($store.clientWidth ?? 1024) : Math.min(Math.floor(($store.clientWidth ?? 1024) / 90), $store.tabs.length);
34
39
  $: scalefactor = Math.min(roundTo(($store.clientWidth ?? 1024) / (cols * 130), 4), 1);
35
40
  $: wrapping = cols !== $store.tabs.length;
36
41
  $: dialogContext.hasTabs = !$accordion;
@@ -7,6 +7,10 @@ declare const __propDef: {
7
7
  store?: TabStore | undefined;
8
8
  disableDialogControl?: boolean | undefined;
9
9
  accordionOnMobile?: boolean | undefined;
10
+ /**
11
+ * Takes the width of the tabs area, in pixels, and returns the number of tabs that should be
12
+ * displayed at that width.
13
+ */ columnsShown?: ((tabsWidth: number) => number) | undefined;
10
14
  };
11
15
  events: {
12
16
  [evt: string]: CustomEvent<any>;
@@ -151,7 +151,7 @@ let thumbnailExpanded = false;
151
151
  .dialog-chooser-chooser {
152
152
  order: 3;
153
153
  width: 100%;
154
- height: 50%;
154
+ height: 70%;
155
155
  }
156
156
  }
157
157
 
@@ -97,17 +97,17 @@ $: reactToPreview($preview);
97
97
  flex-direction: row;
98
98
  height: 25vh;
99
99
  }
100
- .dialog-chooser-preview :global(.dialog-chooser-thumbnail) {
100
+ .dialog-chooser-preview .preview-container :global(.dialog-chooser-thumbnail) {
101
101
  max-width: 50%;
102
102
  }
103
- .dialog-chooser-preview :global(.dialog-chooser-thumbnail.expanded) {
103
+ .dialog-chooser-preview .preview-container :global(.dialog-chooser-thumbnail.expanded) {
104
104
  max-width: unset;
105
105
  }
106
- .dialog-chooser-preview :global(.dialog-chooser-thumbnail img) {
106
+ .dialog-chooser-preview .preview-container :global(.dialog-chooser-thumbnail img) {
107
107
  object-fit: cover;
108
108
  object-position: center;
109
109
  }
110
- .dialog-chooser-preview :global(.dialog-chooser-thumbnail.expanded img) {
110
+ .dialog-chooser-preview .preview-container :global(.dialog-chooser-thumbnail.expanded img) {
111
111
  object-fit: scale-down;
112
112
  width: unset;
113
113
  }
@@ -156,8 +156,11 @@ function onKeyDown(e) {
156
156
  <style>
157
157
  .select-icon {
158
158
  border-radius: 0.25em;
159
- border: 1px solid #808080;
160
- color: black;
159
+ border: 0px;
160
+ background-color: var(--dg-button-bg, #501214);
161
+ color: var(--dg-button-text, #fff);
162
+ padding: 0.5em 1em;
163
+ font-size: 0.8em;
161
164
  }
162
165
  section {
163
166
  position: relative;
@@ -207,24 +207,24 @@ async function selectHeader(selected) {
207
207
  </script>
208
208
 
209
209
  <svelte:window on:mouseup={headerDragEnd} />
210
+ <!-- svelte-ignore a11y-no-static-element-interactions -->
210
211
  <div class="tree-header" class:resizing={!!dragtargetid} use:resize={{ store: treeWidth }} on:mouseup={headerDragEnd} on:touchend={headerDragEnd} on:mousemove={dragtargetid ? headerDrag : undefined} on:touchmove={dragtargetid ? headerDrag : undefined}>
211
- <div class="checkbox" bind:this={checkboxelement} aria-hidden="true">&nbsp;</div>
212
- {#each shownHeaders as header, i (header.label)}
213
- <div bind:this={headerelements[i]} id={header.id} class="tree-header-cell {header.id}" aria-hidden="true" style:width={$headerOverride[header.id] ?? $headerSizes?.[i]} style:padding-left={i === 0 ? '1.4em' : undefined}>{header.label}{#if i === 0 && $store.loading}<LoadIcon />{/if}{#if i === 0 && isNotBlank(search)}&nbsp;(searching: {search}){/if}</div>
214
- <!-- svelte-ignore a11y-no-static-element-interactions -->
215
- {#if enableResize && i !== shownHeaders.length - 1}<div class="tree-separator {header.id}" on:mousedown={headerDragStart(header, i)} on:touchstart={headerDragStart(header, i)} on:dblclick={headerDragReset}>&nbsp;</div>{/if}
216
- {/each}
217
- {#if hiddenHeaders.length}
218
- <div class="button-wrapper">
219
- <button bind:this={showMoreButton} type='button'><Icon icon={dotsIcon} hiddenLabel="View other columns"/></button>
220
- <PopupMenu bind:value={selectedHeaderValue} items={hiddenHeaders.map(h => ({ value: h.id, label: h.label }))} buttonelement={showMoreButton} on:change={e => {selectHeader(e.detail)}} let:item menuContainerClass="hideable-container" menuClass="hideable-headers" menuItemSelectedClass="selected-header">
221
- {#if item.hasOwnProperty('value')}
222
- <Icon icon={'value' in item && item.value === selectedHeaderValue ? radioSelectedIcon : circleIcon} inline/>
223
- {item.label}
224
- {/if}
225
- </PopupMenu>
226
- </div>
227
- {/if}
212
+ <div class="checkbox" bind:this={checkboxelement} aria-hidden="true">&nbsp;</div>
213
+ {#each shownHeaders as header, i (header.label)}
214
+ <div bind:this={headerelements[i]} id={header.id} class="tree-header-cell {header.id}" aria-hidden="true" style:width={$headerOverride[header.id] ?? $headerSizes?.[i]} style:padding-left={i === 0 ? '1.4em' : undefined}>{header.label}{#if i === 0 && $store.loading}<LoadIcon />{/if}{#if i === 0 && isNotBlank(search)}&nbsp;(searching: {search}){/if}</div>
215
+ {#if enableResize && i !== shownHeaders.length - 1}<div class="tree-separator {header.id}" on:mousedown={headerDragStart(header, i)} on:touchstart={headerDragStart(header, i)} on:dblclick={headerDragReset}>&nbsp;</div>{/if}
216
+ {/each}
217
+ {#if hiddenHeaders.length}
218
+ <div class="button-wrapper">
219
+ <button bind:this={showMoreButton} type='button'><Icon icon={dotsIcon} hiddenLabel="View other columns"/></button>
220
+ <PopupMenu bind:value={selectedHeaderValue} items={hiddenHeaders.map(h => ({ value: h.id, label: h.label }))} buttonelement={showMoreButton} on:change={async e => { await selectHeader(e.detail) }} let:item menuContainerClass="hideable-container" menuClass="hideable-headers" menuItemSelectedClass="selected-header">
221
+ {#if 'value' in item}
222
+ <Icon icon={'value' in item && item.value === selectedHeaderValue ? radioSelectedIcon : circleIcon} inline width="1.1em"/>
223
+ {item.label}
224
+ {/if}
225
+ </PopupMenu>
226
+ </div>
227
+ {/if}
228
228
  </div>
229
229
  {#if mounted && myRootItems?.length}
230
230
  <!-- svelte-ignore a11y-no-noninteractive-element-to-interactive-role -->
@@ -312,7 +312,7 @@ async function selectHeader(selected) {
312
312
  padding: 0.4em;
313
313
  background: white;
314
314
  border: 1px solid slategray;
315
- border-radius: 3px;
315
+ border-radius: 5px;
316
316
  min-width: 10em;
317
317
  max-height: 20em;
318
318
  overflow-y: auto;
@@ -320,6 +320,8 @@ async function selectHeader(selected) {
320
320
  :global(div.hideable-container ul.hideable-headers li[role="option"]) {
321
321
  padding-left: 0;
322
322
  color: black;
323
+ padding: 0.5em;
324
+ font-size: 1.1em;
323
325
  }
324
326
 
325
327
  </style>
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.1",
4
+ "version": "1.1.3",
5
5
  "scripts": {
6
6
  "prepublishOnly": "svelte-package",
7
7
  "dev": "vite dev --force",
@@ -27,7 +27,7 @@
27
27
  "@iconify-icons/mdi": "^1.2.22",
28
28
  "@iconify-icons/ph": "^1.2.2",
29
29
  "@txstate-mws/svelte-components": "^1.5.5",
30
- "@txstate-mws/svelte-forms": "^1.3.16",
30
+ "@txstate-mws/svelte-forms": "^1.3.17",
31
31
  "codemirror": "^6.0.1",
32
32
  "txstate-utils": "^1.8.0"
33
33
  },