@api-client/ui 0.5.5 → 0.5.7

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 (114) hide show
  1. package/.cursor/rules/html-and-css-best-practices.mdc +63 -0
  2. package/.cursor/rules/lit-best-practices.mdc +78 -0
  3. package/.github/instructions/html-and-css-best-practices.instructions.md +70 -0
  4. package/.github/instructions/lit-best-practices.instructions.md +86 -0
  5. package/build/src/elements/currency/currency-picker.d.ts +10 -0
  6. package/build/src/elements/currency/currency-picker.d.ts.map +1 -0
  7. package/build/src/elements/currency/currency-picker.js +27 -0
  8. package/build/src/elements/currency/currency-picker.js.map +1 -0
  9. package/build/src/elements/currency/internals/Picker.d.ts +311 -0
  10. package/build/src/elements/currency/internals/Picker.d.ts.map +1 -0
  11. package/build/src/elements/currency/internals/Picker.js +857 -0
  12. package/build/src/elements/currency/internals/Picker.js.map +1 -0
  13. package/build/src/elements/currency/internals/Picker.styles.d.ts +3 -0
  14. package/build/src/elements/currency/internals/Picker.styles.d.ts.map +1 -0
  15. package/build/src/elements/currency/internals/Picker.styles.js +58 -0
  16. package/build/src/elements/currency/internals/Picker.styles.js.map +1 -0
  17. package/build/src/elements/highlight/MarkdownStyles.d.ts.map +1 -1
  18. package/build/src/elements/highlight/MarkdownStyles.js +0 -13
  19. package/build/src/elements/highlight/MarkdownStyles.js.map +1 -1
  20. package/build/src/elements/http/BodyEditor.d.ts +0 -13
  21. package/build/src/elements/http/BodyEditor.d.ts.map +1 -1
  22. package/build/src/elements/http/BodyEditor.js +0 -13
  23. package/build/src/elements/http/BodyEditor.js.map +1 -1
  24. package/build/src/elements/http/BodyTextEditor.d.ts +0 -13
  25. package/build/src/elements/http/BodyTextEditor.d.ts.map +1 -1
  26. package/build/src/elements/http/BodyTextEditor.js +0 -13
  27. package/build/src/elements/http/BodyTextEditor.js.map +1 -1
  28. package/build/src/elements/http/BodyUrlEncodedEditor.d.ts +0 -13
  29. package/build/src/elements/http/BodyUrlEncodedEditor.d.ts.map +1 -1
  30. package/build/src/elements/http/BodyUrlEncodedEditor.js +0 -13
  31. package/build/src/elements/http/BodyUrlEncodedEditor.js.map +1 -1
  32. package/build/src/elements/http/UrlInput.d.ts +0 -13
  33. package/build/src/elements/http/UrlInput.d.ts.map +1 -1
  34. package/build/src/elements/http/UrlInput.js +0 -13
  35. package/build/src/elements/http/UrlInput.js.map +1 -1
  36. package/build/src/index.d.ts +2 -0
  37. package/build/src/index.d.ts.map +1 -1
  38. package/build/src/index.js +2 -0
  39. package/build/src/index.js.map +1 -1
  40. package/build/src/md/button/internals/base.d.ts +1 -0
  41. package/build/src/md/button/internals/base.d.ts.map +1 -1
  42. package/build/src/md/button/internals/base.js +7 -0
  43. package/build/src/md/button/internals/base.js.map +1 -1
  44. package/build/src/md/button/internals/button.styles.js +1 -1
  45. package/build/src/md/button/internals/button.styles.js.map +1 -1
  46. package/build/src/md/date/internals/DateTime.d.ts +0 -13
  47. package/build/src/md/date/internals/DateTime.d.ts.map +1 -1
  48. package/build/src/md/date/internals/DateTime.js +0 -13
  49. package/build/src/md/date/internals/DateTime.js.map +1 -1
  50. package/build/src/md/date-picker/index.d.ts +13 -0
  51. package/build/src/md/date-picker/index.d.ts.map +1 -0
  52. package/build/src/md/date-picker/index.js +13 -0
  53. package/build/src/md/date-picker/index.js.map +1 -0
  54. package/build/src/md/date-picker/internals/DatePicker.styles.d.ts +4 -0
  55. package/build/src/md/date-picker/internals/DatePicker.styles.d.ts.map +1 -0
  56. package/build/src/md/date-picker/internals/DatePicker.styles.js +409 -0
  57. package/build/src/md/date-picker/internals/DatePicker.styles.js.map +1 -0
  58. package/build/src/md/date-picker/internals/DatePickerCalendar.d.ts +272 -0
  59. package/build/src/md/date-picker/internals/DatePickerCalendar.d.ts.map +1 -0
  60. package/build/src/md/date-picker/internals/DatePickerCalendar.js +1062 -0
  61. package/build/src/md/date-picker/internals/DatePickerCalendar.js.map +1 -0
  62. package/build/src/md/date-picker/internals/DatePickerUtils.d.ts +93 -0
  63. package/build/src/md/date-picker/internals/DatePickerUtils.d.ts.map +1 -0
  64. package/build/src/md/date-picker/internals/DatePickerUtils.js +221 -0
  65. package/build/src/md/date-picker/internals/DatePickerUtils.js.map +1 -0
  66. package/build/src/md/date-picker/ui-date-picker-input.d.ts +160 -0
  67. package/build/src/md/date-picker/ui-date-picker-input.d.ts.map +1 -0
  68. package/build/src/md/date-picker/ui-date-picker-input.js +464 -0
  69. package/build/src/md/date-picker/ui-date-picker-input.js.map +1 -0
  70. package/build/src/md/date-picker/ui-date-picker-modal-input.d.ts +178 -0
  71. package/build/src/md/date-picker/ui-date-picker-modal-input.d.ts.map +1 -0
  72. package/build/src/md/date-picker/ui-date-picker-modal-input.js +538 -0
  73. package/build/src/md/date-picker/ui-date-picker-modal-input.js.map +1 -0
  74. package/build/src/md/date-picker/ui-date-picker-modal.d.ts +156 -0
  75. package/build/src/md/date-picker/ui-date-picker-modal.d.ts.map +1 -0
  76. package/build/src/md/date-picker/ui-date-picker-modal.js +423 -0
  77. package/build/src/md/date-picker/ui-date-picker-modal.js.map +1 -0
  78. package/build/src/md/dialog/internals/Dialog.styles.d.ts.map +1 -1
  79. package/build/src/md/dialog/internals/Dialog.styles.js +1 -0
  80. package/build/src/md/dialog/internals/Dialog.styles.js.map +1 -1
  81. package/demo/elements/currency/index.html +91 -0
  82. package/demo/elements/currency/index.ts +272 -0
  83. package/demo/elements/har/har2.json +1 -1
  84. package/demo/elements/index.html +3 -0
  85. package/demo/md/date-picker/date-picker.ts +336 -0
  86. package/demo/md/date-picker/index.html +171 -0
  87. package/demo/md/index.html +2 -0
  88. package/package.json +1 -1
  89. package/src/elements/currency/currency-picker.ts +14 -0
  90. package/src/elements/currency/internals/Picker.styles.ts +58 -0
  91. package/src/elements/currency/internals/Picker.ts +846 -0
  92. package/src/elements/highlight/MarkdownStyles.ts +0 -13
  93. package/src/elements/http/BodyEditor.ts +0 -13
  94. package/src/elements/http/BodyTextEditor.ts +0 -13
  95. package/src/elements/http/BodyUrlEncodedEditor.ts +0 -13
  96. package/src/elements/http/UrlInput.ts +0 -13
  97. package/src/index.ts +17 -0
  98. package/src/md/button/internals/base.ts +7 -0
  99. package/src/md/button/internals/button.styles.ts +1 -1
  100. package/src/md/date/internals/DateTime.ts +0 -14
  101. package/src/md/date-picker/README.md +184 -0
  102. package/src/md/date-picker/index.ts +17 -0
  103. package/src/md/date-picker/internals/DatePicker.styles.ts +411 -0
  104. package/src/md/date-picker/internals/DatePickerCalendar.ts +1031 -0
  105. package/src/md/date-picker/internals/DatePickerUtils.ts +288 -0
  106. package/src/md/date-picker/ui-date-picker-input.ts +333 -0
  107. package/src/md/date-picker/ui-date-picker-modal-input.ts +440 -0
  108. package/src/md/date-picker/ui-date-picker-modal.ts +346 -0
  109. package/src/md/dialog/internals/Dialog.styles.ts +1 -0
  110. package/test/README.md +3 -2
  111. package/test/elements/currency/CurrencyPicker.accessibility.test.ts +328 -0
  112. package/test/elements/currency/CurrencyPicker.core.test.ts +318 -0
  113. package/test/elements/currency/CurrencyPicker.integration.test.ts +482 -0
  114. package/test/elements/currency/CurrencyPicker.test.ts +486 -0
