@tylertech/forge 3.1.2 → 3.2.0

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 (32) hide show
  1. package/custom-elements.json +161 -37
  2. package/dist/lib.js +1 -1
  3. package/dist/lib.js.map +4 -4
  4. package/dist/vscode.html-custom-data.json +16 -1
  5. package/esm/calendar/calendar-adapter.d.ts +6 -6
  6. package/esm/calendar/calendar-adapter.js +45 -11
  7. package/esm/calendar/calendar-constants.d.ts +20 -0
  8. package/esm/calendar/calendar-constants.js +22 -0
  9. package/esm/calendar/calendar-core.d.ts +3 -3
  10. package/esm/calendar/calendar-core.js +5 -17
  11. package/esm/calendar/calendar-dom-utils.js +10 -4
  12. package/esm/calendar/calendar-dropdown/calendar-dropdown-constants.d.ts +2 -0
  13. package/esm/calendar/calendar.d.ts +9 -0
  14. package/esm/calendar/calendar.js +9 -0
  15. package/esm/chips/chip/chip-core.js +0 -1
  16. package/esm/date-picker/base/base-date-picker-adapter.d.ts +3 -0
  17. package/esm/date-picker/base/base-date-picker-adapter.js +56 -0
  18. package/esm/date-picker/base/base-date-picker-constants.d.ts +11 -0
  19. package/esm/date-picker/base/base-date-picker-constants.js +2 -1
  20. package/esm/date-picker/base/base-date-picker-core.d.ts +4 -1
  21. package/esm/date-picker/base/base-date-picker-core.js +12 -1
  22. package/esm/date-picker/base/base-date-picker.d.ts +5 -1
  23. package/esm/date-picker/base/base-date-picker.js +8 -0
  24. package/esm/date-range-picker/date-range-picker-adapter.js +4 -2
  25. package/esm/list/list-item/list-item-constants.d.ts +6 -0
  26. package/esm/list/list-item/list-item-constants.js +7 -2
  27. package/esm/list/list-item/list-item-core.d.ts +5 -0
  28. package/esm/list/list-item/list-item-core.js +17 -2
  29. package/esm/list/list-item/list-item.d.ts +5 -1
  30. package/esm/list/list-item/list-item.js +8 -0
  31. package/esm/list-dropdown/list-dropdown-utils.js +1 -0
  32. package/package.json +1 -1
@@ -287,7 +287,7 @@
287
287
  },
