@nylas/web-elements 0.0.0-canary-20241017103834 → 0.0.0-canary-20241017202051

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.
Files changed (31) hide show
  1. package/dist/cdn/nylas-additional-participants/nylas-additional-participants.es.js +7 -7
  2. package/dist/cdn/nylas-editor-tabs/nylas-editor-tabs.es.js +4552 -4544
  3. package/dist/cdn/nylas-reminder-emails/nylas-reminder-emails.es.js +2289 -2281
  4. package/dist/cdn/nylas-reminder-time/nylas-reminder-time.es.js +2253 -2245
  5. package/dist/cdn/nylas-scheduler-editor/nylas-scheduler-editor.es.js +97 -89
  6. package/dist/cjs/calendar-agenda-fill-icon_54.cjs.entry.js +32 -37
  7. package/dist/cjs/calendar-agenda-fill-icon_54.cjs.entry.js.map +1 -1
  8. package/dist/cjs/loader.cjs.js +1 -1
  9. package/dist/cjs/nylas-web-elements.cjs.js +1 -1
  10. package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.js +9 -9
  11. package/dist/collection/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.js.map +1 -1
  12. package/dist/collection/components/scheduler-editor/nylas-reminder-time/nylas-reminder-time.js +23 -30
  13. package/dist/collection/components/scheduler-editor/nylas-reminder-time/nylas-reminder-time.js.map +1 -1
  14. package/dist/collection/components/scheduler-editor/nylas-reminder-time/test/nylas-reminder-time.spec.js +37 -0
  15. package/dist/collection/components/scheduler-editor/nylas-reminder-time/test/nylas-reminder-time.spec.js.map +1 -0
  16. package/dist/components/nylas-additional-participants2.js +9 -9
  17. package/dist/components/nylas-additional-participants2.js.map +1 -1
  18. package/dist/components/nylas-reminder-time2.js +23 -29
  19. package/dist/components/nylas-reminder-time2.js.map +1 -1
  20. package/dist/esm/calendar-agenda-fill-icon_54.entry.js +32 -37
  21. package/dist/esm/calendar-agenda-fill-icon_54.entry.js.map +1 -1
  22. package/dist/esm/loader.js +1 -1
  23. package/dist/esm/nylas-web-elements.js +1 -1
  24. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  25. package/dist/nylas-web-elements/nylas-web-elements.esm.js.map +1 -1
  26. package/dist/nylas-web-elements/{p-df131a08.entry.js → p-1ce8b1c3.entry.js} +3 -3
  27. package/dist/nylas-web-elements/p-1ce8b1c3.entry.js.map +1 -0
  28. package/dist/types/components/scheduler-editor/nylas-additional-participants/nylas-additional-participants.d.ts +1 -1
  29. package/dist/types/components/scheduler-editor/nylas-reminder-time/nylas-reminder-time.d.ts +1 -1
  30. package/package.json +1 -1
  31. package/dist/nylas-web-elements/p-df131a08.entry.js.map +0 -1
@@ -24,22 +24,29 @@ var __metadata = (undefined && undefined.__metadata) || function (k, v) {
24
24
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
25
25
  return Reflect.metadata(k, v);
26
26
  };
27
+ const reminderTimeOptions = [
28
+ { value: 60 * 24, label: 'day' },
29
+ { value: 60, label: 'hour' },
30
+ { value: 1, label: 'minute' },
31
+ ];
27
32
  function getInitialTimeValue(timeInMinutes) {
28
33
  if (!timeInMinutes)
29
34
  return 30;
30
- if (timeInMinutes >= 60 * 24)
31
- return timeInMinutes / (60 * 24);
32
- if (timeInMinutes >= 90 || timeInMinutes === 60)
33
- return timeInMinutes / 60;
35
+ for (const option of reminderTimeOptions) {
36
+ if (timeInMinutes % option.value === 0) {
37
+ return timeInMinutes / option.value;
38
+ }
39
+ }
34
40
  return timeInMinutes;
35
41
  }
36
42
  function getInitialTimeIncrement(timeInMinutes) {
37
43
  if (!timeInMinutes)
38
- return 30;
39
- if (timeInMinutes >= 60 * 24)
40
- return 60 * 24;
41
- if (timeInMinutes >= 90 || timeInMinutes === 60)
42
- return 60;
44
+ return 1;
45
+ for (const option of reminderTimeOptions) {
46
+ if (timeInMinutes % option.value === 0) {
47
+ return option.value;
48
+ }
49
+ }
43
50
  return 1;
44
51
  }
