@epa-wg/custom-element-dist 0.0.32 → 0.0.33

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 (219) hide show
  1. package/.storybook/main.ts +3 -7
  2. package/.storybook/preview.ts +4 -6
  3. package/README.md +4 -4
  4. package/coverage/coverage-final.json +7 -18
  5. package/coverage/index.html +30 -30
  6. package/coverage/src/custom-element/coverage.svg +1 -1
  7. package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
  8. package/coverage/src/custom-element/custom-element.js.html +579 -429
  9. package/coverage/src/custom-element/http-request.js/coverage.svg +1 -1
  10. package/coverage/src/custom-element/http-request.js.html +13 -13
  11. package/coverage/src/custom-element/index.html +29 -29
  12. package/coverage/src/custom-element/local-storage.js.html +1 -1
  13. package/coverage/src/custom-element/location-element.js.html +31 -31
  14. package/coverage/src/custom-element/module-url.js/coverage.svg +1 -1
  15. package/coverage/src/custom-element/module-url.js.html +20 -20
  16. package/coverage/src/index.html +1 -1
  17. package/coverage/src/mocks/handlers.ts.html +1 -1
  18. package/coverage/src/mocks/index.html +1 -1
  19. package/coverage/src/stories/coverage.svg +1 -1
  20. package/coverage/src/stories/{local-storage.test.stories.ts → frame.canvas.ts}/coverage.svg +1 -1
  21. package/coverage/src/stories/frame.canvas.ts.html +175 -0
  22. package/coverage/src/stories/http-request.stories.ts.html +1 -1
  23. package/coverage/src/stories/index.html +14 -179
  24. package/coverage/src/stories/testStoryBook.ts.html +8 -8
  25. package/coverage/src/sum.ts.html +1 -1
  26. package/dist/custom-element-6slVaFEs.cjs +97 -0
  27. package/dist/custom-element-WnOqmEOe.js +609 -0
  28. package/dist/custom-element-bundle.cjs +1 -1
  29. package/dist/custom-element-bundle.js +2 -2
  30. package/dist/demo/attributes.html +153 -0
  31. package/dist/demo/external-templates-sb-6.html +42 -0
  32. package/dist/demo/external-templates-sb-7.html +42 -0
  33. package/dist/demo/html-template.html +1 -1
  34. package/dist/demo/module-url-sb-2.html +46 -0
  35. package/dist/demo/module-url-sb-4.html +48 -0
  36. package/dist/demo/module-url-sb-5.html +53 -0
  37. package/dist/demo/s.xml +71 -8
  38. package/dist/demo/s.xslt +55 -31
  39. package/dist/demo/ss.html +13 -4
  40. package/dist/mockServiceWorker.js +31 -8
  41. package/package.json +25 -26
  42. package/public/demo/attributes.html +153 -0
  43. package/public/demo/external-templates-sb-6.html +42 -0
  44. package/public/demo/external-templates-sb-7.html +42 -0
  45. package/public/demo/html-template.html +1 -1
  46. package/public/demo/module-url-sb-2.html +46 -0
  47. package/public/demo/module-url-sb-4.html +48 -0
  48. package/public/demo/module-url-sb-5.html +53 -0
  49. package/public/demo/s.xml +71 -8
  50. package/public/demo/s.xslt +55 -31
  51. package/public/demo/ss.html +13 -4
  52. package/public/mockServiceWorker.js +31 -8
  53. package/src/custom-element/custom-element.d.ts +4 -0
  54. package/src/custom-element/custom-element.js +91 -41
  55. package/src/custom-element/demo/attributes.html +153 -0
  56. package/src/custom-element/demo/html-template.html +1 -1
  57. package/src/custom-element/demo/s.xml +71 -8
  58. package/src/custom-element/demo/s.xslt +55 -31
  59. package/src/custom-element/demo/ss.html +13 -4
  60. package/src/custom-element/ide/web-types-dce.json +1 -1
  61. package/src/custom-element/ide/web-types-xsl.json +1 -1
  62. package/src/custom-element/index.html +1 -1
  63. package/src/material/components/badge.html +240 -0
  64. package/src/material/components/dropdown.html +7 -12
  65. package/src/material/components/icon-link.html +1 -0
  66. package/src/material/components/icon.html +253 -0
  67. package/src/material/components/input.html +290 -82
  68. package/src/material/components/menu.html +7 -5
  69. package/src/material/components.html +48 -11
  70. package/src/material/theme/semantic.css +20 -1
  71. package/src/mocks/versions.mock.ts +1 -1
  72. package/src/stories/__screenshots__/attributes.test.stories.ts +1 -0
  73. package/src/stories/__screenshots__/external-template.test.stories.ts +1 -0
  74. package/src/stories/__screenshots__/module-url.test.stories.ts +1 -0
  75. package/src/stories/__screenshots__/stories.test.ts/attributes-Attributes-definition-1.png +0 -0
  76. package/src/stories/__screenshots__/stories.test.ts/attributes-Attributes-runtime-change-1.png +0 -0
  77. package/src/stories/__screenshots__/stories.test.ts/attributes-Instance-Attributes-1.png +0 -0
  78. package/src/stories/__screenshots__/stories.test.ts/attributes-Instance-Attributes-2.png +0 -0
  79. package/src/stories/__screenshots__/stories.test.ts/attributes-cloneAs-el-newTag--1.png +0 -0
  80. package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---1.png +0 -0
  81. package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---2.png +0 -0
  82. package/src/stories/__screenshots__/stories.test.ts/attributes-mergeAttr--from--to---3.png +0 -0
  83. package/src/stories/__screenshots__/stories.test.ts/attributes-mix-to-from--1.png +0 -0
  84. package/src/stories/__screenshots__/stories.test.ts/http-request-Attributes-definition-1.png +0 -0
  85. package/src/stories/__screenshots__/stories.test.ts/http-request-Attributes-runtime-change-1.png +0 -0
  86. package/src/stories/__screenshots__/stories.test.ts/http-request-Instance-Attributes-1.png +0 -0
  87. package/src/stories/__screenshots__/stories.test.ts/http-request-Instance-Attributes-2.png +0 -0
  88. package/src/stories/__screenshots__/stories.test.ts/http-request-cloneAs-el-newTag--1.png +0 -0
  89. package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-headers-and-response-status-and-headers-1.png +0 -0
  90. package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-with-delayed--5-seconds-response-1.png +0 -0
  91. package/src/stories/__screenshots__/stories.test.ts/http-request-http-request-with-error-1.png +0 -0
  92. package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---1.png +0 -0
  93. package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---2.png +0 -0
  94. package/src/stories/__screenshots__/stories.test.ts/http-request-mergeAttr--from--to---3.png +0 -0
  95. package/src/stories/__screenshots__/stories.test.ts/http-request-mix-to-from--1.png +0 -0
  96. package/src/stories/__screenshots__/stories.test.ts/http-request-url-and-slice-1.png +0 -0
  97. package/src/stories/__screenshots__/stories.test.ts/http-request-url-change-1.png +0 -0
  98. package/src/stories/attributes.test.stories.ts +83 -17
  99. package/src/stories/external-template.test.stories.ts +16 -14
  100. package/src/stories/frame.canvas.ts +31 -0
  101. package/src/stories/module-url.test.stories.ts +29 -61
  102. package/storybook-static/assets/Color-F6OSRLHC-Cbp293x2.js +1 -0
  103. package/storybook-static/assets/Configure-BrFr4SLE.js +165 -0
  104. package/storybook-static/assets/DocsRenderer-CFRXHY34-DhHzJiIO.js +2 -0
  105. package/storybook-static/assets/attributes.test.stories-CzWkKw0e.js +1 -0
  106. package/storybook-static/assets/{attributes.test.stories-D1X6EBrd.js → attributes.test.stories-Gg9LQTEK.js} +109 -38
  107. package/storybook-static/assets/{css.test.stories-Cp_g2hE1.js → css.test.stories-B_3ltOrx.js} +1 -1
  108. package/storybook-static/assets/custom-element-CPnvJnn8.js +97 -0
  109. package/storybook-static/assets/{dom-merge.test.stories-hbpdCka0.js → dom-merge.test.stories-nQxcgLoM.js} +1 -1
  110. package/storybook-static/assets/entry-preview-docs-Dwczwtsc.js +2 -0
  111. package/storybook-static/assets/external-template.test.stories-BivZqBTp.js +1 -0
  112. package/storybook-static/assets/{external-template.test.stories-BK89h6sk.js → external-template.test.stories-DZ-rjnfd.js} +38 -40
  113. package/storybook-static/assets/{form.test.stories-BfoLe_rw.js → form.test.stories-DQhPYtMj.js} +1 -1
  114. package/storybook-static/assets/frame.canvas-ClTqYyMN.js +1 -0
  115. package/storybook-static/assets/{handlers-yVPwH_Nz.js → handlers-CLkps6Nz.js} +17 -14
  116. package/storybook-static/assets/{http-request.stories-CBFJS2Ws.js → http-request.stories-jo0f73nw.js} +1 -1
  117. package/storybook-static/assets/iframe-CZwRpnn9.js +199 -0
  118. package/storybook-static/assets/index-B68YUdzy.js +621 -0
  119. package/storybook-static/assets/index-BwkS7JH_.js +8 -0
  120. package/storybook-static/assets/index-CJQtnF9V.js +1 -0
  121. package/storybook-static/assets/index-Dr4PwNfd.js +240 -0
  122. package/storybook-static/assets/{local-storage.test.stories-C0Yzy6Am.js → local-storage.test.stories-uA5EKRPf.js} +1 -1
  123. package/storybook-static/assets/{location-element.test.stories-DNFrEu5A.js → location-element.test.stories-Cu-6Elcg.js} +1 -1
  124. package/storybook-static/assets/module-url.test.stories-CD_wusXQ.js +142 -0
  125. package/storybook-static/assets/module-url.test.stories-CTjUAk3J.js +1 -0
  126. package/storybook-static/assets/preview-1xJJ3sKE.js +1 -0
  127. package/storybook-static/assets/preview-BFlNN3Wj.js +1 -0
  128. package/storybook-static/assets/preview-CTOeX_lO.js +1 -0
  129. package/storybook-static/assets/preview-Cm4PPhHS.js +50 -0
  130. package/storybook-static/assets/preview-CuCH40jj.js +2 -0
  131. package/storybook-static/assets/preview-DfTudP20.js +1 -0
  132. package/storybook-static/assets/{set-url.test.stories-BBfLxv2u.js → set-url.test.stories-CY7B9BVZ.js} +1 -1
  133. package/storybook-static/assets/{slice-events.test.stories-HcXF8XQI.js → slice-events.test.stories-BVnPXm6e.js} +1 -1
  134. package/storybook-static/assets/{slots.test.stories-i6mnIFM2.js → slots.test.stories-Dxsa9KdA.js} +1 -1
  135. package/storybook-static/assets/{version-select.test.stories-BsUFH6Va.js → version-select.test.stories-Buga1PAa.js} +1 -1
  136. package/storybook-static/demo/attributes.html +153 -0
  137. package/storybook-static/demo/external-templates-sb-6.html +42 -0
  138. package/storybook-static/demo/external-templates-sb-7.html +42 -0
  139. package/storybook-static/demo/html-template.html +1 -1
  140. package/storybook-static/demo/module-url-sb-2.html +46 -0
  141. package/storybook-static/demo/module-url-sb-4.html +48 -0
  142. package/storybook-static/demo/module-url-sb-5.html +53 -0
  143. package/storybook-static/demo/s.xml +71 -8
  144. package/storybook-static/demo/s.xslt +55 -31
  145. package/storybook-static/demo/ss.html +13 -4
  146. package/storybook-static/iframe.html +1 -1
  147. package/storybook-static/index.html +6 -10
  148. package/storybook-static/index.json +1 -1
  149. package/storybook-static/mockServiceWorker.js +31 -8
  150. package/storybook-static/project.json +1 -1
  151. package/storybook-static/sb-addons/essentials-actions-2/manager-bundle.js +3 -0
  152. package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +8 -8
  153. package/storybook-static/sb-addons/essentials-controls-1/manager-bundle.js +391 -0
  154. package/storybook-static/sb-addons/essentials-docs-3/manager-bundle.js +230 -0
  155. package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
  156. package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
  157. package/storybook-static/sb-addons/essentials-toolbars-6/manager-bundle.js +1 -1
  158. package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
  159. package/storybook-static/sb-addons/interactions-9/manager-bundle.js +58 -58
  160. package/storybook-static/sb-manager/globals-module-info.js +9 -0
  161. package/storybook-static/sb-manager/globals-runtime.js +10719 -10473
  162. package/storybook-static/sb-manager/runtime.js +4944 -6321
  163. package/coverage/src/stories/attributes.test.stories.ts/coverage.svg +0 -10
  164. package/coverage/src/stories/attributes.test.stories.ts.html +0 -814
  165. package/coverage/src/stories/css.test.stories.ts/coverage.svg +0 -10
  166. package/coverage/src/stories/css.test.stories.ts.html +0 -460
  167. package/coverage/src/stories/dom-merge.test.stories.ts/coverage.svg +0 -10
  168. package/coverage/src/stories/dom-merge.test.stories.ts.html +0 -706
  169. package/coverage/src/stories/external-template.test.stories.ts/coverage.svg +0 -10
  170. package/coverage/src/stories/external-template.test.stories.ts.html +0 -865
  171. package/coverage/src/stories/form.test.stories.ts/coverage.svg +0 -10
  172. package/coverage/src/stories/form.test.stories.ts.html +0 -661
  173. package/coverage/src/stories/local-storage.test.stories.ts.html +0 -1315
  174. package/coverage/src/stories/location-element.test.stories.ts/coverage.svg +0 -10
  175. package/coverage/src/stories/location-element.test.stories.ts.html +0 -523
  176. package/coverage/src/stories/module-url.test.stories.ts/coverage.svg +0 -10
  177. package/coverage/src/stories/module-url.test.stories.ts.html +0 -640
  178. package/coverage/src/stories/set-url.test.stories.ts/coverage.svg +0 -10
  179. package/coverage/src/stories/set-url.test.stories.ts.html +0 -433
  180. package/coverage/src/stories/slice-events.test.stories.ts/coverage.svg +0 -10
  181. package/coverage/src/stories/slice-events.test.stories.ts.html +0 -952
  182. package/coverage/src/stories/slots.test.stories.ts/coverage.svg +0 -10
  183. package/coverage/src/stories/slots.test.stories.ts.html +0 -742
  184. package/coverage/src/stories/version-select.test.stories.ts/coverage.svg +0 -10
  185. package/coverage/src/stories/version-select.test.stories.ts.html +0 -397
  186. package/dist/custom-element-D2wf_rqP.js +0 -576
  187. package/dist/custom-element-Dtzhbjkc.cjs +0 -97
  188. package/storybook-static/assets/Color-F6OSRLHC-BU3iy8jH.js +0 -1
  189. package/storybook-static/assets/Configure-DN6ifayP.js +0 -165
  190. package/storybook-static/assets/DocsRenderer-CFRXHY34-BaVEufDj.js +0 -2
  191. package/storybook-static/assets/custom-element-uuAtIYWS.js +0 -97
  192. package/storybook-static/assets/entry-preview-docs-BbcIMweR.js +0 -2
  193. package/storybook-static/assets/iframe-CJEL_4Nu.js +0 -2
  194. package/storybook-static/assets/index-BcZLpTeD.js +0 -8
  195. package/storybook-static/assets/index-CxRwF5Or.js +0 -234
  196. package/storybook-static/assets/index-D-8MO0q_.js +0 -1
  197. package/storybook-static/assets/index-D5fBh-7N.js +0 -1
  198. package/storybook-static/assets/index-DM-KBPdl.js +0 -1
  199. package/storybook-static/assets/index-RSFf30w1.js +0 -1
  200. package/storybook-static/assets/index-SnjB5uV8.js +0 -769
  201. package/storybook-static/assets/module-url.test.stories-CXibF5Ta.js +0 -208
  202. package/storybook-static/assets/preview-BhhEZcNS.js +0 -1
  203. package/storybook-static/assets/preview-Bnd0XhaF.js +0 -52
  204. package/storybook-static/assets/preview-CNKoaWES.js +0 -1
  205. package/storybook-static/assets/preview-DAeyCMnM.js +0 -1
  206. package/storybook-static/assets/preview-DHPc-V4N.js +0 -1
  207. package/storybook-static/assets/preview-DJMlNTk8.js +0 -2
  208. package/storybook-static/assets/preview-DYzi3Z2p.js +0 -1
  209. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js +0 -333
  210. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js.LEGAL.txt +0 -40
  211. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +0 -3
  212. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +0 -391
  213. package/storybook-static/sb-addons/links-1/manager-bundle.js +0 -3
  214. package/storybook-static/sb-preview/globals.js +0 -33
  215. package/storybook-static/sb-preview/runtime.js +0 -7174
  216. package/test-runner-jest.config.js +0 -15
  217. /package/storybook-static/sb-addons/{essentials-actions-3 → essentials-actions-2}/manager-bundle.js.LEGAL.txt +0 -0
  218. /package/storybook-static/sb-addons/{essentials-controls-2 → essentials-controls-1}/manager-bundle.js.LEGAL.txt +0 -0
  219. /package/storybook-static/sb-addons/{links-1 → essentials-docs-3}/manager-bundle.js.LEGAL.txt +0 -0
