accomadesc 0.2.13 → 0.2.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.
@@ -9,6 +9,7 @@
9
9
  import OccuPlanPicker from './occuplan/OccuPlanPicker.svelte';
10
10
  import { slide } from 'svelte/transition';
11
11
  import type { DateTime } from 'luxon';
12
+ import { randomID } from './names/gen.ts';
12
13
 
13
14
  const {
14
15
  endpoint,
@@ -25,16 +26,18 @@
25
26
  submitText,
26
27
  invalidText,
27
28
  maxCharsAllowed = 300,
29
+ preview = false,
28
30
  translateFunc,
29
31
  formatDateFunc,
30
32
  }: BookingRequestContent & I18nFacade = $props();
31
33
 
34
+ const id = randomID();
35
+
32
36
  let name = $state('');
33
37
  let email = $state('');
34
38
  let message = $state('');
35
39
  let arrival: DateTime | undefined = $state();
36
40
  let leave: DateTime | undefined = $state();
37
- let disabled = $state(false);
38
41
  let inputDatesEngaged = $state(false);
39
42
 
40
43
  let currentCharsCount = $derived(message.length);
@@ -50,8 +53,7 @@
50
53
  let errored = $state(false);
51
54
  let successfullySent = $state(false);
52
55
  let sending = $state(false);
53
-
54
- //https://popnapdkcdnabruxkjti.supabase.co/storage/v1/object/public/ical/81e66599-ac3c-4ad6-b261-fceeb784f9e9/050edcb4-680e-4542-96df-3ae4a2af89a5
56
+ let disabled = $derived(preview || errored || successfullySent);
55
57
 
56
58
  const url = calUrl;
57
59
  const oStateID = `i-${url}-${OCCUPATION_STATE}`;
@@ -128,31 +130,31 @@
128
130
 
129
131
  <form onsubmit={createRequest}>
130
132
  <input type="hidden" value={userID} />
131
- <label for="name-input">
133
+ <label for={`${id}-name-input`}>
132
134
  <span class:disabled>{@html translateFunc ? translateFunc(nameLabel) : 'Name'}:</span>
133
135
  </label>
134
136
  <div class="input-wrapper">
135
137
  <TextInput
136
- id="name-input"
138
+ id={`${id}name-input`}
137
139
  type="text"
138
140
  marginForMessage={false}
139
141
  bind:value={name}
140
142
  enabled={!disabled}
141
143
  />
142
144
  </div>
143
- <label for="email-input">
145
+ <label for={`${id}-email-input`}>
144
146
  <span class:disabled>{@html translateFunc ? translateFunc(emailLabel) : 'Email'}:</span>
145
147
  </label>
146
148
  <div class="input-wrapper">
147
149
  <TextInput
148
- id="email-input"
150
+ id={`${id}-email-input`}
149
151
  type="email"
150
152
  marginForMessage={false}
151
153
  bind:value={email}
152
154
  enabled={!disabled}
153
155
  />
154
156
  </div>
155
- <label for="date-input">
157
+ <label for={`${id}-date-input`}>
156
158
  <span class:disabled
157
159
  >{@html translateFunc ? translateFunc(dateEntryLabel) : 'Vacation Dates'}:</span
158
160
  >
@@ -165,7 +167,8 @@
165
167
  {/if}
166
168
  <div class="date-input-wrapper" id="engage-date-buttons">
167
169
  <Button
168
- id="date-input"
170
+ enabled={!disabled}
171
+ id={`${id}-date-input`}
169
172
  iconName="edit"
170
173
  size={1.8}
171
174
  clicked={engageDateInput}
@@ -190,18 +193,19 @@
190
193
  </label>
191
194
 
192
195
  <div class="message-wrapper">