45
52
  const NylasReminderTime = proxyCustomElement(class NylasReminderTime extends HTMLElement {
@@ -60,15 +67,6 @@ const NylasReminderTime = proxyCustomElement(class NylasReminderTime extends HTM
60
67
  debug('nylas-reminder-time', 'elementNameChangedHandler', newValue);
61
68
  this.host.setAttribute('name', newValue);
62
69
  }
63
- eventReminderTimeMinutesChangedHandler(newValue, oldValue) {
64
- debug('nylas-reminder-time', 'eventReminderTimeMinutesChangedHandler', newValue);
65
- if (newValue === oldValue) {
66
- return;
67
- }
68
- this.reminderTime = getInitialTimeValue(newValue);
69
- this.reminderTimeincrement = getInitialTimeIncrement(newValue);
70
- this.reminderTimeMinutes = newValue;
71
- }
72
70
  reminderTimeMinutesChangedHandler(newValue, oldValue) {
73
71
  debug('nylas-reminder-time', 'reminderTimeMinutesChangedHandler', newValue);
74
72
  if (newValue === oldValue) {
@@ -82,14 +80,17 @@ const NylasReminderTime = proxyCustomElement(class NylasReminderTime extends HTM
82
80
  componentWillLoad() {
83
81
  debug('nylas-reminder-time', 'componentWillLoad');
84
82
  this.host.setAttribute('name', this.name);
85
- this.setReminderTimeMinuteOptions();
86
83
  }
87
84
  componentDidLoad() {
88
85
  debug('nylas-reminder-time', 'componentDidLoad');
86
+ this.setReminderTimeMinuteOptions();
89
87
  }
90
88
  disconnectedCallback() {
91
89
  debug('nylas-reminder-time', 'disconnectedCallback');
92
90
  }
91
+ get isInternalsAvailable() {
92
+ return this.internals !== undefined && typeof this.internals.setFormValue === 'function';
93
+ }
93
94
  setReminderTimeMinuteOptions() {
94
95
  if (this.reminderTimeincrement === 1) {
95
96
  this.reminderTimeMinutesOptions = REMINDER_MINUTE_OPTIONS;
@@ -113,28 +114,22 @@ const NylasReminderTime = proxyCustomElement(class NylasReminderTime extends HTM
113
114
  }
114
115
  this.setReminderTimeMinuteOptions();
115
116
  this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;
116
- this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
117
+ this.isInternalsAvailable && this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
117
118
  }
118
119
  inputOptionChangedHandler(event) {
119
120
  debug('nylas-calendar-picker', 'inputOptionChangedHandler', event.detail);
120
121
  const { value } = event.detail;
121
122
  this.reminderTime = value;
122
123
  this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;
123
- this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
124
+ this.isInternalsAvailable && this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
124
125
  }
125
126
  render() {
126
- const reminderTimeOptions = [
127
- { value: 1, label: 'minute' },
128
- { value: 60, label: 'hour' },
129
- { value: 60 * 24, label: 'day' },
130
- ];
131
- return (h(Host, { key: 'd5f118391bdd7e4779f6eca15335285047fdb350' }, h("div", { key: '2dd8d3ba52d4f95480c9cf1fdaf5d0f1f7c1e523', class: "nylas-reminder-time", part: "nrt" }, h("div", { key: '3799c4b266f4078e22ad78b86225ef9abdc5fa49', class: "nylas-reminder-time__wrapper" }, h("input-dropdown", { key: '004b6336c041660e1424ac44f16e82c8a5a2ca53', name: 'reminder-time', options: this.reminderTimeMinutesOptions, inputValue: this.reminderTime.toString(), exportparts: "id_dropdown: nrt__input_dropdown, id_dropdown-input: nrt__input_dropdown-input, id_dropdown-content: nrt__input_dropdown-content", defaultInputOption: this.reminderTimeMinutesOptions.find(i => i.value == this.reminderTime) ?? reminderTimeOptions[0] }), h("select-dropdown", { key: '6a42c7f4633d89dd9a94d3c2f119e151613667ec', name: 'reminder-time-unit', options: reminderTimeOptions, pluralizedLabel: this.reminderTime > 1 ? 's' : '', exportparts: "sd_dropdown: nrt__dropdown, sd_dropdown-button: nrt__dropdown-button, sd_dropdown-content: nrt__dropdown-content", defaultSelectedOption: reminderTimeOptions.find(i => i.value == this.reminderTimeincrement) ?? reminderTimeOptions[0], withSearch: false })))));
127
+ return (h(Host, { key: 'b089eb10d76d001112d867a61889a685b8908355' }, h("div", { key: '13b8479fb822135c00ff8f97974c8269731b2a84', class: "nylas-reminder-time", part: "nrt" }, h("div", { key: '728e90c61077b1037aa285329f11a09a296b33b4', class: "nylas-reminder-time__wrapper" }, h("input-dropdown", { key: '40a22b75424d4b3b552a2dc1b60e79a8cb595032', name: 'reminder-time', options: this.reminderTimeMinutesOptions, inputValue: this.reminderTime.toString(), exportparts: "id_dropdown: nrt__input_dropdown, id_dropdown-input: nrt__input_dropdown-input, id_dropdown-content: nrt__input_dropdown-content", defaultInputOption: this.reminderTimeMinutesOptions.find(i => i.value == this.reminderTime) ?? reminderTimeOptions[0] }), h("select-dropdown", { key: '6128bb953b883be5341ba005438ab353b0016c48', name: 'reminder-time-unit', options: [...reminderTimeOptions].sort((a, b) => a.value - b.value), pluralizedLabel: this.reminderTime > 1 ? 's' : '', exportparts: "sd_dropdown: nrt__dropdown, sd_dropdown-button: nrt__dropdown-button, sd_dropdown-content: nrt__dropdown-content", defaultSelectedOption: reminderTimeOptions.find(i => i.value == this.reminderTimeincrement) ?? reminderTimeOptions[0], withSearch: false })))));
132
128
  }
133
129
  static get formAssociated() { return true; }
134
130
  get host() { return this; }
135
131
  static get watchers() { return {
136
132
  "name": ["elementNameChangedHandler"],
137
- "eventReminderTimeMinutes": ["eventReminderTimeMinutesChangedHandler"],
138
133
  "reminderTimeMinutes": ["reminderTimeMinutesChangedHandler"]
139
134
  }; }
140
135
  static get style() { return NylasReminderTimeStyle0; }
@@ -147,7 +142,6 @@ const NylasReminderTime = proxyCustomElement(class NylasReminderTime extends HTM
147
142
  "reminderTimeMinutesOptions": [32]
148
143
  }, [[0, "nylasFormDropdownChanged", "nylasFormDropdownChangedHandler"], [0, "inputOptionChanged", "inputOptionChangedHandler"]], {
149
144
  "name": ["elementNameChangedHandler"],
150
- "eventReminderTimeMinutes": ["eventReminderTimeMinutesChangedHandler"],
151
145
  "reminderTimeMinutes": ["reminderTimeMinutesChangedHandler"]
152
146
  }]);
153
147
  __decorate([
@@ -1 +1 @@
1
- {"file":"nylas-reminder-time2.js","mappings":";;;;;;;;;AAAA,MAAM,oBAAoB,GAAG,g2DAAg2D,CAAC;AAC93D,gCAAe,oBAAoB;;;;;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qBAAqB,EAAC,IAAI,EAAC,KAAK,IACzC,4DAAK,KAAK,EAAC,8BAA8B,IACvC,uEACE,IAAI,EAAE,eAAe,EACrB,OAAO,EAAE,IAAI,CAAC,0BAA0B,EACxC,UAAU,EAAE,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,EACxC,WAAW,EAAC,kIAAkI,EAC9I,kBAAkB,EAAE,IAAI,CAAC,0BAA0B,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,mBAAmB,CAAC,CAAC,CAAC,GACrH,EACF,wEACE,IAAI,EAAE,oBAAoB,EAC1B,OAAO,EAAE,mBAAmB,EAC5B,eAAe,EAAE,IAAI,CAAC,YAAY,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,EACjD,WAAW,EAAC,kHAAkH,EAC9H,qBAAqB,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,qBAAqB,CAAC,IAAI,mBAAmB,CAAC,CAAC,CAAC,EACrH,UAAU,EAAE,KAAK,GACjB,CACE,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;AA9BD;IALC,iBAAiB,CAAuG;QACvH,IAAI,EAAE,qBAAqB;QAC3B,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;+CA+BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/scheduler-editor/nylas-reminder-time/nylas-reminder-time.scss?tag=nylas-reminder-time&encapsulation=shadow","src/components/scheduler-editor/nylas-reminder-time/nylas-reminder-time.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n @include default-css-variables;\n}\n\n.nylas-reminder-time {\n display: flex;\n flex-direction: column;\n gap: 4px;\n\n label {\n display: flex;\n align-items: center;\n color: var(--nylas-base-800);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 150%;\n\n /* 21px */\n span.required {\n color: var(--nylas-error, #cc4841);\n }\n\n span.label-icon {\n margin-left: 4px;\n\n tooltip-component {\n display: flex;\n }\n }\n }\n}\n\n.nylas-reminder-time__wrapper {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n\n input {\n padding: 12px 16px;\n border-width: 1;\n border-radius: 8px;\n border: 1px solid var(--nylas-base-200);\n font-family: var(--nylas-font-family);\n font-size: 16px;\n line-height: 24px;\n width: 48px;\n }\n\n input-dropdown::part(id_dropdown-input) {\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n padding: 14px 16px;\n width: 50px;\n }\n\n input-dropdown::part(id_dropdown-content) {\n width: 100%;\n min-width: unset;\n height: 160px;\n }\n\n select-dropdown {\n width: 120px;\n\n @media #{$mobile} {\n width: 100%;\n }\n }\n\n select-dropdown::part(sd_dropdown-button) {\n border: 1px solid var(--nylas-base-200);\n }\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { REMINDER_MINUTE_OPTIONS, REMINDER_HOUR_OPTIONS, REMINDER_DAY_OPTIONS } from '@/common/constants';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } from '@/utils/utils';\nimport { AttachInternals, Component, Host, Listen, State, h, Element, Prop, Watch, Event, EventEmitter } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\n\nfunction getInitialTimeValue(timeInMinutes: number | undefined) {\n if (!timeInMinutes) return 30;\n if (timeInMinutes >= 60 * 24) return timeInMinutes / (60 * 24);\n if (timeInMinutes >= 90 || timeInMinutes === 60) return timeInMinutes / 60;\n return timeInMinutes;\n}\n\nfunction getInitialTimeIncrement(timeInMinutes: number | undefined) {\n if (!timeInMinutes) return 30;\n if (timeInMinutes >= 60 * 24) return 60 * 24;\n if (timeInMinutes >= 90 || timeInMinutes === 60) return 60;\n return 1;\n}\n\n/**\n * The `nylas-reminder-time` component is a form input for the reminder time before an event.\n *\n * @part nrt - The event reminder container\n * @part nrt - The dropdown container for the reminder time increment\n * @part nrt__dropdown-button - The dropdown button for the reminder time increment\n * @part nrt__dropdown-content - The dropdown content for the reminder time increment\n * @part nrt__input_dropdown - The input dropdown container for the reminder time minutes\n * @part nrt__input_dropdown-input - The input for the reminder time minutes\n * @part nrt__input_dropdown-content - The dropdown content for the input reminder time minutes\n */\n@Component({\n tag: 'nylas-reminder-time',\n styleUrl: 'nylas-reminder-time.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasReminderTime {\n /**\n * The host element <nylas-reminder-time>\n */\n @Element() host!: HTMLElement;\n /**\n * The name of the reminder time. Default is 'reminder time'.\n */\n @Prop() name: string = 'reminder-time';\n /**\n * The event reminder time in minutes as set in the configuration.\n */\n @Prop() eventReminderTimeMinutes?: number;\n /**\n * The selected event reminder time state. This defaults to the reminder time from the configuration or 30 minutes.\n */\n @State() reminderTime: number = getInitialTimeValue(this.eventReminderTimeMinutes);\n /**\n * The reminder time in minutes. This defaults to the reminder time from the configuration or 30 minutes.\n */\n @State() reminderTimeMinutes: number = this.eventReminderTimeMinutes ?? 30;\n /**\n * The reminder time increment. This defaults to minute(s).\n */\n @State() reminderTimeincrement: number = getInitialTimeIncrement(this.eventReminderTimeMinutes);\n /**\n * The reminderTimeMinutesOptions for the dropdown.\n */\n @State() reminderTimeMinutesOptions = REMINDER_MINUTE_OPTIONS;\n\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\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-reminder-time', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('eventReminderTimeMinutes')\n eventReminderTimeMinutesChangedHandler(newValue: number, oldValue: number) {\n debug('nylas-reminder-time', 'eventReminderTimeMinutesChangedHandler', newValue);\n if (newValue === oldValue) {\n return;\n }\n this.reminderTime = getInitialTimeValue(newValue);\n this.reminderTimeincrement = getInitialTimeIncrement(newValue);\n this.reminderTimeMinutes = newValue;\n }\n\n @Watch('reminderTimeMinutes')\n reminderTimeMinutesChangedHandler(newValue: number, oldValue: number) {\n debug('nylas-reminder-time', 'reminderTimeMinutesChangedHandler', newValue);\n if (newValue === oldValue) {\n return;\n }\n this.valueChanged.emit({ value: newValue.toString(), name: this.name });\n }\n\n /**\n * Event emitted when the event reminder time changes.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n connectedCallback() {\n debug('nylas-reminder-time', 'connectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-reminder-time', 'componentWillLoad');\n this.host.setAttribute('name', this.name);\n this.setReminderTimeMinuteOptions();\n }\n\n componentDidLoad() {\n debug('nylas-reminder-time', 'componentDidLoad');\n }\n\n disconnectedCallback() {\n debug('nylas-reminder-time', 'disconnectedCallback');\n }\n\n setReminderTimeMinuteOptions() {\n if (this.reminderTimeincrement === 1) {\n this.reminderTimeMinutesOptions = REMINDER_MINUTE_OPTIONS;\n } else if (this.reminderTimeincrement === 60) {\n this.reminderTimeMinutesOptions = REMINDER_HOUR_OPTIONS;\n } else this.reminderTimeMinutesOptions = REMINDER_DAY_OPTIONS;\n return this.reminderTimeMinutesOptions;\n }\n\n @Listen('nylasFormDropdownChanged')\n nylasFormDropdownChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-calendar-picker', 'nylasFormDropdownChangedHandler', event.detail);\n const { value } = event.detail;\n this.reminderTimeincrement = parseInt(value);\n\n if (this.reminderTimeincrement === 1) {\n this.reminderTime = 60;\n } else {\n this.reminderTime = 1;\n }\n\n this.setReminderTimeMinuteOptions();\n this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;\n this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);\n }\n\n @Listen('inputOptionChanged')\n inputOptionChangedHandler(event: CustomEvent<{ value: number; name: string }>) {\n debug('nylas-calendar-picker', 'inputOptionChangedHandler', event.detail);\n const { value } = event.detail;\n this.reminderTime = value;\n this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;\n this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);\n }\n\n @RegisterComponent<NylasReminderTime, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-reminder-time',\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n const reminderTimeOptions = [\n { value: 1, label: 'minute' },\n { value: 60, label: 'hour' },\n { value: 60 * 24, label: 'day' },\n ];\n\n return (\n <Host>\n <div class=\"nylas-reminder-time\" part=\"nrt\">\n <div class=\"nylas-reminder-time__wrapper\">\n <input-dropdown\n name={'reminder-time'}\n options={this.reminderTimeMinutesOptions}\n inputValue={this.reminderTime.toString()}\n exportparts=\"id_dropdown: nrt__input_dropdown, id_dropdown-input: nrt__input_dropdown-input, id_dropdown-content: nrt__input_dropdown-content\"\n defaultInputOption={this.reminderTimeMinutesOptions.find(i => i.value == this.reminderTime) ?? reminderTimeOptions[0]}\n />\n <select-dropdown\n name={'reminder-time-unit'}\n options={reminderTimeOptions}\n pluralizedLabel={this.reminderTime > 1 ? 's' : ''}\n exportparts=\"sd_dropdown: nrt__dropdown, sd_dropdown-button: nrt__dropdown-button, sd_dropdown-content: nrt__dropdown-content\"\n defaultSelectedOption={reminderTimeOptions.find(i => i.value == this.reminderTimeincrement) ?? reminderTimeOptions[0]}\n withSearch={false}\n />\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
1
+ {"file":"nylas-reminder-time2.js","mappings":";;;;;;;;;AAAA,MAAM,oBAAoB,GAAG,g2DAAg2D,CAAC;AAC93D,gCAAe,oBAAoB;;;;;;;;;;;;;;;;ACMnC,MAAM,mBAAmB,GAAG;IAC1B,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE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IAAI,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,IAAI,mBAAmB,CAAC,CAAC,CAAC,GACrH,EACF,wEACE,IAAI,EAAE,oBAAoB,EAC1B,OAAO,EAAE,CAAC,GAAG,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,EACnE,eAAe,EAAE,IAAI,CAAC,YAAY,GAAG,CAAC,GAAG,GAAG,GAAG,EAAE,EACjD,WAAW,EAAC,kHAAkH,EAC9H,qBAAqB,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,qBAAqB,CAAC,IAAI,mBAAmB,CAAC,CAAC,CAAC,EACrH,UAAU,EAAE,KAAK,GACjB,CACE,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;AAxBD;IALC,iBAAiB,CAAuG;QACvH,IAAI,EAAE,qBAAqB;QAC3B,YAAY,EAAE,EAAE;QAChB,iBAAiB,EAAE,IAAI;KACxB,CAAC;;;;+CAyBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/scheduler-editor/nylas-reminder-time/nylas-reminder-time.scss?tag=nylas-reminder-time&encapsulation=shadow","src/components/scheduler-editor/nylas-reminder-time/nylas-reminder-time.tsx"],"sourcesContent":["@import '../../../common/styles/variables.scss';\n\n:host {\n display: block;\n @include default-css-variables;\n}\n\n.nylas-reminder-time {\n display: flex;\n flex-direction: column;\n gap: 4px;\n\n label {\n display: flex;\n align-items: center;\n color: var(--nylas-base-800);\n font-size: 16px;\n font-style: normal;\n font-weight: 400;\n line-height: 150%;\n\n /* 21px */\n span.required {\n color: var(--nylas-error, #cc4841);\n }\n\n span.label-icon {\n margin-left: 4px;\n\n tooltip-component {\n display: flex;\n }\n }\n }\n}\n\n.nylas-reminder-time__wrapper {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n\n input {\n padding: 12px 16px;\n border-width: 1;\n border-radius: 8px;\n border: 1px solid var(--nylas-base-200);\n font-family: var(--nylas-font-family);\n font-size: 16px;\n line-height: 24px;\n width: 48px;\n }\n\n input-dropdown::part(id_dropdown-input) {\n border: 1px solid var(--nylas-base-200);\n border-radius: var(--nylas-border-radius-2x);\n padding: 14px 16px;\n width: 50px;\n }\n\n input-dropdown::part(id_dropdown-content) {\n width: 100%;\n min-width: unset;\n height: 160px;\n }\n\n select-dropdown {\n width: 120px;\n\n @media #{$mobile} {\n width: 100%;\n }\n }\n\n select-dropdown::part(sd_dropdown-button) {\n border: 1px solid var(--nylas-base-200);\n }\n}\n","import { RegisterComponent } from '@/common/register-component';\nimport { REMINDER_MINUTE_OPTIONS, REMINDER_HOUR_OPTIONS, REMINDER_DAY_OPTIONS } from '@/common/constants';\nimport { NylasSchedulerConfigConnector } from '@/connector/nylas-scheduler-config-connector';\nimport { debug } from '@/utils/utils';\nimport { AttachInternals, Component, Host, Listen, State, h, Element, Prop, Watch, Event, EventEmitter } from '@stencil/core';\nimport { NylasSchedulerEditor } from '../nylas-scheduler-editor/nylas-scheduler-editor';\n\nconst reminderTimeOptions = [\n { value: 60 * 24, label: 'day' },\n { value: 60, label: 'hour' },\n { value: 1, label: 'minute' },\n];\n\nfunction getInitialTimeValue(timeInMinutes: number | undefined) {\n if (!timeInMinutes) return 30; // Default to 30 minutes if undefined\n\n // Loop through the reminderTimeOptions to find the appropriate division\n for (const option of reminderTimeOptions) {\n if (timeInMinutes % option.value === 0) {\n return timeInMinutes / option.value; // Return the divided value\n }\n }\n\n // If no exact division is found, return the time in minutes\n return timeInMinutes;\n}\n\nfunction getInitialTimeIncrement(timeInMinutes: number | undefined) {\n if (!timeInMinutes) return 1; // Default to minutes if undefined\n\n // Loop through the reminderTimeOptions and check divisibility\n for (const option of reminderTimeOptions) {\n if (timeInMinutes % option.value === 0) {\n return option.value;\n }\n }\n\n // If no suitable option is found, default to minutes\n return 1;\n}\n\n/**\n * The `nylas-reminder-time` component is a form input for the reminder time before an event.\n *\n * @part nrt - The event reminder container\n * @part nrt - The dropdown container for the reminder time increment\n * @part nrt__dropdown-button - The dropdown button for the reminder time increment\n * @part nrt__dropdown-content - The dropdown content for the reminder time increment\n * @part nrt__input_dropdown - The input dropdown container for the reminder time minutes\n * @part nrt__input_dropdown-input - The input for the reminder time minutes\n * @part nrt__input_dropdown-content - The dropdown content for the input reminder time minutes\n */\n@Component({\n tag: 'nylas-reminder-time',\n styleUrl: 'nylas-reminder-time.scss',\n shadow: true,\n formAssociated: true,\n})\nexport class NylasReminderTime {\n /**\n * The host element <nylas-reminder-time>\n */\n @Element() host!: HTMLElement;\n /**\n * The name of the reminder time. Default is 'reminder time'.\n */\n @Prop() name: string = 'reminder-time';\n /**\n * The event reminder time in minutes as set in the configuration.\n */\n @Prop() eventReminderTimeMinutes?: number;\n /**\n * The selected event reminder time state. This defaults to the reminder time from the configuration or 30 minutes.\n */\n @State() reminderTime: number = getInitialTimeValue(this.eventReminderTimeMinutes);\n /**\n * The reminder time in minutes. This defaults to the reminder time from the configuration or 30 minutes.\n */\n @State() reminderTimeMinutes: number = this.eventReminderTimeMinutes ?? 30;\n /**\n * The reminder time increment. This defaults to minute(s).\n */\n @State() reminderTimeincrement: number = getInitialTimeIncrement(this.eventReminderTimeMinutes);\n /**\n * The reminderTimeMinutesOptions for the dropdown.\n */\n @State() reminderTimeMinutesOptions = REMINDER_MINUTE_OPTIONS;\n\n /**\n * The element internals.\n */\n @AttachInternals() internals!: ElementInternals;\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-reminder-time', 'elementNameChangedHandler', newValue);\n this.host.setAttribute('name', newValue);\n }\n\n @Watch('reminderTimeMinutes')\n reminderTimeMinutesChangedHandler(newValue: number, oldValue: number) {\n debug('nylas-reminder-time', 'reminderTimeMinutesChangedHandler', newValue);\n if (newValue === oldValue) {\n return;\n }\n this.valueChanged.emit({ value: newValue.toString(), name: this.name });\n }\n\n /**\n * Event emitted when the event reminder time changes.\n */\n @Event() valueChanged!: EventEmitter<{\n value: string;\n name: string;\n }>;\n\n connectedCallback() {\n debug('nylas-reminder-time', 'connectedCallback');\n }\n\n componentWillLoad() {\n debug('nylas-reminder-time', 'componentWillLoad');\n this.host.setAttribute('name', this.name);\n }\n\n componentDidLoad() {\n debug('nylas-reminder-time', 'componentDidLoad');\n this.setReminderTimeMinuteOptions();\n }\n\n disconnectedCallback() {\n debug('nylas-reminder-time', 'disconnectedCallback');\n }\n\n /**\n * The unit tests in stencil does not support the internals API.\n * This method checks if the internals API is available.\n * @returns boolean\n */\n get isInternalsAvailable() {\n return this.internals !== undefined && typeof this.internals.setFormValue === 'function';\n }\n\n setReminderTimeMinuteOptions() {\n if (this.reminderTimeincrement === 1) {\n this.reminderTimeMinutesOptions = REMINDER_MINUTE_OPTIONS;\n } else if (this.reminderTimeincrement === 60) {\n this.reminderTimeMinutesOptions = REMINDER_HOUR_OPTIONS;\n } else this.reminderTimeMinutesOptions = REMINDER_DAY_OPTIONS;\n return this.reminderTimeMinutesOptions;\n }\n\n @Listen('nylasFormDropdownChanged')\n nylasFormDropdownChangedHandler(event: CustomEvent<{ value: string; name: string }>) {\n debug('nylas-calendar-picker', 'nylasFormDropdownChangedHandler', event.detail);\n const { value } = event.detail;\n this.reminderTimeincrement = parseInt(value);\n\n if (this.reminderTimeincrement === 1) {\n this.reminderTime = 60;\n } else {\n this.reminderTime = 1;\n }\n\n this.setReminderTimeMinuteOptions();\n this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;\n this.isInternalsAvailable && this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);\n }\n\n @Listen('inputOptionChanged')\n inputOptionChangedHandler(event: CustomEvent<{ value: number; name: string }>) {\n debug('nylas-calendar-picker', 'inputOptionChangedHandler', event.detail);\n const { value } = event.detail;\n this.reminderTime = value;\n this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;\n this.isInternalsAvailable && this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);\n }\n\n @RegisterComponent<NylasReminderTime, NylasSchedulerConfigConnector, Exclude<NylasSchedulerEditor['stores'], undefined>>({\n name: 'nylas-reminder-time',\n eventToProps: {},\n fireRegisterEvent: true,\n })\n render() {\n return (\n <Host>\n <div class=\"nylas-reminder-time\" part=\"nrt\">\n <div class=\"nylas-reminder-time__wrapper\">\n <input-dropdown\n name={'reminder-time'}\n options={this.reminderTimeMinutesOptions}\n inputValue={this.reminderTime.toString()}\n exportparts=\"id_dropdown: nrt__input_dropdown, id_dropdown-input: nrt__input_dropdown-input, id_dropdown-content: nrt__input_dropdown-content\"\n defaultInputOption={this.reminderTimeMinutesOptions.find(i => i.value == this.reminderTime) ?? reminderTimeOptions[0]}\n />\n <select-dropdown\n name={'reminder-time-unit'}\n options={[...reminderTimeOptions].sort((a, b) => a.value - b.value)}\n pluralizedLabel={this.reminderTime > 1 ? 's' : ''}\n exportparts=\"sd_dropdown: nrt__dropdown, sd_dropdown-button: nrt__dropdown-button, sd_dropdown-content: nrt__dropdown-content\"\n defaultSelectedOption={reminderTimeOptions.find(i => i.value == this.reminderTimeincrement) ?? reminderTimeOptions[0]}\n withSearch={false}\n />\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
@@ -421,7 +421,7 @@ const NylasAdditionalParticipants = class {
421
421
  disconnectedCallback() {
422
422
  debug('nylas-additional-participants', 'disconnectedCallback');
423
423
  }
424
- isInternalsAvailable() {
424
+ get isInternalsAvailable() {
425
425
  return this.internals !== undefined && typeof this.internals.setFormValue === 'function' && typeof this.internals.setValidity === 'function';
426
426
  }
427
427
  onInputOptionChanged(event) {
@@ -430,14 +430,14 @@ const NylasAdditionalParticipants = class {
430
430
  const index = event.detail.name;
431
431
  const participant = this.participantOptions?.find(participant => participant.email === event.detail.value);
432
432
  if (!participant && this.isRoundRobinConfig) {
433
- this.isInternalsAvailable() && this.internals.setValidity({ customError: true }, 'For round robin configuration, participant should be selected from the dropdown.');
433
+ this.isInternalsAvailable && this.internals.setValidity({ customError: true }, 'For round robin configuration, participant should be selected from the dropdown.');
434
434
  this.participantErrors[index] = 'For round robin page, participant should be selected from the dropdown.';
435
435
  this.participants[index].is_valid = false;
436
436
  this.participants = [...this.participants];
437
437
  return;
438
438
  }
439
439
  else if (!participant && !EMAIL_REGEX.test(event.detail.value)) {
440
- this.isInternalsAvailable() && this.internals.setValidity({ customError: true }, 'Please enter a valid email address');
440
+ this.isInternalsAvailable && this.internals.setValidity({ customError: true }, 'Please enter a valid email address');
441
441
  this.participantErrors[index] = 'Please enter a valid email address';
442
442
  this.participants[index].is_valid = false;
443
443
  this.participants = [...this.participants];
@@ -446,7 +446,7 @@ const NylasAdditionalParticipants = class {
446
446
  else {
447
447
  this.participantErrors[index] = '';
448
448
  this.participants[index].is_valid = true;
449
- this.isInternalsAvailable() && this.internals.setValidity({});
449
+ this.isInternalsAvailable && this.internals.setValidity({});
450
450
  }
451
451
  this.participants[index].email = event.detail.value;
452
452
  this.participants[index].availability = participant ? { calendar_ids: ['primary'] } : undefined;
@@ -489,13 +489,13 @@ const NylasAdditionalParticipants = class {
489
489
  debug('nylas-additional-participants', 'updateFormValue');
490
490
  const participants = this.isRoundRobinConfig ? (this.includeOrganizerAsParticipant ? this.participants : this.participants.filter(p => !p.is_organizer)) : this.participants;
491
491
  if (participants.length === 0) {
492
- this.isInternalsAvailable() && this.internals.setValidity({ customError: true }, 'Please add at least one participant');
492
+ this.isInternalsAvailable && this.internals.setValidity({ customError: true }, 'Please add at least one participant');
493
493
  this.error = 'Please add at least one participant';
494
494
  }
495
495
  else {
496
- this.isInternalsAvailable() && this.internals.setValidity({});
496
+ this.isInternalsAvailable && this.internals.setValidity({});
497
497
  this.error = '';
498
- this.isInternalsAvailable() && this.internals.setFormValue(JSON.stringify(participants), this.name);
498
+ this.isInternalsAvailable && this.internals.setFormValue(JSON.stringify(participants), this.name);
499
499
  this.valueChanged.emit({ value: JSON.stringify(participants), name: this.name });
500
500
  }
501
501
  }
@@ -506,7 +506,7 @@ const NylasAdditionalParticipants = class {
506
506
  });
507
507
  }
508
508
  render() {
509
- return (h(Host, { key: 'b17facebc66435c9e405b442500163b47836914e', part: "nap" }, h("nylas-form-card", { key: 'bce92f93c9f0ec0c04c000582505ea1adb1a3e22' }, h("h3", { key: '07cd5fd66a38dadfd67f67607fe81fb235cbb1f3', slot: "header-title", class: "nylas-additional-participants__title", part: "nap__title" }, "Participants"), h("p", { key: '3e9f5348444a81731228d4ce5f355b3cd6ead03f', slot: "header-subtitle", class: "nylas-additional-participants__subtitle", part: "nap__subtitle" }, "Add people in your team or organization to join the event."), h("div", { key: 'b6921a32886aaedbf9ecaa942912c2991881b380', slot: "content", class: "nylas-additional-participants__content" }, h("div", { key: '780531379643ee4764122906f144d302e0bc32e5' }, this.participants.map((participant, index) => {
509
+ return (h(Host, { key: '16a28d7d8ee91b685a22472d8a90721a5074d798', part: "nap" }, h("nylas-form-card", { key: '9fde59eadfcdf05c3b4add30a5c35f9b21d00c30' }, h("h3", { key: '82e3c3ad537ef4c60d19695f11e481bac2ed31ae', slot: "header-title", class: "nylas-additional-participants__title", part: "nap__title" }, "Participants"), h("p", { key: '4df3d661d2c6801ba8e88d82853ae562ed3be8e8', slot: "header-subtitle", class: "nylas-additional-participants__subtitle", part: "nap__subtitle" }, "Add people in your team or organization to join the event."), h("div", { key: '3ccb34354c025b52760433683812acf37b480e77', slot: "content", class: "nylas-additional-participants__content" }, h("div", { key: '007cf8396921637cf230cc26d73de147169cd250' }, this.participants.map((participant, index) => {
510
510
  return (h("div", { class: 'nylas-additional-participants__input_group', part: "nap__input_group" }, !participant.is_organizer && h("label", null, `Participant ${index}`), h("div", { part: "nap__input_wrapper", class: {
511
511
  'nylas-additional-participants__input_wrapper': true,
512
512
  'nylas-additional-participants__input_wrapper_organizer': participant?.is_organizer === true,
@@ -516,7 +516,7 @@ const NylasAdditionalParticipants = class {
516
516
  this.includeOrganizerAsParticipant = !this.includeOrganizerAsParticipant;
517
517
  this.updateFormValue();
518
518
  }, checked: this.includeOrganizerAsParticipant }), h("label", { htmlFor: `organizer_participant`, "aria-label": "Include as participant" }, "Participant", h("tooltip-component", { id: "organizer_participant_tooltip" }, h("info-icon", { slot: "tooltip-icon" }), h("span", { slot: "tooltip-content" }, h("strong", null, "Include Organizer:"), " The organizer (you) will be included in the round-robin rotation. ", h("br", null), h("strong", null, "Exclude Organizer:"), " The organizer (you) will not be included in the round-robin rotation."))))))) : (h("input-dropdown", { id: `${index}`, name: `${index}`, filterable: true, inputValue: participant.email, options: this.getArrayDifference(this.participantOptions || [], this.participants) })), !participant.is_organizer && (h("button", { onClick: () => this.removeParticipant(index), part: "nap__remove-participant" }, h("close-icon", null))))), !participant.is_valid && (h("p", { class: "nylas-additional-participants__error", part: "nap__error" }, this.participantErrors[index]))));
519
- }), h("p", { key: '9921cf9eb77303da37e64bb4b2555fe662bcb299', class: "nylas-additional-participants__error", part: "nap__error" }, this.error)), h("button", { key: '0fdc9f4d4ee5b221aaaa01de39e0fe5ad29675f1', class: "nylas-additional-participants__add", part: "nap__add-participant", onClick: () => this.addParticipant() }, h("add-circle-icon", { key: 'c1c405144661b246731d48907246b3bc9e252410' }), " ", h("span", { key: '2ccd09a3a9c148dd4e895f7c3b2ac52cce86b76b' }, "Add ", this.participants.length > 1 ? 'another' : 'a', " participant"))))));
519
+ }), h("p", { key: 'f1dd954c137093fa9e474f3886e4b5320aeb5e2e', class: "nylas-additional-participants__error", part: "nap__error" }, this.error)), h("button", { key: '859585010fc9fce314b856f5e7e07ac8b8c47b88', class: "nylas-additional-participants__add", part: "nap__add-participant", onClick: () => this.addParticipant() }, h("add-circle-icon", { key: 'aec7eb5de30e66bca29b73962f356109471c2e9e' }), " ", h("span", { key: 'f07ecfaa4db46f7954d734314c46f2d773158730' }, "Add ", this.participants.length > 1 ? 'another' : 'a', " participant"))))));
520
520
  }
521
521
  static get formAssociated() { return true; }
522
522
  get host() { return getElement(this); }
@@ -8450,22 +8450,29 @@ var __metadata$2 = (undefined && undefined.__metadata) || function (k, v) {
8450
8450
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
8451
8451
  return Reflect.metadata(k, v);
8452
8452
  };
8453
+ const reminderTimeOptions = [
8454
+ { value: 60 * 24, label: 'day' },
8455
+ { value: 60, label: 'hour' },
8456
+ { value: 1, label: 'minute' },
8457
+ ];
8453
8458
  function getInitialTimeValue(timeInMinutes) {
8454
8459
  if (!timeInMinutes)
8455
8460
  return 30;
8456
- if (timeInMinutes >= 60 * 24)
8457
- return timeInMinutes / (60 * 24);
8458
- if (timeInMinutes >= 90 || timeInMinutes === 60)
8459
- return timeInMinutes / 60;
8461
+ for (const option of reminderTimeOptions) {
8462
+ if (timeInMinutes % option.value === 0) {
8463
+ return timeInMinutes / option.value;
8464
+ }
8465
+ }
8460
8466
  return timeInMinutes;
8461
8467
  }
8462
8468
  function getInitialTimeIncrement(timeInMinutes) {
8463
8469
  if (!timeInMinutes)
8464
- return 30;
8465
- if (timeInMinutes >= 60 * 24)
8466
- return 60 * 24;
8467
- if (timeInMinutes >= 90 || timeInMinutes === 60)
8468
- return 60;
8470
+ return 1;
8471
+ for (const option of reminderTimeOptions) {
8472
+ if (timeInMinutes % option.value === 0) {
8473
+ return option.value;
8474
+ }
8475
+ }
8469
8476
  return 1;
8470
8477
  }
8471
8478
  const NylasReminderTime = class {
@@ -8490,15 +8497,6 @@ const NylasReminderTime = class {
8490
8497
  debug('nylas-reminder-time', 'elementNameChangedHandler', newValue);
8491
8498
  this.host.setAttribute('name', newValue);
8492
8499
  }
8493
- eventReminderTimeMinutesChangedHandler(newValue, oldValue) {
8494
- debug('nylas-reminder-time', 'eventReminderTimeMinutesChangedHandler', newValue);
8495
- if (newValue === oldValue) {
8496
- return;
8497
- }
8498
- this.reminderTime = getInitialTimeValue(newValue);
8499
- this.reminderTimeincrement = getInitialTimeIncrement(newValue);
8500
- this.reminderTimeMinutes = newValue;
8501
- }
8502
8500
  reminderTimeMinutesChangedHandler(newValue, oldValue) {
8503
8501
  debug('nylas-reminder-time', 'reminderTimeMinutesChangedHandler', newValue);
8504
8502
  if (newValue === oldValue) {
@@ -8512,14 +8510,17 @@ const NylasReminderTime = class {
8512
8510
  componentWillLoad() {
8513
8511
  debug('nylas-reminder-time', 'componentWillLoad');
8514
8512
  this.host.setAttribute('name', this.name);
8515
- this.setReminderTimeMinuteOptions();
8516
8513
  }
8517
8514
  componentDidLoad() {
8518
8515
  debug('nylas-reminder-time', 'componentDidLoad');
8516
+ this.setReminderTimeMinuteOptions();
8519
8517
  }
8520
8518
  disconnectedCallback() {
8521
8519
  debug('nylas-reminder-time', 'disconnectedCallback');
8522
8520
  }
8521
+ get isInternalsAvailable() {
8522
+ return this.internals !== undefined && typeof this.internals.setFormValue === 'function';
8523
+ }
8523
8524
  setReminderTimeMinuteOptions() {
8524
8525
  if (this.reminderTimeincrement === 1) {
8525
8526
  this.reminderTimeMinutesOptions = REMINDER_MINUTE_OPTIONS;
@@ -8543,28 +8544,22 @@ const NylasReminderTime = class {
8543
8544
  }
8544
8545
  this.setReminderTimeMinuteOptions();
8545
8546
  this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;
8546
- this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
8547
+ this.isInternalsAvailable && this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
8547
8548
  }
8548
8549
  inputOptionChangedHandler(event) {
8549
8550
  debug('nylas-calendar-picker', 'inputOptionChangedHandler', event.detail);
8550
8551
  const { value } = event.detail;
8551
8552
  this.reminderTime = value;
8552
8553
  this.reminderTimeMinutes = this.reminderTime * this.reminderTimeincrement;
8553
- this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
8554
+ this.isInternalsAvailable && this.internals.setFormValue(this.reminderTimeMinutes.toString(), this.name);
8554
8555
  }
8555
8556
  render() {
8556
- const reminderTimeOptions = [
8557
- { value: 1, label: 'minute' },
8558
- { value: 60, label: 'hour' },
8559
- { value: 60 * 24, label: 'day' },
8560
- ];
8561
- return (h(Host, { key: 'd5f118391bdd7e4779f6eca15335285047fdb350' }, h("div", { key: '2dd8d3ba52d4f95480c9cf1fdaf5d0f1f7c1e523', class: "nylas-reminder-time", part: "nrt" }, h("div", { key: '3799c4b266f4078e22ad78b86225ef9abdc5fa49', class: "nylas-reminder-time__wrapper" }, h("input-dropdown", { key: '004b6336c041660e1424ac44f16e82c8a5a2ca53', name: 'reminder-time', options: this.reminderTimeMinutesOptions, inputValue: this.reminderTime.toString(), exportparts: "id_dropdown: nrt__input_dropdown, id_dropdown-input: nrt__input_dropdown-input, id_dropdown-content: nrt__input_dropdown-content", defaultInputOption: this.reminderTimeMinutesOptions.find(i => i.value == this.reminderTime) ?? reminderTimeOptions[0] }), h("select-dropdown", { key: '6a42c7f4633d89dd9a94d3c2f119e151613667ec', name: 'reminder-time-unit', options: reminderTimeOptions, pluralizedLabel: this.reminderTime > 1 ? 's' : '', exportparts: "sd_dropdown: nrt__dropdown, sd_dropdown-button: nrt__dropdown-button, sd_dropdown-content: nrt__dropdown-content", defaultSelectedOption: reminderTimeOptions.find(i => i.value == this.reminderTimeincrement) ?? reminderTimeOptions[0], withSearch: false })))));
8557
+ return (h(Host, { key: 'b089eb10d76d001112d867a61889a685b8908355' }, h("div", { key: '13b8479fb822135c00ff8f97974c8269731b2a84', class: "nylas-reminder-time", part: "nrt" }, h("div", { key: '728e90c61077b1037aa285329f11a09a296b33b4', class: "nylas-reminder-time__wrapper" }, h("input-dropdown", { key: '40a22b75424d4b3b552a2dc1b60e79a8cb595032', name: 'reminder-time', options: this.reminderTimeMinutesOptions, inputValue: this.reminderTime.toString(), exportparts: "id_dropdown: nrt__input_dropdown, id_dropdown-input: nrt__input_dropdown-input, id_dropdown-content: nrt__input_dropdown-content", defaultInputOption: this.reminderTimeMinutesOptions.find(i => i.value == this.reminderTime) ?? reminderTimeOptions[0] }), h("select-dropdown", { key: '6128bb953b883be5341ba005438ab353b0016c48', name: 'reminder-time-unit', options: [...reminderTimeOptions].sort((a, b) => a.value - b.value), pluralizedLabel: this.reminderTime > 1 ? 's' : '', exportparts: "sd_dropdown: nrt__dropdown, sd_dropdown-button: nrt__dropdown-button, sd_dropdown-content: nrt__dropdown-content", defaultSelectedOption: reminderTimeOptions.find(i => i.value == this.reminderTimeincrement) ?? reminderTimeOptions[0], withSearch: false })))));
8562
8558
  }
8563
8559
  static get formAssociated() { return true; }
8564
8560
  get host() { return getElement(this); }
8565
8561
  static get watchers() { return {
8566
8562
  "name": ["elementNameChangedHandler"],
8567
- "eventReminderTimeMinutes": ["eventReminderTimeMinutesChangedHandler"],
8568
8563
  "reminderTimeMinutes": ["reminderTimeMinutesChangedHandler"]
8569
8564
  }; }
8570
8565
  };