@@ -1,17 +1,4 @@
1
1
  /**
2
- @license
3
- Copyright 2016 The Advanced REST client authors <arc@mulesoft.com>
4
- Licensed under the Apache License, Version 2.0 (the "License"); you may not
5
- use this file except in compliance with the License. You may obtain a copy of
6
- the License at
7
- http://www.apache.org/licenses/LICENSE-2.0
8
- Unless required by applicable law or agreed to in writing, software
9
- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11
- License for the specific language governing permissions and limitations under
12
- the License.
13
- */
14
- /**
15
2
  ## Styles for markdown viewer
16
3
 
17
4
  It should be included where the `marked-highlight` is used.
@@ -1,16 +1,3 @@
1
- /**
2
- @license
3
- Copyright 2020 The Advanced REST client authors <arc@mulesoft.com>
4
- Licensed under the Apache License, Version 2.0 (the "License"); you may not
5
- use this file except in compliance with the License. You may obtain a copy of
6
- the License at
7
- http://www.apache.org/licenses/LICENSE-2.0
8
- Unless required by applicable law or agreed to in writing, software
9
- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11
- License for the specific language governing permissions and limitations under
12
- the License.
13
- */
14
1
  import { html, TemplateResult, PropertyValues, nothing } from 'lit'
15
2
  import { property, query } from 'lit/decorators.js'
