@govtechsg/sgds-web-component 3.21.1 → 3.21.2-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/components/Button/index.umd.min.js +5 -3
  2. package/components/Button/index.umd.min.js.map +1 -1
  3. package/components/Button/sgds-button.d.ts +4 -0
  4. package/components/Button/sgds-button.js +8 -0
  5. package/components/Button/sgds-button.js.map +1 -1
  6. package/components/Datepicker/index.umd.min.js +14 -12
  7. package/components/Datepicker/index.umd.min.js.map +1 -1
  8. package/components/FileUpload/index.umd.min.js +4 -2
  9. package/components/FileUpload/index.umd.min.js.map +1 -1
  10. package/components/Pagination/index.umd.min.js +4 -2
  11. package/components/Pagination/index.umd.min.js.map +1 -1
  12. package/components/Tab/index.umd.min.js +1 -1
  13. package/components/Tab/index.umd.min.js.map +1 -1
  14. package/components/Tab/sgds-tab-panel.js +1 -0
  15. package/components/Tab/sgds-tab-panel.js.map +1 -1
  16. package/components/index.umd.min.js +5 -3
  17. package/components/index.umd.min.js.map +1 -1
  18. package/css/fouc.css +1 -1
  19. package/custom-elements.json +643 -607
  20. package/index.umd.min.js +5 -3
  21. package/index.umd.min.js.map +1 -1
  22. package/package.json +1 -1
  23. package/react/components/Button/sgds-button.cjs.js +8 -0
  24. package/react/components/Button/sgds-button.cjs.js.map +1 -1
  25. package/react/components/Button/sgds-button.js +8 -0
  26. package/react/components/Button/sgds-button.js.map +1 -1
  27. package/react/components/Tab/sgds-tab-panel.cjs.js +1 -0
  28. package/react/components/Tab/sgds-tab-panel.cjs.js.map +1 -1
  29. package/react/components/Tab/sgds-tab-panel.js +1 -0
  30. package/react/components/Tab/sgds-tab-panel.js.map +1 -1
  31. package/react/index.cjs.js +6 -6
  32. package/react/index.d.ts +1 -1
  33. package/react/index.js +1 -1
  34. package/react/utils/formSubmitController.cjs.js +5 -0
  35. package/react/utils/formSubmitController.cjs.js.map +1 -1
  36. package/react/utils/formSubmitController.js +5 -0
  37. package/react/utils/formSubmitController.js.map +1 -1
  38. package/types/react.d.ts +92 -88
  39. package/utils/formSubmitController.js +5 -0
  40. package/utils/formSubmitController.js.map +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@govtechsg/sgds-web-component",
3
- "version": "3.21.1",
3
+ "version": "3.21.2-rc.1",
4
4
  "description": "",
5
5
  "main": "./index.umd.js",
6
6
  "module": "./index.js",
@@ -92,6 +92,8 @@ class SgdsButton extends buttonElement["default"] {
92
92
  })}"
93
93
  ?disabled=${ifDefined_js.ifDefined(isLink ? undefined : this.disabled)}
94
94
  type=${ifDefined_js.ifDefined(isLink ? undefined : this.type)}
95
+ name=${ifDefined_js.ifDefined(isLink ? undefined : this.name)}
96
+ value=${ifDefined_js.ifDefined(isLink ? undefined : this.value)}
95
97
  href=${ifDefined_js.ifDefined(isLink ? this.href : undefined)}
96
98
  target=${ifDefined_js.ifDefined(isLink ? this.target : undefined)}
97
99
  download=${ifDefined_js.ifDefined(isLink ? this.download : undefined)}
@@ -119,6 +121,12 @@ class SgdsButton extends buttonElement["default"] {
119
121
  }
120
122
  }
121
123
  SgdsButton.styles = [...buttonElement["default"].styles, anchor["default"], button["default"]];
