@sebgroup/green-core 1.41.4 → 1.43.0

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 (142) hide show
  1. package/chunks/{chunk.LFJRIUDW.js → chunk.27E4EAEK.js} +1 -1
  2. package/chunks/{chunk.OZKMO7MO.js → chunk.45G6WXHQ.js} +4 -4
  3. package/chunks/{chunk.U5ZRINAQ.js → chunk.5ILTFS7Z.js} +4 -4
  4. package/chunks/{chunk.TIZKFTOL.js → chunk.6TK2YLON.js} +4 -4
  5. package/chunks/{chunk.7LRXZSEN.js → chunk.7DT5MKRB.js} +16 -16
  6. package/chunks/{chunk.5HZZAANC.js → chunk.AYPTUHYC.js} +36 -8
  7. package/chunks/chunk.BMCPXEME.js +547 -0
  8. package/chunks/{chunk.PGF5IHBJ.js → chunk.BSBZ273F.js} +4 -5
  9. package/chunks/{chunk.QMCIUYKV.js → chunk.BV4C5SVG.js} +4 -4
  10. package/chunks/{chunk.46EN32JA.js → chunk.C7Y7PTZR.js} +4 -3
  11. package/chunks/chunk.CK2UGCPG.js +0 -0
  12. package/chunks/{chunk.3CMOBJLQ.js → chunk.COV7GAYR.js} +1 -1
  13. package/chunks/chunk.CXRT6D5K.js +37 -0
  14. package/chunks/chunk.FJYZD6XI.js +85 -0
  15. package/chunks/{chunk.UYKGWW26.js → chunk.G5USMKIK.js} +4 -4
  16. package/chunks/chunk.GWCQWDVH.js +652 -0
  17. package/chunks/{chunk.5OEMCN3X.js → chunk.GZZHMTT6.js} +4 -4
  18. package/chunks/{chunk.4VW724L2.js → chunk.JMCXGEXD.js} +1 -1
  19. package/chunks/{chunk.6UWH3HEF.js → chunk.MPWX3JFB.js} +185 -69
  20. package/chunks/chunk.MRMXDOA5.js +0 -0
  21. package/chunks/{chunk.KDPIWUU4.js → chunk.N36GFO5Q.js} +2 -2
  22. package/chunks/{chunk.NCVXC67U.js → chunk.O7DQRPML.js} +36 -12
  23. package/chunks/{chunk.CB6SQEYF.js → chunk.PINFIHVO.js} +1 -1
  24. package/chunks/{chunk.7QHWOINK.js → chunk.QX3VLACM.js} +2 -2
  25. package/chunks/chunk.SIMOQIAG.js +363 -0
  26. package/chunks/{chunk.35VXSWIL.js → chunk.U5ZHQXSW.js} +24 -14
  27. package/chunks/chunk.U7PZF5JG.js +142 -0
  28. package/chunks/{chunk.UNXDEINN.js → chunk.UO5V45G5.js} +3 -3
  29. package/chunks/{chunk.2WIGXRMD.js → chunk.VM32X2K4.js} +303 -301
  30. package/chunks/chunk.VOYMQ322.js +1 -1
  31. package/chunks/{chunk.GHL35SB7.js → chunk.WPF76QMP.js} +33 -9
  32. package/chunks/{chunk.ADPMTWTS.js → chunk.XKACXVCM.js} +55 -44
  33. package/chunks/{chunk.Z27WVNGN.js → chunk.XUSFHKBA.js} +1 -1
  34. package/chunks/chunk.YGBQCHTD.js +107 -0
  35. package/chunks/{chunk.2BMJPIND.js → chunk.YUFO2JLT.js} +4 -1
  36. package/components/badge/badge.d.ts +27 -3
  37. package/components/badge/badge.figma.js +2 -2
  38. package/components/badge/badge.js +2 -4
  39. package/components/badge/index.js +3 -4
  40. package/components/button/button.d.ts +1 -1
  41. package/components/button/button.js +4 -5
  42. package/components/button/fab/fab.js +6 -7
  43. package/components/button/fab/index.js +6 -7
  44. package/components/button/index.js +4 -5
  45. package/components/calendar/calendar.js +2 -2
  46. package/components/calendar/index.js +2 -2
  47. package/components/content/divider/divider.js +3 -3
  48. package/components/content/divider/index.js +3 -3
  49. package/components/content/spacer/index.js +3 -3
  50. package/components/content/spacer/spacer.js +3 -3
  51. package/components/content/text/index.js +4 -3
  52. package/components/content/text/text.d.ts +25 -9
  53. package/components/content/text/text.js +3 -3
  54. package/components/context-menu/context-menu.js +2 -2
  55. package/components/context-menu/index.js +2 -2
  56. package/components/datepicker/datepicker.js +9 -10
  57. package/components/datepicker/index.js +9 -10
  58. package/components/dropdown/dropdown.js +7 -8
  59. package/components/dropdown/index.js +7 -8
  60. package/components/filter-chips/filter-chip/filter-chip.js +4 -5
  61. package/components/filter-chips/filter-chip/index.js +4 -5
  62. package/components/filter-chips/filter-chips.js +5 -6
  63. package/components/filter-chips/index.js +5 -6
  64. package/components/form/form-control.d.ts +1 -0
  65. package/components/form/form-control.js +1 -1
  66. package/components/form/index.js +6 -6
  67. package/components/form/summary/index.js +6 -6
  68. package/components/form/summary/summary.js +6 -6
  69. package/components/icon/icons/index.js +3 -3
  70. package/components/index.d.ts +3 -0
  71. package/components/index.js +48 -36
  72. package/components/input/index.js +23 -4
  73. package/components/input/input.d.ts +21 -14
  74. package/components/input/input.js +23 -4
  75. package/components/layout/card/card.d.ts +1 -91
  76. package/components/layout/card/card.js +4 -4
  77. package/components/layout/card/index.js +4 -4
  78. package/components/layout/container/container.d.ts +229 -12
  79. package/components/layout/container/container.js +3 -3
  80. package/components/layout/container/index.js +3 -3
  81. package/components/layout/flex/flex.d.ts +35 -5
  82. package/components/layout/flex/flex.js +4 -4
  83. package/components/layout/flex/index.js +4 -4
  84. package/components/layout/grid/grid.d.ts +1 -1
  85. package/components/layout/grid/grid.js +4 -4
  86. package/components/layout/grid/index.js +4 -4
  87. package/components/layout/mask/index.d.ts +1 -0
  88. package/components/layout/mask/index.js +18 -0
  89. package/components/layout/mask/mask.d.ts +30 -0
  90. package/components/layout/mask/mask.js +18 -0
  91. package/components/media/img/img.d.ts +10 -10
  92. package/components/media/img/img.js +3 -4
  93. package/components/media/img/index.js +3 -4
  94. package/components/media/video/index.js +3 -4
  95. package/components/media/video/video.d.ts +10 -10
  96. package/components/media/video/video.js +3 -4
  97. package/components/menu-button/index.js +4 -4
  98. package/components/menu-button/menu-button.d.ts +1 -1
  99. package/components/menu-button/menu-button.js +4 -4
  100. package/components/segmented-control/index.js +3 -3
  101. package/components/segmented-control/segment/index.js +2 -2
  102. package/components/segmented-control/segment/segment.js +2 -2
  103. package/components/segmented-control/segmented-control.js +3 -3
  104. package/components/textarea/index.d.ts +1 -0
  105. package/components/textarea/index.js +37 -0
  106. package/components/textarea/textarea.d.ts +91 -0
  107. package/components/textarea/textarea.js +37 -0
  108. package/components/textarea/textarea.styles.d.ts +1 -0
  109. package/components/theme/index.js +2 -2
  110. package/components/theme/theme.js +2 -2
  111. package/index.js +47 -35
  112. package/package.json +1 -1
  113. package/primitives/listbox/index.js +3 -3
  114. package/primitives/listbox/listbox.js +3 -3
  115. package/primitives/listbox/option.js +3 -3
  116. package/primitives/menu/index.js +2 -2
  117. package/primitives/menu/menu-item.js +2 -2
  118. package/primitives/menu/menu.js +2 -2
  119. package/primitives/ripple/index.js +2 -2
  120. package/primitives/ripple/ripple.js +2 -2
  121. package/primitives/signal/index.js +3 -4
  122. package/primitives/signal/signal.js +3 -4
  123. package/utils/decorators/style-expression-property.d.ts +16 -1
  124. package/utils/helpers/style-expression-parser-tester.d.ts +1 -0
  125. package/utils/helpers/style-expression-parser.d.ts +5 -1
  126. package/chunks/chunk.7VC33K5Z.js +0 -49
  127. package/chunks/chunk.DONYL7JA.js +0 -625
  128. package/chunks/chunk.DXFB4XE4.js +0 -145
  129. package/chunks/chunk.NKSKWGNM.js +0 -28
  130. package/chunks/chunk.QQNADZQJ.js +0 -100
  131. package/chunks/chunk.S7GBHO2E.js +0 -40
  132. package/chunks/chunk.SXGACXKX.js +0 -28
  133. package/chunks/chunk.XAOS66M6.js +0 -103
  134. package/chunks/chunk.YBOK7MI7.js +0 -31
  135. package/components/media/img/img.style.css.js +0 -7
  136. package/components/media/video/video.style.css.js +0 -7
  137. package/primitives/signal/signal.style.css.js +0 -7
  138. /package/chunks/{chunk.WK7IKANC.js → chunk.BPGOHQLS.js} +0 -0
  139. /package/components/layout/{card/card.style.d.ts → mask/mask.style.d.ts} +0 -0
  140. /package/components/media/img/{img.style.css.d.ts → img.style.d.ts} +0 -0
  141. /package/components/media/video/{video.style.css.d.ts → video.style.d.ts} +0 -0
  142. /package/primitives/signal/{signal.style.css.d.ts → signal.style.d.ts} +0 -0