@@ -30,11 +30,15 @@
30
30
  &>p{ min-width: 90%; }
31
31
  html-demo-element{flex:1; width: 100%; }
32
32
  }
33
+ html-demo-element.flat-attr{
34
+ .token.attr-name:before{content:'\A '; }
35
+ }
33
36
  </style>
34
37
  </head>
35
38
 
36
39
  <body>
37
40
  <custom-element hidden src="./icon-link.html#cem-icon-link" tag="cem-icon-link"></custom-element>
41
+ <custom-element hidden src="./icon.html#cem-icon" tag="cem-icon"></custom-element>
38
42
 
39
43
 
40
44
  <header class="cem-theme-teal">
@@ -42,19 +46,54 @@
42
46
  </header>
43
47
  <pre>
44
48
  TODO
45
- * bypass all INPUT attributes
46
- * error handling
49
+ * error handling & styling
47
50
  * link to form error handling
48
- * docs
51
+ * password show text 👁️ & clear button
52
+ * slice propagation to owner DCE
53
+ * tokens as in https://material-web.dev/components/text-field/#filled-text-field-tokens
54
+ or by css in https://material.angular.io/components/input/overview
55
+ * outlined variation
56
+ * docs w/ how to use
49
57
  </pre>
50
58
  <main>
51
- <p><code>cem-input</code> is autocomplete component from &lt;custom-element&gt; Material suite based on the
52
- <a href="https://material.io/components" >Material Design specification</a>.
53
- </p>
59
+ <section>
60
+ <p><code>cem-input</code> is text input component from &lt;custom-element&gt; Material suite based on the
61
+ <a href="https://material.io/components" >Material Design specification</a>,
62
+ <a href="https://m3.material.io/components/text-fields/specs" >text fields</a> in particular.
63
+ </p>
64
+ <p>Other implementations: <a href="https://material-web.dev/components/text-field/">Material Web</a>(Lit),
65
+ <a href="https://material.angular.io/components/input/overview">Angular Material</a>
66
+ </p>
67
+ <h1>Attributes</h1>
68
+ <div> <code>leading, label, trailing, supporting </code> attributes define the text when slot
69
+ with same name is omitted.
70
+ </div>
71
+ <div> <code>leading</code>, <code>trailing</code> attributes defines the
72
+ <a href="./icon.html">cem-icon</a> source.
73
+ </div>
74
+ <div> <code>label</code> attribute defines the label text.
75
+ </div>
76
+ <h1>Slots</h1>
77
+ <div> <code>leading</code> placeholder for leading icon</div>
78
+ <div> <code>label</code> placeholder for label text</div>
79
+ <div> <code>trailing</code> placeholder for trailing icon</div>
80
+ <div> <code>supporting</code> placeholder for supporting text</div>
81
+ <div> <code>warn</code> warning text, </div>
82
+ <p>
83
+ <code>warn</code> slot content would overlap the <code>supporting</code> slot when not empty.
84
+ Default slot implementation is sensitive to <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLObjectElement/validationMessage"
85
+ >validationMessage property</a>.
86
+ </p>
87
+ <details>
88
+ <summary>Error handling and styling</summary>
89
+ Something small enough to escape casual notice.
90
+ </details>
91
+
92
+ </section>
54
93
  <custom-element tag="cem-input" hidden>
