@sebgroup/green-core 1.61.0 → 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.U44LH2CF.js → chunk.3M24Q4NP.js} +147 -681
- package/chunks/{chunk.B7X4UWIN.js → chunk.3W52UD6H.js} +1 -1
- package/chunks/{chunk.DBFF5KCR.js → chunk.42MDAP6X.js} +1 -1
- package/chunks/{chunk.BYYROY6X.js → chunk.4RMUKKUH.js} +6 -6
- package/chunks/{chunk.Z334YLO4.js → chunk.5CEHJDND.js} +1 -1
- package/chunks/{chunk.YRHYEHLO.js → chunk.5UYAQERP.js} +1 -1
- package/chunks/{chunk.PBUUPCPL.js → chunk.6AF3XRTH.js} +1 -1
- package/chunks/{chunk.A2VYZXDP.js → chunk.6AQRJC23.js} +57 -141
- package/chunks/{chunk.S4DOMLSN.js → chunk.73JEK27O.js} +2 -2
- package/chunks/{chunk.HJBA7FLT.js → chunk.7LYVHSEG.js} +119 -118
- package/chunks/{chunk.YAPDYZK6.js → chunk.7NLM5ITX.js} +1 -1
- package/chunks/{chunk.QIE6QJ5O.js → chunk.7QPOP3BL.js} +2 -2
- package/chunks/{chunk.P2BOEVHE.js → chunk.APDVCDJD.js} +2 -2
- package/chunks/{chunk.KMMI2BYQ.js → chunk.D75WOAXB.js} +1 -1
- package/chunks/{chunk.KEPXMMGX.js → chunk.DJH7QFAN.js} +1 -1
- package/chunks/{chunk.HOH7FXB5.js → chunk.DNBRIHSH.js} +2 -2
- package/chunks/{chunk.RL2KSWKV.js → chunk.EB3VGCXK.js} +1 -1
- package/chunks/{chunk.5L6LO6VX.js → chunk.EKZSYRZR.js} +1 -1
- package/chunks/{chunk.C3ZGNKY3.js → chunk.F527BHGP.js} +2 -2
- package/chunks/{chunk.77RJTA43.js → chunk.HPSQUKF2.js} +5 -1
- package/chunks/{chunk.FCB5VT3N.js → chunk.I757A54S.js} +3 -3
- package/chunks/{chunk.MSDETVDW.js → chunk.JVDRTWPP.js} +1 -1
- package/chunks/{chunk.ZTRXED5A.js → chunk.MH5UGJXC.js} +1 -1
- package/chunks/chunk.MLXMQIEV.js +1 -1
- package/chunks/{chunk.M6S3B5GI.js → chunk.MT7XFVN3.js} +1 -1
- package/chunks/{chunk.UWI652VF.js → chunk.NCKHK5PG.js} +9 -7
- package/chunks/{chunk.QN5HFZCH.js → chunk.NHKCTJYM.js} +1 -1
- package/chunks/{chunk.OSIUU4NF.js → chunk.NLD74Y2D.js} +110 -197
- package/chunks/{chunk.BWVUFYGS.js → chunk.NRNM3BUT.js} +3 -1
- package/chunks/{chunk.RTE75ZOU.js → chunk.NWFUJWE6.js} +118 -173
- package/chunks/{chunk.KTCN5HJV.js → chunk.NYSKXC32.js} +1 -1
- package/chunks/{chunk.WXBRUX3Q.js → chunk.PJJSVZOK.js} +2 -2
- package/chunks/chunk.PNB5RPI3.js +301 -0
- package/chunks/{chunk.SGFAP56K.js → chunk.PPMF6234.js} +1 -1
- package/chunks/{chunk.BHWBJIPJ.js → chunk.QLHOYAX6.js} +4 -3
- package/chunks/{chunk.IS6GBDKU.js → chunk.QWWOLT5V.js} +1 -1
- package/chunks/{chunk.W6E54X7P.js → chunk.RGTKMLGE.js} +1 -1
- package/chunks/{chunk.27SYD4ZG.js → chunk.UBTUHHC7.js} +2 -2
- package/chunks/{chunk.H26SOC3M.js → chunk.UKR6SWJ2.js} +2 -2
- package/chunks/{chunk.Z3MHP5MN.js → chunk.V56VPSWH.js} +8 -1
- package/chunks/chunk.VZTV63IQ.js +0 -0
- package/chunks/{chunk.WV7BXKV6.js → chunk.WWSNXINM.js} +2 -2
- package/chunks/{chunk.3HGZ5B5Q.js → chunk.XMAA7CU5.js} +1 -1
- package/chunks/{chunk.NCZAYYNU.js → chunk.ZFGPNYTO.js} +1 -1
- package/chunks/{chunk.43JUKB53.js → chunk.ZRKILGXZ.js} +1 -7
- 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 +4 -0
- package/components/form/form-control.js +1 -1
- package/components/form/index.js +6 -6
- package/components/form/summary/index.js +6 -6
- package/components/form/summary/summary.js +6 -6
- 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 +48 -45
- package/components/input/index.js +15 -13
- package/components/input/input.d.ts +13 -12
- package/components/input/input.js +15 -13
- 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.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 +2 -2
- package/components/text/text.js +2 -2
- package/components/textarea/index.js +15 -13
- package/components/textarea/textarea.d.ts +13 -17
- package/components/textarea/textarea.js +15 -13
- 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 +48 -45
- 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/transitional-styles.js +3 -1
|
@@ -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) => {
|
|
@@ -244,8 +175,64 @@ var GdsTextarea = class extends GdsFormControlElement {
|
|
|
244
175
|
})
|
|
245
176
|
);
|
|
246
177
|
});
|
|
247
|
-
|
|
248
|
-
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");
|
|
249
236
|
}
|
|
250
237
|
connectedCallback() {
|
|
251
238
|
super.connectedCallback();
|
|
@@ -254,7 +241,7 @@ var GdsTextarea = class extends GdsFormControlElement {
|
|
|
254
241
|
}
|
|
255
242
|
disconnectedCallback() {
|
|
256
243
|
super.disconnectedCallback();
|
|
257
|
-
|
|
244
|
+
__privateGet(this, _stopDragging).call(this);
|
|
258
245
|
}
|
|
259
246
|
render() {
|
|
260
247
|
return html`${choose(this.variant, [
|
|
@@ -267,8 +254,9 @@ var GdsTextarea = class extends GdsFormControlElement {
|
|
|
267
254
|
}
|
|
268
255
|
_setAutoHeight() {
|
|
269
256
|
this.elTextareaAsync.then((element) => {
|
|
270
|
-
|
|
271
|
-
|
|
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());
|
|
272
260
|
});
|
|
273
261
|
}
|
|
274
262
|
};
|
|
@@ -278,40 +266,29 @@ renderDefault_fn = function() {
|
|
|
278
266
|
return html`
|
|
279
267
|
<gds-form-control-header>
|
|
280
268
|
<label for="input" slot="label">${this.label}</label>
|
|
281
|
-
<span slot="supporting-text" id="supporting-text"
|
|
282
|
-
|
|
283
|
-
>
|
|
269
|
+
<span slot="supporting-text" id="supporting-text">
|
|
270
|
+
${this.supportingText}
|
|
271
|
+
</span>
|
|
284
272
|
<slot
|
|
285
273
|
name="extended-supporting-text"
|
|
286
274
|
slot="extended-supporting-text"
|
|
287
275
|
></slot>
|
|
288
276
|
</gds-form-control-header>
|
|
289
277
|
|
|
290
|
-
<gds-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
gap="xs"
|
|
295
|
-
level="3"
|
|
296
|
-
padding=${!this.trailSlotOccupied ? "s s s m" : "s m s m"}
|
|
297
|
-
border-radius="xs"
|
|
298
|
-
.background=${this.disabled ? "disabled" : this.invalid ? "negative-secondary" : "secondary"}
|
|
299
|
-
.border=${this.disabled ? "" : this.invalid ? "4xs/negative" : "4xs/secondary"}
|
|
300
|
-
class="field ${this.invalid ? "invalid" : ""}"
|
|
278
|
+
<gds-field-base
|
|
279
|
+
id="field"
|
|
280
|
+
.disabled=${this.disabled}
|
|
281
|
+
.invalid=${this.invalid}
|
|
301
282
|
@click=${__privateGet(this, _handleFieldClick)}
|
|
302
|
-
|
|
283
|
+
multiline
|
|
303
284
|
>
|
|
304
|
-
${__privateMethod(this,
|
|
305
|
-
|
|
306
|
-
<gds-flex gap="xs" align-items="center" block-size="l">
|
|
307
|
-
${__privateMethod(this, _renderClearButton, renderClearButton_fn).call(this)} ${__privateMethod(this, _renderSlotTrail, renderSlotTrail_fn).call(this)}
|
|
308
|
-
</gds-flex>
|
|
285
|
+
${__privateMethod(this, _renderFieldContents, renderFieldContents_fn).call(this)}
|
|
309
286
|
${when(
|
|
310
287
|
this.resize === "auto",
|
|
311
288
|
() => __privateMethod(this, _renderResizeHandle, renderResizeHandle_fn).call(this),
|
|
312
289
|
() => nothing
|
|
313
290
|
)}
|
|
314
|
-
</gds-
|
|
291
|
+
</gds-field-base>
|
|
315
292
|
|
|
316
293
|
<gds-form-control-footer
|
|
317
294
|
.charCounter=${__privateGet(this, _shouldShowRemainingChars, shouldShowRemainingChars_get) && this.maxlength - (((_a = this.value) == null ? void 0 : _a.length) || 0)}
|
|
@@ -328,15 +305,23 @@ _handleOnInput = new WeakMap();
|
|
|
328
305
|
_handleOnChange = new WeakMap();
|
|
329
306
|
_handleFieldClick = new WeakMap();
|
|
330
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
|
+
};
|
|
331
318
|
_renderSlotLead = new WeakSet();
|
|
332
319
|
renderSlotLead_fn = function() {
|
|
333
|
-
return html
|
|
320
|
+
return html`<slot slot="lead" name="lead"></slot>`;
|
|
334
321
|
};
|
|
335
322
|
_renderSlotTrail = new WeakSet();
|
|
336
323
|
renderSlotTrail_fn = function() {
|
|
337
|
-
return html
|
|
338
|
-
<slot name="trail" @slotchange=${__privateMethod(this, _handleSlotChange, handleSlotChange_fn)}></slot>
|
|
339
|
-
`;
|
|
324
|
+
return html`<slot slot="trail" name="trail"></slot>`;
|
|
340
325
|
};
|
|
341
326
|
_addResizeHandleListener = new WeakSet();
|
|
342
327
|
addResizeHandleListener_fn = function() {
|
|
@@ -344,67 +329,20 @@ addResizeHandleListener_fn = function() {
|
|
|
344
329
|
if (resizeHandle) {
|
|
345
330
|
resizeHandle.addEventListener(
|
|
346
331
|
"mousedown",
|
|
347
|
-
|
|
332
|
+
__privateGet(this, _startDragging)
|
|
348
333
|
);
|
|
349
334
|
}
|
|
350
335
|
};
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
this.lastMouseY = event.clientY;
|
|
356
|
-
document.addEventListener("mousemove", __privateMethod(this, _onDrag, onDrag_fn).bind(this));
|
|
357
|
-
document.addEventListener("mouseup", __privateMethod(this, _stopDragging, stopDragging_fn).bind(this));
|
|
358
|
-
};
|
|
359
|
-
_onDrag = new WeakSet();
|
|
360
|
-
onDrag_fn = function(event) {
|
|
361
|
-
if (!this.isDragging)
|
|
362
|
-
return;
|
|
363
|
-
const deltaY = event.clientY - this.lastMouseY;
|
|
364
|
-
if (Math.abs(deltaY) >= 20) {
|
|
365
|
-
if (deltaY > 0) {
|
|
366
|
-
this.lines += 1;
|
|
367
|
-
} else {
|
|
368
|
-
this.lines = Math.max(1, this.lines - 1);
|
|
369
|
-
}
|
|
370
|
-
this.elTextareaAsync.then((element) => {
|
|
371
|
-
element == null ? void 0 : element.style.setProperty("--_lines", this.lines.toString());
|
|
372
|
-
});
|
|
373
|
-
this.lastMouseY = event.clientY;
|
|
374
|
-
}
|
|
375
|
-
};
|
|
376
|
-
_stopDragging = new WeakSet();
|
|
377
|
-
stopDragging_fn = function() {
|
|
378
|
-
this.isDragging = false;
|
|
379
|
-
document.removeEventListener("mousemove", __privateMethod(this, _onDrag, onDrag_fn).bind(this));
|
|
380
|
-
document.removeEventListener("mouseup", __privateMethod(this, _stopDragging, stopDragging_fn).bind(this));
|
|
381
|
-
};
|
|
336
|
+
_resizeState = new WeakMap();
|
|
337
|
+
_startDragging = new WeakMap();
|
|
338
|
+
_onDrag = new WeakMap();
|
|
339
|
+
_stopDragging = new WeakMap();
|
|
382
340
|
_renderResizeHandle = new WeakSet();
|
|
383
341
|
renderResizeHandle_fn = function() {
|
|
384
342
|
return html`
|
|
385
|
-
<
|
|
386
|
-
class="resize-handle"
|
|
387
|
-
position="absolute"
|
|
388
|
-
inset="auto auto -10px 0"
|
|
389
|
-
width="100%"
|
|
390
|
-
height="20px"
|
|
391
|
-
cursor="row-resize"
|
|
392
|
-
z-index="2"
|
|
393
|
-
@mousedown=${__privateMethod(this, _startDragging, startDragging_fn)}
|
|
394
|
-
></gds-container>
|
|
343
|
+
<div class="resize-handle" @mousedown=${__privateGet(this, _startDragging)}></div>
|
|
395
344
|
`;
|
|
396
345
|
};
|
|
397
|
-
_handleSlotChange = new WeakSet();
|
|
398
|
-
handleSlotChange_fn = function(event) {
|
|
399
|
-
const slot = event.target;
|
|
400
|
-
const assignedNodes = slot.assignedNodes({ flatten: true });
|
|
401
|
-
this.trailSlotOccupied = assignedNodes.length > 0 && assignedNodes.some(
|
|
402
|
-
(node) => {
|
|
403
|
-
var _a;
|
|
404
|
-
return node.nodeType === Node.ELEMENT_NODE || node.nodeType === Node.TEXT_NODE && ((_a = node.textContent) == null ? void 0 : _a.trim()) !== "";
|
|
405
|
-
}
|
|
406
|
-
);
|
|
407
|
-
};
|
|
408
346
|
_renderNativeTextarea = new WeakSet();
|
|
409
347
|
renderNativeTextarea_fn = function() {
|
|
410
348
|
return html`
|
|
@@ -413,7 +351,6 @@ renderNativeTextarea_fn = function() {
|
|
|
413
351
|
@change=${__privateGet(this, _handleOnChange)}
|
|
414
352
|
.value=${this.value}
|
|
415
353
|
id="input"
|
|
416
|
-
style="${this.invalid ? "color: var(--gds-color-l3-content-negative);" : this.disabled ? "color: currentColor;pointer-events:none;" : null}"
|
|
417
354
|
aria-describedby="supporting-text"
|
|
418
355
|
placeholder=" "
|
|
419
356
|
${forwardAttributes(__privateGet(this, _forwardableAttrs))}
|
|
@@ -432,6 +369,8 @@ renderClearButton_fn = function() {
|
|
|
432
369
|
?disabled="${this.disabled}"
|
|
433
370
|
label="${msg("Clear input")}"
|
|
434
371
|
@click=${__privateGet(this, _handleClearBtnClick)}
|
|
372
|
+
slot="action"
|
|
373
|
+
id="clear-button"
|
|
435
374
|
>
|
|
436
375
|
<gds-icon-cross-small />
|
|
437
376
|
</gds-button>
|
|
@@ -444,12 +383,6 @@ shouldShowRemainingChars_get = function() {
|
|
|
444
383
|
return this.maxlength < Number.MAX_SAFE_INTEGER;
|
|
445
384
|
};
|
|
446
385
|
GdsTextarea.styles = [tokens, styles];
|
|
447
|
-
__decorateClass([
|
|
448
|
-
property()
|
|
449
|
-
], GdsTextarea.prototype, "value", 2);
|
|
450
|
-
__decorateClass([
|
|
451
|
-
property()
|
|
452
|
-
], GdsTextarea.prototype, "label", 2);
|
|
453
386
|
__decorateClass([
|
|
454
387
|
styleExpressionProperty({
|
|
455
388
|
valueTemplate: (v) => v,
|
|
@@ -460,26 +393,9 @@ __decorateClass([
|
|
|
460
393
|
}
|
|
461
394
|
})
|
|
462
395
|
], GdsTextarea.prototype, "rows", 2);
|
|
463
|
-
__decorateClass([
|
|
464
|
-
state()
|
|
465
|
-
], GdsTextarea.prototype, "lines", 2);
|
|
466
396
|
__decorateClass([
|
|
467
397
|
property({ attribute: "supporting-text" })
|
|
468
398
|
], GdsTextarea.prototype, "supportingText", 2);
|
|
469
|
-
__decorateClass([
|
|
470
|
-
property({
|
|
471
|
-
attribute: "show-extended-supporting-text",
|
|
472
|
-
type: Boolean,
|
|
473
|
-
reflect: true
|
|
474
|
-
})
|
|
475
|
-
], GdsTextarea.prototype, "showExtendedSupportingText", 2);
|
|
476
|
-
__decorateClass([
|
|
477
|
-
property({
|
|
478
|
-
attribute: "disabled",
|
|
479
|
-
type: Boolean,
|
|
480
|
-
reflect: true
|
|
481
|
-
})
|
|
482
|
-
], GdsTextarea.prototype, "disabled", 2);
|
|
483
399
|
__decorateClass([
|
|
484
400
|
property({ type: Boolean })
|
|
485
401
|
], GdsTextarea.prototype, "clearable", 2);
|
|
@@ -498,9 +414,6 @@ __decorateClass([
|
|
|
498
414
|
__decorateClass([
|
|
499
415
|
query("textarea")
|
|
500
416
|
], GdsTextarea.prototype, "elTextarea", 2);
|
|
501
|
-
__decorateClass([
|
|
502
|
-
state()
|
|
503
|
-
], GdsTextarea.prototype, "trailSlotOccupied", 2);
|
|
504
417
|
__decorateClass([
|
|
505
418
|
watch("value")
|
|
506
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);
|