124
+ tslib.__decorate([
125
+ decorators_js.property({ type: String, reflect: true })
126
+ ], SgdsButton.prototype, "name", void 0);
127
+ tslib.__decorate([
128
+ decorators_js.property({ type: String, reflect: true })
129
+ ], SgdsButton.prototype, "value", void 0);
122
130
  tslib.__decorate([
123
131
  decorators_js.property({ type: String, reflect: true })
124
132
  ], SgdsButton.prototype, "type", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-button.cjs.js","sources":["../../../../src/components/Button/sgds-button.ts"],"sourcesContent":["import { property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { html, literal } from \"lit/static-html.js\";\nimport ButtonElement from \"../../base/button-element\";\nimport { HasSlotController } from \"../../utils/slot\";\nimport { FormSubmitController } from \"../../utils/formSubmitController\";\nimport anchorStyles from \"../../styles/anchor.css\";\nimport buttonStyles from \"./button.css\";\n\nexport type ButtonVariant = \"primary\" | \"outline\" | \"ghost\" | \"danger\";\n\n/**\n * @summary Custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.\n *\n * @slot default - The button's label.\n * @slot leftIcon - The slot for icon to the left of the button text\n * @slot rightIcon - The slot for icon to the right of the button text\n *\n * @event sgds-blur - Emitted when the button is blurred.\n * @event sgds-focus - Emitted when the button is focused.\n *\n *\n */\nexport class SgdsButton extends ButtonElement {\n static styles = [...ButtonElement.styles, anchorStyles, buttonStyles];\n\n /** @internal */\n private readonly formSubmitController = new FormSubmitController(this, {\n form: (input: HTMLInputElement) => {\n // Buttons support a form attribute that points to an arbitrary form, so if this attribute it set we need to query\n // the form from the same root using its id\n if (input.hasAttribute(\"form\")) {\n const doc = input.getRootNode() as Document | ShadowRoot;\n const formId = input.getAttribute(\"form\");\n return doc.getElementById(formId) as HTMLFormElement;\n }\n\n // Fall back to the closest containing form\n return input.closest(\"form\");\n }\n });\n /** The behavior of the button with default as `type='button', `reset` resets all the controls to their initial values and `submit` submits the form data to the server */\n @property({ type: String, reflect: true }) type: \"button\" | \"submit\" | \"reset\" = \"button\";\n /**\n * The \"form owner\" to associate the button with. If omitted, the closest containing form will be used instead. The\n * value of this attribute must be an id of a form in the same document or shadow root as the button.\n */\n @property({ type: String, reflect: true }) form: string;\n\n /** Used to override the form owner's `action` attribute. */\n @property({ type: String, reflect: true, attribute: \"formaction\" }) formAction: string;\n\n /** Used to override the form owner's `method` attribute. */\n @property({ type: String, reflect: true, attribute: \"formmethod\" }) formMethod: \"post\" | \"get\";\n\n /** Used to override the form owner's `novalidate` attribute. */\n @property({ attribute: \"formnovalidate\", type: Boolean, reflect: true })\n formNoValidate: boolean;\n\n /** Used to override the form owner's `target` attribute. */\n @property({ type: String, reflect: true, attribute: \"formtarget\" }) formTarget:\n | \"_self\"\n | \"_blank\"\n | \"_parent\"\n | \"_top\"\n | string;\n\n /** When set, the button will be in full width. */\n @property({ type: Boolean, reflect: true }) fullWidth = false;\n\n /** Used only for SSR to indicate the presence of the `leftIcon` slot. */\n @property({ type: Boolean }) hasLeftIconSlot = false;\n\n /** Used only for SSR to indicate the presence of the `rightIcon` slot. */\n @property({ type: Boolean }) hasRightIconSlot = false;\n\n private readonly hasSlotController = new HasSlotController(this, \"leftIcon\", \"rightIcon\");\n\n updated() {\n if (!this.hasLeftIconSlot) this.hasLeftIconSlot = this.hasSlotController.test(\"leftIcon\");\n if (!this.hasRightIconSlot) this.hasRightIconSlot = this.hasSlotController.test(\"rightIcon\");\n }\n\n protected override _handleClick(event: MouseEvent) {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n this.removeEventListener(\"click\", this._clickHandler);\n this.addEventListener(\"click\", this._clickHandler);\n }\n\n private _clickHandler = () => {\n if (this.type === \"submit\") {\n this.formSubmitController.submit(this);\n }\n if (this.type === \"reset\") {\n this.formSubmitController.reset(this);\n }\n };\n\n render() {\n const isLink = this.href;\n const tag = isLink ? literal`a` : literal`button`;\n const noIcon = !this.hasLeftIconSlot && !this.hasRightIconSlot;\n\n return html`\n <${tag}\n class=\"btn ${classMap({\n disabled: this.disabled,\n active: this.active,\n \"has-left-icon\": this.hasLeftIconSlot,\n \"has-right-icon\": this.hasRightIconSlot,\n \"no-icon\": noIcon,\n loading: this.loading\n })}\"\n ?disabled=${ifDefined(isLink ? undefined : this.disabled)}\n type=${ifDefined(isLink ? undefined : this.type)}\n href=${ifDefined(isLink ? this.href : undefined)}\n target=${ifDefined(isLink ? this.target : undefined)}\n download=${ifDefined(isLink ? this.download : undefined)}\n rel=${ifDefined(isLink && this.target === \"_blank\" ? \"noreferrer noopener\" : undefined)}\n role=${ifDefined(isLink ? \"button\" : undefined)}\n aria-disabled=${this.disabled || this.loading ? \"true\" : \"false\"}\n tabindex=${this.disabled ? \"-1\" : \"0\"}\n @click=${this._handleClick}\n @keydown=${this._handleKeydown}\n @focus=${this._handleFocus}\n @blur=${this._handleBlur}\n aria-label=${ifDefined(this.loading ? \"Loading\" : this.ariaLabel)}\n >\n ${\n this.loading\n ? html`<sgds-spinner\n size=${ifDefined(this._assignSpinnerSize(this.size))}\n tone=${ifDefined(this._assignSpinnerTone(this.tone, this.variant))}\n ></sgds-spinner>`\n : html`<slot name=\"leftIcon\"></slot>\n <span><slot></slot></span>\n <slot name=\"rightIcon\"></slot>`\n }\n \n </${tag}>\n `;\n }\n}\n\nexport default SgdsButton;\n"],"names":["ButtonElement","FormSubmitController","HasSlotController","literal","html","classMap","ifDefined","anchorStyles","buttonStyles","__decorate","property"],"mappings":";;;;;;;;;;;;;;;;AAYA;;;;;;;;;;;AAWG;AACG,MAAO,UAAW,SAAQA,wBAAa,CAAA;AAA7C,IAAA,WAAA,GAAA;;;AAImB,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAIC,yCAAoB,CAAC,IAAI,EAAE;AACrE,YAAA,IAAI,EAAE,CAAC,KAAuB,KAAI;;;AAGhC,gBAAA,IAAI,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;AAC9B,oBAAA,MAAM,GAAG,GAAG,KAAK,CAAC,WAAW,EAA2B,CAAC;oBACzD,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;AAC1C,oBAAA,OAAO,GAAG,CAAC,cAAc,CAAC,MAAM,CAAoB,CAAC;iBACtD;;AAGD,gBAAA,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aAC9B;AACF,SAAA,CAAC,CAAC;;QAEwC,IAAI,CAAA,IAAA,GAAkC,QAAQ,CAAC;;QA0B9C,IAAS,CAAA,SAAA,GAAG,KAAK,CAAC;;QAGjC,IAAe,CAAA,eAAA,GAAG,KAAK,CAAC;;QAGxB,IAAgB,CAAA,gBAAA,GAAG,KAAK,CAAC;QAErC,IAAiB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components/Button/sgds-button.ts"],"sourcesContent":["import { property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { html, literal } from \"lit/static-html.js\";\nimport ButtonElement from \"../../base/button-element\";\nimport { HasSlotController } from \"../../utils/slot\";\nimport { FormSubmitController } from \"../../utils/formSubmitController\";\nimport anchorStyles from \"../../styles/anchor.css\";\nimport buttonStyles from \"./button.css\";\n\nexport type ButtonVariant = \"primary\" | \"outline\" | \"ghost\" | \"danger\";\n\n/**\n * @summary Custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.\n *\n * @slot default - The button's label.\n * @slot leftIcon - The slot for icon to the left of the button text\n * @slot rightIcon - The slot for icon to the right of the button text\n *\n * @event sgds-blur - Emitted when the button is blurred.\n * @event sgds-focus - Emitted when the button is focused.\n *\n *\n */\nexport class SgdsButton extends ButtonElement {\n static styles = [...ButtonElement.styles, anchorStyles, buttonStyles];\n\n /** @internal */\n private readonly formSubmitController = new FormSubmitController(this, {\n form: (input: HTMLInputElement) => {\n // Buttons support a form attribute that points to an arbitrary form, so if this attribute it set we need to query\n // the form from the same root using its id\n if (input.hasAttribute(\"form\")) {\n const doc = input.getRootNode() as Document | ShadowRoot;\n const formId = input.getAttribute(\"form\");\n return doc.getElementById(formId) as HTMLFormElement;\n }\n\n // Fall back to the closest containing form\n return input.closest(\"form\");\n }\n });\n /** The name of the button, submitted as a name/value pair with form data only when this button is the submitter. Only works with `type=\"submit\"`. Has no effect when the button is rendered as a link (i.e. when `href` is set). */\n @property({ type: String, reflect: true }) name: string;\n\n /** The value of the button, submitted as a name/value pair with form data only when this button is the submitter. Only works with `type=\"submit\"`. Has no effect when the button is rendered as a link (i.e. when `href` is set). */\n @property({ type: String, reflect: true }) value: string;\n\n /** The behavior of the button with default as `type='button', `reset` resets all the controls to their initial values and `submit` submits the form data to the server */\n @property({ type: String, reflect: true }) type: \"button\" | \"submit\" | \"reset\" = \"button\";\n /**\n * The \"form owner\" to associate the button with. If omitted, the closest containing form will be used instead. The\n * value of this attribute must be an id of a form in the same document or shadow root as the button.\n */\n @property({ type: String, reflect: true }) form: string;\n\n /** Used to override the form owner's `action` attribute. */\n @property({ type: String, reflect: true, attribute: \"formaction\" }) formAction: string;\n\n /** Used to override the form owner's `method` attribute. */\n @property({ type: String, reflect: true, attribute: \"formmethod\" }) formMethod: \"post\" | \"get\";\n\n /** Used to override the form owner's `novalidate` attribute. */\n @property({ attribute: \"formnovalidate\", type: Boolean, reflect: true })\n formNoValidate: boolean;\n\n /** Used to override the form owner's `target` attribute. */\n @property({ type: String, reflect: true, attribute: \"formtarget\" }) formTarget:\n | \"_self\"\n | \"_blank\"\n | \"_parent\"\n | \"_top\"\n | string;\n\n /** When set, the button will be in full width. */\n @property({ type: Boolean, reflect: true }) fullWidth = false;\n\n /** Used only for SSR to indicate the presence of the `leftIcon` slot. */\n @property({ type: Boolean }) hasLeftIconSlot = false;\n\n /** Used only for SSR to indicate the presence of the `rightIcon` slot. */\n @property({ type: Boolean }) hasRightIconSlot = false;\n\n private readonly hasSlotController = new HasSlotController(this, \"leftIcon\", \"rightIcon\");\n\n updated() {\n if (!this.hasLeftIconSlot) this.hasLeftIconSlot = this.hasSlotController.test(\"leftIcon\");\n if (!this.hasRightIconSlot) this.hasRightIconSlot = this.hasSlotController.test(\"rightIcon\");\n }\n\n protected override _handleClick(event: MouseEvent) {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n this.removeEventListener(\"click\", this._clickHandler);\n this.addEventListener(\"click\", this._clickHandler);\n }\n\n private _clickHandler = () => {\n if (this.type === \"submit\") {\n this.formSubmitController.submit(this);\n }\n if (this.type === \"reset\") {\n this.formSubmitController.reset(this);\n }\n };\n\n render() {\n const isLink = this.href;\n const tag = isLink ? literal`a` : literal`button`;\n const noIcon = !this.hasLeftIconSlot && !this.hasRightIconSlot;\n\n return html`\n <${tag}\n class=\"btn ${classMap({\n disabled: this.disabled,\n active: this.active,\n \"has-left-icon\": this.hasLeftIconSlot,\n \"has-right-icon\": this.hasRightIconSlot,\n \"no-icon\": noIcon,\n loading: this.loading\n })}\"\n ?disabled=${ifDefined(isLink ? undefined : this.disabled)}\n type=${ifDefined(isLink ? undefined : this.type)}\n name=${ifDefined(isLink ? undefined : this.name)}\n value=${ifDefined(isLink ? undefined : this.value)}\n href=${ifDefined(isLink ? this.href : undefined)}\n target=${ifDefined(isLink ? this.target : undefined)}\n download=${ifDefined(isLink ? this.download : undefined)}\n rel=${ifDefined(isLink && this.target === \"_blank\" ? \"noreferrer noopener\" : undefined)}\n role=${ifDefined(isLink ? \"button\" : undefined)}\n aria-disabled=${this.disabled || this.loading ? \"true\" : \"false\"}\n tabindex=${this.disabled ? \"-1\" : \"0\"}\n @click=${this._handleClick}\n @keydown=${this._handleKeydown}\n @focus=${this._handleFocus}\n @blur=${this._handleBlur}\n aria-label=${ifDefined(this.loading ? \"Loading\" : this.ariaLabel)}\n >\n ${\n this.loading\n ? html`<sgds-spinner\n size=${ifDefined(this._assignSpinnerSize(this.size))}\n tone=${ifDefined(this._assignSpinnerTone(this.tone, this.variant))}\n ></sgds-spinner>`\n : html`<slot name=\"leftIcon\"></slot>\n <span><slot></slot></span>\n <slot name=\"rightIcon\"></slot>`\n }\n \n </${tag}>\n `;\n }\n}\n\nexport default SgdsButton;\n"],"names":["ButtonElement","FormSubmitController","HasSlotController","literal","html","classMap","ifDefined","anchorStyles","buttonStyles","__decorate","property"],"mappings":";;;;;;;;;;;;;;;;AAYA;;;;;;;;;;;AAWG;AACG,MAAO,UAAW,SAAQA,wBAAa,CAAA;AAA7C,IAAA,WAAA,GAAA;;;AAImB,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAIC,yCAAoB,CAAC,IAAI,EAAE;AACrE,YAAA,IAAI,EAAE,CAAC,KAAuB,KAAI;;;AAGhC,gBAAA,IAAI,KAAK,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;AAC9B,oBA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A,KAAA,CAAA,CAAA,CAAA;AAI/FD,gBAAA,CAAA;AADC,IAAAC,sBAAQ,CAAC,EAAE,SAAS,EAAE,gBAAgB,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAChD,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAG4CD,gBAAA,CAAA;AAAnE,IAAAC,sBAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;AAKxD,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,YAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGiCD,gBAAA,CAAA;IAA3CC,sBAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAAmB,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGjCD,gBAAA,CAAA;AAA5B,IAAAC,sBAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAAyB,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGxBD,gBAAA,CAAA;AAA5B,IAAAC,sBAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAA0B,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,kBAAA,EAAA,KAAA,CAAA,CAAA;;;;;"}
@@ -88,6 +88,8 @@ class SgdsButton extends ButtonElement {
88
88
  })}"
89
89
  ?disabled=${ifDefined(isLink ? undefined : this.disabled)}
90
90
  type=${ifDefined(isLink ? undefined : this.type)}
91
+ name=${ifDefined(isLink ? undefined : this.name)}
92
+ value=${ifDefined(isLink ? undefined : this.value)}
91
93
  href=${ifDefined(isLink ? this.href : undefined)}
92
94
  target=${ifDefined(isLink ? this.target : undefined)}
93
95
  download=${ifDefined(isLink ? this.download : undefined)}
@@ -115,6 +117,12 @@ class SgdsButton extends ButtonElement {
115
117
  }
116
118
  }
117
119
  SgdsButton.styles = [...ButtonElement.styles, css_248z, css_248z$1];
