@ukic/canary-web-components 2.0.0-canary.37 → 2.0.0-canary.39

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 (95) hide show
  1. package/dist/cjs/core.cjs.js +1 -1
  2. package/dist/cjs/ic-data-table.cjs.entry.js +6 -2
  3. package/dist/cjs/ic-data-table.cjs.entry.js.map +1 -1
  4. package/dist/cjs/ic-date-picker.cjs.entry.js +110 -57
  5. package/dist/cjs/ic-date-picker.cjs.entry.js.map +1 -1
  6. package/dist/cjs/ic-navigation-group.cjs.entry.js +9 -0
  7. package/dist/cjs/ic-navigation-group.cjs.entry.js.map +1 -1
  8. package/dist/cjs/ic-radio-option.cjs.entry.js +1 -1
  9. package/dist/cjs/ic-radio-option.cjs.entry.js.map +1 -1
  10. package/dist/cjs/ic-tree-item.cjs.entry.js +1 -1
  11. package/dist/cjs/ic-tree-item.cjs.entry.js.map +1 -1
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/collection/components/ic-card-horizontal/ic-card-horizontal.stories.js +605 -0
  14. package/dist/collection/components/ic-card-horizontal/ic-card-horizontal.stories.js.map +1 -0
  15. package/dist/collection/components/ic-data-table/ic-data-table.js +6 -2
  16. package/dist/collection/components/ic-data-table/ic-data-table.js.map +1 -1
  17. package/dist/collection/components/ic-data-table/ic-data-table.stories.js +414 -0
  18. package/dist/collection/components/ic-data-table/ic-data-table.stories.js.map +1 -0
  19. package/dist/collection/components/ic-data-table/story-data.js +155 -0
  20. package/dist/collection/components/ic-data-table/story-data.js.map +1 -1
  21. package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.stories.js +98 -0
  22. package/dist/collection/components/ic-data-table-title-bar/ic-data-table-title-bar.stories.js.map +1 -0
  23. package/dist/collection/components/ic-date-input/ic-date-input.stories.js +341 -0
  24. package/dist/collection/components/ic-date-input/ic-date-input.stories.js.map +1 -0
  25. package/dist/collection/components/ic-date-picker/ic-date-picker.css +10 -3
  26. package/dist/collection/components/ic-date-picker/ic-date-picker.js +152 -57
  27. package/dist/collection/components/ic-date-picker/ic-date-picker.js.map +1 -1
  28. package/dist/collection/components/ic-date-picker/ic-date-picker.stories.js +167 -0
  29. package/dist/collection/components/ic-date-picker/ic-date-picker.stories.js.map +1 -0
  30. package/dist/collection/components/ic-date-picker/story-data.js +34 -3
  31. package/dist/collection/components/ic-date-picker/story-data.js.map +1 -1
  32. package/dist/collection/components/ic-pagination-bar/ic-pagination-bar.stories.js +260 -0
  33. package/dist/collection/components/ic-pagination-bar/ic-pagination-bar.stories.js.map +1 -0
  34. package/dist/collection/components/ic-select-with-multi/ic-select-multi.stories.js +144 -0
  35. package/dist/collection/components/ic-select-with-multi/ic-select-multi.stories.js.map +1 -0
  36. package/dist/collection/components/ic-tree-item/ic-tree-item.css +22 -3
  37. package/dist/collection/components/ic-tree-view/ic-tree-view.stories.js +456 -0
  38. package/dist/collection/components/ic-tree-view/ic-tree-view.stories.js.map +1 -0
  39. package/dist/components/ic-data-table.js +6 -2
  40. package/dist/components/ic-data-table.js.map +1 -1
  41. package/dist/components/ic-date-picker.js +112 -57
  42. package/dist/components/ic-date-picker.js.map +1 -1
  43. package/dist/components/ic-navigation-group.js +11 -2
  44. package/dist/components/ic-navigation-group.js.map +1 -1
  45. package/dist/components/ic-radio-option.js +1 -1
  46. package/dist/components/ic-radio-option.js.map +1 -1
  47. package/dist/components/ic-tree-item.js +1 -1
  48. package/dist/components/ic-tree-item.js.map +1 -1
  49. package/dist/core/core.esm.js +1 -1
  50. package/dist/core/core.esm.js.map +1 -1
  51. package/dist/core/p-04fe848d.entry.js +2 -0
  52. package/dist/core/p-04fe848d.entry.js.map +1 -0
  53. package/dist/core/{p-b4f824a6.entry.js → p-3ebd4703.entry.js} +2 -2
  54. package/dist/core/p-3ebd4703.entry.js.map +1 -0
  55. package/dist/core/p-bd0328f3.entry.js +2 -0
  56. package/dist/core/p-bd0328f3.entry.js.map +1 -0
  57. package/dist/core/p-cc0e0b46.entry.js +2 -0
  58. package/dist/core/p-cc0e0b46.entry.js.map +1 -0
  59. package/dist/core/p-fac387e8.entry.js +2 -0
  60. package/dist/core/p-fac387e8.entry.js.map +1 -0
  61. package/dist/esm/core.js +1 -1
  62. package/dist/esm/ic-data-table.entry.js +6 -2
  63. package/dist/esm/ic-data-table.entry.js.map +1 -1
  64. package/dist/esm/ic-date-picker.entry.js +110 -57
  65. package/dist/esm/ic-date-picker.entry.js.map +1 -1
  66. package/dist/esm/ic-navigation-group.entry.js +10 -1
  67. package/dist/esm/ic-navigation-group.entry.js.map +1 -1
  68. package/dist/esm/ic-radio-option.entry.js +1 -1
  69. package/dist/esm/ic-radio-option.entry.js.map +1 -1
  70. package/dist/esm/ic-tree-item.entry.js +1 -1
  71. package/dist/esm/ic-tree-item.entry.js.map +1 -1
  72. package/dist/esm/loader.js +1 -1
  73. package/dist/types/components/ic-card-horizontal/ic-card-horizontal.stories.d.ts +82 -0
  74. package/dist/types/components/ic-data-table/ic-data-table.stories.d.ts +239 -0
  75. package/dist/types/components/ic-data-table/story-data.d.ts +57 -0
  76. package/dist/types/components/ic-data-table-title-bar/ic-data-table-title-bar.stories.d.ts +47 -0
  77. package/dist/types/components/ic-date-input/ic-date-input.stories.d.ts +124 -0
  78. package/dist/types/components/ic-date-picker/ic-date-picker.d.ts +18 -1
  79. package/dist/types/components/ic-date-picker/ic-date-picker.stories.d.ts +153 -0
  80. package/dist/types/components/ic-date-picker/story-data.d.ts +2 -0
  81. package/dist/types/components/ic-pagination-bar/ic-pagination-bar.stories.d.ts +106 -0
  82. package/dist/types/components/ic-select-with-multi/ic-select-multi.stories.d.ts +106 -0
  83. package/dist/types/components/ic-tree-view/ic-tree-view.stories.d.ts +99 -0
  84. package/dist/types/components.d.ts +13 -0
  85. package/hydrate/index.js +129 -62
  86. package/package.json +12 -12
  87. package/dist/core/p-4084bce2.entry.js +0 -2
  88. package/dist/core/p-4084bce2.entry.js.map +0 -1
  89. package/dist/core/p-71bbb583.entry.js +0 -2
  90. package/dist/core/p-71bbb583.entry.js.map +0 -1
  91. package/dist/core/p-89112e37.entry.js +0 -2
  92. package/dist/core/p-89112e37.entry.js.map +0 -1
  93. package/dist/core/p-b4f824a6.entry.js.map +0 -1
  94. package/dist/core/p-fe105ed0.entry.js +0 -2
  95. package/dist/core/p-fe105ed0.entry.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import { Host, h, } from "@stencil/core";
