@api-client/ui 0.5.5 → 0.5.6

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 (82) hide show
  1. package/build/src/elements/highlight/MarkdownStyles.d.ts.map +1 -1
  2. package/build/src/elements/highlight/MarkdownStyles.js +0 -13
  3. package/build/src/elements/highlight/MarkdownStyles.js.map +1 -1
  4. package/build/src/elements/http/BodyEditor.d.ts +0 -13
  5. package/build/src/elements/http/BodyEditor.d.ts.map +1 -1
  6. package/build/src/elements/http/BodyEditor.js +0 -13
  7. package/build/src/elements/http/BodyEditor.js.map +1 -1
  8. package/build/src/elements/http/BodyTextEditor.d.ts +0 -13
  9. package/build/src/elements/http/BodyTextEditor.d.ts.map +1 -1
  10. package/build/src/elements/http/BodyTextEditor.js +0 -13
  11. package/build/src/elements/http/BodyTextEditor.js.map +1 -1
  12. package/build/src/elements/http/BodyUrlEncodedEditor.d.ts +0 -13
  13. package/build/src/elements/http/BodyUrlEncodedEditor.d.ts.map +1 -1
  14. package/build/src/elements/http/BodyUrlEncodedEditor.js +0 -13
  15. package/build/src/elements/http/BodyUrlEncodedEditor.js.map +1 -1
  16. package/build/src/elements/http/UrlInput.d.ts +0 -13
  17. package/build/src/elements/http/UrlInput.d.ts.map +1 -1
  18. package/build/src/elements/http/UrlInput.js +0 -13
  19. package/build/src/elements/http/UrlInput.js.map +1 -1
  20. package/build/src/index.d.ts +2 -0
  21. package/build/src/index.d.ts.map +1 -1
  22. package/build/src/index.js +2 -0
  23. package/build/src/index.js.map +1 -1
  24. package/build/src/md/button/internals/button.styles.js +1 -1
  25. package/build/src/md/button/internals/button.styles.js.map +1 -1
  26. package/build/src/md/date/internals/DateTime.d.ts +0 -13
  27. package/build/src/md/date/internals/DateTime.d.ts.map +1 -1
  28. package/build/src/md/date/internals/DateTime.js +0 -13
  29. package/build/src/md/date/internals/DateTime.js.map +1 -1
  30. package/build/src/md/date-picker/index.d.ts +13 -0
  31. package/build/src/md/date-picker/index.d.ts.map +1 -0
  32. package/build/src/md/date-picker/index.js +13 -0
  33. package/build/src/md/date-picker/index.js.map +1 -0
  34. package/build/src/md/date-picker/internals/DatePicker.styles.d.ts +4 -0
  35. package/build/src/md/date-picker/internals/DatePicker.styles.d.ts.map +1 -0
  36. package/build/src/md/date-picker/internals/DatePicker.styles.js +336 -0
  37. package/build/src/md/date-picker/internals/DatePicker.styles.js.map +1 -0
  38. package/build/src/md/date-picker/internals/DatePickerCalendar.d.ts +159 -0
  39. package/build/src/md/date-picker/internals/DatePickerCalendar.d.ts.map +1 -0
  40. package/build/src/md/date-picker/internals/DatePickerCalendar.js +770 -0
  41. package/build/src/md/date-picker/internals/DatePickerCalendar.js.map +1 -0
  42. package/build/src/md/date-picker/internals/DatePickerUtils.d.ts +93 -0
  43. package/build/src/md/date-picker/internals/DatePickerUtils.d.ts.map +1 -0
  44. package/build/src/md/date-picker/internals/DatePickerUtils.js +221 -0
  45. package/build/src/md/date-picker/internals/DatePickerUtils.js.map +1 -0
  46. package/build/src/md/date-picker/ui-date-picker-input.d.ts +108 -0
  47. package/build/src/md/date-picker/ui-date-picker-input.d.ts.map +1 -0
  48. package/build/src/md/date-picker/ui-date-picker-input.js +397 -0
  49. package/build/src/md/date-picker/ui-date-picker-input.js.map +1 -0
  50. package/build/src/md/date-picker/ui-date-picker-modal-input.d.ts +119 -0
  51. package/build/src/md/date-picker/ui-date-picker-modal-input.d.ts.map +1 -0
  52. package/build/src/md/date-picker/ui-date-picker-modal-input.js +473 -0
  53. package/build/src/md/date-picker/ui-date-picker-modal-input.js.map +1 -0
  54. package/build/src/md/date-picker/ui-date-picker-modal.d.ts +108 -0
  55. package/build/src/md/date-picker/ui-date-picker-modal.d.ts.map +1 -0
  56. package/build/src/md/date-picker/ui-date-picker-modal.js +344 -0
  57. package/build/src/md/date-picker/ui-date-picker-modal.js.map +1 -0
  58. package/build/src/md/dialog/internals/Dialog.styles.d.ts.map +1 -1
  59. package/build/src/md/dialog/internals/Dialog.styles.js +1 -0
  60. package/build/src/md/dialog/internals/Dialog.styles.js.map +1 -1
  61. package/demo/elements/har/har2.json +1 -1
  62. package/demo/md/date-picker/date-picker.ts +301 -0
  63. package/demo/md/date-picker/index.html +171 -0
  64. package/demo/md/index.html +2 -0
  65. package/package.json +1 -1
  66. package/src/elements/highlight/MarkdownStyles.ts +0 -13
  67. package/src/elements/http/BodyEditor.ts +0 -13
  68. package/src/elements/http/BodyTextEditor.ts +0 -13
  69. package/src/elements/http/BodyUrlEncodedEditor.ts +0 -13
  70. package/src/elements/http/UrlInput.ts +0 -13
  71. package/src/index.ts +17 -0
  72. package/src/md/button/internals/button.styles.ts +1 -1
  73. package/src/md/date/internals/DateTime.ts +0 -14
  74. package/src/md/date-picker/README.md +184 -0
  75. package/src/md/date-picker/index.ts +17 -0
  76. package/src/md/date-picker/internals/DatePicker.styles.ts +338 -0
  77. package/src/md/date-picker/internals/DatePickerCalendar.ts +697 -0
  78. package/src/md/date-picker/internals/DatePickerUtils.ts +288 -0
  79. package/src/md/date-picker/ui-date-picker-input.ts +272 -0
  80. package/src/md/date-picker/ui-date-picker-modal-input.ts +371 -0
  81. package/src/md/date-picker/ui-date-picker-modal.ts +263 -0
  82. package/src/md/dialog/internals/Dialog.styles.ts +1 -0
