@nylas/web-elements 1.1.0-canary.10 → 1.1.0-canary.11
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.
- package/dist/cjs/add-circle-icon_21.cjs.entry.js +73 -40
- package/dist/cjs/add-circle-icon_21.cjs.entry.js.map +1 -1
- package/dist/cjs/google-logo-icon_4.cjs.entry.js +5 -4
- package/dist/cjs/google-logo-icon_4.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/nylas-api-request-05f1e068.js.map +1 -1
- package/dist/cjs/nylas-api-request-de316f1a.js.map +1 -1
- package/dist/cjs/nylas-availability-picker.cjs.entry.js +14 -7
- package/dist/cjs/nylas-availability-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-booked-event-card.cjs.entry.js +1 -1
- package/dist/cjs/nylas-booked-event-card_10.cjs.entry.js +9 -9
- package/dist/cjs/nylas-booking-calendar-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-booking-form.cjs.entry.js +3 -3
- package/dist/cjs/nylas-buffer-time.cjs.entry.js +7 -6
- package/dist/cjs/nylas-buffer-time.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-calendar-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-date-picker.cjs.entry.js +1 -1
- package/dist/cjs/nylas-editor-tabs.cjs.entry.js +5 -4
- package/dist/cjs/nylas-editor-tabs.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-event-description.cjs.entry.js +2 -2
- package/dist/cjs/nylas-event-description.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-event-duration.cjs.entry.js +1 -1
- package/dist/cjs/nylas-event-duration.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-event-info.cjs.entry.js +1 -1
- package/dist/cjs/nylas-event-info.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-event-limits.cjs.entry.js +1 -1
- package/dist/cjs/nylas-event-limits.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-event-title.cjs.entry.js +2 -2
- package/dist/cjs/nylas-if-state.cjs.entry.js +1 -1
- package/dist/cjs/nylas-limit-future-bookings.cjs.entry.js +1 -1
- package/dist/cjs/nylas-limit-future-bookings.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-locale-switch.cjs.entry.js +3 -3
- package/dist/cjs/nylas-location-component.cjs.entry.js +4 -4
- package/dist/cjs/nylas-location-component.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-min-cancellation-notice.cjs.entry.js +1 -1
- package/dist/cjs/nylas-min-cancellation-notice.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-scheduler-editor.cjs.entry.js +1 -1
- package/dist/cjs/nylas-scheduler-editor.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-selected-event-card.cjs.entry.js +1 -1
- package/dist/cjs/nylas-time-window-picker.cjs.entry.js +39 -14
- package/dist/cjs/nylas-time-window-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/nylas-web-elements.cjs.js +1 -1
- package/dist/cjs/scheduler-config-store-918c20d5.js.map +1 -1
- package/dist/cjs/scheduler-config-store-a5b7c08b.js.map +1 -1
- package/dist/collection/collection-manifest.json +3 -3
- package/dist/collection/common/nylas-api-request.js.map +1 -1
- package/dist/collection/components/nylas-if-state/nylas-if-state.js +1 -1
- package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.js +1 -1
- package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js +3 -3
- package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js +1 -1
- package/dist/collection/components/scheduler/nylas-locale-switch/nylas-locale-switch.js +3 -3
- package/dist/collection/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.js +1 -1
- package/dist/collection/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.js +35 -14
- package/dist/collection/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-booking-calendar-picker/nylas-booking-calendar-picker.js +1 -1
- package/dist/collection/components/scheduler-editor/nylas-booking-calendar-picker/nylas-booking-calendar-picker.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.css +1 -1
- package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.js +6 -5
- package/dist/collection/components/scheduler-editor/nylas-buffer-time/nylas-buffer-time.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-buffer-time/test/nylas-buffer-time.spec.js +2 -2
- package/dist/collection/components/scheduler-editor/nylas-buffer-time/test/nylas-buffer-time.spec.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-calendar-picker/nylas-calendar-picker.js +1 -1
- package/dist/collection/components/scheduler-editor/nylas-calendar-picker/nylas-calendar-picker.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.js +6 -5
- package/dist/collection/components/scheduler-editor/nylas-editor-tabs/nylas-editor-tabs.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-event-description/nylas-event-description.js +5 -5
- package/dist/collection/components/scheduler-editor/nylas-event-description/nylas-event-description.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-event-duration/nylas-event-duration.js +4 -4
- package/dist/collection/components/scheduler-editor/nylas-event-duration/nylas-event-duration.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-event-info/nylas-event-info.js +1 -1
- package/dist/collection/components/scheduler-editor/nylas-event-info/nylas-event-info.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-event-limits/nylas-event-limits.js +1 -1
- package/dist/collection/components/scheduler-editor/nylas-event-limits/nylas-event-limits.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-event-title/nylas-event-title.js +2 -2
- package/dist/collection/components/scheduler-editor/nylas-limit-future-bookings/nylas-limit-future-bookings.js +4 -4
- package/dist/collection/components/scheduler-editor/nylas-limit-future-bookings/nylas-limit-future-bookings.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-location-component/nylas-location-component.js +23 -23
- package/dist/collection/components/scheduler-editor/nylas-location-component/nylas-location-component.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-min-cancellation-notice/nylas-min-cancellation-notice.js +3 -3
- package/dist/collection/components/scheduler-editor/nylas-min-cancellation-notice/nylas-min-cancellation-notice.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.js +9 -9
- package/dist/collection/components/scheduler-editor/nylas-scheduler-editor/nylas-scheduler-editor.js.map +1 -1
- package/dist/collection/components/scheduler-editor/nylas-time-window-picker/nylas-time-window-picker.js +56 -57
- package/dist/collection/components/scheduler-editor/nylas-time-window-picker/nylas-time-window-picker.js.map +1 -1
- package/dist/collection/stores/scheduler-config-store.js.map +1 -1
- package/dist/collection/types/index.js +6 -0
- package/dist/collection/types/index.js.map +1 -0
- package/dist/components/nylas-api-request.js.map +1 -1
- package/dist/components/nylas-availability-picker2.js +15 -8
- package/dist/components/nylas-availability-picker2.js.map +1 -1
- package/dist/components/nylas-booked-event-card2.js +1 -1
- package/dist/components/nylas-booking-calendar-picker2.js.map +1 -1
- package/dist/components/nylas-booking-form2.js +3 -3
- package/dist/components/nylas-buffer-time2.js +7 -6
- package/dist/components/nylas-buffer-time2.js.map +1 -1
- package/dist/components/nylas-calendar-picker2.js.map +1 -1
- package/dist/components/nylas-date-picker2.js +1 -1
- package/dist/components/nylas-editor-tabs2.js +5 -4
- package/dist/components/nylas-editor-tabs2.js.map +1 -1
- package/dist/components/nylas-event-description2.js +2 -2
- package/dist/components/nylas-event-description2.js.map +1 -1
- package/dist/components/nylas-event-duration2.js +1 -1
- package/dist/components/nylas-event-duration2.js.map +1 -1
- package/dist/components/nylas-event-info2.js +1 -1
- package/dist/components/nylas-event-info2.js.map +1 -1
- package/dist/components/nylas-event-limits2.js +1 -1
- package/dist/components/nylas-event-limits2.js.map +1 -1
- package/dist/components/nylas-event-title2.js +2 -2
- package/dist/components/nylas-if-state.js +1 -1
- package/dist/components/nylas-limit-future-bookings2.js +1 -1
- package/dist/components/nylas-limit-future-bookings2.js.map +1 -1
- package/dist/components/nylas-locale-switch2.js +3 -3
- package/dist/components/nylas-location-component2.js +5 -5
- package/dist/components/nylas-location-component2.js.map +1 -1
- package/dist/components/nylas-min-cancellation-notice2.js +1 -1
- package/dist/components/nylas-min-cancellation-notice2.js.map +1 -1
- package/dist/components/nylas-scheduler-editor.js +1 -1
- package/dist/components/nylas-scheduler-editor.js.map +1 -1
- package/dist/components/nylas-selected-event-card2.js +1 -1
- package/dist/components/nylas-time-window-picker2.js +39 -16
- package/dist/components/nylas-time-window-picker2.js.map +1 -1
- package/dist/components/scheduler-config-store.js.map +1 -1
- package/dist/esm/add-circle-icon_21.entry.js +73 -40
- package/dist/esm/add-circle-icon_21.entry.js.map +1 -1
- package/dist/esm/google-logo-icon_4.entry.js +5 -4
- package/dist/esm/google-logo-icon_4.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/nylas-api-request-59738f8c.js.map +1 -1
- package/dist/esm/nylas-api-request-ff2869d7.js.map +1 -1
- package/dist/esm/nylas-availability-picker.entry.js +14 -7
- package/dist/esm/nylas-availability-picker.entry.js.map +1 -1
- package/dist/esm/nylas-booked-event-card.entry.js +1 -1
- package/dist/esm/nylas-booked-event-card_10.entry.js +9 -9
- package/dist/esm/nylas-booking-calendar-picker.entry.js.map +1 -1
- package/dist/esm/nylas-booking-form.entry.js +3 -3
- package/dist/esm/nylas-buffer-time.entry.js +7 -6
- package/dist/esm/nylas-buffer-time.entry.js.map +1 -1
- package/dist/esm/nylas-calendar-picker.entry.js.map +1 -1
- package/dist/esm/nylas-date-picker.entry.js +1 -1
- package/dist/esm/nylas-editor-tabs.entry.js +5 -4
- package/dist/esm/nylas-editor-tabs.entry.js.map +1 -1
- package/dist/esm/nylas-event-description.entry.js +2 -2
- package/dist/esm/nylas-event-description.entry.js.map +1 -1
- package/dist/esm/nylas-event-duration.entry.js +1 -1
- package/dist/esm/nylas-event-duration.entry.js.map +1 -1
- package/dist/esm/nylas-event-info.entry.js +1 -1
- package/dist/esm/nylas-event-info.entry.js.map +1 -1
- package/dist/esm/nylas-event-limits.entry.js +1 -1
- package/dist/esm/nylas-event-limits.entry.js.map +1 -1
- package/dist/esm/nylas-event-title.entry.js +2 -2
- package/dist/esm/nylas-if-state.entry.js +1 -1
- package/dist/esm/nylas-limit-future-bookings.entry.js +1 -1
- package/dist/esm/nylas-limit-future-bookings.entry.js.map +1 -1
- package/dist/esm/nylas-locale-switch.entry.js +3 -3
- package/dist/esm/nylas-location-component.entry.js +4 -4
- package/dist/esm/nylas-location-component.entry.js.map +1 -1
- package/dist/esm/nylas-min-cancellation-notice.entry.js +1 -1
- package/dist/esm/nylas-min-cancellation-notice.entry.js.map +1 -1
- package/dist/esm/nylas-scheduler-editor.entry.js +1 -1
- package/dist/esm/nylas-scheduler-editor.entry.js.map +1 -1
- package/dist/esm/nylas-selected-event-card.entry.js +1 -1
- package/dist/esm/nylas-time-window-picker.entry.js +39 -14
- package/dist/esm/nylas-time-window-picker.entry.js.map +1 -1
- package/dist/esm/nylas-web-elements.js +1 -1
- package/dist/esm/scheduler-config-store-8ccc8dc7.js.map +1 -1
- package/dist/esm/scheduler-config-store-ec3b6190.js.map +1 -1
- package/dist/nylas-web-elements/nylas-api-request-ff2869d7.js.map +1 -1
- package/dist/nylas-web-elements/nylas-availability-picker.entry.js +14 -7
- package/dist/nylas-web-elements/nylas-availability-picker.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-booked-event-card.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-booking-calendar-picker.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-booking-form.entry.js +3 -3
- package/dist/nylas-web-elements/nylas-buffer-time.entry.js +7 -6
- package/dist/nylas-web-elements/nylas-buffer-time.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-calendar-picker.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-date-picker.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-editor-tabs.entry.js +5 -4
- package/dist/nylas-web-elements/nylas-editor-tabs.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-description.entry.js +2 -2
- package/dist/nylas-web-elements/nylas-event-description.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-duration.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-event-duration.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-info.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-event-info.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-limits.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-event-limits.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-event-title.entry.js +2 -2
- package/dist/nylas-web-elements/nylas-if-state.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-limit-future-bookings.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-limit-future-bookings.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-locale-switch.entry.js +3 -3
- package/dist/nylas-web-elements/nylas-location-component.entry.js +4 -4
- package/dist/nylas-web-elements/nylas-location-component.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-min-cancellation-notice.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-min-cancellation-notice.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-selected-event-card.entry.js +1 -1
- package/dist/nylas-web-elements/nylas-time-window-picker.entry.js +39 -14
- package/dist/nylas-web-elements/nylas-time-window-picker.entry.js.map +1 -1
- package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
- package/dist/nylas-web-elements/p-0dabcb4d.js.map +1 -1
- package/dist/nylas-web-elements/{p-933c6d32.entry.js → p-181654f5.entry.js} +3 -3
- package/dist/nylas-web-elements/{p-933c6d32.entry.js.map → p-181654f5.entry.js.map} +1 -1
- package/dist/nylas-web-elements/{p-b1b3eb52.entry.js → p-1871c702.entry.js} +2 -2
- package/dist/nylas-web-elements/p-4f4e83d0.entry.js +2 -0
- package/dist/nylas-web-elements/p-4f4e83d0.entry.js.map +1 -0
- package/dist/nylas-web-elements/p-a219b2c7.entry.js +2 -0
- package/dist/nylas-web-elements/p-a219b2c7.entry.js.map +1 -0
- package/dist/nylas-web-elements/{p-a002b4cf.entry.js → p-e92690a2.entry.js} +2 -2
- package/dist/nylas-web-elements/p-ee91a2a0.js.map +1 -1
- package/dist/nylas-web-elements/scheduler-config-store-8ccc8dc7.js.map +1 -1
- package/dist/types/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.d.ts +10 -5
- package/dist/types/components/scheduler-editor/nylas-event-description/nylas-event-description.d.ts +2 -2
- package/dist/types/components/scheduler-editor/nylas-location-component/nylas-location-component.d.ts +2 -2
- package/dist/types/components/scheduler-editor/nylas-time-window-picker/nylas-time-window-picker.d.ts +8 -3
- package/dist/types/components.d.ts +125 -32
- package/dist/types/stores/scheduler-config-store.d.ts +5 -1
- package/dist/types/types/index.d.ts +73 -0
- package/package.json +4 -2
- package/dist/nylas-web-elements/p-74492776.entry.js +0 -2
- package/dist/nylas-web-elements/p-74492776.entry.js.map +0 -1
- package/dist/nylas-web-elements/p-76461af6.entry.js +0 -2
- package/dist/nylas-web-elements/p-76461af6.entry.js.map +0 -1
- /package/dist/nylas-web-elements/{p-b1b3eb52.entry.js.map → p-1871c702.entry.js.map} +0 -0
- /package/dist/nylas-web-elements/{p-a002b4cf.entry.js.map → p-e92690a2.entry.js.map} +0 -0
|
@@ -56,9 +56,9 @@ const NylasAvailabilityPicker = class {
|
|
|
56
56
|
this.host.setAttribute('name', newValue);
|
|
57
57
|
}
|
|
58
58
|
configChangedHandler(newConfig) {
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
this.openHoursToSchedule(
|
|
59
|
+
const organizer = newConfig?.participants?.find(p => p.is_organizer);
|
|
60
|
+
if (organizer && organizer?.availability?.open_hours) {
|
|
61
|
+
this.openHoursToSchedule(organizer?.availability?.open_hours);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
scheduleChanged(newValue, oldValue) {
|
|
@@ -207,7 +207,13 @@ const NylasAvailabilityPicker = class {
|
|
|
207
207
|
this.schedule[day].splice(index, 1);
|
|
208
208
|
this.schedule = { ...this.schedule };
|
|
209
209
|
}
|
|
210
|
-
setTime(
|
|
210
|
+
setTime(event) {
|
|
211
|
+
console.log('timeChanged', event);
|
|
212
|
+
const { key, value } = event.detail;
|
|
213
|
+
console.log({
|
|
214
|
+
key,
|
|
215
|
+
value,
|
|
216
|
+
});
|
|
211
217
|
const [dayIndex, timeType] = key.split('_');
|
|
212
218
|
const [day, index] = dayIndex.split(':');
|
|
213
219
|
if (timeType === 'start') {
|
|
@@ -219,7 +225,8 @@ const NylasAvailabilityPicker = class {
|
|
|
219
225
|
this.internals.setValidity({ customError: false });
|
|
220
226
|
this.schedule = { ...this.schedule };
|
|
221
227
|
}
|
|
222
|
-
setFormError(
|
|
228
|
+
setFormError(event) {
|
|
229
|
+
const { key } = event.detail;
|
|
223
230
|
const [_, timeType] = key.split('_');
|
|
224
231
|
const element = this.host.shadowRoot?.getElementById(key);
|
|
225
232
|
if (element) {
|
|
@@ -301,7 +308,7 @@ const NylasAvailabilityPicker = class {
|
|
|
301
308
|
label: constants.TIMEZONE_MAP[key],
|
|
302
309
|
value: key,
|
|
303
310
|
}));
|
|
304
|
-
return (index.h(index.Host, { key: '
|
|
311
|
+
return (index.h(index.Host, { key: 'ebdf308b5d2e38cbbe9c01915a8704cdc137b56f' }, index.h("div", { key: '81557accec232465b3e86d5d0bdc1ae25aa8d6de', class: "nylas-availability-picker" }, index.h("div", { key: 'f5c2a5ef92fc59568672b536a9e604547561b8d6', class: "header", part: "nap__header" }, index.h("h3", { key: 'cbccae32847e68a5fe47f9f1f901e55546621c36' }, "General availability"), index.h("p", { key: '34600ddd459b5d681574458f4f4acdb5ed26f7ac' }, "Set your availability for scheduling meetings.")), index.h("div", { key: '65785316b94376cf4d79de9c875e39060226ca31', class: "content" }, index.h("div", { key: '5c30c0bd916460f668dc3f881b4b01a1792e59b0', class: "select-timezone", part: "nap__select-timezone" }, index.h("h4", { key: '0638898cae070a5d9eae8cd1dca83e39e5bb735f', class: "sub-header" }, "Select timezone", index.h("span", { key: 'd6746b3329ba92bf5c759895444d08924ba7769c', class: "icon" }, index.h("tooltip-component", { key: '76dbc460bd91fa0f33a65c65ce092ad966ce6535' }, index.h("info-icon", { key: '5778fb41c006172a125a4430186ad85d4cdbaf3c', slot: "tooltip-icon" }), index.h("span", { key: '76132f33db5dce9d7d7e5e111065ad9d1ec64d3f', slot: "tooltip-content" }, "Select your timezone for displaying availability.")))), index.h("select-dropdown", { key: '9a0a3702b4868109ccc8f77e1143727de1e3f1fa', name: "timezone", exportparts: "sd_dropdown: nap__timezone-container, sd_dropdown-button: nap__timezone-button, sd_dropdown-content: nap__timezone-dropdown-content", options: timezoneOptions, defaultSelectedOption: timezoneOptions.find(i => i.value === this.defaultTimezone) }, index.h("span", { key: 'ed0756090602c8a52ffdae493f09cfa7d61dd1e9', slot: "select-icon" }, index.h("globe-icon", { key: '6e5e5234210ba8cc50ef57338a2f4e926521cb70', width: "20", height: "20" })))), index.h("div", { key: 'eac4322bf2aa8f5ea84e4d7ccee293803c70b2ac', class: "availability", part: "nap__availability" }, Object.keys(this.schedule).map(key => {
|
|
305
312
|
const day = key;
|
|
306
313
|
const timeRanges = this.schedule[key];
|
|
307
314
|
return (index.h("div", { class: "availability-day" }, index.h("div", { class: "day", part: "nap__day" }, index.h("input", { type: "checkbox", name: day, id: day, checked: timeRanges.length > 0, onClick: () => {
|
|
@@ -316,7 +323,7 @@ const NylasAvailabilityPicker = class {
|
|
|
316
323
|
timeRanges.map((timeRange, timeRangeIndex) => {
|
|
317
324
|
const startKey = `${key}:${timeRangeIndex}_start`;
|
|
318
325
|
const endKey = `${key}:${timeRangeIndex}_end`;
|
|
319
|
-
return (index.h("div", { class: "time-range", part: "nap__time-range" }, index.h("div", { class: "pickers" }, index.h("nylas-time-window-picker", { id: startKey, hasError: this.overlapDays[day]?.includes(timeRangeIndex), time: timeRange.start, name: startKey, key: startKey, exportparts: "time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times"
|
|
326
|
+
return (index.h("div", { class: "time-range", part: "nap__time-range" }, index.h("div", { class: "pickers" }, index.h("nylas-time-window-picker", { id: startKey, hasError: this.overlapDays[day]?.includes(timeRangeIndex), time: timeRange.start, name: startKey, key: startKey, exportparts: "time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times" }), index.h("span", null, " - "), index.h("nylas-time-window-picker", { id: endKey, hasError: this.overlapDays[day]?.includes(timeRangeIndex), time: timeRange.end, name: endKey, key: endKey, minimumStartTime: timeRange.start, exportparts: "time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times" })), index.h("button", { onClick: () => this.removeTimeRange(day, timeRangeIndex) }, index.h("close-icon", null))));
|
|
320
327
|
}), index.h("p", { class: "error" }, this.overlapDays[day] ? 'Overlapping time ranges' : '')), index.h("div", null, timeRanges.length > 0 ? (index.h("button", { onClick: () => this.addTimeRange(day), part: "nap__add-time-range" }, index.h("add-circle-icon", null))) : null)));
|
|
321
328
|
}))))));
|
|
322
329
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"nylas-availability-picker.entry.cjs.js","mappings":";;;;;;;;;;AAAA,MAAM,0BAA0B,GAAG,m/IAAm/I;;;;;;;;;;;;;;;;MC8CzgJ,uBAAuB;;;;;;;;;;;;;oBAIX,cAAc;+BACH,IAAI,CAAC,cAAc,EAAE,CAAC,eAAe,EAAE,CAAC,QAAQ;wBAiB9D;YAClB,GAAG,EAAE,EAAE;YACP,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS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BAAQ,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,IAAI,EAAC,qBAAqB,IACvEA,gCAAmB,CACZ,IACP,IAAI,CACJ,CACF,EACN;SACH,CAAC,CACE,CACF,CACF,CACD,EACP;KACH;;;;;;;;;AAnHD;IALCE,mCAAiB,CAA6G;QAC7H,IAAI,EAAE,2BAA2B;QACjC,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,uCAAuC,EAAE,uBAAuB,CAAC,CAAC,CAAC;QAC3F,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;qDAoHD;;;;;","names":["debug","timeToMinutes","convertTo12HourFormat","minutesToTime","convertTo24HourFormat","TIMEZONE_MAP","h","Host","RegisterComponent"],"sources":["src/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.scss?tag=nylas-availability-picker&encapsulation=shadow","src/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n @include default-css-variables;\n width: inherit;\n}\n\n.nylas-availability-picker {\n width: inherit;\n display: flex;\n flex-direction: column;\n margin: 1rem;\n border-radius: var(--nylas-border-radius-2x);\n border: 1px solid var(--nylas-base-200);\n .header {\n padding: 1rem;\n border-bottom: 1px solid var(--nylas-base-200);\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n line-height: 20px;\n color: var(--nylas-base-900);\n text-align: left;\n }\n p {\n margin: 0.25rem 0 0 0;\n font-size: 0.875rem;\n font-weight: 400;\n line-height: 20px;\n color: var(--nylas-base-600);\n text-align: left;\n }\n }\n .content {\n padding: 1rem;\n color: var(--nylas-base-900);\n font-size: 16px;\n font-family: var(--nylas-font-family);\n @media #{$small-mobile} {\n font-size: 15px;\n }\n .select-timezone {\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: 1px solid var(--nylas-base-200);\n padding-bottom: 1rem;\n gap: 1rem;\n h4 {\n display: flex;\n gap: 0.5rem;\n align-items: center;\n margin: 0;\n font-size: 16px;\n @media #{$small-mobile} {\n font-size: 15px;\n }\n font-weight: 500;\n line-height: 20px;\n }\n select-dropdown {\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n }\n }\n .availability {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n padding: 0 0.5rem;\n @media #{$small-mobile} {\n gap: 0.5rem;\n padding: 0;\n }\n margin: 1rem 0;\n .availability-day {\n display: grid;\n grid-template-columns: minmax(auto, 65px) 1fr minmax(auto, 40px);\n @media #{$mobile} {\n grid-template-columns: 78px 1fr auto;\n }\n @media #{$small-mobile} {\n display: inline-grid;\n gap: 8px;\n grid-template-columns: 60px 1fr auto;\n }\n gap: 1rem;\n align-items: baseline;\n .day {\n display: flex;\n gap: 0.5rem;\n @media #{$small-mobile} {\n gap: 0.25rem;\n }\n align-items: center;\n\n input[type='checkbox'] {\n transform: scale(1.3);\n }\n }\n .time-ranges {\n span.unavailable {\n height: 48px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .time-range {\n display: flex;\n gap: 1.5rem;\n justify-content: space-between;\n align-items: baseline;\n @media #{$small-mobile} {\n justify-content: unset;\n gap: 0.5rem;\n }\n .pickers {\n display: flex;\n gap: 1rem;\n @media #{$small-mobile} {\n gap: 0.5rem;\n }\n span {\n margin-top: 0.75rem;\n }\n }\n &:not(:last-of-type) {\n margin-bottom: 1rem;\n }\n }\n p.error {\n color: var(--nylas-error);\n }\n }\n button {\n border: none;\n background: transparent;\n height: 40px;\n cursor: pointer;\n color: var(--nylas-base-800);\n &:hover,\n &:active {\n color: var(--nylas-primary);\n }\n }\n }\n }\n }\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { convertTo12HourFormat, convertTo24HourFormat, debug, minutesToTime, timeToMinutes } from '@/utils/utils';\nimport { AttachInternals, Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { TIMEZONE_MAP } from '@/common/constants';\nimport { Configuration } from '@nylas/core';\n\ntype OpenHours = {\n days: number[];\n start: string;\n end: string;\n timezone: string;\n};\n\ntype Schedule = {\n SUN: { start: string; end: string }[];\n MON: { start: string; end: string }[];\n TUE: { start: string; end: string }[];\n WED: { start: string; end: string }[];\n THU: { start: string; end: string }[];\n FRI: { start: string; end: string }[];\n SAT: { start: string; end: string }[];\n};\n\n/**\n * The `nylas-availability-picker` component is a form input for selecting availability (open hours).\n * @part nap__header - The header of the availability picker\n * @part nap__select-timezone - The timezone selection container\n * @part nap__select-timezone-button - The timezone selection button\n * @part nap__select-timezone-dropdown-content - The timezone selection dropdown content\n * @part nap__availability - The availability container\n * @part nap__day - The day container\n * @part nap__time-ranges - The time ranges container\n * @part nap__time-range - The time range container\n * @part nap__add-time-range - The add time range button\n * @part nap__time-picker-container - The time picker container\n * @part nap__time-picker-input - The time picker input\n * @part nap__time-picker-times - The time picker times\n */\n@Component({\n tag: 'nylas-availability-picker',\n styleUrl: 'nylas-availability-picker.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasAvailabilityPicker {\n @Element() host!: HTMLNylasAvailabilityPickerElement;\n @Prop() selectedConfiguration?: Configuration;\n @Prop() openHours?: OpenHours[];\n @Prop() name: string = 'availability';\n @Prop() defaultTimezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n /**\n * This event is fired when the selected availability / open hours change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: {\n openHours: OpenHours[];\n timezone: string;\n };\n name: string;\n }>;\n\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n @State() schedule = {\n SUN: [],\n MON: [{ start: '09:00am', end: '05:00pm' }],\n TUE: [{ start: '09:00am', end: '05:00pm' }],\n WED: [{ start: '09:00am', end: '05:00pm' }],\n THU: [{ start: '09:00am', end: '05:00pm' }],\n FRI: [{ start: '09:00am', end: '05:00pm' }],\n SAT: [],\n };\n @State() timezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n @State() overlapDays: { [key: string]: number[] } = {};\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-calendar-picker', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('selectedConfiguration')\n configChangedHandler(newConfig: Configuration) {\n const organizerParticipant = newConfig?.participants?.find(p => p.is_organizer);\n if (organizerParticipant && organizerParticipant?.availability?.open_hours) {\n this.openHoursToSchedule(organizerParticipant?.availability?.open_hours);\n }\n }\n\n @Watch('schedule')\n scheduleChanged(newValue: Schedule, oldValue: Schedule) {\n if (newValue !== oldValue) {\n this.valueChanged.emit({\n value: {\n openHours: this.scheduleToOpenHours(newValue),\n timezone: this.timezone,\n },\n name: this.name,\n });\n let overlapDays: { [key: string]: number[] } = {};\n Object.keys(newValue).forEach(key => {\n const dayTimeRanges = newValue[key];\n if (dayTimeRanges.length > 0) {\n const overlaps = this.getOverlaps(dayTimeRanges);\n if (overlaps.length > 0) {\n overlapDays[key] = overlaps;\n }\n }\n });\n this.overlapDays = overlapDays;\n if (typeof this.internals.setFormValue !== 'function') {\n return;\n }\n if (Object.keys(overlapDays).length > 0) {\n const element = this.host.shadowRoot?.getElementById(Object.keys(overlapDays)[0]) as HTMLInputElement;\n if (element) {\n this.internals.setValidity({ customError: true }, 'Overlapping time ranges found', element);\n }\n } else {\n this.internals.setValidity({ customError: false });\n this.internals.setFormValue(\n JSON.stringify({\n openHours: this.scheduleToOpenHours(this.schedule),\n timezone: this.timezone,\n }),\n );\n }\n }\n }\n\n @Listen('selectedOptionChanged')\n selectedOptionChangedHandler(\n event: CustomEvent<{\n value: string;\n name: string;\n }>,\n ) {\n const { name, value } = event.detail;\n if (name === 'timezone') {\n this.timezone = value;\n if (typeof this.internals.setFormValue !== 'function') {\n return;\n }\n this.internals.setFormValue(\n JSON.stringify({\n openHours: this.scheduleToOpenHours(this.schedule),\n timezone: this.timezone,\n }),\n );\n }\n }\n\n connectedCallback() {\n debug('nylas-availability-picker', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-availability-picker', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-availability-picker', 'componentWillLoad');\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-availability-picker', 'componentDidLoad');\n if (this.openHours && this.openHours.length > 0) {\n this.openHoursToSchedule(this.openHours);\n }\n if (typeof this.internals.setFormValue !== 'function') {\n return;\n }\n this.internals.setFormValue(\n JSON.stringify({\n openHours: this.scheduleToOpenHours(this.schedule),\n timezone: this.timezone,\n }),\n );\n }\n\n getOverlaps(timeRanges) {\n // Convert times to minutes and add to the array\n let timeRangesInMinutes = timeRanges.map((range, index) => ({\n start: timeToMinutes(range.start),\n end: timeToMinutes(range.end),\n originalIndex: index,\n }));\n\n // Sort by start time\n timeRangesInMinutes.sort((a, b) => a.start - b.start);\n let overlaps: number[] = [];\n // Check for overlap\n for (let i = 1; i < timeRangesInMinutes.length; i++) {\n if (timeRangesInMinutes[i].start < timeRangesInMinutes[i - 1].end) {\n // Add both overlapping time range indices if they are not already included\n if (!overlaps.includes(timeRangesInMinutes[i].originalIndex)) {\n overlaps.push(timeRangesInMinutes[i].originalIndex);\n }\n if (!overlaps.includes(timeRangesInMinutes[i - 1].originalIndex)) {\n overlaps.push(timeRangesInMinutes[i - 1].originalIndex);\n }\n }\n }\n return overlaps.sort((a, b) => a - b); // Return sorted list of indices\n }\n\n addTimeRange(day) {\n const currentTimeRanges = this.schedule[day];\n\n // Default working hours are from 00:00 to 23:45 for calculation purposes\n const dayStart = 0; // Start of the day in minutes (00:00)\n const dayEnd = 1425; // End of the day in minutes (23:45)\n\n if (currentTimeRanges.length === 0) {\n // If there are no existing time ranges, add one at the start of the day\n this.schedule[day] = [{ start: '09:00am', end: '05:00pm' }]; // Example range\n } else {\n // Convert all time ranges to minutes for comparison\n const timeRangesInMinutes = currentTimeRanges\n .map(range => ({\n start: timeToMinutes(range.start),\n end: timeToMinutes(range.end),\n }))\n .sort((a, b) => a.start - b.start); // Sort by start time\n\n // Attempt to add a new time range at the end of the day\n const lastRangeEnd = timeRangesInMinutes[timeRangesInMinutes.length - 1].end;\n if (lastRangeEnd + 60 <= dayEnd) {\n // There's room at the end of the day\n this.schedule[day].push({\n start: convertTo12HourFormat(minutesToTime(lastRangeEnd)),\n end: convertTo12HourFormat(minutesToTime(lastRangeEnd + 60)),\n });\n } else {\n // No room at the end, look for gaps at the beginning of the day\n let gapFound = false;\n if (timeRangesInMinutes[0].start > dayStart + 60) {\n // There's room for at least a 1-hour meeting at the beginning of the day\n this.schedule[day].push({\n start: convertTo12HourFormat(minutesToTime(dayStart)),\n end: convertTo12HourFormat(minutesToTime(dayStart + 60)),\n });\n gapFound = true;\n }\n\n if (!gapFound) {\n // Search for gaps between scheduled time ranges\n for (let i = 0; i < timeRangesInMinutes.length - 1; i++) {\n const currentEnd = timeRangesInMinutes[i].end;\n const nextStart = timeRangesInMinutes[i + 1].start;\n\n if (nextStart - currentEnd >= 60) {\n // Found a gap\n this.schedule[day].push({\n start: convertTo12HourFormat(minutesToTime(currentEnd)),\n end: convertTo12HourFormat(minutesToTime(currentEnd + 60)),\n });\n break; // Exit the loop after adding a time range\n }\n }\n }\n }\n }\n\n // Sort the updated schedule to maintain order\n this.schedule[day].sort((a, b) => timeToMinutes(a.start) - timeToMinutes(b.start));\n\n this.schedule = { ...this.schedule };\n }\n\n removeTimeRange(day, index) {\n this.schedule[day].splice(index, 1);\n this.schedule = { ...this.schedule };\n }\n\n setTime(key: string, _event: Event, value: string) {\n const [dayIndex, timeType] = key.split('_');\n const [day, index] = dayIndex.split(':');\n\n if (timeType === 'start') {\n this.schedule[day][index].start = value;\n } else if (timeType === 'end') {\n this.schedule[day][index].end = value;\n }\n this.internals.setValidity({ customError: false });\n this.schedule = { ...this.schedule };\n }\n\n setFormError(key: string, _event: Event, _errorMessage: string) {\n const [_, timeType] = key.split('_');\n const element = this.host.shadowRoot?.getElementById(key);\n if (element) {\n this.internals.setValidity({ customError: true }, `Invalid ${timeType} time`, element as HTMLInputElement);\n }\n }\n\n openHoursToSchedule(openHours: OpenHours[]) {\n const newSchedule = {\n SUN: [],\n MON: [],\n TUE: [],\n WED: [],\n THU: [],\n FRI: [],\n SAT: [],\n };\n openHours.forEach(openHour => {\n openHour.days.forEach(day => {\n const dayKey = this.getDayKey(day);\n const start12hr = convertTo12HourFormat(openHour.start);\n const end12hr = convertTo12HourFormat(openHour.end);\n const timeRange = { start: start12hr, end: end12hr };\n\n // Check if the time range already exists for the day\n let timeRangeExists = false;\n if (newSchedule[dayKey]) {\n // Search for an existing time range that matches the current one\n timeRangeExists = newSchedule[dayKey].some(range => range.start === timeRange.start && range.end === timeRange.end);\n }\n\n if (!timeRangeExists) {\n if (newSchedule[dayKey]) {\n newSchedule[dayKey].push(timeRange);\n } else {\n newSchedule[dayKey] = [timeRange];\n }\n }\n });\n });\n\n this.timezone = this.defaultTimezone;\n this.schedule = newSchedule;\n }\n\n getDayKey(dayIndex: number): string {\n const days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];\n return days[dayIndex];\n }\n\n scheduleToOpenHours(schedule: Schedule): OpenHours[] {\n const dayKeys = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];\n let openHoursMap: Map<string, { days: number[]; start: string; end: string }> = new Map();\n\n dayKeys.forEach((dayKey, index) => {\n if (schedule[dayKey]) {\n // Check if schedule for the day exists\n schedule[dayKey].forEach(timeRange => {\n const start24hr = convertTo24HourFormat(timeRange.start);\n const end24hr = convertTo24HourFormat(timeRange.end);\n const key = `${start24hr}-${end24hr}`;\n\n if (!openHoursMap.has(key)) {\n openHoursMap.set(key, { days: [index], start: start24hr, end: end24hr });\n } else {\n let entry = openHoursMap.get(key);\n if (entry) {\n entry.days.push(index);\n openHoursMap.set(key, entry);\n }\n }\n });\n }\n });\n\n let selectedOpenHours: OpenHours[] = [];\n openHoursMap.forEach((value, _key) => {\n selectedOpenHours.push({\n days: value.days,\n start: value.start,\n end: value.end,\n timezone: this.timezone,\n });\n });\n\n return selectedOpenHours;\n }\n\n @RegisterComponent<NylasAvailabilityPicker, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-availability-picker',\n stateToProps: new Map([['schedulerConfig.selectedConfiguration', 'selectedConfiguration']]),\n fireRegisterEvent: true,\n })\n render() {\n const timezoneOptions = Object.keys(TIMEZONE_MAP).map(key => ({\n label: TIMEZONE_MAP[key],\n value: key,\n }));\n\n return (\n <Host>\n <div class=\"nylas-availability-picker\">\n <div class=\"header\" part=\"nap__header\">\n <h3>General availability</h3>\n <p>Set your availability for scheduling meetings.</p>\n </div>\n <div class=\"content\">\n <div class=\"select-timezone\" part=\"nap__select-timezone\">\n <h4 class=\"sub-header\">\n Select timezone\n <span class=\"icon\">\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">Select your timezone for displaying availability.</span>\n </tooltip-component>\n </span>\n </h4>\n <select-dropdown\n name=\"timezone\"\n exportparts=\"sd_dropdown: nap__timezone-container, sd_dropdown-button: nap__timezone-button, sd_dropdown-content: nap__timezone-dropdown-content\"\n options={timezoneOptions}\n defaultSelectedOption={timezoneOptions.find(i => i.value === this.defaultTimezone)}\n >\n <span slot=\"select-icon\">\n <globe-icon width=\"20\" height=\"20\" />\n </span>\n </select-dropdown>\n </div>\n <div class=\"availability\" part=\"nap__availability\">\n {Object.keys(this.schedule).map(key => {\n const day = key;\n const timeRanges = this.schedule[key] as { start: string; end: string }[];\n return (\n <div class=\"availability-day\">\n <div class=\"day\" part=\"nap__day\">\n <input\n type=\"checkbox\"\n name={day}\n id={day}\n checked={timeRanges.length > 0}\n onClick={() => {\n if (timeRanges.length > 0) {\n this.schedule[day] = [];\n } else {\n this.schedule[day] = [{ start: '09:00am', end: '05:00pm' }];\n }\n this.schedule = { ...this.schedule };\n }}\n />\n <label htmlFor={day} aria-label=\"Select day\">\n {day}\n </label>\n </div>\n <div class=\"time-ranges\" part=\"nap__time-ranges\">\n {timeRanges.length ? null : <span class=\"unavailable\">Unavailable</span>}\n {timeRanges.length > 0 &&\n timeRanges.map((timeRange, timeRangeIndex) => {\n const startKey = `${key}:${timeRangeIndex}_start`;\n const endKey = `${key}:${timeRangeIndex}_end`;\n return (\n <div class=\"time-range\" part=\"nap__time-range\">\n <div class=\"pickers\">\n <nylas-time-window-picker\n id={startKey}\n hasError={this.overlapDays[day]?.includes(timeRangeIndex)}\n time={timeRange.start}\n name={startKey}\n key={startKey}\n exportparts=\"time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times\"\n setTime={(event, additionalData) => this.setTime(startKey, event, additionalData)}\n setFormError={(event, additionalData) => this.setFormError(startKey, event, additionalData)}\n />\n <span> - </span>\n <nylas-time-window-picker\n id={endKey}\n hasError={this.overlapDays[day]?.includes(timeRangeIndex)}\n time={timeRange.end}\n name={endKey}\n key={endKey}\n minimumStartTime={timeRange.start}\n exportparts=\"time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times\"\n setTime={(event, additionalData) => this.setTime(endKey, event, additionalData)}\n setFormError={(event, additionalData) => this.setFormError(endKey, event, additionalData)}\n />\n </div>\n <button onClick={() => this.removeTimeRange(day, timeRangeIndex)}>\n <close-icon />\n </button>\n </div>\n );\n })}\n <p class=\"error\">{this.overlapDays[day] ? 'Overlapping time ranges' : ''}</p>\n </div>\n <div>\n {timeRanges.length > 0 ? (\n <button onClick={() => this.addTimeRange(day)} part=\"nap__add-time-range\">\n <add-circle-icon />\n </button>\n ) : null}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\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,CAAC,GAAG,CAAC,GAAG,yBAAyB,GAAG,EAAE,CAAK,CACzE,EACNA,qBACG,UAAU,CAAC,MAAM,GAAG,CAAC,IACpBA,oBAAQ,OAAO,EAAE,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,IAAI,EAAC,qBAAqB,IACvEA,gCAAmB,CACZ,IACP,IAAI,CACJ,CACF,EACN;SACH,CAAC,CACE,CACF,CACF,CACD,EACP;KACH;;;;;;;;;AAnHD;IALCE,mCAAiB,CAA6G;QAC7H,IAAI,EAAE,2BAA2B;QACjC,YAAY,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,uCAAuC,EAAE,uBAAuB,CAAC,CAAC,CAAC;QAC3F,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;qDAoHD;;;;;","names":["debug","timeToMinutes","convertTo12HourFormat","minutesToTime","convertTo24HourFormat","TIMEZONE_MAP","h","Host","RegisterComponent"],"sources":["src/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.scss?tag=nylas-availability-picker&encapsulation=shadow","src/components/scheduler-editor/nylas-availability-picker/nylas-availability-picker.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n @include default-css-variables;\n width: inherit;\n}\n\n.nylas-availability-picker {\n width: inherit;\n display: flex;\n flex-direction: column;\n margin: 1rem;\n border-radius: var(--nylas-border-radius-2x);\n border: 1px solid var(--nylas-base-200);\n .header {\n padding: 1rem;\n border-bottom: 1px solid var(--nylas-base-200);\n h3 {\n margin: 0;\n font-size: 16px;\n font-weight: 600;\n line-height: 20px;\n color: var(--nylas-base-900);\n text-align: left;\n }\n p {\n margin: 0.25rem 0 0 0;\n font-size: 0.875rem;\n font-weight: 400;\n line-height: 20px;\n color: var(--nylas-base-600);\n text-align: left;\n }\n }\n .content {\n padding: 1rem;\n color: var(--nylas-base-900);\n font-size: 16px;\n font-family: var(--nylas-font-family);\n @media #{$small-mobile} {\n font-size: 15px;\n }\n .select-timezone {\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: 1px solid var(--nylas-base-200);\n padding-bottom: 1rem;\n gap: 1rem;\n h4 {\n display: flex;\n gap: 0.5rem;\n align-items: center;\n margin: 0;\n font-size: 16px;\n @media #{$small-mobile} {\n font-size: 15px;\n }\n font-weight: 500;\n line-height: 20px;\n }\n select-dropdown {\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n }\n }\n .availability {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n padding: 0 0.5rem;\n @media #{$small-mobile} {\n gap: 0.5rem;\n padding: 0;\n }\n margin: 1rem 0;\n .availability-day {\n display: grid;\n grid-template-columns: minmax(auto, 65px) 1fr minmax(auto, 40px);\n @media #{$mobile} {\n grid-template-columns: 78px 1fr auto;\n }\n @media #{$small-mobile} {\n display: inline-grid;\n gap: 8px;\n grid-template-columns: 60px 1fr auto;\n }\n gap: 1rem;\n align-items: baseline;\n .day {\n display: flex;\n gap: 0.5rem;\n @media #{$small-mobile} {\n gap: 0.25rem;\n }\n align-items: center;\n\n input[type='checkbox'] {\n transform: scale(1.3);\n }\n }\n .time-ranges {\n span.unavailable {\n height: 48px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .time-range {\n display: flex;\n gap: 1.5rem;\n justify-content: space-between;\n align-items: baseline;\n @media #{$small-mobile} {\n justify-content: unset;\n gap: 0.5rem;\n }\n .pickers {\n display: flex;\n gap: 1rem;\n @media #{$small-mobile} {\n gap: 0.5rem;\n }\n span {\n margin-top: 0.75rem;\n }\n }\n &:not(:last-of-type) {\n margin-bottom: 1rem;\n }\n }\n p.error {\n color: var(--nylas-error);\n }\n }\n button {\n border: none;\n background: transparent;\n height: 40px;\n cursor: pointer;\n color: var(--nylas-base-800);\n &:hover,\n &:active {\n color: var(--nylas-primary);\n }\n }\n }\n }\n }\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { convertTo12HourFormat, convertTo24HourFormat, debug, minutesToTime, timeToMinutes } from '@/utils/utils';\nimport { AttachInternals, Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { TIMEZONE_MAP } from '@/common/constants';\nimport { Configuration } from '@nylas/core';\n\nexport type OpenHours = {\n days: number[];\n start: string;\n end: string;\n timezone: string;\n};\n\nexport type Schedule = {\n SUN: { start: string; end: string }[];\n MON: { start: string; end: string }[];\n TUE: { start: string; end: string }[];\n WED: { start: string; end: string }[];\n THU: { start: string; end: string }[];\n FRI: { start: string; end: string }[];\n SAT: { start: string; end: string }[];\n};\n\n/**\n * The `nylas-availability-picker` component is a form input for selecting availability (open hours).\n * @part nap__header - The header of the availability picker\n * @part nap__select-timezone - The timezone selection container\n * @part nap__select-timezone-button - The timezone selection button\n * @part nap__select-timezone-dropdown-content - The timezone selection dropdown content\n * @part nap__availability - The availability container\n * @part nap__day - The day container\n * @part nap__time-ranges - The time ranges container\n * @part nap__time-range - The time range container\n * @part nap__add-time-range - The add time range button\n * @part nap__time-picker-container - The time picker container\n * @part nap__time-picker-input - The time picker input\n * @part nap__time-picker-times - The time picker times\n */\n@Component({\n tag: 'nylas-availability-picker',\n styleUrl: 'nylas-availability-picker.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasAvailabilityPicker {\n /**\n * The element <nylas-availability-picker> itself.\n */\n @Element() host!: HTMLNylasAvailabilityPickerElement;\n /**\n * The selected configuration.\n */\n @Prop() selectedConfiguration?: Configuration;\n /**\n * The open hours to display.\n */\n @Prop() openHours?: OpenHours[];\n /**\n * The name of the availability picker.\n */\n @Prop() name: string = 'availability';\n /*\n * The default timezone or preset timezone.\n */\n @Prop() defaultTimezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n\n /**\n * This event is fired when the selected availability / open hours change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: {\n openHours: OpenHours[];\n timezone: string;\n };\n name: string;\n }>;\n\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n @State() schedule = {\n SUN: [],\n MON: [{ start: '09:00am', end: '05:00pm' }],\n TUE: [{ start: '09:00am', end: '05:00pm' }],\n WED: [{ start: '09:00am', end: '05:00pm' }],\n THU: [{ start: '09:00am', end: '05:00pm' }],\n FRI: [{ start: '09:00am', end: '05:00pm' }],\n SAT: [],\n };\n /**\n * The selected timezone state.\n */\n @State() timezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone;\n /**\n * The overlapping time ranges state. This is used to display an error message when there are overlapping time ranges.\n */\n @State() overlapDays: { [key: string]: number[] } = {};\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-calendar-picker', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('selectedConfiguration')\n configChangedHandler(newConfig: Configuration) {\n const organizer = newConfig?.participants?.find(p => p.is_organizer);\n if (organizer && organizer?.availability?.open_hours) {\n this.openHoursToSchedule(organizer?.availability?.open_hours);\n }\n }\n\n @Watch('schedule')\n scheduleChanged(newValue: Schedule, oldValue: Schedule) {\n if (newValue !== oldValue) {\n this.valueChanged.emit({\n value: {\n openHours: this.scheduleToOpenHours(newValue),\n timezone: this.timezone,\n },\n name: this.name,\n });\n let overlapDays: { [key: string]: number[] } = {};\n Object.keys(newValue).forEach(key => {\n const dayTimeRanges = newValue[key];\n if (dayTimeRanges.length > 0) {\n const overlaps = this.getOverlaps(dayTimeRanges);\n if (overlaps.length > 0) {\n overlapDays[key] = overlaps;\n }\n }\n });\n this.overlapDays = overlapDays;\n if (typeof this.internals.setFormValue !== 'function') {\n return;\n }\n if (Object.keys(overlapDays).length > 0) {\n const element = this.host.shadowRoot?.getElementById(Object.keys(overlapDays)[0]) as HTMLInputElement;\n if (element) {\n this.internals.setValidity({ customError: true }, 'Overlapping time ranges found', element);\n }\n } else {\n this.internals.setValidity({ customError: false });\n this.internals.setFormValue(\n JSON.stringify({\n openHours: this.scheduleToOpenHours(this.schedule),\n timezone: this.timezone,\n }),\n );\n }\n }\n }\n\n @Listen('selectedOptionChanged')\n selectedOptionChangedHandler(\n event: CustomEvent<{\n value: string;\n name: string;\n }>,\n ) {\n const { name, value } = event.detail;\n if (name === 'timezone') {\n this.timezone = value;\n if (typeof this.internals.setFormValue !== 'function') {\n return;\n }\n this.internals.setFormValue(\n JSON.stringify({\n openHours: this.scheduleToOpenHours(this.schedule),\n timezone: this.timezone,\n }),\n );\n }\n }\n\n connectedCallback() {\n debug('nylas-availability-picker', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-availability-picker', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-availability-picker', 'componentWillLoad');\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-availability-picker', 'componentDidLoad');\n if (this.openHours && this.openHours.length > 0) {\n this.openHoursToSchedule(this.openHours);\n }\n if (typeof this.internals.setFormValue !== 'function') {\n return;\n }\n this.internals.setFormValue(\n JSON.stringify({\n openHours: this.scheduleToOpenHours(this.schedule),\n timezone: this.timezone,\n }),\n );\n }\n\n getOverlaps(timeRanges) {\n // Convert times to minutes and add to the array\n let timeRangesInMinutes = timeRanges.map((range, index) => ({\n start: timeToMinutes(range.start),\n end: timeToMinutes(range.end),\n originalIndex: index,\n }));\n\n // Sort by start time\n timeRangesInMinutes.sort((a, b) => a.start - b.start);\n let overlaps: number[] = [];\n // Check for overlap\n for (let i = 1; i < timeRangesInMinutes.length; i++) {\n if (timeRangesInMinutes[i].start < timeRangesInMinutes[i - 1].end) {\n // Add both overlapping time range indices if they are not already included\n if (!overlaps.includes(timeRangesInMinutes[i].originalIndex)) {\n overlaps.push(timeRangesInMinutes[i].originalIndex);\n }\n if (!overlaps.includes(timeRangesInMinutes[i - 1].originalIndex)) {\n overlaps.push(timeRangesInMinutes[i - 1].originalIndex);\n }\n }\n }\n return overlaps.sort((a, b) => a - b); // Return sorted list of indices\n }\n\n addTimeRange(day) {\n const currentTimeRanges = this.schedule[day];\n\n // Default working hours are from 00:00 to 23:45 for calculation purposes\n const dayStart = 0; // Start of the day in minutes (00:00)\n const dayEnd = 1425; // End of the day in minutes (23:45)\n\n if (currentTimeRanges.length === 0) {\n // If there are no existing time ranges, add one at the start of the day\n this.schedule[day] = [{ start: '09:00am', end: '05:00pm' }]; // Example range\n } else {\n // Convert all time ranges to minutes for comparison\n const timeRangesInMinutes = currentTimeRanges\n .map(range => ({\n start: timeToMinutes(range.start),\n end: timeToMinutes(range.end),\n }))\n .sort((a, b) => a.start - b.start); // Sort by start time\n\n // Attempt to add a new time range at the end of the day\n const lastRangeEnd = timeRangesInMinutes[timeRangesInMinutes.length - 1].end;\n if (lastRangeEnd + 60 <= dayEnd) {\n // There's room at the end of the day\n this.schedule[day].push({\n start: convertTo12HourFormat(minutesToTime(lastRangeEnd)),\n end: convertTo12HourFormat(minutesToTime(lastRangeEnd + 60)),\n });\n } else {\n // No room at the end, look for gaps at the beginning of the day\n let gapFound = false;\n if (timeRangesInMinutes[0].start > dayStart + 60) {\n // There's room for at least a 1-hour meeting at the beginning of the day\n this.schedule[day].push({\n start: convertTo12HourFormat(minutesToTime(dayStart)),\n end: convertTo12HourFormat(minutesToTime(dayStart + 60)),\n });\n gapFound = true;\n }\n\n if (!gapFound) {\n // Search for gaps between scheduled time ranges\n for (let i = 0; i < timeRangesInMinutes.length - 1; i++) {\n const currentEnd = timeRangesInMinutes[i].end;\n const nextStart = timeRangesInMinutes[i + 1].start;\n\n if (nextStart - currentEnd >= 60) {\n // Found a gap\n this.schedule[day].push({\n start: convertTo12HourFormat(minutesToTime(currentEnd)),\n end: convertTo12HourFormat(minutesToTime(currentEnd + 60)),\n });\n break; // Exit the loop after adding a time range\n }\n }\n }\n }\n }\n\n // Sort the updated schedule to maintain order\n this.schedule[day].sort((a, b) => timeToMinutes(a.start) - timeToMinutes(b.start));\n\n this.schedule = { ...this.schedule };\n }\n\n removeTimeRange(day, index) {\n this.schedule[day].splice(index, 1);\n this.schedule = { ...this.schedule };\n }\n\n @Listen('timeChange')\n setTime(event: CustomEvent<{ key: string; value: string }>) {\n console.log('timeChanged', event);\n const { key, value } = event.detail;\n console.log({\n key,\n value,\n });\n const [dayIndex, timeType] = key.split('_');\n const [day, index] = dayIndex.split(':');\n\n if (timeType === 'start') {\n this.schedule[day][index].start = value;\n } else if (timeType === 'end') {\n this.schedule[day][index].end = value;\n }\n this.internals.setValidity({ customError: false });\n this.schedule = { ...this.schedule };\n }\n\n @Listen('formError')\n setFormError(event: CustomEvent<{ key: string; message: string }>) {\n const { key } = event.detail;\n const [_, timeType] = key.split('_');\n const element = this.host.shadowRoot?.getElementById(key);\n if (element) {\n this.internals.setValidity({ customError: true }, `Invalid ${timeType} time`, element as HTMLInputElement);\n }\n }\n\n openHoursToSchedule(openHours: OpenHours[]) {\n const newSchedule = {\n SUN: [],\n MON: [],\n TUE: [],\n WED: [],\n THU: [],\n FRI: [],\n SAT: [],\n };\n openHours.forEach(openHour => {\n openHour.days.forEach(day => {\n const dayKey = this.getDayKey(day);\n const start12hr = convertTo12HourFormat(openHour.start);\n const end12hr = convertTo12HourFormat(openHour.end);\n const timeRange = { start: start12hr, end: end12hr };\n\n // Check if the time range already exists for the day\n let timeRangeExists = false;\n if (newSchedule[dayKey]) {\n // Search for an existing time range that matches the current one\n timeRangeExists = newSchedule[dayKey].some(range => range.start === timeRange.start && range.end === timeRange.end);\n }\n\n if (!timeRangeExists) {\n if (newSchedule[dayKey]) {\n newSchedule[dayKey].push(timeRange);\n } else {\n newSchedule[dayKey] = [timeRange];\n }\n }\n });\n });\n\n this.timezone = this.defaultTimezone;\n this.schedule = newSchedule;\n }\n\n getDayKey(dayIndex: number): string {\n const days = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];\n return days[dayIndex];\n }\n\n scheduleToOpenHours(schedule: Schedule): OpenHours[] {\n const dayKeys = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'];\n let openHoursMap: Map<string, { days: number[]; start: string; end: string }> = new Map();\n\n dayKeys.forEach((dayKey, index) => {\n if (schedule[dayKey]) {\n // Check if schedule for the day exists\n schedule[dayKey].forEach(timeRange => {\n const start24hr = convertTo24HourFormat(timeRange.start);\n const end24hr = convertTo24HourFormat(timeRange.end);\n const key = `${start24hr}-${end24hr}`;\n\n if (!openHoursMap.has(key)) {\n openHoursMap.set(key, { days: [index], start: start24hr, end: end24hr });\n } else {\n let entry = openHoursMap.get(key);\n if (entry) {\n entry.days.push(index);\n openHoursMap.set(key, entry);\n }\n }\n });\n }\n });\n\n let selectedOpenHours: OpenHours[] = [];\n openHoursMap.forEach((value, _key) => {\n selectedOpenHours.push({\n days: value.days,\n start: value.start,\n end: value.end,\n timezone: this.timezone,\n });\n });\n\n return selectedOpenHours;\n }\n\n @RegisterComponent<NylasAvailabilityPicker, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-availability-picker',\n stateToProps: new Map([['schedulerConfig.selectedConfiguration', 'selectedConfiguration']]),\n fireRegisterEvent: true,\n })\n render() {\n const timezoneOptions = Object.keys(TIMEZONE_MAP).map(key => ({\n label: TIMEZONE_MAP[key],\n value: key,\n }));\n\n return (\n <Host>\n <div class=\"nylas-availability-picker\">\n <div class=\"header\" part=\"nap__header\">\n <h3>General availability</h3>\n <p>Set your availability for scheduling meetings.</p>\n </div>\n <div class=\"content\">\n <div class=\"select-timezone\" part=\"nap__select-timezone\">\n <h4 class=\"sub-header\">\n Select timezone\n <span class=\"icon\">\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">Select your timezone for displaying availability.</span>\n </tooltip-component>\n </span>\n </h4>\n <select-dropdown\n name=\"timezone\"\n exportparts=\"sd_dropdown: nap__timezone-container, sd_dropdown-button: nap__timezone-button, sd_dropdown-content: nap__timezone-dropdown-content\"\n options={timezoneOptions}\n defaultSelectedOption={timezoneOptions.find(i => i.value === this.defaultTimezone)}\n >\n <span slot=\"select-icon\">\n <globe-icon width=\"20\" height=\"20\" />\n </span>\n </select-dropdown>\n </div>\n <div class=\"availability\" part=\"nap__availability\">\n {Object.keys(this.schedule).map(key => {\n const day = key;\n const timeRanges = this.schedule[key] as { start: string; end: string }[];\n return (\n <div class=\"availability-day\">\n <div class=\"day\" part=\"nap__day\">\n <input\n type=\"checkbox\"\n name={day}\n id={day}\n checked={timeRanges.length > 0}\n onClick={() => {\n if (timeRanges.length > 0) {\n this.schedule[day] = [];\n } else {\n this.schedule[day] = [{ start: '09:00am', end: '05:00pm' }];\n }\n this.schedule = { ...this.schedule };\n }}\n />\n <label htmlFor={day} aria-label=\"Select day\">\n {day}\n </label>\n </div>\n <div class=\"time-ranges\" part=\"nap__time-ranges\">\n {timeRanges.length ? null : <span class=\"unavailable\">Unavailable</span>}\n {timeRanges.length > 0 &&\n timeRanges.map((timeRange, timeRangeIndex) => {\n const startKey = `${key}:${timeRangeIndex}_start`;\n const endKey = `${key}:${timeRangeIndex}_end`;\n return (\n <div class=\"time-range\" part=\"nap__time-range\">\n <div class=\"pickers\">\n <nylas-time-window-picker\n id={startKey}\n hasError={this.overlapDays[day]?.includes(timeRangeIndex)}\n time={timeRange.start}\n name={startKey}\n key={startKey}\n exportparts=\"time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times\"\n // setTime={(event, additionalData) => this.setTime(startKey, event, additionalData)}\n // setFormError={(event, additionalData) => this.setFormError(startKey, event, additionalData)}\n />\n <span> - </span>\n <nylas-time-window-picker\n id={endKey}\n hasError={this.overlapDays[day]?.includes(timeRangeIndex)}\n time={timeRange.end}\n name={endKey}\n key={endKey}\n minimumStartTime={timeRange.start}\n exportparts=\"time-picker: nap__time-picker-container, time-input: nap__time-picker-input, times: nap__time-picker-times\"\n // setTime={(event, additionalData) => this.setTime(endKey, event, additionalData)}\n // setFormError={(event, additionalData) => this.setFormError(endKey, event, additionalData)}\n />\n </div>\n <button onClick={() => this.removeTimeRange(day, timeRangeIndex)}>\n <close-icon />\n </button>\n </div>\n );\n })}\n <p class=\"error\">{this.overlapDays[day] ? 'Overlapping time ranges' : ''}</p>\n </div>\n <div>\n {timeRanges.length > 0 ? (\n <button onClick={() => this.addTimeRange(day)} part=\"nap__add-time-range\">\n <add-circle-icon />\n </button>\n ) : null}\n </div>\n </div>\n );\n })}\n </div>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -83,7 +83,7 @@ const NylasBookedEventCard = class {
|
|
|
83
83
|
utils.debug(`[nylas-booked-event-card] Component did load`);
|
|
84
84
|
}
|
|
85
85
|
render() {
|
|
86
|
-
return (index.h(index.Host, { key: '
|
|
86
|
+
return (index.h(index.Host, { key: '5bd3216b60b7cdb86a44435706fb43b6a898e61c', part: "nbec" }, index.h("sp-theme", { key: 'f6059be8647e7340db11f12db85596b2493a3032', theme: "spectrum", color: "dark", scale: "medium" }, index.h("div", { key: '5f6cf3edb7b911c7c2c24d4ce82357298cc10108', class: "booked-event-timezone" }, index.h("globe-icon", { key: 'b23ca20aa43dc402a2071ed0019ff103f455e769' }), constants.TIMEZONE_MAP[this.selectedTimezone]), index.h("div", { key: '664f226bd33a6ee1ee938ac76eca60085e822915', class: "event-card-wrapper", part: "nbec__card" }, index.h("div", { key: '0de5fccaf726cc6a6fb1917249ffcccbaf45190f', class: "calendar-icon" }, index.h("calendar-check-icon", { key: '94bbe15e7acddbc88916355337170a6753fa70b3' })), index.h("div", { key: 'f3876bccacb3a99e7c337aff930095884b3e6be3', class: "booked-event-header" }, index.h("h2", { key: 'da46d3cb4865421827cd7b3f499cae06ca09e365', slot: "card-title", part: "nbec__title" }, "Booking ", !!this.rescheduleBookingId ? 'rescheduled' : 'confirmed', "!"), index.h("div", { key: '57ed93864ee0cbdbf5755b0fe9a6b2803ca7a869', part: "nbec__description" }, this.getOrganizer(this.eventInfo)?.name || this.getOrganizer(this.eventInfo)?.email, "\u00A0&\u00A0", this.bookingInfo?.primaryParticipant?.name || this.bookingInfo?.primaryParticipant?.email)), index.h("sp-divider", { key: '4fab8afdbdc7e9a2b55e35779ff087a5497b0c3e' }), index.h("div", { key: '54ffc748a0da3bd9ae866137b600d0dc1da5eb5e', class: "booking-date-time" }, index.h("checkmark-circle-icon", { key: '674edd7058565b837a618089c653d20b8b8f08e7' }), index.h("h3", { key: '51f406b68b2e310e354e79703aea3efd14236d57' }, "Booking date and time"), index.h("p", { key: '404211c1b06bb80da3eb7274f4a41fba962ce0b9' }, new Date(this.selectedTimeslot?.start_time).toLocaleDateString(undefined, { dateStyle: 'full' }), " ", index.h("br", { key: '221f96d994e440affff5a347fbb9da5a2566ab29' }), new Date(this.selectedTimeslot?.start_time).toLocaleTimeString(undefined, { timeStyle: 'short' }), " -", ' ', new Date(this.selectedTimeslot?.end_time).toLocaleTimeString(undefined, { timeStyle: 'short' }))), index.h("div", { key: 'd333515e59086254d2484c5f55ad9b69a21bf0bb', class: "booking-participants" }), index.h("sp-divider", { key: 'f6ee5cd38d186d943a345f037357419f2af7e3c7' }), index.h("div", { key: 'c6eb21904c9db747ceb7a2daed88bf86057f4046', class: "footer" }, index.h("sp-button", { key: 'ee4a439cd71eb0c9c6a1a82be35698a3b027c6c5', variant: "secondary", treatment: "outline", class: "cancel", onClick: this.handleCancelBookingButtonClicked, part: "nbec__button-outline nbec__cancel-cta" }, "Cancel booking"), index.h("sp-button", { key: '36aa6cc83eb259f21098787e61d36c4a8ca5b3df', variant: "secondary", treatment: "outline", class: "reschedule", onClick: this.handleRescheduleButtonClicked, part: "nbec__button-outline nbec__reschedule-cta" }, "Reschedule"))))));
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
__decorate([
|
|
@@ -84,7 +84,7 @@ const NylasBookedEventCard = class {
|
|
|
84
84
|
utils.debug(`[nylas-booked-event-card] Component did load`);
|
|
85
85
|
}
|
|
86
86
|
render() {
|
|
87
|
-
return (index.h(index.Host, { key: '
|
|
87
|
+
return (index.h(index.Host, { key: '5bd3216b60b7cdb86a44435706fb43b6a898e61c', part: "nbec" }, index.h("sp-theme", { key: 'f6059be8647e7340db11f12db85596b2493a3032', theme: "spectrum", color: "dark", scale: "medium" }, index.h("div", { key: '5f6cf3edb7b911c7c2c24d4ce82357298cc10108', class: "booked-event-timezone" }, index.h("globe-icon", { key: 'b23ca20aa43dc402a2071ed0019ff103f455e769' }), constants.TIMEZONE_MAP[this.selectedTimezone]), index.h("div", { key: '664f226bd33a6ee1ee938ac76eca60085e822915', class: "event-card-wrapper", part: "nbec__card" }, index.h("div", { key: '0de5fccaf726cc6a6fb1917249ffcccbaf45190f', class: "calendar-icon" }, index.h("calendar-check-icon", { key: '94bbe15e7acddbc88916355337170a6753fa70b3' })), index.h("div", { key: 'f3876bccacb3a99e7c337aff930095884b3e6be3', class: "booked-event-header" }, index.h("h2", { key: 'da46d3cb4865421827cd7b3f499cae06ca09e365', slot: "card-title", part: "nbec__title" }, "Booking ", !!this.rescheduleBookingId ? 'rescheduled' : 'confirmed', "!"), index.h("div", { key: '57ed93864ee0cbdbf5755b0fe9a6b2803ca7a869', part: "nbec__description" }, this.getOrganizer(this.eventInfo)?.name || this.getOrganizer(this.eventInfo)?.email, "\u00A0&\u00A0", this.bookingInfo?.primaryParticipant?.name || this.bookingInfo?.primaryParticipant?.email)), index.h("sp-divider", { key: '4fab8afdbdc7e9a2b55e35779ff087a5497b0c3e' }), index.h("div", { key: '54ffc748a0da3bd9ae866137b600d0dc1da5eb5e', class: "booking-date-time" }, index.h("checkmark-circle-icon", { key: '674edd7058565b837a618089c653d20b8b8f08e7' }), index.h("h3", { key: '51f406b68b2e310e354e79703aea3efd14236d57' }, "Booking date and time"), index.h("p", { key: '404211c1b06bb80da3eb7274f4a41fba962ce0b9' }, new Date(this.selectedTimeslot?.start_time).toLocaleDateString(undefined, { dateStyle: 'full' }), " ", index.h("br", { key: '221f96d994e440affff5a347fbb9da5a2566ab29' }), new Date(this.selectedTimeslot?.start_time).toLocaleTimeString(undefined, { timeStyle: 'short' }), " -", ' ', new Date(this.selectedTimeslot?.end_time).toLocaleTimeString(undefined, { timeStyle: 'short' }))), index.h("div", { key: 'd333515e59086254d2484c5f55ad9b69a21bf0bb', class: "booking-participants" }), index.h("sp-divider", { key: 'f6ee5cd38d186d943a345f037357419f2af7e3c7' }), index.h("div", { key: 'c6eb21904c9db747ceb7a2daed88bf86057f4046', class: "footer" }, index.h("sp-button", { key: 'ee4a439cd71eb0c9c6a1a82be35698a3b027c6c5', variant: "secondary", treatment: "outline", class: "cancel", onClick: this.handleCancelBookingButtonClicked, part: "nbec__button-outline nbec__cancel-cta" }, "Cancel booking"), index.h("sp-button", { key: '36aa6cc83eb259f21098787e61d36c4a8ca5b3df', variant: "secondary", treatment: "outline", class: "reschedule", onClick: this.handleRescheduleButtonClicked, part: "nbec__button-outline nbec__reschedule-cta" }, "Reschedule"))))));
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
90
|
__decorate$7([
|
|
@@ -286,13 +286,13 @@ const NylasBookingForm = class {
|
|
|
286
286
|
this.guestEmailErrors = { ...errors };
|
|
287
287
|
}
|
|
288
288
|
render() {
|
|
289
|
-
return (index.h(index.Host, { key: '
|
|
289
|
+
return (index.h(index.Host, { key: '018357db1ce7dbbeb11ebc236b869a3baf246c69' }, index.h("form", { key: '5f26a98903372d4c587df1d1045bcb240c4ee7cd', onSubmit: e => this.bookButtonClickedHandler(e), noValidate: true }, index.h("div", { key: '4ad84c89bb19933cb5d8403939104c38705ddfba', class: "nylas-booking-form" }, index.h("slot", { key: 'c594f51e9d8cbd40e1d42f9aa86baae536a9c7e7', name: "custom-booking-form" }, index.h("div", { key: 'fe026c1562cb85c773e31cec8a0a3574b3515e0c', class: "input-wrapper" }, index.h("label", { key: '27ecf20858dd3133ec4914970f7148720bc603ed', htmlFor: "name", class: { 'input-label': true, 'error': !this.isNameValid }, part: "nbf__input-label" }, "Name ", index.h("span", { key: '4a39ea8d7aa693f860c17aa28b2130ae49f31a1c', class: "required" }, "*")), index.h("input", { key: '69fb70d74fe3b3cd883ca7fc0a9f174b6f81936a', id: "name", type: "text", placeholder: "Enter your name", value: this.name, class: {
|
|
290
290
|
input: true,
|
|
291
291
|
error: !this.isNameValid,
|
|
292
|
-
}, part: "nbf__input-textfield", onInput: (e) => this.changeName(e.target?.value) }), index.h("p", { key: '
|
|
292
|
+
}, part: "nbf__input-textfield", onInput: (e) => this.changeName(e.target?.value) }), index.h("p", { key: 'e4be03fd299cbc94713e5561fb9ed69a78af200c', class: "help-text" }, this.validationError.name)), index.h("div", { key: '017e724bfd408c5bde7714ae8b2a941d4a1194d9', class: "input-wrapper" }, index.h("label", { key: 'ed19f30d50d5d2ae95bcbf567b5c888b7906463d', htmlFor: "email", class: { 'input-label': true, 'error': !this.isEmailValid }, part: "nbf__input-label" }, "Email ", index.h("span", { key: '9b3ab493851edfcc407a38fad0994da171ac9976', class: "required" }, "*")), index.h("input", { key: '768690b3cc350537be1fa39cc7a295f688c1d91d', id: "email", type: "email", placeholder: "Enter your email", value: this.email, class: {
|
|
293
293
|
input: true,
|
|
294
294
|
error: !this.isEmailValid,
|
|
295
|
-
}, part: "nbf__input-textfield", onInput: (e) => this.changeEmail(e.target?.value) }), index.h("p", { key: '
|
|
295
|
+
}, part: "nbf__input-textfield", onInput: (e) => this.changeEmail(e.target?.value) }), index.h("p", { key: '24a39d859e700d000a363fe8df2f000365542fb0', class: "help-text" }, this.validationError.email)))), index.h("div", { key: '40b4b99dcf471afb8079d49fb9a0efe6bb7e406c', class: "cta" }, index.h("sp-button", { key: 'ae6bc3f620953f355184c7aef3ce692c2509c81d', treatment: "outline", variant: "secondary", class: 'back', part: "nbf__button-outline", onClick: this.handleBackButtonClicked }, index.h("slot", { key: 'e5a10ff0978756f7c3f8751a7aca6e3281f5046b', name: "booking-form-back-label" }, "Back")), index.h("sp-button", { key: '3aa5fe99000d52ef64db4191950109caeb526878', variant: "primary", class: 'book', part: "nbf__button-primary", type: "submit" }, this.isLoading && index.h("loading-icon", { slot: "icon" }), index.h("slot", { key: '83c5332efd5eb82617dc0a0f5275950431d95c26', name: "booking-form-book-label" }, "Book now"))))));
|
|
296
296
|
}
|
|
297
297
|
get host() { return index.getElement(this); }
|
|
298
298
|
static get watchers() { return {
|
|
@@ -646,7 +646,7 @@ const NylasDatePicker = class {
|
|
|
646
646
|
return date && selectableDates?.find(d => utils.isSameDay(d, date)) === undefined;
|
|
647
647
|
}
|
|
648
648
|
render() {
|
|
649
|
-
return (index.h(index.Host, { key: '
|
|
649
|
+
return (index.h(index.Host, { key: 'd6122ec547ac33e6febfe41497a1bd3de1eeb6b3', part: "ndp" }, index.h("div", { key: 'cee58b509bf57156342c7506a020b64611f62209', class: "nylas-date-picker" }, index.h("div", { key: 'bb3a8356004b07fd86fb05961eb400215b824e3a', class: 'header flex-row' }, index.h("h2", { key: '681f87b531eaa6c26b99bb2616fd59cd388e6bd9', part: 'ndp__month-header' }, index.h("strong", { key: 'e93fb4feacb91042cbfa8bb65b0a196fafb343d2' }, this.month.toLocaleDateString(undefined, { month: 'long' })), "\u00A0", this.month.toLocaleDateString(undefined, { year: 'numeric' })), index.h("div", { key: 'fb4c4671c2cf24d4ae2ddf1077d0431a8a6261a8', class: 'pagination' }, index.h("button", { key: '6810b244baf594e6a9c69b2916704744a0d18f74', onClick: () => this.changeMonth(-1), class: { 'chevron-left': true, 'button': true }, disabled: !this.selectableDates?.length || this.month <= new Date(), part: "ndp__month-button" }, index.h("chevron-icon", { key: '8a14ef5e447da88e3c1c19b77f7d42454243dd4e' })), index.h("button", { key: 'aa6efd17b59da3308fec14032c64017849750702', onClick: () => this.changeMonth(1), class: { 'chevron-right': true, 'button': true }, disabled: !this.selectableDates?.length || this.disableNextMonthButton, part: "ndp__month-button" }, index.h("chevron-icon", { key: '3a1704b4c41d92ac54a6936e487402a98bba5de1' })))), index.h("div", { key: '85910baac9b8b411ebfede44c0a11bff2e489efe', class: 'dates' }, ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT'].map(day => {
|
|
650
650
|
return (index.h("div", { class: 'day', part: "ndp__day" }, day));
|
|
651
651
|
}), this.dates.map((date, i) => {
|
|
652
652
|
const isDisabled = this.isDisabled(date, this.selectableDates);
|
|
@@ -755,13 +755,13 @@ const NylasLocaleSwitch = class {
|
|
|
755
755
|
label: constants.LANGUAGE_MAP[key],
|
|
756
756
|
value: key,
|
|
757
757
|
}));
|
|
758
|
-
return (index.h(index.Host, { key: '
|
|
758
|
+
return (index.h(index.Host, { key: '9b59f6361d95bf132b22ff7d03edd20c58d81f9a' }, index.h("div", { key: 'f2ebeeaed33b6e750f71d23ca24aa2d1ad858a10', class: "nylas-locale-switch" }, index.h("div", { key: '3bb086e794c113b62d88b458f213beaeb28bf5c7', class: {
|
|
759
759
|
'select-wrapper': true,
|
|
760
760
|
'timezone': true,
|
|
761
|
-
} }, index.h("select-dropdown", { key: '
|
|
761
|
+
} }, index.h("select-dropdown", { key: '169822d4f1c58f795f0a9189c074699814a2790e', name: "timezone", options: timezoneOptions, defaultSelectedOption: timezoneOptions.find(op => op.value == this.selectedTimezone) }, index.h("span", { key: '54fd84316990a375e60291bc68406a2fd1a43f57', slot: "select-icon" }, index.h("globe-icon", { key: '2cd6a94baef61202b97411e10cb212b48ddd527a', width: "20", height: "20" })))), index.h("div", { key: '39e1a7f52109e87ebfcd41f5eb35146a21ab7911', class: {
|
|
762
762
|
'select-wrapper': true,
|
|
763
763
|
'language': true,
|
|
764
|
-
} }, index.h("select-dropdown", { key: '
|
|
764
|
+
} }, index.h("select-dropdown", { key: 'b803b2685efe46673d125b3d10714bafd48197c1', name: "language", options: languageOptions, defaultSelectedOption: languageOptions.find(lang => lang.value == this.selectedLanguage) }, index.h("span", { key: 'b8a7d37f9bd60a14f2652fd17d7572b2bd853ee7', slot: "select-icon" }, index.h("translate-icon", { key: 'b36f31c8ddec7a70fdce4154006fce11af4e3bb3', width: "20", height: "20" })))))));
|
|
765
765
|
}
|
|
766
766
|
};
|
|
767
767
|
__decorate$2([
|
|
@@ -894,7 +894,7 @@ const NylasSelectedEventCard = class {
|
|
|
894
894
|
this.endTime = new Date(selectedTimeslot?.end_time).toLocaleString(undefined, { timeStyle: 'short' });
|
|
895
895
|
}
|
|
896
896
|
render() {
|
|
897
|
-
return (index.h(index.Host, { key: '
|
|
897
|
+
return (index.h(index.Host, { key: 'c84565db48fc177fd6f8af71db7f9776516cf46f', part: "nsec" }, index.h("sp-theme", { key: '7de2e148c85b878e735ac6a69a62892110de9b65', theme: "spectrum", color: "dark", scale: "medium" }, index.h("div", { key: '0a9f43a55c68fdd7d93b42600b94e2f10d551dd4', class: "event-card", part: "nsec__card" }, index.h("div", { key: '18b16b39d4c3d7c1a0f9c16c084d99f1b9b9ff5b', class: "calendar-icon", part: "nsec__icon" }, index.h("calendar-icon", { key: '92202409a7e922975ab31216d8f68c3fb8767cbe' })), index.h("div", { key: '79006fdf073ed56acec50e1e11ddf101fcfca81c', class: "nylas-selected-event-card__date", part: "nsec__date" }, this.selectedDate?.toLocaleDateString(undefined, { dateStyle: 'full' })), index.h("div", { key: '1f605b2bc03f290b5a5b3ac858256f438ac33651', class: "nylas-selected-event-card__time", part: "nsec__time" }, this.startTime, " - ", this.endTime)), index.h("div", { key: '03f9f64e0229904519984305751c388886838b99', class: "event-timezone", part: "nsec__timezone" }, index.h("globe-icon", { key: '7bd33f03d96671423199113ee24fe913f78c1bca' }), constants.TIMEZONE_MAP[this.selectedTimezone]))));
|
|
898
898
|
}
|
|
899
899
|
static get watchers() { return {
|
|
900
900
|
"selectedTimeslot": ["handleSelectedTimeslotChange"]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"nylas-booking-calendar-picker.entry.cjs.js","mappings":";;;;;;;;;AAAA,MAAM,6BAA6B,GAAG,0kGAA0kG;;;;;;;;;;;;;;;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ACW,CACf,EACPA,6BACE,IAAI,EAAC,kBAAkB,EACvB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,KAAK,EACjB,WAAW,EAAC,qHAAqH,EACjI,qBAAqB,EAAE,eAAe,CAAC,IAAI,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,IAAI,IAAI,CAAC,sBAAsB,CAAC,IAAI,eAAe,CAAC,CAAC,CAAC,GAClH,CACE,KAENA,iBAAK,KAAK,EAAC,wCAAwC,IACjDA,kBAAM,KAAK,EAAC,OAAO,8CACqBA,0BAAa,CAC9C,EACPA,iBAAK,KAAK,EAAC,gBAAgB,IACzBA,mCAAuB,CACnB,CACF,CACP,CACG,CACD,EACP;KACH;;;;;;;AAjDD;IApBCE,mCAAiB,CAAgH;QAChI,IAAI,EAAE,+BAA+B;QACrC,YAAY,EAAE,IAAI,GAAG,CAAC;YACpB,CAAC,2BAA2B,EAAE,WAAW,CAAC;YAC1C,CAAC,6BAA6B,EAAE,aAAa,CAAC;SAC/C,CAAC;QACF,YAAY,EAAE;YACZ,YAAY,EAAE,OACZ,KAAiI,EACjI,8BAA6D;gBAE7D,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;gBAEtC,IAAI,YAAY,EAAE;oBAChB,YAAY,CAAC,KAAK,CAAC,CAAC;iBACrB;aACF;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;wDAkDD;;;;;","names":["debug","h","Host","RegisterComponent"],"sources":["src/components/scheduler-editor/nylas-booking-calendar-picker/nylas-booking-calendar-picker.scss?tag=nylas-booking-calendar-picker&encapsulation=shadow","src/components/scheduler-editor/nylas-booking-calendar-picker/nylas-booking-calendar-picker.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n @include default-css-variables;\n width: inherit;\n}\n\n.nylas-booking-calendar-picker {\n width: inherit;\n display: flex;\n flex-direction: column;\n margin: 1rem;\n border-radius: var(--nylas-border-radius-2x);\n border: 1px solid var(--nylas-base-200);\n .header {\n padding: 1rem;\n border-bottom: 1px solid var(--nylas-base-200);\n h3 {\n margin: 0;\n font-size: 1rem;\n font-weight: 600;\n line-height: 20px;\n color: var(--nylas-base-900);\n text-align: left;\n }\n p {\n margin: 0.25rem 0 0 0;\n font-size: 0.875rem;\n font-weight: 400;\n line-height: 20px;\n color: var(--nylas-base-600);\n text-align: left;\n }\n }\n .nylas-booking-calendar-picker__loading {\n padding-bottom: 1rem;\n display: flex;\n flex-direction: column;\n gap: 4px;\n .label {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin: 1rem 1rem 0;\n color: var(--nylas-base-800);\n }\n .loading-button {\n margin: 0 1rem;\n padding: 0;\n width: inherit;\n height: 48px;\n color: black;\n font-size: 1rem;\n cursor: not-allowed;\n display: flex;\n gap: 0.5rem;\n justify-content: space-between;\n align-items: center;\n background: transparent;\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n span {\n padding: 0 1rem;\n }\n }\n }\n .nylas-booking-calendar-picker__dropdown {\n padding: 1rem;\n display: flex;\n flex-direction: column;\n gap: 4px;\n span.label {\n display: flex;\n align-items: center;\n gap: 4px;\n color: var(--nylas-base-800);\n tooltip-component {\n display: flex;\n }\n }\n select-dropdown::part(sd_dropdown) {\n width: 100%;\n }\n select-dropdown::part(sd_dropdown-content) {\n width: 100%;\n max-width: unset;\n }\n select-dropdown::part(sd_dropdown-button) {\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n padding: 1rem;\n }\n select-dropdown::part(sd_dropdown-button-selected-label) {\n max-width: calc(100% - 2rem);\n font-family: var(--nylas-font-family);\n font-size: 16px;\n line-height: 24px;\n }\n }\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } from '@/utils/utils';\nimport { Calendar } from '@nylas/core';\nimport { AttachInternals, Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { User } from '@/common/nylas-api-request';\n\n/**\n * The `nylas-booking-calendar-picker` component is a UI component that displays the booking calendar picker.\n * @part nbcp - The booking calendar picker container\n * @part nbcp__header - The header of the booking calendar picker\n * @part nbcp__input-label - The input label of the booking calendar picker\n * @part nbcp__dropdown - The dropdown container\n * @part nbcp__dropdown-button - The dropdown button\n * @part nbcp__dropdown-content - The dropdown content\n */\n@Component({\n tag: 'nylas-booking-calendar-picker',\n styleUrl: 'nylas-booking-calendar-picker.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasBookingCalendarPicker {\n @Element() host!: HTMLNylasCalendarPickerElement;\n /**\n * The calendars to choose from.\n */\n @Prop() calendars?: Calendar[];\n /**\n * The current logged in user.\n */\n @Prop() currentUser?: User;\n /**\n * The name of the calendar picker.\n */\n @Prop() name: string = 'booking-calendar';\n /**\n * The default selected calendars.\n */\n @Prop() defaultBookingCalendar: string = '';\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The selected calendars.\n */\n @State() selectedCalendar: string = '';\n\n /**\n * This event is fired when the selected calendars change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void;\n }>;\n\n // Lifecycle methods\n connectedCallback() {\n debug('nylas-booking-calendar-picker', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-booking-calendar-picker', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-booking-calendar-picker', 'componentWillLoad');\n // See comment in the @Watch('name') decorator for more information.\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-booking-calendar-picker', 'componentDidLoad');\n this.defaultBookingCalendar = this.defaultBookingCalendar || this.currentUser?.email || '';\n\n // TODO: Remove this when the internals in tests are fixed.\n if (typeof this.internals.setFormValue === 'function') {\n this.internals.setFormValue(this.defaultBookingCalendar.toString(), 'booking-calendar');\n }\n this.selectedCalendar = this.defaultBookingCalendar || this.currentUser?.email || '';\n }\n\n componentWillUpdate() {\n debug('nylas-booking-calendar-picker', 'componentWillUpdate');\n }\n\n componentDidUpdate() {\n debug('nylas-booking-calendar-picker', 'componentDidUpdate');\n }\n\n componentWillRender() {\n debug('nylas-booking-calendar-picker', 'componentWillRender');\n }\n\n componentDidRender() {\n debug('nylas-booking-calendar-picker', 'componentDidRender');\n }\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-booking-calendar-picker', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Listen('selectedOptionChanged')\n selectedOptionChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-booking-calendar-picker', 'selectedOptionChangedHandler', event.detail);\n // Pass as handler so that if event.defaultPrevented by parent app, this will be skipped.\n const valueChanged = (event: CustomEvent<{ value: string; name: string }>) => {\n const { value } = event.detail;\n this.selectedCalendar = value;\n this.internals.setFormValue(value.toString(), this.name);\n };\n this.valueChanged.emit({ value: event.detail.value, name: this.name, valueChanged });\n }\n\n @RegisterComponent<NylasBookingCalendarPicker, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-booking-calendar-picker',\n stateToProps: new Map([\n ['schedulerConfig.calendars', 'calendars'],\n ['schedulerConfig.currentUser', 'currentUser'],\n ]),\n eventToProps: {\n valueChanged: async (\n event: CustomEvent<{ value: string; name: string; valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void }>,\n _nylasSchedulerConfigConnector: NylasSchedulerConfigConnector,\n ) => {\n const { valueChanged } = event.detail;\n // If a handler is passed, call it.\n if (valueChanged) {\n valueChanged(event);\n }\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n const calendarOptions =\n this.calendars?.map(calendar => {\n return {\n value: calendar.id,\n label: calendar.name,\n };\n }) ?? [];\n\n return (\n <Host>\n <div class=\"nylas-booking-calendar-picker\" part=\"nbcp\">\n <div class=\"header\" part=\"nbcp__header\">\n <h3>Calendar booking</h3>\n <p>Choose calendar where you’d like the event bookings to show up.</p>\n </div>\n\n {calendarOptions.length > 0 ? (\n <div class=\"nylas-booking-calendar-picker__dropdown\">\n <span class=\"label\" part=\"nbcp__input-label\">\n Select a calendar to book meetings on\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">\n Check availability across one or multiple calendars. If multiple calendars are selected, you must be available across all of them to be considered available.\n </span>\n </tooltip-component>\n </span>\n <select-dropdown\n name=\"booking-calendar\"\n options={calendarOptions}\n withSearch={false}\n exportparts=\"sd_dropdown: nbcp__dropdown, sd_dropdown-button: nbcp__dropdown-button, sd_dropdown-content: nbcp__dropdown-content\"\n defaultSelectedOption={calendarOptions.find(cal => cal.value == this.defaultBookingCalendar) ?? calendarOptions[0]}\n />\n </div>\n ) : (\n <div class=\"nylas-booking-calendar-picker__loading\">\n <span class=\"label\">\n Select a calendar to book meetings on <info-icon />\n </span>\n <div class=\"loading-button\">\n <span>Loading...</span>\n </div>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"nylas-booking-calendar-picker.entry.cjs.js","mappings":";;;;;;;;;AAAA,MAAM,6BAA6B,GAAG,0kGAA0kG;;;;;;;;;;;;;;;;MCuBnmG,0BAA0B;;;;;;;;;;;;;oBAad,kBAAkB;sCAIA,EAAE;gCASP,EAAE;;IAYtC,iBAAiB;QACfA,WAAK,CAAC,+BAA+B,EAAE,mBAAmB,CAAC,CAAC;KAC7D;IAED,oBAAoB;QAClBA,WAAK,CAAC,+BAA+B,EAAE,sBAAsB,CAAC,CAAC;KAChE;IAED,iBAA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,CAAC,CAAC,CAAC,GAClH,CACE,KAENA,iBAAK,KAAK,EAAC,wCAAwC,IACjDA,kBAAM,KAAK,EAAC,OAAO,8CACqBA,0BAAa,CAC9C,EACPA,iBAAK,KAAK,EAAC,gBAAgB,IACzBA,mCAAuB,CACnB,CACF,CACP,CACG,CACD,EACP;KACH;;;;;;;AAjDD;IApBCE,mCAAiB,CAAgH;QAChI,IAAI,EAAE,+BAA+B;QACrC,YAAY,EAAE,IAAI,GAAG,CAAC;YACpB,CAAC,2BAA2B,EAAE,WAAW,CAAC;YAC1C,CAAC,6BAA6B,EAAE,aAAa,CAAC;SAC/C,CAAC;QACF,YAAY,EAAE;YACZ,YAAY,EAAE,OACZ,KAAiI,EACjI,8BAA6D;gBAE7D,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC;gBAEtC,IAAI,YAAY,EAAE;oBAChB,YAAY,CAAC,KAAK,CAAC,CAAC;iBACrB;aACF;SACF;QACD,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;wDAkDD;;;;;","names":["debug","h","Host","RegisterComponent"],"sources":["src/components/scheduler-editor/nylas-booking-calendar-picker/nylas-booking-calendar-picker.scss?tag=nylas-booking-calendar-picker&encapsulation=shadow","src/components/scheduler-editor/nylas-booking-calendar-picker/nylas-booking-calendar-picker.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n @include default-css-variables;\n width: inherit;\n}\n\n.nylas-booking-calendar-picker {\n width: inherit;\n display: flex;\n flex-direction: column;\n margin: 1rem;\n border-radius: var(--nylas-border-radius-2x);\n border: 1px solid var(--nylas-base-200);\n .header {\n padding: 1rem;\n border-bottom: 1px solid var(--nylas-base-200);\n h3 {\n margin: 0;\n font-size: 1rem;\n font-weight: 600;\n line-height: 20px;\n color: var(--nylas-base-900);\n text-align: left;\n }\n p {\n margin: 0.25rem 0 0 0;\n font-size: 0.875rem;\n font-weight: 400;\n line-height: 20px;\n color: var(--nylas-base-600);\n text-align: left;\n }\n }\n .nylas-booking-calendar-picker__loading {\n padding-bottom: 1rem;\n display: flex;\n flex-direction: column;\n gap: 4px;\n .label {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n margin: 1rem 1rem 0;\n color: var(--nylas-base-800);\n }\n .loading-button {\n margin: 0 1rem;\n padding: 0;\n width: inherit;\n height: 48px;\n color: black;\n font-size: 1rem;\n cursor: not-allowed;\n display: flex;\n gap: 0.5rem;\n justify-content: space-between;\n align-items: center;\n background: transparent;\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n span {\n padding: 0 1rem;\n }\n }\n }\n .nylas-booking-calendar-picker__dropdown {\n padding: 1rem;\n display: flex;\n flex-direction: column;\n gap: 4px;\n span.label {\n display: flex;\n align-items: center;\n gap: 4px;\n color: var(--nylas-base-800);\n tooltip-component {\n display: flex;\n }\n }\n select-dropdown::part(sd_dropdown) {\n width: 100%;\n }\n select-dropdown::part(sd_dropdown-content) {\n width: 100%;\n max-width: unset;\n }\n select-dropdown::part(sd_dropdown-button) {\n width: 100%;\n display: flex;\n justify-content: space-between;\n align-items: center;\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n padding: 1rem;\n }\n select-dropdown::part(sd_dropdown-button-selected-label) {\n max-width: calc(100% - 2rem);\n font-family: var(--nylas-font-family);\n font-size: 16px;\n line-height: 24px;\n }\n }\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } from '@/utils/utils';\nimport { Calendar } from '@nylas/core';\nimport { AttachInternals, Component, Element, Event, EventEmitter, Host, Listen, Prop, State, Watch, h } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\nimport { User } from '@/common/nylas-api-request';\n\n/**\n * The `nylas-booking-calendar-picker` component is a UI component that displays the booking calendar picker.\n * @part nbcp - The booking calendar picker container\n * @part nbcp__header - The header of the booking calendar picker\n * @part nbcp__input-label - The input label of the booking calendar picker\n * @part nbcp__dropdown - The dropdown container\n * @part nbcp__dropdown-button - The dropdown button\n * @part nbcp__dropdown-content - The dropdown content\n */\n@Component({\n tag: 'nylas-booking-calendar-picker',\n styleUrl: 'nylas-booking-calendar-picker.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasBookingCalendarPicker {\n @Element() host!: HTMLNylasCalendarPickerElement;\n /**\n * The calendars to choose from.\n */\n @Prop() calendars?: Calendar[];\n /**\n * The current logged in user.\n */\n @Prop() currentUser?: User;\n /**\n * The name of the calendar picker.\n */\n @Prop() name: string = 'booking-calendar';\n /**\n * The default selected calendar.\n */\n @Prop() defaultBookingCalendar: string = '';\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\n\n /**\n * The selected calendars.\n */\n @State() selectedCalendar: string = '';\n\n /**\n * This event is fired when the selected calendars change.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void;\n }>;\n\n // Lifecycle methods\n connectedCallback() {\n debug('nylas-booking-calendar-picker', 'connectedCallback');\n }\n\n disconnectedCallback() {\n debug('nylas-booking-calendar-picker', 'disconnectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-booking-calendar-picker', 'componentWillLoad');\n // See comment in the @Watch('name') decorator for more information.\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-booking-calendar-picker', 'componentDidLoad');\n this.defaultBookingCalendar = this.defaultBookingCalendar || this.currentUser?.email || '';\n\n // TODO: Remove this when the internals in tests are fixed.\n if (typeof this.internals.setFormValue === 'function') {\n this.internals.setFormValue(this.defaultBookingCalendar.toString(), 'booking-calendar');\n }\n this.selectedCalendar = this.defaultBookingCalendar || this.currentUser?.email || '';\n }\n\n componentWillUpdate() {\n debug('nylas-booking-calendar-picker', 'componentWillUpdate');\n }\n\n componentDidUpdate() {\n debug('nylas-booking-calendar-picker', 'componentDidUpdate');\n }\n\n componentWillRender() {\n debug('nylas-booking-calendar-picker', 'componentWillRender');\n }\n\n componentDidRender() {\n debug('nylas-booking-calendar-picker', 'componentDidRender');\n }\n\n /**\n * When a name prop is passed, stencil does not automatically set the name attribute on the host element.\n * Since this component is form-associated, the name attribute is required for form submission.\n * This is a workaround to ensure that the name attribute is set on the host element.\n */\n @Watch('name')\n elementNameChangedHandler(newValue: string) {\n debug('nylas-booking-calendar-picker', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Listen('selectedOptionChanged')\n selectedOptionChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-booking-calendar-picker', 'selectedOptionChangedHandler', event.detail);\n // Pass as handler so that if event.defaultPrevented by parent app, this will be skipped.\n const valueChanged = (event: CustomEvent<{ value: string; name: string }>) => {\n const { value } = event.detail;\n this.selectedCalendar = value;\n this.internals.setFormValue(value.toString(), this.name);\n };\n this.valueChanged.emit({ value: event.detail.value, name: this.name, valueChanged });\n }\n\n @RegisterComponent<NylasBookingCalendarPicker, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-booking-calendar-picker',\n stateToProps: new Map([\n ['schedulerConfig.calendars', 'calendars'],\n ['schedulerConfig.currentUser', 'currentUser'],\n ]),\n eventToProps: {\n valueChanged: async (\n event: CustomEvent<{ value: string; name: string; valueChanged?: (event: CustomEvent<{ value: string; name: string }>) => void }>,\n _nylasSchedulerConfigConnector: NylasSchedulerConfigConnector,\n ) => {\n const { valueChanged } = event.detail;\n // If a handler is passed, call it.\n if (valueChanged) {\n valueChanged(event);\n }\n },\n },\n fireRegisterEvent: true,\n })\n render() {\n const calendarOptions =\n this.calendars?.map(calendar => {\n return {\n value: calendar.id,\n label: calendar.name,\n };\n }) ?? [];\n\n return (\n <Host>\n <div class=\"nylas-booking-calendar-picker\" part=\"nbcp\">\n <div class=\"header\" part=\"nbcp__header\">\n <h3>Calendar booking</h3>\n <p>Choose calendar where you’d like the event bookings to show up.</p>\n </div>\n\n {calendarOptions.length > 0 ? (\n <div class=\"nylas-booking-calendar-picker__dropdown\">\n <span class=\"label\" part=\"nbcp__input-label\">\n Select a calendar to book meetings on\n <tooltip-component>\n <info-icon slot=\"tooltip-icon\" />\n <span slot=\"tooltip-content\">\n Check availability across one or multiple calendars. If multiple calendars are selected, you must be available across all of them to be considered available.\n </span>\n </tooltip-component>\n </span>\n <select-dropdown\n name=\"booking-calendar\"\n options={calendarOptions}\n withSearch={false}\n exportparts=\"sd_dropdown: nbcp__dropdown, sd_dropdown-button: nbcp__dropdown-button, sd_dropdown-content: nbcp__dropdown-content\"\n defaultSelectedOption={calendarOptions.find(cal => cal.value == this.defaultBookingCalendar) ?? calendarOptions[0]}\n />\n </div>\n ) : (\n <div class=\"nylas-booking-calendar-picker__loading\">\n <span class=\"label\">\n Select a calendar to book meetings on <info-icon />\n </span>\n <div class=\"loading-button\">\n <span>Loading...</span>\n </div>\n </div>\n )}\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -175,13 +175,13 @@ const NylasBookingForm = class {
|
|
|
175
175
|
this.guestEmailErrors = { ...errors };
|
|
176
176
|
}
|
|
177
177
|
render() {
|
|
178
|
-
return (index.h(index.Host, { key: '
|
|
178
|
+
return (index.h(index.Host, { key: '018357db1ce7dbbeb11ebc236b869a3baf246c69' }, index.h("form", { key: '5f26a98903372d4c587df1d1045bcb240c4ee7cd', onSubmit: e => this.bookButtonClickedHandler(e), noValidate: true }, index.h("div", { key: '4ad84c89bb19933cb5d8403939104c38705ddfba', class: "nylas-booking-form" }, index.h("slot", { key: 'c594f51e9d8cbd40e1d42f9aa86baae536a9c7e7', name: "custom-booking-form" }, index.h("div", { key: 'fe026c1562cb85c773e31cec8a0a3574b3515e0c', class: "input-wrapper" }, index.h("label", { key: '27ecf20858dd3133ec4914970f7148720bc603ed', htmlFor: "name", class: { 'input-label': true, 'error': !this.isNameValid }, part: "nbf__input-label" }, "Name ", index.h("span", { key: '4a39ea8d7aa693f860c17aa28b2130ae49f31a1c', class: "required" }, "*")), index.h("input", { key: '69fb70d74fe3b3cd883ca7fc0a9f174b6f81936a', id: "name", type: "text", placeholder: "Enter your name", value: this.name, class: {
|
|
179
179
|
input: true,
|
|
180
180
|
error: !this.isNameValid,
|
|
181
|
-
}, part: "nbf__input-textfield", onInput: (e) => this.changeName(e.target?.value) }), index.h("p", { key: '
|
|
181
|
+
}, part: "nbf__input-textfield", onInput: (e) => this.changeName(e.target?.value) }), index.h("p", { key: 'e4be03fd299cbc94713e5561fb9ed69a78af200c', class: "help-text" }, this.validationError.name)), index.h("div", { key: '017e724bfd408c5bde7714ae8b2a941d4a1194d9', class: "input-wrapper" }, index.h("label", { key: 'ed19f30d50d5d2ae95bcbf567b5c888b7906463d', htmlFor: "email", class: { 'input-label': true, 'error': !this.isEmailValid }, part: "nbf__input-label" }, "Email ", index.h("span", { key: '9b3ab493851edfcc407a38fad0994da171ac9976', class: "required" }, "*")), index.h("input", { key: '768690b3cc350537be1fa39cc7a295f688c1d91d', id: "email", type: "email", placeholder: "Enter your email", value: this.email, class: {
|
|
182
182
|
input: true,
|
|
183
183
|
error: !this.isEmailValid,
|
|
184
|
-
}, part: "nbf__input-textfield", onInput: (e) => this.changeEmail(e.target?.value) }), index.h("p", { key: '
|
|
184
|
+
}, part: "nbf__input-textfield", onInput: (e) => this.changeEmail(e.target?.value) }), index.h("p", { key: '24a39d859e700d000a363fe8df2f000365542fb0', class: "help-text" }, this.validationError.email)))), index.h("div", { key: '40b4b99dcf471afb8079d49fb9a0efe6bb7e406c', class: "cta" }, index.h("sp-button", { key: 'ae6bc3f620953f355184c7aef3ce692c2509c81d', treatment: "outline", variant: "secondary", class: 'back', part: "nbf__button-outline", onClick: this.handleBackButtonClicked }, index.h("slot", { key: 'e5a10ff0978756f7c3f8751a7aca6e3281f5046b', name: "booking-form-back-label" }, "Back")), index.h("sp-button", { key: '3aa5fe99000d52ef64db4191950109caeb526878', variant: "primary", class: 'book', part: "nbf__button-primary", type: "submit" }, this.isLoading && index.h("loading-icon", { slot: "icon" }), index.h("slot", { key: '83c5332efd5eb82617dc0a0f5275950431d95c26', name: "booking-form-book-label" }, "Book now"))))));
|
|
185
185
|
}
|
|
186
186
|
get host() { return index.getElement(this); }
|
|
187
187
|
static get watchers() { return {
|
|
@@ -7,7 +7,7 @@ const registerComponent = require('./register-component-4f8ae42c.js');
|
|
|
7
7
|
const utils = require('./utils-85bd0909.js');
|
|
8
8
|
require('./_commonjsHelpers-ef8cd0cd.js');
|
|
9
9
|
|
|
10
|
-
const nylasBufferTimeCss = ":host{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:\"Inter\", sans-serif;width:inherit}.nylas-buffer-time{width:inherit;display:flex;flex-direction:column;margin:1rem;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-200);text-align:left}.nylas-buffer-time .header{padding:1rem;border-bottom:1px solid var(--nylas-base-200)}.nylas-buffer-time .header h3{margin:0;font-size:1rem;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.nylas-buffer-time .header p{margin:0.25rem 0 0 0;font-size:0.875rem;font-weight:400;line-height:20px;color:var(--nylas-base-600);text-align:left}.nylas-buffer-time .nylas-buffer-time__body{display:grid;grid-template-columns:1fr auto}@media screen and (max-width: 768px){.nylas-buffer-time .nylas-buffer-time__body{grid-template-columns:1fr}}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown{padding:1rem;display:flex;flex-direction:column;gap:1rem;border-right:1px solid var(--nylas-base-200);color:var(--nylas-base-800)}@media screen and (max-width: 768px){.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown{border:none}}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown .nylas-buffer-time__row{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:1rem}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown .nylas-buffer-time__row label{width:200px}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown .nylas-buffer-time__row .dropdown-container{display:flex;gap:1rem;align-items:center;justify-content:flex-end}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview{width:208px;background:var(--nylas-base-25);border-bottom-right-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview{width:inherit;border-bottom-left-radius:var(--nylas-border-radius-2x)}}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview h4{font-size:14px;line-height:24px;color:var(--nylas-base-600);font-family:var(--nylas-font-family);font-weight:500;text-align:center}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container{padding:0 2rem 1rem}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .slot{background-color:transparent;border-top:1px solid var(--nylas-base-300)}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .slot.active{background-color:var(--nylas-base-100)}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .slot:last-of-type{border-bottom:1px solid var(--nylas-base-300)}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .event-slot{background-color:var(--nylas-base-600);border-top:1px solid var(--nylas-base-300)
|
|
10
|
+
const nylasBufferTimeCss = ":host{display:block;--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:\"Inter\", sans-serif;width:inherit}.nylas-buffer-time{width:inherit;display:flex;flex-direction:column;margin:1rem;border-radius:var(--nylas-border-radius-2x);border:1px solid var(--nylas-base-200);text-align:left}.nylas-buffer-time .header{padding:1rem;border-bottom:1px solid var(--nylas-base-200)}.nylas-buffer-time .header h3{margin:0;font-size:1rem;font-weight:600;line-height:20px;color:var(--nylas-base-900);text-align:left}.nylas-buffer-time .header p{margin:0.25rem 0 0 0;font-size:0.875rem;font-weight:400;line-height:20px;color:var(--nylas-base-600);text-align:left}.nylas-buffer-time .nylas-buffer-time__body{display:grid;grid-template-columns:1fr auto}@media screen and (max-width: 768px){.nylas-buffer-time .nylas-buffer-time__body{grid-template-columns:1fr}}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown{padding:1rem;display:flex;flex-direction:column;gap:1rem;border-right:1px solid var(--nylas-base-200);color:var(--nylas-base-800)}@media screen and (max-width: 768px){.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown{border:none}}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown .nylas-buffer-time__row{display:grid;grid-template-columns:auto 1fr;align-items:center;gap:1rem}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown .nylas-buffer-time__row label{width:200px}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__dropdown .nylas-buffer-time__row .dropdown-container{display:flex;gap:1rem;align-items:center;justify-content:flex-end}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview{width:208px;background:var(--nylas-base-25);border-bottom-right-radius:var(--nylas-border-radius-2x)}@media screen and (max-width: 768px){.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview{width:inherit;border-bottom-left-radius:var(--nylas-border-radius-2x)}}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview h4{font-size:14px;line-height:24px;color:var(--nylas-base-600);font-family:var(--nylas-font-family);font-weight:500;text-align:center;margin:0.75rem 0}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container{padding:0 2rem 1rem}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .slot{background-color:transparent;border-top:1px solid var(--nylas-base-300)}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .slot.active{background-color:var(--nylas-base-100)}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .slot:last-of-type{border-bottom:1px solid var(--nylas-base-300)}.nylas-buffer-time .nylas-buffer-time__body .nylas-buffer-time__preview .preview-container .event-slot{background-color:var(--nylas-base-600);border-top:1px solid var(--nylas-base-300)}.nylas-buffer-time .nylas-buffer-time__dropdown select-dropdown::part(sd_dropdown-button){width:104px;display:flex;justify-content:space-between;align-items:center;border:1px solid var(--nylas-base-200);border-radius:var(--nylas-border-radius-2x);padding:1rem}.nylas-buffer-time .nylas-buffer-time__dropdown select-dropdown::part(sd_dropdown-content){width:100%}.nylas-buffer-time .nylas-buffer-time__dropdown select-dropdown::part(sd_dropdown-button-selected-label){max-width:calc(100% - 2rem);font-family:var(--nylas-font-family);font-size:16px;line-height:24px}";
|
|
11
11
|
|
|
12
12
|
var __decorate = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
|
13
13
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
@@ -97,7 +97,7 @@ const NylasBufferTime = class {
|
|
|
97
97
|
}
|
|
98
98
|
renderPreview() {
|
|
99
99
|
const totalSlots = 4;
|
|
100
|
-
const slotHeight =
|
|
100
|
+
const slotHeight = 10;
|
|
101
101
|
const eventSlotHeight = slotHeight * 2;
|
|
102
102
|
const slotFill = minutes => {
|
|
103
103
|
const fullSlots = Math.floor(minutes / 30);
|
|
@@ -146,13 +146,14 @@ const NylasBufferTime = class {
|
|
|
146
146
|
return (index.h("div", { class: "preview-container" }, createBeforeSlots(), index.h("div", { class: "event-slot", style: { height: `${eventSlotHeight}px` } }), createAfterSlots()));
|
|
147
147
|
}
|
|
148
148
|
render() {
|
|
149
|
-
const minuteOptions = Array.from({ length:
|
|
149
|
+
const minuteOptions = Array.from({ length: 24 }, (_, i) => {
|
|
150
|
+
const value = (i + 1) * 5;
|
|
150
151
|
return {
|
|
151
|
-
label:
|
|
152
|
-
value:
|
|
152
|
+
label: value.toString(),
|
|
153
|
+
value: value,
|
|
153
154
|
};
|
|
154
155
|
});
|
|
155
|
-
return (index.h(index.Host, null, index.h("div", { class: "nylas-buffer-time", part: "nbt" }, index.h("div", { class: "header", part: "nbt__header" }, index.h("h3", null, "Buffer time"), index.h("p", null, "Add buffer time before and after the event.")), index.h("div", { class: "nylas-buffer-time__body", part: "nbt__body" }, index.h("div", { class: "nylas-buffer-time__dropdown" }, index.h("div", { class: "nylas-buffer-time__row" }, index.h("label", null, "Before the event"), index.h("div", { class: "dropdown-container" }, index.h("select-dropdown", { id: "before-buffer-time", name: "before-buffer-time", exportparts: "sd_dropdown: nbt__dropdown-before, sd_dropdown-button: nbt__dropdown-button-before, sd_dropdown-content: nbt__dropdown-content-before", options: minuteOptions, defaultSelectedOption: minuteOptions.find(min => min.value == this.selectedBeforeBufferTime) ?? minuteOptions[0] }), index.h("span", null, "mins"))), index.h("div", { class: "nylas-buffer-time__row" }, index.h("label", null, "After the event"), index.h("div", { class: "dropdown-container" }, index.h("select-dropdown", { id: "after-buffer-time", name: "after-buffer-time", exportparts: "sd_dropdown: nbt__dropdown-after, sd_dropdown-button: nbt__dropdown-button-after, sd_dropdown-content: nbt__dropdown-content-after", options: minuteOptions, defaultSelectedOption: minuteOptions.find(min => min.value == this.selectedAfterBufferTime) ?? minuteOptions[0] }), index.h("span", null, "mins")))), index.h("div", { class: "nylas-buffer-time__preview", part: "nbt__preview" }, index.h("h4", null, "PREVIEW"), this.renderPreview())))));
|
|
156
|
+
return (index.h(index.Host, null, index.h("div", { class: "nylas-buffer-time", part: "nbt" }, index.h("div", { class: "header", part: "nbt__header" }, index.h("h3", null, "Buffer time"), index.h("p", null, "Add buffer time before and after the event.")), index.h("div", { class: "nylas-buffer-time__body", part: "nbt__body" }, index.h("div", { class: "nylas-buffer-time__dropdown" }, index.h("div", { class: "nylas-buffer-time__row" }, index.h("label", null, "Before the event"), index.h("div", { class: "dropdown-container" }, index.h("select-dropdown", { id: "before-buffer-time", withSearch: false, name: "before-buffer-time", exportparts: "sd_dropdown: nbt__dropdown-before, sd_dropdown-button: nbt__dropdown-button-before, sd_dropdown-content: nbt__dropdown-content-before", options: minuteOptions, defaultSelectedOption: minuteOptions.find(min => min.value == this.selectedBeforeBufferTime) ?? minuteOptions[0] }), index.h("span", null, "mins"))), index.h("div", { class: "nylas-buffer-time__row" }, index.h("label", null, "After the event"), index.h("div", { class: "dropdown-container" }, index.h("select-dropdown", { id: "after-buffer-time", withSearch: false, name: "after-buffer-time", exportparts: "sd_dropdown: nbt__dropdown-after, sd_dropdown-button: nbt__dropdown-button-after, sd_dropdown-content: nbt__dropdown-content-after", options: minuteOptions, defaultSelectedOption: minuteOptions.find(min => min.value == this.selectedAfterBufferTime) ?? minuteOptions[0] }), index.h("span", null, "mins")))), index.h("div", { class: "nylas-buffer-time__preview", part: "nbt__preview" }, index.h("h4", null, "PREVIEW"), this.renderPreview())))));
|
|
156
157
|
}
|
|
157
158
|
static get formAssociated() { return true; }
|
|
158
159
|
get host() { return index.getElement(this); }
|