@api-client/ui 0.5.38 → 0.5.40

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 (299) hide show
  1. package/build/src/md/list/internals/ListItem.d.ts +24 -15
  2. package/build/src/md/list/internals/ListItem.d.ts.map +1 -1
  3. package/build/src/md/list/internals/ListItem.js +85 -59
  4. package/build/src/md/list/internals/ListItem.js.map +1 -1
  5. package/build/src/md/list/internals/ListItem.styles.js +11 -11
  6. package/build/src/md/list/internals/ListItem.styles.js.map +1 -1
  7. package/build/src/md/select/internals/Option.d.ts +4 -14
  8. package/build/src/md/select/internals/Option.d.ts.map +1 -1
  9. package/build/src/md/select/internals/Option.js +13 -28
  10. package/build/src/md/select/internals/Option.js.map +1 -1
  11. package/build/src/md/select/internals/Select.d.ts +1 -1
  12. package/build/src/md/select/internals/Select.d.ts.map +1 -1
  13. package/build/src/md/select/internals/Select.js +15 -5
  14. package/build/src/md/select/internals/Select.js.map +1 -1
  15. package/build/tsconfig.tsbuildinfo +1 -0
  16. package/package.json +1 -1
  17. package/src/md/list/internals/ListItem.styles.ts +11 -11
  18. package/src/md/list/internals/ListItem.ts +68 -43
  19. package/src/md/select/internals/Option.ts +14 -26
  20. package/src/md/select/internals/Select.ts +15 -5
  21. package/.aiexclude +0 -3
  22. package/.cursor/rules/html-and-css-best-practices.mdc +0 -63
  23. package/.cursor/rules/lit-best-practices.mdc +0 -89
  24. package/.editorconfig +0 -29
  25. package/.github/CONTRIBUTING.md +0 -24
  26. package/.github/instructions/html-and-css-best-practices.instructions.md +0 -70
  27. package/.github/instructions/lit-best-practices.instructions.md +0 -90
  28. package/.github/release.yml +0 -14
  29. package/.github/stale.yml +0 -23
  30. package/.github/workflows/auto-release.yml +0 -182
  31. package/.github/workflows/release.yml +0 -82
  32. package/.prettierrc.js +0 -14
  33. package/.vscode/settings.json +0 -18
  34. package/RELEASE.md +0 -163
  35. package/RELEASE_SETUP.md +0 -235
  36. package/build/src/demo/DemoPage.d.ts +0 -81
  37. package/build/src/demo/DemoPage.d.ts.map +0 -1
  38. package/build/src/demo/DemoPage.js +0 -175
  39. package/build/src/demo/DemoPage.js.map +0 -1
  40. package/build/src/demo/DemoStyles.d.ts +0 -3
  41. package/build/src/demo/DemoStyles.d.ts.map +0 -1
  42. package/build/src/demo/DemoStyles.js +0 -60
  43. package/build/src/demo/DemoStyles.js.map +0 -1
  44. package/build/test/elements/navigation/Navigation.test.d.ts +0 -3
  45. package/build/test/elements/navigation/Navigation.test.d.ts.map +0 -1
  46. package/build/test/elements/navigation/Navigation.test.js +0 -113
  47. package/build/test/elements/navigation/Navigation.test.js.map +0 -1
  48. package/commitlint.config.cjs +0 -2
  49. package/demo/elements/authorization/AuthPlugin.js +0 -57
  50. package/demo/elements/authorization/AuthProxy.js +0 -215
  51. package/demo/elements/authorization/api-key.html +0 -27
  52. package/demo/elements/authorization/api-key.ts +0 -44
  53. package/demo/elements/authorization/basic.html +0 -27
  54. package/demo/elements/authorization/basic.ts +0 -43
  55. package/demo/elements/authorization/bearer.html +0 -27
  56. package/demo/elements/authorization/bearer.ts +0 -43
  57. package/demo/elements/authorization/env.js +0 -8
  58. package/demo/elements/authorization/index.html +0 -44
  59. package/demo/elements/authorization/ntlm.html +0 -27
  60. package/demo/elements/authorization/ntlm.ts +0 -43
  61. package/demo/elements/authorization/oauth-authorize.html +0 -75
  62. package/demo/elements/authorization/oauth-authorize.ts +0 -40
  63. package/demo/elements/authorization/oauth-error.html +0 -18
  64. package/demo/elements/authorization/oauth-error.ts +0 -10
  65. package/demo/elements/authorization/oauth-popup.html +0 -36
  66. package/demo/elements/authorization/oauth2.html +0 -27
  67. package/demo/elements/authorization/oauth2.ts +0 -100
  68. package/demo/elements/authorization/oidc.html +0 -27
  69. package/demo/elements/authorization/oidc.ts +0 -139
  70. package/demo/elements/authorization/private.crt +0 -31
  71. package/demo/elements/authorization/private.csr +0 -28
  72. package/demo/elements/authorization/private.key +0 -51
  73. package/demo/elements/authorization/private.pem +0 -31
  74. package/demo/elements/authorization/redirect.html +0 -20
  75. package/demo/elements/authorization/ssl-commands.sh +0 -30
  76. package/demo/elements/authorization/ssl.conf +0 -24
  77. package/demo/elements/autocomplete/index.html +0 -64
  78. package/demo/elements/autocomplete/index.ts +0 -171
  79. package/demo/elements/code-editor/CodeEditorDemo.ts +0 -173
  80. package/demo/elements/code-editor/index.html +0 -19
  81. package/demo/elements/context-menu/DemoIcons.ts +0 -21
  82. package/demo/elements/context-menu/basic.html +0 -25
  83. package/demo/elements/context-menu/basic.ts +0 -119
  84. package/demo/elements/context-menu/custom-data.html +0 -25
  85. package/demo/elements/context-menu/custom-data.ts +0 -62
  86. package/demo/elements/context-menu/demo.css +0 -28
  87. package/demo/elements/context-menu/enabled-state.html +0 -25
  88. package/demo/elements/context-menu/enabled-state.ts +0 -73
  89. package/demo/elements/context-menu/icons.html +0 -25
  90. package/demo/elements/context-menu/icons.ts +0 -64
  91. package/demo/elements/context-menu/index.html +0 -43
  92. package/demo/elements/context-menu/nested.html +0 -25
  93. package/demo/elements/context-menu/nestedt.ts +0 -152
  94. package/demo/elements/context-menu/no-execute.html +0 -25
  95. package/demo/elements/context-menu/no-execute.ts +0 -134
  96. package/demo/elements/context-menu/radio-menu.html +0 -25
  97. package/demo/elements/context-menu/radio-menu.ts +0 -83
  98. package/demo/elements/context-menu/separators.html +0 -25
  99. package/demo/elements/context-menu/separators.ts +0 -172
  100. package/demo/elements/currency/index.html +0 -91
  101. package/demo/elements/currency/index.ts +0 -352
  102. package/demo/elements/environment/environment-editor.html +0 -20
  103. package/demo/elements/environment/environment-editor.ts +0 -49
  104. package/demo/elements/environment/index.html +0 -33
  105. package/demo/elements/environment/server-editor.html +0 -20
  106. package/demo/elements/environment/server-editor.ts +0 -67
  107. package/demo/elements/environment/variables-editor.html +0 -20
  108. package/demo/elements/environment/variables-editor.ts +0 -94
  109. package/demo/elements/har/har-viewer.html +0 -20
  110. package/demo/elements/har/har-viewer.ts +0 -76
  111. package/demo/elements/har/har1.har +0 -3044
  112. package/demo/elements/har/har2.json +0 -439
  113. package/demo/elements/har/index.html +0 -26
  114. package/demo/elements/highlight/example.md +0 -27
  115. package/demo/elements/highlight/index.html +0 -31
  116. package/demo/elements/highlight/marked-highlight.html +0 -132
  117. package/demo/elements/highlight/marked-highlight.ts +0 -22
  118. package/demo/elements/highlight/prism-highlight.html +0 -62
  119. package/demo/elements/highlight/prism-highlight.ts +0 -17
  120. package/demo/elements/http/body-editor.html +0 -17
  121. package/demo/elements/http/body-editor.ts +0 -115
  122. package/demo/elements/http/headers.html +0 -17
  123. package/demo/elements/http/headers.ts +0 -59
  124. package/demo/elements/http/http-assertions.html +0 -20
  125. package/demo/elements/http/http-assertions.ts +0 -89
  126. package/demo/elements/http/http-flows.html +0 -23
  127. package/demo/elements/http/http-flows.ts +0 -89
  128. package/demo/elements/http/index.html +0 -45
  129. package/demo/elements/http/request-editor.html +0 -26
  130. package/demo/elements/http/request-editor.ts +0 -197
  131. package/demo/elements/http/request-log.html +0 -16
  132. package/demo/elements/http/request-log.ts +0 -136
  133. package/demo/elements/http/url-editing.html +0 -17
  134. package/demo/elements/http/url-editing.ts +0 -112
  135. package/demo/elements/icons/index.html +0 -81
  136. package/demo/elements/icons/index.ts +0 -52
  137. package/demo/elements/index.html +0 -72
  138. package/demo/elements/mention-textarea/index.html +0 -19
  139. package/demo/elements/mention-textarea/index.ts +0 -205
  140. package/demo/elements/navigation/navigation-item.html +0 -49
  141. package/demo/elements/navigation/navigation-item.ts +0 -131
  142. package/demo/elements/navigation/navigation.html +0 -20
  143. package/demo/elements/navigation/navigation.ts +0 -45
  144. package/demo/elements/project/index.html +0 -29
  145. package/demo/elements/project/project-run-report.html +0 -20
  146. package/demo/elements/project/project-run-report.ts +0 -132
  147. package/demo/elements/project/request-editor.html +0 -23
  148. package/demo/elements/project/request-editor.ts +0 -232
  149. package/demo/elements/user/user-avatar.html +0 -17
  150. package/demo/elements/user/user-avatar.ts +0 -60
  151. package/demo/env.js +0 -4
  152. package/demo/index.html +0 -34
  153. package/demo/layout/index.html +0 -94
  154. package/demo/layout/index.ts +0 -190
  155. package/demo/md/DemoStyles.ts +0 -61
  156. package/demo/md/UiDemoPage.ts +0 -6
  157. package/demo/md/buttons/button.html +0 -121
  158. package/demo/md/buttons/button.ts +0 -246
  159. package/demo/md/buttons/group.html +0 -36
  160. package/demo/md/buttons/group.ts +0 -171
  161. package/demo/md/checkbox/index.html +0 -39
  162. package/demo/md/checkbox/index.ts +0 -220
  163. package/demo/md/chip/chip.html +0 -70
  164. package/demo/md/chip/chip.ts +0 -219
  165. package/demo/md/chip/pawel6c9a.jpg +0 -0
  166. package/demo/md/collapse/CustomDetail.ts +0 -89
  167. package/demo/md/collapse/collapse.html +0 -21
  168. package/demo/md/collapse/collapse.ts +0 -78
  169. package/demo/md/date-picker/date-picker.ts +0 -336
  170. package/demo/md/date-picker/index.html +0 -171
  171. package/demo/md/dialog/confirm-dialog.html +0 -49
  172. package/demo/md/dialog/confirm-dialog.ts +0 -121
  173. package/demo/md/dialog/dialog.html +0 -25
  174. package/demo/md/dialog/dialog.ts +0 -468
  175. package/demo/md/dropdown-list/index.html +0 -31
  176. package/demo/md/dropdown-list/index.ts +0 -158
  177. package/demo/md/icon-button/index.html +0 -122
  178. package/demo/md/icon-button/index.ts +0 -132
  179. package/demo/md/index.html +0 -73
  180. package/demo/md/inputs/input.html +0 -73
  181. package/demo/md/inputs/input.ts +0 -278
  182. package/demo/md/inputs/radio.html +0 -39
  183. package/demo/md/inputs/radio.ts +0 -156
  184. package/demo/md/inputs/switch.html +0 -45
  185. package/demo/md/inputs/switch.ts +0 -144
  186. package/demo/md/list/list.html +0 -65
  187. package/demo/md/list/list.ts +0 -204
  188. package/demo/md/listbox/listbox.html +0 -31
  189. package/demo/md/listbox/listbox.ts +0 -27
  190. package/demo/md/menu/index.html +0 -19
  191. package/demo/md/menu/index.ts +0 -514
  192. package/demo/md/notification/snack.html +0 -21
  193. package/demo/md/notification/snack.ts +0 -70
  194. package/demo/md/progress/progress.html +0 -46
  195. package/demo/md/progress/progress.ts +0 -161
  196. package/demo/md/segmented-button/index.html +0 -21
  197. package/demo/md/segmented-button/index.ts +0 -55
  198. package/demo/md/select/index.html +0 -16
  199. package/demo/md/select/index.ts +0 -207
  200. package/demo/md/tabs/tabs.html +0 -40
  201. package/demo/md/tabs/tabs.ts +0 -214
  202. package/demo/oauth-popup.html +0 -36
  203. package/demo/page.css +0 -8
  204. package/demo/resources/calendar-month.png +0 -0
  205. package/demo/resources/favorite.png +0 -0
  206. package/demo/resources/fingerprint.png +0 -0
  207. package/demo/resources/home-work.png +0 -0
  208. package/demo/resources/mood.png +0 -0
  209. package/demo/resources/print.png +0 -0
  210. package/demo/resources/stars.png +0 -0
  211. package/demo/resources/theaters.png +0 -0
  212. package/demo/tsconfig.json +0 -4
  213. package/eslint.config.js +0 -97
  214. package/scripts/copy-assets.js +0 -21
  215. package/scripts/release.js +0 -66
  216. package/src/demo/DemoPage.ts +0 -169
  217. package/src/demo/DemoStyles.ts +0 -60
  218. package/test/README.md +0 -375
  219. package/test/contextual-menu/ContextMenu.test.ts +0 -760
  220. package/test/contextual-menu/ContextMenuElement.test.ts +0 -569
  221. package/test/core/activity.spec.ts +0 -413
  222. package/test/core/activity_manager.spec.ts +0 -544
  223. package/test/core/application.spec.ts +0 -218
  224. package/test/core/fragment.spec.ts +0 -565
  225. package/test/core/fragment_manager.spec.ts +0 -404
  226. package/test/core/live_data.spec.ts +0 -558
  227. package/test/core/renderer.spec.ts +0 -113
  228. package/test/dom-assertions.test.ts +0 -182
  229. package/test/elements/MonacoSetup.ts +0 -65
  230. package/test/elements/authorization/basic-method.test.ts +0 -177
  231. package/test/elements/authorization/bearer-method.test.ts +0 -143
  232. package/test/elements/authorization/ntlm-method.test.ts +0 -219
  233. package/test/elements/authorization/oauth2-client-credentials-method.test.ts +0 -334
  234. package/test/elements/authorization/oauth2-code-method.test.ts +0 -320
  235. package/test/elements/authorization/oauth2-custom-grant-method.test.ts +0 -255
  236. package/test/elements/authorization/oauth2-device-code-method.test.ts +0 -371
  237. package/test/elements/authorization/oauth2-implicit-method.test.ts +0 -407
  238. package/test/elements/authorization/oauth2-jwt-method.test.ts +0 -217
  239. package/test/elements/authorization/oauth2-password-method.test.ts +0 -275
  240. package/test/elements/authorization/openid-method.test.ts +0 -591
  241. package/test/elements/autocomplete/autocomplete-input.spec.ts +0 -646
  242. package/test/elements/code-editor/code-editor.accessibility.test.ts +0 -298
  243. package/test/elements/code-editor/code-editor.test.ts +0 -574
  244. package/test/elements/currency/CurrencyPicker.accessibility.test.ts +0 -328
  245. package/test/elements/currency/CurrencyPicker.core.test.ts +0 -318
  246. package/test/elements/currency/CurrencyPicker.integration.test.ts +0 -482
  247. package/test/elements/currency/CurrencyPicker.test.ts +0 -486
  248. package/test/elements/data-table/DataTable.browser.test.ts +0 -649
  249. package/test/elements/har/HarUtils.test.ts +0 -45
  250. package/test/elements/har/HarViewerElement.test.ts +0 -687
  251. package/test/elements/har/test-data/har1.har +0 -3044
  252. package/test/elements/highlight/MarkedHighlightElement.test.ts +0 -452
  253. package/test/elements/highlight/PrismHighlightElement.test.ts +0 -79
  254. package/test/elements/highlight/PrismHighlighter.test.ts +0 -94
  255. package/test/elements/highlight/remoteSanitization.md +0 -1
  256. package/test/elements/highlight/test.md +0 -3
  257. package/test/elements/highlight/test1.md +0 -3
  258. package/test/elements/highlight/test2.md +0 -1
  259. package/test/elements/http/BodyFormdataEditorElement.test.ts +0 -482
  260. package/test/elements/http/BodyMultipartEditorElement.test.ts +0 -658
  261. package/test/elements/http/BodyRawEditorElement.test.ts +0 -90
  262. package/test/elements/http/CertificateAdd.test.ts +0 -457
  263. package/test/elements/http/HttpAssertions.test.ts +0 -994
  264. package/test/elements/http/HttpFlows.test.ts +0 -502
  265. package/test/elements/http/UrlEncodeUtils.test.ts +0 -202
  266. package/test/elements/layout/SplitItem.test.ts +0 -440
  267. package/test/elements/layout/SplitLayoutManager.test.ts +0 -1501
  268. package/test/elements/layout/SplitPanel.test.ts +0 -1109
  269. package/test/elements/mention-textarea/MentionTextArea.basic.test.ts +0 -114
  270. package/test/elements/mention-textarea/MentionTextArea.test.ts +0 -613
  271. package/test/elements/navigation/Navigation.test.ts +0 -120
  272. package/test/env.ts +0 -15
  273. package/test/events/EventTypes.test.ts +0 -363
  274. package/test/events/EventsTestHelpers.ts +0 -16
  275. package/test/helpers/TestUtils.ts +0 -243
  276. package/test/helpers/UiMock.ts +0 -185
  277. package/test/lib/Dom.test.ts +0 -231
  278. package/test/md/button/UiButton.test.ts +0 -347
  279. package/test/md/button/UiIconButton.test.ts +0 -155
  280. package/test/md/chip/UiChip.test.ts +0 -219
  281. package/test/md/collapse/UiCollapse.test.ts +0 -250
  282. package/test/md/collapse/flex-layout.test.ts +0 -105
  283. package/test/md/date-time/DateTime.test.ts +0 -348
  284. package/test/md/dialog/UiConfirmDialog.test.ts +0 -131
  285. package/test/md/dialog/UiDialog.test.ts +0 -759
  286. package/test/md/menu/Menu.test.ts +0 -855
  287. package/test/md/menu/MenuIntegration.test.ts +0 -426
  288. package/test/md/menu/MenuItem.test.ts +0 -652
  289. package/test/md/menu/SubMenu.test.ts +0 -410
  290. package/test/md/progress/UiCircularProgressElement.test.ts +0 -481
  291. package/test/md/progress/UiProgressElement.test.ts +0 -117
  292. package/test/md/progress/UiRangeElement.test.ts +0 -156
  293. package/test/md/select/Select.test.ts +0 -925
  294. package/test/plugins/takeScreenshotPlugin.js +0 -35
  295. package/test/setup.test.ts +0 -217
  296. package/test/setup.ts +0 -117
  297. package/test/tsconfig.json +0 -7
  298. package/web-dev-server.config.js +0 -21
  299. package/web-test-runner.config.js +0 -90
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@api-client/ui",
3
- "version": "0.5.38",
3
+ "version": "0.5.40",
4
4
  "description": "Internal UI component library for the API Client ecosystem.",