16
3
  import type { IBodyMetaModel, IRawBody, IUrlEncodedBodyMeta } from '@api-client/core/models/RequestUiMeta.js'
@@ -1,17 +1,4 @@
1
1
  /* eslint-disable @typescript-eslint/ban-ts-comment */
2
- /**
3
- @license
4
- Copyright 2018 The Advanced REST client authors <arc@mulesoft.com>
5
- Licensed under the Apache License, Version 2.0 (the "License"); you may not
6
- use this file except in compliance with the License. You may obtain a copy of
7
- the License at
8
- http://www.apache.org/licenses/LICENSE-2.0
9
- Unless required by applicable law or agreed to in writing, software
10
- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
- License for the specific language governing permissions and limitations under
13
- the License.
14
- */
15
2
  import { html, nothing, TemplateResult } from 'lit'
16
3
  import { property, query } from 'lit/decorators.js'
17
4
  // import * as monaco from 'monaco-editor'; // /esm/vs/editor/editor.main.js
@@ -1,16 +1,3 @@
1
- /**
2
- @license
3
- Copyright 2020 The Advanced REST client authors <arc@mulesoft.com>
4
- Licensed under the Apache License, Version 2.0 (the "License"); you may not
5
- use this file except in compliance with the License. You may obtain a copy of
6
- the License at
7
- http://www.apache.org/licenses/LICENSE-2.0
8
- Unless required by applicable law or agreed to in writing, software
9
- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11
- License for the specific language governing permissions and limitations under
12
- the License.
13
- */
14
1
  import { html, TemplateResult, PropertyValues, nothing } from 'lit'
15
2
  import { property } from 'lit/decorators.js'