@@ -0,0 +1,184 @@
1
+ # Date Picker Components
2
+
3
+ A comprehensive Material Design 3 styled date picker system with three variants to suit different use cases and screen sizes.
4
+
5
+ ## Components
6
+
7
+ ### 1. Docked Date Picker (`ui-date-picker-input`)
8
+
9
+ A text field with dropdown calendar, ideal for forms and medium to large layouts.
10
+
11
+ ```html
12
+ <ui-date-picker-input
13
+ label="Select date"
14
+ placeholder="MM/DD/YYYY"
15
+ .value=${new Date()}
16
+ @change=${this.handleDateChange}
17
+ ></ui-date-picker-input>
18
+ ```
19
+
20
+ **Features:**
21
+
22
+ - Text input with calendar dropdown
23
+ - Keyboard and mouse input support
24
+ - Form integration
25
+ - Customizable date formatting
26
+
27
+ ### 2. Modal Date Picker (`ui-date-picker-modal`)
28
+
29
+ Full-screen modal for date range selection, perfect for booking interfaces.
30
+
31
+ ```html
32
+ <ui-date-picker-modal
33
+ .open=${true}
34
+ .selectedRange=${{ start: new Date(), end: null }}
35
+ title="Select travel dates"
36
+ startLabel="Check-in"
37
+ endLabel="Check-out"
38
+ @date-range-change=${this.handleRangeChange}
39
+ @close=${this.handleClose}
40
+ ></ui-date-picker-modal>
41
+ ```
42
+
43
+ **Features:**
44
+
45
+ - Full-screen modal interface
46
+ - Date range selection
47
+ - Calendar/input mode toggle
48
+ - Mobile-optimized
49
+
50
+ ### 3. Modal Input Date Picker (`ui-date-picker-modal-input`)
51
+
52
+ Manual date entry using keyboard input, ideal for compact layouts.
53
+
54
+ ```html
55
+ <ui-date-picker-modal-input
56
+ .open=${true}
57
+ .rangeMode=${true}
58
+ .selectedRange=${{ start: null, end: null }}
59
+ @date-input-change=${this.handleInputChange}
60
+ @modal-input-close=${this.handleClose}
61
+ ></ui-date-picker-modal-input>
62
+ ```
63
+
64
+ **Features:**
65
+
66
+ - Keyboard-focused input
67
+ - Single date or range mode
68
+ - Multiple date format support
69
+ - Validation and error handling
70
+
71
+ ## Calendar Component (`ui-date-picker-calendar`)
72
+
73
+ The underlying calendar grid component used by other pickers.
74
+
75
+ ```html
76
+ <ui-date-picker-calendar
77
+ .selectedDate=${new Date()}
78
+ .rangeSelection=${false}
79
+ @date-select=${this.handleDateSelect}
80
+ ></ui-date-picker-calendar>
81
+ ```
82
+
83
+ ## Utility Functions
84
+
85
+ The `DatePickerUtils` module provides helper functions for date operations:
86
+
87
+ ```javascript
88
+ import {
89
+ formatDate,
90
+ parseDate,
91
+ generateCalendarMonth,
92
+ isSameDay,
93
+ addMonths
94
+ } from './internals/DatePickerUtils.js'
95
+
96
+ // Format a date
97
+ const formatted = formatDate(new Date(), 'en-US')
98
+
99
+ // Parse user input
100
+ const date = parseDate('12/25/2024')
101
+
102
+ // Generate calendar data
103
+ const calendar = generateCalendarMonth(2024, 11) // December 2024
104
+ ```
105
+
106
+ ## Common Properties
107
+
108
+ ### Date Constraints
109
+
110
+ ```html
111
+ <!-- Minimum and maximum dates -->
112
+ <ui-date-picker-input
113
+ .minDate=${new Date('2024-01-01')}
114
+ .maxDate=${new Date('2024-12-31')}
115
+ ></ui-date-picker-input>
116
+
117
+ <!-- Disabled specific dates -->
118
+ <ui-date-picker-input
119
+ .disabledDates=${[new Date('2024-12-25'), new Date('2024-01-01')]}
120
+ ></ui-date-picker-input>
121
+ ```
122
+
123
+ ### Localization
124
+
125
+ ```html
126
+ <!-- Custom locale -->
127
+ <ui-date-picker-input
128
+ locale="en-GB"
129
+ .dateFormat=${date => date.toLocaleDateString('en-GB')}
130
+ ></ui-date-picker-input>
131
+ ```
132
+
133
+ ## Styling
134
+
135
+ All components follow Material Design 3 guidelines and respect CSS custom properties:
136
+
137
+ ```css
138
+ :root {
139
+ --ui-color-primary: #6750a4;
140
+ --ui-color-surface: #fff;
141
+ --ui-color-on-surface: #1d1b20;
142
+ --ui-border-radius-medium: 12px;
143
+ --ui-elevation-level2: 0 2px 8px rgba(0,0,0,0.15);
144
+ }
145
+ ```
146
+
147
+ ## Accessibility
148
+
149
+ - Full keyboard navigation support
150
+ - ARIA labels and roles
151
+ - Screen reader compatible
152
+ - Focus management
153
+ - High contrast support
154
+
155
+ ## Browser Support
156
+
157
+ - Modern browsers with ES2015+ support
158
+ - Chrome 88+, Firefox 78+, Safari 14+, Edge 88+
159
+ - Mobile browsers on iOS 14+ and Android 7+
160
+
161
+ ## Events
162
+
163
+ ### Docked Date Picker
164
+
165
+ - `change`: Fired when date selection changes
166
+
167
+ ### Modal Date Picker
168
+
169
+ - `date-range-change`: Fired when date range changes
170
+ - `close`: Fired when modal closes
171
+
172
+ ### Modal Input Date Picker
173
+
174
+ - `date-input-change`: Fired when input values change
175
+ - `modal-input-close`: Fired when modal closes
176
+
177
+ ### Calendar Component
178
+
179
+ - `date-select`: Fired when single date is selected
180
+ - `date-range-select`: Fired when date range is selected
181
+
182
+ ## Examples
183
+
184
+ See the demo files in `/demo/md/date-picker/` for complete usage examples.
@@ -0,0 +1,17 @@
1
+ // Export main components
2
+ export { UiDatePickerCalendar } from './internals/DatePickerCalendar.js'
3
+ export { UiDatePickerInput } from './ui-date-picker-input.js'
4
+ export { UiDatePickerModal } from './ui-date-picker-modal.js'
5
+ export { UiDatePickerModalInput } from './ui-date-picker-modal-input.js'
6
+
7
+ // Export utilities and types
8
+ export * from './internals/DatePickerUtils.js'
9
+ export type { DateSelectEvent, DateRangeSelectEvent } from './internals/DatePickerCalendar.js'
10
+ export type { ModalDatePickerChangeEvent } from './ui-date-picker-modal.js'
11
+ export type { ModalInputDatePickerChangeEvent } from './ui-date-picker-modal-input.js'
12
+
13
+ // Import components for registration
14
+ import './ui-date-picker-input.js'
15
+ import './ui-date-picker-modal.js'
16
+ import './ui-date-picker-modal-input.js'
17
+ import './internals/DatePickerCalendar.js'
@@ -0,0 +1,338 @@
1
+ import { css } from 'lit'
2
+
3
+ export const calendarStyles = css`
4
+ :host {
5
+ display: block;
6
+ font-family: 'Roboto', sans-serif;
7
+ font-size: 14px;
8
+ border-radius: 12px;
9
+ background: var(--md-sys-color-surface-container-high);
10
+ border: 1px solid var(--md-sys-color-outline-variant);
11
+ box-shadow: var(--md-sys-elevation-2);
12
+ overflow: hidden;
13
+ }
14
+
15
+ .calendar {
16
+ padding: 20px 12px 12px 12px;
17
+ }
18
+
19
+ /* Header */
20
+ .header {
21
+ display: flex;
22
+ align-items: center;
23
+ justify-content: space-between;
24
+ margin-bottom: 30px;
25
+ gap: 8px;
26
+ }
27
+
28
+ .month-year {
29
+ display: flex;
30
+ align-items: center;
31
+ flex: 1;
32
+ justify-content: space-between;
33
+ }
34
+
35
+ .month-selector,
36
+ .year-selector {
37
+ display: flex;
38
+ align-items: center;
39
+ }
40
+
41
+ .month-year-text {
42
+ font-size: 16px;
43
+ font-weight: 500;
44
+ color: var(--md-sys-color-on-surface);
45
+ min-width: 120px;
46
+ }
47
+
48
+ /* Weekdays header */
49
+ .weekdays {
50
+ display: grid;
51
+ grid-template-columns: repeat(7, 40px);
52
+ margin-bottom: 16px;
53
+ }
54
+
55
+ .weekday {
56
+ display: flex;
57
+ align-items: center;
58
+ justify-content: center;
59
+ height: 32px;
60
+ font-size: 12px;
61
+ font-weight: 500;
62
+ color: var(--md-sys-color-on-surface-variant);
63
+ text-transform: uppercase;
64
+ }
65
+
66
+ /* Calendar grid */
67
+ .days {
68
+ display: grid;
69
+ grid-template-columns: repeat(7, 40px);
70
+ gap: 0;
71
+ }
72
+
73
+ .day-cell {
74
+ display: flex;
75
+ align-items: center;
76
+ justify-content: center;
77
+ position: relative;
78
+ width: 40px;
79
+ }
80
+
81
+ .day-cell.in-range.has-complete-range {
82
+ background: var(--md-sys-color-secondary-container);
83
+ }
84
+
85
+ .day-cell.range-start.has-complete-range:not(.range-end) {
86
+ background: linear-gradient(to right, transparent 50%, var(--md-sys-color-secondary-container) 50%);
87
+ }
88
+
89
+ .day-cell.range-end.has-complete-range:not(.range-start) {
90
+ background: linear-gradient(to left, transparent 50%, var(--md-sys-color-secondary-container) 50%);
91
+ }
92
+
93
+ .day-cell.range-start.range-end.has-complete-range {
94
+ background: transparent;
95
+ }
96
+
97
+ .day-button {
98
+ width: 40px !important;
99
+ height: 40px !important;
100
+ min-width: 40px !important;
101
+ padding: 0;
102
+ }
103
+
104
+ .day-button.other-month {
105
+ opacity: 0.38;
106
+ }
107
+
108
+ .nav-button,
109
+ .month-button,
110
+ .year-button,
111
+ .other-month .day-button:not([color='filled']):not([disabled]) {
112
+ color: var(--md-sys-color-on-surface-variant);
113
+ }
114
+
115
+ .month-button,
116
+ .year-button {
117
+ padding: 0;
118
+ }
119
+
120
+ .weekday:not([color='filled']),
121
+ .day-button:not([color='filled']):not([disabled]) {
122
+ color: var(--md-sys-color-on-surface);
123
+ }
124
+
125
+ .today .day-button:not([color='filled']) {
126
+ color: var(--md-sys-color-primary);
127
+ }
128
+
129
+ .today .day-button {
130
+ --md-button-outline-color: var(--md-sys-color-primary);
131
+ }
132
+
133
+ /* Dropdown views */
134
+ .dropdown-view {
135
+ min-height: 300px;
136
+ }
137
+
138
+ .close-button {
139
+ display: flex;
140
+ align-items: center;
141
+ justify-content: center;
142
+ width: 32px;
143
+ height: 32px;
144
+ border: none;
145
+ background: transparent;
146
+ color: var(--md-sys-color-on-surface-variant);
147
+ cursor: pointer;
148
+ border-radius: 16px;
149
+ transition: background-color 0.2s ease;
150
+ }
151
+
152
+ .close-button:hover {
153
+ background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent);
154
+ }
155
+
156
+ .close-button:focus {
157
+ outline: none;
158
+ background: color-mix(in srgb, var(--md-sys-color-on-surface) 12%, transparent);
159
+ }
160
+
161
+ /* Month dropdown */
162
+ .month-list {
163
+ display: grid;
164
+ grid-template-columns: repeat(3, 1fr);
165
+ gap: 8px;
166
+ }
167
+
168
+ .year-option:not(.selected),
169
+ .month-option:not(.selected) {
170
+ color: var(--md-sys-color-on-surface-variant);
171
+ }
172
+
173
+ /* Year dropdown */
174
+ .year-grid {
175
+ display: grid;
176
+ grid-template-columns: repeat(4, 1fr);
177
+ gap: 4px;
178
+ max-height: 240px;
179
+ overflow-y: auto;
180
+ padding: 4px;
181
+ }
182
+
183
+ .actions {
184
+ margin-top: 8px;
185
+ display: flex;
186
+ justify-content: flex-end;
187
+ }
188
+ `
189
+
190
+ export const inputStyles = css`
191
+ :host {
192
+ display: inline-block;
193
+ width: 100%;
194
+ }
195
+
196
+ .input-container {
197
+ position: relative;
198
+ }
199
+
200
+ .dropdown-container {
201
+ position: absolute;
202
+ position-anchor: --ui-date-picker-anchor;
203
+ top: anchor(bottom);
204
+ left: anchor(left);
205
+ z-index: 1000;
206
+ margin-top: 4px;
207
+ min-width: anchor-size(width);
208
+ width: max-content;
209
+ max-width: calc(100vw - 32px);
210
+ }
211
+
212
+ .backdrop {
213
+ position: fixed;
214
+ top: 0;
215
+ left: 0;
216
+ right: 0;
217
+ bottom: 0;
218
+ z-index: 999;
219
+ background: transparent;
220
+ }
221
+ `
222
+
223
+ export const modalStyles = css`
224
+ .modal-header {
225
+ display: flex;
226
+ align-items: center;
227
+ justify-content: space-between;
228
+ padding: 24px 24px 16px;
229
+ }
230
+
231
+ .modal-title {
232
+ font-size: 24px;
233
+ font-weight: 400;
234
+ color: var(--md-sys-color-on-surface);
235
+ margin: 0;
236
+ }
237
+
238
+ .modal-content {
239
+ display: flex;
240
+ flex-direction: column;
241
+ align-items: center;
242
+ gap: 24px;
243
+ max-height: 60vh;
244
+ overflow-y: auto;
245
+ }
246
+
247
+ .modal-content ui-date-picker-calendar {
248
+ box-shadow: none;
249
+ }
250
+
251
+ .date-range-display {
252
+ display: flex;
253
+ align-items: center;
254
+ gap: 16px;
255
+ padding: 16px;
256
+ background: var(--md-sys-color-surface-container-highest);
257
+ border-radius: 12px;
258
+ width: 100%;
259
+ max-width: 320px;
260
+ }
261
+
262
+ .date-display {
263
+ flex: 1;
264
+ text-align: center;
265
+ }
266
+
267
+ .date-label {
268
+ font-size: 12px;
269
+ font-weight: 500;
270
+ color: var(--md-sys-color-on-surface-variant);
271
+ text-transform: uppercase;
272
+ margin-bottom: 4px;
273
+ }
274
+
275
+ .date-value {
276
+ font-size: 16px;
277
+ font-weight: 400;
278
+ color: var(--md-sys-color-on-surface);
279
+ }
280
+
281
+ .date-separator {
282
+ color: var(--md-sys-color-on-surface-variant);
283
+ font-size: 18px;
284
+ }
285
+
286
+ .modal-actions {
287
+ display: flex;
288
+ justify-content: flex-end;
289
+ gap: 8px;
290
+ padding: 16px 24px;
291
+ border-top: 1px solid var(--md-sys-color-outline-variant);
292
+ }
293
+
294
+ /* Calendar Action Buttons */
295
+ .actions {
296
+ display: flex;
297
+ justify-content: flex-end;
298
+ gap: 8px;
299
+ margin-top: 16px;
300
+ padding-top: 16px;
301
+ border-top: 1px solid var(--md-sys-color-outline-variant);
302
+ }
303
+
304
+ /* Pending selection state */
305
+ .day.pending {
306
+ background: var(--md-sys-color-secondary-container);
307
+ color: var(--md-sys-color-on-secondary-container);
308
+ border: 2px solid var(--md-sys-color-secondary);
309
+ }
310
+
311
+ .day.pending.selected {
312
+ background: var(--md-sys-color-secondary);
313
+ color: var(--md-sys-color-on-secondary);
314
+ }
315
+
316
+ .day.pending.range-start,
317
+ .day.pending.range-end {
318
+ background: var(--md-sys-color-secondary);
319
+ color: var(--md-sys-color-on-secondary);
320
+ }
321
+
322
+ .day.pending.in-range {
323
+ background: var(--md-sys-color-secondary-container);
324
+ color: var(--md-sys-color-on-secondary-container);
325
+ }
326
+
327
+ /* Responsive */
328
+ @media (max-width: 640px) {
329
+ .modal-content {
330
+ padding: 16px;
331
+ }
332
+
333
+ .calendar {
334
+ width: 100%;
335
+ max-width: 320px;
336
+ }
337
+ }
338
+ `