120
+ __decorate([
121
+ property({ type: String, reflect: true })
122
+ ], SgdsButton.prototype, "name", void 0);
123
+ __decorate([
124
+ property({ type: String, reflect: true })
125
+ ], SgdsButton.prototype, "value", void 0);
118
126
  __decorate([
119
127
  property({ type: String, reflect: true })
120
128
  ], SgdsButton.prototype, "type", void 0);
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-button.js","sources":["../../../../src/components/Button/sgds-button.ts"],"sourcesContent":["import { property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { html, literal } from \"lit/static-html.js\";\nimport ButtonElement from \"../../base/button-element\";\nimport { HasSlotController } from \"../../utils/slot\";\nimport { FormSubmitController } from \"../../utils/formSubmitController\";\nimport anchorStyles from \"../../styles/anchor.css\";\nimport buttonStyles from \"./button.css\";\n\nexport type ButtonVariant = \"primary\" | \"outline\" | \"ghost\" | \"danger\";\n\n/**\n * @summary Custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.\n *\n * @slot default - The button's label.\n * @slot leftIcon - The slot for icon to the left of the button text\n * @slot rightIcon - The slot for icon to the right of the button text\n *\n * @event sgds-blur - Emitted when the button is blurred.\n * @event sgds-focus - Emitted when the button is focused.\n *\n *\n */\nexport class SgdsButton extends ButtonElement {\n static styles = [...ButtonElement.styles, anchorStyles, buttonStyles];\n\n /** @internal */\n private readonly formSubmitController = new FormSubmitController(this, {\n form: (input: HTMLInputElement) => {\n // Buttons support a form attribute that points to an arbitrary form, so if this attribute it set we need to query\n // the form from the same root using its id\n if (input.hasAttribute(\"form\")) {\n const doc = input.getRootNode() as Document | ShadowRoot;\n const formId = input.getAttribute(\"form\");\n return doc.getElementById(formId) as HTMLFormElement;\n }\n\n // Fall back to the closest containing form\n return input.closest(\"form\");\n }\n });\n /** The behavior of the button with default as `type='button', `reset` resets all the controls to their initial values and `submit` submits the form data to the server */\n @property({ type: String, reflect: true }) type: \"button\" | \"submit\" | \"reset\" = \"button\";\n /**\n * The \"form owner\" to associate the button with. If omitted, the closest containing form will be used instead. The\n * value of this attribute must be an id of a form in the same document or shadow root as the button.\n */\n @property({ type: String, reflect: true }) form: string;\n\n /** Used to override the form owner's `action` attribute. */\n @property({ type: String, reflect: true, attribute: \"formaction\" }) formAction: string;\n\n /** Used to override the form owner's `method` attribute. */\n @property({ type: String, reflect: true, attribute: \"formmethod\" }) formMethod: \"post\" | \"get\";\n\n /** Used to override the form owner's `novalidate` attribute. */\n @property({ attribute: \"formnovalidate\", type: Boolean, reflect: true })\n formNoValidate: boolean;\n\n /** Used to override the form owner's `target` attribute. */\n @property({ type: String, reflect: true, attribute: \"formtarget\" }) formTarget:\n | \"_self\"\n | \"_blank\"\n | \"_parent\"\n | \"_top\"\n | string;\n\n /** When set, the button will be in full width. */\n @property({ type: Boolean, reflect: true }) fullWidth = false;\n\n /** Used only for SSR to indicate the presence of the `leftIcon` slot. */\n @property({ type: Boolean }) hasLeftIconSlot = false;\n\n /** Used only for SSR to indicate the presence of the `rightIcon` slot. */\n @property({ type: Boolean }) hasRightIconSlot = false;\n\n private readonly hasSlotController = new HasSlotController(this, \"leftIcon\", \"rightIcon\");\n\n updated() {\n if (!this.hasLeftIconSlot) this.hasLeftIconSlot = this.hasSlotController.test(\"leftIcon\");\n if (!this.hasRightIconSlot) this.hasRightIconSlot = this.hasSlotController.test(\"rightIcon\");\n }\n\n protected override _handleClick(event: MouseEvent) {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n this.removeEventListener(\"click\", this._clickHandler);\n this.addEventListener(\"click\", this._clickHandler);\n }\n\n private _clickHandler = () => {\n if (this.type === \"submit\") {\n this.formSubmitController.submit(this);\n }\n if (this.type === \"reset\") {\n this.formSubmitController.reset(this);\n }\n };\n\n render() {\n const isLink = this.href;\n const tag = isLink ? literal`a` : literal`button`;\n const noIcon = !this.hasLeftIconSlot && !this.hasRightIconSlot;\n\n return html`\n <${tag}\n class=\"btn ${classMap({\n disabled: this.disabled,\n active: this.active,\n \"has-left-icon\": this.hasLeftIconSlot,\n \"has-right-icon\": this.hasRightIconSlot,\n \"no-icon\": noIcon,\n loading: this.loading\n })}\"\n ?disabled=${ifDefined(isLink ? undefined : this.disabled)}\n type=${ifDefined(isLink ? undefined : this.type)}\n href=${ifDefined(isLink ? this.href : undefined)}\n target=${ifDefined(isLink ? this.target : undefined)}\n download=${ifDefined(isLink ? this.download : undefined)}\n rel=${ifDefined(isLink && this.target === \"_blank\" ? \"noreferrer noopener\" : undefined)}\n role=${ifDefined(isLink ? \"button\" : undefined)}\n aria-disabled=${this.disabled || this.loading ? \"true\" : \"false\"}\n tabindex=${this.disabled ? \"-1\" : \"0\"}\n @click=${this._handleClick}\n @keydown=${this._handleKeydown}\n @focus=${this._handleFocus}\n @blur=${this._handleBlur}\n aria-label=${ifDefined(this.loading ? \"Loading\" : this.ariaLabel)}\n >\n ${\n this.loading\n ? html`<sgds-spinner\n size=${ifDefined(this._assignSpinnerSize(this.size))}\n tone=${ifDefined(this._assignSpinnerTone(this.tone, this.variant))}\n ></sgds-spinner>`\n : html`<slot name=\"leftIcon\"></slot>\n <span><slot></slot></span>\n <slot name=\"rightIcon\"></slot>`\n }\n \n </${tag}>\n `;\n }\n}\n\nexport default SgdsButton;\n"],"names":["anchorStyles","buttonStyles"],"mappings":";;;;;;;;;;;;AAYA;;;;;;;;;;;AAWG;AACG,MAAO,UAAW,SAAQ,aAAa,CAAA;AAA7C,IAAA,WAAA,GAAA;;;AAImB,QAAA,IAAA,CAAA,oBAAoB,GAAG,IAAI,oBAAoB,CAAC,IAAI,EAAE;AACrE,YAAA,IAAI,EAAE,CAAC,KAAuB,KAAI;;;AAGhC,gBAAA,IAAI,KAAK,CAAC,YAAY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A,CAAA,SAAA,EAAA,WAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGjC,UAAA,CAAA;AAA5B,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAAyB,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,KAAA,CAAA,CAAA,CAAA;AAGxB,UAAA,CAAA;AAA5B,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAA0B,CAAA,EAAA,UAAA,CAAA,SAAA,EAAA,kBAAA,EAAA,KAAA,CAAA,CAAA;;;;"}
1
+ {"version":3,"file":"sgds-button.js","sources":["../../../../src/components/Button/sgds-button.ts"],"sourcesContent":["import { property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport { ifDefined } from \"lit/directives/if-defined.js\";\nimport { html, literal } from \"lit/static-html.js\";\nimport ButtonElement from \"../../base/button-element\";\nimport { HasSlotController } from \"../../utils/slot\";\nimport { FormSubmitController } from \"../../utils/formSubmitController\";\nimport anchorStyles from \"../../styles/anchor.css\";\nimport buttonStyles from \"./button.css\";\n\nexport type ButtonVariant = \"primary\" | \"outline\" | \"ghost\" | \"danger\";\n\n/**\n * @summary Custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.\n *\n * @slot default - The button's label.\n * @slot leftIcon - The slot for icon to the left of the button text\n * @slot rightIcon - The slot for icon to the right of the button text\n *\n * @event sgds-blur - Emitted when the button is blurred.\n * @event sgds-focus - Emitted when the button is focused.\n *\n *\n */\nexport class SgdsButton extends ButtonElement {\n static styles = [...ButtonElement.styles, anchorStyles, buttonStyles];\n\n /** @internal */\n private readonly formSubmitController = new FormSubmitController(this, {\n form: (input: HTMLInputElement) => {\n // Buttons support a form attribute that points to an arbitrary form, so if this attribute it set we need to query\n // the form from the same root using its id\n if (input.hasAttribute(\"form\")) {\n const doc = input.getRootNode() as Document | ShadowRoot;\n const formId = input.getAttribute(\"form\");\n return doc.getElementById(formId) as HTMLFormElement;\n }\n\n // Fall back to the closest containing form\n return input.closest(\"form\");\n }\n });\n /** The name of the button, submitted as a name/value pair with form data only when this button is the submitter. Only works with `type=\"submit\"`. Has no effect when the button is rendered as a link (i.e. when `href` is set). */\n @property({ type: String, reflect: true }) name: string;\n\n /** The value of the button, submitted as a name/value pair with form data only when this button is the submitter. Only works with `type=\"submit\"`. Has no effect when the button is rendered as a link (i.e. when `href` is set). */\n @property({ type: String, reflect: true }) value: string;\n\n /** The behavior of the button with default as `type='button', `reset` resets all the controls to their initial values and `submit` submits the form data to the server */\n @property({ type: String, reflect: true }) type: \"button\" | \"submit\" | \"reset\" = \"button\";\n /**\n * The \"form owner\" to associate the button with. If omitted, the closest containing form will be used instead. The\n * value of this attribute must be an id of a form in the same document or shadow root as the button.\n */\n @property({ type: String, reflect: true }) form: string;\n\n /** Used to override the form owner's `action` attribute. */\n @property({ type: String, reflect: true, attribute: \"formaction\" }) formAction: string;\n\n /** Used to override the form owner's `method` attribute. */\n @property({ type: String, reflect: true, attribute: \"formmethod\" }) formMethod: \"post\" | \"get\";\n\n /** Used to override the form owner's `novalidate` attribute. */\n @property({ attribute: \"formnovalidate\", type: Boolean, reflect: true })\n formNoValidate: boolean;\n\n /** Used to override the form owner's `target` attribute. */\n @property({ type: String, reflect: true, attribute: \"formtarget\" }) formTarget:\n | \"_self\"\n | \"_blank\"\n | \"_parent\"\n | \"_top\"\n | string;\n\n /** When set, the button will be in full width. */\n @property({ type: Boolean, reflect: true }) fullWidth = false;\n\n /** Used only for SSR to indicate the presence of the `leftIcon` slot. */\n @property({ type: Boolean }) hasLeftIconSlot = false;\n\n /** Used only for SSR to indicate the presence of the `rightIcon` slot. */\n @property({ type: Boolean }) hasRightIconSlot = false;\n\n private readonly hasSlotController = new HasSlotController(this, \"leftIcon\", \"rightIcon\");\n\n updated() {\n if (!this.hasLeftIconSlot) this.hasLeftIconSlot = this.hasSlotController.test(\"leftIcon\");\n if (!this.hasRightIconSlot) this.hasRightIconSlot = this.hasSlotController.test(\"rightIcon\");\n }\n\n protected override _handleClick(event: MouseEvent) {\n if (this.disabled || this.loading) {\n event.preventDefault();\n event.stopPropagation();\n return;\n }\n this.removeEventListener(\"click\", this._clickHandler);\n this.addEventListener(\"click\", this._clickHandler);\n }\n\n private _clickHandler = () => {\n if (this.type === \"submit\") {\n this.formSubmitController.submit(this);\n }\n if (this.type === \"reset\") {\n this.formSubmitController.reset(this);\n }\n };\n\n render() {\n const isLink = this.href;\n const tag = isLink ? literal`a` : literal`button`;\n const noIcon = !this.hasLeftIconSlot && !this.hasRightIconSlot;\n\n return html`\n <${tag}\n class=\"btn ${classMap({\n disabled: this.disabled,\n active: this.active,\n \"has-left-icon\": this.hasLeftIconSlot,\n \"has-right-icon\": this.hasRightIconSlot,\n \"no-icon\": noIcon,\n loading: this.loading\n })}\"\n ?disabled=${ifDefined(isLink ? undefined : this.disabled)}\n type=${ifDefined(isLink ? undefined : this.type)}\n name=${ifDefined(isLink ? undefined : this.name)}\n value=${ifDefined(isLink ? undefined : this.value)}\n href=${ifDefined(isLink ? this.href : undefined)}\n target=${ifDefined(isLink ? this.target : undefined)}\n download=${ifDefined(isLink ? this.download : undefined)}\n rel=${ifDefined(isLink && this.target === \"_blank\" ? \"noreferrer noopener\" : undefined)}\n role=${ifDefined(isLink ? \"button\" : undefined)}\n aria-disabled=${this.disabled || this.loading ? \"true\" : \"false\"}\n tabindex=${this.disabled ? \"-1\" : \"0\"}\n @click=${this._handleClick}\n @keydown=${this._handleKeydown}\n @focus=${this._handleFocus}\n @blur=${this._handleBlur}\n aria-label=${ifDefined(this.loading ? \"Loading\" : this.ariaLabel)}\n >\n ${\n this.loading\n ? html`<sgds-spinner\n size=${ifDefined(this._assignSpinnerSize(this.size))}\n tone=${ifDefined(this._assignSpinnerTone(this.tone, this.variant))}\n ></sgds-spinner>`\n : html`<slot name=\"leftIcon\"></slot>\n <span><slot></slot></span>\n <slot name=\"rightIcon\"></slot>`\n }\n \n </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@@ -34,6 +34,7 @@ class SgdsTabPanel extends sgdsElement["default"] {
34
34
  }
35
35
  _handleActiveChange() {
36
36
  this.setAttribute("aria-hidden", this.active ? "false" : "true");
37
+ this.inert = !this.active;
37
38
  }
38
39
  render() {
39
40
  return lit.html `
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-tab-panel.cjs.js","sources":["../../../../src/components/Tab/sgds-tab-panel.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { watch } from \"../../utils/watch\";\nimport tabPanelStyles from \"./tab-panel.css\";\n\nlet id = 0;\n\n/**\n * @summary Tab panels are used inside tab groups to display tabbed content.\n * @slot - The tab panel's content.\n *\n */\nexport class SgdsTabPanel extends SgdsElement {\n static styles = [...SgdsElement.styles, tabPanelStyles];\n private readonly attrId = ++id;\n private readonly componentId = `sgds-tab-panel-${this.attrId}`;\n /** The tab panel's name. */\n @property({ reflect: true }) name = \"\";\n\n /** When true, the tab panel will be shown. When used with tab-group, this property is already being managed */\n @property({ type: Boolean, reflect: true }) active = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.id = this.id.length > 0 ? this.id : this.componentId;\n this.setAttribute(\"role\", \"tabpanel\");\n }\n\n @watch(\"active\")\n _handleActiveChange() {\n this.setAttribute(\"aria-hidden\", this.active ? \"false\" : \"true\");\n }\n\n render() {\n return html`\n <slot\n class=${classMap({\n \"tab-panel\": true,\n \"tab-panel--active\": this.active\n })}\n ></slot>\n `;\n }\n}\n\nexport default SgdsTabPanel;\n"],"names":["SgdsElement","html","classMap","tabPanelStyles","__decorate","property","watch"],"mappings":";;;;;;;;;;;;;AAOA,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;AAIG;AACG,MAAO,YAAa,SAAQA,sBAAW,CAAA;AAA7C,IAAA,WAAA,GAAA;;QAEmB,IAAM,CAAA,MAAA,GAAG,EAAE,EAAE,CAAC;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K,CAAC,QAAQ,CAAC;AAGf,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,qBAAA,EAAA,IAAA,CAAA;;;;;"}
1
+ {"version":3,"file":"sgds-tab-panel.cjs.js","sources":["../../../../src/components/Tab/sgds-tab-panel.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { watch } from \"../../utils/watch\";\nimport tabPanelStyles from \"./tab-panel.css\";\n\nlet id = 0;\n\n/**\n * @summary Tab panels are used inside tab groups to display tabbed content.\n * @slot - The tab panel's content.\n *\n */\nexport class SgdsTabPanel extends SgdsElement {\n static styles = [...SgdsElement.styles, tabPanelStyles];\n private readonly attrId = ++id;\n private readonly componentId = `sgds-tab-panel-${this.attrId}`;\n /** The tab panel's name. */\n @property({ reflect: true }) name = \"\";\n\n /** When true, the tab panel will be shown. When used with tab-group, this property is already being managed */\n @property({ type: Boolean, reflect: true }) active = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.id = this.id.length > 0 ? this.id : this.componentId;\n this.setAttribute(\"role\", \"tabpanel\");\n }\n\n @watch(\"active\")\n _handleActiveChange() {\n this.setAttribute(\"aria-hidden\", this.active ? \"false\" : \"true\");\n this.inert = !this.active;\n }\n\n render() {\n return html`\n <slot\n class=${classMap({\n \"tab-panel\": true,\n \"tab-panel--active\": this.active\n })}\n ></slot>\n `;\n }\n}\n\nexport default SgdsTabPanel;\n"],"names":["SgdsElement","html","classMap","tabPanelStyles","__decorate","property","watch"],"mappings":";;;;;;;;;;;;;AAOA,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;AAIG;AACG,MAAO,YAAa,SAAQA,sBAAW,CAAA;AAA7C,IAAA,WAAA,GAAA;;QAEmB,IAAM,CAAA,MAAA,GAAG,EAAE,EAAE,CAAC;AACd,QAAA,IAAA,CAAA,WAAW,GAAG,CAAkB,eAAA,EAAA,IAAI,CAAC,MA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K,CAAC,QAAQ,CAAC;AAIf,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,qBAAA,EAAA,IAAA,CAAA;;;;;"}
@@ -30,6 +30,7 @@ class SgdsTabPanel extends SgdsElement {
30
30
  }
31
31
  _handleActiveChange() {
32
32
  this.setAttribute("aria-hidden", this.active ? "false" : "true");
33
+ this.inert = !this.active;
33
34
  }
34
35
  render() {
35
36
  return html `
@@ -1 +1 @@
1
- {"version":3,"file":"sgds-tab-panel.js","sources":["../../../../src/components/Tab/sgds-tab-panel.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { watch } from \"../../utils/watch\";\nimport tabPanelStyles from \"./tab-panel.css\";\n\nlet id = 0;\n\n/**\n * @summary Tab panels are used inside tab groups to display tabbed content.\n * @slot - The tab panel's content.\n *\n */\nexport class SgdsTabPanel extends SgdsElement {\n static styles = [...SgdsElement.styles, tabPanelStyles];\n private readonly attrId = ++id;\n private readonly componentId = `sgds-tab-panel-${this.attrId}`;\n /** The tab panel's name. */\n @property({ reflect: true }) name = \"\";\n\n /** When true, the tab panel will be shown. When used with tab-group, this property is already being managed */\n @property({ type: Boolean, reflect: true }) active = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.id = this.id.length > 0 ? this.id : this.componentId;\n this.setAttribute(\"role\", \"tabpanel\");\n }\n\n @watch(\"active\")\n _handleActiveChange() {\n this.setAttribute(\"aria-hidden\", this.active ? \"false\" : \"true\");\n }\n\n render() {\n return html`\n <slot\n class=${classMap({\n \"tab-panel\": true,\n \"tab-panel--active\": this.active\n })}\n ></slot>\n `;\n }\n}\n\nexport default SgdsTabPanel;\n"],"names":["tabPanelStyles"],"mappings":";;;;;;;;;AAOA,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;AAIG;AACG,MAAO,YAAa,SAAQ,WAAW,CAAA;AAA7C,IAAA,WAAA,GAAA;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A;AAS3D,UAAA,CAAA;IADC,KAAK,CAAC,QAAQ,CAAC;AAGf,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,qBAAA,EAAA,IAAA,CAAA;;;;"}
1
+ {"version":3,"file":"sgds-tab-panel.js","sources":["../../../../src/components/Tab/sgds-tab-panel.ts"],"sourcesContent":["import { html } from \"lit\";\nimport { property } from \"lit/decorators.js\";\nimport { classMap } from \"lit/directives/class-map.js\";\nimport SgdsElement from \"../../base/sgds-element\";\nimport { watch } from \"../../utils/watch\";\nimport tabPanelStyles from \"./tab-panel.css\";\n\nlet id = 0;\n\n/**\n * @summary Tab panels are used inside tab groups to display tabbed content.\n * @slot - The tab panel's content.\n *\n */\nexport class SgdsTabPanel extends SgdsElement {\n static styles = [...SgdsElement.styles, tabPanelStyles];\n private readonly attrId = ++id;\n private readonly componentId = `sgds-tab-panel-${this.attrId}`;\n /** The tab panel's name. */\n @property({ reflect: true }) name = \"\";\n\n /** When true, the tab panel will be shown. When used with tab-group, this property is already being managed */\n @property({ type: Boolean, reflect: true }) active = false;\n\n connectedCallback() {\n super.connectedCallback();\n this.id = this.id.length > 0 ? this.id : this.componentId;\n this.setAttribute(\"role\", \"tabpanel\");\n }\n\n @watch(\"active\")\n _handleActiveChange() {\n this.setAttribute(\"aria-hidden\", this.active ? \"false\" : \"true\");\n this.inert = !this.active;\n }\n\n render() {\n return html`\n <slot\n class=${classMap({\n \"tab-panel\": true,\n \"tab-panel--active\": this.active\n })}\n ></slot>\n `;\n }\n}\n\nexport default SgdsTabPanel;\n"],"names":["tabPanelStyles"],"mappings":";;;;;;;;;AAOA,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;AAIG;AACG,MAAO,YAAa,SAAQ,WAAW,CAAA;AAA7C,IAAA,WAAA,GAAA;;QAEmB,IAAM,CAAA,MAAA,GAAG,EAAE,EAAE,CAAC;AACd,QAAA,IAAA,CAAA,WAAW,GAAG,CAAkB,eAAA,EAAA,IAAI,CAAC,MAAM,EAAE,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AA,EAAA,YAAA,CAAA,SAAA,EAAA,qBAAA,EAAA,IAAA,CAAA;;;;"}
@@ -8,9 +8,9 @@ var index$1 = require('./accordion/index.cjs.js');
8
8
  var index$2 = require('./alert-link/index.cjs.js');
9
9
  var index$3 = require('./alert/index.cjs.js');
10
10
  var index$4 = require('./badge/index.cjs.js');
11
- var index$5 = require('./breadcrumb-item/index.cjs.js');
12
- var index$6 = require('./breadcrumb/index.cjs.js');
13
- var index$7 = require('./button/index.cjs.js');
11
+ var index$5 = require('./button/index.cjs.js');
12
+ var index$6 = require('./breadcrumb-item/index.cjs.js');
13
+ var index$7 = require('./breadcrumb/index.cjs.js');
14
14
  var index$8 = require('./card/index.cjs.js');
15
15
  var index$9 = require('./checkbox-group/index.cjs.js');
16
16
  var index$a = require('./checkbox/index.cjs.js');
@@ -84,9 +84,9 @@ exports.SgdsAccordion = index$1["default"];
84
84
  exports.SgdsAlertLink = index$2["default"];
85
85
  exports.SgdsAlert = index$3["default"];
86
86
  exports.SgdsBadge = index$4["default"];
87
- exports.SgdsBreadcrumbItem = index$5["default"];
88
- exports.SgdsBreadcrumb = index$6["default"];
89
- exports.SgdsButton = index$7["default"];
87
+ exports.SgdsButton = index$5["default"];
88
+ exports.SgdsBreadcrumbItem = index$6["default"];
89
+ exports.SgdsBreadcrumb = index$7["default"];
90
90
  exports.SgdsCard = index$8["default"];
91
91
  exports.SgdsCheckboxGroup = index$9["default"];
92
92
  exports.SgdsCheckbox = index$a["default"];
package/react/index.d.ts CHANGED
@@ -3,9 +3,9 @@ export { default as SgdsAccordion } from './accordion';
3
3
  export { default as SgdsAlertLink } from './alert-link';
4
4
  export { default as SgdsAlert } from './alert';
5
5
  export { default as SgdsBadge } from './badge';
6
+ export { default as SgdsButton } from './button';
6
7
  export { default as SgdsBreadcrumbItem } from './breadcrumb-item';
7
8
  export { default as SgdsBreadcrumb } from './breadcrumb';
8
- export { default as SgdsButton } from './button';
9
9
  export { default as SgdsCard } from './card';
10
10
  export { default as SgdsCheckboxGroup } from './checkbox-group';
11
11
  export { default as SgdsCheckbox } from './checkbox';
package/react/index.js CHANGED
@@ -4,9 +4,9 @@ export { default as SgdsAccordion } from './accordion/index.js';
4
4
  export { default as SgdsAlertLink } from './alert-link/index.js';
5
5
  export { default as SgdsAlert } from './alert/index.js';
6
6
  export { default as SgdsBadge } from './badge/index.js';
7
+ export { default as SgdsButton } from './button/index.js';
7
8
  export { default as SgdsBreadcrumbItem } from './breadcrumb-item/index.js';
8
9
  export { default as SgdsBreadcrumb } from './breadcrumb/index.js';
9
- export { default as SgdsButton } from './button/index.js';
10
10
  export { default as SgdsCard } from './card/index.js';
11
11
  export { default as SgdsCheckboxGroup } from './checkbox-group/index.js';
12
12
  export { default as SgdsCheckbox } from './checkbox/index.js';
@@ -42,6 +42,11 @@ class FormSubmitController {
42
42
  button.setAttribute(attr, invoker.getAttribute(attr));
43
43
  }
44
44
  });
45
+ // Forward name/value so the submitter's data is included in FormData
46
+ if (type === "submit" && invoker.hasAttribute("name")) {
47
+ button.name = invoker.getAttribute("name");
48
+ button.value = invoker.getAttribute("value") || "";
49
+ }
45
50
  }
46
51
  this.form.append(button);
47
52
  button.click();
@@ -1 +1 @@
1
- {"version":3,"file":"formSubmitController.cjs.js","sources":["../../../src/utils/formSubmitController.ts"],"sourcesContent":["import type SgdsButton from \"../components/Button/sgds-button\";\nimport type { ReactiveController, ReactiveControllerHost } from \"lit\";\nimport SgdsElement from \"../base/sgds-element\";\nimport { SgdsInput } from \"../components\";\n\n/**\n * A controller to help with form submission\n */\nexport class FormSubmitController implements ReactiveController {\n host?: ReactiveControllerHost & Element;\n form?: HTMLFormElement | null;\n options: FormSubmitControllerOptions;\n\n constructor(host: ReactiveControllerHost & Element, options?: Partial<FormSubmitControllerOptions>) {\n (this.host = host).addController(this);\n this.options = {\n form: (input: HTMLInputElement) => {\n return input.closest(\"form\");\n },\n ...options\n };\n }\n\n hostConnected() {\n this.form = this.options.form(this.host);\n }\n\n hostDisconnected() {\n if (this.form) {\n this.form = undefined;\n }\n }\n /**\n * Creates a temporary native HTML button that can participate in form and invoke form submits and reset\n * Button is removed once action is performed\n */\n doAction(type: \"submit\" | \"reset\", invoker?: HTMLInputElement | SgdsButton) {\n if (this.form) {\n const button = document.createElement(\"button\");\n button.type = type;\n button.style.position = \"absolute\";\n button.style.width = \"0\";\n button.style.height = \"0\";\n button.style.clipPath = \"inset(50%)\";\n button.style.overflow = \"hidden\";\n button.style.whiteSpace = \"nowrap\";\n\n // Pass form attributes through to the temporary button\n if (invoker) {\n [\"formaction\", \"formmethod\", \"formnovalidate\", \"formtarget\"].forEach(attr => {\n if (invoker.hasAttribute(attr)) {\n button.setAttribute(attr, invoker.getAttribute(attr));\n }\n });\n }\n\n this.form.append(button);\n button.click();\n button.remove();\n }\n }\n\n /** Resets the form, restoring all the control to their default value */\n reset(invoker?: HTMLInputElement | SgdsButton) {\n this.doAction(\"reset\", invoker);\n }\n\n /** Submits the form, triggering validation and form data injection. */\n submit(invoker?: HTMLInputElement | SgdsButton) {\n // Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a\n // native submit button into the form, \"click\" it, then remove it to simulate a standard form submission.\n this.doAction(\"submit\", invoker);\n }\n}\n\nexport interface FormSubmitControllerOptions {\n /** A function that returns the form containing the form control. */\n form: (input: unknown) => HTMLFormElement | null;\n}\n\nexport interface SgdsFormControl extends SgdsElement {\n // Form attributes\n name: string;\n value: unknown;\n disabled?: boolean;\n defaultValue?: unknown;\n defaultChecked?: boolean;\n form?: HTMLFormElement;\n valid?: boolean;\n invalid?: boolean;\n\n // Constraint validation attributes\n pattern?: string;\n min?: number | string | Date;\n max?: number | string | Date;\n step?: number | \"any\";\n required?: boolean;\n minlength?: number;\n maxlength?: number;\n\n input?: HTMLInputElement | SgdsInput;\n}\n"],"names":[],"mappings":";;;;;AAKA;;AAEG;MACU,oBAAoB,CAAA;IAK/B,WAAY,CAAA,IAAsC,EAAE,OAA8C,EAAA;QAChG,CAAC,IAAI,CAAC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AAY,CAAC,IAAI,CAAC,EAAE;AAC9B,wBAAA,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;qBACvD;AACH,iBAAC,CAAC,CAAC;aACJ;AAED,YAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACzB,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,MAAM,EAAE,CAAC;SACjB;KACF;;AAGD,IAAA,KAAK,CAAC,OAAuC,EAAA;AAC3C,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KACjC;;AAGD,IAAA,MAAM,CAAC,OAAuC,EAAA;;;AAG5C,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;KAClC;AACF;;;;"}
1
+ {"version":3,"file":"formSubmitController.cjs.js","sources":["../../../src/utils/formSubmitController.ts"],"sourcesContent":["import type SgdsButton from \"../components/Button/sgds-button\";\nimport type { ReactiveController, ReactiveControllerHost } from \"lit\";\nimport SgdsElement from \"../base/sgds-element\";\nimport { SgdsInput } from \"../components\";\n\n/**\n * A controller to help with form submission\n */\nexport class FormSubmitController implements ReactiveController {\n host?: ReactiveControllerHost & Element;\n form?: HTMLFormElement | null;\n options: FormSubmitControllerOptions;\n\n constructor(host: ReactiveControllerHost & Element, options?: Partial<FormSubmitControllerOptions>) {\n (this.host = host).addController(this);\n this.options = {\n form: (input: HTMLInputElement) => {\n return input.closest(\"form\");\n },\n ...options\n };\n }\n\n hostConnected() {\n this.form = this.options.form(this.host);\n }\n\n hostDisconnected() {\n if (this.form) {\n this.form = undefined;\n }\n }\n /**\n * Creates a temporary native HTML button that can participate in form and invoke form submits and reset\n * Button is removed once action is performed\n */\n doAction(type: \"submit\" | \"reset\", invoker?: HTMLInputElement | SgdsButton) {\n if (this.form) {\n const button = document.createElement(\"button\");\n button.type = type;\n button.style.position = \"absolute\";\n button.style.width = \"0\";\n button.style.height = \"0\";\n button.style.clipPath = \"inset(50%)\";\n button.style.overflow = \"hidden\";\n button.style.whiteSpace = \"nowrap\";\n\n // Pass form attributes through to the temporary button\n if (invoker) {\n [\"formaction\", \"formmethod\", \"formnovalidate\", \"formtarget\"].forEach(attr => {\n if (invoker.hasAttribute(attr)) {\n button.setAttribute(attr, invoker.getAttribute(attr));\n }\n });\n\n // Forward name/value so the submitter's data is included in FormData\n if (type === \"submit\" && invoker.hasAttribute(\"name\")) {\n button.name = invoker.getAttribute(\"name\");\n button.value = invoker.getAttribute(\"value\") || \"\";\n }\n }\n\n this.form.append(button);\n button.click();\n button.remove();\n }\n }\n\n /** Resets the form, restoring all the control to their default value */\n reset(invoker?: HTMLInputElement | SgdsButton) {\n this.doAction(\"reset\", invoker);\n }\n\n /** Submits the form, triggering validation and form data injection. */\n submit(invoker?: HTMLInputElement | SgdsButton) {\n // Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a\n // native submit button into the form, \"click\" it, then remove it to simulate a standard form submission.\n this.doAction(\"submit\", invoker);\n }\n}\n\nexport interface FormSubmitControllerOptions {\n /** A function that returns the form containing the form control. */\n form: (input: unknown) => HTMLFormElement | null;\n}\n\nexport interface SgdsFormControl extends SgdsElement {\n // Form attributes\n name: string;\n value: unknown;\n disabled?: boolean;\n defaultValue?: unknown;\n defaultChecked?: boolean;\n form?: HTMLFormElement;\n valid?: boolean;\n invalid?: boolean;\n\n // Constraint validation attributes\n pattern?: string;\n min?: number | string | Date;\n max?: number | string | Date;\n step?: number | \"any\";\n required?: boolean;\n minlength?: number;\n maxlength?: number;\n\n input?: HTMLInputElement | SgdsInput;\n}\n"],"names":[],"mappings":";;;;;AAKA;;AAEG;MACU,oBAAoB,CAAA;IAK/B,WAAY,CAAA,IAAsC,EAAE,OAA8C,EAAA;QAChG,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QACvC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,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;qBACvD;AACH,iBAAC,CAAC,CAAC;;gBAGH,IAAI,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;oBACrD,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;oBAC3C,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;iBACpD;aACF;AAED,YAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACzB,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,MAAM,EAAE,CAAC;SACjB;KACF;;AAGD,IAAA,KAAK,CAAC,OAAuC,EAAA;AAC3C,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KACjC;;AAGD,IAAA,MAAM,CAAC,OAAuC,EAAA;;;AAG5C,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;KAClC;AACF;;;;"}
@@ -38,6 +38,11 @@ class FormSubmitController {
38
38
  button.setAttribute(attr, invoker.getAttribute(attr));
39
39
  }
40
40
  });