2
2
  import { createDate, clampDate, dateMatches, dateInRange, getMonthStart, getMonthEnd, getWeekEnd, getWeekStart, yearInRange, } from "../../utils/date-helpers";
3
3
  import { stringEnumToArray, onComponentRequiredPropUndefined, removeDisabledFalse, } from "../../utils/helpers";
4
- import { IcWeekDays, IcShortDayNames, IcDateInputMonths, } from "../../utils/types";
4
+ import { IcDateInputMonths, IcDayNames, IcShortDayNames, IcWeekDays, } from "../../utils/types";
5
5
  import chevron from "../../assets/chevron-icon.svg";
6
6
  import { DayButton } from "./ic-day-button";
7
7
  import { MonthPicker } from "./ic-month-picker";
@@ -41,12 +41,30 @@ export class DatePicker {
41
41
  this.decadeStart = decadeArr[1];
42
42
  this.decadeEnd = decadeArr[10];
43
43
  };
44
+ this.notifyScreenReaderSelectedDate = () => {
45
+ const dayNames = stringEnumToArray(IcDayNames);
46
+ const months = stringEnumToArray(IcDateInputMonths);
47
+ this.selectedDateInfoEl.textContent = this.selectedDate
48
+ ? `Selected date: ${dayNames[this.selectedDate.getDay()]}, ${this.selectedDate.getDate()} ${months[this.selectedDate.getMonth()]} ${this.selectedDate.getFullYear()}`
49
+ : "Selected date cleared";
50
+ };
44
51
  this.setSelectedDate = (d, emit = true) => {
45
52
  if (d === null || !dateMatches(d, this.selectedDate)) {
46
53
  this.selectedDate = d;
47
54
  this.value = d;
48
55
  if (emit) {
49
- this.inputEl.triggerIcChange(d);
56
+ if (this.inputEl) {
57
+ this.inputEl.triggerIcChange(d);
58
+ }
59
+ else {
60
+ if (this.selectedDate) {
61
+ this.setFocussedDate(this.selectedDate);
62
+ }
63
+ this.icSelectedDateChange.emit({ value: d });
64
+ if (!this.showDateInput && this.selectedDateInfoEl) {
65
+ this.notifyScreenReaderSelectedDate();
66
+ }
67
+ }
50
68
  }
51
69
  }
52
70
  };