288
288
  {
289
289
  "name": "forge-calendar",
290
- "description": "\n---\n\n\n### **Events:**\n - **forge-calendar-date-select** - Event fired when a date is selected.\n- **forge-calendar-focus-change** - Event fired when the focus changes.\n- **forge-calendar-month-change** - Event fired when the month changes.\n- **forge-calendar-view-change** - Event fired when the view changes.\n\n### **Methods:**\n - **clear(): _void_** - Clears the selected date(s).\n- **deselectDate(date: _Date_): _void_** - Deselects a date.\n- **goToDate(date: _Date_, setFocus: _boolean_): _void_** - Navigates to a specific date.\n- **handleKey(evt: _KeyboardEvent_): _void_** - Handles a keyboard event.\n- **layout(): _void_** - Lays out the calendar.\n- **selectDate(date: _Date_): _void_** - Selects a date.\n- **setActiveDate(date: _Date_, setFocus: _boolean_): _boolean_** - Sets the active date.\n- **today(): _void_** - Sets the calendar to today.\n- **toggleDate(date: _Date_, force: _boolean_): _void_** - Toggles a date selection.",
290
+ "description": "\n---\n\n\n### **Events:**\n - **forge-calendar-date-select** - Event fired when a date is selected.\n- **forge-calendar-focus-change** - Event fired when the focus changes.\n- **forge-calendar-month-change** - Event fired when the month changes.\n- **forge-calendar-view-change** - Event fired when the view changes.\n\n### **Methods:**\n - **clear(): _void_** - Clears the selected date(s).\n- **deselectDate(date: _Date_): _void_** - Deselects a date.\n- **goToDate(date: _Date_, setFocus: _boolean_): _void_** - Navigates to a specific date.\n- **handleKey(evt: _KeyboardEvent_): _void_** - Handles a keyboard event.\n- **layout(): _void_** - Lays out the calendar.\n- **selectDate(date: _Date_): _void_** - Selects a date.\n- **setActiveDate(date: _Date_, setFocus: _boolean_): _boolean_** - Sets the active date.\n- **today(): _void_** - Sets the calendar to today.\n- **toggleDate(date: _Date_, force: _boolean_): _void_** - Toggles a date selection.\n\n### **Slots:**\n - **today-button-text** - Text to display in the today button.\n- **clear-button-text** - Text to display in the clear button.\n- **next-month-button-text** - Text to display in the next month button's tooltip.\n- **previous-month-button-text** - Text to display in the previous month button's tooltip.\n- **next-year-button-text** - Text to display in the next year button's tooltip.\n- **previous-year-button-text** - Text to display in the previous year button's tooltip.\n- **next-years-button-text** - Text to display in the next years button's tooltip.\n- **previous-years-button-text** - Text to display in the previous years button's tooltip.",
291
291
  "attributes": [
292
292
  {
293
293
  "name": "allow-single-date-range",
@@ -617,6 +617,11 @@
617
617
  "description": "Whether to allow an invalid date to be input. When true, the date picker will not clear out the value of the input if the date was invalid (i.e. could not be parsed).",
618
618
  "values": []
619
619
  },
620
+ {
621
+ "name": "calendar-text",
622
+ "description": "Customized strings to display in the calendar dropdown UI.",
623
+ "values": [{ "name": "DatePickerCalendarDropdownText" }]
624
+ },
620
625
  {
621
626
  "name": "disabled",
622
627
  "description": "Whether the date picker is disabled or not.",
@@ -691,6 +696,11 @@
691
696
  "description": "Whether to allow an invalid date to be input. When true, the date picker will not clear out the value of the input if the date was invalid (i.e. could not be parsed).",
692
697
  "values": []
693
698
  },
699
+ {
700
+ "name": "calendar-text",
701
+ "description": "Customized strings to display in the calendar dropdown UI.",
702
+ "values": [{ "name": "DatePickerCalendarDropdownText" }]
703
+ },
694
704
  {
695
705
  "name": "disabled",
696
706
  "description": "Whether the date picker is disabled or not.",
@@ -2899,6 +2909,11 @@
2899
2909
  "name": "noninteractive",
2900
2910
  "description": "Controls whether the list item will automatically attach itself to interactive slotted elements or not.",
2901
2911
  "values": []
2912
+ },
2913
+ {
2914
+ "name": "focus-propagation",
2915
+ "description": "Controls whether the interactive element will receive focus if a non-interactive element is clicked within the list item.",
2916
+ "values": []
2902
2917
  }
2903
2918
  ],
2904
2919
  "references": []
@@ -4,9 +4,9 @@
4
4
  * License: Apache-2.0
5
5
  */
6
6
  import { BaseAdapter, IBaseAdapter } from '../core/base';
7
- import { DayOfWeek, ICalendarDateOptions, ICalendarDayOptions, ICalendarEvent, ICalendarDateConfig } from './calendar-constants';
8
7
  import { ICalendarComponent } from './calendar';
9
- import { CalendarDirection, ICalendarMenuOption, CalendarMenuAnimationType } from './calendar-menu';
8
+ import { CalendarView, DayOfWeek, ICalendarDateConfig, ICalendarDateOptions, ICalendarDayOptions, ICalendarEvent } from './calendar-constants';
9
+ import { CalendarDirection, CalendarMenuAnimationType, ICalendarMenuOption } from './calendar-menu';
10
10
  export interface ICalendarAdapter extends IBaseAdapter {
11
11
  animateIntoSelectionMenu(options: ICalendarMenuOption[], direction: CalendarDirection, setFocus: boolean): void;
12
12
  closeMenu(): void;
@@ -54,10 +54,10 @@ export interface ICalendarAdapter extends IBaseAdapter {
54
54
  setMonthButtonPressed(value: boolean): void;
55
55
  setMultiple(value: boolean): void;
56
56
  setNextButtonDisabled(value: boolean): void;
57
- setNextButtonLabel(label: string): void;
57
+ setNextButtonLabel(view: CalendarView): void;
58
58
  setPreventFocusOnMenu(value: boolean): void;
59
59
  setPreviousButtonDisabled(value: boolean): void;
60
- setPreviousButtonLabel(label: string): void;
60
+ setPreviousButtonLabel(view: CalendarView): void;
61
61
  setRange(dates: Date[] | null): void;
62
62
  setRangeEnd(date: Date | null): void;
63
63
  setRangeStart(date: Date | null): void;
@@ -115,8 +115,8 @@ export declare class CalendarAdapter extends BaseAdapter<ICalendarComponent> imp
115
115
  removeHeader(): void;
116
116
  setNextButtonDisabled(value: boolean): void;
117
117
  setPreviousButtonDisabled(value: boolean): void;
118
- setNextButtonLabel(label: string): void;
119
- setPreviousButtonLabel(label: string): void;
118
+ setNextButtonLabel(view: CalendarView): void;
119
+ setPreviousButtonLabel(view: CalendarView): void;
120
120
  setMonthButtonPressed(value: boolean): void;
121
121
  setYearButtonPressed(value: boolean): void;
122
122
  setMonth(month: number, locale?: string): void;
@@ -3,13 +3,13 @@
3
3
  * Copyright Tyler Technologies, Inc.
4
4
  * License: Apache-2.0
5
5
  */
6
- import { getShadowElement, removeAllChildren, appendToAttribute, toggleAttribute, toggleOnAttribute } from '@tylertech/forge-core';
6
+ import { appendToAttribute, getShadowElement, removeAllChildren, toggleAttribute, toggleOnAttribute } from '@tylertech/forge-core';
7
7
  import { BaseAdapter } from '../core/base';
8
8
  import { CALENDAR_CONSTANTS } from './calendar-constants';
9
- import { splitIntoWeeks } from './calendar-utils';
10
9
  import { getAccessibleHeader, getClearButton, getDateElement, getDateId, getDateRow, getDateSpacerElement, getDayElement, getEventElement, getEventWrapperElement, getEventWrapperId, getFooter, getHeader, getMonthButtonContent, getTodayButton, getTooltip, getYearButtonContent, setTabindexOnElement } from './calendar-dom-utils';
11
10
  import { getLocalizedMonth, getLocalizedYear } from './calendar-locale-utils';
12
11
  import { CALENDAR_MENU_CONSTANTS } from './calendar-menu';
12
+ import { splitIntoWeeks } from './calendar-utils';
13
13
  export class CalendarAdapter extends BaseAdapter {
14
14
  constructor(component) {
15
15
  super(component);
@@ -136,20 +136,54 @@ export class CalendarAdapter extends BaseAdapter {
136
136
  const previousButton = this._container.querySelector(CALENDAR_CONSTANTS.selectors.PREVIOUS_BUTTON);
137
137
  previousButton?.toggleAttribute('disabled', value);
138
138
  }
139
- setNextButtonLabel(label) {
140
- const nextButton = this._container.querySelector(CALENDAR_CONSTANTS.selectors.NEXT_BUTTON);
141
- nextButton?.setAttribute('aria-label', label);
139
+ setNextButtonLabel(view) {
140
+ let label = '';
141
+ let slotName = '';
142
+ switch (view) {
143
+ case 'date':
144
+ label = CALENDAR_CONSTANTS.strings.DEFAULT_NEXT_MONTH_BUTTON_TEXT;
145
+ slotName = CALENDAR_CONSTANTS.slots.NEXT_MONTH_BUTTON_TEXT;
146
+ break;
147
+ case 'month':
148
+ label = CALENDAR_CONSTANTS.strings.DEFAULT_NEXT_YEAR_BUTTON_TEXT;
149
+ slotName = CALENDAR_CONSTANTS.slots.NEXT_YEAR_BUTTON_TEXT;
150
+ break;
151
+ case 'year':
152
+ label = CALENDAR_CONSTANTS.strings.DEFAULT_NEXT_YEARS_BUTTON_TEXT;
153
+ slotName = CALENDAR_CONSTANTS.slots.NEXT_YEARS_BUTTON_TEXT;
154
+ break;
155
+ }
142
156
  const nextTooltip = this._container.querySelector(CALENDAR_CONSTANTS.selectors.NEXT_BUTTON_TOOLTIP);
143
157
  if (nextTooltip) {
144
- nextTooltip.innerHTML = label;
158
+ const slot = document.createElement('slot');
159
+ slot.name = slotName;
160
+ slot.innerText = label;
161
+ nextTooltip.innerHTML = slot.outerHTML;
162
+ }
163
+ }
164
+ setPreviousButtonLabel(view) {
165
+ let label = '';
166
+ let slotName = '';
167
+ switch (view) {
168
+ case 'date':
169
+ label = CALENDAR_CONSTANTS.strings.DEFAULT_PREVIOUS_MONTH_BUTTON_TEXT;
170
+ slotName = CALENDAR_CONSTANTS.slots.PREVIOUS_MONTH_BUTTON_TEXT;
171
+ break;
172
+ case 'month':
173
+ label = CALENDAR_CONSTANTS.strings.DEFAULT_PREVIOUS_YEAR_BUTTON_TEXT;
174
+ slotName = CALENDAR_CONSTANTS.slots.PREVIOUS_YEAR_BUTTON_TEXT;
175
+ break;
176
+ case 'year':
177
+ label = CALENDAR_CONSTANTS.strings.DEFAULT_PREVIOUS_YEARS_BUTTON_TEXT;
178
+ slotName = CALENDAR_CONSTANTS.slots.PREVIOUS_YEARS_BUTTON_TEXT;
179
+ break;
145
180
  }
146
- }
147
- setPreviousButtonLabel(label) {
148
- const previousButton = this._container.querySelector(CALENDAR_CONSTANTS.selectors.PREVIOUS_BUTTON);
149
- previousButton?.setAttribute('aria-label', label);
150
181
  const previousTooltip = this._container.querySelector(CALENDAR_CONSTANTS.selectors.PREVIOUS_BUTTON_TOOLTIP);
151
182
  if (previousTooltip) {
152
- previousTooltip.innerHTML = label;
183
+ const slot = document.createElement('slot');
184
+ slot.name = slotName;
185
+ slot.innerText = label;
186
+ previousTooltip.innerHTML = slot.outerHTML;
153
187
  }
154
188
  }
155
189
  setMonthButtonPressed(value) {
@@ -84,6 +84,16 @@ export declare const CALENDAR_CONSTANTS: {
84
84
  TODAY_BUTTON: string;
85
85
  YEAR_BUTTON: string;
86
86
  };
87
+ slots: {
88
+ PREVIOUS_MONTH_BUTTON_TEXT: string;
89
+ NEXT_MONTH_BUTTON_TEXT: string;
90
+ PREVIOUS_YEAR_BUTTON_TEXT: string;
91
+ NEXT_YEAR_BUTTON_TEXT: string;
92
+ PREVIOUS_YEARS_BUTTON_TEXT: string;
93
+ NEXT_YEARS_BUTTON_TEXT: string;
94
+ TODAY_BUTTON_TEXT: string;
95
+ CLEAR_BUTTON_TEXT: string;
96
+ };
87
97
  parts: {
88
98
  CLEAR_BUTTON: string;
89
99
  DATE: string;
@@ -154,6 +164,16 @@ export declare const CALENDAR_CONSTANTS: {
154
164
  readonly MONTH_CHANGE: "forge-calendar-month-change";
155
165
  readonly VIEW_CHANGE: "forge-calendar-view-change";
156
166
  };
167
+ strings: {
168
+ DEFAULT_PREVIOUS_MONTH_BUTTON_TEXT: string;
169
+ DEFAULT_NEXT_MONTH_BUTTON_TEXT: string;
170
+ DEFAULT_PREVIOUS_YEAR_BUTTON_TEXT: string;
171
+ DEFAULT_NEXT_YEAR_BUTTON_TEXT: string;
172
+ DEFAULT_PREVIOUS_YEARS_BUTTON_TEXT: string;
173
+ DEFAULT_NEXT_YEARS_BUTTON_TEXT: string;
174
+ DEFAULT_TODAY_BUTTON_TEXT: string;
175
+ DEFAULT_CLEAR_BUTTON_TEXT: string;
176
+ };
157
177
  numbers: {
158
178
  DEFAULT_MAX_YEAR_OFFSET: number;
159
179
  DEFAULT_MIN_YEAR_OFFSET: number;
@@ -88,6 +88,16 @@ const ids = {
88
88
  TODAY_BUTTON: 'today-button',
89
89
  YEAR_BUTTON: 'year-button'
90
90
  };
91
+ const slots = {
92
+ PREVIOUS_MONTH_BUTTON_TEXT: 'previous-month-button-text',
93
+ NEXT_MONTH_BUTTON_TEXT: 'next-month-button-text',
94
+ PREVIOUS_YEAR_BUTTON_TEXT: 'previous-year-button-text',
95
+ NEXT_YEAR_BUTTON_TEXT: 'next-year-button-text',
96
+ PREVIOUS_YEARS_BUTTON_TEXT: 'previous-years-button-text',
97
+ NEXT_YEARS_BUTTON_TEXT: 'next-years-button-text',
98
+ TODAY_BUTTON_TEXT: 'today-button-text',
99
+ CLEAR_BUTTON_TEXT: 'clear-button-text'
100
+ };
91
101
  const weekdayParts = {
92
102
  SUNDAY: 'sunday',
93
103
  MONDAY: 'monday',
@@ -161,6 +171,16 @@ const events = {
161
171
  MONTH_CHANGE: `${elementName}-month-change`,
162
172
  VIEW_CHANGE: `${elementName}-view-change`
163
173
  };
174
+ const strings = {
175
+ DEFAULT_PREVIOUS_MONTH_BUTTON_TEXT: 'Previous month',
176
+ DEFAULT_NEXT_MONTH_BUTTON_TEXT: 'Next month',
177
+ DEFAULT_PREVIOUS_YEAR_BUTTON_TEXT: 'Previous year',
178
+ DEFAULT_NEXT_YEAR_BUTTON_TEXT: 'Next year',
179
+ DEFAULT_PREVIOUS_YEARS_BUTTON_TEXT: 'Previous years',
180
+ DEFAULT_NEXT_YEARS_BUTTON_TEXT: 'Next years',
181
+ DEFAULT_TODAY_BUTTON_TEXT: 'Today',
182
+ DEFAULT_CLEAR_BUTTON_TEXT: 'Clear'
183
+ };
164
184
  const numbers = {
165
185
  DEFAULT_MAX_YEAR_OFFSET: 50,
166
186
  DEFAULT_MIN_YEAR_OFFSET: 50,
@@ -175,9 +195,11 @@ export const CALENDAR_CONSTANTS = {
175
195
  attributes,
176
196
  classes,
177
197
  ids,
198
+ slots,
178
199
  parts,
179
200
  selectors,
180
201
  events,
202
+ strings,
181
203
  numbers
182
204
  };
183
205
  export var DayOfWeek;
@@ -3,11 +3,11 @@
3
3
  * Copyright Tyler Technologies, Inc.
4
4
  * License: Apache-2.0
5
5
  */
6
- import { CalendarEventBuilder, CalendarMode, CalendarView, DayOfWeek, CalendarDateBuilder, CalendarDayBuilder, CalendarDateSelectCallback, ICalendarEvent, CalendarTooltipBuilder } from './calendar-constants';
7
6
  import { ICalendarAdapter } from './calendar-adapter';
8
- import { DateRange } from './core/date-range';
9
- import { ICalendarBase } from './core/calendar-base';
7
+ import { CalendarDateBuilder, CalendarDateSelectCallback, CalendarDayBuilder, CalendarEventBuilder, CalendarMode, CalendarTooltipBuilder, CalendarView, DayOfWeek, ICalendarEvent } from './calendar-constants';
10
8
  import { CalendarMenuAnimationType } from './calendar-menu';
9
+ import { ICalendarBase } from './core/calendar-base';
10
+ import { DateRange } from './core/date-range';
11
11
  export interface ICalendarCore extends ICalendarBase {
12
12
  mode: CalendarMode;
13
13
  view: CalendarView;
@@ -4,12 +4,12 @@
4
4
  * License: Apache-2.0
5
5
  */
6
6
  import { isArray, isDefined, isValidDate } from '@tylertech/forge-core';
7
+ import { getLastDateOfMonth, getMonthLength, isSameDate } from '../core/utils/date-utils';
7
8
  import { CALENDAR_CONSTANTS, CalendarMonthFocus, DayOfWeek } from './calendar-constants';
8
- import { isDisabled, isSelected, getAllYearOptions, getDateRangeFromDates, getDatesFromDateRange, getDatesInRange, getEventDescriptions, getEventsOnDate, getFirstDateOfWeek, getIndexOfDate, getLastDateOfWeek, getMinAndMaxDates, getMonthDates, getMonthOptions, getMultipleFromRange, getSortedDaysOfWeek, getYearOptions, isInMonth, isToday, parseYearRange, sortDates, coerceDateFromValue, shouldHandleEvent } from './calendar-utils';
9
- import { getFirstDayOfWeekForLocale, getLocalizedMonth, getLocalizedYear, getWeekendDaysForLocale, isRtlLocale } from './calendar-locale-utils';
10
9
  import { eventIncludesDate } from './calendar-dom-utils';
10
+ import { getFirstDayOfWeekForLocale, getLocalizedMonth, getLocalizedYear, getWeekendDaysForLocale, isRtlLocale } from './calendar-locale-utils';
11
+ import { coerceDateFromValue, getAllYearOptions, getDateRangeFromDates, getDatesFromDateRange, getDatesInRange, getEventDescriptions, getEventsOnDate, getFirstDateOfWeek, getIndexOfDate, getLastDateOfWeek, getMinAndMaxDates, getMonthDates, getMonthOptions, getMultipleFromRange, getSortedDaysOfWeek, getYearOptions, isDisabled, isInMonth, isSelected, isToday, parseYearRange, shouldHandleEvent, sortDates } from './calendar-utils';
11
12
  import { DateRange } from './core/date-range';
12
- import { getLastDateOfMonth, getMonthLength, isSameDate } from '../core/utils/date-utils';
13
13
  export class CalendarCore {
14
14
  constructor(_adapter) {
15
15
  this._adapter = _adapter;
@@ -880,20 +880,8 @@ export class CalendarCore {
880
880
  * Sets the labels on the previous and next buttons appropriate for the view.
881
881
  */
882
882
  _setNavButtonLabels() {
883
- switch (this._view) {
884
- case 'date':
885
- this._adapter.setPreviousButtonLabel('Previous month');
886
- this._adapter.setNextButtonLabel('Next month');
887
- break;
888
- case 'month':
889
- this._adapter.setPreviousButtonLabel('Previous year');
890
- this._adapter.setNextButtonLabel('Next year');
891
- break;
892
- case 'year':
893
- this._adapter.setPreviousButtonLabel('Previous years');
894
- this._adapter.setNextButtonLabel('Next years');
895
- break;
896
- }
883
+ this._adapter.setPreviousButtonLabel(this._view);
884
+ this._adapter.setNextButtonLabel(this._view);
897
885
  }
898
886
  /**
899
887
  * Rebuilds all dates and resets the date grid.
@@ -168,10 +168,10 @@ export function getHeader() {
168
168
  previousButton.setAttribute('part', CALENDAR_CONSTANTS.parts.PREVIOUS_BUTTON);
169
169
  previousButton.id = CALENDAR_CONSTANTS.ids.PREVIOUS_BUTTON;
170
170
  previousButton.type = 'button';
171
- previousButton.setAttribute('aria-label', 'Previous');
172
171
  previousIcon.setAttribute('name', 'keyboard_arrow_left');
173
172
  previousTooltip.id = CALENDAR_CONSTANTS.ids.PREVIOUS_BUTTON_TOOLTIP;
174
173
  previousTooltip.setAttribute('aria-hidden', 'true');
174
+ previousTooltip.type = 'label';
175
175
  previousTooltip.innerText = 'Previous';
176
176
  previousButton.appendChild(previousTooltip);
177
177
  previousButton.appendChild(previousIcon);
@@ -181,10 +181,10 @@ export function getHeader() {
181
181
  nextButton.setAttribute('part', CALENDAR_CONSTANTS.parts.NEXT_BUTTON);
182
182
  nextButton.id = CALENDAR_CONSTANTS.ids.NEXT_BUTTON;
183
183
  nextButton.type = 'button';
184
- nextButton.setAttribute('aria-label', 'Next');
185
184
  nextIcon.setAttribute('name', 'keyboard_arrow_right');
186
185
  nextTooltip.id = CALENDAR_CONSTANTS.ids.NEXT_BUTTON_TOOLTIP;
187
186
  nextTooltip.setAttribute('aria-hidden', 'true');
187
+ nextTooltip.type = 'label';
188
188
  nextTooltip.innerText = 'Next';
189
189
  nextButton.appendChild(nextTooltip);
190
190
  nextButton.appendChild(nextIcon);
@@ -252,7 +252,10 @@ export function getClearButton() {
252
252
  clearButton.id = CALENDAR_CONSTANTS.ids.CLEAR_BUTTON;
253
253
  clearButton.setAttribute('part', CALENDAR_CONSTANTS.parts.CLEAR_BUTTON);
254
254
  clearButton.type = 'button';
255
- clearButton.innerText = 'Clear';
255
+ const slot = document.createElement('slot');
256
+ slot.name = CALENDAR_CONSTANTS.slots.CLEAR_BUTTON_TEXT;
257
+ slot.innerText = CALENDAR_CONSTANTS.strings.DEFAULT_CLEAR_BUTTON_TEXT;
258
+ clearButton.appendChild(slot);
256
259
  return clearButton;
257
260
  }
258
261
  /** Returns a today button. */
@@ -261,7 +264,10 @@ export function getTodayButton() {
261
264
  todayButton.id = CALENDAR_CONSTANTS.ids.TODAY_BUTTON;
262
265
  todayButton.setAttribute('part', CALENDAR_CONSTANTS.parts.TODAY_BUTTON);
263
266
  todayButton.type = 'button';
264
- todayButton.innerText = 'Today';
267
+ const slot = document.createElement('slot');
268
+ slot.name = CALENDAR_CONSTANTS.slots.TODAY_BUTTON_TEXT;
269
+ slot.innerText = CALENDAR_CONSTANTS.strings.DEFAULT_TODAY_BUTTON_TEXT;
270
+ todayButton.appendChild(slot);
265
271
  return todayButton;
266
272
  }
267
273
  /** Checks whether an event originated from a date element, returning the element if it did. */
@@ -3,10 +3,12 @@
3
3
  * Copyright Tyler Technologies, Inc.
4
4
  * License: Apache-2.0
5
5
  */
6
+ import { IDatePickerCalendarDropdownText } from '../../date-picker/base/base-date-picker-constants';
6
7
  export interface ICalendarDropdownPopupConfig {
7
8
  activeChangeCallback?: (id: string) => void;
8
9
  closeCallback?: () => void;
9
10
  popupClasses?: string | string[] | null;
11
+ calendarText?: IDatePickerCalendarDropdownText;
10
12
  }
11
13
  export declare const CALENDAR_DROPDOWN_CONSTANTS: {
12
14
  classes: {
@@ -108,6 +108,15 @@ declare global {
108
108
  * @fires {CustomEvent<ICalendarFocusChangeEventData>} forge-calendar-focus-change - Event fired when the focus changes.
109
109
  * @fires {CustomEvent<ICalendarMonthChangeEventData>} forge-calendar-month-change - Event fired when the month changes.
110
110
  * @fires {CustomEvent<CalendarView>} forge-calendar-view-change - Event fired when the view changes.
111
+ *
112
+ * @slot today-button-text - Text to display in the today button.
113
+ * @slot clear-button-text - Text to display in the clear button.
114
+ * @slot next-month-button-text - Text to display in the next month button's tooltip.
115
+ * @slot previous-month-button-text - Text to display in the previous month button's tooltip.
116
+ * @slot next-year-button-text - Text to display in the next year button's tooltip.
117
+ * @slot previous-year-button-text - Text to display in the previous year button's tooltip.
118
+ * @slot next-years-button-text - Text to display in the next years button's tooltip.
119
+ * @slot previous-years-button-text - Text to display in the previous years button's tooltip.
111
120
  */
112
121
  export declare class CalendarComponent extends BaseComponent implements ICalendarComponent {
113
122
  static get observedAttributes(): string[];
@@ -86,6 +86,15 @@ const styles = '.forge-calendar{width:var(--forge-calendar-width,100%);height:fi
86
86
  * @fires {CustomEvent<ICalendarFocusChangeEventData>} forge-calendar-focus-change - Event fired when the focus changes.
87
87
  * @fires {CustomEvent<ICalendarMonthChangeEventData>} forge-calendar-month-change - Event fired when the month changes.
88
88
  * @fires {CustomEvent<CalendarView>} forge-calendar-view-change - Event fired when the view changes.
89
+ *
90
+ * @slot today-button-text - Text to display in the today button.
91
+ * @slot clear-button-text - Text to display in the clear button.
92
+ * @slot next-month-button-text - Text to display in the next month button's tooltip.
93
+ * @slot previous-month-button-text - Text to display in the previous month button's tooltip.
94
+ * @slot next-year-button-text - Text to display in the next year button's tooltip.
95
+ * @slot previous-year-button-text - Text to display in the previous year button's tooltip.
96
+ * @slot next-years-button-text - Text to display in the next years button's tooltip.
97
+ * @slot previous-years-button-text - Text to display in the previous years button's tooltip.
89
98
  */
90
99
  let CalendarComponent = class CalendarComponent extends BaseComponent {
91
100
  static get observedAttributes() {
@@ -183,7 +183,6 @@ export class ChipCore {
183
183
  set value(value) {
184
184
  if (this._value !== value) {
185
185
  this._value = value;
186
- this._adapter.setHostAttribute(CHIP_CONSTANTS.attributes.VALUE, String(this._value));
187
186
  }
188
187
  }
189
188
  get selected() {
@@ -7,6 +7,7 @@ import { DateRange, DayOfWeek, ICalendarComponent } from '../../calendar';
7
7
  import { ICalendarDropdown, ICalendarDropdownPopupConfig } from '../../calendar/calendar-dropdown';
8
8
  import { BaseAdapter, IBaseAdapter, IDateInputMaskOptions } from '../../core';
9
9
  import { BaseComponent } from '../../core/base/base-component';
10
+ import { IDatePickerCalendarDropdownText } from './base-date-picker-constants';
10
11
  export interface IBaseDatePickerAdapter extends IBaseAdapter {
11
12
  initialize(): void;
12
13
  initializeAccessibility(): void;
@@ -45,6 +46,7 @@ export interface IBaseDatePickerAdapter extends IBaseAdapter {
45
46
  getCalendarActiveDate(): Date | undefined;
46
47
  setCalendarYearRange(value: string): void;
47
48
  setCalendarLocale(locale: string | undefined): void;
49
+ setCalendarText(text: IDatePickerCalendarDropdownText): void;
48
50
  propagateCalendarKey(evt: KeyboardEvent): void;
49
51
  }
50
52
  export declare abstract class BaseDatePickerAdapter<T extends BaseComponent> extends BaseAdapter<T> implements IBaseDatePickerAdapter {
@@ -93,6 +95,7 @@ export declare abstract class BaseDatePickerAdapter<T extends BaseComponent> ext
93
95
  getCalendarActiveDate(): Date | undefined;
94
96
  setCalendarYearRange(value: string): void;
95
97
  setCalendarLocale(locale: string | undefined): void;
98
+ setCalendarText(text: IDatePickerCalendarDropdownText): void;
96
99
  propagateCalendarKey(evt: KeyboardEvent): void;
97
100
  tryCreateToggle(): void;
98
101
  protected _createToggleElement(): HTMLElement;
@@ -4,6 +4,7 @@
4
4
  * License: Apache-2.0
5
5
  */
6
6
  import { randomChars } from '@tylertech/forge-core';
7
+ import { CALENDAR_CONSTANTS } from '../../calendar';
7
8
  import { BaseAdapter } from '../../core';
8
9
  import { ICON_BUTTON_CONSTANTS } from '../../icon-button';
9
10
  import { TEXT_FIELD_CONSTANTS } from '../../text-field';
@@ -43,6 +44,7 @@ export class BaseDatePickerAdapter extends BaseAdapter {
43
44
  this._calendarDropdown.open(calendarConfig);
44
45
  this._calendarDropdown.dropdownElement?.style.setProperty('--forge-calendar-width', '320px');
45
46
  this._calendarDropdown.calendar?.style.setProperty('margin', '8px');
47
+ this.setCalendarText(dropdownConfig?.calendarText || {});
46
48
  }
47
49
  detachCalendar() {
48
50
  if (this._calendarDropdown && this._calendarDropdown.isOpen) {
@@ -104,6 +106,60 @@ export class BaseDatePickerAdapter extends BaseAdapter {
104
106
  this._calendarDropdown.locale = locale;
105
107
  }
106
108
  }
109
+ setCalendarText(text) {
110
+ const calendar = this._calendarDropdown?.calendar;
111
+ if (!calendar) {
112
+ return;
113
+ }
114
+ if (text.today) {
115
+ const el = document.createElement('span');
116
+ el.slot = CALENDAR_CONSTANTS.slots.TODAY_BUTTON_TEXT;
117
+ el.textContent = text.today;
118
+ calendar.append(el);
119
+ }
120
+ if (text.clear) {
121
+ const el = document.createElement('span');
122
+ el.slot = CALENDAR_CONSTANTS.slots.CLEAR_BUTTON_TEXT;
123
+ el.textContent = text.clear;
124
+ calendar.append(el);
125
+ }
126
+ if (text.nextMonth) {
127
+ const el = document.createElement('span');
128
+ el.slot = CALENDAR_CONSTANTS.slots.NEXT_MONTH_BUTTON_TEXT;
129
+ el.textContent = text.nextMonth;
130
+ calendar.append(el);
131
+ }
132
+ if (text.previousMonth) {
133
+ const el = document.createElement('span');
134
+ el.slot = CALENDAR_CONSTANTS.slots.PREVIOUS_MONTH_BUTTON_TEXT;
135
+ el.textContent = text.previousMonth;
136
+ calendar.append(el);
137
+ }
138
+ if (text.nextYear) {
139
+ const el = document.createElement('span');
140
+ el.slot = CALENDAR_CONSTANTS.slots.NEXT_YEAR_BUTTON_TEXT;
141
+ el.textContent = text.nextYear;
142
+ calendar.append(el);
143
+ }
144
+ if (text.previousYear) {
145
+ const el = document.createElement('span');
146
+ el.slot = CALENDAR_CONSTANTS.slots.PREVIOUS_YEAR_BUTTON_TEXT;
147
+ el.textContent = text.previousYear;
148
+ calendar.append(el);
149
+ }
150
+ if (text.nextYears) {
151
+ const el = document.createElement('span');
152
+ el.slot = CALENDAR_CONSTANTS.slots.NEXT_YEARS_BUTTON_TEXT;
153
+ el.textContent = text.nextYears;
154
+ calendar.append(el);
155
+ }
156
+ if (text.previousYears) {
157
+ const el = document.createElement('span');
158
+ el.slot = CALENDAR_CONSTANTS.slots.PREVIOUS_YEARS_BUTTON_TEXT;
159
+ el.textContent = text.previousYears;
160
+ calendar.append(el);
161
+ }
162
+ }
107
163
  propagateCalendarKey(evt) {
108
164
  this._calendarDropdown?.calendar?.handleKey(evt);
109
165
  }
@@ -25,6 +25,16 @@ export interface IDatePickerCalendarDropdownConfig<T> {
25
25
  clearCallback: () => void;
26
26
  disabledDaysOfWeek?: DayOfWeek[] | null;
27
27
  }
28
+ export interface IDatePickerCalendarDropdownText {
29
+ today?: string;
30
+ clear?: string;
31
+ previousMonth?: string;
32
+ nextMonth?: string;
33
+ previousYear?: string;
34
+ nextYear?: string;
35
+ previousYears?: string;
36
+ nextYears?: string;
37
+ }
28
38
  export declare const BASE_DATE_PICKER_CONSTANTS: {
29
39
  observedAttributes: {
30
40
  MIN: string;
@@ -42,6 +52,7 @@ export declare const BASE_DATE_PICKER_CONSTANTS: {
42
52
  DISABLED_DAYS_OF_WEEK: string;
43
53
  YEAR_RANGE: string;
44
54
  LOCALE: string;
55
+ CALENDAR_TEXT: string;
45
56
  };
46
57
  attributes: {
47
58
  TOGGLE: string;
@@ -18,7 +18,8 @@ const observedAttributes = {
18
18
  SHOW_CLEAR: 'show-clear',
19
19
  DISABLED_DAYS_OF_WEEK: 'disabled-days-of-week',
20
20
  YEAR_RANGE: 'year-range',
21
- LOCALE: 'locale'
21
+ LOCALE: 'locale',
22
+ CALENDAR_TEXT: 'calendar-text'
22
23
  };
23
24
  const attributes = {
24
25
  TOGGLE: 'forge-date-picker-toggle'
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { CalendarMode, DayOfWeek, ICalendarDateSelectEventData } from '../../calendar/calendar-constants';
7
7
  import { IBaseDatePickerAdapter } from './base-date-picker-adapter';
8
- import { DatePickerFormatCallback, DatePickerParseCallback, DatePickerPrepareMaskCallback, DatePickerValueMode } from './base-date-picker-constants';
8
+ import { DatePickerFormatCallback, DatePickerParseCallback, DatePickerPrepareMaskCallback, DatePickerValueMode, IDatePickerCalendarDropdownText } from './base-date-picker-constants';
9
9
  export interface IBaseDatePickerCore<TValue> {
10
10
  value: TValue | null | undefined;
11
11
  min: Date | string | null | undefined;
@@ -53,6 +53,7 @@ export declare abstract class BaseDatePickerCore<TAdapter extends IBaseDatePicke
53
53
  protected _disabledDaysOfWeek: DayOfWeek[];
54
54
  protected _yearRange: string;
55
55
  protected _locale: string | undefined;
56
+ protected _calendarText: IDatePickerCalendarDropdownText;
56
57
  protected _isInitialized: boolean;
57
58
  private _inputListener;
58
59
  private _inputKeydownListener;
@@ -154,4 +155,6 @@ export declare abstract class BaseDatePickerCore<TAdapter extends IBaseDatePicke
154
155
  set yearRange(value: string);
155
156
  get locale(): string | undefined;
156
157
  set locale(value: string | undefined);
158
+ get calendarText(): IDatePickerCalendarDropdownText;
159
+ set calendarText(value: IDatePickerCalendarDropdownText);
157
160
  }
@@ -26,6 +26,7 @@ export class BaseDatePickerCore {
26
26
  this._showToday = false;
27
27
  this._showClear = false;
28
28
  this._yearRange = '-50:+50';
29
+ this._calendarText = {};
29
30
  this._isInitialized = false;
30
31
  this._inputListener = evt => this._onInput(evt);
31
32
  this._inputKeydownListener = evt => this._onInputKeydown(evt);
@@ -131,7 +132,8 @@ export class BaseDatePickerCore {
131
132
  const dropdownConfig = {
132
133
  popupClasses: this._popupClasses,
133
134
  closeCallback: this._dropdownCloseListener,
134
- activeChangeCallback: this._activeChangeListener
135
+ activeChangeCallback: this._activeChangeListener,
136
+ calendarText: this._calendarText
135
137
  };
136
138
  // If the max date is in the past, set the calendar to the min date
137
139
  const currentDate = new Date().getTime();
@@ -633,4 +635,13 @@ export class BaseDatePickerCore {
633
635
  }
634
636
  }
635
637
  }
638
+ get calendarText() {
639
+ return { ...this._calendarText };
640
+ }
641
+ set calendarText(value) {
642
+ if (JSON.stringify(this._calendarText) !== JSON.stringify(value)) {
643
+ this._calendarText = { ...value };
644
+ this._adapter.setCalendarText(this._calendarText);
645
+ }
646
+ }
636
647
  }
@@ -5,7 +5,7 @@
5
5
  */
6
6
  import { DayOfWeek } from '../../calendar/calendar-constants';
7
7
  import { BaseComponent, IBaseComponent } from '../../core/base/base-component';
8
- import { DatePickerFormatCallback, DatePickerParseCallback, DatePickerPrepareMaskCallback, DatePickerValueMode } from './base-date-picker-constants';
8
+ import { DatePickerFormatCallback, DatePickerParseCallback, DatePickerPrepareMaskCallback, DatePickerValueMode, IDatePickerCalendarDropdownText } from './base-date-picker-constants';
9
9
  import { BaseDatePickerCore } from './base-date-picker-core';
10
10
  import { IBaseDatePickerAdapter } from './base-date-picker-adapter';
11
11
  export interface IBaseDatePickerComponent<TValue> extends IBaseComponent {
@@ -31,9 +31,11 @@ export interface IBaseDatePickerComponent<TValue> extends IBaseComponent {
31
31
  disabledDaysOfWeek: DayOfWeek[];
32
32
  yearRange: string;
33
33
  locale: string | undefined;
34
+ calendarText: IDatePickerCalendarDropdownText;
34
35
  }
35
36
  /**
36
37
  * @property {boolean} [allowInvalidDate=false] - Whether to allow an invalid date to be input. When true, the date picker will not clear out the value of the input if the date was invalid (i.e. could not be parsed).
38
+ * @property {DatePickerCalendarDropdownText} calendarText - Customized strings to display in the calendar dropdown UI.
37
39
  * @property {boolean} [disabled=false] - Whether the date picker is disabled or not.
38
40
  * @property {(date: Date) => boolean} disableDayCallback - The callback to use for testing whether a specific date should be disabled or not.
39
41
  * @property {Date | Date[] | null | undefined} disabledDates - The dates that are restricted from being selected.
@@ -57,6 +59,7 @@ export interface IBaseDatePickerComponent<TValue> extends IBaseComponent {
57
59
  * @property {string} yearRange - The year range.
58
60
  *
59
61
  * @attribute {boolean} [allow-invalid-date=false] - Whether to allow an invalid date to be input. When true, the date picker will not clear out the value of the input if the date was invalid (i.e. could not be parsed).
62
+ * @attribute {DatePickerCalendarDropdownText} [calendar-text] - Customized strings to display in the calendar dropdown UI.
60
63
  * @attribute {boolean} [disabled=false] - Whether the date picker is disabled or not.
61
64
  * @attribute {string} [disabled-days-of-week] - The days of the week to disable from selection.
62
65
  * @attribute {string} [locale] - The locale to use.
@@ -100,4 +103,5 @@ export declare abstract class BaseDatePickerComponent<TPublicValue, TPrivateValu
100
103
  disableDayCallback: (date: Date) => boolean;
101
104
  yearRange: string;
102
105
  locale: string | undefined;
106
+ calendarText: IDatePickerCalendarDropdownText;
103
107
  }