41
+ // Forward name/value so the submitter's data is included in FormData
42
+ if (type === "submit" && invoker.hasAttribute("name")) {
43
+ button.name = invoker.getAttribute("name");
44
+ button.value = invoker.getAttribute("value") || "";
45
+ }
41
46
  }
42
47
  this.form.append(button);
43
48
  button.click();
@@ -1 +1 @@
1
- {"version":3,"file":"formSubmitController.js","sources":["../../../src/utils/formSubmitController.ts"],"sourcesContent":["import type SgdsButton from \"../components/Button/sgds-button\";\nimport type { ReactiveController, ReactiveControllerHost } from \"lit\";\nimport SgdsElement from \"../base/sgds-element\";\nimport { SgdsInput } from \"../components\";\n\n/**\n * A controller to help with form submission\n */\nexport class FormSubmitController implements ReactiveController {\n host?: ReactiveControllerHost & Element;\n form?: HTMLFormElement | null;\n options: FormSubmitControllerOptions;\n\n constructor(host: ReactiveControllerHost & Element, options?: Partial<FormSubmitControllerOptions>) {\n (this.host = host).addController(this);\n this.options = {\n form: (input: HTMLInputElement) => {\n return input.closest(\"form\");\n },\n ...options\n };\n }\n\n hostConnected() {\n this.form = this.options.form(this.host);\n }\n\n hostDisconnected() {\n if (this.form) {\n this.form = undefined;\n }\n }\n /**\n * Creates a temporary native HTML button that can participate in form and invoke form submits and reset\n * Button is removed once action is performed\n */\n doAction(type: \"submit\" | \"reset\", invoker?: HTMLInputElement | SgdsButton) {\n if (this.form) {\n const button = document.createElement(\"button\");\n button.type = type;\n button.style.position = \"absolute\";\n button.style.width = \"0\";\n button.style.height = \"0\";\n button.style.clipPath = \"inset(50%)\";\n button.style.overflow = \"hidden\";\n button.style.whiteSpace = \"nowrap\";\n\n // Pass form attributes through to the temporary button\n if (invoker) {\n [\"formaction\", \"formmethod\", \"formnovalidate\", \"formtarget\"].forEach(attr => {\n if (invoker.hasAttribute(attr)) {\n button.setAttribute(attr, invoker.getAttribute(attr));\n }\n });\n }\n\n this.form.append(button);\n button.click();\n button.remove();\n }\n }\n\n /** Resets the form, restoring all the control to their default value */\n reset(invoker?: HTMLInputElement | SgdsButton) {\n this.doAction(\"reset\", invoker);\n }\n\n /** Submits the form, triggering validation and form data injection. */\n submit(invoker?: HTMLInputElement | SgdsButton) {\n // Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a\n // native submit button into the form, \"click\" it, then remove it to simulate a standard form submission.\n this.doAction(\"submit\", invoker);\n }\n}\n\nexport interface FormSubmitControllerOptions {\n /** A function that returns the form containing the form control. */\n form: (input: unknown) => HTMLFormElement | null;\n}\n\nexport interface SgdsFormControl extends SgdsElement {\n // Form attributes\n name: string;\n value: unknown;\n disabled?: boolean;\n defaultValue?: unknown;\n defaultChecked?: boolean;\n form?: HTMLFormElement;\n valid?: boolean;\n invalid?: boolean;\n\n // Constraint validation attributes\n pattern?: string;\n min?: number | string | Date;\n max?: number | string | Date;\n step?: number | \"any\";\n required?: boolean;\n minlength?: number;\n maxlength?: number;\n\n input?: HTMLInputElement | SgdsInput;\n}\n"],"names":[],"mappings":";AAKA;;AAEG;MACU,oBAAoB,CAAA;IAK/B,WAAY,CAAA,IAAsC,EAAE,OAA8C,EAAA;QAChG,CAAC,IAAI,CAAC,IAAI,GAAG,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,OAAO,GACV,MAAA,CAAA,MAAA,CAAA,EAAA,IAAI,EAAE,CAAC,KAAuB,KAAI;AAChC,gBAAA,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;aAC9B,EAAA,EACE,OAAO,CACX,CAAC;KACH;IAED,aAAa,GAAA;AACX,QAAA,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KAC1C;IAED,gBAAgB,GAAA;AACd,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE;AACb,YAAA,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;SACvB;KACF;AACD;;;AAGG;IACH,QAAQ,CAAC,IAAwB,EAAE,OAAuC,EAAA;AACxE,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE;YACb,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAChD,YAAA,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;AACnB,YAAA,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,UAAU,CAAC;AACnC,YAAA,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC;AACzB,YAAA,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC;AAC1B,YAAA,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,YAAY,CAAC;AACrC,YAAA,MAAM,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;AACjC,YAAA,MAAM,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC;;YAGnC,IAAI,OAAO,EAAE;AACX,gBAAA,CAAC,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,IAAI,IAAG;AAC1E,oBAAA,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;AAC9B,wBAAA,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;qBACvD;AACH,iBAAC,CAAC,CAAC;aACJ;AAED,YAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACzB,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,MAAM,EAAE,CAAC;SACjB;KACF;;AAGD,IAAA,KAAK,CAAC,OAAuC,EAAA;AAC3C,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KACjC;;AAGD,IAAA,MAAM,CAAC,OAAuC,EAAA;;;AAG5C,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;KAClC;AACF;;;;"}
1
+ {"version":3,"file":"formSubmitController.js","sources":["../../../src/utils/formSubmitController.ts"],"sourcesContent":["import type SgdsButton from \"../components/Button/sgds-button\";\nimport type { ReactiveController, ReactiveControllerHost } from \"lit\";\nimport SgdsElement from \"../base/sgds-element\";\nimport { SgdsInput } from \"../components\";\n\n/**\n * A controller to help with form submission\n */\nexport class FormSubmitController implements ReactiveController {\n host?: ReactiveControllerHost & Element;\n form?: HTMLFormElement | null;\n options: FormSubmitControllerOptions;\n\n constructor(host: ReactiveControllerHost & Element, options?: Partial<FormSubmitControllerOptions>) {\n (this.host = host).addController(this);\n this.options = {\n form: (input: HTMLInputElement) => {\n return input.closest(\"form\");\n },\n ...options\n };\n }\n\n hostConnected() {\n this.form = this.options.form(this.host);\n }\n\n hostDisconnected() {\n if (this.form) {\n this.form = undefined;\n }\n }\n /**\n * Creates a temporary native HTML button that can participate in form and invoke form submits and reset\n * Button is removed once action is performed\n */\n doAction(type: \"submit\" | \"reset\", invoker?: HTMLInputElement | SgdsButton) {\n if (this.form) {\n const button = document.createElement(\"button\");\n button.type = type;\n button.style.position = \"absolute\";\n button.style.width = \"0\";\n button.style.height = \"0\";\n button.style.clipPath = \"inset(50%)\";\n button.style.overflow = \"hidden\";\n button.style.whiteSpace = \"nowrap\";\n\n // Pass form attributes through to the temporary button\n if (invoker) {\n [\"formaction\", \"formmethod\", \"formnovalidate\", \"formtarget\"].forEach(attr => {\n if (invoker.hasAttribute(attr)) {\n button.setAttribute(attr, invoker.getAttribute(attr));\n }\n });\n\n // Forward name/value so the submitter's data is included in FormData\n if (type === \"submit\" && invoker.hasAttribute(\"name\")) {\n button.name = invoker.getAttribute(\"name\");\n button.value = invoker.getAttribute(\"value\") || \"\";\n }\n }\n\n this.form.append(button);\n button.click();\n button.remove();\n }\n }\n\n /** Resets the form, restoring all the control to their default value */\n reset(invoker?: HTMLInputElement | SgdsButton) {\n this.doAction(\"reset\", invoker);\n }\n\n /** Submits the form, triggering validation and form data injection. */\n submit(invoker?: HTMLInputElement | SgdsButton) {\n // Calling form.submit() bypasses the submit event and constraint validation. To prevent this, we can inject a\n // native submit button into the form, \"click\" it, then remove it to simulate a standard form submission.\n this.doAction(\"submit\", invoker);\n }\n}\n\nexport interface FormSubmitControllerOptions {\n /** A function that returns the form containing the form control. */\n form: (input: unknown) => HTMLFormElement | null;\n}\n\nexport interface SgdsFormControl extends SgdsElement {\n // Form attributes\n name: string;\n value: unknown;\n disabled?: boolean;\n defaultValue?: unknown;\n defaultChecked?: boolean;\n form?: HTMLFormElement;\n valid?: boolean;\n invalid?: boolean;\n\n // Constraint validation attributes\n pattern?: string;\n min?: number | string | Date;\n max?: number | string | Date;\n step?: number | \"any\";\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AAU,GAAG,QAAQ,CAAC;;YAGnC,IAAI,OAAO,EAAE;AACX,gBAAA,CAAC,YAAY,EAAE,YAAY,EAAE,gBAAgB,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,IAAI,IAAG;AAC1E,oBAAA,IAAI,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;AAC9B,wBAAA,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;qBACvD;AACH,iBAAC,CAAC,CAAC;;gBAGH,IAAI,IAAI,KAAK,QAAQ,IAAI,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;oBACrD,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;oBAC3C,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;iBACpD;aACF;AAED,YAAA,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACzB,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,MAAM,CAAC,MAAM,EAAE,CAAC;SACjB;KACF;;AAGD,IAAA,KAAK,CAAC,OAAuC,EAAA;AAC3C,QAAA,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;KACjC;;AAGD,IAAA,MAAM,CAAC,OAAuC,EAAA;;;AAG5C,QAAA,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;KAClC;AACF;;;;"}
package/types/react.d.ts CHANGED
@@ -171,23 +171,13 @@ Variants include: `primary`, `accent`, `success`, `danger`, `warning`, `cyan`, `
171
171
  "onsgds-after-hide"?: SgdsEventHandler;
172
172
  }
173
173
 
174
- // ── BreadcrumbItem ─────────────────────────────────────────────────────────────
175
-
176
- export interface SgdsBreadcrumbItemProps extends SgdsBaseProps {
177
- /** Indicates the link matches the current location of the page. Programmatically handled by SgdsBreadcrumb to set this prop to true for the last breadcrumb item */
178
- active?: boolean;
179
- }
180
-
181
- // ── Breadcrumb ─────────────────────────────────────────────────────────────
182
-
183
- export interface SgdsBreadcrumbProps extends SgdsBaseProps {
184
- /** The aria-label of nav element within breadcrumb component. */
185
- ariaLabel?: string;
186
- }
187
-
188
174
  // ── Button ─────────────────────────────────────────────────────────────
189
175
 
190
176
  export interface SgdsButtonProps extends SgdsBaseProps {
177
+ /** The name of the button, submitted as a name/value pair with form data only when this button is the submitter. Only works with `type="submit"`. Has no effect when the button is rendered as a link (i.e. when `href` is set). */
178
+ name?: string;
179
+ /** The value of the button, submitted as a name/value pair with form data only when this button is the submitter. Only works with `type="submit"`. Has no effect when the button is rendered as a link (i.e. when `href` is set). */
180
+ value?: string;
191
181
  /** The behavior of the button with default as `type='button', `reset` resets all the controls to their initial values and `submit` submits the form data to the server */
192
182
  type?: "button" | "submit" | "reset";
193
183
  /** The "form owner" to associate the button with. If omitted, the closest containing form will be used instead. The
@@ -235,6 +225,20 @@ value of this attribute must be an id of a form in the same document or shadow r
235
225
  "onsgds-focus"?: SgdsEventHandler;
236
226
  }
237
227
 
228
+ // ── BreadcrumbItem ─────────────────────────────────────────────────────────────
229
+
230
+ export interface SgdsBreadcrumbItemProps extends SgdsBaseProps {
231
+ /** Indicates the link matches the current location of the page. Programmatically handled by SgdsBreadcrumb to set this prop to true for the last breadcrumb item */
232
+ active?: boolean;
233
+ }
234
+
235
+ // ── Breadcrumb ─────────────────────────────────────────────────────────────
236
+
237
+ export interface SgdsBreadcrumbProps extends SgdsBaseProps {
238
+ /** The aria-label of nav element within breadcrumb component. */
239
+ ariaLabel?: string;
240
+ }
241
+
238
242
  // ── Card ─────────────────────────────────────────────────────────────
