@dosgato/dialog 1.2.3 → 1.2.5

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,10 +1,10 @@
1
1
  <script context="module">export const DG_DIALOG_FIELD_MULTIPLE = {};
2
2
  function noOp(..._) { return ''; }
3
3
  </script>
4
- <script>import caretCircleDown from '@iconify-icons/ph/caret-circle-down';
5
- import caretCircleUp from '@iconify-icons/ph/caret-circle-up';
4
+ <script>import caretCircleDown from '@iconify-icons/ph/caret-circle-down-fill';
5
+ import caretCircleUp from '@iconify-icons/ph/caret-circle-up-fill';
6
6
  import plusCircleLight from '@iconify-icons/ph/plus-circle-light';
7
- import xCircle from '@iconify-icons/ph/x-circle';
7
+ import xCircle from '@iconify-icons/ph/x-circle-fill';
8
8
  import { AddMore, FORM_CONTEXT, FORM_INHERITED_PATH } from '@txstate-mws/svelte-forms';
9
9
  import { derivedStore } from '@txstate-mws/svelte-store';
10
10
  import { getContext, setContext } from 'svelte';
@@ -132,6 +132,9 @@ $: messages = compact ? $messageStore : [];
132
132
  font-size: 1.3em;
133
133
  color: black;
134
134
  }
