@sebgroup/green-core 1.60.1 → 1.62.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.
- package/README.md +1 -1
- package/chunks/{chunk.2RPIXTTF.js → chunk.3M24Q4NP.js} +148 -682
- package/chunks/{chunk.3YTTW5RI.js → chunk.3W52UD6H.js} +1 -1
- package/chunks/{chunk.MIOFI52O.js → chunk.42MDAP6X.js} +1 -1
- package/chunks/chunk.4RMUKKUH.js +382 -0
- package/chunks/{chunk.3HJXEV5P.js → chunk.5CEHJDND.js} +1 -1
- package/chunks/chunk.5HUS6CAH.js +0 -0
- package/chunks/{chunk.RMKD7K5Q.js → chunk.5UYAQERP.js} +1 -1
- package/chunks/{chunk.QHIYGBWM.js → chunk.6AF3XRTH.js} +1 -1
- package/chunks/{chunk.IGE2PH6T.js → chunk.6AQRJC23.js} +68 -144
- package/chunks/{chunk.JLZ2K3ZW.js → chunk.73JEK27O.js} +2 -2
- package/chunks/{chunk.V4QLU4WW.js → chunk.7LYVHSEG.js} +134 -103
- package/chunks/{chunk.7HVXPWQU.js → chunk.7NLM5ITX.js} +1 -1
- package/chunks/{chunk.STX4NWC2.js → chunk.7QPOP3BL.js} +2 -2
- package/chunks/{chunk.2QH66UQK.js → chunk.APDVCDJD.js} +2 -2
- package/chunks/{chunk.VRRDZBIH.js → chunk.D75WOAXB.js} +1 -1
- package/chunks/{chunk.4ZHTAQDZ.js → chunk.DJH7QFAN.js} +3 -3
- package/chunks/{chunk.WMYX5PV4.js → chunk.DNBRIHSH.js} +20 -8
- package/chunks/{chunk.E5WWCN6L.js → chunk.EB3VGCXK.js} +1 -1
- package/chunks/{chunk.SHITJ27X.js → chunk.EKZSYRZR.js} +1 -1
- package/chunks/{chunk.HALKUGTF.js → chunk.F527BHGP.js} +2 -2
- package/chunks/{chunk.QYSGJ5CP.js → chunk.GYV7S25D.js} +6 -13
- package/chunks/{chunk.RXOV7ZV4.js → chunk.HPSQUKF2.js} +5 -1
- package/chunks/{chunk.5CPWW5KU.js → chunk.I757A54S.js} +8 -4
- package/chunks/{chunk.3NKIMO26.js → chunk.JVDRTWPP.js} +1 -1
- package/chunks/{chunk.UDVIBJU2.js → chunk.MH5UGJXC.js} +1 -1
- package/chunks/chunk.MLXMQIEV.js +1 -1
- package/chunks/{chunk.EQK24GA7.js → chunk.MT7XFVN3.js} +1 -1
- package/chunks/{chunk.UWI652VF.js → chunk.NCKHK5PG.js} +9 -7
- package/chunks/{chunk.6YX75PNT.js → chunk.NHKCTJYM.js} +1 -1
- package/chunks/{chunk.UIVK7CMU.js → chunk.NLD74Y2D.js} +127 -200
- package/chunks/{chunk.BWVUFYGS.js → chunk.NRNM3BUT.js} +3 -1
- package/chunks/{chunk.QKJCCX2Y.js → chunk.NWFUJWE6.js} +128 -177
- package/chunks/{chunk.C3TU53VJ.js → chunk.NYSKXC32.js} +25 -3
- package/chunks/{chunk.55XSUTOR.js → chunk.PJJSVZOK.js} +12 -12
- package/chunks/chunk.PNB5RPI3.js +301 -0
- package/chunks/{chunk.OGD6Z42O.js → chunk.PPMF6234.js} +1 -1
- package/chunks/{chunk.VV4IKVAK.js → chunk.QLHOYAX6.js} +76 -57
- package/chunks/{chunk.AER44Y4F.js → chunk.QWWOLT5V.js} +1 -1
- package/chunks/{chunk.OY54R5D4.js → chunk.RGTKMLGE.js} +1 -1
- package/chunks/{chunk.MRBX5PXE.js → chunk.UBTUHHC7.js} +6 -8
- package/chunks/{chunk.ZG76HOCS.js → chunk.UKR6SWJ2.js} +2 -2
- package/chunks/{chunk.JYQY43ZR.js → chunk.V56VPSWH.js} +15 -1
- package/chunks/chunk.VZTV63IQ.js +0 -0
- package/chunks/{chunk.Y666F4RC.js → chunk.WWSNXINM.js} +2 -2
- package/chunks/{chunk.BRHKDNFD.js → chunk.XMAA7CU5.js} +1 -1
- package/chunks/{chunk.S4YT6LUT.js → chunk.ZFGPNYTO.js} +1 -1
- package/chunks/{chunk.TVJYFYLU.js → chunk.ZRKILGXZ.js} +28 -12
- package/components/badge/badge.js +5 -5
- package/components/badge/index.js +5 -5
- package/components/button/button.js +6 -6
- package/components/button/button.trans.styles.js +3 -1
- package/components/button/index.js +6 -6
- package/components/calendar/calendar.js +4 -4
- package/components/calendar/calendar.trans.styles.js +3 -1
- package/components/calendar/index.js +4 -4
- package/components/card/card.js +3 -3
- package/components/card/index.js +3 -3
- package/components/container/container.js +2 -2
- package/components/container/index.js +2 -2
- package/components/context-menu/context-menu.js +8 -6
- package/components/context-menu/context-menu.trans.styles.js +3 -1
- package/components/context-menu/index.js +9 -7
- package/components/datepicker/datepicker.d.ts +16 -13
- package/components/datepicker/datepicker.js +32 -14
- package/components/datepicker/datepicker.trans.styles.js +3 -1
- package/components/datepicker/index.js +32 -14
- package/components/dialog/dialog.js +9 -9
- package/components/dialog/index.js +9 -9
- package/components/divider/divider.js +2 -2
- package/components/divider/index.js +2 -2
- package/components/dropdown/dropdown.d.ts +22 -10
- package/components/dropdown/dropdown.js +28 -11
- package/components/dropdown/dropdown.trans.styles.js +3 -1
- package/components/dropdown/index.js +29 -12
- package/components/fab/fab.js +7 -7
- package/components/fab/index.js +7 -7
- package/components/filter-chips/filter-chip/filter-chip.js +7 -7
- package/components/filter-chips/filter-chip/filter-chip.trans.styles.js +3 -1
- package/components/filter-chips/filter-chip/index.js +7 -7
- package/components/filter-chips/filter-chips.js +8 -8
- package/components/filter-chips/filter-chips.trans.styles.js +3 -1
- package/components/filter-chips/index.js +8 -8
- package/components/flex/flex.js +3 -3
- package/components/flex/index.js +3 -3
- package/components/form/form-control.d.ts +12 -0
- package/components/form/form-control.js +1 -1
- package/components/form/index.js +9 -8
- package/components/form/summary/index.js +9 -8
- package/components/form/summary/summary.d.ts +1 -1
- package/components/form/summary/summary.js +9 -8
- package/components/grid/grid.js +3 -3
- package/components/grid/index.js +3 -3
- package/components/grouped-list/grouped-list.js +4 -2
- package/components/grouped-list/grouped-list.trans.styles.js +3 -1
- package/components/grouped-list/index.js +4 -2
- package/components/icon/icons/index.js +9 -9
- package/components/img/img.js +2 -2
- package/components/img/index.js +2 -2
- package/components/index.js +53 -49
- package/components/input/index.js +16 -14
- package/components/input/input.d.ts +13 -12
- package/components/input/input.js +16 -14
- package/components/input/input.trans.styles.d.ts +2 -0
- package/components/input/input.trans.styles.js +13 -0
- package/components/link/index.js +3 -3
- package/components/link/link.js +3 -3
- package/components/mask/index.js +4 -4
- package/components/mask/mask.js +4 -4
- package/components/menu-button/index.js +3 -3
- package/components/menu-button/menu-button.js +3 -3
- package/components/popover/index.js +4 -2
- package/components/popover/popover.js +4 -2
- package/components/popover/popover.trans.styles.js +3 -1
- package/components/rich-text/index.js +3 -3
- package/components/rich-text/rich-text.d.ts +15 -1
- package/components/rich-text/rich-text.js +3 -3
- package/components/segmented-control/index.js +5 -5
- package/components/segmented-control/segment/index.js +4 -4
- package/components/segmented-control/segment/segment.js +4 -4
- package/components/segmented-control/segment/segment.trans.styles.js +4 -2
- package/components/segmented-control/segmented-control.js +5 -5
- package/components/segmented-control/segmented-control.trans.styles.js +4 -2
- package/components/signal/index.js +2 -2
- package/components/signal/signal.js +2 -2
- package/components/spacer/index.js +2 -2
- package/components/spacer/spacer.js +2 -2
- package/components/text/index.js +3 -2
- package/components/text/text.js +2 -2
- package/components/textarea/index.js +16 -14
- package/components/textarea/textarea.d.ts +14 -17
- package/components/textarea/textarea.js +16 -14
- package/components/theme/index.js +4 -4
- package/components/theme/theme.js +4 -4
- package/components/theme/theme.trans.styles.js +4 -2
- package/components/video/index.js +2 -2
- package/components/video/video.js +2 -2
- package/index.js +53 -49
- package/package.json +1 -1
- package/primitives/field-base/field-base.d.ts +41 -0
- package/primitives/field-base/field-base.js +15 -0
- package/primitives/field-base/field-base.styles.d.ts +1 -0
- package/primitives/field-base/field-base.trans.styles.d.ts +2 -0
- package/primitives/field-base/index.d.ts +1 -0
- package/primitives/field-base/index.js +16 -0
- package/primitives/form-control-footer/form-control-footer.js +6 -6
- package/primitives/form-control-footer/index.js +6 -6
- package/primitives/form-control-header/form-control-header.js +9 -9
- package/primitives/form-control-header/index.js +9 -9
- package/primitives/listbox/index.js +6 -6
- package/primitives/listbox/listbox.js +6 -6
- package/primitives/listbox/option.js +5 -5
- package/primitives/menu/index.js +6 -4
- package/primitives/menu/menu-heading.js +4 -2
- package/primitives/menu/menu-item.js +5 -3
- package/primitives/menu/menu.js +6 -4
- package/primitives/ripple/index.js +3 -3
- package/primitives/ripple/ripple.js +3 -3
- package/tokens.style.d.ts +3 -3
- package/transitional-styles.js +3 -1
- package/chunks/chunk.LOIMPU3C.js +0 -797
|
@@ -68,15 +68,17 @@ var GdsFormControlFooter = class extends GdsElement {
|
|
|
68
68
|
render() {
|
|
69
69
|
return html`<div aria-live="polite">
|
|
70
70
|
<div class="error-message">
|
|
71
|
-
|
|
71
|
+
<slot name="message"
|
|
72
|
+
>${when(
|
|
72
73
|
this.validationMessage,
|
|
73
74
|
() => html`
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
)}
|
|
75
|
+
<gds-icon-triangle-exclamation
|
|
76
|
+
solid
|
|
77
|
+
></gds-icon-triangle-exclamation>
|
|
78
|
+
${this.validationMessage}
|
|
79
|
+
`
|
|
80
|
+
)}</slot
|
|
81
|
+
>
|
|
80
82
|
</div>
|
|
81
83
|
<div class="char-counter">
|
|
82
84
|
${when(
|
|
@@ -3,16 +3,16 @@ import {
|
|
|
3
3
|
} from "./chunk.H2KG3F2S.js";
|
|
4
4
|
import {
|
|
5
5
|
forwardAttributes
|
|
6
|
-
} from "./chunk.
|
|
6
|
+
} from "./chunk.QLHOYAX6.js";
|
|
7
7
|
import {
|
|
8
8
|
GdsFormControlElement
|
|
9
|
-
} from "./chunk.
|
|
9
|
+
} from "./chunk.V56VPSWH.js";
|
|
10
10
|
import {
|
|
11
11
|
watch
|
|
12
12
|
} from "./chunk.TYGMNHNO.js";
|
|
13
13
|
import {
|
|
14
14
|
tokens
|
|
15
|
-
} from "./chunk.
|
|
15
|
+
} from "./chunk.4RMUKKUH.js";
|
|
16
16
|
import {
|
|
17
17
|
gdsCustomElement,
|
|
18
18
|
html
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
|
|
27
27
|
// libs/core/src/components/textarea/textarea.ts
|
|
28
28
|
import { localized, msg } from "@lit/localize";
|
|
29
|
-
import { property, query, queryAsync
|
|
29
|
+
import { property, query, queryAsync } from "lit/decorators.js";
|
|
30
30
|
import { choose } from "lit/directives/choose.js";
|
|
31
31
|
import { when } from "lit/directives/when.js";
|
|
32
32
|
import { nothing } from "lit/html.js";
|
|
@@ -34,27 +34,7 @@ import { nothing } from "lit/html.js";
|
|
|
34
34
|
// libs/core/src/components/textarea/textarea.styles.ts
|
|
35
35
|
import { css } from "lit";
|
|
36
36
|
var styles = css`
|
|
37
|
-
@layer
|
|
38
|
-
|
|
39
|
-
@layer tokens {
|
|
40
|
-
:host {
|
|
41
|
-
--_transition: all 368ms cubic-bezier(0.4, 0, 0.2, 1), height 0s;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@layer a11y {
|
|
46
|
-
@media (prefers-reduced-motion: reduce) {
|
|
47
|
-
:host {
|
|
48
|
-
--_transition: none;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
@media (prefers-reduced-transparency: reduce) {
|
|
53
|
-
:host {
|
|
54
|
-
--_transparency: 1;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
37
|
+
@layer base, simplified;
|
|
58
38
|
|
|
59
39
|
@layer base {
|
|
60
40
|
* {
|
|
@@ -70,52 +50,6 @@ var styles = css`
|
|
|
70
50
|
gap: var(--gds-space-xs);
|
|
71
51
|
}
|
|
72
52
|
|
|
73
|
-
:host([disabled]) {
|
|
74
|
-
color: var(--gds-color-l3-content-disabled);
|
|
75
|
-
pointer-events: none;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
:host([size='small']) textarea {
|
|
79
|
-
font-size: var(--gds-text-size-detail-s);
|
|
80
|
-
line-height: var(--gds-text-line-height-detail-s);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.field {
|
|
84
|
-
transition: var(--_transition);
|
|
85
|
-
position: relative;
|
|
86
|
-
outline: 2px solid transparent;
|
|
87
|
-
outline-offset: 2px;
|
|
88
|
-
|
|
89
|
-
&:has(textarea:focus-visible) {
|
|
90
|
-
border-color: var(--gds-color-l3-border-primary);
|
|
91
|
-
outline-color: currentColor;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
&.invalid:has(textarea:focus-visible) {
|
|
95
|
-
border-color: var(--gds-color-l3-border-negative);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
@media (hover: hover) {
|
|
100
|
-
.field {
|
|
101
|
-
&:hover {
|
|
102
|
-
background: color-mix(
|
|
103
|
-
in srgb,
|
|
104
|
-
var(--gds-color-l3-background-secondary),
|
|
105
|
-
var(--gds-color-l3-states-light-hover)
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
&.invalid:hover {
|
|
110
|
-
background: color-mix(
|
|
111
|
-
in srgb,
|
|
112
|
-
var(--gds-color-l3-background-negative-secondary),
|
|
113
|
-
var(--gds-color-l3-states-negative-hover)
|
|
114
|
-
);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
53
|
textarea {
|
|
120
54
|
appearance: none;
|
|
121
55
|
background-color: transparent;
|
|
@@ -147,7 +81,17 @@ var styles = css`
|
|
|
147
81
|
display: flex;
|
|
148
82
|
}
|
|
149
83
|
|
|
84
|
+
[align-items] ::part(_button) {
|
|
85
|
+
margin-top: calc(var(--gds-space-2xs) * -1);
|
|
86
|
+
}
|
|
87
|
+
|
|
150
88
|
.resize-handle {
|
|
89
|
+
position: absolute;
|
|
90
|
+
inset: auto auto -10px 0;
|
|
91
|
+
width: 100%;
|
|
92
|
+
height: 20px;
|
|
93
|
+
cursor: row-resize;
|
|
94
|
+
z-index: 2;
|
|
151
95
|
&:hover,
|
|
152
96
|
&:active {
|
|
153
97
|
&::before {
|
|
@@ -176,40 +120,27 @@ var styles = css`
|
|
|
176
120
|
`;
|
|
177
121
|
|
|
178
122
|
// libs/core/src/components/textarea/textarea.ts
|
|
179
|
-
var _renderDefault, renderDefault_fn, _renderFloatingLabel, renderFloatingLabel_fn, _forwardableAttrs, _handleOnInput, _handleOnChange, _handleFieldClick, _handleClearBtnClick, _renderSlotLead, renderSlotLead_fn, _renderSlotTrail, renderSlotTrail_fn, _addResizeHandleListener, addResizeHandleListener_fn,
|
|
123
|
+
var _renderDefault, renderDefault_fn, _renderFloatingLabel, renderFloatingLabel_fn, _forwardableAttrs, _handleOnInput, _handleOnChange, _handleFieldClick, _handleClearBtnClick, _renderFieldContents, renderFieldContents_fn, _renderSlotLead, renderSlotLead_fn, _renderSlotTrail, renderSlotTrail_fn, _addResizeHandleListener, addResizeHandleListener_fn, _resizeState, _startDragging, _onDrag, _stopDragging, _renderResizeHandle, renderResizeHandle_fn, _renderNativeTextarea, renderNativeTextarea_fn, _renderClearButton, renderClearButton_fn, _shouldShowRemainingChars, shouldShowRemainingChars_get;
|
|
180
124
|
var GdsTextarea = class extends GdsFormControlElement {
|
|
181
125
|
constructor() {
|
|
182
126
|
super();
|
|
183
127
|
__privateAdd(this, _renderDefault);
|
|
184
128
|
// variant="floatingLabel"
|
|
185
129
|
__privateAdd(this, _renderFloatingLabel);
|
|
130
|
+
__privateAdd(this, _renderFieldContents);
|
|
186
131
|
__privateAdd(this, _renderSlotLead);
|
|
187
132
|
__privateAdd(this, _renderSlotTrail);
|
|
188
133
|
__privateAdd(this, _addResizeHandleListener);
|
|
189
|
-
__privateAdd(this, _startDragging);
|
|
190
|
-
__privateAdd(this, _onDrag);
|
|
191
|
-
__privateAdd(this, _stopDragging);
|
|
192
134
|
__privateAdd(this, _renderResizeHandle);
|
|
193
|
-
__privateAdd(this, _handleSlotChange);
|
|
194
135
|
__privateAdd(this, _renderNativeTextarea);
|
|
195
136
|
__privateAdd(this, _renderClearButton);
|
|
196
137
|
__privateAdd(this, _shouldShowRemainingChars);
|
|
197
|
-
this.value = "";
|
|
198
|
-
this.label = "";
|
|
199
138
|
this.rows = 4;
|
|
200
|
-
this.lines = 4;
|
|
201
|
-
// Default number of lines
|
|
202
|
-
this.isDragging = false;
|
|
203
|
-
// Track dragging state
|
|
204
|
-
this.lastMouseY = 0;
|
|
205
139
|
this.supportingText = "";
|
|
206
|
-
this.showExtendedSupportingText = false;
|
|
207
|
-
this.disabled = false;
|
|
208
140
|
this.clearable = false;
|
|
209
|
-
this.resize = "";
|
|
141
|
+
this.resize = "auto";
|
|
210
142
|
this.maxlength = Number.MAX_SAFE_INTEGER;
|
|
211
143
|
this.variant = "default";
|
|
212
|
-
this.trailSlotOccupied = false;
|
|
213
144
|
// Any attribute name added here will get forwarded to the native <input> element.
|
|
214
145
|
__privateAdd(this, _forwardableAttrs, (attr) => ["type", "placeholder", "required"].includes(attr.name));
|
|
215
146
|
__privateAdd(this, _handleOnInput, (e) => {
|
|
@@ -231,9 +162,77 @@ var GdsTextarea = class extends GdsFormControlElement {
|
|
|
231
162
|
});
|
|
232
163
|
__privateAdd(this, _handleClearBtnClick, () => {
|
|
233
164
|
this.value = "";
|
|
165
|
+
this.dispatchEvent(
|
|
166
|
+
new Event("gds-input-cleared", {
|
|
167
|
+
bubbles: true,
|
|
168
|
+
composed: true
|
|
169
|
+
})
|
|
170
|
+
);
|
|
171
|
+
this.dispatchEvent(
|
|
172
|
+
new Event("input", {
|
|
173
|
+
bubbles: true,
|
|
174
|
+
composed: true
|
|
175
|
+
})
|
|
176
|
+
);
|
|
234
177
|
});
|
|
235
|
-
|
|
236
|
-
this
|
|
178
|
+
// State for the resize handle action
|
|
179
|
+
__privateAdd(this, _resizeState, {
|
|
180
|
+
isDragging: false,
|
|
181
|
+
startMouseY: 0,
|
|
182
|
+
lines: this.rows,
|
|
183
|
+
deltaLines: 0,
|
|
184
|
+
lineHeight: 0
|
|
185
|
+
});
|
|
186
|
+
__privateAdd(this, _startDragging, (event) => {
|
|
187
|
+
event.preventDefault();
|
|
188
|
+
__privateGet(this, _resizeState).isDragging = true;
|
|
189
|
+
__privateGet(this, _resizeState).startMouseY = event.clientY;
|
|
190
|
+
__privateGet(this, _resizeState).lineHeight = parseFloat(
|
|
191
|
+
getComputedStyle(this.elTextarea).lineHeight
|
|
192
|
+
);
|
|
193
|
+
document.addEventListener("mousemove", __privateGet(this, _onDrag));
|
|
194
|
+
document.addEventListener("mouseup", __privateGet(this, _stopDragging));
|
|
195
|
+
});
|
|
196
|
+
__privateAdd(this, _onDrag, (event) => {
|
|
197
|
+
if (!__privateGet(this, _resizeState).isDragging)
|
|
198
|
+
return;
|
|
199
|
+
const deltaY = event.clientY - __privateGet(this, _resizeState).startMouseY;
|
|
200
|
+
__privateGet(this, _resizeState).deltaLines = Math.round(
|
|
201
|
+
deltaY / __privateGet(this, _resizeState).lineHeight
|
|
202
|
+
);
|
|
203
|
+
this.elTextareaAsync.then((element) => {
|
|
204
|
+
element == null ? void 0 : element.style.setProperty(
|
|
205
|
+
"--_lines",
|
|
206
|
+
(__privateGet(this, _resizeState).lines + __privateGet(this, _resizeState).deltaLines).toString()
|
|
207
|
+
);
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
__privateAdd(this, _stopDragging, () => {
|
|
211
|
+
__privateGet(this, _resizeState).isDragging = false;
|
|
212
|
+
__privateGet(this, _resizeState).lines += __privateGet(this, _resizeState).deltaLines;
|
|
213
|
+
this.rows = __privateGet(this, _resizeState).lines;
|
|
214
|
+
__privateGet(this, _resizeState).deltaLines = 0;
|
|
215
|
+
document.removeEventListener("mousemove", __privateGet(this, _onDrag));
|
|
216
|
+
document.removeEventListener("mouseup", __privateGet(this, _stopDragging));
|
|
217
|
+
});
|
|
218
|
+
this.value = "";
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* A reference to the clear button element. Returns null if there is no clear button.
|
|
222
|
+
* Intended for use in integration tests.
|
|
223
|
+
*/
|
|
224
|
+
test_getClearButton() {
|
|
225
|
+
var _a;
|
|
226
|
+
return (_a = this.shadowRoot) == null ? void 0 : _a.querySelector("#clear-button");
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* A reference to the field element. This does not refer to the input element itself,
|
|
230
|
+
* but the wrapper that makes up the visual field.
|
|
231
|
+
* Intended for use in integration tests.
|
|
232
|
+
*/
|
|
233
|
+
test_getFieldElement() {
|
|
234
|
+
var _a;
|
|
235
|
+
return (_a = this.shadowRoot) == null ? void 0 : _a.querySelector("#field");
|
|
237
236
|
}
|
|
238
237
|
connectedCallback() {
|
|
239
238
|
super.connectedCallback();
|
|
@@ -242,7 +241,7 @@ var GdsTextarea = class extends GdsFormControlElement {
|
|
|
242
241
|
}
|
|
243
242
|
disconnectedCallback() {
|
|
244
243
|
super.disconnectedCallback();
|
|
245
|
-
|
|
244
|
+
__privateGet(this, _stopDragging).call(this);
|
|
246
245
|
}
|
|
247
246
|
render() {
|
|
248
247
|
return html`${choose(this.variant, [
|
|
@@ -255,54 +254,45 @@ var GdsTextarea = class extends GdsFormControlElement {
|
|
|
255
254
|
}
|
|
256
255
|
_setAutoHeight() {
|
|
257
256
|
this.elTextareaAsync.then((element) => {
|
|
258
|
-
|
|
259
|
-
|
|
257
|
+
this.rows = Math.max(this.rows, element.value.split("\n").length);
|
|
258
|
+
__privateGet(this, _resizeState).lines = Number(this.rows);
|
|
259
|
+
element == null ? void 0 : element.style.setProperty("--_lines", this.rows.toString());
|
|
260
260
|
});
|
|
261
261
|
}
|
|
262
262
|
};
|
|
263
263
|
_renderDefault = new WeakSet();
|
|
264
264
|
renderDefault_fn = function() {
|
|
265
|
+
var _a;
|
|
265
266
|
return html`
|
|
266
267
|
<gds-form-control-header>
|
|
267
268
|
<label for="input" slot="label">${this.label}</label>
|
|
268
|
-
<span slot="supporting-text" id="supporting-text"
|
|
269
|
-
|
|
270
|
-
>
|
|
269
|
+
<span slot="supporting-text" id="supporting-text">
|
|
270
|
+
${this.supportingText}
|
|
271
|
+
</span>
|
|
271
272
|
<slot
|
|
272
273
|
name="extended-supporting-text"
|
|
273
274
|
slot="extended-supporting-text"
|
|
274
275
|
></slot>
|
|
275
276
|
</gds-form-control-header>
|
|
276
277
|
|
|
277
|
-
<gds-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
gap="xs"
|
|
282
|
-
level="3"
|
|
283
|
-
padding=${!this.trailSlotOccupied ? "s s s m" : "s m s m"}
|
|
284
|
-
border-radius="xs"
|
|
285
|
-
.background=${this.disabled ? "disabled" : this.invalid ? "negative-secondary" : "secondary"}
|
|
286
|
-
.border=${this.disabled ? "" : this.invalid ? "4xs/negative" : "4xs/secondary"}
|
|
287
|
-
class="field ${this.invalid ? "invalid" : ""}"
|
|
278
|
+
<gds-field-base
|
|
279
|
+
id="field"
|
|
280
|
+
.disabled=${this.disabled}
|
|
281
|
+
.invalid=${this.invalid}
|
|
288
282
|
@click=${__privateGet(this, _handleFieldClick)}
|
|
289
|
-
|
|
283
|
+
multiline
|
|
290
284
|
>
|
|
291
|
-
${__privateMethod(this,
|
|
292
|
-
|
|
293
|
-
<gds-flex gap="xs" align-items="center" block-size="l">
|
|
294
|
-
${__privateMethod(this, _renderClearButton, renderClearButton_fn).call(this)} ${__privateMethod(this, _renderSlotTrail, renderSlotTrail_fn).call(this)}
|
|
295
|
-
</gds-flex>
|
|
285
|
+
${__privateMethod(this, _renderFieldContents, renderFieldContents_fn).call(this)}
|
|
296
286
|
${when(
|
|
297
287
|
this.resize === "auto",
|
|
298
288
|
() => __privateMethod(this, _renderResizeHandle, renderResizeHandle_fn).call(this),
|
|
299
289
|
() => nothing
|
|
300
290
|
)}
|
|
301
|
-
</gds-
|
|
291
|
+
</gds-field-base>
|
|
302
292
|
|
|
303
293
|
<gds-form-control-footer
|
|
304
|
-
.charCounter=${__privateGet(this, _shouldShowRemainingChars, shouldShowRemainingChars_get) && this.maxlength - this.value.length}
|
|
305
|
-
.validationMessage=${this.invalid && this.validationMessage}
|
|
294
|
+
.charCounter=${__privateGet(this, _shouldShowRemainingChars, shouldShowRemainingChars_get) && this.maxlength - (((_a = this.value) == null ? void 0 : _a.length) || 0)}
|
|
295
|
+
.validationMessage=${this.invalid && (this.errorMessage || this.validationMessage)}
|
|
306
296
|
></gds-form-control-footer>
|
|
307
297
|
`;
|
|
308
298
|
};
|
|
@@ -315,15 +305,23 @@ _handleOnInput = new WeakMap();
|
|
|
315
305
|
_handleOnChange = new WeakMap();
|
|
316
306
|
_handleFieldClick = new WeakMap();
|
|
317
307
|
_handleClearBtnClick = new WeakMap();
|
|
308
|
+
_renderFieldContents = new WeakSet();
|
|
309
|
+
renderFieldContents_fn = function() {
|
|
310
|
+
const elements = [
|
|
311
|
+
__privateMethod(this, _renderSlotLead, renderSlotLead_fn).call(this),
|
|
312
|
+
__privateMethod(this, _renderNativeTextarea, renderNativeTextarea_fn).call(this),
|
|
313
|
+
__privateMethod(this, _renderClearButton, renderClearButton_fn).call(this),
|
|
314
|
+
__privateMethod(this, _renderSlotTrail, renderSlotTrail_fn).call(this)
|
|
315
|
+
];
|
|
316
|
+
return elements.map((element) => html`${element}`);
|
|
317
|
+
};
|
|
318
318
|
_renderSlotLead = new WeakSet();
|
|
319
319
|
renderSlotLead_fn = function() {
|
|
320
|
-
return html
|
|
320
|
+
return html`<slot slot="lead" name="lead"></slot>`;
|
|
321
321
|
};
|
|
322
322
|
_renderSlotTrail = new WeakSet();
|
|
323
323
|
renderSlotTrail_fn = function() {
|
|
324
|
-
return html
|
|
325
|
-
<slot name="trail" @slotchange=${__privateMethod(this, _handleSlotChange, handleSlotChange_fn)}></slot>
|
|
326
|
-
`;
|
|
324
|
+
return html`<slot slot="trail" name="trail"></slot>`;
|
|
327
325
|
};
|
|
328
326
|
_addResizeHandleListener = new WeakSet();
|
|
329
327
|
addResizeHandleListener_fn = function() {
|
|
@@ -331,67 +329,20 @@ addResizeHandleListener_fn = function() {
|
|
|
331
329
|
if (resizeHandle) {
|
|
332
330
|
resizeHandle.addEventListener(
|
|
333
331
|
"mousedown",
|
|
334
|
-
|
|
332
|
+
__privateGet(this, _startDragging)
|
|
335
333
|
);
|
|
336
334
|
}
|
|
337
335
|
};
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
this.lastMouseY = event.clientY;
|
|
343
|
-
document.addEventListener("mousemove", __privateMethod(this, _onDrag, onDrag_fn).bind(this));
|
|
344
|
-
document.addEventListener("mouseup", __privateMethod(this, _stopDragging, stopDragging_fn).bind(this));
|
|
345
|
-
};
|
|
346
|
-
_onDrag = new WeakSet();
|
|
347
|
-
onDrag_fn = function(event) {
|
|
348
|
-
if (!this.isDragging)
|
|
349
|
-
return;
|
|
350
|
-
const deltaY = event.clientY - this.lastMouseY;
|
|
351
|
-
if (Math.abs(deltaY) >= 20) {
|
|
352
|
-
if (deltaY > 0) {
|
|
353
|
-
this.lines += 1;
|
|
354
|
-
} else {
|
|
355
|
-
this.lines = Math.max(1, this.lines - 1);
|
|
356
|
-
}
|
|
357
|
-
this.elTextareaAsync.then((element) => {
|
|
358
|
-
element == null ? void 0 : element.style.setProperty("--_lines", this.lines.toString());
|
|
359
|
-
});
|
|
360
|
-
this.lastMouseY = event.clientY;
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
|
-
_stopDragging = new WeakSet();
|
|
364
|
-
stopDragging_fn = function() {
|
|
365
|
-
this.isDragging = false;
|
|
366
|
-
document.removeEventListener("mousemove", __privateMethod(this, _onDrag, onDrag_fn).bind(this));
|
|
367
|
-
document.removeEventListener("mouseup", __privateMethod(this, _stopDragging, stopDragging_fn).bind(this));
|
|
368
|
-
};
|
|
336
|
+
_resizeState = new WeakMap();
|
|
337
|
+
_startDragging = new WeakMap();
|
|
338
|
+
_onDrag = new WeakMap();
|
|
339
|
+
_stopDragging = new WeakMap();
|
|
369
340
|
_renderResizeHandle = new WeakSet();
|
|
370
341
|
renderResizeHandle_fn = function() {
|
|
371
342
|
return html`
|
|
372
|
-
<
|
|
373
|
-
class="resize-handle"
|
|
374
|
-
position="absolute"
|
|
375
|
-
inset="auto auto -10px 0"
|
|
376
|
-
width="100%"
|
|
377
|
-
height="20px"
|
|
378
|
-
cursor="row-resize"
|
|
379
|
-
z-index="2"
|
|
380
|
-
@mousedown=${__privateMethod(this, _startDragging, startDragging_fn)}
|
|
381
|
-
></gds-container>
|
|
343
|
+
<div class="resize-handle" @mousedown=${__privateGet(this, _startDragging)}></div>
|
|
382
344
|
`;
|
|
383
345
|
};
|
|
384
|
-
_handleSlotChange = new WeakSet();
|
|
385
|
-
handleSlotChange_fn = function(event) {
|
|
386
|
-
const slot = event.target;
|
|
387
|
-
const assignedNodes = slot.assignedNodes({ flatten: true });
|
|
388
|
-
this.trailSlotOccupied = assignedNodes.length > 0 && assignedNodes.some(
|
|
389
|
-
(node) => {
|
|
390
|
-
var _a;
|
|
391
|
-
return node.nodeType === Node.ELEMENT_NODE || node.nodeType === Node.TEXT_NODE && ((_a = node.textContent) == null ? void 0 : _a.trim()) !== "";
|
|
392
|
-
}
|
|
393
|
-
);
|
|
394
|
-
};
|
|
395
346
|
_renderNativeTextarea = new WeakSet();
|
|
396
347
|
renderNativeTextarea_fn = function() {
|
|
397
348
|
return html`
|
|
@@ -400,7 +351,6 @@ renderNativeTextarea_fn = function() {
|
|
|
400
351
|
@change=${__privateGet(this, _handleOnChange)}
|
|
401
352
|
.value=${this.value}
|
|
402
353
|
id="input"
|
|
403
|
-
style="${this.invalid ? "color: var(--gds-color-l3-content-negative);" : this.disabled ? "color: currentColor;pointer-events:none;" : null}"
|
|
404
354
|
aria-describedby="supporting-text"
|
|
405
355
|
placeholder=" "
|
|
406
356
|
${forwardAttributes(__privateGet(this, _forwardableAttrs))}
|
|
@@ -409,7 +359,8 @@ renderNativeTextarea_fn = function() {
|
|
|
409
359
|
};
|
|
410
360
|
_renderClearButton = new WeakSet();
|
|
411
361
|
renderClearButton_fn = function() {
|
|
412
|
-
|
|
362
|
+
var _a;
|
|
363
|
+
if (this.clearable && (((_a = this.value) == null ? void 0 : _a.length) || 0) > 0)
|
|
413
364
|
return html`
|
|
414
365
|
<gds-button
|
|
415
366
|
size="small"
|
|
@@ -418,6 +369,8 @@ renderClearButton_fn = function() {
|
|
|
418
369
|
?disabled="${this.disabled}"
|
|
419
370
|
label="${msg("Clear input")}"
|
|
420
371
|
@click=${__privateGet(this, _handleClearBtnClick)}
|
|
372
|
+
slot="action"
|
|
373
|
+
id="clear-button"
|
|
421
374
|
>
|
|
422
375
|
<gds-icon-cross-small />
|
|
423
376
|
</gds-button>
|
|
@@ -430,12 +383,6 @@ shouldShowRemainingChars_get = function() {
|
|
|
430
383
|
return this.maxlength < Number.MAX_SAFE_INTEGER;
|
|
431
384
|
};
|
|
432
385
|
GdsTextarea.styles = [tokens, styles];
|
|
433
|
-
__decorateClass([
|
|
434
|
-
property()
|
|
435
|
-
], GdsTextarea.prototype, "value", 2);
|
|
436
|
-
__decorateClass([
|
|
437
|
-
property()
|
|
438
|
-
], GdsTextarea.prototype, "label", 2);
|
|
439
386
|
__decorateClass([
|
|
440
387
|
styleExpressionProperty({
|
|
441
388
|
valueTemplate: (v) => v,
|
|
@@ -446,26 +393,9 @@ __decorateClass([
|
|
|
446
393
|
}
|
|
447
394
|
})
|
|
448
395
|
], GdsTextarea.prototype, "rows", 2);
|
|
449
|
-
__decorateClass([
|
|
450
|
-
state()
|
|
451
|
-
], GdsTextarea.prototype, "lines", 2);
|
|
452
396
|
__decorateClass([
|
|
453
397
|
property({ attribute: "supporting-text" })
|
|
454
398
|
], GdsTextarea.prototype, "supportingText", 2);
|
|
455
|
-
__decorateClass([
|
|
456
|
-
property({
|
|
457
|
-
attribute: "show-extended-supporting-text",
|
|
458
|
-
type: Boolean,
|
|
459
|
-
reflect: true
|
|
460
|
-
})
|
|
461
|
-
], GdsTextarea.prototype, "showExtendedSupportingText", 2);
|
|
462
|
-
__decorateClass([
|
|
463
|
-
property({
|
|
464
|
-
attribute: "disabled",
|
|
465
|
-
type: Boolean,
|
|
466
|
-
reflect: true
|
|
467
|
-
})
|
|
468
|
-
], GdsTextarea.prototype, "disabled", 2);
|
|
469
399
|
__decorateClass([
|
|
470
400
|
property({ type: Boolean })
|
|
471
401
|
], GdsTextarea.prototype, "clearable", 2);
|
|
@@ -484,9 +414,6 @@ __decorateClass([
|
|
|
484
414
|
__decorateClass([
|
|
485
415
|
query("textarea")
|
|
486
416
|
], GdsTextarea.prototype, "elTextarea", 2);
|
|
487
|
-
__decorateClass([
|
|
488
|
-
state()
|
|
489
|
-
], GdsTextarea.prototype, "trailSlotOccupied", 2);
|
|
490
417
|
__decorateClass([
|
|
491
418
|
watch("value")
|
|
492
419
|
], GdsTextarea.prototype, "_setAutoHeight", 1);
|
|
@@ -48,7 +48,9 @@ var styles = css`
|
|
|
48
48
|
|
|
49
49
|
#extended-supporting-text {
|
|
50
50
|
opacity: 1;
|
|
51
|
-
transition:
|
|
51
|
+
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
52
|
+
transition-duration: 368ms;
|
|
53
|
+
transition-property: all;
|
|
52
54
|
font-size: var(--gds-text-size-body-s);
|
|
53
55
|
line-height: var(--gds-text-line-height-body-s);
|
|
54
56
|
border-radius: var(--gds-space-xs);
|