@sebgroup/green-core 1.88.5 → 1.88.6

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.
@@ -1,4 +1,5 @@
1
1
  import { GdsElement } from '../../gds-element';
2
+ import './form-request-submit-polyfill';
2
3
  export interface GdsValidator {
3
4
  /**
4
5
  * Validate the form control element. Should return the validity state and an optional validation message.
@@ -19,6 +20,7 @@ export declare abstract class GdsFormControlElement<ValueT = any> extends GdsEle
19
20
  #private;
20
21
  static formAssociated: boolean;
21
22
  constructor();
23
+ connectedCallback(): void;
22
24
  /**
23
25
  * A validator that can be used to validate the form control and set an error message.
24
26
  */
@@ -8,6 +8,7 @@ var _internals;
8
8
  import { property } from "lit/decorators.js";
9
9
  import { GdsElement } from "../../gds-element.js";
10
10
  import { watch } from "../../utils/decorators/index.js";
11
+ import "./form-request-submit-polyfill";
11
12
  class GdsFormControlElement extends GdsElement {
12
13
  constructor() {
13
14
  super();
@@ -23,7 +24,7 @@ class GdsFormControlElement extends GdsElement {
23
24
  __privateSet(this, _internals, {
24
25
  form: this.closest("form"),
25
26
  setFormValue: (value) => {
26
- this.value = value;
27
+ this._internalValue = value;
27
28
  },
28
29
  setValidity: (validity, validationMessage) => {
29
30
  ;
@@ -45,11 +46,21 @@ class GdsFormControlElement extends GdsElement {
45
46
  valid: true
46
47
  },
47
48
  willValidate: true,
48
- checkValidity: () => true,
49
- reportValidity: () => true
49
+ checkValidity: this.checkValidity.bind(this),
50
+ reportValidity: this.reportValidity.bind(this)
50
51
  });
51
52
  }
52
53
  }
54
+ connectedCallback() {
55
+ super.connectedCallback();
56
+ if (typeof this.attachInternals !== "function") {
57
+ const form = this.closest("form");
58
+ if (form) {
59
+ form.addEventListener("submit", this._handleFormSubmit.bind(this));
60
+ form.addEventListener("reset", this.formResetCallback.bind(this));
61
+ }
62
+ }
63
+ }
53
64
  set invalid(value) {
54
65
  const oldValue = this.invalid;
55
66
  __privateGet(this, _internals).setValidity(
@@ -0,0 +1,33 @@
1
+ ;
2
+ (function(prototype) {
3
+ if (typeof prototype.requestSubmit == "function")
4
+ return;
5
+ prototype.requestSubmit = function(submitter = null) {
6
+ if (submitter) {
7
+ validateSubmitter(submitter, this);
8
+ submitter.click();
9
+ } else {
10
+ submitter = document.createElement("input");
11
+ submitter.type = "submit";
12
+ submitter.hidden = true;
13
+ this.appendChild(submitter);
14
+ submitter.click();
15
+ this.removeChild(submitter);
16
+ }
17
+ };
18
+ function validateSubmitter(submitter, form) {
19
+ submitter instanceof HTMLElement || raise(TypeError, "parameter 1 is not of type 'HTMLElement'");
20
+ submitter.type == "submit" || raise(TypeError, "The specified element is not a submit button");
21
+ submitter.form == form || raise(
22
+ DOMException,
23
+ "The specified element is not owned by this form element",
24
+ "NotFoundError"
25
+ );
26
+ }
27
+ function raise(errorConstructor, message, name = "Error") {
28
+ throw new errorConstructor(
29
+ "Failed to execute 'requestSubmit' on 'HTMLFormElement': " + message + ".",
30
+ name
31
+ );
32
+ }
33
+ })(HTMLFormElement.prototype);
@@ -8,6 +8,7 @@ export declare const GdsCheckbox: (props: React.ComponentProps<ReturnType<typeof
8
8
  disabled?: boolean | undefined;
9
9
  value?: string | undefined;
10
10
  render?: (() => any) | undefined;
11
+ connectedCallback?: (() => void) | undefined;
11
12
  validator?: import("../../../components/form/form-control").GdsValidator | undefined;
12
13
  required?: boolean | undefined;
13
14
  errorMessage?: string | undefined;
@@ -22,7 +23,6 @@ export declare const GdsCheckbox: (props: React.ComponentProps<ReturnType<typeof
22
23
  gdsElementName?: string | undefined;
23
24
  _isUsingTransitionalStyles?: boolean | undefined;
24
25
  _dynamicStylesController?: import("../../../utils/controllers/dynamic-styles-controller").DynamicStylesController | undefined;
25
- connectedCallback?: (() => void) | undefined;
26
26
  disconnectedCallback?: (() => void) | undefined;
27
27
  dispatchStandardEvent?: ((name: string, options?: EventInit) => boolean) | undefined;
28
28
  dispatchCustomEvent?: (<T>(name: string, options?: CustomEventInit<T>) => boolean) | undefined;
@@ -8,6 +8,7 @@ export declare const GdsFilterChips: (props: React.ComponentProps<ReturnType<typ
8
8
  rowCollapse?: boolean | undefined;
9
9
  render?: (() => any) | undefined;
10
10
  focus?: ((options?: FocusOptions) => void) | undefined;
11
+ connectedCallback?: (() => void) | undefined;
11
12
  validator?: import("../../../components/form/form-control").GdsValidator | undefined;
12
13
  required?: boolean | undefined;
13
14
  errorMessage?: string | undefined;
@@ -23,7 +24,6 @@ export declare const GdsFilterChips: (props: React.ComponentProps<ReturnType<typ
23
24
  gdsElementName?: string | undefined;
24
25
  _isUsingTransitionalStyles?: boolean | undefined;
25
26
  _dynamicStylesController?: import("../../../utils/controllers/dynamic-styles-controller").DynamicStylesController | undefined;
26
- connectedCallback?: (() => void) | undefined;
27
27
  disconnectedCallback?: (() => void) | undefined;
28
28
  dispatchStandardEvent?: ((name: string, options?: EventInit) => boolean) | undefined;
29
29
  dispatchCustomEvent?: (<T>(name: string, options?: CustomEventInit<T>) => boolean) | undefined;
@@ -10,9 +10,9 @@ export * from './coachmark/index.js';
10
10
  export * from './container/index.js';
11
11
  export * from './context-menu/index.js';
12
12
  export * from './datepicker/index.js';
13
- export * from './details/index.js';
14
13
  export * from './dialog/index.js';
15
14
  export * from './div/index.js';
15
+ export * from './details/index.js';
16
16
  export * from './divider/index.js';
17
17
  export * from './dropdown/index.js';
18
18
  export * from './fab/index.js';
@@ -20,11 +20,11 @@ export * from './filter-chips/index.js';
20
20
  export * from './flex/index.js';
21
21
  export * from './form-summary/index.js';
22
22
  export * from './grid/index.js';
23
+ export * from './grouped-list/index.js';
24
+ export * from './list-item/index.js';
23
25
  export * from './icons/icon/index.js';
24
26
  export * from './img/index.js';
25
27
  export * from './input/index.js';
26
- export * from './grouped-list/index.js';
27
- export * from './list-item/index.js';
28
28
  export * from './link/index.js';
29
29
  export * from './mask/index.js';
30
30
  export * from './menu-button/index.js';
@@ -35,9 +35,9 @@ export * from './rich-text/index.js';
35
35
  export * from './segmented-control/index.js';
36
36
  export * from './select/index.js';
37
37
  export * from './signal/index.js';
38
+ export * from './spacer/index.js';
38
39
  export * from './spinner/index.js';
39
40
  export * from './text/index.js';
40
- export * from './spacer/index.js';
41
41
  export * from './textarea/index.js';
42
42
  export * from './theme/index.js';
43
43
  export * from './video/index.js';
@@ -54,8 +54,8 @@ export * from './formatted-number/index.js';
54
54
  export * from './radio-group/index.js';
55
55
  export * from './segment/index.js';
56
56
  export * from './sensitive-account/index.js';
57
- export * from './sensitive-date/index.js';
58
57
  export * from './sensitive-number/index.js';
58
+ export * from './sensitive-date/index.js';
59
59
  export * from './icons/icon-ai/index.js';
60
60
  export * from './icons/icon-airplane-up/index.js';
61
61
  export * from './icons/icon-archive/index.js';
@@ -10,9 +10,9 @@ export * from "./coachmark/index.js";
10
10
  export * from "./container/index.js";
11
11
  export * from "./context-menu/index.js";
12
12
  export * from "./datepicker/index.js";
13
- export * from "./details/index.js";
14
13
  export * from "./dialog/index.js";
15
14
  export * from "./div/index.js";
15
+ export * from "./details/index.js";
16
16
  export * from "./divider/index.js";
17
17
  export * from "./dropdown/index.js";
18
18
  export * from "./fab/index.js";
@@ -20,11 +20,11 @@ export * from "./filter-chips/index.js";
20
20
  export * from "./flex/index.js";
21
21
  export * from "./form-summary/index.js";
22
22
  export * from "./grid/index.js";
23
+ export * from "./grouped-list/index.js";
24
+ export * from "./list-item/index.js";
23
25
  export * from "./icons/icon/index.js";
24
26
  export * from "./img/index.js";
25
27
  export * from "./input/index.js";
26
- export * from "./grouped-list/index.js";
27
- export * from "./list-item/index.js";
28
28
  export * from "./link/index.js";
29
29
  export * from "./mask/index.js";
30
30
  export * from "./menu-button/index.js";
@@ -35,9 +35,9 @@ export * from "./rich-text/index.js";
35
35
  export * from "./segmented-control/index.js";
36
36
  export * from "./select/index.js";
37
37
  export * from "./signal/index.js";
38
+ export * from "./spacer/index.js";
38
39
  export * from "./spinner/index.js";
39
40
  export * from "./text/index.js";
40
- export * from "./spacer/index.js";
41
41
  export * from "./textarea/index.js";
42
42
  export * from "./theme/index.js";
43
43
  export * from "./video/index.js";
@@ -54,8 +54,8 @@ export * from "./formatted-number/index.js";
54
54
  export * from "./radio-group/index.js";
55
55
  export * from "./segment/index.js";
56
56
  export * from "./sensitive-account/index.js";
57
- export * from "./sensitive-date/index.js";
58
57
  export * from "./sensitive-number/index.js";
58
+ export * from "./sensitive-date/index.js";
59
59
  export * from "./icons/icon-ai/index.js";
60
60
  export * from "./icons/icon-airplane-up/index.js";
61
61
  export * from "./icons/icon-archive/index.js";
@@ -39,6 +39,7 @@ export declare const GdsInput: (props: React.ComponentProps<ReturnType<typeof ge
39
39
  focus?: ((options?: FocusOptions) => void) | undefined;
40
40
  render?: (() => any) | undefined;
41
41
  _getValidityAnchor?: (() => HTMLInputElement) | undefined;
42
+ connectedCallback?: (() => void) | undefined;
42
43
  validator?: import("../../../components/form/form-control").GdsValidator | undefined;
43
44
  required?: boolean | undefined;
44
45
  errorMessage?: string | undefined;
@@ -56,7 +57,6 @@ export declare const GdsInput: (props: React.ComponentProps<ReturnType<typeof ge
56
57
  gdsElementName?: string | undefined;
57
58
  _isUsingTransitionalStyles?: boolean | undefined;
58
59
  _dynamicStylesController?: import("../../../utils/controllers/dynamic-styles-controller").DynamicStylesController | undefined;
59
- connectedCallback?: (() => void) | undefined;
60
60
  disconnectedCallback?: (() => void) | undefined;
61
61
  dispatchStandardEvent?: ((name: string, options?: EventInit) => boolean) | undefined;
62
62
  dispatchCustomEvent?: (<T>(name: string, options?: CustomEventInit<T>) => boolean) | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sebgroup/green-core",
3
3
  "description": "A carefully crafted set of Web Components, laying the foundation of the Green Design System.",
4
- "version": "1.88.5",
4
+ "version": "1.88.6",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
7
7
  "type": "module",
@@ -93,6 +93,7 @@
93
93
  "./components/form-summary/index.js",
94
94
  "./components/form-summary/summary.js",
95
95
  "./components/form/form-control.js",
96
+ "./components/form/form-request-submit-polyfill.js",
96
97
  "./components/form/index.js",
97
98
  "./components/formatted-text/account/account-formatter.js",
98
99
  "./components/formatted-text/account/formatted-account.js",
@@ -9,23 +9,21 @@ const styles = css`
9
9
  align-items: center;
10
10
  line-height: var(--gds-sys-text-line-height-detail-m);
11
11
  color: var(--gds-sys-color-l2-content-primary);
12
+ }
12
13
 
13
- & > div {
14
- display: flex;
15
- flex-direction: column;
16
- }
14
+ #label-row > div {
15
+ display: flex;
16
+ flex-direction: column;
17
17
  }
18
18
 
19
19
  ::slotted(label) {
20
20
  font-weight: var(--gds-sys-text-weight-book);
21
21
  }
22
22
 
23
- :host(.size-small) {
24
- & slot[name='supporting-text'],
25
- & ::slotted(label) {
26
- font-size: var(--gds-sys-text-size-detail-s);
27
- line-height: var(--gds-sys-text-line-height-detail-s);
28
- }
23
+ :host(.size-small) slot[name='supporting-text'],
24
+ :host(.size-small) ::slotted(label) {
25
+ font-size: var(--gds-sys-text-size-detail-s);
26
+ line-height: var(--gds-sys-text-line-height-detail-s);
29
27
  }
30
28
 
31
29
  #extended-supporting-text {
@@ -39,20 +37,20 @@ const styles = css`
39
37
  background-color: var(--gds-sys-color-l3-background-secondary);
40
38
  color: var(--gds-sys-color-l3-content-tertiary);
41
39
  max-height: var(--_max-height);
40
+ }
42
41
 
43
- &[aria-hidden='false'] {
44
- margin: var(--gds-sys-space-2xs) 0 0 0;
45
- padding: var(--gds-sys-space-s) var(--gds-sys-space-m);
46
- }
42
+ #extended-supporting-text[aria-hidden='false'] {
43
+ margin: var(--gds-sys-space-2xs) 0 0 0;
44
+ padding: var(--gds-sys-space-s) var(--gds-sys-space-m);
45
+ }
47
46
 
48
- &[aria-hidden='true'] {
49
- max-height: 0;
50
- opacity: 0;
51
- translate: 0 2px;
52
- padding: 0 var(--gds-sys-space-m);
53
- margin: 0;
54
- overflow: hidden;
55
- }
47
+ #extended-supporting-text[aria-hidden='true'] {
48
+ max-height: 0;
49
+ opacity: 0;
50
+ translate: 0 2px;
51
+ padding: 0 var(--gds-sys-space-m);
52
+ margin: 0;
53
+ overflow: hidden;
56
54
  }
57
55
  }
58
56
  `;
@@ -1,6 +1,6 @@
1
1
  import "../../chunks/chunk.QTSIPXV3.js";
2
2
  import { html as litHtml } from "lit";
3
- const VER_SUFFIX = "-a65924";
3
+ const VER_SUFFIX = "-5a46e8";
4
4
  class ScopedElementRegistry {
5
5
  static get instance() {
6
6
  if (!globalThis.__gdsElementLookupTable?.[VER_SUFFIX])