135
+ .dialog-multiple-buttons .dialog-multiple-delete {
136
+ color: var(--dg-danger-bg, #9a3332);
137
+ }
135
138
  .dialog-multiple-buttons button:disabled {
136
139
  color: #6d6d6d;
137
140
  }
@@ -1,8 +1,9 @@
1
1
  <script>import { FORM_CONTEXT, FORM_INHERITED_PATH } from '@txstate-mws/svelte-forms';
2
2
  import { getContext, onMount } from 'svelte';
3
- import { get, isNotBlank, randomid, shouldUseWhiteText } from 'txstate-utils';
3
+ import { get, isNotBlank, isNotNull, keyby, randomid } from 'txstate-utils';
4
4
  import { Radio } from '..';
5
5
  import FieldStandard from '../FieldStandard.svelte';
6
+ import { ScreenReaderOnly } from '@txstate-mws/svelte-components';
6
7
  export let id = undefined;
7
8
  let className = '';
8
9
  export { className as class };
@@ -19,6 +20,7 @@ const groupid = randomid();
19
20
  const store = getContext(FORM_CONTEXT);
20
21
  const inheritedPath = getContext(FORM_INHERITED_PATH);
21
22
  const finalPath = [inheritedPath, path].filter(isNotBlank).join('.');
23
+ $: colorsByValue = keyby(options, 'value');
22
24
  async function reactToOptions(..._) {
23
25
  const val = get($store.data, finalPath);
24
26
  if (!val)
@@ -38,22 +40,31 @@ onMount(reactToOptions);
38
40
  {#if addAllOption}
39
41
  <label for={`${groupid}.alt`} class="colorsel alternating">
40
42
  <Radio id={`${groupid}.alt`} name={groupid} value="alternating" selected={value === 'alternating'} {onChange} {onBlur} {helptextid}/>
41
- <span class="alternating-bg">
42
- {#each options as option (option.value)}
43
- <span style:background-color={option.color}></span>
44
- {/each}
45
- </span>
46
- <span class="picker-text">Alternating</span>
43
+ <div class="picker-text">
44
+ <ScreenReaderOnly>Alternating</ScreenReaderOnly>
45
+ <div class="alternating-bg">
46
+ {#each options as option (option.value)}
47
+ <div style:background-color={option.color} style:flex-basis={`calc(100% / ${options.length})`}></div>
48
+ {/each}
49
+ </div>
50
+ </div>
47
51
  </label>
48
52
  {/if}
49
53
  {#each options as option, idx (option.value) }
50
54
  {@const radioid = `${groupid}.${idx}`}
51
- <label for={radioid} class="colorsel">
55
+ <label for={radioid} class="colorsel" title={option.name || option.value}>
52
56
  <Radio id={radioid} name={groupid} value={option.value} selected={value === option.value} {onChange} {onBlur} {helptextid}/>
53
- <span class="picker-text" style:background-color={option.color} class:dark={shouldUseWhiteText(option.color)}>{option.name || option.value}</span>
57
+ <div class="picker-text" style:background-color={option.color}>
58
+ <ScreenReaderOnly>{option.name || option.value}</ScreenReaderOnly>
59
+ </div>
54
60
  </label>
55
61
  {/each}
56
62
  </div>
63
+ {#if options.length && isNotNull(get($store.data, finalPath))}
64
+ <div>
65
+ Selected Color: <span class="selected-color">{get($store.data, finalPath) === 'alternating' ? 'Alternating' : (colorsByValue[get($store.data, finalPath)]?.name ?? get($store.data, finalPath))}</span>
66
+ </div>
67
+ {/if}
57
68
  </div>
58
69
  </FieldStandard>
59
70
 
@@ -63,21 +74,11 @@ onMount(reactToOptions);
63
74
  container-name: color-picker-container;
64
75
  }
65
76
  .color-container {
66
- display: grid;
67
- grid-gap: 10px;
68
- grid-template-columns: 1fr 1fr 1fr 1fr;
69
- }
70
- @container color-picker-container (max-width: 600px) {
71
- .color-container {
72
- grid-template-columns: 1fr 1fr 1fr;
73
- }
74
- }
75
- @container color-picker-container (max-width: 350px) {
76
- .color-container {
77
- grid-template-columns: 1fr 1fr;
78
- }
77
+ display: flex;
78
+ flex-wrap: wrap;
79
+ gap: 1em;
80
+ margin-bottom: 1em;
79
81
  }
80
-
81
82
  label.colorsel :global(input[type="radio"]) {
82
83
  border: 0;
83
84
  clip: rect(0 0 0 0);
@@ -88,54 +89,33 @@ onMount(reactToOptions);
88
89
  position: absolute;
89
90
  width: 1px;
90
91
  }
91
-
92
- label.colorsel :global(input[type="radio"] + span) {
93
- display: inline-block;
94
- padding: 1rem;
95
- width: 100%;
92
+ label.colorsel :global(input[type="radio"] + div.picker-text) {
93
+ position: relative;
94
+ display: flex;
95
+ justify-content: center;
96
+ align-items: center;
97
+ width: 50px;
98
+ height: 50px;
99
+ border-radius: 100%;
96
100
  text-align: center;
97
101
  white-space: nowrap;
98
102
  border: 1px solid #D1D1D1;
99
103
  }
100
104
 
101
- label.colorsel :global(input[type="radio"]:checked + span) {
105
+ label.colorsel :global(input[type="radio"]:checked + div.picker-text) {
102
106
  outline: 5px solid #93BBC4;
103
107
  }
104
108
 
105
- label.colorsel :global(input[type="radio"]:focus + span) {
109
+ label.colorsel :global(input[type="radio"]:focus + div.picker-text) {
106
110
  outline: 5px solid blue;
107
111
  }
108
-
109
- label.colorsel.alternating {
110
- position: relative;
112
+ label.colorsel.alternating .picker-text {
113
+ overflow: hidden;
111
114
  }
112
-
113
- label.colorsel.alternating span.alternating-bg {
115
+ label.colorsel.alternating .picker-text .alternating-bg {
114
116
  display: flex;
115
- padding: 0;
116
117
  height: 100%;
117
- }
118
-
119
- label.colorsel.alternating span.alternating-bg span {
120
118
  width: 100%;
121
119
  }
122
120
 
123
- label.colorsel.alternating span.picker-text {
124
- position: absolute;
125
- left: 50%;
126
- top: 50%;
127
- transform: translate(-50%, -50%);
128
- }
129
-
130
- label .picker-text {
131
- font-weight: bold;
132
- letter-spacing: 0.5px;
133
- color: black;
134
- text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.6), 1px -1px 1px rgba(255, 255, 255, 0.6), -1px 1px 1px rgba(255, 255, 255, 0.6), -1px -1px 1px rgba(255, 255, 255, 0.6);
135
- }
136
- label .picker-text.dark, label.alternating .picker-text {
137
- color: white;
138
- text-shadow: 1px 1px 1px #222, 1px -1px 1px #222, -1px 1px 1px #222, -1px -1px 1px #222;
139
- }
140
-
141
121
  </style>
@@ -130,6 +130,22 @@ async function reactToAspectRatio(ar) {
130
130
  }
131
131
  }
132
132
  $: void reactToAspectRatio(selectionAspectRatio);
133
+ let initialLoad = true;
134
+ let initialVal;
135
+ let srcChanged = false;
136
+ async function onimageload(e) {
137
+ if (initialLoad) {
138
+ initialVal = e.target.src;
139
+ initialLoad = false;
140
+ }
141
+ else {
142
+ if (e.target.src !== initialVal || srcChanged) {
143
+ await tick();
144
+ store.maximize();
145
+ srcChanged = true;
146
+ }
147
+ }
148
+ }
133
149
  </script>
134
150
 
135
151
  <svelte:window on:mousemove={onMouseMove} on:mouseup={onMouseUp} on:touchend={onMouseUp} on:touchcancel={onMouseUp} />
@@ -146,7 +162,7 @@ $: void reactToAspectRatio(selectionAspectRatio);
146
162
  </div>
147
163
  <!-- svelte-ignore a11y-no-static-element-interactions -->
148
164
  <div bind:this={container} use:resize on:resize={() => updateRect()} class="crop-image-container" on:mousedown={onMouseDown} on:touchstart={onMouseDown} on:touchmove={onMouseMove} style:cursor={$store.cursor}>
149
- <img class="crop-image" src={imageSrc} alt="" />
165
+ <img class="crop-image" src={imageSrc} alt="" on:load={onimageload}/>
150
166
  {#if $selection && $outputPct}
151
167
  <div class='crop-bg'>
152
168
  <img class='crop-image clipped' src={imageSrc} alt="" style:clip-path="polygon({$outputPct.left}% {$outputPct.top}%, {100 - $outputPct.right}% {$outputPct.top}%, {100 - $outputPct.right}% {100 - $outputPct.bottom}%, {$outputPct.left}% {100 - $outputPct.bottom}%, {$outputPct.left}% {$outputPct.top}%)" />