@sebgroup/green-core 1.72.0 → 1.74.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/components/blur/blur.component.d.ts +18 -0
- package/components/blur/blur.component.js +18 -0
- package/components/blur/blur.d.ts +2 -0
- package/components/blur/blur.js +6 -0
- package/components/blur/blur.styles.d.ts +2 -0
- package/components/blur/blur.styles.js +12 -0
- package/components/blur/index.d.ts +1 -0
- package/components/blur/index.js +1 -0
- package/components/datepicker/datepicker.component.d.ts +7 -2
- package/components/datepicker/datepicker.component.js +41 -32
- package/components/datepicker/datepicker.styles.js +5 -11
- package/components/details/details.component.d.ts +0 -1
- package/components/details/details.component.js +8 -26
- package/components/details/details.styles.js +11 -4
- package/components/dropdown/dropdown.component.d.ts +9 -2
- package/components/dropdown/dropdown.component.js +24 -19
- package/components/dropdown/dropdown.styles.js +5 -25
- package/components/formatted-text/account/account-formatter.d.ts +4 -0
- package/components/formatted-text/account/account-formatter.js +13 -0
- package/components/formatted-text/account/formatted-account.component.d.ts +28 -0
- package/components/formatted-text/account/formatted-account.component.js +34 -0
- package/components/formatted-text/account/formatted-account.d.ts +2 -0
- package/components/formatted-text/account/formatted-account.js +6 -0
- package/components/formatted-text/account/index.d.ts +1 -0
- package/components/formatted-text/account/index.js +1 -0
- package/components/formatted-text/date/date-time-formatter.d.ts +10 -0
- package/components/formatted-text/date/date-time-formatter.js +49 -0
- package/components/formatted-text/date/formatted-date.component.d.ts +29 -0
- package/components/formatted-text/date/formatted-date.component.js +43 -0
- package/components/formatted-text/date/formatted-date.d.ts +2 -0
- package/components/formatted-text/date/formatted-date.js +6 -0
- package/components/formatted-text/date/index.d.ts +1 -0
- package/components/formatted-text/date/index.js +1 -0
- package/components/formatted-text/formatted-text.d.ts +12 -0
- package/components/formatted-text/formatted-text.js +19 -0
- package/components/formatted-text/formatters.d.ts +3 -0
- package/components/formatted-text/formatters.js +3 -0
- package/components/formatted-text/index.d.ts +4 -0
- package/components/formatted-text/index.js +4 -0
- package/components/formatted-text/number/formatted-number.component.d.ts +31 -0
- package/components/formatted-text/number/formatted-number.component.js +40 -0
- package/components/formatted-text/number/formatted-number.d.ts +2 -0
- package/components/formatted-text/number/formatted-number.js +6 -0
- package/components/formatted-text/number/index.d.ts +1 -0
- package/components/formatted-text/number/index.js +1 -0
- package/components/formatted-text/number/number-formatter.d.ts +4 -0
- package/components/formatted-text/number/number-formatter.js +20 -0
- package/components/index.d.ts +1 -0
- package/components/index.js +1 -0
- package/components/input/input.component.d.ts +6 -11
- package/components/input/input.component.js +40 -40
- package/components/input/input.styles.js +1 -61
- package/components/pure.d.ts +1 -0
- package/components/pure.js +1 -0
- package/components/select/select.component.d.ts +6 -0
- package/components/select/select.component.js +36 -13
- package/components/select/select.styles.js +1 -17
- package/components/sensitive/index.d.ts +1 -0
- package/components/sensitive/index.js +1 -0
- package/components/sensitive/number/index.d.ts +1 -0
- package/components/sensitive/number/index.js +1 -0
- package/components/sensitive/number/sensitive-number.component.d.ts +31 -0
- package/components/sensitive/number/sensitive-number.component.js +43 -0
- package/components/sensitive/number/sensitive-number.d.ts +2 -0
- package/components/sensitive/number/sensitive-number.js +6 -0
- package/components/textarea/textarea.component.d.ts +6 -11
- package/components/textarea/textarea.component.js +48 -48
- package/components/textarea/textarea.styles.js +14 -58
- package/components/theme/chlorophyll-tokens.scss.js +1 -1
- package/generated/react/blur/index.d.ts +365 -0
- package/generated/react/blur/index.js +13 -0
- package/generated/react/datepicker/index.d.ts +1 -0
- package/generated/react/dropdown/index.d.ts +1 -0
- package/generated/react/formatted-account/index.d.ts +428 -0
- package/generated/react/formatted-account/index.js +15 -0
- package/generated/react/formatted-date/index.d.ts +430 -0
- package/generated/react/formatted-date/index.js +13 -0
- package/generated/react/formatted-number/index.d.ts +430 -0
- package/generated/react/formatted-number/index.js +15 -0
- package/generated/react/index.d.ts +8 -3
- package/generated/react/index.js +8 -3
- package/generated/react/input/index.d.ts +1 -1
- package/generated/react/select/index.d.ts +1 -0
- package/generated/react/sensitive-number/index.d.ts +431 -0
- package/generated/react/sensitive-number/index.js +15 -0
- package/generated/react/textarea/index.d.ts +1 -1
- package/package.json +19 -1
- package/primitives/field-base/field-base.trans.styles.scss.js +1 -1
- package/primitives/form-control-header/form-control-header.component.js +1 -0
- package/setup-jest.js +43 -13
- package/shared-styles/form-control-host.style.d.ts +2 -0
- package/shared-styles/form-control-host.style.js +65 -0
- package/tokens/dark.css.js +1 -1
- package/tokens/light.css.js +1 -1
- package/tokens/motion.css.js +1 -1
- package/tokens/shadow.css.js +1 -1
- package/tokens/size.css.js +1 -1
- package/tokens/text.css.js +1 -1
- package/utils/helpers/custom-element-scoping.js +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { GdsElement } from '../../gds-element';
|
|
2
|
+
/**
|
|
3
|
+
* @element gds-blur
|
|
4
|
+
* A container that applies a blur effect to its content.
|
|
5
|
+
*
|
|
6
|
+
* @slot - Content to be blurred.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* <gds-blur>
|
|
10
|
+
* <div>Sensitive content here</div>
|
|
11
|
+
* </gds-blur>
|
|
12
|
+
*
|
|
13
|
+
* @status beta
|
|
14
|
+
*/
|
|
15
|
+
export declare class GdsBlur extends GdsElement {
|
|
16
|
+
static styles: import("lit").CSSResult;
|
|
17
|
+
render(): any;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__decorateClass
|
|
3
|
+
} from "../../chunks/chunk.QTSIPXV3.js";
|
|
4
|
+
import { GdsElement } from "../../gds-element.js";
|
|
5
|
+
import { gdsCustomElement, html } from "../../scoping.js";
|
|
6
|
+
import styles from "./blur.styles.js";
|
|
7
|
+
let GdsBlur = class extends GdsElement {
|
|
8
|
+
render() {
|
|
9
|
+
return html`<slot></slot>`;
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
GdsBlur.styles = styles;
|
|
13
|
+
GdsBlur = __decorateClass([
|
|
14
|
+
gdsCustomElement("gds-blur")
|
|
15
|
+
], GdsBlur);
|
|
16
|
+
export {
|
|
17
|
+
GdsBlur
|
|
18
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './blur';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./blur.js";
|
|
@@ -29,6 +29,12 @@ declare class Datepicker extends GdsFormControlElement<Date> {
|
|
|
29
29
|
* Whether to use the small variant of the datepicker field.
|
|
30
30
|
*/
|
|
31
31
|
size: 'large' | 'small';
|
|
32
|
+
/**
|
|
33
|
+
* Hides the header and the footer, while still keeping the accessible label
|
|
34
|
+
*
|
|
35
|
+
* Always set the `label` attribute, and if you need to hide it, add this attribute and keep `label` set.
|
|
36
|
+
*/
|
|
37
|
+
plain: boolean;
|
|
32
38
|
/**
|
|
33
39
|
* Whether to show a column of week numbers in the calendar.
|
|
34
40
|
*/
|
|
@@ -96,10 +102,9 @@ declare const GdsDatepicker_base: (new (...args: any[]) => import("../../utils/m
|
|
|
96
102
|
*
|
|
97
103
|
* @status beta
|
|
98
104
|
*
|
|
99
|
-
* @slot supporting-text - A supporting text that will be displayed below the label and above the input field.
|
|
100
105
|
* @slot extended-supporting-text - A longer supporting text can be placed here. It will be displayed in a panel when the user clicks the info button.
|
|
101
106
|
* @slot message - ***(deprecated - use `errorMessage` property instead)*** Error message to show below the input field whem there is a validation error.
|
|
102
|
-
* @slot sub-label - ***(deprecated - use `supporting-text`
|
|
107
|
+
* @slot sub-label - ***(deprecated - use `supporting-text` property instead)*** Renders between the label and the trigger button.
|
|
103
108
|
*
|
|
104
109
|
* @event change - Fired when the value of the dropdown is changed through user interaction (not when value prop is set programatically).
|
|
105
110
|
* @event gds-ui-state - Fired when the dropdown is opened or closed.
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
__privateMethod,
|
|
6
6
|
__privateSet
|
|
7
7
|
} from "../../chunks/chunk.QTSIPXV3.js";
|
|
8
|
-
var _valueOnOpen, _renderBackToValidRangeButton, renderBackToValidRangeButton_fn, _focusDate, focusDate_fn, _getSpinnerLabel, getSpinnerLabel_fn, _getMinSpinnerValue, getMinSpinnerValue_fn, _getMaxSpinnerValue, getMaxSpinnerValue_fn, _dispatchChangeEvent, dispatchChangeEvent_fn, _dispatchInputEvent, dispatchInputEvent_fn, _handleFieldFocusOut, _handleSpinnerFocus, _handleClipboardCopy, _handleClipboardPaste, _handleFieldClick, _handleCalendarChange, _handleMonthChange, _handleYearChange, _handleIncrementFocusedMonth, _handleDecrementFocusedMonth, _handleCalendarFocusChange, _handlePopoverStateChange, _handleSpinnerKeydown, _parseDateFormat, parseDateFormat_fn, _handleSpinnerChange, _spinnerState, _years, years_get, _isValueOutsideRange, isValueOutsideRange_get;
|
|
8
|
+
var _valueOnOpen, _shouldShowFooter, shouldShowFooter_fn, _renderBackToValidRangeButton, renderBackToValidRangeButton_fn, _focusDate, focusDate_fn, _getSpinnerLabel, getSpinnerLabel_fn, _getMinSpinnerValue, getMinSpinnerValue_fn, _getMaxSpinnerValue, getMaxSpinnerValue_fn, _dispatchChangeEvent, dispatchChangeEvent_fn, _dispatchInputEvent, dispatchInputEvent_fn, _handleFieldFocusOut, _handleSpinnerFocus, _handleClipboardCopy, _handleClipboardPaste, _handleFieldClick, _handleCalendarChange, _handleMonthChange, _handleYearChange, _handleIncrementFocusedMonth, _handleDecrementFocusedMonth, _handleCalendarFocusChange, _handlePopoverStateChange, _handleSpinnerKeydown, _parseDateFormat, parseDateFormat_fn, _handleSpinnerChange, _spinnerState, _years, years_get, _isValueOutsideRange, isValueOutsideRange_get;
|
|
9
9
|
import { localized, msg } from "@lit/localize";
|
|
10
10
|
import { nothing } from "lit";
|
|
11
11
|
import { property, query, queryAll, queryAsync, state } from "lit/decorators.js";
|
|
@@ -19,6 +19,7 @@ import { GdsButton } from "../../components/button/button.component.js";
|
|
|
19
19
|
import { GdsDropdown } from "../../components/dropdown/dropdown.component.js";
|
|
20
20
|
import { GdsFlex } from "../../components/flex/flex.component.js";
|
|
21
21
|
import { gdsCustomElement, html } from "../../scoping.js";
|
|
22
|
+
import formControlHostStyle from "../../shared-styles/form-control-host.style.js";
|
|
22
23
|
import { tokens } from "../../tokens.style.js";
|
|
23
24
|
import { TransitionalStyles } from "../../transitional-styles.js";
|
|
24
25
|
import { watch } from "../../utils/decorators/index.js";
|
|
@@ -43,6 +44,7 @@ import { styles } from "./datepicker.styles.js";
|
|
|
43
44
|
let Datepicker = class extends GdsFormControlElement {
|
|
44
45
|
constructor() {
|
|
45
46
|
super();
|
|
47
|
+
__privateAdd(this, _shouldShowFooter);
|
|
46
48
|
__privateAdd(this, _renderBackToValidRangeButton);
|
|
47
49
|
__privateAdd(this, _focusDate);
|
|
48
50
|
__privateAdd(this, _getSpinnerLabel);
|
|
@@ -64,6 +66,7 @@ let Datepicker = class extends GdsFormControlElement {
|
|
|
64
66
|
this.open = false;
|
|
65
67
|
this.supportingText = "";
|
|
66
68
|
this.size = "large";
|
|
69
|
+
this.plain = false;
|
|
67
70
|
this.showWeekNumbers = false;
|
|
68
71
|
this.hideLabel = false;
|
|
69
72
|
this.disabledWeekends = false;
|
|
@@ -273,26 +276,29 @@ let Datepicker = class extends GdsFormControlElement {
|
|
|
273
276
|
}
|
|
274
277
|
render() {
|
|
275
278
|
return html`
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
279
|
+
${when(
|
|
280
|
+
!this.plain,
|
|
281
|
+
() => html`<gds-form-control-header class="size-${this.size}">
|
|
282
|
+
<label id="label" for="spinner-0" slot="label">${this.label}</label>
|
|
283
|
+
${when(
|
|
284
|
+
this.supportingText.length > 0,
|
|
285
|
+
() => html`<span slot="supporting-text" id="supporting-text">
|
|
286
|
+
${this.supportingText}
|
|
287
|
+
</span>`
|
|
288
|
+
)}
|
|
289
|
+
<slot
|
|
290
|
+
id="supporting-text-slot"
|
|
291
|
+
name="extended-supporting-text"
|
|
292
|
+
slot="extended-supporting-text"
|
|
293
|
+
></slot>
|
|
294
|
+
<!-- @deprecated: use 'supporting-text' slot instead. Remove in 2.0 release. -->
|
|
295
|
+
<slot
|
|
296
|
+
id="sub-label-slot"
|
|
297
|
+
name="sub-label"
|
|
298
|
+
slot="supporting-text"
|
|
299
|
+
></slot>
|
|
300
|
+
</gds-form-control-header>`
|
|
283
301
|
)}
|
|
284
|
-
<slot
|
|
285
|
-
id="supporting-text-slot"
|
|
286
|
-
name="extended-supporting-text"
|
|
287
|
-
slot="extended-supporting-text"
|
|
288
|
-
></slot>
|
|
289
|
-
<!-- @deprecated: use 'supporting-text' slot instead. Remove in 2.0 release. -->
|
|
290
|
-
<slot
|
|
291
|
-
id="sub-label-slot"
|
|
292
|
-
name="sub-label"
|
|
293
|
-
slot="supporting-text"
|
|
294
|
-
></slot>
|
|
295
|
-
</gds-form-control-header>
|
|
296
302
|
<gds-field-base
|
|
297
303
|
.size=${this.size}
|
|
298
304
|
.disabled=${this.disabled}
|
|
@@ -315,7 +321,7 @@ let Datepicker = class extends GdsFormControlElement {
|
|
|
315
321
|
aria-valuemin=${__privateMethod(this, _getMinSpinnerValue, getMinSpinnerValue_fn).call(this, f.name)}
|
|
316
322
|
aria-valuemax=${__privateMethod(this, _getMaxSpinnerValue, getMaxSpinnerValue_fn).call(this, f.name)}
|
|
317
323
|
aria-label=${__privateMethod(this, _getSpinnerLabel, getSpinnerLabel_fn).call(this, f.name)}
|
|
318
|
-
aria-describedby="
|
|
324
|
+
aria-describedby="supporting-text supporting-text-slot sub-label-slot message"
|
|
319
325
|
data-max-width=${__privateMethod(this, _getMaxSpinnerValue, getMaxSpinnerValue_fn).call(this, f.name).toString().length}
|
|
320
326
|
@keydown=${__privateGet(this, _handleSpinnerKeydown)}
|
|
321
327
|
@change=${(e) => __privateGet(this, _handleSpinnerChange).call(this, e.detail.value, f.name)}
|
|
@@ -355,22 +361,18 @@ let Datepicker = class extends GdsFormControlElement {
|
|
|
355
361
|
</gds-button>
|
|
356
362
|
</gds-field-base>
|
|
357
363
|
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
this.
|
|
361
|
-
|
|
362
|
-
// Wrapped in a slot for backwards compatibility with the deprecated message slot
|
|
363
|
-
// Remove for 2.0 release
|
|
364
|
-
() => html`
|
|
364
|
+
${when(
|
|
365
|
+
__privateMethod(this, _shouldShowFooter, shouldShowFooter_fn).call(this),
|
|
366
|
+
() => html`<gds-form-control-footer class="size-${this.size}">
|
|
367
|
+
${``}
|
|
365
368
|
<slot id="message" name="message" slot="message">
|
|
366
369
|
<gds-icon-triangle-exclamation
|
|
367
370
|
solid
|
|
368
371
|
></gds-icon-triangle-exclamation>
|
|
369
372
|
${this.errorMessage || this.validationMessage}
|
|
370
373
|
</slot>
|
|
371
|
-
|
|
374
|
+
</gds-form-control-footer>`
|
|
372
375
|
)}
|
|
373
|
-
</gds-form-control-footer>
|
|
374
376
|
|
|
375
377
|
<gds-popover
|
|
376
378
|
autofocus
|
|
@@ -529,6 +531,10 @@ let Datepicker = class extends GdsFormControlElement {
|
|
|
529
531
|
}
|
|
530
532
|
};
|
|
531
533
|
_valueOnOpen = new WeakMap();
|
|
534
|
+
_shouldShowFooter = new WeakSet();
|
|
535
|
+
shouldShowFooter_fn = function() {
|
|
536
|
+
return !this.plain && this.invalid;
|
|
537
|
+
};
|
|
532
538
|
_renderBackToValidRangeButton = new WeakSet();
|
|
533
539
|
renderBackToValidRangeButton_fn = async function() {
|
|
534
540
|
const focusedDate = await this.getFocusedDate();
|
|
@@ -567,7 +573,7 @@ getSpinnerLabel_fn = function(name) {
|
|
|
567
573
|
month: msg("Month"),
|
|
568
574
|
day: msg("Day")
|
|
569
575
|
};
|
|
570
|
-
return labels[name]
|
|
576
|
+
return `${labels[name]} ${this.label}`;
|
|
571
577
|
};
|
|
572
578
|
_getMinSpinnerValue = new WeakSet();
|
|
573
579
|
getMinSpinnerValue_fn = function(name) {
|
|
@@ -655,7 +661,7 @@ isValueOutsideRange_get = function() {
|
|
|
655
661
|
return false;
|
|
656
662
|
return this.value.getFullYear() < this.min.getFullYear() || this.value.getFullYear() > this.max.getFullYear();
|
|
657
663
|
};
|
|
658
|
-
Datepicker.styles = [tokens, styles];
|
|
664
|
+
Datepicker.styles = [tokens, formControlHostStyle, styles];
|
|
659
665
|
__decorateClass([
|
|
660
666
|
property({ converter: dateConverter })
|
|
661
667
|
], Datepicker.prototype, "value", 1);
|
|
@@ -674,6 +680,9 @@ __decorateClass([
|
|
|
674
680
|
__decorateClass([
|
|
675
681
|
property({ type: String })
|
|
676
682
|
], Datepicker.prototype, "size", 2);
|
|
683
|
+
__decorateClass([
|
|
684
|
+
property({ type: Boolean })
|
|
685
|
+
], Datepicker.prototype, "plain", 2);
|
|
677
686
|
__decorateClass([
|
|
678
687
|
property({ type: Boolean, attribute: "show-week-numbers" })
|
|
679
688
|
], Datepicker.prototype, "showWeekNumbers", 2);
|
|
@@ -4,17 +4,6 @@ const styles = css`
|
|
|
4
4
|
@layer base, reset;
|
|
5
5
|
|
|
6
6
|
@layer base {
|
|
7
|
-
:host {
|
|
8
|
-
display: flex;
|
|
9
|
-
flex-direction: column;
|
|
10
|
-
width: 100%;
|
|
11
|
-
contain: layout;
|
|
12
|
-
isolation: isolate;
|
|
13
|
-
gap: var(--gds-space-xs);
|
|
14
|
-
font-family: inherit;
|
|
15
|
-
min-width: 200px;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
7
|
::part(_button) {
|
|
19
8
|
outline-offset: -1px;
|
|
20
9
|
}
|
|
@@ -29,6 +18,11 @@ const styles = css`
|
|
|
29
18
|
font-weight: var(--gds-text-weight-regular);
|
|
30
19
|
}
|
|
31
20
|
|
|
21
|
+
:host([size='small']) .spinners {
|
|
22
|
+
font-size: var(--gds-text-size-detail-s);
|
|
23
|
+
line-height: var(--gds-text-line-height-detail-s);
|
|
24
|
+
}
|
|
25
|
+
|
|
32
26
|
.spinner {
|
|
33
27
|
display: flex;
|
|
34
28
|
align-items: center;
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
__privateAdd,
|
|
4
4
|
__privateGet
|
|
5
5
|
} from "../../chunks/chunk.QTSIPXV3.js";
|
|
6
|
-
var
|
|
6
|
+
var _handleToggle, _handleKeydown, _syncGroupState, _dispatchStateEvent, _renderHeader, _renderIconButton, _renderContent;
|
|
7
7
|
import { property, query } from "lit/decorators.js";
|
|
8
8
|
import { classMap } from "lit/directives/class-map.js";
|
|
9
9
|
import { GdsElement } from "../../gds-element.js";
|
|
@@ -30,21 +30,6 @@ let GdsDetails = class extends withSizeXProps(
|
|
|
30
30
|
this.name = "";
|
|
31
31
|
this.open = false;
|
|
32
32
|
this.size = "large";
|
|
33
|
-
__privateAdd(this, _initializeContentHeight, () => {
|
|
34
|
-
if (!this._content)
|
|
35
|
-
return;
|
|
36
|
-
__privateGet(this, _updateContentHeight).call(this);
|
|
37
|
-
});
|
|
38
|
-
__privateAdd(this, _updateContentHeight, () => {
|
|
39
|
-
if (!this._content)
|
|
40
|
-
return;
|
|
41
|
-
requestAnimationFrame(() => {
|
|
42
|
-
this._content?.style.setProperty(
|
|
43
|
-
"--_max-height",
|
|
44
|
-
this.open ? `${this._content.scrollHeight}px` : "0"
|
|
45
|
-
);
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
33
|
__privateAdd(this, _handleToggle, () => {
|
|
49
34
|
this.open = !this.open;
|
|
50
35
|
__privateGet(this, _dispatchStateEvent).call(this);
|
|
@@ -59,12 +44,11 @@ let GdsDetails = class extends withSizeXProps(
|
|
|
59
44
|
if (!this.open || !this.name)
|
|
60
45
|
return;
|
|
61
46
|
document.querySelectorAll('[gds-element="gds-details"]').forEach((details) => {
|
|
62
|
-
var _a
|
|
47
|
+
var _a;
|
|
63
48
|
if (details !== this && details.name === this.name) {
|
|
64
49
|
const other = details;
|
|
65
50
|
other.open = false;
|
|
66
|
-
__privateGet(_a = other,
|
|
67
|
-
__privateGet(_b = other, _dispatchStateEvent).call(_b);
|
|
51
|
+
__privateGet(_a = other, _dispatchStateEvent).call(_a);
|
|
68
52
|
}
|
|
69
53
|
});
|
|
70
54
|
});
|
|
@@ -114,7 +98,11 @@ let GdsDetails = class extends withSizeXProps(
|
|
|
114
98
|
return html`
|
|
115
99
|
<div
|
|
116
100
|
id="content-${this.name || "default"}"
|
|
117
|
-
class
|
|
101
|
+
class=${classMap({
|
|
102
|
+
content: true,
|
|
103
|
+
open: this.open,
|
|
104
|
+
small: this.size === "small"
|
|
105
|
+
})}
|
|
118
106
|
aria-hidden="${!this.open}"
|
|
119
107
|
>
|
|
120
108
|
<slot></slot>
|
|
@@ -122,11 +110,7 @@ let GdsDetails = class extends withSizeXProps(
|
|
|
122
110
|
`;
|
|
123
111
|
});
|
|
124
112
|
}
|
|
125
|
-
firstUpdated() {
|
|
126
|
-
__privateGet(this, _initializeContentHeight).call(this);
|
|
127
|
-
}
|
|
128
113
|
__handleOpenChange() {
|
|
129
|
-
__privateGet(this, _updateContentHeight).call(this);
|
|
130
114
|
__privateGet(this, _syncGroupState).call(this);
|
|
131
115
|
}
|
|
132
116
|
render() {
|
|
@@ -143,8 +127,6 @@ let GdsDetails = class extends withSizeXProps(
|
|
|
143
127
|
`;
|
|
144
128
|
}
|
|
145
129
|
};
|
|
146
|
-
_initializeContentHeight = new WeakMap();
|
|
147
|
-
_updateContentHeight = new WeakMap();
|
|
148
130
|
_handleToggle = new WeakMap();
|
|
149
131
|
_handleKeydown = new WeakMap();
|
|
150
132
|
_syncGroupState = new WeakMap();
|
|
@@ -91,7 +91,6 @@ const styles = css`
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
.details.open .content {
|
|
94
|
-
display: flex;
|
|
95
94
|
padding-block-end: var(--gds-space-l);
|
|
96
95
|
}
|
|
97
96
|
|
|
@@ -100,11 +99,19 @@ const styles = css`
|
|
|
100
99
|
}
|
|
101
100
|
|
|
102
101
|
.content {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
transition:
|
|
102
|
+
interpolate-size: allow-keywords;
|
|
103
|
+
height: 0;
|
|
104
|
+
transition:
|
|
105
|
+
height 0.35s ease,
|
|
106
|
+
padding-block-end 0.35s ease;
|
|
107
|
+
overflow-y: clip;
|
|
106
108
|
outline: none;
|
|
107
109
|
}
|
|
110
|
+
|
|
111
|
+
.content.open {
|
|
112
|
+
height: max-content;
|
|
113
|
+
max-height: 100vh;
|
|
114
|
+
}
|
|
108
115
|
}
|
|
109
116
|
`;
|
|
110
117
|
export {
|
|
@@ -9,10 +9,9 @@ export * from '../../primitives/listbox/option.component';
|
|
|
9
9
|
*
|
|
10
10
|
* @slot - Options for the dropdown. Accepts `gds-option` and `gds-menu-heading` elements.
|
|
11
11
|
* @slot trigger - Custom content for the trigger button can be assigned through this slot.
|
|
12
|
-
* @slot supporting-text - A supporting text that will be displayed below the label and above the input field.
|
|
13
12
|
* @slot extended-supporting-text - A longer supporting text can be placed here. It will be displayed in a panel when the user clicks the info button.
|
|
14
13
|
* @slot message - ***(deprecated - use `errorMessage` property instead)*** Error message to show below the input field whem there is a validation error.
|
|
15
|
-
* @slot sub-label - ***(deprecated - use `supporting-text`
|
|
14
|
+
* @slot sub-label - ***(deprecated - use `supporting-text` property instead)*** Renders between the label and the trigger button.
|
|
16
15
|
*
|
|
17
16
|
* @event change - Fired when the value of the dropdown is changed through user interaction (not when value prop is set programatically).
|
|
18
17
|
* @event input - Fired when the value of the dropdown is changed through user interaction.
|
|
@@ -94,8 +93,16 @@ export declare class GdsDropdown<ValueT = any> extends GdsFormControlElement<Val
|
|
|
94
93
|
size: 'medium' | 'small';
|
|
95
94
|
/**
|
|
96
95
|
* Whether to hide the label.
|
|
96
|
+
*
|
|
97
|
+
* @deprecated - use `plain` instead
|
|
97
98
|
*/
|
|
98
99
|
hideLabel: boolean;
|
|
100
|
+
/**
|
|
101
|
+
* Hides the header and the footer, while still keeping the accessible label
|
|
102
|
+
*
|
|
103
|
+
* Always set the `label` attribute, and if you need to hide it, add this attribute and keep `label` set.
|
|
104
|
+
*/
|
|
105
|
+
plain: boolean;
|
|
99
106
|
/**
|
|
100
107
|
* Whether to disable the mobile styles.
|
|
101
108
|
*/
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
__privateMethod,
|
|
6
6
|
__privateSet
|
|
7
7
|
} from "../../chunks/chunk.QTSIPXV3.js";
|
|
8
|
-
var _optionElements, _renderCombobox, _renderTriggerButton, _calcMaxHeight, _dispatchUISateEvent, _handlePopoverStateChange, _handleSearchFieldInput, _handleSearchFieldKeyDown, _handleListboxKeyDown, _handleOptionFocusChange, _handleSelectionChange, handleSelectionChange_fn, _dispatchInputEvent, _dispatchChangeEvent, _registerAutoCloseListener, registerAutoCloseListener_fn, _unregisterAutoCloseListener, unregisterAutoCloseListener_fn, _blurCloseListener, _tabCloseListener;
|
|
8
|
+
var _optionElements, _shouldShowFooter, shouldShowFooter_fn, _renderCombobox, _renderTriggerButton, _calcMaxHeight, _dispatchUISateEvent, _handlePopoverStateChange, _handleSearchFieldInput, _handleSearchFieldKeyDown, _handleListboxKeyDown, _handleOptionFocusChange, _handleSelectionChange, handleSelectionChange_fn, _dispatchInputEvent, _dispatchChangeEvent, _registerAutoCloseListener, registerAutoCloseListener_fn, _unregisterAutoCloseListener, unregisterAutoCloseListener_fn, _blurCloseListener, _tabCloseListener;
|
|
9
9
|
import { localized, msg, str } from "@lit/localize";
|
|
10
10
|
import { property, query, queryAsync } from "lit/decorators.js";
|
|
11
11
|
import { ifDefined } from "lit/directives/if-defined.js";
|
|
@@ -17,6 +17,7 @@ import { GdsFormControlFooter } from "../../primitives/form-control-footer/form-
|
|
|
17
17
|
import { GdsFormControlHeader } from "../../primitives/form-control-header/form-control-header.component.js";
|
|
18
18
|
import { GdsListbox } from "../../primitives/listbox/listbox.component.js";
|
|
19
19
|
import { gdsCustomElement, html } from "../../scoping.js";
|
|
20
|
+
import formControlHostStyle from "../../shared-styles/form-control-host.style.js";
|
|
20
21
|
import { tokens } from "../../tokens.style.js";
|
|
21
22
|
import { observeLightDOM } from "../../utils/decorators/observe-light-dom.js";
|
|
22
23
|
import { watch } from "../../utils/decorators/watch.js";
|
|
@@ -29,6 +30,7 @@ export * from "../../primitives/listbox/option.component.js";
|
|
|
29
30
|
let GdsDropdown = class extends GdsFormControlElement {
|
|
30
31
|
constructor() {
|
|
31
32
|
super(...arguments);
|
|
33
|
+
__privateAdd(this, _shouldShowFooter);
|
|
32
34
|
/**
|
|
33
35
|
* Selects an option in the dropdown.
|
|
34
36
|
*
|
|
@@ -48,6 +50,7 @@ let GdsDropdown = class extends GdsFormControlElement {
|
|
|
48
50
|
this.maxHeight = 500;
|
|
49
51
|
this.size = "medium";
|
|
50
52
|
this.hideLabel = false;
|
|
53
|
+
this.plain = false;
|
|
51
54
|
this.disableMobileStyles = false;
|
|
52
55
|
__privateAdd(this, _optionElements, void 0);
|
|
53
56
|
__privateAdd(this, _renderCombobox, () => {
|
|
@@ -55,6 +58,7 @@ let GdsDropdown = class extends GdsFormControlElement {
|
|
|
55
58
|
<input
|
|
56
59
|
id="trigger"
|
|
57
60
|
role="combobox"
|
|
61
|
+
class="native-control"
|
|
58
62
|
aria-expanded="${this.open}"
|
|
59
63
|
aria-owns="listbox"
|
|
60
64
|
aria-haspopup="listbox"
|
|
@@ -94,6 +98,7 @@ let GdsDropdown = class extends GdsFormControlElement {
|
|
|
94
98
|
<button
|
|
95
99
|
id="trigger"
|
|
96
100
|
role="combobox"
|
|
101
|
+
class="native-control"
|
|
97
102
|
aria-expanded="${this.open}"
|
|
98
103
|
aria-owns="listbox"
|
|
99
104
|
aria-haspopup="listbox"
|
|
@@ -291,7 +296,7 @@ let GdsDropdown = class extends GdsFormControlElement {
|
|
|
291
296
|
render() {
|
|
292
297
|
return html`
|
|
293
298
|
${when(
|
|
294
|
-
!this.hideLabel,
|
|
299
|
+
!this.plain && !this.hideLabel,
|
|
295
300
|
() => html`
|
|
296
301
|
<gds-form-control-header class="size-${this.size}">
|
|
297
302
|
<label id="label" for="trigger" slot="label">${this.label}</label>
|
|
@@ -361,23 +366,16 @@ let GdsDropdown = class extends GdsFormControlElement {
|
|
|
361
366
|
</gds-popover>
|
|
362
367
|
|
|
363
368
|
${when(
|
|
364
|
-
|
|
369
|
+
__privateMethod(this, _shouldShowFooter, shouldShowFooter_fn).call(this),
|
|
365
370
|
() => html`
|
|
366
371
|
<gds-form-control-footer class="size-${this.size}">
|
|
367
|
-
${
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
<gds-icon-triangle-exclamation
|
|
375
|
-
solid
|
|
376
|
-
></gds-icon-triangle-exclamation>
|
|
377
|
-
${this.errorMessage || this.validationMessage}
|
|
378
|
-
</slot>
|
|
379
|
-
`
|
|
380
|
-
)}
|
|
372
|
+
${``}
|
|
373
|
+
<slot id="message" name="message" slot="message">
|
|
374
|
+
<gds-icon-triangle-exclamation
|
|
375
|
+
solid
|
|
376
|
+
></gds-icon-triangle-exclamation>
|
|
377
|
+
${this.errorMessage || this.validationMessage}
|
|
378
|
+
</slot>
|
|
381
379
|
</gds-form-control-footer>
|
|
382
380
|
`
|
|
383
381
|
)}
|
|
@@ -434,6 +432,10 @@ let GdsDropdown = class extends GdsFormControlElement {
|
|
|
434
432
|
}
|
|
435
433
|
};
|
|
436
434
|
_optionElements = new WeakMap();
|
|
435
|
+
_shouldShowFooter = new WeakSet();
|
|
436
|
+
shouldShowFooter_fn = function() {
|
|
437
|
+
return !this.plain && this.invalid;
|
|
438
|
+
};
|
|
437
439
|
_renderCombobox = new WeakMap();
|
|
438
440
|
_renderTriggerButton = new WeakMap();
|
|
439
441
|
_calcMaxHeight = new WeakMap();
|
|
@@ -475,7 +477,7 @@ unregisterAutoCloseListener_fn = function() {
|
|
|
475
477
|
};
|
|
476
478
|
_blurCloseListener = new WeakMap();
|
|
477
479
|
_tabCloseListener = new WeakMap();
|
|
478
|
-
GdsDropdown.styles = [tokens, styles];
|
|
480
|
+
GdsDropdown.styles = [tokens, formControlHostStyle, styles];
|
|
479
481
|
__decorateClass([
|
|
480
482
|
property({ attribute: "supporting-text" })
|
|
481
483
|
], GdsDropdown.prototype, "supportingText", 2);
|
|
@@ -510,7 +512,10 @@ __decorateClass([
|
|
|
510
512
|
property({ type: Boolean, attribute: "hide-label" })
|
|
511
513
|
], GdsDropdown.prototype, "hideLabel", 2);
|
|
512
514
|
__decorateClass([
|
|
513
|
-
property()
|
|
515
|
+
property({ type: Boolean })
|
|
516
|
+
], GdsDropdown.prototype, "plain", 2);
|
|
517
|
+
__decorateClass([
|
|
518
|
+
property({ type: Boolean })
|
|
514
519
|
], GdsDropdown.prototype, "disableMobileStyles", 2);
|
|
515
520
|
__decorateClass([
|
|
516
521
|
query("#trigger")
|
|
@@ -5,35 +5,23 @@ const style = css`
|
|
|
5
5
|
|
|
6
6
|
@layer base {
|
|
7
7
|
:host {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
width: 100%;
|
|
11
|
-
gap: var(--gds-space-xs);
|
|
12
|
-
--_transition: all 368ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
8
|
+
isolation: auto;
|
|
9
|
+
contain: none;
|
|
13
10
|
}
|
|
14
11
|
|
|
15
12
|
#field::part(_base) {
|
|
16
13
|
cursor: pointer;
|
|
17
14
|
}
|
|
18
15
|
|
|
19
|
-
button {
|
|
20
|
-
appearance: none;
|
|
21
|
-
background: transparent;
|
|
22
|
-
border-width: 0;
|
|
23
|
-
font-family: inherit;
|
|
24
|
-
font-size: inherit;
|
|
25
|
-
line-height: inherit;
|
|
26
|
-
color: currentColor;
|
|
27
|
-
cursor: pointer;
|
|
28
|
-
padding: 0;
|
|
29
|
-
text-align: left;
|
|
16
|
+
button#trigger {
|
|
30
17
|
flex: 0 1 100%;
|
|
18
|
+
cursor: pointer;
|
|
31
19
|
|
|
32
20
|
/* This prevents overflow when the text is too long */
|
|
33
21
|
display: grid;
|
|
34
22
|
}
|
|
35
23
|
|
|
36
|
-
|
|
24
|
+
#trigger:focus {
|
|
37
25
|
outline: none;
|
|
38
26
|
}
|
|
39
27
|
|
|
@@ -75,14 +63,6 @@ const style = css`
|
|
|
75
63
|
}
|
|
76
64
|
}
|
|
77
65
|
|
|
78
|
-
input[role='combobox'] {
|
|
79
|
-
appearance: none;
|
|
80
|
-
background: transparent;
|
|
81
|
-
border: none;
|
|
82
|
-
font-size: inherit;
|
|
83
|
-
outline: none;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
66
|
[aria-expanded='true'] [slot='trail'] {
|
|
87
67
|
transform: scaleY(-1);
|
|
88
68
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "../../../chunks/chunk.QTSIPXV3.js";
|
|
2
|
+
const accountsFormats = {
|
|
3
|
+
"seb-account": (value) => {
|
|
4
|
+
const account = typeof value === "string" ? value.replace(" ", "") : value?.toString() ?? "";
|
|
5
|
+
if (account.length !== 11) {
|
|
6
|
+
return account;
|
|
7
|
+
}
|
|
8
|
+
return `${account.slice(0, 4)} ${account.slice(4, 6)} ${account.slice(6, 9)} ${account.slice(9, 11)}`;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
accountsFormats
|
|
13
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { GdsFormattedText } from '../formatted-text';
|
|
3
|
+
import { AccountFormats } from './account-formatter';
|
|
4
|
+
/**
|
|
5
|
+
* @element gds-formatted-account
|
|
6
|
+
* @status beta
|
|
7
|
+
*
|
|
8
|
+
* `gds-formatted-account` extends `gds-text` and formats the account to the desired format.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <gds-formatted-account
|
|
12
|
+
* account="54400023423">
|
|
13
|
+
* </gds-formatted-account>
|
|
14
|
+
*/
|
|
15
|
+
export declare class GdsFormattedAccount extends GdsFormattedText {
|
|
16
|
+
/**
|
|
17
|
+
* The account number or identifier to display.
|
|
18
|
+
* For format 'seb-account', it needs to be 11 characters.
|
|
19
|
+
* */
|
|
20
|
+
account?: number | string;
|
|
21
|
+
/**
|
|
22
|
+
* Specifies the account format.
|
|
23
|
+
* @default 'seb-account'
|
|
24
|
+
*/
|
|
25
|
+
protected format: AccountFormats;
|
|
26
|
+
get formattedValue(): string;
|
|
27
|
+
protected firstUpdated(_changedProperties: PropertyValues): void;
|
|
28
|
+
}
|