16
3
  import { live } from 'lit/directives/live.js'
@@ -1,16 +1,3 @@
1
- /**
2
- @license
3
- Copyright 2018 The Advanced REST client authors <arc@mulesoft.com>
4
- Licensed under the Apache License, Version 2.0 (the "License"); you may not
5
- use this file except in compliance with the License. You may obtain a copy of
6
- the License at
7
- http://www.apache.org/licenses/LICENSE-2.0
8
- Unless required by applicable law or agreed to in writing, software
9
- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11
- License for the specific language governing permissions and limitations under
12
- the License.
13
- */
14
1
  import { html, TemplateResult } from 'lit'
15
2
  import { classMap } from 'lit/directives/class-map.js'
16
3
  import { StyleInfo, styleMap } from 'lit/directives/style-map.js'
package/src/index.ts CHANGED
@@ -9,6 +9,23 @@ export { default as Menu } from './md/menu/internal/Menu.js'
9
9
  export { default as MenuItem } from './md/menu/internal/MenuItem.js'
10
10
  export { default as SubMenu } from './md/menu/internal/SubMenu.js'
11
11
 
12
+ // Date Picker Components
13
+ export {
14
+ UiDatePickerCalendar,
15
+ UiDatePickerInput,
16
+ UiDatePickerModal,
17
+ UiDatePickerModalInput,
18
+ } from './md/date-picker/index.js'
19
+ export type {
20
+ DateRange,
21
+ CalendarDay,
22
+ CalendarMonth,
23
+ DateSelectEvent,
24
+ DateRangeSelectEvent,
25
+ ModalDatePickerChangeEvent,
26
+ ModalInputDatePickerChangeEvent,
27
+ } from './md/date-picker/index.js'
28
+
12
29
  // Demo
13
30
  export { DemoPage } from './demo/DemoPage.js'
14
31
 
@@ -234,6 +234,8 @@ export default class BaseButton extends UiElement {
234
234
  const allowedReasons = reason === 'enter' || reason === 'space'
235
235
  if (this.type === 'submit' && (!reason || allowedReasons)) {
236
236
  this.handleSubmit()
237
+ } else if (this.type === 'reset' && (!reason || allowedReasons)) {
238
+ this.handleReset()
237
239
  } else if (allowedReasons) {
238
240
  this.click()
239
241
  }
@@ -337,6 +339,11 @@ export default class BaseButton extends UiElement {
337
339
  }
338
340
  }
339
341
 
342
+ protected handleReset(): void {
343
+ const form = this.form as HTMLFormElement
344
+ form?.reset()
345
+ }
346
+
340
347
  override handlePointerEnter(e: PointerEvent): void {
341
348
  super.handlePointerEnter(e)
342
349
  this.ripple?.beginHover(e)
@@ -269,7 +269,7 @@ export default css`
269
269
 
270
270
  /* Outlined Button */
271
271
  :host([color='outlined']) {
272
- border: 1px var(--md-sys-color-outline-variant) solid;
272
+ border: 1px var(--md-button-outline-color, var(--md-sys-color-outline-variant)) solid;
273
273
  --_color: var(--md-sys-color-on-surface-variant);
274
274
  }
275
275
 
@@ -1,17 +1,3 @@
1
- /**
2
- @license
3
- Copyright 2016 The Advanced REST client authors <arc@mulesoft.com>
4
- Licensed under the Apache License, Version 2.0 (the "License"); you may not
5
- use this file except in compliance with the License. You may obtain a copy of
6
- the License at
7
- http://www.apache.org/licenses/LICENSE-2.0
8
- Unless required by applicable law or agreed to in writing, software
9
- distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
10
- WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
11
- License for the specific language governing permissions and limitations under
12
- the License.
13
- */
14
-
15
1
  export type DateTimeTextOptions = 'long' | 'short' | 'narrow'
16
2
  export type DateTimeNumberOptions = 'numeric' | '2-digit'
17
3
  export type DateTimeTimezoneOptions = 'long' | 'short'
@@ -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'