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

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 (175) hide show
  1. package/.idea/custom-element-dist.iml +11 -0
  2. package/.idea/inspectionProfiles/Project_Default.xml +25 -0
  3. package/.idea/misc.xml +6 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/vcs.xml +6 -0
  6. package/.storybook/main.ts +21 -19
  7. package/.storybook/preview.ts +25 -25
  8. package/README.md +4 -4
  9. package/coverage/coverage-final.json +21 -21
  10. package/coverage/index.html +26 -26
  11. package/coverage/src/custom-element/coverage.svg +1 -1
  12. package/coverage/src/custom-element/custom-element.js/coverage.svg +1 -1
  13. package/coverage/src/custom-element/custom-element.js.html +543 -441
  14. package/coverage/src/custom-element/http-request.js.html +12 -12
  15. package/coverage/src/custom-element/index.html +18 -18
  16. package/coverage/src/custom-element/local-storage.js.html +52 -52
  17. package/coverage/src/custom-element/location-element.js.html +4 -4
  18. package/coverage/src/custom-element/module-url.js.html +1 -1
  19. package/coverage/src/index.html +1 -1
  20. package/coverage/src/mocks/handlers.ts.html +1 -1
  21. package/coverage/src/mocks/index.html +1 -1
  22. package/coverage/src/stories/attributes.test.stories.ts/coverage.svg +1 -1
  23. package/coverage/src/stories/attributes.test.stories.ts.html +335 -35
  24. package/coverage/src/stories/coverage.svg +1 -1
  25. package/coverage/src/stories/css.test.stories.ts.html +1 -1
  26. package/coverage/src/stories/dom-merge.test.stories.ts.html +1 -1
  27. package/coverage/src/stories/external-template.test.stories.ts.html +2 -2
  28. package/coverage/src/stories/form.test.stories.ts.html +1 -1
  29. package/coverage/src/stories/http-request.stories.ts.html +1 -1
  30. package/coverage/src/stories/index.html +22 -22
  31. package/coverage/src/stories/local-storage.test.stories.ts.html +17 -17
  32. package/coverage/src/stories/location-element.test.stories.ts.html +3 -6
  33. package/coverage/src/stories/module-url.test.stories.ts.html +1 -1
  34. package/coverage/src/stories/set-url.test.stories.ts.html +1 -1
  35. package/coverage/src/stories/slice-events.test.stories.ts/coverage.svg +1 -1
  36. package/coverage/src/stories/slice-events.test.stories.ts.html +284 -23
  37. package/coverage/src/stories/slots.test.stories.ts.html +1 -1
  38. package/coverage/src/stories/testStoryBook.ts.html +12 -12
  39. package/coverage/src/stories/version-select.test.stories.ts.html +3 -3
  40. package/coverage/src/sum.ts.html +1 -1
  41. package/dist/custom-element-D2wf_rqP.js +576 -0
  42. package/dist/custom-element-Dtzhbjkc.cjs +97 -0
  43. package/dist/custom-element-bundle.cjs +1 -1
  44. package/dist/custom-element-bundle.js +30 -28
  45. package/dist/demo/a.html +51 -38
  46. package/dist/demo/a.svg +26 -26
  47. package/dist/demo/data-slices.html +37 -0
  48. package/dist/demo/external-template.html +1 -0
  49. package/dist/demo/form.html +42 -0
  50. package/dist/demo/hex-grid-dce.html +1 -1
  51. package/dist/demo/hex-grid.html +1 -1
  52. package/dist/demo/parameters.html +20 -1
  53. package/dist/demo/s.xml +6 -12
  54. package/dist/demo/s.xslt +64 -15
  55. package/dist/demo/ss.html +4 -23
  56. package/package.json +13 -13
  57. package/public/demo/a.html +51 -38
  58. package/public/demo/a.svg +26 -26
  59. package/public/demo/data-slices.html +37 -0
  60. package/public/demo/external-template.html +1 -0
  61. package/public/demo/form.html +42 -0
  62. package/public/demo/hex-grid-dce.html +1 -1
  63. package/public/demo/hex-grid.html +1 -1
  64. package/public/demo/parameters.html +20 -1
  65. package/public/demo/s.xml +6 -12
  66. package/public/demo/s.xslt +64 -15
  67. package/public/demo/ss.html +4 -23
  68. package/src/custom-element/custom-element.js +76 -42
  69. package/src/custom-element/demo/a.html +51 -38
  70. package/src/custom-element/demo/a.svg +26 -26
  71. package/src/custom-element/demo/data-slices.html +37 -0
  72. package/src/custom-element/demo/external-template.html +1 -0
  73. package/src/custom-element/demo/form.html +42 -0
  74. package/src/custom-element/demo/hex-grid-dce.html +1 -1
  75. package/src/custom-element/demo/hex-grid.html +1 -1
  76. package/src/custom-element/demo/parameters.html +20 -1
  77. package/src/custom-element/demo/s.xml +6 -12
  78. package/src/custom-element/demo/s.xslt +64 -15
  79. package/src/custom-element/demo/ss.html +4 -23
  80. package/src/custom-element/ide/web-types-dce.json +1 -1
  81. package/src/custom-element/ide/web-types-xsl.json +1 -1
  82. package/src/material/angular.css +987 -987
  83. package/src/material/components/autocomplete.html +239 -240
  84. package/src/material/components/dropdown.html +110 -46
  85. package/src/material/components/icon-link.html +160 -160
  86. package/src/material/components/input.html +363 -0
  87. package/src/material/components/menu.html +234 -234
  88. package/src/material/components.html +121 -120
  89. package/src/material/demo.css +36 -31
  90. package/src/material/index.html +110 -110
  91. package/src/material/material.css +356 -356
  92. package/src/material/theme/README.md +17 -17
  93. package/src/material/theme/semantic.css +113 -112
  94. package/src/mocks/versions.mock.ts +8 -8
  95. package/src/stories/attributes.test.stories.ts +123 -23
  96. package/src/stories/external-template.test.stories.ts +1 -1
  97. package/src/stories/location-element.test.stories.ts +1 -2
  98. package/src/stories/slice-events.test.stories.ts +87 -0
  99. package/storybook-static/assets/Color-F6OSRLHC-BU3iy8jH.js +1 -0
  100. package/storybook-static/assets/{Configure-DOhzHFEs.js → Configure-DN6ifayP.js} +1 -1
  101. package/storybook-static/assets/{DocsRenderer-CFRXHY34-BSJkbsd6.js → DocsRenderer-CFRXHY34-BaVEufDj.js} +2 -2
  102. package/storybook-static/assets/attributes.test.stories-D1X6EBrd.js +278 -0
  103. package/storybook-static/assets/{css.test.stories-pgbBc17d.js → css.test.stories-Cp_g2hE1.js} +1 -1
  104. package/storybook-static/assets/custom-element-uuAtIYWS.js +97 -0
  105. package/storybook-static/assets/{dom-merge.test.stories-CXcYP_-J.js → dom-merge.test.stories-hbpdCka0.js} +1 -1
  106. package/storybook-static/assets/entry-preview-DHVXbf3x.js +26 -0
  107. package/storybook-static/assets/entry-preview-docs-BbcIMweR.js +2 -0
  108. package/storybook-static/assets/{external-template.test.stories-CpJ68Ghy.js → external-template.test.stories-BK89h6sk.js} +3 -3
  109. package/storybook-static/assets/{form.test.stories-D35lyqd8.js → form.test.stories-BfoLe_rw.js} +1 -1
  110. package/storybook-static/assets/{handlers-CW9pDZnt.js → handlers-yVPwH_Nz.js} +21 -21
  111. package/storybook-static/assets/{http-request.stories-CBbknCOO.js → http-request.stories-CBFJS2Ws.js} +1 -1
  112. package/storybook-static/assets/iframe-CJEL_4Nu.js +2 -0
  113. package/storybook-static/assets/index-BcZLpTeD.js +8 -0
  114. package/storybook-static/assets/{index-BSz1w4Gl.js → index-CxRwF5Or.js} +130 -130
  115. package/storybook-static/assets/index-D5fBh-7N.js +1 -0
  116. package/storybook-static/assets/{index-YxUFxnQR.js → index-DM-KBPdl.js} +1 -1
  117. package/storybook-static/assets/{index-B3QjF0Ed.js → index-RSFf30w1.js} +1 -1
  118. package/storybook-static/assets/index-SnjB5uV8.js +769 -0
  119. package/storybook-static/assets/{local-storage.test.stories-BY-PWhuk.js → local-storage.test.stories-C0Yzy6Am.js} +1 -1
  120. package/storybook-static/assets/{location-element.test.stories-3auBYEaU.js → location-element.test.stories-DNFrEu5A.js} +1 -1
  121. package/storybook-static/assets/{module-url.test.stories-B7L9cL60.js → module-url.test.stories-CXibF5Ta.js} +1 -1
  122. package/storybook-static/assets/{preview-CfWMRsRq.js → preview-Bnd0XhaF.js} +2 -2
  123. package/storybook-static/assets/{preview-BRPR-UXC.js → preview-CNKoaWES.js} +1 -1
  124. package/storybook-static/assets/preview-DAeyCMnM.js +1 -0
  125. package/storybook-static/assets/preview-DJMlNTk8.js +2 -0
  126. package/storybook-static/assets/{set-url.test.stories-CuSuDLIx.js → set-url.test.stories-BBfLxv2u.js} +1 -1
  127. package/storybook-static/assets/{slice-events.test.stories-BkRKsKem.js → slice-events.test.stories-HcXF8XQI.js} +138 -13
  128. package/storybook-static/assets/{slots.test.stories-BJCUWFkE.js → slots.test.stories-i6mnIFM2.js} +1 -1
  129. package/storybook-static/assets/tiny-invariant-CopsF_GD.js +1 -0
  130. package/storybook-static/assets/{version-select.test.stories-B3ybJn_Z.js → version-select.test.stories-BsUFH6Va.js} +1 -1
  131. package/storybook-static/demo/a.html +51 -38
  132. package/storybook-static/demo/a.svg +26 -26
  133. package/storybook-static/demo/data-slices.html +37 -0
  134. package/storybook-static/demo/external-template.html +1 -0
  135. package/storybook-static/demo/form.html +42 -0
  136. package/storybook-static/demo/hex-grid-dce.html +1 -1
  137. package/storybook-static/demo/hex-grid.html +1 -1
  138. package/storybook-static/demo/parameters.html +20 -1
  139. package/storybook-static/demo/s.xml +6 -12
  140. package/storybook-static/demo/s.xslt +64 -15
  141. package/storybook-static/demo/ss.html +4 -23
  142. package/storybook-static/iframe.html +2 -2
  143. package/storybook-static/index.html +4 -0
  144. package/storybook-static/index.json +1 -1
  145. package/storybook-static/project.json +1 -1
  146. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js +333 -0
  147. package/storybook-static/sb-addons/chromatic-com-storybook-10/manager-bundle.js.LEGAL.txt +40 -0
  148. package/storybook-static/sb-addons/essentials-actions-3/manager-bundle.js +1 -1
  149. package/storybook-static/sb-addons/essentials-backgrounds-4/manager-bundle.js +8 -8
  150. package/storybook-static/sb-addons/essentials-controls-2/manager-bundle.js +82 -85
  151. package/storybook-static/sb-addons/essentials-measure-7/manager-bundle.js +1 -1
  152. package/storybook-static/sb-addons/essentials-outline-8/manager-bundle.js +1 -1
  153. package/storybook-static/sb-addons/essentials-viewport-5/manager-bundle.js +1 -1
  154. package/storybook-static/sb-addons/interactions-9/manager-bundle.js +66 -67
  155. package/storybook-static/sb-addons/storybook-core-core-server-presets-0/common-manager-bundle.js +1 -1
  156. package/storybook-static/sb-manager/globals-module-info.js +25 -3
  157. package/storybook-static/sb-manager/globals-runtime.js +29585 -43124
  158. package/storybook-static/sb-manager/runtime.js +10647 -9399
  159. package/storybook-static/sb-preview/runtime.js +3536 -5860
  160. package/test-runner-jest.config.js +15 -0
  161. package/dist/custom-element-BOIPgtxz.js +0 -565
  162. package/dist/custom-element-CUsSENWc.cjs +0 -97
  163. package/src/stories/__screenshots__/http-request.test.ts/http-request-url-change-1.png +0 -0
  164. package/storybook-static/assets/Color-ERTF36HU-CQkSD2nd.js +0 -1
  165. package/storybook-static/assets/attributes.test.stories-BJBuuXgZ.js +0 -150
  166. package/storybook-static/assets/custom-element-BDGsYgbP.js +0 -97
  167. package/storybook-static/assets/entry-preview-C313OLrj.js +0 -26
  168. package/storybook-static/assets/entry-preview-docs-B7ORr9w5.js +0 -2
  169. package/storybook-static/assets/iframe-DOi4N7qI.js +0 -2
  170. package/storybook-static/assets/index-BdcJ-iJ7.js +0 -8
  171. package/storybook-static/assets/index-CaL3Qp7t.js +0 -634
  172. package/storybook-static/assets/index-DgFM0Ce3.js +0 -1
  173. package/storybook-static/assets/preview-C992A1Y-.js +0 -2
  174. package/storybook-static/assets/preview-CcS4DQh8.js +0 -1
  175. package/storybook-static/assets/tiny-invariant-BxWVcicq.js +0 -1
