accomadesc 0.1.13 → 0.1.15

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.
@@ -125,43 +125,61 @@
125
125
  {#if explainer}
126
126
  <div class="explainer">{@html translateFunc ? translateFunc(explainer) : ''}</div>
127
127
  {/if}
128
+
128
129
  <form onsubmit={createRequest}>
129
130
  <input type="hidden" value={userID} />
130
- <label class:disabled>
131
- {@html translateFunc ? translateFunc(nameLabel) : 'Name'}:
132
- <TextInput type="text" marginForMessage={false} bind:value={name} enabled={!disabled} />
131
+ <label for="name-input">
132
+ <span class:disabled>{@html translateFunc ? translateFunc(nameLabel) : 'Name'}:</span>
133
133
  </label>
134
- <label class:disabled>
135
- {@html translateFunc ? translateFunc(emailLabel) : 'Email'}:
136
- <TextInput type="email" marginForMessage={false} bind:value={email} enabled={!disabled} />
134
+ <div class="input-wrapper">
135
+ <TextInput
136
+ id="name-input"
137
+ type="text"
138
+ marginForMessage={false}
139
+ bind:value={name}
140
+ enabled={!disabled}
141
+ />
142
+ </div>
143
+ <label for="email-input">
144
+ <span class:disabled>{@html translateFunc ? translateFunc(emailLabel) : 'Email'}:</span>
137
145
  </label>
138
- <div style="display:flex;">
139
- <span class:disabled>
140
- {@html translateFunc ? translateFunc(dateEntryLabel) : 'Vacation Dates'}:
141
- </span>
142
- <div class="date-input-wrapper">
143
- {#if inputDatesEngaged}
144
- <div transition:slide style="min-width: 32rem;" class="picker-wrapper">
145
- <OccuPlanPicker {arrival} {leave} {url} aborted={abortDateInput} {dateSelected} />
146
- </div>
147
- {/if}
148
- <div class="date-input-display-wrapper" id="engage-date-buttons">
149
- <Button
150
- iconName="edit"
151
- size={1.8}
152
- clicked={engageDateInput}
153
- text={arrival && leave && formatDateFunc
154
- ? `${formatDateFunc(arrival)} - ${formatDateFunc(leave)}`
155
- : ''}
156
- />
157
- {#if arrival && leave}
158
- <Button iconName="delete" size={1.8} clicked={dateDeleted} />
159
- {/if}
146
+ <div class="input-wrapper">
147
+ <TextInput
148
+ id="email-input"
149
+ type="email"
150
+ marginForMessage={false}
151
+ bind:value={email}
152
+ enabled={!disabled}
153
+ />
154
+ </div>
155
+ <label for="date-input">
156
+ <span class:disabled
157
+ >{@html translateFunc ? translateFunc(dateEntryLabel) : 'Vacation Dates'}:</span
158
+ >
159
+ </label>
160
+ <div class="input-wrapper" class:disabled>
161
+ {#if inputDatesEngaged}
162
+ <div transition:slide style="min-width: 32rem;" class="picker-wrapper">
163
+ <OccuPlanPicker {arrival} {leave} {url} aborted={abortDateInput} {dateSelected} />
160
164
  </div>
165
+ {/if}
166
+ <div class="date-input-wrapper" id="engage-date-buttons">
167
+ <Button
168
+ id="date-input"
169
+ iconName="edit"
170
+ size={1.8}
171
+ clicked={engageDateInput}
172
+ text={arrival && leave && formatDateFunc
173
+ ? `${formatDateFunc(arrival)} - ${formatDateFunc(leave)}`
174
+ : ''}
175
+ />
176
+ {#if arrival && leave}
177
+ <Button iconName="delete" size={1.8} clicked={dateDeleted} />
178
+ {/if}
161
179
  </div>
162
180
  </div>
163
- <label class="row-label"
164
- ><div class:disabled>
181
+ <label class="notes-input">
182
+ <div class:disabled>
165
183
  {@html translateFunc
166
184
  ? translateFunc(messageLabel)
167
185
  : 'Your Message'}{#if showMaxCharsMessage}<span class="max-chars-message"
@@ -171,21 +189,23 @@
171
189
  <Notes {disabled} changed={messageChanged} />
172
190
  </label>
173
191
 
174
- {#if successfullySent}
175
- <div class="success">
176
- {translateFunc ? translateFunc(successfullySentText) : 'Successfully Sent Email'}
177
- </div>
178
- {/if}
179
- {#if errored}
180
- <div class="error">
181
- {translateFunc ? translateFunc(sentErroredText) : 'Error Occurred Sending Email'}
182
- </div>
183
- {/if}
184
- {#if invalid}
185
- <div class="error">
186
- {translateFunc ? translateFunc(invalidText) : 'Dates Are Not Available'}
187
- </div>
188
- {/if}
192
+ <div class="message-wrapper">
193
+ {#if successfullySent}
194
+ <div class="success">
195
+ {translateFunc ? translateFunc(successfullySentText) : 'Successfully Sent Email'}
196
+ </div>
197
+ {/if}
198
+ {#if errored}
199
+ <div class="error">
200
+ {translateFunc ? translateFunc(sentErroredText) : 'Error Occurred Sending Email'}
201
+ </div>
202
+ {/if}
203
+ {#if invalid}
204
+ <div class="error">
205
+ {translateFunc ? translateFunc(invalidText) : 'Dates Are Not Available'}
206
+ </div>
207
+ {/if}
208
+ </div>
189
209
  <div class="button-wrapper">
190
210
  <Button
191
211
  enabled={canSubmit && !disabled}
@@ -213,42 +233,54 @@
213
233
  color: var(--main-font-color);
214
234
  }
215
235
  }
216
-
217
- .date-input-wrapper {
236
+ form {
218
237
  width: 100%;
219
- display: flex;
220
- justify-content: flex-end;
221
- }
238
+ display: grid;
239
+ grid-template-columns: [start] 1fr [gap-start] 0.5fr [gap-end] 3fr [end];
240
+ row-gap: 0.5rem;
222
241
 
223
- .date-input-display-wrapper {
224
- display: flex;
225
- justify-content: flex-end;
226
- align-items: center;
227
- }
228
-
229
- .picker-wrapper {
230
- position: absolute;
231
- z-index: 9999;
232
- background-color: var(--main-bg-color);
233
- }
242
+ label {
243
+ grid-column-start: start;
244
+ grid-column-end: gap-start;
245
+ }
234
246
 
235
- form {
236
- width: 100%;
237
- display: flex;
238
- flex-direction: column;
239
- gap: 0.5rem;
240
- }
247
+ label.notes-input {
248
+ margin-top: 2rem;
249
+ grid-column-start: start;
250
+ grid-column-end: end;
251
+ display: flex;
252
+ flex-direction: column;
253
+ gap: 1rem;
254
+ }
241
255
 
242
- label {
243
- display: flex;
244
- gap: 1rem;
245
- align-items: center;
246
- justify-content: space-between;
247
- }
256
+ .input-wrapper {
257
+ grid-column-start: gap-end;
258
+ grid-column-end: end;
259
+ }
260
+ .date-input-wrapper {
261
+ display: flex;
262
+ gap: 1rem;
263
+ justify-content: flex-start;
264
+ }
265
+ .picker-wrapper {
266
+ position: absolute;
267
+ z-index: 9999;
268
+ background-color: var(--main-bg-color);
269
+ }
248
270
 
249
- .row-label {
250
- flex-direction: column;
251
- gap: 0.2rem;
271
+ .message-wrapper {
272
+ margin-top: 1rem;
273
+ grid-column-start: start;
274
+ grid-column-end: end;
275
+ display: flex;
276
+ justify-content: flex-start;
277
+ }
278
+ .button-wrapper {
279
+ grid-column-start: start;
280
+ grid-column-end: end;
281
+ display: flex;
282
+ justify-content: flex-start;
283
+ }
252
284
  }
253
285
 
254
286
  .max-chars-message {
@@ -1,9 +1,11 @@
1
1
  <script lang="ts">
2
2
  import { getIcon } from './icons.js';
3
+ import { randomID } from '../names/gen.ts';
3
4
 
4
5
  const {
5
6
  text = null,
6
7
  iconName = '',
8
+ id = randomID(),
7
9
  ariaLabel = text ? text : iconName,
8
10
  form = null,
9
11
  type = 'button',
@@ -23,6 +25,7 @@
23
25
  }: {
24
26
  text?: string | null;
25
27
  iconName?: string;
28
+ id?: string;
26
29
  ariaLabel?: string;
27
30
  form?: string | null;
28
31
  type?: 'button' | 'submit' | 'reset';
@@ -165,6 +168,7 @@
165
168
 
166
169
  {#if showBackdrop}
167
170
  <button
171
+ {id}
168
172
  class:pressed
169
173
  aria-label={ariaLabel}
170
174
  style="
@@ -217,6 +221,7 @@
217
221
  </button>
218
222
  {:else}
219
223
  <button
224
+ {id}
220
225
  aria-label={ariaLabel}
221
226
  style="
222
227
  height: {size}rem;
@@ -1,6 +1,7 @@
1
1
  type $$ComponentProps = {
2
2
  text?: string | null;
3
3
  iconName?: string;
4
+ id?: string;
4
5
  ariaLabel?: string;
5
6
  form?: string | null;
6
7
  type?: 'button' | 'submit' | 'reset';
@@ -2,15 +2,16 @@
2
2
  import { randomID } from '../names/gen.js';
3
3
 
4
4
  let {
5
+ id = randomID(),
5
6
  disabled,
6
7
  changed,
7
8
  }: {
9
+ id?: string;
8
10
  disabled: boolean;
9
11
  changed: (value: string) => void;
10
12
  } = $props();
11
13
 
12
14
  let divElement: HTMLDivElement;
13
- let id = randomID();
14
15
 
15
16
  const contentChanged = (e: Event) => {
16
17
  const target = e.currentTarget as HTMLDivElement;
@@ -1,4 +1,5 @@
1
1
  type $$ComponentProps = {
2
+ id?: string;
2
3
  disabled: boolean;
3
4
  changed: (value: string) => void;
4
5
  };
@@ -13,6 +13,7 @@
13
13
  defaultMonthHeaderFormat,
14
14
  } from './state.svelte.js';
15
15
  import { DateTime } from 'luxon';
16
+ import { browser } from '$app/environment';
16
17
 
17
18
  let {
18
19
  url,
@@ -41,12 +42,15 @@
41
42
  },
42
43
  }: OccuplanTranslations & OccuplanMiscProps = $props();
43
44
 
44
- const oStateID = `i-${url}-${OCCUPATION_STATE}`;
45
+ /*const oStateID = `i-${url}-${OCCUPATION_STATE}`;
45
46
  let occupationState: OccupationState = getContext(oStateID);
46
- if (!occupationState) {
47
- occupationState = new OccupationState(url);
48
- setContext(oStateID, occupationState);
49
- }
47
+ $effect(() => {
48
+ if (browser && !occupationState) {
49
+ occupationState = new OccupationState(url);
50
+ setContext(oStateID, occupationState);
51
+ }
52
+ });
53
+ */
50
54
 
51
55
  /*
52
56
  use different component based on different media size.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "accomadesc",
3
- "version": "0.1.13",
3
+ "version": "0.1.15",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",