@@ -1,625 +0,0 @@
1
- import {
2
- forwardAttributes
3
- } from "./chunk.YBOK7MI7.js";
4
- import {
5
- GdsFormControlElement
6
- } from "./chunk.2BMJPIND.js";
7
- import {
8
- constrainSlots
9
- } from "./chunk.KBYQYDL3.js";
10
- import {
11
- tokens
12
- } from "./chunk.2WIGXRMD.js";
13
- import {
14
- watch
15
- } from "./chunk.2WO4NHJ2.js";
16
- import {
17
- gdsCustomElement,
18
- html
19
- } from "./chunk.VOYMQ322.js";
20
- import {
21
- __decorateClass,
22
- __privateAdd,
23
- __privateGet,
24
- __privateMethod,
25
- __spreadProps,
26
- __spreadValues
27
- } from "./chunk.5VURDMKE.js";
28
-
29
- // libs/core/src/components/input/input.ts
30
- import { LitElement } from "lit";
31
- import { property, query, queryAsync } from "lit/decorators.js";
32
- import { until } from "lit/directives/until.js";
33
- import { nothing } from "lit/html.js";
34
- import { when } from "lit/directives/when.js";
35
- import { choose } from "lit/directives/choose.js";
36
- import { msg } from "@lit/localize";
37
-
38
- // libs/core/src/components/input/input.styles.ts
39
- import { css } from "lit";
40
- var styles = css`
41
- @layer tokens, a11y, base, simplified;
42
-
43
- @layer tokens {
44
- :host {
45
- --_color-bg: var(--gds-sys-color-container-container);
46
-
47
- --_color-border: var(--gds-sys-color-stroke-stroke-variant1);
48
- --_border-radius: 0.5rem;
49
- --_border-width: 0.0625rem;
50
- --_border-width-hover: 0.125rem;
51
-
52
- --_color-outline-alpha: 60%;
53
- --_color-outline: color-mix(
54
- in srgb,
55
- var(--_color-border),
56
- transparent var(--_color-outline-alpha)
57
- );
58
-
59
- --_transition: var(--gds-sys-transition);
60
- --_lh: 1.25;
61
- --_core-min-block-size: 3.5rem;
62
- --_gap: 0.5rem;
63
- --_padding-block: 0.625rem;
64
- --_padding-inline: 1rem;
65
- --_core-icon-size: 1.5rem;
66
- --_inner-height: 2rem;
67
- }
68
- }
69
-
70
- @layer a11y {
71
- /* @media (prefers-color-scheme: dark) {
72
- :host {
73
- --_color-bg: var(--_color-bg-dark);
74
- }
75
- } */
76
-
77
- @media (prefers-reduced-motion: reduce) {
78
- :host {
79
- --_transition: none;
80
- }
81
- }
82
-
83
- @media (prefers-reduced-transparency: reduce) {
84
- :host {
85
- --_transparency: 1;
86
- }
87
- }
88
-
89
- /* @media (prefers-contrast: more) {
90
- :host {
91
- --_color-bg: hsla(60, 4%, 96%, 1);
92
- --_color-outline-alpha: 0%;
93
- }
94
- } */
95
- }
96
-
97
- @layer base {
98
- * {
99
- box-sizing: border-box;
100
- }
101
-
102
- :host {
103
- contain: layout;
104
- display: block;
105
- isolation: isolate;
106
- }
107
-
108
- .head {
109
- align-items: center;
110
- display: flex;
111
- justify-content: space-between;
112
- padding-inline-end: 1rem;
113
- }
114
-
115
- label {
116
- font-weight: 400;
117
- }
118
-
119
- .foot {
120
- align-items: center;
121
- display: flex;
122
- justify-content: space-between;
123
- padding-inline-end: 1rem;
124
-
125
- gds-badge {
126
- align-self: flex-end;
127
- }
128
-
129
- :first-child {
130
- flex-grow: 1;
131
- }
132
- }
133
-
134
- .supporting-text,
135
- .error-text {
136
- font-size: 0.875rem;
137
- }
138
-
139
- slot[name='extended-supporting-text'] {
140
- background-color: #eee;
141
- border: 1px solid #ccc;
142
- border-radius: 0.5rem;
143
- display: block;
144
- font-size: 0.875rem;
145
- margin-top: 0.5rem;
146
- opacity: 0;
147
- padding: 1rem;
148
- transition: var(--_transition);
149
-
150
- [aria-hidden='false'] & {
151
- opacity: 1;
152
- }
153
- }
154
-
155
- div.extended-supporting-text {
156
- display: grid;
157
- grid-template-rows: 0fr;
158
- transition: var(--_transition);
159
-
160
- > * {
161
- overflow: hidden;
162
- }
163
-
164
- &[aria-hidden='false'] {
165
- grid-template-rows: 1fr;
166
- opacity: 1;
167
- }
168
- }
169
-
170
- input[type='number']::-webkit-inner-spin-button {
171
- display: none;
172
- }
173
-
174
- input,
175
- textarea {
176
- appearance: none;
177
- background-color: transparent;
178
- border: 0;
179
- box-sizing: border-box;
180
- font-family: inherit;
181
- font-size: var(--_fs);
182
- line-height: var(--_lh);
183
- margin: unset;
184
- min-height: var(--_inner-height);
185
- outline: none;
186
- overflow: hidden;
187
- padding: unset;
188
- transition: var(--_transition);
189
- width: 100%;
190
-
191
- &:focus:not(:focus-visible) {
192
- outline: none;
193
- }
194
-
195
- &::-webkit-inner-spin-button,
196
- &::-webkit-calendar-picker-indicator {
197
- appearance: none;
198
- background-color: rgb(195, 0, 255);
199
- background-image: none;
200
- height: 100%;
201
- position: absolute;
202
- right: 0;
203
- top: 0;
204
- width: 40px;
205
- }
206
- }
207
-
208
- textarea {
209
- max-height: max(var(--_inner-height), calc(1lh * var(--_lines)));
210
- min-height: max(var(--_inner-height), calc(1lh * var(--_lines)));
211
- overflow: hidden;
212
- resize: none;
213
- transition: unset;
214
- }
215
-
216
- .field {
217
- align-items: flex-start;
218
- background-color: var(--_color-bg);
219
- block-size: max-content;
220
- border: var(--_border-width) solid var(--_color-border);
221
- border-radius: var(--_border-radius);
222
- cursor: text;
223
- display: flex;
224
- flex-direction: row;
225
- gap: var(--_gap);
226
- justify-content: center;
227
- margin-block: var(--_gap);
228
- min-block-size: var(--_core-min-block-size);
229
- outline-color: transparent;
230
- outline-offset: var(--_border-width);
231
- outline-style: solid;
232
- outline-width: var(--_border-width-hover);
233
- padding-block: var(--_padding-block);
234
- padding-inline: var(--_padding-inline);
235
- position: relative;
236
- transition: var(--_transition);
237
-
238
- &:focus:not(:focus-visible) {
239
- outline: none;
240
- }
241
-
242
- &:hover {
243
- --_color-bg: var(--gds-sys-color-container-container-dim2);
244
- }
245
-
246
- &:has(input:focus, textarea:focus) {
247
- /* --_border-width: var(--_border-width-hover); */
248
- border: var(--_border-width) solid var(--_color-border);
249
- border-radius: var(--_border-radius);
250
- box-shadow: none;
251
- outline-color: var(--_color-outline);
252
- transition: var(--_transition);
253
- }
254
-
255
- slot {
256
- align-items: center;
257
- display: flex;
258
- height: var(--_inner-height);
259
- }
260
- }
261
-
262
- :host(:invalid) .field {
263
- --_color-bg: var(--gds-sys-color-status-negative-negative-bright);
264
- --_color-border: var(--gds-sys-color-stroke-stroke-negative);
265
- --_color-outline: var(--gds-sys-color-stroke-stroke-negative);
266
- color: var(--gds-sys-color-status-negative-on-negative-bright);
267
- }
268
-
269
- :host(:invalid) .error-text {
270
- color: var(--gds-sys-color-status-negative-on-negative-bright);
271
- }
272
-
273
- :host(:invalid) label {
274
- color: var(--gds-sys-color-status-negative-on-negative-bright);
275
- }
276
- }
277
-
278
- @layer simplified {
279
- :host([variant='simplified']) label {
280
- align-items: center;
281
- background-color: transparent;
282
- display: block;
283
- height: max-content;
284
- inset: 0;
285
- width: 100%;
286
-
287
- div {
288
- line-height: var(--_lh);
289
- position: absolute;
290
- top: 50%;
291
- transform: translateY(-50%);
292
- transition: var(--_transition);
293
- }
294
- }
295
-
296
- :host([variant='simplified'])
297
- label:has(
298
- input:not(:placeholder-shown, [readonly]),
299
- textarea:not(:placeholder-shown, [readonly])
300
- ),
301
- :host([variant='simplified']) label:focus-within {
302
- div {
303
- font-size: 0.75rem;
304
- font-weight: 500;
305
- top: 0.375rem;
306
- transform: translateY(
307
- translateY(calc(0px - var(--gds-input-label-translate)))
308
- );
309
- }
310
-
311
- input,
312
- textarea {
313
- margin-top: 0.75rem;
314
- }
315
- }
316
- }
317
- `;
318
-
319
- // libs/core/src/components/input/input.ts
320
- var _renderDefault, renderDefault_fn, _renderSimplified, renderSimplified_fn, _forwardableAttrs, _handleOnInput, _handleOnChange, _handleFieldClick, _handleClearBtnClick, _handleSupportingTextBtnClick, _renderNativeInput, renderNativeInput_fn, _renderNativeTextarea, renderNativeTextarea_fn, _renderSupportingText, renderSupportingText_fn, _renderExtendedSupportingText, renderExtendedSupportingText_fn, _renderClearButton, renderClearButton_fn, _shouldShowRemainingChars, shouldShowRemainingChars_get, _renderRemainingCharsBadge, renderRemainingCharsBadge_fn, _asyncRenderExtendedSupportingTextButton, asyncRenderExtendedSupportingTextButton_fn;
321
- var GdsInput = class extends GdsFormControlElement {
322
- constructor() {
323
- super();
324
- // variant="default"
325
- __privateAdd(this, _renderDefault);
326
- // variant="simplified"
327
- __privateAdd(this, _renderSimplified);
328
- __privateAdd(this, _renderNativeInput);
329
- __privateAdd(this, _renderNativeTextarea);
330
- __privateAdd(this, _renderSupportingText);
331
- __privateAdd(this, _renderExtendedSupportingText);
332
- __privateAdd(this, _renderClearButton);
333
- __privateAdd(this, _shouldShowRemainingChars);
334
- __privateAdd(this, _renderRemainingCharsBadge);
335
- /**
336
- * Returns a promise that resolves when the DOM query for the extended supporting text slot has resolved.
337
- * If the slot is empty, an empty template is returned, otherwise the support text toggle button is returned.
338
- */
339
- __privateAdd(this, _asyncRenderExtendedSupportingTextButton);
340
- this.value = "";
341
- this.label = "";
342
- this.supportingText = "";
343
- this.showExtendedSupportingText = false;
344
- this.clearable = false;
345
- this.maxlength = Number.MAX_SAFE_INTEGER;
346
- this.variant = "default";
347
- this.multiline = false;
348
- // Any attribute name added here will get forwarded to the native <input> element.
349
- __privateAdd(this, _forwardableAttrs, (attr) => ["type", "placeholder", "required"].includes(attr.name));
350
- __privateAdd(this, _handleOnInput, (e) => {
351
- const element = e.target;
352
- this.value = element.value;
353
- });
354
- __privateAdd(this, _handleOnChange, (e) => {
355
- const element = e.target;
356
- this.value = element.value;
357
- this.dispatchEvent(
358
- new Event("change", {
359
- bubbles: true,
360
- composed: true
361
- })
362
- );
363
- });
364
- __privateAdd(this, _handleFieldClick, () => {
365
- this.elInputAsync.then((el) => el.focus());
366
- });
367
- __privateAdd(this, _handleClearBtnClick, () => {
368
- this.value = "";
369
- });
370
- __privateAdd(this, _handleSupportingTextBtnClick, () => {
371
- this.showExtendedSupportingText = !this.showExtendedSupportingText;
372
- this.dispatchEvent(
373
- new CustomEvent("gds-ui-state", {
374
- bubbles: true,
375
- composed: true,
376
- detail: this.showExtendedSupportingText
377
- })
378
- );
379
- });
380
- constrainSlots(this);
381
- }
382
- connectedCallback() {
383
- super.connectedCallback();
384
- this._setAutoHeight();
385
- }
386
- render() {
387
- return html`${choose(this.variant, [
388
- ["default", () => __privateMethod(this, _renderDefault, renderDefault_fn).call(this)],
389
- ["simplified", () => __privateMethod(this, _renderSimplified, renderSimplified_fn).call(this)]
390
- ])}`;
391
- }
392
- _getValidityAnchor() {
393
- return this.elInput;
394
- }
395
- _setAutoHeight() {
396
- if (!this.multiline)
397
- return;
398
- this.elInputAsync.then((element) => {
399
- const lines = (element.value.split("\n").length || 1).toString();
400
- element == null ? void 0 : element.style.setProperty("--_lines", lines.toString());
401
- });
402
- }
403
- };
404
- _renderDefault = new WeakSet();
405
- renderDefault_fn = function() {
406
- return html`
407
- <div class="head">
408
- <label for="input">${this.label}</label>
409
- ${until(__privateMethod(this, _asyncRenderExtendedSupportingTextButton, asyncRenderExtendedSupportingTextButton_fn).call(this), nothing)}
410
- </div>
411
-
412
- ${__privateMethod(this, _renderSupportingText, renderSupportingText_fn).call(this)} ${__privateMethod(this, _renderExtendedSupportingText, renderExtendedSupportingText_fn).call(this)}
413
-
414
- <div class="field" @click=${__privateGet(this, _handleFieldClick)}>
415
- <slot name="lead"></slot>
416
- ${when(
417
- this.multiline,
418
- () => html`${__privateMethod(this, _renderNativeTextarea, renderNativeTextarea_fn).call(this)}`,
419
- () => html`${__privateMethod(this, _renderNativeInput, renderNativeInput_fn).call(this)}`
420
- )}
421
- <slot name="trail" gds-allow="gds-badge"></slot>
422
- ${__privateMethod(this, _renderClearButton, renderClearButton_fn).call(this)}
423
- </div>
424
-
425
- <div class="foot">
426
- <div>
427
- ${when(
428
- this.invalid,
429
- () => html`<span class="error-text">${this.validationMessage}</span>`
430
- )}
431
- </div>
432
- ${when(
433
- __privateGet(this, _shouldShowRemainingChars, shouldShowRemainingChars_get),
434
- () => __privateMethod(this, _renderRemainingCharsBadge, renderRemainingCharsBadge_fn).call(this)
435
- )}
436
- </div>
437
- `;
438
- };
439
- _renderSimplified = new WeakSet();
440
- renderSimplified_fn = function() {
441
- return html`
442
- <div class="field" @click=${__privateGet(this, _handleFieldClick)}>
443
- <slot name="lead"></slot>
444
- <label for="input">
445
- <div>${this.label}</div>
446
- ${when(
447
- this.multiline,
448
- () => html`${__privateMethod(this, _renderNativeTextarea, renderNativeTextarea_fn).call(this)}`,
449
- () => html`${__privateMethod(this, _renderNativeInput, renderNativeInput_fn).call(this)}`
450
- )}
451
- </label>
452
- <slot name="trail" gds-allow="gds-badge"></slot>
453
- ${__privateMethod(this, _renderClearButton, renderClearButton_fn).call(this)}
454
- </div>
455
-
456
- <div class="foot">
457
- ${__privateMethod(this, _renderSupportingText, renderSupportingText_fn).call(this)}
458
- ${when(
459
- __privateGet(this, _shouldShowRemainingChars, shouldShowRemainingChars_get),
460
- () => __privateMethod(this, _renderRemainingCharsBadge, renderRemainingCharsBadge_fn).call(this)
461
- )}
462
- ${until(__privateMethod(this, _asyncRenderExtendedSupportingTextButton, asyncRenderExtendedSupportingTextButton_fn).call(this), nothing)}
463
- </div>
464
-
465
- ${__privateMethod(this, _renderExtendedSupportingText, renderExtendedSupportingText_fn).call(this)}
466
- `;
467
- };
468
- _forwardableAttrs = new WeakMap();
469
- _handleOnInput = new WeakMap();
470
- _handleOnChange = new WeakMap();
471
- _handleFieldClick = new WeakMap();
472
- _handleClearBtnClick = new WeakMap();
473
- _handleSupportingTextBtnClick = new WeakMap();
474
- _renderNativeInput = new WeakSet();
475
- renderNativeInput_fn = function() {
476
- return html`
477
- <input
478
- @input=${__privateGet(this, _handleOnInput)}
479
- @change=${__privateGet(this, _handleOnChange)}
480
- .value=${this.value}
481
- id="input"
482
- aria-describedby="supporting-text"
483
- placeholder=" "
484
- ${forwardAttributes(__privateGet(this, _forwardableAttrs))}
485
- />
486
- `;
487
- };
488
- _renderNativeTextarea = new WeakSet();
489
- renderNativeTextarea_fn = function() {
490
- return html`
491
- <textarea
492
- @input=${__privateGet(this, _handleOnInput)}
493
- @change=${__privateGet(this, _handleOnChange)}
494
- .value=${this.value}
495
- id="input"
496
- aria-describedby="supporting-text"
497
- placeholder=" "
498
- ${forwardAttributes(__privateGet(this, _forwardableAttrs))}
499
- ></textarea>
500
- `;
501
- };
502
- _renderSupportingText = new WeakSet();
503
- renderSupportingText_fn = function() {
504
- return html`
505
- <div class="supporting-text" id="supporting-text">
506
- ${this.supportingText}
507
- </div>
508
- `;
509
- };
510
- _renderExtendedSupportingText = new WeakSet();
511
- renderExtendedSupportingText_fn = function() {
512
- return html`
513
- <div
514
- class="extended-supporting-text"
515
- aria-hidden="${!this.showExtendedSupportingText}"
516
- ?inert="${!this.showExtendedSupportingText}"
517
- >
518
- <div>
519
- <slot name="message" @slotchange=${() => this.requestUpdate()}></slot>
520
- </div>
521
- </div>
522
- `;
523
- };
524
- _renderClearButton = new WeakSet();
525
- renderClearButton_fn = function() {
526
- if (this.clearable && this.value.length > 0)
527
- return html`
528
- <gds-button
529
- size="small"
530
- variant="tertiary"
531
- label="${msg("Clear input")}"
532
- @click=${__privateGet(this, _handleClearBtnClick)}
533
- >
534
- <gds-icon-cross-small />
535
- </gds-button>
536
- `;
537
- else
538
- return nothing;
539
- };
540
- _shouldShowRemainingChars = new WeakSet();
541
- shouldShowRemainingChars_get = function() {
542
- return this.maxlength < Number.MAX_SAFE_INTEGER;
543
- };
544
- _renderRemainingCharsBadge = new WeakSet();
545
- renderRemainingCharsBadge_fn = function() {
546
- const remaining = this.maxlength - this.value.length;
547
- let variant;
548
- if (remaining < 0) {
549
- variant = "error";
550
- } else if (remaining < 20) {
551
- variant = "warning";
552
- } else {
553
- variant = "success";
554
- }
555
- return html`<gds-badge variant="${variant}">${remaining}</gds-badge>`;
556
- };
557
- _asyncRenderExtendedSupportingTextButton = new WeakSet();
558
- asyncRenderExtendedSupportingTextButton_fn = async function() {
559
- return this.elExtendedSupportingTextSlot.then((slot) => {
560
- if (slot && slot.assignedElements().length > 0)
561
- return html`
562
- <gds-button
563
- size="small"
564
- variant="tertiary"
565
- label="${msg("Show extended supporting text")}"
566
- @click=${__privateGet(this, _handleSupportingTextBtnClick)}
567
- >
568
- <gds-icon-circle-info />
569
- </gds-button>
570
- `;
571
- else
572
- return nothing;
573
- });
574
- };
575
- GdsInput.shadowRootOptions = __spreadProps(__spreadValues({}, LitElement.shadowRootOptions), {
576
- delegatesFocus: true
577
- });
578
- GdsInput.styles = [tokens, styles];
579
- __decorateClass([
580
- property()
581
- ], GdsInput.prototype, "value", 2);
582
- __decorateClass([
583
- property()
584
- ], GdsInput.prototype, "label", 2);
585
- __decorateClass([
586
- property({ attribute: "supporting-text" })
587
- ], GdsInput.prototype, "supportingText", 2);
588
- __decorateClass([
589
- property({
590
- attribute: "show-extended-supporting-text",
591
- type: Boolean,
592
- reflect: true
593
- })
594
- ], GdsInput.prototype, "showExtendedSupportingText", 2);
595
- __decorateClass([
596
- property({ type: Boolean })
597
- ], GdsInput.prototype, "clearable", 2);
598
- __decorateClass([
599
- property({ type: Number })
600
- ], GdsInput.prototype, "maxlength", 2);
601
- __decorateClass([
602
- property({ type: String })
603
- ], GdsInput.prototype, "variant", 2);
604
- __decorateClass([
605
- property({ type: Boolean })
606
- ], GdsInput.prototype, "multiline", 2);
607
- __decorateClass([
608
- queryAsync("input, textarea")
609
- ], GdsInput.prototype, "elInputAsync", 2);
610
- __decorateClass([
611
- query("input, textarea")
612
- ], GdsInput.prototype, "elInput", 2);
613
- __decorateClass([
614
- queryAsync('slot[name="extended-supporting-text"]')
615
- ], GdsInput.prototype, "elExtendedSupportingTextSlot", 2);
616
- __decorateClass([
617
- watch("value")
618
- ], GdsInput.prototype, "_setAutoHeight", 1);
619
- GdsInput = __decorateClass([
620
- gdsCustomElement("gds-input")
621
- ], GdsInput);
622
-
623
- export {
624
- GdsInput
625
- };