@@ -0,0 +1,363 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xhtml="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
6
+ <title>Components - custom-element - Material Design</title>
7
+ <link href="../../custom-element/demo/wc-square.svg" rel="icon"/>
8
+ <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"/>
9
+ <link crossorigin="anonymous" href="https://use.fontawesome.com/releases/v5.15.4/css/all.css"
10
+ integrity="sha384-DyZ88mC6Up2uqS4h/KRgHuoeGwBcD4Ng9SiP4dIRy0EXTlnuz47vAwmeGwVChigm" rel="stylesheet"/>
11
+
12
+ <script type="importmap">
13
+ {
14
+ "imports": {
15
+ "@epa-wg/": "../../"
16
+ }
17
+ }
18
+ </script>
19
+ <script src="../../custom-element/module-url.js" type="module"></script>
20
+ <script src="../../custom-element/custom-element.js" type="module"></script>
21
+ <style>
22
+ @import "../angular.css";
23
+ @import "../material.css";
24
+ @import "../theme/semantic.css";
25
+ @import "../demo.css";
26
+ main{
27
+ display: flex; flex-wrap: wrap;
28
+ gap: 3rem;
29
+ padding: 5rem;
30
+ &>p{ min-width: 90%; }
31
+ html-demo-element{flex:1; width: 100%; }
32
+ }
33
+ </style>
34
+ </head>
35
+
36
+ <body>
37
+ <custom-element hidden src="./icon-link.html#cem-icon-link" tag="cem-icon-link"></custom-element>
38
+
39
+
40
+ <header class="cem-theme-teal">
41
+ <custom-element src="../index.html#nav-head" ></custom-element>
42
+ </header>
43
+ <pre>
44
+ TODO
45
+ * bypass all INPUT attributes
46
+ * error handling
47
+ * link to form error handling
48
+ * docs
49
+ </pre>
50
+ <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>
54
+ <custom-element tag="cem-input" hidden>
55
+ <template>
56
+ <attribute name="name" ></attribute>
57
+ <attribute name="label" ></attribute>
58
+ <attribute name="type" ></attribute>
59
+ <attribute name="autocapitalize" ></attribute>
60
+ <attribute name="disabled" ></attribute>
61
+ <attribute name="multiple" ></attribute>
62
+ <attribute name="readonly" ></attribute>
63
+ <attribute name="required" ></attribute>
64
+ <attribute name="incremental" ></attribute>
65
+ <attribute name="max" ></attribute>
66
+ <attribute name="maxlength" ></attribute>
67
+ <attribute name="min" ></attribute>
68
+ <attribute name="minlength" ></attribute>
69
+ <attribute name="size" ></attribute>
70
+ <attribute name="step" ></attribute>
71
+ <attribute name="tabindex" ></attribute>
72
+ <attribute name="autocomplete" ></attribute>
73
+ <attribute name="form" ></attribute>
74
+ <attribute name="id" ></attribute>
75
+ <attribute name="list" ></attribute>
76
+ <attribute name="pattern" ></attribute>
77
+ <attribute name="placeholder" ></attribute>
78
+ <attribute name="title" ></attribute>
79
+ <attribute name="value" ></attribute>
80
+
81
+ <style>
82
+ dce-root
83
+ {
84
+ display: flex; flex-direction: column; justify-content: center;
85
+ --input-padding: 0;
86
+
87
+ --cem-input-outline: inset 0 -1px 0 black;
88
+ --cem-input-outline-focus: inset 0 -3px 0 var(--cem-outline-color-focus);
89
+ --cem-input-container-shape: 0.25rem;
90
+ --cem-input-background-color: var(--cem-list-background-color);
91
+ --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);
92
+
93
+ background-color: var(--cem-filled-text-field-container-color, var(--cem-app-surface-variant));
94
+
95
+ &>label
96
+ { display: flex; flex-direction: column; justify-content: center;
97
+ flex: 1; padding: 0.5rem 1rem;
98
+ box-shadow: var(--cem-input-outline);
99
+ transition: var(--drop-transition);
100
+ box-sizing: border-box;
101
+ min-height: 3.5rem;
102
+ color: var(--cem-filled-text-field-label-text-color);
103
+
104
+ input
105
+ { background: none; padding: var(--input-padding);
106
+ &,&:focus,&:focus-visible{ border: none; outline: none; }
107
+ &:placeholder-shown{ border: none; outline:none; }
108
+ &[value=""]{ height: 0; }
109
+ &:focus,&:focus-visible,&[placeholder*=""]{ height: auto; }
110
+
111
+ color: var(--cem-filled-text-field-input-text-color, var(--cem-app-on-surface));
112
+ caret-color: var(--cem-filled-text-field-caret-color, var(--cem-app-primary));
113
+ font-size: 1rem;
114
+ transition: var(--drop-transition);
115
+ }
116
+ }
117
+ &:focus-within
118
+ {
119
+ &> label
120
+ { box-shadow: var(--cem-input-outline-focus);
121
+ font-size: small; justify-content: space-between;
122
+ }
123
+ }
124
+ label:has( input:not([value=""]) ){ font-size: small; justify-content: space-between;}
125
+ slice{display: none;}
126
+ }
127
+ </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>
164
+ </template>
165
+ </custom-element>
166
+
167
+ <custom-element tag="cem-demo-input-types" hidden>
168
+ <template>
169
+ <attribute name="value" select="//type"></attribute>
170
+ <label>Type:
171
+ <select slice="type">
172
+ <option value="text" > text </option>
173
+ <option value="date" > date </option>
174
+ <option value="datetime-local"> datetime-local </option>
175
+ <option value="email" > email </option>
176
+ <option value="month" > month </option>
177
+ <option value="number" > number </option>
178
+ <option value="password" > password </option>
179
+ <option value="tel" > tel </option>
180
+ <option value="text" > text </option>
181
+ <option value="time" > time </option>
182
+ <option value="url" > url </option>
183
+ <option value="week" > week </option>
184
+ <optgroup label="other types do not make a sense for cem-input">
185
+ <option value="button" > button </option>
186
+ <option value="checkbox" > checkbox </option>
187
+ <option value="color" > color </option>
188
+ <option value="file" > file </option>
189
+ <option value="hidden" > hidden </option>
190
+ <option value="image" > image </option>
191
+ <option value="radio" > radio </option>
192
+ <option value="range" > range </option>
193
+ <option value="reset" > reset </option>
194
+ <option value="search" > search </option>
195
+ <option value="submit" > submit </option>
196
+ </optgroup>
197
+ </select>
198
+ </label>
199
+ </template>
200
+ </custom-element>
201
+
202
+ <custom-element tag="cem-demo-cb">
203
+ <template>
204
+ <attribute name="slice" ></attribute>
205
+ <attribute name="value" select="//val"></attribute>
206
+ <label><input type="checkbox" value="{$slice}" slice="val" /> {$slice} </label>
207
+ </template>
208
+ </custom-element>
209
+
210
+ <custom-element tag="cem-demo-tx">
211
+ <template>
212
+ <attribute name="slice" ></attribute>
213
+ <attribute name="value" select="//val"></attribute>
214
+ <style>input,label{ width: 100%; } </style>
215
+ <label>{$slice}<input slice="val" /></label>
216
+ </template>
217
+ </custom-element>
218
+
219
+ <custom-element tag="cem-demo-in">
220
+ <template>
221
+ <attribute name="slice" ></attribute>
222
+ <attribute name="value" select="//val"></attribute>
223
+ <style>input,label{ width: 100%; } </style>
224
+ <label>{$slice}<input slice="val" type="number"/></label>
225
+ </template>
226
+ </custom-element>
227
+
228
+ <html-demo-element legend="No value" description="Focus to see the cursor in input with label shifted upward ">
229
+ <template>
230
+ <cem-input label="String field" ></cem-input>
231
+ </template>
232
+ </html-demo-element>
233
+
234
+ <html-demo-element legend="No value with placeholder" description="focus to see the placeholder text">
235
+ <template>
236
+ <cem-input label="Number" type="number" placeholder="Enter the numeric value">
237
+ </cem-input>
238
+ </template>
239
+ </html-demo-element>
240
+
241
+ <html-demo-element legend="Value defined" description="The value should be visible" >
242
+ <template>
243
+ <cem-input label="Text" type="text" value="abc"></cem-input>
244
+ </template>
245
+ </html-demo-element>
246
+
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>
250
+ <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
252
+ <a href="./menu.html">menu</a> with suggestions.
253
+ </p>
254
+ <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>
259
+ </template>
260
+ </html-demo-element>
261
+
262
+ <html-demo-element legend="Native error support" >
263
+ <div slot="descrition">Native <a href="https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation">
264
+ Form validation</a> is supported. See also <a href="../../custom-element/demo/form.html"><code>custom-element</code> form handling</a> </div>
265
+ <div><code>required</code> attribute would trigger the system message if the field is empty.</div>
266
+ <div>
267
+ Press Next button to see the browser error popup.</div>
268
+ <template>
269
+ <form>
270
+ <cem-input required></cem-input>
271
+ <button>Next</button>
272
+ </form>
273
+ </template>
274
+ </html-demo-element>
275
+
276
+ <html-demo-element legend="Error message">
277
+ <div slot="description"><code>warn</code> slot is used for warning message</div>
278
+ <template>
279
+ <form>
280
+ <cem-input required></cem-input>
281
+ <button>Next</button>
282
+ </form>
283
+ </template>
284
+ </html-demo-element>
285
+
286
+
287
+ <html-demo-element legend="INPUT field attributes playground" id="play">
288
+ <div slot="descrition">
289
+ <p> Underlying implementation uses
290
+ <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input">HTML input</a>.
291
+ All its attributes are supported.
292
+ </p>
293
+ <custom-element >
294
+ <template>
295
+ <style>
296
+ &>dce-root
297
+ { display: flex; flex-wrap: wrap; gap: 2rem; align-items: center;
298
+ &>*{ flex: 1 1 10rem; }
299
+ }
300
+ label{ display: block; }
301
+ </style>
302
+ <cem-demo-cb slice="autocapitalize" ></cem-demo-cb>
303
+ <cem-demo-cb slice="disabled" ></cem-demo-cb>
304
+ <cem-demo-cb slice="multiple" ></cem-demo-cb>
305
+ <cem-demo-cb slice="readonly" ></cem-demo-cb>
306
+ <cem-demo-cb slice="required" ></cem-demo-cb>
307
+ <cem-demo-cb slice="incremental" ></cem-demo-cb>
308
+ <cem-demo-in slice="max" ></cem-demo-in>
309
+ <cem-demo-in slice="maxlength" ></cem-demo-in>
310
+ <cem-demo-in slice="min" ></cem-demo-in>
311
+ <cem-demo-in slice="minlength" ></cem-demo-in>
312
+ <cem-demo-in slice="size" ></cem-demo-in>
313
+ <cem-demo-in slice="step" ></cem-demo-in>
314
+ <cem-demo-in slice="tabindex" ></cem-demo-in>
315
+ <cem-demo-tx slice="autocomplete" ></cem-demo-tx>
316
+ <cem-demo-tx slice="form" ></cem-demo-tx>
317
+ <cem-demo-tx slice="id" ></cem-demo-tx>
318
+ <cem-demo-tx slice="list" ></cem-demo-tx>
319
+ <cem-demo-tx slice="name" ></cem-demo-tx>
320
+ <cem-demo-tx slice="pattern" ></cem-demo-tx>
321
+ <cem-demo-tx slice="placeholder" ></cem-demo-tx>
322
+ <cem-demo-tx slice="title" ></cem-demo-tx>
323
+ <cem-demo-tx slice="value" ></cem-demo-tx>
324
+ <cem-demo-input-types slice="type"></cem-demo-input-types>
325
+
326
+ <form action="#play">
327
+ <cem-input type="{//type}" value="123">
328
+ <if test="//autocapitalize = 'autocapitalize'" ><attribute name="autocapitalize" ></attribute></if>
329
+ <if test="//disabled = 'disabled'" ><attribute name="disabled" ></attribute></if>
330
+ <if test="//multiple = 'multiple'" ><attribute name="multiple" ></attribute></if>
331
+ <if test="//readonly = 'readonly'" ><attribute name="readonly" ></attribute></if>
332
+ <if test="//required = 'required'" ><attribute name="required" ></attribute></if>
333
+ <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>
340
+ </cem-input>
341
+ <button>Next</button>
342
+ <if test="//required = 'required'" >//req:{//required }</if>
343
+
344
+ </form>
345
+ </template>
346
+ </custom-element>
347
+
348
+ </div>
349
+ <template>
350
+ </template>
351
+ </html-demo-element>
352
+
353
+ </main>
354
+ <footer>
355
+ <hr/>
356
+ Powered by Syngrafact Corp. ©2024.<br/>
357
+ <a href="../../LICENSE"> Code and documentation licensed under an Apache License 2.0 </a>
358
+ </footer>
359
+ <!--<script type="module" src="./html-demo-element.js"></script>-->
360
+ <script type="module" src="https://unpkg.com/html-demo-element@1/html-demo-element.js"></script>
361
+
362
+ </body>
363
+ </html>