@@ -61,13 +79,17 @@ export class DatePicker {
61
79
  event.stopImmediatePropagation();
62
80
  };
63
81
  this.handleDocumentClick = () => {
64
- this.calendarOpen = false;
82
+ if (this.showDateInput) {
83
+ this.calendarOpen = false;
84
+ }
65
85
  };
66
86
  this.keyDownHandler = (event) => {
67
87
  if (event.key === "Escape") {
68
88
  if (this.calendarOpen) {
69
89
  this.closeButtonClickHandler();
70
- this.inputEl.setCalendarFocus();
90
+ if (this.inputEl) {
91
+ this.inputEl.setCalendarFocus();
92
+ }
71
93
  event.stopImmediatePropagation();
72
94
  }
73
95
  }
@@ -77,7 +99,9 @@ export class DatePicker {
77
99
  }
78
100
  };
79
101
  this.closeButtonClickHandler = () => {
80
- this.calendarOpen = false;
102
+ if (this.showDateInput) {
103
+ this.calendarOpen = false;
104
+ }
81
105
  };
82
106
  this.focusFirstElement = () => {
83
107
  this.monthButtonEl.setFocus();
@@ -287,8 +311,12 @@ export class DatePicker {
287
311
  };
288
312
  this.handleSelectDay = (day) => {
289
313
  this.setSelectedDate(day);
290
- this.calendarOpen = false;
291
- this.inputEl.setCalendarFocus();
314
+ if (this.showDateInput) {
315
+ this.calendarOpen = false;
316
+ if (this.inputEl) {
317
+ this.inputEl.setCalendarFocus();
318
+ }
319
+ }
292
320
  };
293
321
  this.handleSelectMonth = (month) => {
294
322
  this.moveMonths(month - this.monthInView);
@@ -705,6 +733,60 @@ export class DatePicker {
705
733
  }
706
734
  return inputProps;
707
735
  };
736
+ this.renderHiddenInput = () => !this.showDateInput ? (h("span", { id: this.selectedDateInfoId, class: "sr-only", "aria-live": "polite" }, h("span", { ref: (el) => (this.selectedDateInfoEl = el), role: "status" }))) : ("");
737
+ this.renderCalendar = () => {
738
+ const { monthNames, size, focussedMonth, focussedYear, monthInView, yearInView, monthPickerVisible, yearPickerVisible, orderedDaysOfWeek, decadeView, minDate, maxDate, showPickerClearButton, showPickerTodayButton, dialogDescription, } = this;
739
+ let monthButtonText = "";
740
+ if (monthPickerVisible) {
741
+ monthButtonText = `Use the arrow keys to change the selected month. To return to day picker view, press Enter or Space to select a month, or press Escape.`;
742
+ }
743
+ else {
744
+ monthButtonText = `Press Enter or Space to open month picker view or use the arrow keys to change month.`;
745
+ }
746
+ let yearButtonText = "";
747
+ if (yearPickerVisible) {
748
+ yearButtonText = `Use the arrow keys to change the selected year. To return to day picker view, press Enter or Space to select a year, or press Escape.`;
749
+ }
750
+ else {
751
+ yearButtonText = `Press Enter or Space to open year picker view or use the arrow keys to change the selected year.`;
752
+ }
753
+ const dialogLabel = "choose date";
754
+ const monthLabel = monthNames && monthNames[monthInView]
755
+ ? monthNames[monthInView]
756
+ : "Open month picker";
757
+ const yearLabel = this.yearInView ? this.yearInView : "Open year picker";
758
+ let minDay = minDate;
759
+ if (this.disablePast) {
760
+ const yesterday = new Date(minDate);
761
+ yesterday.setDate(minDate.getDate() - 1);
762
+ minDay = yesterday;
763
+ }
764
+ return (h("div", null, h("span", { id: "dialog-description", class: "sr-only" }, dialogDescription), h("div", { role: "dialog", "aria-modal": "true", "aria-label": dialogLabel, "aria-describedBy": "dialog-description", class: {
765
+ "calendar-container": true,
766
+ "show-date-input": this.showDateInput,
767
+ "hide-date-input": !this.showDateInput,
768
+ above: this.showPickerAbove,
769
+ }, onMouseDown: this.handleCalendarMouseDown, onClick: this.handleCalendarClick }, h("span", { ref: (el) => (this.liveRegionEl = el), id: "live-region", "aria-live": "assertive", class: "sr-only" }), h("div", { class: {
770
+ "month-year-nav-container": true,
771
+ } }, h("div", { class: "month-year-nav" }, this.previousMonthButton(), h("span", { id: "select-month-hint", "aria-hidden": "true" }, monthButtonText), h("ic-button", { ref: (el) => (this.monthButtonEl = el), size: size, class: "month-picker-button", "aria-haspopup": "menu", "aria-expanded": monthPickerVisible ? "true" : "false", "full-width": "true", variant: "tertiary", "aria-label": monthLabel, "aria-describedby": "select-month-hint", onKeyDown: this.monthButtonKeyDownHandler, onClick: this.monthButtonClickHandler }, monthNames[monthInView]), this.nextMonthButton()), h("div", { class: "month-year-nav" }, this.previousYearButton(), h("span", { id: "select-year-hint", "aria-hidden": "true" }, yearButtonText), h("ic-button", { ref: (el) => (this.yearButtonEl = el), size: size, class: "year-picker-button", "aria-haspopup": "menu", "aria-expanded": yearPickerVisible ? "true" : "false", "full-width": "true", variant: "tertiary", "aria-label": yearLabel, "aria-describedby": "select-year-hint", onKeyDown: this.yearButtonKeyDownHandler, onClick: this.yearButtonClickHandler }, this.yearInView), this.nextYearButton())), !(monthPickerVisible || yearPickerVisible) && (h("div", { class: {
772
+ calendar: true,
773
+ hidden: monthPickerVisible || yearPickerVisible,
774
+ }, onKeyDown: this.handleCalendarKeyDown }, h("div", { class: "weekdays", "aria-hidden": "true" }, orderedDaysOfWeek.map((dayName) => {
775
+ const header = size === "small" ? dayName.charAt(0) : dayName;
776
+ return (h("div", { class: "calendar-day-header" }, h("ic-typography", { variant: "caption" }, header)));
777
+ })), h("div", { class: "calendar-days-container" }, this.currMonthView.map((day) => (h(DayButton, { day: day, disableDay: this.disableDays.includes(Number(day.getDay())), today: dateMatches(day, this.today), selected: dateMatches(day, this.selectedDate), focussed: dateMatches(day, this.focussedDate), inRange: dateInRange(day, minDay, maxDate), monthInView: monthInView, onSelectDay: this.handleSelectDay, focussedDayRef: this.setFocussedDayEl, onFocusDay: this.onDayButtonFocusHandler, onBlurDay: this.onDayButtonBlurHandler, showDaysOutsideMonth: this.showDaysOutsideMonth })))))), h("div", { class: {
778
+ "month-picker-container": true,
779
+ hidden: !monthPickerVisible,
780
+ } }, monthPickerVisible && (h(MonthPicker, { size: size, onSelectMonth: this.handleSelectMonth, monthInView: monthInView, focussedMonth: focussedMonth, onKeyDown: this.monthPickerKeyDownHandler, focussedMonthRef: this.setFocussedMonthEl, minDate: minDate, maxDate: maxDate, yearInView: yearInView }))), h("div", { class: {
781
+ "year-picker-container": true,
782
+ hidden: !yearPickerVisible,
783
+ } }, yearPickerVisible && (h(YearPicker, { decadeView: decadeView, size: size, focussedYear: focussedYear, onSelectYear: this.handleSelectYear, onKeyDown: this.yearPickerKeyDownHandler, onFocusYear: this.onYearButtonFocusHandler, onBlurYear: this.onYearButtonBlurHandler, yearInView: yearInView, minDate: minDate, maxDate: maxDate, focussedYearRef: this.setFocussedYearEl }))), h("div", { class: {
784
+ "bottom-buttons": true,
785
+ "no-today": !showPickerTodayButton,
786
+ } }, showPickerTodayButton && (h("ic-button", { id: "today-button", variant: "tertiary", ref: (el) => (this.todayButtonEl = el), size: size, "aria-label": "Navigate to current date", onClick: this.todayButtonClickHandler, onKeyDown: this.todayButtonKeyDownHandler, disabled: this.isCurrentMonth() }, "Go to today")), showPickerClearButton && (h("ic-button", { id: "clear-button", "aria-label": "clear selected date", ref: (el) => (this.clearButtonEl = el), variant: "tertiary", size: size, onClick: this.clearButtonClickHandler, onKeyDown: this.clearButtonKeyDownHandler, disabled: this.value === "" ||
787
+ this.value === null ||
788
+ this.value === undefined }, "Clear")))), this.renderHiddenInput()));
789
+ };
708
790
  this.calendarOpen = false;
709
791
  this.currMonthView = [];
710
792
  this.currYearPickerView = [];
@@ -742,6 +824,7 @@ export class DatePicker {
742
824
  this.name = undefined;
743
825
  this.openAtDate = "";
744
826
  this.required = false;
827
+ this.showDateInput = true;
745
828
  this.showDaysOutsideMonth = true;
746
829
  this.showPickerClearButton = true;
747
830
  this.showPickerTodayButton = true;
@@ -776,6 +859,11 @@ export class DatePicker {
776
859
  this.minDate = createDate(this.min, this.dateFormat);
777
860
  }
778
861
  }
862
+ watchShowDateInputHandler() {
863
+ if (!this.showDateInput) {
864
+ this.calendarOpen = true;
865
+ }
866
+ }
779
867
  watchStartOfWeekHandler() {
780
868
  this.orderedDaysOfWeek = this.daysOfWeek
781
869
  .slice(this.startOfWeek)
@@ -867,13 +955,23 @@ export class DatePicker {
867
955
  this.watchMaxHandler();
868
956
  this.watchMinHandler();
869
957
  removeDisabledFalse(this.disabled, this.el);
958
+ this.selectedDateInfoId = `${this.inputId}-selected-date-info`;
870
959
  }
871
960
  componentWillRender() {
872
961
  this.dateInputProps = this.setDateInputProps();
962
+ if (!this.showDateInput) {
963
+ this.calendarOpen = true;
964
+ }
873
965
  }
874
966
  componentWillUpdate() {
875
967
  this.dateInputProps = this.setDateInputProps();
876
968
  }
969
+ componentDidLoad() {
970
+ if (!this.showDateInput && this.value) {
971
+ this.setSelectedDate(new Date(this.value));
972
+ this.setFocussedDate(this.selectedDate);
973
+ }
974
+ }
877
975
  localCalendarButtonClickHandler(ev) {
878
976
  this.myCalendarButtonClicked = true;
879
977
  if (!this.calendarOpen) {
@@ -883,61 +981,14 @@ export class DatePicker {
883
981
  }
884
982
  calendarButtonClickHandler() {
885
983
  //closes this picker if calendar button in another clicked
886
- if (!this.myCalendarButtonClicked) {
984
+ if (!this.myCalendarButtonClicked && this.showDateInput) {
887
985
  this.calendarOpen = false;
888
986
  }
889
987
  this.myCalendarButtonClicked = false;
890
988
  }
891
989
  render() {
892
- const { calendarOpen, dateInputProps, monthNames, size, focussedMonth, focussedYear, monthInView, yearInView, monthPickerVisible, yearPickerVisible, orderedDaysOfWeek, decadeView, minDate, maxDate, showPickerClearButton, showPickerTodayButton, dialogDescription, } = this;
893
- let monthButtonText = "";
894
- if (monthPickerVisible) {
895
- monthButtonText = `Use the arrow keys to change the selected month. To return to day picker view, press Enter or Space to select a month, or press Escape.`;
896
- }
897
- else {
898
- monthButtonText = `Press Enter or Space to open month picker view or use the arrow keys to change month.`;
899
- }
900
- let yearButtonText = "";
901
- if (yearPickerVisible) {
902
- yearButtonText = `Use the arrow keys to change the selected year. To return to day picker view, press Enter or Space to select a year, or press Escape.`;
903
- }
904
- else {
905
- yearButtonText = `Press Enter or Space to open year picker view or use the arrow keys to change the selected year.`;
906
- }
907
- const dialogLabel = "choose date";
908
- const monthLabel = monthNames && monthNames[monthInView]
909
- ? monthNames[monthInView]
910
- : "Open month picker";
911
- const yearLabel = this.yearInView ? this.yearInView : "Open year picker";
912
- let minDay = minDate;
913
- if (this.disablePast) {
914
- const yesterday = new Date(minDate);
915
- yesterday.setDate(minDate.getDate() - 1);
916
- minDay = yesterday;
917
- }
918
- return (h(Host, { onKeyDown: this.keyDownHandler, class: size }, h("div", { class: "date-input-container" }, h("ic-date-input", Object.assign({ ref: (el) => (this.inputEl = el) }, dateInputProps))), calendarOpen && (h("div", null, h("span", { id: "dialog-description", class: "sr-only" }, dialogDescription), h("div", { role: "dialog", "aria-modal": "true", "aria-label": dialogLabel, "aria-describedBy": "dialog-description", class: {
919
- "calendar-container": true,
920
- above: this.showPickerAbove,
921
- }, onMouseDown: this.handleCalendarMouseDown, onClick: this.handleCalendarClick }, h("span", { ref: (el) => (this.liveRegionEl = el), id: "live-region", "aria-live": "assertive", class: "sr-only" }), h("div", { class: {
922
- "month-year-nav-container": true,
923
- } }, h("div", { class: "month-year-nav" }, this.previousMonthButton(), h("span", { id: "select-month-hint", "aria-hidden": "true" }, monthButtonText), h("ic-button", { ref: (el) => (this.monthButtonEl = el), size: size, class: "month-picker-button", "aria-haspopup": "menu", "aria-expanded": monthPickerVisible ? "true" : "false", "full-width": "true", variant: "tertiary", "aria-label": monthLabel, "aria-describedby": "select-month-hint", onKeyDown: this.monthButtonKeyDownHandler, onClick: this.monthButtonClickHandler }, monthNames[monthInView]), this.nextMonthButton()), h("div", { class: "month-year-nav" }, this.previousYearButton(), h("span", { id: "select-year-hint", "aria-hidden": "true" }, yearButtonText), h("ic-button", { ref: (el) => (this.yearButtonEl = el), size: size, class: "year-picker-button", "aria-haspopup": "menu", "aria-expanded": yearPickerVisible ? "true" : "false", "full-width": "true", variant: "tertiary", "aria-label": yearLabel, "aria-describedby": "select-year-hint", onKeyDown: this.yearButtonKeyDownHandler, onClick: this.yearButtonClickHandler }, this.yearInView), this.nextYearButton())), !(monthPickerVisible || yearPickerVisible) && (h("div", { class: {
924
- calendar: true,
925
- hidden: monthPickerVisible || yearPickerVisible,
926
- }, onKeyDown: this.handleCalendarKeyDown }, h("div", { class: "weekdays", "aria-hidden": "true" }, orderedDaysOfWeek.map((dayName) => {
927
- const header = size === "small" ? dayName.charAt(0) : dayName;
928
- return (h("div", { class: "calendar-day-header" }, h("ic-typography", { variant: "caption" }, header)));
929
- })), h("div", { class: "calendar-days-container" }, this.currMonthView.map((day) => (h(DayButton, { day: day, disableDay: this.disableDays.includes(Number(day.getDay())), today: dateMatches(day, this.today), selected: dateMatches(day, this.selectedDate), focussed: dateMatches(day, this.focussedDate), inRange: dateInRange(day, minDay, maxDate), monthInView: monthInView, onSelectDay: this.handleSelectDay, focussedDayRef: this.setFocussedDayEl, onFocusDay: this.onDayButtonFocusHandler, onBlurDay: this.onDayButtonBlurHandler, showDaysOutsideMonth: this.showDaysOutsideMonth })))))), h("div", { class: {
930
- "month-picker-container": true,
931
- hidden: !monthPickerVisible,
932
- } }, monthPickerVisible && (h(MonthPicker, { size: size, onSelectMonth: this.handleSelectMonth, monthInView: monthInView, focussedMonth: focussedMonth, onKeyDown: this.monthPickerKeyDownHandler, focussedMonthRef: this.setFocussedMonthEl, minDate: minDate, maxDate: maxDate, yearInView: yearInView }))), h("div", { class: {
933
- "year-picker-container": true,
934
- hidden: !yearPickerVisible,
935
- } }, yearPickerVisible && (h(YearPicker, { decadeView: decadeView, size: size, focussedYear: focussedYear, onSelectYear: this.handleSelectYear, onKeyDown: this.yearPickerKeyDownHandler, onFocusYear: this.onYearButtonFocusHandler, onBlurYear: this.onYearButtonBlurHandler, yearInView: yearInView, minDate: minDate, maxDate: maxDate, focussedYearRef: this.setFocussedYearEl }))), h("div", { class: {
936
- "bottom-buttons": true,
937
- "no-today": !showPickerTodayButton,
938
- } }, showPickerTodayButton && (h("ic-button", { id: "today-button", variant: "tertiary", ref: (el) => (this.todayButtonEl = el), size: size, "aria-label": "Navigate to current date", onClick: this.todayButtonClickHandler, onKeyDown: this.todayButtonKeyDownHandler, disabled: this.isCurrentMonth() }, "Go to today")), showPickerClearButton && (h("ic-button", { id: "clear-button", "aria-label": "clear selected date", ref: (el) => (this.clearButtonEl = el), variant: "tertiary", size: size, onClick: this.clearButtonClickHandler, onKeyDown: this.clearButtonKeyDownHandler, disabled: this.value === "" ||
939
- this.value === null ||
940
- this.value === undefined }, "Clear"))))))));
990
+ const { calendarOpen, dateInputProps, keyDownHandler, renderCalendar, showDateInput, size, } = this;
991
+ return (h(Host, { onKeyDown: keyDownHandler, class: size }, showDateInput && (h("div", { class: "date-input-container" }, h("ic-date-input", Object.assign({ ref: (el) => (this.inputEl = el) }, dateInputProps)))), calendarOpen && renderCalendar()));
941
992
  }
942
993
  static get is() { return "ic-date-picker"; }
943
994
  static get encapsulation() { return "shadow"; }
@@ -1317,6 +1368,27 @@ export class DatePicker {
1317
1368
  "reflect": false,
1318
1369
  "defaultValue": "false"
1319
1370
  },
1371
+ "showDateInput": {
1372
+ "type": "boolean",
1373
+ "mutable": false,
1374
+ "complexType": {
1375
+ "original": "boolean",
1376
+ "resolved": "boolean",
1377
+ "references": {}
1378
+ },
1379
+ "required": false,
1380
+ "optional": true,
1381
+ "docs": {
1382
+ "tags": [{
1383
+ "name": "deprecated",
1384
+ "text": "This prop should not be used anymore. If `false` hides the date input control and just displays the calendar."
1385
+ }],
1386
+ "text": ""
1387
+ },
1388
+ "attribute": "show-date-input",
1389
+ "reflect": false,
1390
+ "defaultValue": "true"
1391
+ },
1320
1392
  "showDaysOutsideMonth": {
1321
1393
  "type": "boolean",
1322
1394
  "mutable": false,
@@ -1529,6 +1601,26 @@ export class DatePicker {
1529
1601
  }
1530
1602
  }
1531
1603
  }
1604
+ }, {
1605
+ "method": "icSelectedDateChange",
1606
+ "name": "icSelectedDateChange",
1607
+ "bubbles": true,
1608
+ "cancelable": true,
1609
+ "composed": true,
1610
+ "docs": {
1611
+ "tags": [],
1612
+ "text": "Emitted when the selected date has changed."
1613
+ },
1614
+ "complexType": {
1615
+ "original": "{ value: Date }",
1616
+ "resolved": "{ value: Date; }",
1617
+ "references": {
1618
+ "Date": {
1619
+ "location": "global",
1620
+ "id": "global::Date"
1621
+ }
1622
+ }
1623
+ }
1532
1624
  }];
1533
1625
  }
1534
1626
  static get elementRef() { return "el"; }
@@ -1548,6 +1640,9 @@ export class DatePicker {
1548
1640
  }, {
1549
1641
  "propName": "min",
1550
1642
  "methodName": "watchMinHandler"
1643
+ }, {
1644
+ "propName": "showDateInput",
1645
+ "methodName": "watchShowDateInputHandler"
1551
1646
  }, {
1552
1647
  "propName": "startOfWeek",
1553
1648
  "methodName": "watchStartOfWeekHandler"