@sebgroup/green-core 1.20.0 → 1.20.2

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