5
5
  "license": "UNLICENSED",
6
6
  "main": "build/src/index.js",
@@ -3,7 +3,6 @@ import { css } from 'lit'
3
3
  export default css`
4
4
  :host {
5
5
  display: block;
6
- height: 56px;
7
6
  outline: none;
8
7
  cursor: default;
9
8
  position: relative;
@@ -24,16 +23,6 @@ export default css`
24
23
  display: none;
25
24
  }
26
25
 
27
- :host([lines='two']),
28
- :host([lines='one'][image='image']) {
29
- height: 72px;
30
- }
31
-
32
- :host([lines='three']),
33
- :host([lines='one'][image='video']) {
34
- height: 88px;
35
- }
36
-
37
26
  .surface {
38
27
  height: inherit;
39
28
  box-sizing: border-box;
@@ -44,6 +33,17 @@ export default css`
44
33
  padding: 8px 16px 8px 16px;
45
34
 
46
35
  gap: 16px;
36
+ height: 56px;
37
+ }
38
+
39
+ :host([image='image']) .surface,
40
+ .surface.two-lines {
41
+ height: 72px;
42
+ }
43
+
44
+ :host([image='video']) .surface,
45
+ .surface.three-lines {
46
+ height: 88px;
47
47
  }
48
48
 
49
49
  .ripple {
@@ -13,6 +13,7 @@ export enum ListItemLines {
13
13
  one = 'one',
14
14
  two = 'two',
15
15
  three = 'three',
16
+ auto = 'auto',
16
17
  }
17
18
 
18
19
  export enum ListItemImage {
@@ -24,28 +25,42 @@ export enum ListItemImage {
24
25
  }
25
26
 
26
27
  /**
27
- * @slot
28
- * @slot overline
29
- * @slot start
30
- * @slot end
31
- * @slot end-text
32
- * @slot supporting-text
28
+ * @slot - The main content of the list item, typically a label or title.
29
+ * @slot overline - The text displayed above the main content.
30
+ * @slot start - The content displayed at the start of the list item.
31
+ * @slot end - The content displayed at the end of the list item.
32
+ * @slot end-text - The text displayed at the end of the list item.
33
+ * @slot supporting-text - The supporting text displayed below the main content.
33
34
  */
34
35
  export default class UiListItem extends UiElement {
35
36
  @query('ui-ripple') accessor ripple!: UiRipple
36
37
 
38
+ #lines: ListItemLines = ListItemLines.one
39
+
40
+ get lines(): ListItemLines {
41
+ if (this.#lines === ListItemLines.auto) {
42
+ return this.hasOverline || this.hasSupportingText ? ListItemLines.two : ListItemLines.one
43
+ }
44
+ return this.#lines
45
+ }
46
+
37
47
  /**
38
- * Whether the chip is disabled. The user can't interact with the chip when `true`.
48
+ * The number of lines to render the list template for.
49
+ * @default ListItemLines.one
39
50
  * @attribute
40
51
  */
41
- @property({ type: Boolean, reflect: true }) accessor disabled = false
52
+ @property({ type: String, reflect: true })
53
+ set lines(value: ListItemLines) {
54
+ const oldValue = this.#lines
55
+ this.#lines = value
56
+ this.requestUpdate('lines', oldValue)
57
+ }
42
58
 
43
59
  /**
44
- * The number of lines to render the list template for.
45
- * @default ListItemLines.one
60
+ * Whether the chip is disabled. The user can't interact with the chip when `true`.
46
61
  * @attribute
47
62
  */
48
- @property({ type: String, reflect: true }) accessor lines: ListItemLines
63
+ @property({ type: Boolean, reflect: true }) accessor disabled = false
49
64
 
50
65
  /**
51
66
  * The type of the list image.
@@ -67,12 +82,14 @@ export default class UiListItem extends UiElement {
67
82
  @state() accessor hasStartItem = false
68
83
  @state() accessor hasEndItem = false
69
84
  @state() accessor hasEndTextItem = false
85
+ @state() accessor hasOverline = false
86
+ @state() accessor hasSupportingText = false
70
87
 
71
88
  constructor() {
72
89
  super()
73
90
 
74
- this.lines = ListItemLines.one
75
91
  this.image = ListItemImage.icon
92
+ this.lines = ListItemLines.one
76
93
 
77
94
  this.addEventListener('click', this.handleClick.bind(this))
78
95
  this.addEventListener('pointerdown', this.handlePointerDown.bind(this))
@@ -195,49 +212,57 @@ export default class UiListItem extends UiElement {
195
212
  this.removeAttribute('tabindex')
196
213
  }
197
214
 
198
- protected handleStartSlotChange(): void {
199
- const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name="start"]')
200
- if (slot) {
201
- this.hasStartItem = slot.assignedNodes({ flatten: true }).length > 0
202
- } else {
203
- this.hasStartItem = false
204
- }
215
+ private _handleSlotChange(event: Event): boolean {
216
+ const slot = event.target as HTMLSlotElement
217
+ return slot.assignedNodes({ flatten: true }).length > 0
218
+ }
219
+
220
+ protected handleOverlineSlotChange(event: Event): void {
221
+ this.hasOverline = this._handleSlotChange(event)
205
222
  this.requestUpdate()
206
223
  }
207
224
 
208
- protected handleEndSlotChange(): void {
209
- const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name="end"]')
210
- if (slot) {
211
- this.hasEndItem = slot.assignedNodes({ flatten: true }).length > 0
212
- } else {
213
- this.hasEndItem = false
214
- }
225
+ protected handleSupportingTextSlotChange(event: Event): void {
226
+ this.hasSupportingText = this._handleSlotChange(event)
215
227
  this.requestUpdate()
216
228
  }
217
229
 
218
- protected handleEndTextSlotChange(): void {
219
- const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name="end-text"]')
220
- if (slot) {
221
- this.hasEndTextItem = slot.assignedNodes({ flatten: true }).length > 0
222
- } else {
223
- this.hasEndTextItem = false
224
- }
230
+ protected handleStartSlotChange(event: Event): void {
231
+ this.hasStartItem = this._handleSlotChange(event)
232
+ this.requestUpdate()
233
+ }
234
+
235
+ protected handleEndSlotChange(event: Event): void {
236
+ this.hasEndItem = this._handleSlotChange(event)
225
237
  this.requestUpdate()
226
238
  }
227
239
 
240
+ protected handleEndTextSlotChange(event: Event): void {
241
+ this.hasEndTextItem = this._handleSlotChange(event)
242
+ this.requestUpdate()
243
+ }
244
+
245
+ getSurfaceClasses(): ClassInfo {
246
+ const result: ClassInfo = {
247
+ 'surface': true,
248
+ 'one-line': this.lines === ListItemLines.one,
249
+ 'two-lines': this.lines === ListItemLines.two,
250
+ 'three-lines': this.lines === ListItemLines.three,
251
+ }
252
+ return result
253
+ }
254
+
228
255
  protected override render(): TemplateResult {
229
- const surfaceClasses = classMap({
230
- surface: true,
231
- })
232
256
  return html`
233
257
  ${this.renderFocusRing()} ${this.renderRipple()}
234
- <div class="${surfaceClasses}">${this.renderStart()} ${this.renderBody()} ${this.renderEnd()}</div>
258
+ <div class="${classMap(this.getSurfaceClasses())}">
259
+ ${this.renderStart()} ${this.renderBody()} ${this.renderEnd()}
260
+ </div>
235
261
  `
236
262
  }
237
263
 
238
264
  protected renderRipple = (): TemplateResult => {
239
- const { disabled, static: isStatic } = this
240
- return html`<ui-ripple class="ripple" ?disabled="${disabled || isStatic}"></ui-ripple>`
265
+ return html`<ui-ripple class="ripple" ?disabled="${this.disabled || this.static}"></ui-ripple>`
241
266
  }
242
267
 
243
268
  protected renderFocusRing(): TemplateResult {
@@ -278,13 +303,13 @@ export default class UiListItem extends UiElement {
278
303
  }
279
304
 
280
305
  protected renderBody(): TemplateResult {
281
- const { lines = ListItemLines.one } = this
282
- const hasSupportingText = lines !== ListItemLines.one
283
306
  return html`
284
307
  <div class="body">
285
- <slot name="overline"></slot>
308
+ <slot name="overline" @slotchange=${this.handleOverlineSlotChange}></slot>
286
309
  <span class="headline"><slot></slot></span>
287
- ${hasSupportingText ? html`<span class="supporting-text"><slot name="supporting-text"></slot></span>` : ''}
310
+ <span class="supporting-text"
311
+ ><slot name="supporting-text" @slotchange=${this.handleSupportingTextSlotChange}></slot
312
+ ></span>
288
313
  </div>
289
314
  `
290
315
  }
@@ -1,7 +1,7 @@
1
1
  import { html, PropertyValues, TemplateResult } from 'lit'
2
2
  import { property } from 'lit/decorators.js'
3
- import { classMap } from 'lit/directives/class-map.js'
4
- import UiListItem from '../../list/internals/ListItem.js'
3
+ import { ClassInfo, classMap } from 'lit/directives/class-map.js'
4
+ import UiListItem, { ListItemLines } from '../../list/internals/ListItem.js'
5
5
  import { nanoid } from 'nanoid'
6
6
 
7
7
  /**
@@ -89,11 +89,14 @@ export default class UiOption extends UiListItem {
89
89
  return content.join(' ').trim() || this.value || ''
90
90
  }
91
91
 
92
+ constructor() {
93
+ super()
94
+ this.lines = ListItemLines.auto
95
+ }
96
+
92
97
  /**
93
98
  * Initializes the option when it's connected to the DOM. Sets up ARIA attributes
94
99
  * and generates a unique ID if one isn't provided.
95
- *
96
- * @protected
97
100
  */
98
101
  override connectedCallback(): void {
99
102
  super.connectedCallback()
@@ -106,9 +109,6 @@ export default class UiOption extends UiListItem {
106
109
  /**
107
110
  * Handles property updates and triggers appropriate side effects.
108
111
  * Currently monitors the `selected` property to update selection state.
109
- *
110
- * @param {PropertyValues<this>} changedProperties - Map of changed properties
111
- * @protected
112
112
  */
113
113
  protected override updated(changedProperties: PropertyValues<this>): void {
114
114
  super.updated(changedProperties)
@@ -143,7 +143,7 @@ export default class UiOption extends UiListItem {
143
143
  * Handles click events on the option. Prevents default behavior and dispatches
144
144
  * a custom 'select' event that the parent select component can listen to.
145
145
  *
146
- * @param {MouseEvent} e - The click event
146
+ * @param e - The click event
147
147
  * @protected
148
148
  * @fires select - Custom event with option details in event.detail
149
149
  * @example
@@ -175,23 +175,11 @@ export default class UiOption extends UiListItem {
175
175
  )
176
176
  }
177
177
 
178
- /**
179
- * Renders the option's template. Creates the main structure with focus ring,
180
- * ripple effect, and content areas.
181
- *
182
- * @returns {TemplateResult} The rendered template
183
- * @protected
184
- */
185
- protected override render(): TemplateResult {
186
- const surfaceClasses = classMap({
187
- surface: true,
178
+ override getSurfaceClasses(): ClassInfo {
179
+ return {
180
+ ...super.getSurfaceClasses(),
188
181
  selected: this.selected,
189
- })
190
-
191
- return html`
192
- ${this.renderFocusRing()} ${this.renderRipple()}
193
- <div class="${surfaceClasses}">${this.renderStart()} ${this.renderBody()} ${this.renderEnd()}</div>
194
- `
182
+ }
195
183
  }
196
184
 
197
185
  /**
@@ -200,10 +188,10 @@ export default class UiOption extends UiListItem {
200
188
  */
201
189
  protected override renderEnd(): TemplateResult {
202
190
  return html`
203
- <div class="end">
191
+ <div class="${classMap(this.getEndClasses())}">
204
192
  ${this.selected ? html`<ui-icon icon="check" class="selection-icon"></ui-icon>` : ''}
205
193
  <slot name="end" @slotchange=${this.handleEndSlotChange}></slot>
206
- <slot name="end-text" class="trailing-supporting-text"></slot>
194
+ <slot name="end-text" class="trailing-supporting-text" @slotchange=${this.handleEndTextSlotChange}></slot>
207
195
  </div>
208
196
  `
209
197
  }
@@ -354,12 +354,17 @@ export default class UiSelect extends LitElement {
354
354
 
355
355
  protected override firstUpdated(cp: PropertyValues): void {
356
356
  super.firstUpdated(cp)
357
- this.setCurrentOption()
358
- this.#internals.setFormValue(this.value ?? null)
357
+ this.updateComplete.then(() => {
358
+ this.setCurrentOption()
359
+ this.#internals.setFormValue(this.value ?? null)
360
+ // We need to update here as event with `value` and `selectedOption`
361
+ // already set, the `renderValue` might have incorrect value
362
+ // due to the DOM update.
363
+ this.requestUpdate()
364
+ })
359
365
  }
360
366
 
361
- protected async setCurrentOption(): Promise<void> {
362
- await this.updateComplete
367
+ protected setCurrentOption(): void {
363
368
  const options = this.querySelectorAll<UiOption>('ui-option')
364
369
  if (this.value) {
365
370
  this.selectedOption = Array.from(options).find((option) => option.value === this.value) || null
@@ -459,6 +464,11 @@ export default class UiSelect extends LitElement {
459
464
  if (this.disabled || e.defaultPrevented) return
460
465
  e.preventDefault()
461
466
  e.stopPropagation()
467
+ if (this.open && e.target === this) {
468
+ // If the select is already open and clicked again, close it
469
+ this.open = false
470
+ return
471
+ }
462
472
  this.open = true
463
473
  }
464
474
 
@@ -560,7 +570,7 @@ export default class UiSelect extends LitElement {
560
570
  // When options change, re-evaluate the current selection
561
571
  // only if we don't have an explicit value set
562
572
  if (!this.value) {
563
- await this.setCurrentOption()
573
+ this.setCurrentOption()
564
574
  this.requestUpdate()
565
575
  }
566
576
  }
package/.aiexclude DELETED
@@ -1,3 +0,0 @@
1
- coverage/
2
- .tmp/
3
- build/
@@ -1,63 +0,0 @@
1
- ---
2
- description:
3
- globs: *.ts,*.css,*html
4
- alwaysApply: false
5
- ---
6
-
7
- You are an expert developer in HTML and CSS, focusing on best practices, accessibility, and responsive design.
8
-
9
- Key Principles
10
- - Write semantic HTML to improve accessibility and SEO.
11
- - Use CSS for styling, avoiding inline styles.
12
- - Ensure responsive design using media queries and flexible layouts.
13
- - Prioritize accessibility by using ARIA roles and attributes.
14
-
15
- HTML
16
- - Use semantic elements (e.g., <header>, <main>, <footer>, <article>, <section>).
17
- - Use <button> for clickable elements, not <div> or <span>.
18
- - Use <a> for links, ensuring href attribute is present.
19
- - Use <img> with alt attribute for images.
20
- - Use <form> for forms, with appropriate input types and labels.
21
- - Avoid using deprecated elements (e.g., <font>, <center>).
22
-
23
- CSS
24
- - Use external stylesheets for CSS.
25
- - Use class selectors over ID selectors for styling.
26
- - Use Flexbox and Grid for layout.
27
- - Use rem and em units for scalable and accessible typography.
28
- - Use CSS variables for consistent theming.
29
- - Use BEM (Block Element Modifier) methodology for naming classes.
30
- - Avoid !important; use specificity to manage styles.
31
-
32
- Responsive Design
33
- - Use media queries to create responsive layouts.
34
- - Use mobile-first approach for media queries.
35
- - Ensure touch targets are large enough for touch devices.
36
- - Use responsive images with srcset and sizes attributes.
37
- - Use viewport meta tag for responsive scaling.
38
-
39
- Accessibility
40
- - Use ARIA roles and attributes to enhance accessibility.
41
- - Ensure sufficient color contrast for text.
42
- - Provide keyboard navigation for interactive elements.
43
- - Use focus styles to indicate focus state.
44
- - Use landmarks (e.g., <nav>, <main>, <aside>) for screen readers.
45
-
46
- Performance
47
- - Minimize CSS and HTML file sizes.
48
- - Use CSS minification and compression.
49
- - Avoid excessive use of animations and transitions.
50
- - Use lazy loading for images and other media.
51
-
52
- Testing
53
- - Test HTML and CSS in multiple browsers and devices.
54
- - Use tools like Lighthouse for performance and accessibility audits.
55
- - Validate HTML and CSS using W3C validators.
56
-
57
- Documentation
58
- - Comment complex CSS rules and HTML structures.
59
- - Use consistent naming conventions for classes and IDs.
60
- - Document responsive breakpoints and design decisions.
61
-
62
- Refer to MDN Web Docs for HTML and CSS best practices and to the W3C guidelines for accessibility standards.
63
-
@@ -1,89 +0,0 @@
1
- ---
2
- globs: src/elements/**,src/md/**,src/styles/**,demo/**
3
- alwaysApply: false
4
- ---
5
-
6
- You are an expert developer in web components using the Lit library and Material Design version 3, focusing on best practices, accessibility, and responsive design.
7
-
8
- Key Principles
9
-
10
- - Comply with web elements authoring standards when designing a web component.
11
- - Use accessibility best practices to produce semantically relevant web components.
12
- - Prioritize web standards over custom implementation.
13
- - Prioritize APIs that are passing the Web Platform Baseline
14
- - Minimize external dependencies, but also balance between custom code and widely known and trusted dependencies.
15
- - Everything must be ES compliant. Use the appropriate standards for module imports.
16
-
17
- Lit Web Components
18
-
19
- - Document public properties and public function for authors to understand what these properties and functions do.
20
- - Ensure the appropriate aria roles are applied to each element.
21
- - Document all events and their structure (for custom events).
22
- - Prioritize well-known events (like change, select) over custom events.
23
- - Provide examples of usage when producing component documentation.
24
- - Prioritize native elements over custom elements whenever possible.
25
- - Prioritize composition over attribute passed configuration (a dropdown should have a semantic HTML structure and not auto-generated structure from a complex configuration object).
26
- - Think of other use-cases and how the custom element can scale for future use cases.
27
- - Reuse existing components whenever possible.
28
- - Prefer to put lifecycle methods after the constructor and before the render and other methods.
29
- - Put render methods at the end of the class.
30
- - Use `@property` decorator for public properties and `@state` decorator for private properties.
31
- - Use `@query` decorator for querying elements in the shadow DOM.
32
- - Use `@queryAssignedElements` decorator for querying slotted elements.
33
- - Boolean properties should be initialized to `false` in the constructor.
34
- - Use `@eventOptions` decorator to specify event options like `capture`, `passive`, and `once`.
35
- - Use `@queryAsync` decorator for querying elements that may not be immediately available in the DOM.
36
- - Use `@state` decorator for properties that are internal to the component and should not be exposed to the outside world.
37
- - Avoid passing complex objects as properties. Instead, use simple types like `string`, `number`, or `boolean` and handle complex logic internally.
38
- - Use lifecycle methods like `connectedCallback`, `disconnectedCallback`, and `update` to manage component state and behavior.
39
- - Use `willUpdate` method to perform actions before the component updates, such as validating properties or preparing data.
40
- - Place the component definition under the `internals/` directory of a component folder. The components registration should be done in the component file in the main component directory.
41
- - Place the base material components under the `src/md/` directory.
42
- - Place composite components under the `src/elements/` directory.
43
-
44
- CSS and Styling
45
-
46
- - Prioritize native CSS over JavaScript implementation. Use Web Platform Baseline even if the editor says it's not supported.
47
- - Use anchoring and popover API whenever possible and applicable over JavaScript positioning.
48
- - Place lit component styles in a separate file with the `.styles.ts` extension.
49
- - Add styles to the component registration class, not the base class.
50
- - Declare the `part` attributes to expose custom styling.
51
- - When working on base components, use CSS variables to allow customization of the component styles.
52
- - Define component states via the `internals.states.add("--state-name")` method. These states can be used as `component-name:state(state-name) {}` in the CSS.
53
-
54
- Error handling
55
-
56
- - Components either communicate errors through rendering them internally or dispatch an error event with the error details to the parent component or application.
57
- - Prefer error states defined on the element internals over custom error styling.
58
-
59
- Naming Convention
60
-
61
- - Follow web authoring standards as closely as possible.
62
- - Minimize the use of "-" in attribute and event names
63
- - Use camelCase for properties and methods.
64
- - Do not prefix private or protected properties and methods with an underscore. Use the typescript `private` and `protected` keywords to indicate visibility.
65
-
66
- Testing
67
-
68
- - Use @open-wc/testing library.
69
- - Always add accessibility tests.
70
- - Create fixtures for different states of a component.
71
- - To run tests for a specific file, use the `--files` option in the test command. For example:
72
-
73
- ```bash
74
- npm test -- --files=".tmp/test/**/[test file name].test.js"
75
- ```
76
-
77
- - Prefer the Assert API over the Expect API for assertions. The Assert API is more performant and provides better error messages.
78
- - When updating an element's property, await for the update to complete using `await element.updateComplete` before making assertions. This ensures that the component has fully rendered before checking its state.
79
-
80
- Component Demoing
81
-
82
- - Always produce a demo page under the demo/ directory.
83
- - Use the `DemoPage` class to bootstrap the demo page.
84
- - Use material styles with the demo page. Minimize custom styling.
85
- - Try to render each state separately and minimize the use of complex configurations.
86
- - Start with simple states and progressively enhance the demo with more complex configurations.
87
- - If a component produces output, ensure that the demo page shows the output in a readable format. Use one output per component.
88
- - Document the states in a way that is obvious to the user. Use headings and paragraphs to explain the states.
89
- - Due to the nature how the demo pages are processed, ensure that typescript files that belong to the demo page are imported from the `/.tmp/demo/` directory. This is done automatically by the build process. Imports inside the typescript file should reference files from the `src/` folder directly.
package/.editorconfig DELETED
@@ -1,29 +0,0 @@
1
- # EditorConfig helps developers define and maintain consistent
2
- # coding styles between different editors and IDEs
3
- # editorconfig.org
4
-
5
- root = true
6
-
7
-
8
- [*]
9
-
10
- # Change these settings to your own preference
11
- indent_style = space
12
- indent_size = 2
13
-
14
- # We recommend you to keep these unchanged
15
- end_of_line = lf
16
- charset = utf-8
17
- trim_trailing_whitespace = true
18
- insert_final_newline = true
19
-
20
- [*.md]
21
- trim_trailing_whitespace = false
22
-
23
- [*.json]
24
- indent_size = 2
25
-
26
- [*.{html,js,md}]
27
- block_comment_start = /**
28
- block_comment = *
29
- block_comment_end = */
@@ -1,24 +0,0 @@
1
- # Contributing to API Client
2
-
3
- First of all, we are happy you want to contribute to API Client open source project. API Client is a community driven project and we are open to your input. Before you start lets clear some things first so your contribution is accepted without unnecessary delays.
4
-
5
- ## Start with an issue report
6
-
7
- Before you start working on any code or architecture, please, report an issue in the corresponding repository. This is crucial for open projects so the community can take a part in the discussion. Also, the project is being developed so we can predict upcoming changes. This way we will also be able to direct you in the right direction, like telling you where you can find relevant code. See below for more information.
8
-
9
- ## Code the change
10
-
11
- ### Code and PR
12
-
13
- After you have created an issue report and picked the right repository you now are enabled to code the change. After you finish **introduce relevant tests**. We can't accept PRs that contains an untested code. After that create a PR to the relevant repository. We will get back to you as soon as possible. Heel free to mention us directly in the PR so we will get a notification from GitHub.
14
-
15
- ### Things to consider
16
-
17
- - Introduce changes that other users will benefit from
18
- - Significant architecture changes make take longer to be accepted giving the complexity of the dependencies. API Client has a shared code with MuleSoft's API Console. We need to ensure the stability of both projects.
19
- - Understand the reasons for the distributed architecture and honor the structure of the project. Most likely you want to introduce changes to the `core` repository. Less likely others.
20
- - We are here to help. Ask us questions about the architecture or how stuff work.
21
-
22
- ------
23
-
24
- That's it. We are thrilled seeing you contributing to the project. Drop us a message in case you have any questions.
@@ -1,70 +0,0 @@
1
- ---
2
- applyTo: "*.ts,*.css,*html"
3
- ---
4
-
5
- # HTML and CSS Best Practices
6
-
7
- You are an expert developer in HTML and CSS, focusing on best practices, accessibility, and responsive design.
8
-
9
- ## Key Principles
10
-
11
- - Write semantic HTML to improve accessibility and SEO.
12
- - Use CSS for styling, avoiding inline styles.
13
- - Ensure responsive design using media queries and flexible layouts.
14
- - Prioritize accessibility by using ARIA roles and attributes.
15
-
16
- ## HTML
17
-
18
- - Use semantic elements (e.g., <header>, <main>, <footer>, <article>, <section>).
19
- - Use <button> for clickable elements, not <div> or <span>.
20
- - Use <a> for links, ensuring href attribute is present.
21
- - Use <img> with alt attribute for images.
22
- - Use <form> for forms, with appropriate input types and labels.
23
- - Avoid using deprecated elements (e.g., <font>, <center>).
24
-
25
- ## CSS
26
-
27
- - Use external stylesheets for CSS.
28
- - Use class selectors over ID selectors for styling.
29
- - Use Flexbox and Grid for layout.
30
- - Use rem and em units for scalable and accessible typography.
31
- - Use CSS variables for consistent theming.
32
- - Use BEM (Block Element Modifier) methodology for naming classes.
33
- - Avoid !important; use specificity to manage styles.
34
-
35
- ## Responsive Design
36
-
37
- - Use media queries to create responsive layouts.
38
- - Use mobile-first approach for media queries.
39
- - Ensure touch targets are large enough for touch devices.
40
- - Use responsive images with srcset and sizes attributes.
41
- - Use viewport meta tag for responsive scaling.
42
-
43
- ## Accessibility
44
-
45
- - Use ARIA roles and attributes to enhance accessibility.
46
- - Ensure sufficient color contrast for text.
47
- - Provide keyboard navigation for interactive elements.
48
- - Use focus styles to indicate focus state.
49
- - Use landmarks (e.g., <nav>, <main>, <aside>) for screen readers.
50
-
51
- ## Performance
52
-
53
- - Minimize CSS and HTML file sizes.
54
- - Use CSS minification and compression.
55
- - Avoid excessive use of animations and transitions.
56
- - Use lazy loading for images and other media.
57
-
58
- ## Testing
59
-
60
- - Test HTML and CSS in multiple browsers and devices.
61
- - Use tools like Lighthouse for performance and accessibility audits.
62
- - Validate HTML and CSS using W3C validators.
63
-
64
- ## Documentation
65
-
66
- - Comment complex CSS rules and HTML structures.
67
- - Use consistent naming conventions for classes and IDs.
68
- - Document responsive breakpoints and design decisions.
69
-
70
- Refer to MDN Web Docs for HTML and CSS best practices and to the W3C guidelines for accessibility standards.