@carbon-labs/wc-date-picker 0.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 (156) hide show
  1. package/LICENSE +201 -0
  2. package/es/__stories__/date-picker.stories.d.ts +949 -0
  3. package/es/components/date-picker/calendar-renderer.d.ts +147 -0
  4. package/es/components/date-picker/calendar-renderer.js +406 -0
  5. package/es/components/date-picker/calendar-renderer.js.map +1 -0
  6. package/es/components/date-picker/date-picker-input-skeleton.d.ts +34 -0
  7. package/es/components/date-picker/date-picker-input-skeleton.js +77 -0
  8. package/es/components/date-picker/date-picker-input-skeleton.js.map +1 -0
  9. package/es/components/date-picker/date-picker-input.d.ts +539 -0
  10. package/es/components/date-picker/date-picker-input.js +413 -0
  11. package/es/components/date-picker/date-picker-input.js.map +1 -0
  12. package/es/components/date-picker/date-picker.d.ts +977 -0
  13. package/es/components/date-picker/date-picker.js +1047 -0
  14. package/es/components/date-picker/date-picker.js.map +1 -0
  15. package/es/components/date-picker/date-picker.scss.js +6 -0
  16. package/es/components/date-picker/date-picker.scss.js.map +1 -0
  17. package/es/components/date-picker/defs.d.ts +45 -0
  18. package/es/components/date-picker/defs.js +51 -0
  19. package/es/components/date-picker/defs.js.map +1 -0
  20. package/es/index.d.ts +10 -0
  21. package/es/index.js +5 -0
  22. package/es/index.js.map +1 -0
  23. package/es/state-machine/actions.d.ts +35 -0
  24. package/es/state-machine/actions.js +860 -0
  25. package/es/state-machine/actions.js.map +1 -0
  26. package/es/state-machine/adapters/web-component-adapter.d.ts +142 -0
  27. package/es/state-machine/adapters/web-component-adapter.js +269 -0
  28. package/es/state-machine/adapters/web-component-adapter.js.map +1 -0
  29. package/es/state-machine/effects.d.ts +35 -0
  30. package/es/state-machine/effects.js +92 -0
  31. package/es/state-machine/effects.js.map +1 -0
  32. package/es/state-machine/guards.d.ts +41 -0
  33. package/es/state-machine/guards.js +143 -0
  34. package/es/state-machine/guards.js.map +1 -0
  35. package/es/state-machine/index.d.ts +12 -0
  36. package/es/state-machine/machine.d.ts +92 -0
  37. package/es/state-machine/machine.js +272 -0
  38. package/es/state-machine/machine.js.map +1 -0
  39. package/es/state-machine/states.d.ts +89 -0
  40. package/es/state-machine/states.js +105 -0
  41. package/es/state-machine/states.js.map +1 -0
  42. package/es/state-machine/temporal-utils.d.ts +203 -0
  43. package/es/state-machine/temporal-utils.js +128 -0
  44. package/es/state-machine/temporal-utils.js.map +1 -0
  45. package/es/state-machine/types.d.ts +163 -0
  46. package/es/temp-imports/.storybook/templates/with-layer.d.ts +26 -0
  47. package/es/temp-imports/globals/decorators/carbon-element.d.ts +45 -0
  48. package/es/temp-imports/globals/decorators/carbon-element.js +63 -0
  49. package/es/temp-imports/globals/decorators/carbon-element.js.map +1 -0
  50. package/es/temp-imports/globals/decorators/host-listener.d.ts +17 -0
  51. package/es/temp-imports/globals/decorators/host-listener.js +62 -0
  52. package/es/temp-imports/globals/decorators/host-listener.js.map +1 -0
  53. package/es/temp-imports/globals/internal/collection-helpers.d.ts +41 -0
  54. package/es/temp-imports/globals/internal/handle.d.ts +16 -0
  55. package/es/temp-imports/globals/internal/icon-loader-utils.d.ts +31 -0
  56. package/es/temp-imports/globals/internal/icon-loader-utils.js +69 -0
  57. package/es/temp-imports/globals/internal/icon-loader-utils.js.map +1 -0
  58. package/es/temp-imports/globals/internal/icon-loader.d.ts +28 -0
  59. package/es/temp-imports/globals/internal/icon-loader.js +43 -0
  60. package/es/temp-imports/globals/internal/icon-loader.js.map +1 -0
  61. package/es/temp-imports/globals/mixins/focus.d.ts +369 -0
  62. package/es/temp-imports/globals/mixins/focus.js +38 -0
  63. package/es/temp-imports/globals/mixins/focus.js.map +1 -0
  64. package/es/temp-imports/globals/mixins/form.d.ts +379 -0
  65. package/es/temp-imports/globals/mixins/form.js +49 -0
  66. package/es/temp-imports/globals/mixins/form.js.map +1 -0
  67. package/es/temp-imports/globals/mixins/host-listener.d.ts +387 -0
  68. package/es/temp-imports/globals/mixins/host-listener.js +76 -0
  69. package/es/temp-imports/globals/mixins/host-listener.js.map +1 -0
  70. package/es/temp-imports/globals/mixins/on.d.ts +9 -0
  71. package/es/temp-imports/globals/mixins/on.js +19 -0
  72. package/es/temp-imports/globals/mixins/on.js.map +1 -0
  73. package/es/temp-imports/globals/settings.d.ts +13 -0
  74. package/es/temp-imports/globals/settings.js +76 -0
  75. package/es/temp-imports/globals/settings.js.map +1 -0
  76. package/es/temp-imports/globals/shared-enums.d.ts +19 -0
  77. package/es/temp-imports/globals/shared-enums.js +23 -0
  78. package/es/temp-imports/globals/shared-enums.js.map +1 -0
  79. package/lib/__stories__/date-picker.stories.d.ts +949 -0
  80. package/lib/components/date-picker/calendar-renderer.d.ts +147 -0
  81. package/lib/components/date-picker/calendar-renderer.js +408 -0
  82. package/lib/components/date-picker/calendar-renderer.js.map +1 -0
  83. package/lib/components/date-picker/date-picker-input-skeleton.d.ts +34 -0
  84. package/lib/components/date-picker/date-picker-input-skeleton.js +79 -0
  85. package/lib/components/date-picker/date-picker-input-skeleton.js.map +1 -0
  86. package/lib/components/date-picker/date-picker-input.d.ts +539 -0
  87. package/lib/components/date-picker/date-picker-input.js +422 -0
  88. package/lib/components/date-picker/date-picker-input.js.map +1 -0
  89. package/lib/components/date-picker/date-picker.d.ts +977 -0
  90. package/lib/components/date-picker/date-picker.js +1049 -0
  91. package/lib/components/date-picker/date-picker.js.map +1 -0
  92. package/lib/components/date-picker/date-picker.scss.js +10 -0
  93. package/lib/components/date-picker/date-picker.scss.js.map +1 -0
  94. package/lib/components/date-picker/defs.d.ts +45 -0
  95. package/lib/components/date-picker/defs.js +56 -0
  96. package/lib/components/date-picker/defs.js.map +1 -0
  97. package/lib/index.d.ts +10 -0
  98. package/lib/index.js +8 -0
  99. package/lib/index.js.map +1 -0
  100. package/lib/state-machine/actions.d.ts +35 -0
  101. package/lib/state-machine/actions.js +864 -0
  102. package/lib/state-machine/actions.js.map +1 -0
  103. package/lib/state-machine/adapters/web-component-adapter.d.ts +142 -0
  104. package/lib/state-machine/adapters/web-component-adapter.js +271 -0
  105. package/lib/state-machine/adapters/web-component-adapter.js.map +1 -0
  106. package/lib/state-machine/effects.d.ts +35 -0
  107. package/lib/state-machine/effects.js +96 -0
  108. package/lib/state-machine/effects.js.map +1 -0
  109. package/lib/state-machine/guards.d.ts +41 -0
  110. package/lib/state-machine/guards.js +147 -0
  111. package/lib/state-machine/guards.js.map +1 -0
  112. package/lib/state-machine/index.d.ts +12 -0
  113. package/lib/state-machine/machine.d.ts +92 -0
  114. package/lib/state-machine/machine.js +274 -0
  115. package/lib/state-machine/machine.js.map +1 -0
  116. package/lib/state-machine/states.d.ts +89 -0
  117. package/lib/state-machine/states.js +105 -0
  118. package/lib/state-machine/states.js.map +1 -0
  119. package/lib/state-machine/temporal-utils.d.ts +203 -0
  120. package/lib/state-machine/temporal-utils.js +136 -0
  121. package/lib/state-machine/temporal-utils.js.map +1 -0
  122. package/lib/state-machine/types.d.ts +163 -0
  123. package/lib/temp-imports/.storybook/templates/with-layer.d.ts +26 -0
  124. package/lib/temp-imports/globals/decorators/carbon-element.d.ts +45 -0
  125. package/lib/temp-imports/globals/decorators/carbon-element.js +65 -0
  126. package/lib/temp-imports/globals/decorators/carbon-element.js.map +1 -0
  127. package/lib/temp-imports/globals/decorators/host-listener.d.ts +17 -0
  128. package/lib/temp-imports/globals/decorators/host-listener.js +66 -0
  129. package/lib/temp-imports/globals/decorators/host-listener.js.map +1 -0
  130. package/lib/temp-imports/globals/internal/collection-helpers.d.ts +41 -0
  131. package/lib/temp-imports/globals/internal/handle.d.ts +16 -0
  132. package/lib/temp-imports/globals/internal/icon-loader-utils.d.ts +31 -0
  133. package/lib/temp-imports/globals/internal/icon-loader-utils.js +72 -0
  134. package/lib/temp-imports/globals/internal/icon-loader-utils.js.map +1 -0
  135. package/lib/temp-imports/globals/internal/icon-loader.d.ts +28 -0
  136. package/lib/temp-imports/globals/internal/icon-loader.js +45 -0
  137. package/lib/temp-imports/globals/internal/icon-loader.js.map +1 -0
  138. package/lib/temp-imports/globals/mixins/focus.d.ts +369 -0
  139. package/lib/temp-imports/globals/mixins/focus.js +42 -0
  140. package/lib/temp-imports/globals/mixins/focus.js.map +1 -0
  141. package/lib/temp-imports/globals/mixins/form.d.ts +379 -0
  142. package/lib/temp-imports/globals/mixins/form.js +53 -0
  143. package/lib/temp-imports/globals/mixins/form.js.map +1 -0
  144. package/lib/temp-imports/globals/mixins/host-listener.d.ts +387 -0
  145. package/lib/temp-imports/globals/mixins/host-listener.js +80 -0
  146. package/lib/temp-imports/globals/mixins/host-listener.js.map +1 -0
  147. package/lib/temp-imports/globals/mixins/on.d.ts +9 -0
  148. package/lib/temp-imports/globals/mixins/on.js +23 -0
  149. package/lib/temp-imports/globals/mixins/on.js.map +1 -0
  150. package/lib/temp-imports/globals/settings.d.ts +13 -0
  151. package/lib/temp-imports/globals/settings.js +79 -0
  152. package/lib/temp-imports/globals/settings.js.map +1 -0
  153. package/lib/temp-imports/globals/shared-enums.d.ts +19 -0
  154. package/lib/temp-imports/globals/shared-enums.js +23 -0
  155. package/lib/temp-imports/globals/shared-enums.js.map +1 -0
  156. package/package.json +44 -0
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Copyright IBM Corp. 2026
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { LitElement } from 'lit';
8
+ /**
9
+ * Calendar renderer for date picker.
10
+ * Replaces Flatpickr's calendar UI with a lightweight, framework-agnostic implementation.
11
+ *
12
+ * @element cds-date-picker-calendar
13
+ * @fires cds-date-picker-calendar-date-select - Fired when a date is selected
14
+ * @fires cds-date-picker-calendar-month-change - Fired when the month changes
15
+ */
16
+ declare class CDSDatePickerCalendar extends LitElement {
17
+ /**
18
+ * The currently displayed month (Temporal.PlainYearMonth)
19
+ */
20
+ private _currentMonth;
21
+ /**
22
+ * The selected date(s)
23
+ */
24
+ selectedDates: Temporal.PlainDate[];
25
+ /**
26
+ * The view date from the state machine (used to sync calendar month)
27
+ */
28
+ viewDate?: Temporal.PlainDate;
29
+ /**
30
+ * The focused date for keyboard navigation
31
+ */
32
+ focusedDate?: Temporal.PlainDate | null;
33
+ /**
34
+ * The currently hovered date (for range preview)
35
+ */
36
+ private _hoveredDate?;
37
+ /**
38
+ * The minimum selectable date
39
+ */
40
+ minDate?: Temporal.PlainDate;
41
+ /**
42
+ * The maximum selectable date
43
+ */
44
+ maxDate?: Temporal.PlainDate;
45
+ /**
46
+ * Whether range selection is enabled
47
+ */
48
+ rangeMode: boolean;
49
+ /**
50
+ * The date format for display
51
+ */
52
+ dateFormat: string;
53
+ /**
54
+ * Locale for date formatting
55
+ */
56
+ locale: string;
57
+ /**
58
+ * Navigate to previous month
59
+ */
60
+ private _handlePrevMonth;
61
+ /**
62
+ * Navigate to next month
63
+ */
64
+ private _handleNextMonth;
65
+ /**
66
+ * Handle date selection
67
+ * @param {Temporal.PlainDate} date - The date to select
68
+ */
69
+ private _handleDateSelect;
70
+ /**
71
+ * Dispatch month change event
72
+ */
73
+ private _dispatchMonthChange;
74
+ /**
75
+ * Check if a date is disabled
76
+ * @param {Temporal.PlainDate} date - The date to check
77
+ */
78
+ private _isDateDisabled;
79
+ /**
80
+ * Check if previous month navigation should be disabled
81
+ */
82
+ private _isPrevMonthDisabled;
83
+ /**
84
+ * Check if next month navigation should be disabled
85
+ */
86
+ private _isNextMonthDisabled;
87
+ /**
88
+ * Check if a date is selected
89
+ * @param {Temporal.PlainDate} date - The date to check
90
+ */
91
+ private _isDateSelected;
92
+ /**
93
+ * Check if a date is in range (for range mode)
94
+ * @param {Temporal.PlainDate} date - The date to check
95
+ */
96
+ private _isDateInRange;
97
+ /**
98
+ * Check if a date is today
99
+ * @param {Temporal.PlainDate} date - The date to check
100
+ */
101
+ private _isToday;
102
+ /**
103
+ * Check if a date is focused (for keyboard navigation)
104
+ * @param {Temporal.PlainDate} date - The date to check
105
+ */
106
+ private _isDateFocused;
107
+ /**
108
+ * Handle mouse enter on a date
109
+ * @param {Temporal.PlainDate} date - The date being hovered
110
+ */
111
+ private _handleDateMouseEnter;
112
+ /**
113
+ * Handle mouse leave on a date
114
+ */
115
+ private _handleDateMouseLeave;
116
+ /**
117
+ * Get the days to display in the calendar grid
118
+ */
119
+ private _getCalendarDays;
120
+ /**
121
+ * Get weekday names
122
+ */
123
+ private _getWeekdayNames;
124
+ /**
125
+ * Render the calendar header with month/year and navigation
126
+ */
127
+ private _renderHeader;
128
+ /**
129
+ * Render the weekday headers
130
+ */
131
+ private _renderWeekdays;
132
+ /**
133
+ * Render the calendar days grid
134
+ */
135
+ private _renderDays;
136
+ /**
137
+ * Lifecycle method called when properties change
138
+ * @param {Map<string, any>} changedProperties - Changed properties
139
+ */
140
+ updated(changedProperties: Map<string, any>): void;
141
+ /**
142
+ * Renders the calendar component
143
+ */
144
+ render(): import("lit-html").TemplateResult<1>;
145
+ static styles: any;
146
+ }
147
+ export default CDSDatePickerCalendar;
@@ -0,0 +1,406 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import { LitElement, html } from 'lit';
3
+ import { state, property } from 'lit/decorators.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
5
+ import { prefix } from '../../temp-imports/globals/settings.js';
6
+ import { carbonElement } from '../../temp-imports/globals/decorators/carbon-element.js';
7
+ import ChevronLeft16 from '@carbon/icons/es/chevron--left/16.js';
8
+ import ChevronRight16 from '@carbon/icons/es/chevron--right/16.js';
9
+ import { iconLoader } from '../../temp-imports/globals/internal/icon-loader.js';
10
+ import { plainDateToDate } from '../../state-machine/temporal-utils.js';
11
+ import styles from './date-picker.scss.js';
12
+
13
+ /**
14
+ * Copyright IBM Corp. 2026
15
+ *
16
+ * This source code is licensed under the Apache-2.0 license found in the
17
+ * LICENSE file in the root directory of this source tree.
18
+ */
19
+ /**
20
+ * Calendar renderer for date picker.
21
+ * Replaces Flatpickr's calendar UI with a lightweight, framework-agnostic implementation.
22
+ *
23
+ * @element cds-date-picker-calendar
24
+ * @fires cds-date-picker-calendar-date-select - Fired when a date is selected
25
+ * @fires cds-date-picker-calendar-month-change - Fired when the month changes
26
+ */
27
+ let CDSDatePickerCalendar = class CDSDatePickerCalendar extends LitElement {
28
+ constructor() {
29
+ super(...arguments);
30
+ /**
31
+ * The currently displayed month (Temporal.PlainYearMonth)
32
+ */
33
+ this._currentMonth = Temporal.Now.plainDateISO().toPlainYearMonth();
34
+ /**
35
+ * The selected date(s)
36
+ */
37
+ this.selectedDates = [];
38
+ /**
39
+ * Whether range selection is enabled
40
+ */
41
+ this.rangeMode = false;
42
+ /**
43
+ * The date format for display
44
+ */
45
+ this.dateFormat = 'm/d/Y';
46
+ /**
47
+ * Locale for date formatting
48
+ */
49
+ this.locale = 'en-US';
50
+ }
51
+ /**
52
+ * Navigate to previous month
53
+ */
54
+ _handlePrevMonth() {
55
+ this._currentMonth = this._currentMonth.subtract({ months: 1 });
56
+ this._dispatchMonthChange();
57
+ }
58
+ /**
59
+ * Navigate to next month
60
+ */
61
+ _handleNextMonth() {
62
+ this._currentMonth = this._currentMonth.add({ months: 1 });
63
+ this._dispatchMonthChange();
64
+ }
65
+ /**
66
+ * Handle date selection
67
+ * @param {Temporal.PlainDate} date - The date to select
68
+ */
69
+ _handleDateSelect(date) {
70
+ if (this._isDateDisabled(date)) {
71
+ return;
72
+ }
73
+ this.dispatchEvent(new CustomEvent(`${prefix}-date-picker-calendar-date-select`, {
74
+ bubbles: true,
75
+ composed: true,
76
+ detail: { date },
77
+ }));
78
+ }
79
+ /**
80
+ * Dispatch month change event
81
+ */
82
+ _dispatchMonthChange() {
83
+ this.dispatchEvent(new CustomEvent(`${prefix}-date-picker-calendar-month-change`, {
84
+ bubbles: true,
85
+ composed: true,
86
+ detail: { month: this._currentMonth },
87
+ }));
88
+ }
89
+ /**
90
+ * Check if a date is disabled
91
+ * @param {Temporal.PlainDate} date - The date to check
92
+ */
93
+ _isDateDisabled(date) {
94
+ if (this.minDate && Temporal.PlainDate.compare(date, this.minDate) < 0) {
95
+ return true;
96
+ }
97
+ if (this.maxDate && Temporal.PlainDate.compare(date, this.maxDate) > 0) {
98
+ return true;
99
+ }
100
+ return false;
101
+ }
102
+ /**
103
+ * Check if previous month navigation should be disabled
104
+ */
105
+ _isPrevMonthDisabled() {
106
+ if (!this.minDate) {
107
+ return false;
108
+ }
109
+ // Disable if going to previous month would be before minDate's month
110
+ const prevMonth = this._currentMonth.subtract({ months: 1 });
111
+ const prevMonthLastDay = prevMonth.toPlainDate({
112
+ day: prevMonth.daysInMonth,
113
+ });
114
+ return Temporal.PlainDate.compare(prevMonthLastDay, this.minDate) < 0;
115
+ }
116
+ /**
117
+ * Check if next month navigation should be disabled
118
+ */
119
+ _isNextMonthDisabled() {
120
+ if (!this.maxDate) {
121
+ return false;
122
+ }
123
+ // Disable if going to next month would be after maxDate's month
124
+ const nextMonth = this._currentMonth.add({ months: 1 });
125
+ const nextMonthFirstDay = nextMonth.toPlainDate({ day: 1 });
126
+ return Temporal.PlainDate.compare(nextMonthFirstDay, this.maxDate) > 0;
127
+ }
128
+ /**
129
+ * Check if a date is selected
130
+ * @param {Temporal.PlainDate} date - The date to check
131
+ */
132
+ _isDateSelected(date) {
133
+ return this.selectedDates.some((selected) => {
134
+ if (!selected || typeof selected !== 'object' || !('year' in selected)) {
135
+ return false;
136
+ }
137
+ return Temporal.PlainDate.compare(selected, date) === 0;
138
+ });
139
+ }
140
+ /**
141
+ * Check if a date is in range (for range mode)
142
+ * @param {Temporal.PlainDate} date - The date to check
143
+ */
144
+ _isDateInRange(date) {
145
+ if (!this.rangeMode) {
146
+ return false;
147
+ }
148
+ // Case 1: Both dates are selected (final range)
149
+ if (this.selectedDates.length === 2) {
150
+ const [start, end] = this.selectedDates.sort((a, b) => Temporal.PlainDate.compare(a, b));
151
+ return (Temporal.PlainDate.compare(date, start) >= 0 &&
152
+ Temporal.PlainDate.compare(date, end) <= 0);
153
+ }
154
+ // Case 2: One date selected, show preview range with hovered or focused date
155
+ const previewDate = this._hoveredDate || this.focusedDate;
156
+ if (this.selectedDates.length === 1 && previewDate) {
157
+ const start = this.selectedDates[0];
158
+ const end = previewDate;
159
+ // Sort to handle both forward and backward selection
160
+ const [rangeStart, rangeEnd] = [start, end].sort((a, b) => Temporal.PlainDate.compare(a, b));
161
+ return (Temporal.PlainDate.compare(date, rangeStart) >= 0 &&
162
+ Temporal.PlainDate.compare(date, rangeEnd) <= 0);
163
+ }
164
+ return false;
165
+ }
166
+ /**
167
+ * Check if a date is today
168
+ * @param {Temporal.PlainDate} date - The date to check
169
+ */
170
+ _isToday(date) {
171
+ const today = Temporal.Now.plainDateISO();
172
+ return Temporal.PlainDate.compare(date, today) === 0;
173
+ }
174
+ /**
175
+ * Check if a date is focused (for keyboard navigation)
176
+ * @param {Temporal.PlainDate} date - The date to check
177
+ */
178
+ _isDateFocused(date) {
179
+ if (!this.focusedDate) {
180
+ return false;
181
+ }
182
+ return Temporal.PlainDate.compare(date, this.focusedDate) === 0;
183
+ }
184
+ /**
185
+ * Handle mouse enter on a date
186
+ * @param {Temporal.PlainDate} date - The date being hovered
187
+ */
188
+ _handleDateMouseEnter(date) {
189
+ // Only track hover in range mode when selecting end date
190
+ if (this.rangeMode && this.selectedDates.length === 1) {
191
+ this._hoveredDate = date;
192
+ }
193
+ }
194
+ /**
195
+ * Handle mouse leave on a date
196
+ */
197
+ _handleDateMouseLeave() {
198
+ // Clear hovered date
199
+ this._hoveredDate = undefined;
200
+ }
201
+ /**
202
+ * Get the days to display in the calendar grid
203
+ */
204
+ _getCalendarDays() {
205
+ const firstDayOfMonth = this._currentMonth.toPlainDate({ day: 1 });
206
+ // Get the day of week for the first day (0 = Sunday, 6 = Saturday)
207
+ const firstDayOfWeek = firstDayOfMonth.dayOfWeek % 7;
208
+ // Calculate the start date (may be in previous month)
209
+ const startDate = firstDayOfMonth.subtract({ days: firstDayOfWeek });
210
+ // Generate 42 days (6 weeks) for consistent grid
211
+ const days = [];
212
+ for (let i = 0; i < 42; i++) {
213
+ days.push(startDate.add({ days: i }));
214
+ }
215
+ return days;
216
+ }
217
+ /**
218
+ * Get weekday names
219
+ */
220
+ _getWeekdayNames() {
221
+ // Start from Sunday
222
+ const baseDate = Temporal.PlainDate.from('2024-01-07'); // A Sunday
223
+ const weekdays = [];
224
+ for (let i = 0; i < 7; i++) {
225
+ const date = baseDate.add({ days: i });
226
+ const formatter = new Intl.DateTimeFormat(this.locale, {
227
+ weekday: 'short',
228
+ });
229
+ // Use plainDateToDate to properly convert Temporal.PlainDate to Date
230
+ let name = formatter.format(plainDateToDate(date));
231
+ // Special handling for Thursday to match Carbon's "Th" format
232
+ if (name === 'Thu') {
233
+ name = 'Th';
234
+ }
235
+ else {
236
+ name = name.charAt(0);
237
+ }
238
+ weekdays.push(name);
239
+ }
240
+ return weekdays;
241
+ }
242
+ /**
243
+ * Render the calendar header with month/year and navigation
244
+ */
245
+ _renderHeader() {
246
+ // Convert Temporal.PlainYearMonth to Date properly to avoid month offset issues
247
+ const firstDayOfMonth = this._currentMonth.toPlainDate({ day: 1 });
248
+ const monthName = new Intl.DateTimeFormat(this.locale, {
249
+ month: 'long',
250
+ year: 'numeric',
251
+ }).format(plainDateToDate(firstDayOfMonth));
252
+ const isPrevDisabled = this._isPrevMonthDisabled();
253
+ const isNextDisabled = this._isNextMonthDisabled();
254
+ return html `
255
+ <div class="${prefix}--date-picker__month">
256
+ <button
257
+ type="button"
258
+ class="${prefix}--date-picker__month-nav ${prefix}--date-picker__month-nav--prev"
259
+ tabindex="-1"
260
+ ?disabled="${isPrevDisabled}"
261
+ @click="${this._handlePrevMonth}"
262
+ aria-label="Previous month">
263
+ ${iconLoader(ChevronLeft16)}
264
+ </button>
265
+ <div class="${prefix}--date-picker__current-month">
266
+ <span class="cur-month">${monthName}</span>
267
+ </div>
268
+ <button
269
+ type="button"
270
+ class="${prefix}--date-picker__month-nav ${prefix}--date-picker__month-nav--next"
271
+ tabindex="-1"
272
+ ?disabled="${isNextDisabled}"
273
+ @click="${this._handleNextMonth}"
274
+ aria-label="Next month">
275
+ ${iconLoader(ChevronRight16)}
276
+ </button>
277
+ </div>
278
+ `;
279
+ }
280
+ /**
281
+ * Render the weekday headers
282
+ */
283
+ _renderWeekdays() {
284
+ const weekdays = this._getWeekdayNames();
285
+ return html `
286
+ <div class="${prefix}--date-picker__weekdays">
287
+ ${weekdays.map((day) => html `
288
+ <span class="${prefix}--date-picker__weekday">${day}</span>
289
+ `)}
290
+ </div>
291
+ `;
292
+ }
293
+ /**
294
+ * Render the calendar days grid
295
+ */
296
+ _renderDays() {
297
+ const days = this._getCalendarDays();
298
+ const currentMonthValue = this._currentMonth.month;
299
+ return html `
300
+ <div class="${prefix}--date-picker__days" role="grid">
301
+ ${days.map((date) => {
302
+ const isCurrentMonth = date.month === currentMonthValue;
303
+ const isDisabled = this._isDateDisabled(date);
304
+ const isSelected = this._isDateSelected(date);
305
+ const isInRange = this._isDateInRange(date);
306
+ const isToday = this._isToday(date);
307
+ const isFocused = this._isDateFocused(date);
308
+ const dayClasses = classMap({
309
+ [`${prefix}--date-picker__day`]: true,
310
+ prevMonthDay: !isCurrentMonth && date.month < currentMonthValue,
311
+ nextMonthDay: !isCurrentMonth && date.month > currentMonthValue,
312
+ disabled: isDisabled,
313
+ selected: isSelected,
314
+ inRange: isInRange,
315
+ today: isToday && !isSelected,
316
+ 'no-border': isToday && isSelected,
317
+ focused: isFocused,
318
+ });
319
+ return html `
320
+ <button
321
+ type="button"
322
+ class="${dayClasses}"
323
+ tabindex="-1"
324
+ ?disabled="${isDisabled}"
325
+ @click="${() => this._handleDateSelect(date)}"
326
+ @mouseenter="${() => this._handleDateMouseEnter(date)}"
327
+ @mouseleave="${() => this._handleDateMouseLeave()}"
328
+ aria-label="${date.toString()}">
329
+ ${date.day}
330
+ </button>
331
+ `;
332
+ })}
333
+ </div>
334
+ `;
335
+ }
336
+ /**
337
+ * Lifecycle method called when properties change
338
+ * @param {Map<string, any>} changedProperties - Changed properties
339
+ */
340
+ updated(changedProperties) {
341
+ // Sync calendar month with viewDate from state machine
342
+ if (changedProperties.has('viewDate') && this.viewDate) {
343
+ // Create PlainYearMonth from PlainDate
344
+ this._currentMonth = Temporal.PlainYearMonth.from({
345
+ year: this.viewDate.year,
346
+ month: this.viewDate.month,
347
+ });
348
+ }
349
+ }
350
+ /**
351
+ * Renders the calendar component
352
+ */
353
+ render() {
354
+ return html `
355
+ <div class="${prefix}--date-picker__calendar" tabindex="0">
356
+ ${this._renderHeader()} ${this._renderWeekdays()} ${this._renderDays()}
357
+ </div>
358
+ `;
359
+ }
360
+ };
361
+ CDSDatePickerCalendar.styles = styles;
362
+ __decorate([
363
+ state(),
364
+ __metadata("design:type", Object)
365
+ ], CDSDatePickerCalendar.prototype, "_currentMonth", void 0);
366
+ __decorate([
367
+ property({ type: Array }),
368
+ __metadata("design:type", Array)
369
+ ], CDSDatePickerCalendar.prototype, "selectedDates", void 0);
370
+ __decorate([
371
+ property({ type: Object }),
372
+ __metadata("design:type", Object)
373
+ ], CDSDatePickerCalendar.prototype, "viewDate", void 0);
374
+ __decorate([
375
+ property({ type: Object }),
376
+ __metadata("design:type", Object)
377
+ ], CDSDatePickerCalendar.prototype, "focusedDate", void 0);
378
+ __decorate([
379
+ state(),
380
+ __metadata("design:type", Object)
381
+ ], CDSDatePickerCalendar.prototype, "_hoveredDate", void 0);
382
+ __decorate([
383
+ property({ type: Object }),
384
+ __metadata("design:type", Object)
385
+ ], CDSDatePickerCalendar.prototype, "minDate", void 0);
386
+ __decorate([
387
+ property({ type: Object }),
388
+ __metadata("design:type", Object)
389
+ ], CDSDatePickerCalendar.prototype, "maxDate", void 0);
390
+ __decorate([
391
+ property({ type: Boolean }),
392
+ __metadata("design:type", Object)
393
+ ], CDSDatePickerCalendar.prototype, "rangeMode", void 0);
394
+ __decorate([
395
+ property({ type: String }),
396
+ __metadata("design:type", Object)
397
+ ], CDSDatePickerCalendar.prototype, "dateFormat", void 0);
398
+ __decorate([
399
+ property({ type: String }),
400
+ __metadata("design:type", Object)
401
+ ], CDSDatePickerCalendar.prototype, "locale", void 0);
402
+ CDSDatePickerCalendar = __decorate([
403
+ carbonElement(`${prefix}-date-picker-calendar`)
404
+ ], CDSDatePickerCalendar);
405
+ // Made with Bob
406
+ //# sourceMappingURL=calendar-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calendar-renderer.js","sources":["../../../../components/date-picker/calendar-renderer.ts"],"sourcesContent":[null],"names":["customElement"],"mappings":";;;;;;;;;;;;AAAA;;;;;AAKG;AAiBH;;;;;;;AAOG;AAEH,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,UAAU,CAAA;AAA9C,IAAA,WAAA,GAAA;;AACE;;AAEG;QAEK,IAAA,CAAA,aAAa,GAAQ,QAAQ,CAAC,GAAG,CAAC,YAAY,EAAE,CAAC,gBAAgB,EAAE;AAE3E;;AAEG;QAEH,IAAA,CAAA,aAAa,GAAyB,EAAE;AAgCxC;;AAEG;QAEH,IAAA,CAAA,SAAS,GAAG,KAAK;AAEjB;;AAEG;QAEH,IAAA,CAAA,UAAU,GAAG,OAAO;AAEpB;;AAEG;QAEH,IAAA,CAAA,MAAM,GAAG,OAAO;IA6WlB;AA3WE;;AAEG;IACK,gBAAgB,GAAA;AACtB,QAAA,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAC/D,IAAI,CAAC,oBAAoB,EAAE;IAC7B;AAEA;;AAEG;IACK,gBAAgB,GAAA;AACtB,QAAA,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;QAC1D,IAAI,CAAC,oBAAoB,EAAE;IAC7B;AAEA;;;AAGG;AACK,IAAA,iBAAiB,CAAC,IAAwB,EAAA;AAChD,QAAA,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE;YAC9B;QACF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,EAAA,MAAA,CAAA;AAMrB,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;AACV,CAAA,EAAA,qBAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AA3Db,qBAAqB,GAAA,UAAA,CAAA;AAD1B,IAAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,qBAAA,CAAuB;AACzC,CAAA,EAAA,qBAAqB,CAwa1B;AAID"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Copyright IBM Corp. 2019, 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+ import { LitElement } from 'lit';
8
+ import { DATE_PICKER_INPUT_KIND } from './defs';
9
+ /**
10
+ * Skeleton version of the input box for date picker.
11
+ */
12
+ declare class CDSDatePickerInputSkeleton extends LitElement {
13
+ /**
14
+ * Specify whether the label should be hidden, or not
15
+ */
16
+ hideLabel: boolean;
17
+ /**
18
+ * * @deprecated use `range` instead
19
+ * Date picker input kind. Corresponds to the attribute with the same name.
20
+ */
21
+ kind: DATE_PICKER_INPUT_KIND;
22
+ /**
23
+ * Specify whether the skeleton should be of range date picker.
24
+ */
25
+ range: boolean;
26
+ /**
27
+ * Renders the component template.
28
+ *
29
+ * @returns {TemplateResult} The template result
30
+ */
31
+ render(): import("lit-html").TemplateResult<1>;
32
+ static styles: any;
33
+ }
34
+ export default CDSDatePickerInputSkeleton;
@@ -0,0 +1,77 @@
1
+ import { __decorate, __metadata } from 'tslib';
2
+ import { LitElement, html } from 'lit';
3
+ import { property } from 'lit/decorators.js';
4
+ import { prefix } from '../../temp-imports/globals/settings.js';
5
+ import { DATE_PICKER_INPUT_KIND } from './defs.js';
6
+ import styles from './date-picker.scss.js';
7
+ import { carbonElement } from '../../temp-imports/globals/decorators/carbon-element.js';
8
+
9
+ /**
10
+ * Copyright IBM Corp. 2019, 2025
11
+ *
12
+ * This source code is licensed under the Apache-2.0 license found in the
13
+ * LICENSE file in the root directory of this source tree.
14
+ */
15
+ /**
16
+ * Skeleton version of the input box for date picker.
17
+ */
18
+ let CDSDatePickerInputSkeleton = class CDSDatePickerInputSkeleton extends LitElement {
19
+ constructor() {
20
+ super(...arguments);
21
+ /**
22
+ * Specify whether the label should be hidden, or not
23
+ */
24
+ this.hideLabel = false;
25
+ /**
26
+ * * @deprecated use `range` instead
27
+ * Date picker input kind. Corresponds to the attribute with the same name.
28
+ */
29
+ this.kind = DATE_PICKER_INPUT_KIND.SIMPLE;
30
+ /**
31
+ * Specify whether the skeleton should be of range date picker.
32
+ */
33
+ this.range = false;
34
+ }
35
+ /**
36
+ * Renders the component template.
37
+ *
38
+ * @returns {TemplateResult} The template result
39
+ */
40
+ render() {
41
+ const { hideLabel, range } = this;
42
+ return html `
43
+ <div class="${prefix}--date-picker-input-skeleton-container">
44
+ ${!hideLabel ? html `<span class="${prefix}--label"></span>` : null}
45
+ <div class="${prefix}--date-picker__input ${prefix}--skeleton"></div>
46
+ </div>
47
+ ${range
48
+ ? html `
49
+ <div class="${prefix}--date-picker-input-skeleton-container">
50
+ ${!hideLabel
51
+ ? html `<span class="${prefix}--label"></span>`
52
+ : null}
53
+ <div
54
+ class="${prefix}--date-picker__input ${prefix}--skeleton"></div>
55
+ </div>
56
+ `
57
+ : null}
58
+ `;
59
+ }
60
+ };
61
+ CDSDatePickerInputSkeleton.styles = styles;
62
+ __decorate([
63
+ property({ type: Boolean, reflect: true, attribute: 'hide-label' }),
64
+ __metadata("design:type", Object)
65
+ ], CDSDatePickerInputSkeleton.prototype, "hideLabel", void 0);
66
+ __decorate([
67
+ property({ reflect: true }),
68
+ __metadata("design:type", Object)
69
+ ], CDSDatePickerInputSkeleton.prototype, "kind", void 0);
70
+ __decorate([
71
+ property({ type: Boolean, reflect: true, attribute: 'range' }),
72
+ __metadata("design:type", Object)
73
+ ], CDSDatePickerInputSkeleton.prototype, "range", void 0);
74
+ CDSDatePickerInputSkeleton = __decorate([
75
+ carbonElement(`${prefix}-date-picker-input-skeleton`)
76
+ ], CDSDatePickerInputSkeleton);
77
+ //# sourceMappingURL=date-picker-input-skeleton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date-picker-input-skeleton.js","sources":["../../../../components/date-picker/date-picker-input-skeleton.ts"],"sourcesContent":[null],"names":["customElement"],"mappings":";;;;;;;;AAAA;;;;;AAKG;AAUH;;AAEG;AAEH,IAAM,0BAA0B,GAAhC,MAAM,0BAA2B,SAAQ,UAAU,CAAA;AAAnD,IAAA,WAAA,GAAA;;AACE;;AAEG;QAEH,IAAA,CAAA,SAAS,GAAG,KAAK;AAEjB;;;AAGG;AAEH,QAAA,IAAA,CAAA,IAAI,GAAG,sBAAsB,CAAC,MAAM;AAEpC;;AAEG;QAEH,IAAA,CAAA,KAAK,GAAG,KAAK;IA6Bf;AA3BE;;;;AAIG;IACH,MAAM,GAAA;AACJ,QAAA,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI;AACjC,QAAA,OAAO,IAAI,CAAA;oBACK,MAAM,CAAA;AAChB,QAAA,EAAA,CAAC,SAAS,GAAG,IAAI,CAAA,CAAA,aAAA,EAAgB,MAAM,CAAA,gBAAA,CAAkB,GAAG,IAAI;AACpD,oBAAA,EAAA,MAAM,wBAAwB,MAAM,CAAA;;QAElD;cACE,IAAI,CAAA;0BACY,MAAM,CAAA;AAChB,cAAA,EAAA,CAAC;AACD,kBAAE,IAAI,CAAA,CAAA,aAAA,EAAgB,MAAM,CAAA,gBAAA;AAC5B,kBAAE,IAAI;;AAEG,uBAAA,EAAA,MAAM,wBAAwB,MAAM,CAAA;;AAElD,UAAA;AACH,cAAE,IAAI;KACT;IACH;;AAEO,0BAAA,CAAA,MAAM,GAAG,MAAH;AAzCb,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE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