55
- <template>
94
+ <template id="cem-input">
95
+ <attribute name="value" select="//selected[//selected/event] ?? //attributes/@value" ></attribute>
56
96
  <attribute name="name" ></attribute>
57
- <attribute name="label" ></attribute>
58
97
  <attribute name="type" ></attribute>
59
98
  <attribute name="autocapitalize" ></attribute>
60
99
  <attribute name="disabled" ></attribute>
@@ -76,31 +115,49 @@
76
115
  <attribute name="pattern" ></attribute>
77
116
  <attribute name="placeholder" ></attribute>
78
117
  <attribute name="title" ></attribute>
79
- <attribute name="value" ></attribute>
118
+ <attribute name="leading" aria-description="leading icon" ></attribute>
119
+ <attribute name="trailing" aria-description="trailing icon" ></attribute>
120
+ <attribute name="label" aria-description="label text" ></attribute>
121
+ <attribute name="supporting" aria-description="Supporting text" ></attribute>
80
122
 
81
123
  <style>
82
- dce-root
124
+
125
+ &>dce-root
83
126
  {
84
127
  display: flex; flex-direction: column; justify-content: center;
85
128
  --input-padding: 0;
86
129
 
87
- --cem-input-outline: inset 0 -1px 0 black;
88
- --cem-input-outline-focus: inset 0 -3px 0 var(--cem-outline-color-focus);
89
130
  --cem-input-container-shape: 0.25rem;
90
131
  --cem-input-background-color: var(--cem-list-background-color);
91
132
  --cem-input-container-elevation-shadow: 0px 3px 1px -2px rgba(0, 0, 0, .2), 0px 2px 2px 0px rgba(0, 0, 0, .14), 0px 1px 5px 0px rgba(0, 0, 0, .12);
133
+ --cem-input-focus-transition: all 280ms cubic-bezier(0.4, 0, 0.2, 1);
92
134
 
93
- background-color: var(--cem-filled-text-field-container-color, var(--cem-app-surface-variant));
94
-
135
+ &:has(input:invalid,input:user-invalid,input:out-of-range, .warn>*:not(:empty) )
136
+ { --cem-filled-text-field-label-text-color: var(--alert-color,red);
137
+ --cem-input-outline-color:var(--cem-filled-text-field-label-text-color);
138
+ --cem-input-outline: inset 0 -1px 0 var(--cem-input-outline-color);
139
+ --cem-outline-color-focus: var(--cem-input-outline-color);
140
+ color: var(--cem-filled-text-field-label-text-color);
141
+ .supporting{ display: none; }
142
+ }
95
143
  &>label
96
- { display: flex; flex-direction: column; justify-content: center;
97
- flex: 1; padding: 0.5rem 1rem;
144
+ { display: flex; flex: 1; gap: 0.5rem;
145
+ padding: 0.5rem 1rem;
146
+ background-color: var(--cem-filled-text-field-container-color, var(--cem-app-surface-variant));
147
+ &:hover
148
+ { --cem-filled-text-field-container-color: var(--cem-filled-text-field-container-color-hover,silver);
149
+ --cem-input-outline-color:var(--text-color,black);
150
+ box-shadow: inset 0 -1px 0 var(--cem-input-outline-color,black);
151
+ color:var(--text-color,black)
152
+ }
98
153
  box-shadow: var(--cem-input-outline);
99
154
  transition: var(--drop-transition);
100
155
  box-sizing: border-box;
101
156
  min-height: 3.5rem;
102
157
  color: var(--cem-filled-text-field-label-text-color);
103
-
158
+ position: relative;
159
+ &>.entry{ display: flex;flex-direction: column; justify-content: center;flex:1; }
160
+ label{display: flex;}
104
161
  input
105
162
  { background: none; padding: var(--input-padding);
106
163
  &,&:focus,&:focus-visible{ border: none; outline: none; }
@@ -113,54 +170,100 @@
113
170
  font-size: 1rem;
114
171
  transition: var(--drop-transition);
115
172
  }
173
+ &:after{ display: block; width: 0; height: 0; content: ' ';
174
+ left:0;
175
+ transition: var(--cem-input-focus-transition);
176
+ position: absolute; align-self: center;
177
+ bottom: var(--cem-focus-outline-height);
178
+ }
116
179
  }
117
180
  &:focus-within
118
181
  {
119
182
  &> label
120
- { box-shadow: var(--cem-input-outline-focus);
121
- font-size: small; justify-content: space-between;
183
+ { font-size: small; justify-content: space-between;
184
+ color: var(--cem-outline-color-focus);
185
+ input{ caret-color: var(--cem-outline-color-focus); }
186
+ &:after{ width: 100%; height: var(--cem-focus-outline-height);
187
+ left:0;
188
+ background: none;
189
+ box-shadow: 0 var(--cem-focus-outline-height) 0 var(--cem-outline-color-focus);
190
+ align-self: center;
191
+ transition: var(--cem-input-focus-transition);
192
+ }
122
193
  }
123
194
  }
124
195
  label:has( input:not([value=""]) ){ font-size: small; justify-content: space-between;}
125
196
  slice{display: none;}
197
+ .warn,.supporting
198
+ {
199
+ padding: 0.25rem 1rem;
200
+ font-size: var(--cem-form-field-subscript-text-size, var(--cem-sys-body-small-size));
201
+ }
202
+ [slot="trailing"],[slot="leading"]{display: flex;}
126
203
  }
127
204
  </style>
128
- <slot name="head"></slot>
129
- <slot name="input"><label>{$label}<xhtml:input
130
- type="{$type}"
131
- value="{//selected ?? $value}"
132
- slice="selected" slice-event="input"
133
- >
134
- <if test="$required" ><attribute name="required" >{$required }</attribute></if>
135
- <if test="$autocapitalize" ><attribute name="autocapitalize" >{$autocapitalize }</attribute></if>
136
- <if test="$disabled" ><attribute name="disabled" >{$disabled }</attribute></if>
137
- <if test="$multiple" ><attribute name="multiple" >{$multiple }</attribute></if>
138
- <if test="$readonly" ><attribute name="readonly" >{$readonly }</attribute></if>
139
- <if test="$incremental" ><attribute name="incremental" >{$incremental }</attribute></if>
140
- <if test="$max" ><attribute name="max" >{$max }</attribute></if>
141
- <if test="$maxlength" ><attribute name="maxlength" >{$maxlength }</attribute></if>
142
- <if test="$min" ><attribute name="min" >{$min }</attribute></if>
143
- <if test="$minlength" ><attribute name="minlength" >{$minlength }</attribute></if>
144
- <if test="$size" ><attribute name="size" >{$size }</attribute></if>
145
- <if test="$step" ><attribute name="step" >{$step }</attribute></if>
146
- <if test="$tabindex" ><attribute name="tabindex" >{$tabindex }</attribute></if>
147
- <if test="$autocomplete" ><attribute name="autocomplete" >{$autocomplete }</attribute></if>
148
- <if test="$form" ><attribute name="form" >{$form }</attribute></if>
149
- <if test="$id" ><attribute name="id" >{$id }</attribute></if>
150
- <if test="$list" ><attribute name="list" >{$list }</attribute></if>
151
- <if test="$name" ><attribute name="name" >{$name }</attribute></if>
152
- <if test="$pattern" ><attribute name="pattern" >{$pattern }</attribute></if>
153
- <if test="$placeholder" ><attribute name="placeholder" >{$placeholder }</attribute></if>
154
- <if test="$title" ><attribute name="title" >{$title }</attribute></if>
155
-
156
- <slice name="focused" slice-event="blur" slice-value="0"></slice>
157
- <slice name="focused" slice-event="focus" slice-value="1"></slice>
158
- <slice name="filter" slice-event="blur input" slice-value="//selected"></slice>
159
- </xhtml:input></label></slot>
160
- <if test="$required" >$required:{$required }</if>
161
-
162
- <slot name="warn"></slot>
163
- <slot name="foot"></slot>
205
+ <label>
206
+ <slot name="leading">
207
+ <if test="$leading">
208
+ <cem-icon image="{$leading}"></cem-icon>
209
+ </if>
210
+ </slot>
211
+ <div class="entry">
212
+ <slot name="label">
213
+ <if test="$label">
214
+ <span class="label">{$label}</span>
215
+ </if>
216
+ </slot>
217
+ <slot name="input">
218
+ <xhtml:input
219
+ type="{$type}"
220
+ value="{/datadom/attributes/value }"
221
+ slice="selected" slice-event="input"
222
+ size="2"
223
+ >
224
+ <if test="hasBoolAttribute($required)" ><attribute name="required" >{$required }</attribute></if>
225
+ <if test="hasBoolAttribute($disabled)" ><attribute name="disabled" >{$disabled }</attribute></if>
226
+ <if test="hasBoolAttribute($multiple)" ><attribute name="multiple" >{$multiple }</attribute></if>
227
+ <if test="hasBoolAttribute($readonly)" ><attribute name="readonly" >{$readonly }</attribute></if>
228
+ <if test="hasBoolAttribute($incremental)" ><attribute name="incremental" >{$incremental }</attribute></if>
229
+ <if test="$max" ><attribute name="max" >{$max }</attribute></if>
230
+ <if test="$maxlength" ><attribute name="maxlength" >{$maxlength }</attribute></if>
231
+ <if test="$min" ><attribute name="min" >{$min }</attribute></if>
232
+ <if test="$minlength" ><attribute name="minlength" >{$minlength }</attribute></if>
233
+ <if test="$size" ><attribute name="size" >{$size }</attribute></if>
234
+ <if test="$step" ><attribute name="step" >{$step }</attribute></if>
235
+ <if test="$tabindex" ><attribute name="tabindex" >{$tabindex }</attribute></if>
236
+ <if test="$autocapitalize" ><attribute name="autocapitalize" >{$autocapitalize }</attribute></if>
237
+ <if test="$autocomplete" ><attribute name="autocomplete" >{$autocomplete }</attribute></if>
238
+ <if test="$form" ><attribute name="form" >{$form }</attribute></if>
239
+ <if test="$id" ><attribute name="id" >{$id }</attribute></if>
240
+ <if test="$list" ><attribute name="list" >{$list }</attribute></if>
241
+ <if test="$name" ><attribute name="name" >{$name }</attribute></if>
242
+ <if test="$pattern" ><attribute name="pattern" >{$pattern }</attribute></if>
243
+ <if test="$placeholder" ><attribute name="placeholder" >{$placeholder }</attribute></if>
244
+ <if test="$title" ><attribute name="title" >{$title }</attribute></if>
245
+
246
+ <slice name="focused" slice-event="blur" slice-value="0"></slice>
247
+ <slice name="focused" slice-event="focus" slice-value="1"></slice>
248
+ </xhtml:input>
249
+ </slot>
250
+ </div>
251
+ <slot name="trailing">
252
+ <if test="$trailing">
253
+ <cem-icon image="{$trailing}"></cem-icon>
254
+ </if>
255
+ </slot>
256
+ </label>
257
+ <div class="supporting">
258
+ <slot name="supporting">
259
+ <if test="$supporting">
260
+ {$supporting}
261
+ </if>
262
+ </slot>
263
+ </div>
264
+ <div class="warn">
265
+ <slot name="warn">{//warn}</slot>
266
+ </div>
164
267
  </template>
165
268
  </custom-element>
166
269
 
@@ -212,7 +315,7 @@
212
315
  <attribute name="slice" ></attribute>
213
316
  <attribute name="value" select="//val"></attribute>
214
317
  <style>input,label{ width: 100%; } </style>
215
- <label>{$slice}<input slice="val" /></label>
318
+ <label>{$slice}<input slice="val" value="{$value}"/></label>
216
319
  </template>
217
320
  </custom-element>
218
321
 
@@ -225,13 +328,26 @@
225
328
  </template>
226
329
  </custom-element>
227
330
 
331
+ <html-demo-element legend="Most features" description="Focus to see the cursor in input with label shifted upward "
332
+ class="flat-attr"
333
+ >
334
+ <template>
335
+ <cem-input label="String field with leading and trailing icon "
336
+ placeholder="type here"
337
+ supporting="required field. Clear to see placeholder."
338
+ leading="search"
339
+ trailing="close"
340
+ ></cem-input>
341
+ </template>
342
+ </html-demo-element>
343
+
228
344
  <html-demo-element legend="No value" description="Focus to see the cursor in input with label shifted upward ">
229
345
  <template>
230
346
  <cem-input label="String field" ></cem-input>
231
347
  </template>
232
348
  </html-demo-element>
233
349
 
234
- <html-demo-element legend="No value with placeholder" description="focus to see the placeholder text">
350
+ <html-demo-element legend="No value with placeholder" description="focus to see the placeholder text" class="flat-attr">
235
351
  <template>
236
352
  <cem-input label="Number" type="number" placeholder="Enter the numeric value">
237
353
  </cem-input>
@@ -244,21 +360,85 @@
244
360
  </template>
245
361
  </html-demo-element>
246
362
 
247
- <html-demo-element legend="head and foot slots" >
248
- <div slot="description"><code>head</code> slot inserted above input,
249
- <code>foot</code> slot injected bellow</div>
363
+ <html-demo-element legend="leading and trailing slots" >
364
+ <div slot="description"><code>leading</code> slot inserted before input,
365
+ <code>trailing</code> slot injected after</div>
366
+
367
+ <template>
368
+ <cem-input label="slots sample" type="text" >
369
+ <div slot="leading"><cem-icon image="edit"></cem-icon></div>
370
+ <div slot="trailing">
371
+ <cem-icon image="👁"></cem-icon>
372
+ ️<cem-icon image="close"></cem-icon>️
373
+ </div>
374
+ </cem-input>
375
+ </template>
376
+ </html-demo-element>
377
+
378
+
379
+ <html-demo-element legend="password with trailing slots interaction" >
380
+ <div slot="description"><code>trailing</code> and other slots can become functional </div>
250
381
  <p>Those slots can be used for error or hint UI; persistent or triggered by hover/focus.<br/>
251
- <a href="./autocomplete.html">cem-autocomplete</a> uses <code>foot</code> slot for
382
+ <a href="./autocomplete.html">cem-autocomplete</a> uses <code>trailing</code> slot for
252
383
  <a href="./menu.html">menu</a> with suggestions.
253
384
  </p>
385
+ <p>Click in input field to see the focus leading icon <cem-icon image="edit"></cem-icon>
386
+ changed to <cem-icon image="history_edu"></cem-icon></p>
254
387
  <template>
255
- <cem-input label="slots sample" type="text" placeholder="Enter the fruit name">
256
- <div slot="head"> 🍎 <code>head</code> slot </div>
257
- <div slot="foot"> 🍓 <code>foot</code> slot </div>
258
- </cem-input>
388
+ <custom-element>
389
+ <template id="cem-password">
390
+ <attribute name="value" select="//password[//password/event]"></attribute>
391
+
392
+ <style>
393
+ .input-focused{ display: none; }
394
+ .input-unfocused{ display: inline-flex; }
395
+ &:focus-within{
396
+ .input-focused{ display: inline-flex; }
397
+ .input-unfocused{ display:none; }
398
+ }
399
+ .eye-contailer
400
+ { display: flex;
401
+ align-items: center;
402
+ }
403
+
404
+ [type="checkbox"],.visible-ico{ display: none; }
405
+
406
+ &:has([type="checkbox"]:checked)
407
+ {
408
+ .visible-ico{ display: inline-flex; }
409
+ .invisible-ico{ display: none; }
410
+ }
411
+ .invisible-ico
412
+ { color:var(--cem-action-primary-color);
413
+ background-color: var(--cem-action-primary-background);
414
+ transition: var(--cem-action-transition);
415
+ &:hover{
416
+ background-color: var(--cem-action-primary-background-hover);
417
+ box-shadow: var(--cem-action-box-shadow-hover); }
418
+ &:focus{ background-color: var(--cem-action-primary-background-focus); }
419
+ &:active{ background-color: var(--cem-action-primary-background-active); }
420
+ }
421
+ </style>
422
+ <input type="checkbox" slice="visible" id="visible-cb" />
423
+ <cem-input label="password sample" slice="password" value="{//password[//password/event]}">
424
+ <attribute name="type"><if test="not(//visible='on')">password</if></attribute>
425
+ <div slot="leading">
426
+ <cem-icon image="history_edu" class="input-focused"></cem-icon>
427
+ <cem-icon image="edit" class="input-unfocused"></cem-icon>
428
+ </div>
429
+ <div slot="trailing">
430
+ <label class="eye-contailer" for="visible-cb">
431
+ <cem-icon image="visibility" class="visible-ico" tabindex="0"></cem-icon>
432
+ <cem-icon image="visibility_off" class="invisible-ico" tabindex="0"></cem-icon>
433
+ </label>
434
+ </div>
435
+ </cem-input>
436
+ </template>
437
+ </custom-element>
259
438
  </template>
260
439
  </html-demo-element>
261
440
 
441
+
262
442
  <html-demo-element legend="Native error support" >
263
443
  <div slot="descrition">Native <a href="https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation">
264
444
  Form validation</a> is supported. See also <a href="../../custom-element/demo/form.html"><code>custom-element</code> form handling</a> </div>
@@ -274,17 +454,25 @@
274
454
  </html-demo-element>
275
455
 
276
456
  <html-demo-element legend="Error message">
277
- <div slot="description"><code>warn</code> slot is used for warning message</div>
457
+ <div slot="description"><code>warn</code> attribute and slot is used for warning message</div>
458
+ <div slot="description"><code>supporting</code> attribute and slot is used for supplementary message,
459
+ hidden when <code>warn</code> is not empty </div>
278
460
  <template>
279
- <form>
280
- <cem-input required></cem-input>
281
- <button>Next</button>
282
- </form>
461
+
462
+ <cem-input warn="warning message" label="text" value="abc"></cem-input>
463
+ <hr/>
464
+ <cem-input supporting="complimentary message" label="text" value="abc"></cem-input>
465
+ <hr/>
466
+ <cem-input warn="warning message" supporting="complimentary message is overridden by warning" label="text" value="abc"></cem-input>
467
+ <hr/>
468
+ <cem-input warn="warning message" label="text" value="abc">
469
+ <div slot="warn"><cem-icon image="report" size="small"></cem-icon><b>abc</b> is not valid value</div>
470
+ </cem-input>
283
471
  </template>
284
472
  </html-demo-element>
285
473
 
286
474
 
287
- <html-demo-element legend="INPUT field attributes playground" id="play">
475
+ <html-demo-element legend="INPUT field attributes playground" id="play" style="flex: 2 2 80vw;">
288
476
  <div slot="descrition">
289
477
  <p> Underlying implementation uses
290
478
  <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">HTML input</a>.
@@ -299,7 +487,6 @@
299
487
  }
300
488
  label{ display: block; }
301
489
  </style>
302
- <cem-demo-cb slice="autocapitalize" ></cem-demo-cb>
303
490
  <cem-demo-cb slice="disabled" ></cem-demo-cb>
304
491
  <cem-demo-cb slice="multiple" ></cem-demo-cb>
305
492
  <cem-demo-cb slice="readonly" ></cem-demo-cb>
@@ -312,6 +499,7 @@
312
499
  <cem-demo-in slice="size" ></cem-demo-in>
313
500
  <cem-demo-in slice="step" ></cem-demo-in>
314
501
  <cem-demo-in slice="tabindex" ></cem-demo-in>
502
+ <cem-demo-tx slice="autocapitalize" title="on sentences off none words characters "></cem-demo-tx>
315
503
  <cem-demo-tx slice="autocomplete" ></cem-demo-tx>
316
504
  <cem-demo-tx slice="form" ></cem-demo-tx>
317
505
  <cem-demo-tx slice="id" ></cem-demo-tx>
@@ -320,26 +508,46 @@
320
508
  <cem-demo-tx slice="pattern" ></cem-demo-tx>
321
509
  <cem-demo-tx slice="placeholder" ></cem-demo-tx>
322
510
  <cem-demo-tx slice="title" ></cem-demo-tx>
323
- <cem-demo-tx slice="value" ></cem-demo-tx>
511
+ <cem-demo-tx slice="value" value="abc" ></cem-demo-tx>
512
+ &bull;
513
+ <cem-demo-tx slice="label" title="label text" ></cem-demo-tx>
514
+ <cem-demo-tx slice="leading" title="leading icon" ></cem-demo-tx>
515
+ <cem-demo-tx slice="trailing" title="trailing icon" ></cem-demo-tx>
516
+ <cem-demo-tx slice="supporting" title="supporting text" ></cem-demo-tx>
517
+
324
518
  <cem-demo-input-types slice="type"></cem-demo-input-types>
325
519
 
326
520
  <form action="#play">
327
- <cem-input type="{//type}" value="123">
328
- <if test="//autocapitalize = 'autocapitalize'" ><attribute name="autocapitalize" ></attribute></if>
521
+ <cem-input type="{//type}" >
329
522
  <if test="//disabled = 'disabled'" ><attribute name="disabled" ></attribute></if>
330
523
  <if test="//multiple = 'multiple'" ><attribute name="multiple" ></attribute></if>
331
524
  <if test="//readonly = 'readonly'" ><attribute name="readonly" ></attribute></if>
332
525
  <if test="//required = 'required'" ><attribute name="required" ></attribute></if>
333
526
  <if test="//incremental = 'incremental'" ><attribute name="incremental" ></attribute></if>
334
- <if test="not(//max = '')" ><attribute name="max" >{//max}</attribute></if>
335
- <if test="not(//maxlength = '')" ><attribute name="maxlength" >{//maxlength}</attribute></if>
336
- <if test="not(//min = '')" ><attribute name="min" >{//min}</attribute></if>
337
- <if test="not(//minlength = '')" ><attribute name="minlength" >{//minlength}</attribute></if>
338
- <if test="not(//step = '')" ><attribute name="step" >{//step}</attribute></if>
339
- <if test="not(//tabindex = '')" ><attribute name="tabindex" >{//tabindex}</attribute></if>
527
+ <if test="not(//max = '')" ><attribute name="max" >{//max }</attribute></if>
528
+ <if test="not(//maxlength = '')" ><attribute name="maxlength" >{//maxlength }</attribute></if>
529
+ <if test="not(//min = '')" ><attribute name="min" >{//min }</attribute></if>
530
+ <if test="not(//minlength = '')" ><attribute name="minlength" >{//minlength }</attribute></if>
531
+ <if test="not(//size = '')" ><attribute name="size" >{//size }</attribute></if>
532
+ <if test="not(//step = '')" ><attribute name="step" >{//step }</attribute></if>
533
+ <if test="not(//tabindex = '')" ><attribute name="tabindex" >{//tabindex }</attribute></if>
534
+ <if test="not(//autocapitalize='')" ><attribute name="autocapitalize" >{//autocapitalize }</attribute></if>
535
+ <if test="not(//autocomplete = '')" ><attribute name="autocomplete" >{//autocomplete }</attribute></if>
536
+ <if test="not(//form = '')" ><attribute name="form" >{//form }</attribute></if>
537
+ <if test="not(//id = '')" ><attribute name="id" >{//id }</attribute></if>
538
+ <if test="not(//list = '')" ><attribute name="list" >{//list }</attribute></if>
539
+ <if test="not(//name = '')" ><attribute name="name" >{//name }</attribute></if>
540
+ <if test="not(//pattern = '')" ><attribute name="pattern" >{//pattern }</attribute></if>
541
+ <if test="not(//placeholder = '')" ><attribute name="placeholder" >{//placeholder }</attribute></if>
542
+ <if test="not(//title = '')" ><attribute name="title" >{//title }</attribute></if>
543
+ <if test="not(//value = '')" ><attribute name="value" >{//value }</attribute></if>
544
+ <if test="not(//label = '')" ><attribute name="label" >{//label }</attribute></if>
545
+ <if test="not(//leading = '')" ><attribute name="leading" >{//leading }</attribute></if>
546
+ <if test="not(//trailing = '')" ><attribute name="trailing" >{//trailing }</attribute></if>
547
+ <if test="not(//supporting = '')" ><attribute name="supporting" >{//supporting }</attribute></if>
340
548
  </cem-input>
341
549
  <button>Next</button>
342
- <if test="//required = 'required'" >//req:{//required }</if>
550
+ <if test="//disabled = 'disabled'" >//disabled = 'disabled' </if>
343
551
 
344
552
  </form>
345
553
  </template>
@@ -56,16 +56,18 @@
56
56
  <attribute name="direction"></attribute>
57
57
  <attribute name="justify"></attribute>
58
58
  <style>
59
+
60
+ &[direction="column"]>*{ flex-direction: column; }
61
+ &[direction="row" ]>*{ flex-direction: row; }
62
+ &[justify="end" ]>*{ justify-content: flex-end; }
63
+ &[justify="start" ]>*{ justify-content: flex-start;}
64
+
59
65
  dce-root
60
66
  {
61
67
  display: flex;
62
68
  flex-direction: row;
63
69
  flex-wrap: wrap;
64
- &[direction="column"]{ flex-direction: column; }
65
- &[direction="row" ]{ flex-direction: row; }
66
- &[justify="end" ]{ justify-content: flex-end; }
67
- &[justify="start"]{ justify-content: flex-start;}
68
-
70
+ &>style{display: none !important;}
69
71
  &>*
70
72
  { display: flex;
71
73
  align-items: center;