193
- {#if successfullySent}
194
- <div class="success">
196
+ {#if preview}<div>[PREVIEW]</div>{/if}
197
+ {#if successfullySent || preview}
198
+ <div class="messsage success">
195
199
  {translateFunc ? translateFunc(successfullySentText) : 'Successfully Sent Email'}
196
200
  </div>
197
201
  {/if}
198
- {#if errored}
199
- <div class="error">
202
+ {#if errored || preview}
203
+ <div class="message error">
200
204
  {translateFunc ? translateFunc(sentErroredText) : 'Error Occurred Sending Email'}
201
205
  </div>
202
206
  {/if}
203
- {#if invalid}
204
- <div class="error">
207
+ {#if invalid || preview}
208
+ <div class="message error">
205
209
  {translateFunc ? translateFunc(invalidText) : 'Dates Are Not Available'}
206
210
  </div>
207
211
  {/if}
@@ -228,7 +232,6 @@
228
232
  background-color: var(--main-bg-color);
229
233
  color: var(--main-font-color);
230
234
 
231
- width: 100%;
232
235
  display: flex;
233
236
  flex-direction: column;
234
237
  align-items: center;
@@ -245,6 +248,7 @@
245
248
  row-gap: 0.5rem;
246
249
 
247
250
  label {
251
+ align-content: center;
248
252
  grid-column-start: start;
249
253
  grid-column-end: gap-start;
250
254
  }
@@ -278,7 +282,7 @@
278
282
  grid-column-start: start;
279
283
  grid-column-end: end;
280
284
  display: flex;
281
- justify-content: flex-start;
285
+ justify-content: space-between;
282
286
  }
283
287
  .button-wrapper {
284
288
  grid-column-start: start;
@@ -293,6 +297,11 @@
293
297
  color: var(--alert-font-color);
294
298
  }
295
299
 
300
+ .message {
301
+ display: flex;
302
+ justify-content: space-between;
303
+ }
304
+
296
305
  .success {
297
306
  color: var(--accept-font-color);
298
307
  font-weight: bolder;
@@ -4,6 +4,7 @@
4
4
  import TextInput from './basic/TextInput.svelte';
5
5
  import Notes from './basic/Notes.svelte';
6
6
  import type { ContactFormContent, I18nFacade } from './types.js';
7
+ import { randomID } from './names/gen.ts';
7
8
 
8
9
  const {
9
10
  userID,
@@ -16,9 +17,12 @@
16
17
  successfullySentText,
17
18
  sentErroredText,
18
19
  maxCharsAllowed = 300,
20
+ preview = false,
19
21
  translateFunc,
20
22
  }: ContactFormContent & I18nFacade = $props();
21
23
 
24
+ const id = randomID();
25
+
22
26
  let name = $state('');
23
27
  let email = $state('');
24
28
  let question = $state('');
@@ -33,7 +37,8 @@
33
37
  let currentCharsCount = $derived(question.length);
34
38
  let showMaxCharsMessage = $derived(currentCharsCount > maxCharsAllowed - 50);
35
39
  let canSubmit: boolean = $derived(
36
- name.length > 0 &&
40
+ !preview &&
41
+ name.length > 0 &&
37
42
  email.length > 0 &&
38
43
  question.length > 0 &&
39
44
  question.length <= maxCharsAllowed,
@@ -74,24 +79,43 @@
74
79
  }, 15000);
75
80
  };
76
81
 
77
- let disabled = $derived(errored || successfullySent);
82
+ let disabled = $derived(preview || errored || successfullySent);
78
83
  </script>
79
84
 
80
85
  <div class="wrapper">
81
86
  {#if explainer}
82
87
  <div class="explainer">{@html translateFunc ? translateFunc(explainer) : ''}</div>
83
88
  {/if}
89
+
84
90
  <form onsubmit={submitMessage}>
85
91
  <input type="hidden" value={userID} />
86
- <label class:disabled>
87
- {@html translateFunc ? translateFunc(nameLabel) : 'Name'}:
88
- <TextInput type="text" marginForMessage={false} bind:value={name} enabled={!disabled} />
92
+ <label for={`${id}-name`}>
93
+ <span class:disabled>{@html translateFunc ? translateFunc(nameLabel) : 'Name'}:</span>
89
94
  </label>
90
- <label class:disabled>
91
- {@html translateFunc ? translateFunc(emailLabel) : 'Email'}:
92
- <TextInput type="email" marginForMessage={false} bind:value={email} enabled={!disabled} />
95
+ <div class="input-wrapper">
96
+ <TextInput
97
+ id={`${id}-name`}
98
+ type="text"
99
+ marginForMessage={false}
100
+ bind:value={name}
101
+ enabled={!disabled}
102
+ />
103
+ </div>
104
+ <label for={`${id}-email`}>
105
+ <span class:disabled>{@html translateFunc ? translateFunc(emailLabel) : 'Email'}:</span>
93
106
  </label>
94
- <label class="row-label"
107
+
108
+ <div class="input-wrapper">
109
+ <TextInput
110
+ id={`${id}-email`}
111
+ type="email"
112
+ marginForMessage={false}
113
+ bind:value={email}
114
+ enabled={!disabled}
115
+ />
116
+ </div>
117
+
118
+ <label class="notes-input"
95
119
  ><div class:disabled>
96
120
  {@html translateFunc
97
121
  ? translateFunc(questionLabel)
@@ -99,19 +123,22 @@
99
123
  >&nbsp;({currentCharsCount}/{maxCharsAllowed})</span
100
124
  >{/if}:
101
125
  </div>
102
-
103
- <Notes {disabled} changed={questionChanged} />
126
+ <Notes id={`${id}-notes`} {disabled} changed={questionChanged} />
104
127
  </label>
105
- {#if successfullySent}
106
- <div class="success">
107
- {translateFunc ? translateFunc(successfullySentText) : 'Successfully Sent Email'}
108
- </div>
109
- {/if}
110
- {#if errored}
111
- <div class="error">
112
- {translateFunc ? translateFunc(sentErroredText) : 'Error Occurred Sending Email'}
113
- </div>
114
- {/if}
128
+
129
+ <div class="message-wrapper">
130
+ {#if preview}<div>[PREVIEW]</div>{/if}
131
+ {#if successfullySent || preview}
132
+ <div class="success">
133
+ {translateFunc ? translateFunc(successfullySentText) : 'Successfully Sent Email'}
134
+ </div>
135
+ {/if}
136
+ {#if errored || preview}
137
+ <div class="error">
138
+ {translateFunc ? translateFunc(sentErroredText) : 'Error Occurred Sending Email'}
139
+ </div>
140
+ {/if}
141
+ </div>
115
142
  <div class="button-wrapper">
116
143
  <Button
117
144
  enabled={canSubmit && !disabled}
@@ -128,13 +155,13 @@
128
155
  <style>
129
156
  .explainer {
130
157
  margin-bottom: 1rem;
158
+ grid-column: span 2;
131
159
  }
132
160
 
133
161
  .wrapper {
134
162
  background-color: var(--main-bg-color);
135
163
  color: var(--main-font-color);
136
164
 
137
- width: 100%;
138
165
  display: flex;
139
166
  flex-direction: column;
140
167
  align-items: center;
@@ -147,22 +174,42 @@
147
174
  }
148
175
 
149
176
  form {
150
- display: flex;
151
- flex-direction: column;
152
- width: 100%;
153
- gap: 0.5rem;
154
- }
177
+ display: grid;
178
+ grid-template-columns: [start] 1fr [gap-start] 0.5fr [gap-end] 3fr [end];
179
+ row-gap: 0.5rem;
180
+
181
+ label {
182
+ align-content: center;
183
+ grid-column-start: start;
184
+ grid-column-end: gap-start;
185
+ }
155
186
 
156
- label {
157
- display: flex;
158
- gap: 1rem;
159
- align-items: center;
160
- justify-content: space-between;
161
- }
187
+ .message-wrapper {
188
+ margin-top: 1rem;
189
+ grid-column-start: start;
190
+ grid-column-end: end;
191
+ display: flex;
192
+ justify-content: space-between;
193
+ }
194
+ .button-wrapper {
195
+ grid-column-start: start;
196
+ grid-column-end: end;
197
+ display: flex;
198
+ justify-content: flex-start;
199
+ }
200
+ .input-wrapper {
201
+ grid-column-start: gap-end;
202
+ grid-column-end: end;
203
+ }
162
204
 
163
- .row-label {
164
- flex-direction: column;
165
- gap: 0.2rem;
205
+ .notes-input {
206
+ margin-top: 2rem;
207
+ grid-column-start: start;
208
+ grid-column-end: end;
209
+ display: flex;
210
+ flex-direction: column;
211
+ gap: 1rem;
212
+ }
166
213
  }
167
214
 
168
215
  .max-chars-message {
@@ -5,7 +5,7 @@
5
5
  import type { I18nFacade, PricingShortContent, PricingEntry } from './types.js';
6
6
 
7
7
  let {
8
- global = undefined,
8
+ global,
9
9
  entries = [],
10
10
  ranges = [],
11
11
  staticRanges = [],
package/dist/types.d.ts CHANGED
@@ -263,6 +263,7 @@ export interface ContactFormContent {
263
263
  sentErroredText: string;
264
264
  maxCharsAllowed?: number;
265
265
  explainer?: string;
266
+ preview?: boolean;
266
267
  }
267
268
  export interface BookingRequest {
268
269
  id: string;
@@ -282,9 +283,9 @@ export interface BookingRequestContent {
282
283
  sentErroredText: string;
283
284
  invalidText: string;
284
285
  messageLabel: string;
285
- numberOfNightsLabel: string;
286
286
  maxCharsAllowed?: number;
287
287
  explainer?: string;
288
+ preview?: boolean;
288
289
  }
289
290
  export type Block = Text | Photo | PhotoGallery | Calendar | CalendarAvailable | CalendarGrid | CalendarRows | Pricing | PricingShort | AmenitiesCore | Weather | LeafletMap | AccoCard | AccoDescription | ContactForm | BookingRequest | undefined;
290
291
  export interface FontSpec {
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "accomadesc",
3
- "version": "0.2.13",
3
+ "version": "0.2.15",
4
4
  "scripts": {
5
5
  "dev": "vite dev",
6
6
  "build": "vite build && npm run package",
7
7
  "preview": "vite preview",
8
+ "prepare": "svelte-kit sync || echo ''",
9
+ "prepack": "svelte-kit sync && svelte-package && publint",
8
10
  "package": "svelte-kit sync && svelte-package && publint",
9
11
  "prepublishOnly": "npm run package",
10
12
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
@@ -49,8 +51,7 @@
49
51
  "svelte": "^5.20.5",
50
52
  "svelte-check": "^4.1.4",
51
53
  "typescript": "^5.8.2",
52
- "vite": "^6.2.0",
53
- "vitest": "^2.1.9"
54
+ "vite": "^6.2.0"
54
55
  },
55
56
  "dependencies": {
56
57
  "@dinero.js/currencies": "2.0.0-alpha.14",
@@ -62,7 +63,6 @@
62
63
  "luxon": "^3.5.0",
63
64
  "squirrelly": "^9.1.0"
64
65
  },
65
- "packageManager": "pnpm@10.5.2+sha512.da9dc28cd3ff40d0592188235ab25d3202add8a207afbedc682220e4a0029ffbff4562102b9e6e46b4e3f9e8bd53e6d05de48544b0c57d4b0179e22c76d1199b",
66
66
  "pnpm": {
67
67
  "onlyBuiltDependencies": [
68
68
  "esbuild"