239
243
 
240
244
  export interface SgdsCardProps extends SgdsBaseProps {
@@ -1553,79 +1557,79 @@ export interface SgdsTooltipProps extends SgdsBaseProps {
1553
1557
  declare module "react" {
1554
1558
  namespace JSX {
1555
1559
  interface IntrinsicElements {
1556
- "sgds-accordion-item": SgdsAccordionItemProps;
1557
- "sgds-accordion": SgdsAccordionProps;
1558
- "sgds-alert-link": SgdsAlertLinkProps;
1559
- "sgds-alert": SgdsAlertProps;
1560
- "sgds-badge": SgdsBadgeProps;
1561
- "sgds-breadcrumb-item": SgdsBreadcrumbItemProps;
1562
- "sgds-breadcrumb": SgdsBreadcrumbProps;
1563
- "sgds-button": SgdsButtonProps;
1564
- "sgds-card": SgdsCardProps;
1565
- "sgds-checkbox-group": SgdsCheckboxGroupProps;
1566
- "sgds-checkbox": SgdsCheckboxProps;
1567
- "sgds-close-button": SgdsCloseButtonProps;
1568
- "sgds-combo-box-option": SgdsComboBoxOptionProps;
1569
- "sgds-combo-box": SgdsComboBoxProps;
1570
- "sgds-datepicker": SgdsDatepickerProps;
1571
- "sgds-description-list-group": SgdsDescriptionListGroupProps;
1572
- "sgds-description-list": SgdsDescriptionListProps;
1573
- "sgds-divider": SgdsDividerProps;
1574
- "sgds-drawer": SgdsDrawerProps;
1575
- "sgds-dropdown-item": SgdsDropdownItemProps;
1576
- "sgds-dropdown": SgdsDropdownProps;
1577
- "sgds-file-upload": SgdsFileUploadProps;
1578
- "sgds-footer-item": SgdsFooterItemProps;
1579
- "sgds-footer": SgdsFooterProps;
1580
- "sgds-icon": SgdsIconProps;
1581
- "sgds-icon-button": SgdsIconButtonProps;
1582
- "sgds-icon-card": SgdsIconCardProps;
1583
- "sgds-icon-list": SgdsIconListProps;
1584
- "sgds-image-card": SgdsImageCardProps;
1585
- "sgds-input": SgdsInputProps;
1586
- "sgds-link": SgdsLinkProps;
1587
- "sgds-mainnav-dropdown": SgdsMainnavDropdownProps;
1588
- "sgds-mainnav-item": SgdsMainnavItemProps;
1589
- "sgds-mainnav": SgdsMainnavProps;
1590
- "sgds-masthead": SgdsMastheadProps;
1591
- "sgds-modal": SgdsModalProps;
1592
- "sgds-overflow-menu": SgdsOverflowMenuProps;
1593
- "sgds-pagination": SgdsPaginationProps;
1594
- "sgds-progress-bar": SgdsProgressBarProps;
1595
- "sgds-quantity-toggle": SgdsQuantityToggleProps;
1596
- "sgds-radio-group": SgdsRadioGroupProps;
1597
- "sgds-radio": SgdsRadioProps;
1598
- "sgds-select-option": SgdsSelectOptionProps;
1599
- "sgds-select": SgdsSelectProps;
1600
- "sgds-sidebar-group": SgdsSidebarGroupProps;
1601
- "sgds-sidebar-item": SgdsSidebarItemProps;
1602
- "sgds-sidebar-section": SgdsSidebarSectionProps;
1603
- "sgds-sidebar": SgdsSidebarProps;
1604
- "sgds-sidenav-item": SgdsSidenavItemProps;
1605
- "sgds-sidenav-link": SgdsSidenavLinkProps;
1606
- "sgds-sidenav": SgdsSidenavProps;
1607
- "sgds-skeleton": SgdsSkeletonProps;
1608
- "sgds-spinner": SgdsSpinnerProps;
1609
- "sgds-step": SgdsStepProps;
1610
- "sgds-stepper": SgdsStepperProps;
1611
- "sgds-subnav-item": SgdsSubnavItemProps;
1612
- "sgds-subnav": SgdsSubnavProps;
1613
- "sgds-switch": SgdsSwitchProps;
1614
- "sgds-system-banner-item": SgdsSystemBannerItemProps;
1615
- "sgds-system-banner": SgdsSystemBannerProps;
1616
- "sgds-tab-group": SgdsTabGroupProps;
1617
- "sgds-tab-panel": SgdsTabPanelProps;
1618
- "sgds-tab": SgdsTabProps;
1619
- "sgds-table-cell": SgdsTableCellProps;
1620
- "sgds-table-head": SgdsTableHeadProps;
1621
- "sgds-table-row": SgdsTableRowProps;
1622
- "sgds-table": SgdsTableProps;
1623
- "sgds-table-of-contents": SgdsTableOfContentsProps;
1624
- "sgds-textarea": SgdsTextareaProps;
1625
- "sgds-thumbnail-card": SgdsThumbnailCardProps;
1626
- "sgds-toast-container": SgdsToastContainerProps;
1627
- "sgds-toast": SgdsToastProps;
1628
- "sgds-tooltip": SgdsTooltipProps;
1560
+ "sgds-accordion-item": React.DetailedHTMLProps<SgdsAccordionItemProps, HTMLElement>;
1561
+ "sgds-accordion": React.DetailedHTMLProps<SgdsAccordionProps, HTMLElement>;
1562
+ "sgds-alert-link": React.DetailedHTMLProps<SgdsAlertLinkProps, HTMLElement>;
1563
+ "sgds-alert": React.DetailedHTMLProps<SgdsAlertProps, HTMLElement>;
1564
+ "sgds-badge": React.DetailedHTMLProps<SgdsBadgeProps, HTMLElement>;
1565
+ "sgds-button": React.DetailedHTMLProps<SgdsButtonProps, HTMLElement>;
1566
+ "sgds-breadcrumb-item": React.DetailedHTMLProps<SgdsBreadcrumbItemProps, HTMLElement>;
1567
+ "sgds-breadcrumb": React.DetailedHTMLProps<SgdsBreadcrumbProps, HTMLElement>;
1568
+ "sgds-card": React.DetailedHTMLProps<SgdsCardProps, HTMLElement>;
1569
+ "sgds-checkbox-group": React.DetailedHTMLProps<SgdsCheckboxGroupProps, HTMLElement>;
1570
+ "sgds-checkbox": React.DetailedHTMLProps<SgdsCheckboxProps, HTMLElement>;
1571
+ "sgds-close-button": React.DetailedHTMLProps<SgdsCloseButtonProps, HTMLElement>;
1572
+ "sgds-combo-box-option": React.DetailedHTMLProps<SgdsComboBoxOptionProps, HTMLElement>;
1573
+ "sgds-combo-box": React.DetailedHTMLProps<SgdsComboBoxProps, HTMLElement>;
1574
+ "sgds-datepicker": React.DetailedHTMLProps<SgdsDatepickerProps, HTMLElement>;
1575
+ "sgds-description-list-group": React.DetailedHTMLProps<SgdsDescriptionListGroupProps, HTMLElement>;
1576
+ "sgds-description-list": React.DetailedHTMLProps<SgdsDescriptionListProps, HTMLElement>;
1577
+ "sgds-divider": React.DetailedHTMLProps<SgdsDividerProps, HTMLElement>;
1578
+ "sgds-drawer": React.DetailedHTMLProps<SgdsDrawerProps, HTMLElement>;
1579
+ "sgds-dropdown-item": React.DetailedHTMLProps<SgdsDropdownItemProps, HTMLElement>;
1580
+ "sgds-dropdown": React.DetailedHTMLProps<SgdsDropdownProps, HTMLElement>;
1581
+ "sgds-file-upload": React.DetailedHTMLProps<SgdsFileUploadProps, HTMLElement>;
1582
+ "sgds-footer-item": React.DetailedHTMLProps<SgdsFooterItemProps, HTMLElement>;
1583
+ "sgds-footer": React.DetailedHTMLProps<SgdsFooterProps, HTMLElement>;
1584
+ "sgds-icon": React.DetailedHTMLProps<SgdsIconProps, HTMLElement>;
1585
+ "sgds-icon-button": React.DetailedHTMLProps<SgdsIconButtonProps, HTMLElement>;
1586
+ "sgds-icon-card": React.DetailedHTMLProps<SgdsIconCardProps, HTMLElement>;
1587
+ "sgds-icon-list": React.DetailedHTMLProps<SgdsIconListProps, HTMLElement>;
1588
+ "sgds-image-card": React.DetailedHTMLProps<SgdsImageCardProps, HTMLElement>;
1589
+ "sgds-input": React.DetailedHTMLProps<SgdsInputProps, HTMLElement>;
1590
+ "sgds-link": React.DetailedHTMLProps<SgdsLinkProps, HTMLElement>;
1591
+ "sgds-mainnav-dropdown": React.DetailedHTMLProps<SgdsMainnavDropdownProps, HTMLElement>;
1592
+ "sgds-mainnav-item": React.DetailedHTMLProps<SgdsMainnavItemProps, HTMLElement>;
1593
+ "sgds-mainnav": React.DetailedHTMLProps<SgdsMainnavProps, HTMLElement>;
1594
+ "sgds-masthead": React.DetailedHTMLProps<SgdsMastheadProps, HTMLElement>;
1595
+ "sgds-modal": React.DetailedHTMLProps<SgdsModalProps, HTMLElement>;
1596
+ "sgds-overflow-menu": React.DetailedHTMLProps<SgdsOverflowMenuProps, HTMLElement>;
1597
+ "sgds-pagination": React.DetailedHTMLProps<SgdsPaginationProps, HTMLElement>;
1598
+ "sgds-progress-bar": React.DetailedHTMLProps<SgdsProgressBarProps, HTMLElement>;
1599
+ "sgds-quantity-toggle": React.DetailedHTMLProps<SgdsQuantityToggleProps, HTMLElement>;
1600
+ "sgds-radio-group": React.DetailedHTMLProps<SgdsRadioGroupProps, HTMLElement>;
1601
+ "sgds-radio": React.DetailedHTMLProps<SgdsRadioProps, HTMLElement>;
1602
+ "sgds-select-option": React.DetailedHTMLProps<SgdsSelectOptionProps, HTMLElement>;
1603
+ "sgds-select": React.DetailedHTMLProps<SgdsSelectProps, HTMLElement>;
1604
+ "sgds-sidebar-group": React.DetailedHTMLProps<SgdsSidebarGroupProps, HTMLElement>;
1605
+ "sgds-sidebar-item": React.DetailedHTMLProps<SgdsSidebarItemProps, HTMLElement>;
1606
+ "sgds-sidebar-section": React.DetailedHTMLProps<SgdsSidebarSectionProps, HTMLElement>;
1607
+ "sgds-sidebar": React.DetailedHTMLProps<SgdsSidebarProps, HTMLElement>;
1608
+ "sgds-sidenav-item": React.DetailedHTMLProps<SgdsSidenavItemProps, HTMLElement>;
1609
+ "sgds-sidenav-link": React.DetailedHTMLProps<SgdsSidenavLinkProps, HTMLElement>;
1610
+ "sgds-sidenav": React.DetailedHTMLProps<SgdsSidenavProps, HTMLElement>;
1611
+ "sgds-skeleton": React.DetailedHTMLProps<SgdsSkeletonProps, HTMLElement>;
1612
+ "sgds-spinner": React.DetailedHTMLProps<SgdsSpinnerProps, HTMLElement>;
1613
+ "sgds-step": React.DetailedHTMLProps<SgdsStepProps, HTMLElement>;
1614
+ "sgds-stepper": React.DetailedHTMLProps<SgdsStepperProps, HTMLElement>;
1615
+ "sgds-subnav-item": React.DetailedHTMLProps<SgdsSubnavItemProps, HTMLElement>;
1616
+ "sgds-subnav": React.DetailedHTMLProps<SgdsSubnavProps, HTMLElement>;
1617
+ "sgds-switch": React.DetailedHTMLProps<SgdsSwitchProps, HTMLElement>;
1618
+ "sgds-system-banner-item": React.DetailedHTMLProps<SgdsSystemBannerItemProps, HTMLElement>;
1619
+ "sgds-system-banner": React.DetailedHTMLProps<SgdsSystemBannerProps, HTMLElement>;
1620
+ "sgds-tab-group": React.DetailedHTMLProps<SgdsTabGroupProps, HTMLElement>;
1621
+ "sgds-tab-panel": React.DetailedHTMLProps<SgdsTabPanelProps, HTMLElement>;
1622
+ "sgds-tab": React.DetailedHTMLProps<SgdsTabProps, HTMLElement>;
1623
+ "sgds-table-cell": React.DetailedHTMLProps<SgdsTableCellProps, HTMLElement>;
1624
+ "sgds-table-head": React.DetailedHTMLProps<SgdsTableHeadProps, HTMLElement>;
1625
+ "sgds-table-row": React.DetailedHTMLProps<SgdsTableRowProps, HTMLElement>;
1626
+ "sgds-table": React.DetailedHTMLProps<SgdsTableProps, HTMLElement>;
1627
+ "sgds-table-of-contents": React.DetailedHTMLProps<SgdsTableOfContentsProps, HTMLElement>;
1628
+ "sgds-textarea": React.DetailedHTMLProps<SgdsTextareaProps, HTMLElement>;
1629
+ "sgds-thumbnail-card": React.DetailedHTMLProps<SgdsThumbnailCardProps, HTMLElement>;
1630
+ "sgds-toast-container": React.DetailedHTMLProps<SgdsToastContainerProps, HTMLElement>;
1631
+ "sgds-toast": React.DetailedHTMLProps<SgdsToastProps, HTMLElement>;
1632
+ "sgds-tooltip": React.DetailedHTMLProps<SgdsTooltipProps, HTMLElement>;
1629
1633
  }
1630
1634
  }
1631
1635
  }
@@ -1641,9 +1645,9 @@ declare global {
1641
1645
  "sgds-alert-link": HTMLElement;
1642
1646
  "sgds-alert": HTMLElement;
1643
1647
  "sgds-badge": HTMLElement;
1648
+ "sgds-button": HTMLElement;
1644
1649
  "sgds-breadcrumb-item": HTMLElement;
1645
1650
  "sgds-breadcrumb": HTMLElement;
1646
- "sgds-button": HTMLElement;
1647
1651
  "sgds-card": HTMLElement;
1648
1652
  "sgds-checkbox-group": HTMLElement;
1649
1653
  "sgds-checkbox": HTMLElement;
@@ -37,6 +37,11 @@ class FormSubmitController {
37
37
  button.setAttribute(attr, invoker.getAttribute(attr));
38
38
  }
39
39
  });
40
+ // Forward name/value so the submitter's data is included in FormData
41
+ if (type === "submit" && invoker.hasAttribute("name")) {
42
+ button.name = invoker.getAttribute("name");
43
+ button.value = invoker.getAttribute("value") || "";
44
+ }
40
45
  }
41
46
  this.form.append(button);
42
47
  button.click();