@quartzds/core 1.0.0-beta.39 → 1.0.0-beta.40

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 (94) hide show
  1. package/components/icon.js +1 -1
  2. package/components/label.js +1 -1
  3. package/components/qds-button.js +6 -3
  4. package/components/qds-button.js.map +1 -1
  5. package/components/qds-checkbox.js +4 -4
  6. package/components/qds-dialog.js +1 -1
  7. package/components/qds-divider.js +1 -1
  8. package/components/qds-dropdown.js +2 -2
  9. package/components/qds-form-message.js +2 -2
  10. package/components/qds-inline-link.js +1 -1
  11. package/components/qds-input.js +14 -4
  12. package/components/qds-input.js.map +1 -1
  13. package/components/qds-list-item.js +3 -3
  14. package/components/qds-nav-list-item.js +2 -2
  15. package/components/qds-radio.js +2 -2
  16. package/components/qds-select.js +4 -4
  17. package/components/qds-select.js.map +1 -1
  18. package/components/qds-standalone-link.js +1 -1
  19. package/components/qds-switch.js +3 -3
  20. package/components/qds-table-body.js +1 -1
  21. package/components/qds-table-cell.js +1 -1
  22. package/components/qds-table-head-cell.js +1 -1
  23. package/components/qds-table-head.js +1 -1
  24. package/components/qds-table-row.js +1 -1
  25. package/components/qds-table.js +1 -1
  26. package/components/qds-textarea.js +2 -2
  27. package/components/qds-title.js +2 -2
  28. package/components/tooltip.js +3 -3
  29. package/dist/cjs/loader.cjs.js +1 -1
  30. package/dist/cjs/qds-button.cjs.entry.js +6 -3
  31. package/dist/cjs/qds-button.cjs.entry.js.map +1 -1
  32. package/dist/cjs/qds-checkbox.cjs.entry.js +4 -4
  33. package/dist/cjs/qds-dialog.cjs.entry.js +1 -1
  34. package/dist/cjs/qds-divider.cjs.entry.js +1 -1
  35. package/dist/cjs/qds-dropdown.cjs.entry.js +2 -2
  36. package/dist/cjs/qds-form-message.cjs.entry.js +2 -2
  37. package/dist/cjs/qds-icon.cjs.entry.js +1 -1
  38. package/dist/cjs/qds-inline-link.cjs.entry.js +1 -1
  39. package/dist/cjs/qds-input.cjs.entry.js +13 -3
  40. package/dist/cjs/qds-input.cjs.entry.js.map +1 -1
  41. package/dist/cjs/qds-label.cjs.entry.js +1 -1
  42. package/dist/cjs/qds-list-item.cjs.entry.js +3 -3
  43. package/dist/cjs/qds-nav-list-item.cjs.entry.js +2 -2
  44. package/dist/cjs/qds-radio.cjs.entry.js +2 -2
  45. package/dist/cjs/qds-select.cjs.entry.js +4 -4
  46. package/dist/cjs/qds-select.cjs.entry.js.map +1 -1
  47. package/dist/cjs/qds-standalone-link.cjs.entry.js +1 -1
  48. package/dist/cjs/qds-switch.cjs.entry.js +3 -3
  49. package/dist/cjs/qds-table-body.cjs.entry.js +1 -1
  50. package/dist/cjs/qds-table-cell.cjs.entry.js +1 -1
  51. package/dist/cjs/qds-table-head-cell.cjs.entry.js +1 -1
  52. package/dist/cjs/qds-table-head.cjs.entry.js +1 -1
  53. package/dist/cjs/qds-table-row.cjs.entry.js +1 -1
  54. package/dist/cjs/qds-table.cjs.entry.js +1 -1
  55. package/dist/cjs/qds-textarea.cjs.entry.js +2 -2
  56. package/dist/cjs/qds-title.cjs.entry.js +2 -2
  57. package/dist/cjs/qds-tooltip.cjs.entry.js +3 -3
  58. package/dist/cjs/qds.cjs.js +1 -1
  59. package/dist/custom-elements.json +18 -0
  60. package/dist/docs.json +6 -1
  61. package/dist/esm/loader.js +1 -1
  62. package/dist/esm/qds-button.entry.js +6 -3
  63. package/dist/esm/qds-button.entry.js.map +1 -1
  64. package/dist/esm/qds-checkbox.entry.js +4 -4
  65. package/dist/esm/qds-dialog.entry.js +1 -1
  66. package/dist/esm/qds-divider.entry.js +1 -1
  67. package/dist/esm/qds-dropdown.entry.js +2 -2
  68. package/dist/esm/qds-form-message.entry.js +2 -2
  69. package/dist/esm/qds-icon.entry.js +1 -1
  70. package/dist/esm/qds-inline-link.entry.js +1 -1
  71. package/dist/esm/qds-input.entry.js +13 -3
  72. package/dist/esm/qds-input.entry.js.map +1 -1
  73. package/dist/esm/qds-label.entry.js +1 -1
  74. package/dist/esm/qds-list-item.entry.js +3 -3
  75. package/dist/esm/qds-nav-list-item.entry.js +2 -2
  76. package/dist/esm/qds-radio.entry.js +2 -2
  77. package/dist/esm/qds-select.entry.js +4 -4
  78. package/dist/esm/qds-select.entry.js.map +1 -1
  79. package/dist/esm/qds-standalone-link.entry.js +1 -1
  80. package/dist/esm/qds-switch.entry.js +3 -3
  81. package/dist/esm/qds-table-body.entry.js +1 -1
  82. package/dist/esm/qds-table-cell.entry.js +1 -1
  83. package/dist/esm/qds-table-head-cell.entry.js +1 -1
  84. package/dist/esm/qds-table-head.entry.js +1 -1
  85. package/dist/esm/qds-table-row.entry.js +1 -1
  86. package/dist/esm/qds-table.entry.js +1 -1
  87. package/dist/esm/qds-textarea.entry.js +2 -2
  88. package/dist/esm/qds-title.entry.js +2 -2
  89. package/dist/esm/qds-tooltip.entry.js +3 -3
  90. package/dist/esm/qds.js +1 -1
  91. package/dist/types/components/input/input.d.ts +1 -0
  92. package/hydrate/index.js +61 -48
  93. package/package.json +1 -1
  94. package/styles/core.css +61 -2
@@ -170,7 +170,7 @@ const Icon = /*@__PURE__*/ proxyCustomElement(class Icon extends HTMLElement {
170
170
  await this.setIcon();
171
171
  }
172
172
  render() {
173
- return h("span", { key: '592bfa37691915dff3c7283248d059b9014147a8', class: "qds-wrapper", innerHTML: this.svg });
173
+ return h("span", { key: '2560e66057e3fba1523c65ab383e62e963e20621', class: "qds-wrapper", innerHTML: this.svg });
174
174
  }
175
175
  get element() { return this; }
176
176
  static get watchers() { return {
@@ -36,7 +36,7 @@ const Label = /*@__PURE__*/ proxyCustomElement(class Label extends HTMLElement {
36
36
  this.inheritedAttributes = inheritAriaAttributes(this.element);
37
37
  }
38
38
  render() {
39
- return (h("span", { key: '3ac0fee06b2170fcb701e43a9b9d6ba86476be44', class: {
39
+ return (h("span", { key: 'b882c3999893dbc68e083eb302320b547a9c1caa', class: {
40
40
  'qds-inline': this.inline,
41
41
  'qds-label': true,
42
42
  }, "data-size": this.computedSize, ...this.inheritedAttributes }, this.required && h("span", { class: "qds-required" }, "*"), this.text));
@@ -7,7 +7,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
7
7
  import { p as pickFocusEventAttributes, i as inheritAriaAttributes } from './helpers.js';
8
8
  import { d as defineCustomElement$2 } from './icon.js';
9
9
 
10
- const buttonCss = ":host([hidden]){display:none !important}:host{display:inline-block}.qds-action{transform:scaleX(var(--qds-direction-factor, 1))}.qds-button{align-items:center;-webkit-appearance:none;appearance:none;background-color:initial;border:none;box-sizing:border-box;cursor:pointer;display:inline-flex;justify-content:center;padding-block:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;-webkit-user-select:none;user-select:none;white-space:var(--qds-internal-white-space-property, nowrap);width:100%}.qds-button:any-link{-webkit-text-decoration:none;text-decoration:none}.qds-button:focus-visible{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}.qds-badge{border-radius:var(--qds-control-rounded-border-radius);font:var(--qds-badge-text);height:var(--qds-badge-height);padding-inline:var(--qds-badge-padding-horizontal)}[aria-disabled='true']{opacity:var(--qds-theme-disabled);pointer-events:none}[data-size='small']{font:var(--qds-control-small-text)}.qds-button[data-size='small']{gap:var(--qds-control-small-gap-internal);height:var(--qds-control-small-height);padding-inline:var(--qds-control-button-small-padding-horizontal)}.qds-icon-only[data-size='small']{width:var(--qds-control-small-height)}.qds-icon[data-size='small']{font-size:var(--qds-control-small-icon-size)}[data-size='standard']{font:var(--qds-control-standard-text)}.qds-button[data-size='standard']{gap:var(--qds-control-standard-gap-internal);height:var(--qds-control-standard-height);padding-inline:var(--qds-control-button-standard-padding-horizontal)}.qds-icon-only[data-size='standard']{width:var(--qds-control-standard-height)}.qds-icon[data-size='standard']{font-size:var(--qds-control-standard-icon-size)}[data-size='large']{font:var(--qds-control-large-text)}.qds-button[data-size='large']{gap:var(--qds-control-large-gap-internal);height:var(--qds-control-large-height);padding-inline:var(--qds-control-button-large-padding-horizontal)}.qds-icon-only[data-size='large']{width:var(--qds-control-large-height)}.qds-icon[data-size='large']{font-size:var(--qds-control-large-icon-size)}.qds-button[data-importance='standard'],.qds-button[data-importance='emphasized'],.qds-button[data-variant='destructive']{border-radius:var(--qds-control-border-radius)}[data-importance='subdued']{color:var(--qds-theme-link-standard-default)}.qds-badge[data-importance='subdued']{background-color:var(--qds-theme-feedback-message-informational);color:var(--qds-theme-feedback-message-informational-contrast)}.qds-icon-only[data-importance='subdued']{color:var(--qds-theme-control-text-standard)}.qds-button[data-importance='subdued']{padding-inline:0;border-block-end:var(--qds-control-border-width) solid transparent}.qds-button[data-importance='subdued']:hover{border-block-end:var(--qds-control-border-width) solid\n var(--qds-theme-link-standard-hover);color:var(--qds-theme-link-standard-hover)}.qds-button[data-importance='subdued']:hover .qds-badge{background-color:var(--qds-theme-link-standard-hover)}.qds-button.qds-icon-only[data-importance='subdued']:hover{background-color:var(--qds-theme-interactive-background-hover);border:none;color:var(--qds-theme-control-text-standard)}.qds-button[data-importance='subdued']:active{border-block-end:var(--qds-control-border-width) solid\n var(--qds-theme-link-standard-pressed);color:var(--qds-theme-link-standard-pressed)}.qds-button[data-importance='subdued']:active .qds-badge{background-color:var(--qds-theme-link-standard-pressed)}.qds-button.qds-icon-only[data-importance='subdued']:active{background-color:var(--qds-theme-interactive-background-pressed);border:none;color:var(--qds-theme-control-text-standard)}[data-importance='standard']{color:var(--qds-theme-control-text-standard)}.qds-badge[data-importance='standard']{background-color:var(--qds-theme-feedback-message-neutral);color:var(--qds-theme-feedback-message-neutral-contrast)}.qds-button[data-importance='standard']{border:var(--qds-control-border-width) solid\n var(--qds-theme-control-border)}.qds-button[data-importance='standard']:hover{background-color:var(--qds-theme-interactive-background-hover)}.qds-button[data-importance='standard']:hover .qds-badge{color:var(--qds-theme-interactive-background-hover)}.qds-button[data-importance='standard']:active{background-color:var(--qds-theme-interactive-background-pressed)}.qds-button[data-importance='standard']:active .qds-badge{color:var(--qds-theme-interactive-background-pressed)}.qds-badge[data-importance='emphasized']{background-color:var(--qds-theme-signature-color-contrast);color:var(--qds-theme-signature-color-default)}.qds-button[data-importance='emphasized']{background-color:var(--qds-theme-signature-color-default);color:var(--qds-theme-signature-color-contrast)}.qds-button[data-importance='emphasized']:hover{background-color:var(--qds-theme-signature-color-hover)}.qds-button[data-importance='emphasized']:hover .qds-badge{color:var(--qds-theme-signature-color-hover)}.qds-button[data-importance='emphasized']:active{background-color:var(--qds-theme-signature-color-pressed)}.qds-button[data-importance='emphasized']:active .qds-badge{color:var(--qds-theme-signature-color-pressed)}.qds-badge[data-variant='destructive']{background-color:var(--qds-theme-feedback-action-destructive-contrast);color:var(--qds-theme-feedback-action-destructive-default)}.qds-button[data-variant='destructive']{background-color:var(--qds-theme-feedback-action-destructive-default);color:var(--qds-theme-feedback-action-destructive-contrast)}.qds-button[data-variant='destructive']:hover{background-color:var(--qds-theme-feedback-action-destructive-hover)}.qds-button[data-variant='destructive']:hover .qds-badge{color:var(--qds-theme-feedback-action-destructive-hover)}.qds-button[data-variant='destructive']:active{background-color:var(--qds-theme-feedback-action-destructive-pressed)}.qds-button[data-variant='destructive']:active .qds-badge{color:var(--qds-theme-feedback-action-destructive-pressed)}.qds-button[data-variant='hero']{border-radius:var(--qds-control-hero-border-radius);font:var(--qds-control-hero-text);gap:var(--qds-control-hero-gap-internal);white-space:normal;padding-block:var(--qds-control-hero-padding-auto-height)}.qds-button[data-variant='hero']:not([data-importance='subdued']){padding-inline:var(--qds-control-button-hero-padding-horizontal)}.qds-icon-only[data-variant='hero']{width:var(--qds-control-hero-height)}.qds-icon[data-variant='hero']{font-size:var(--qds-control-hero-icon-size)}.qds-icon-only[data-size='small'],.qds-icon-only[data-size='standard'],.qds-icon-only[data-size='large'],.qds-icon-only[data-variant='hero']{padding-inline:0}";
10
+ const buttonCss = ":host([hidden]){display:none !important}:host{display:inline-block}.qds-action{transform:scaleX(var(--qds-direction-factor, 1))}.qds-container{display:grid;grid-template-areas:'button'}.qds-button{align-items:center;-webkit-appearance:none;appearance:none;background-color:initial;border:none;border-radius:var(\n --qds-control-border-radius-top-left,\n var(--qds-control-border-radius)\n )\n var(--qds-control-border-radius-top-right, var(--qds-control-border-radius))\n var(\n --qds-control-border-radius-bottom-right,\n var(--qds-control-border-radius)\n )\n var(\n --qds-control-border-radius-bottom-left,\n var(--qds-control-border-radius)\n );box-sizing:border-box;cursor:pointer;display:inline-flex;grid-area:button;justify-content:center;outline:none;padding-block:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;-webkit-user-select:none;user-select:none;white-space:var(--qds-internal-white-space-property, nowrap);width:100%}.qds-button:any-link{-webkit-text-decoration:none;text-decoration:none}.qds-focus-ring{border-radius:max(\n 1px,\n var(\n --qds-control-border-radius-top-left,\n var(--qds-control-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-top-right,\n var(--qds-control-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-bottom-right,\n var(--qds-control-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-bottom-left,\n var(--qds-control-border-radius)\n )\n );grid-area:button;isolation:isolate;outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset);pointer-events:none;visibility:hidden;width:calc(\n 100% + var(--qds-control-border-width) -\n var(\n --qds-control-border-width-inline-end,\n var(--qds-control-border-width)\n )\n );height:calc(\n 100% + var(--qds-control-border-width) -\n var(--qds-control-border-width-block-end, var(--qds-control-border-width))\n )}.qds-badge{border-radius:var(--qds-control-rounded-border-radius);font:var(--qds-badge-text);height:var(--qds-badge-height);padding-inline:var(--qds-badge-padding-horizontal)}.qds-icon{flex-shrink:0}[aria-disabled='true']{opacity:var(--qds-theme-disabled);pointer-events:none}[data-size='small']{font:var(--qds-control-small-text)}.qds-button[data-size='small']{gap:var(--qds-control-small-gap-internal);height:var(--qds-control-small-height);padding-inline:var(--qds-control-button-small-padding-horizontal)}.qds-button.qds-icon-only[data-size='small']{padding-inline:0;width:var(--qds-control-small-height)}.qds-icon[data-size='small']{font-size:var(--qds-control-small-icon-size)}[data-size='standard']{font:var(--qds-control-standard-text)}.qds-button[data-size='standard']{gap:var(--qds-control-standard-gap-internal);height:var(--qds-control-standard-height);padding-inline:var(--qds-control-button-standard-padding-horizontal)}.qds-button.qds-icon-only[data-size='standard']{padding-inline:0;width:var(--qds-control-standard-height)}.qds-icon[data-size='standard']{font-size:var(--qds-control-standard-icon-size)}[data-size='large']{font:var(--qds-control-large-text)}.qds-button[data-size='large']{gap:var(--qds-control-large-gap-internal);height:var(--qds-control-large-height);padding-inline:var(--qds-control-button-large-padding-horizontal)}.qds-button.qds-icon-only[data-size='large']{padding-inline:0;width:var(--qds-control-large-height)}.qds-icon[data-size='large']{font-size:var(--qds-control-large-icon-size)}[data-importance='subdued']{color:var(--qds-theme-link-standard-default)}.qds-badge[data-importance='subdued']{background-color:var(--qds-theme-feedback-message-informational);color:var(--qds-theme-feedback-message-informational-contrast)}.qds-button[data-importance='subdued']{border-block-end:var(--qds-control-border-width) solid transparent;padding-inline:0}.qds-button[data-importance='subdued']:hover{border-block-end:var(--qds-control-border-width) solid\n var(--qds-theme-link-standard-hover);color:var(--qds-theme-link-standard-hover)}.qds-button[data-importance='subdued']:hover .qds-badge{background-color:var(--qds-theme-link-standard-hover)}.qds-button[data-importance='subdued']:active{border-block-end:var(--qds-control-border-width) solid\n var(--qds-theme-link-standard-pressed);color:var(--qds-theme-link-standard-pressed)}.qds-button[data-importance='subdued']:active .qds-badge{background-color:var(--qds-theme-link-standard-pressed)}.qds-button[data-importance='subdued']:not(.qds-icon-only){border-radius:0}.qds-button.qds-icon-only[data-importance='subdued']{border:none;color:var(--qds-theme-control-text-standard)}.qds-button.qds-icon-only[data-importance='subdued']:hover{background-color:var(--qds-theme-interactive-background-hover)}.qds-button.qds-icon-only[data-importance='subdued']:active{background-color:var(--qds-theme-interactive-background-pressed)}[data-importance='standard']{color:var(--qds-theme-control-text-standard)}.qds-badge[data-importance='standard']{background-color:var(--qds-theme-feedback-message-neutral);color:var(--qds-theme-feedback-message-neutral-contrast)}.qds-button[data-importance='standard']{border-color:var(--qds-theme-control-border);border-style:solid;border-width:var(--qds-control-border-width)\n var(\n --qds-control-border-width-inline-end,\n var(--qds-control-border-width)\n )\n var(--qds-control-border-width-block-end, var(--qds-control-border-width))\n var(--qds-control-border-width)}.qds-button[data-importance='standard']:hover{background-color:var(--qds-theme-interactive-background-hover)}.qds-button[data-importance='standard']:hover .qds-badge{color:var(--qds-theme-interactive-background-hover)}.qds-button[data-importance='standard']:active{background-color:var(--qds-theme-interactive-background-pressed)}.qds-button[data-importance='standard']:active .qds-badge{color:var(--qds-theme-interactive-background-pressed)}.qds-badge[data-importance='emphasized']{background-color:var(--qds-theme-signature-color-contrast);color:var(--qds-theme-signature-color-default)}.qds-button[data-importance='emphasized']{background-color:var(--qds-theme-signature-color-default);color:var(--qds-theme-signature-color-contrast)}.qds-button[data-importance='emphasized']:hover{background-color:var(--qds-theme-signature-color-hover)}.qds-button[data-importance='emphasized']:hover .qds-badge{color:var(--qds-theme-signature-color-hover)}.qds-button[data-importance='emphasized']:active{background-color:var(--qds-theme-signature-color-pressed)}.qds-button[data-importance='emphasized']:active .qds-badge{color:var(--qds-theme-signature-color-pressed)}.qds-badge[data-variant='destructive']{background-color:var(--qds-theme-feedback-action-destructive-contrast);color:var(--qds-theme-feedback-action-destructive-default)}.qds-button[data-variant='destructive']{background-color:var(--qds-theme-feedback-action-destructive-default);color:var(--qds-theme-feedback-action-destructive-contrast)}.qds-button[data-variant='destructive']:hover{background-color:var(--qds-theme-feedback-action-destructive-hover)}.qds-button[data-variant='destructive']:hover .qds-badge{color:var(--qds-theme-feedback-action-destructive-hover)}.qds-button[data-variant='destructive']:active{background-color:var(--qds-theme-feedback-action-destructive-pressed)}.qds-button[data-variant='destructive']:active .qds-badge{color:var(--qds-theme-feedback-action-destructive-pressed)}.qds-button[data-variant='hero']{border-radius:var(\n --qds-control-border-radius-top-left,\n var(--qds-control-hero-border-radius)\n )\n var(\n --qds-control-border-radius-top-right,\n var(--qds-control-hero-border-radius)\n )\n var(\n --qds-control-border-radius-bottom-right,\n var(--qds-control-hero-border-radius)\n )\n var(\n --qds-control-border-radius-bottom-left,\n var(--qds-control-hero-border-radius)\n );font:var(--qds-control-hero-text);gap:var(--qds-control-hero-gap-internal);padding-block:var(--qds-control-hero-padding-auto-height);white-space:normal}.qds-button[data-variant='hero'][data-importance='standard']{padding-block:calc(\n var(--qds-control-hero-padding-auto-height) -\n var(\n --qds-control-border-width-block-start,\n var(--qds-control-border-width)\n )\n )\n calc(\n var(--qds-control-hero-padding-auto-height) -\n var(\n --qds-control-border-width-block-end,\n var(--qds-control-border-width)\n )\n )}.qds-button[data-variant='hero']:not([data-importance='subdued']){padding-inline:var(--qds-control-button-hero-padding-horizontal)}.qds-button.qds-icon-only[data-variant='hero']{height:var(--qds-control-hero-height);padding:0;width:var(--qds-control-hero-height)}.qds-focus-ring[data-variant='hero']{border-radius:max(\n 1px,\n var(\n --qds-control-border-radius-top-left,\n var(--qds-control-hero-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-top-right,\n var(--qds-control-hero-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-bottom-right,\n var(--qds-control-hero-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-bottom-left,\n var(--qds-control-hero-border-radius)\n )\n )}.qds-icon[data-variant='hero']{font-size:var(--qds-control-hero-icon-size)}.qds-button:focus-visible~.qds-focus-ring{visibility:visible}";
11
11
  const QdsButtonStyle0 = buttonCss;
12
12
 
13
13
  const Button = /*@__PURE__*/ proxyCustomElement(class Button extends HTMLElement {
@@ -136,10 +136,13 @@ const Button = /*@__PURE__*/ proxyCustomElement(class Button extends HTMLElement
136
136
  }
137
137
  render() {
138
138
  const Tag = this.href === undefined ? 'button' : 'a';
139
- return (h(Tag, { key: 'aa439b980fbe2f233204bfc272bfe14a83136f4d', "aria-disabled": this.computedDisabled.toString(), class: {
139
+ return (h("div", { key: 'a4e21a38ce15a8447c131548ed138e12aeaadc7a', class: "qds-container" }, h(Tag, { key: '87128f1a0c778c0bda43aab708707425a74f715f', "aria-disabled": this.computedDisabled.toString(), class: {
140
140
  'qds-button': true,
141
141
  'qds-icon-only': this.iconOnly,
142
- }, "data-importance": this.computedImportance, "data-size": this.computedSize, "data-variant": this.variant, disabled: Tag === 'a' ? undefined : this.disabled, download: Tag === 'a' ? this.download : undefined, href: Tag === 'a' ? this.href : undefined, name: Tag === 'a' ? undefined : this.name, onBlur: this.onBlur, onFocus: this.onFocus, rel: Tag === 'a' ? 'noreferrer noopener' : undefined, role: Tag === 'a' ? 'button' : undefined, tabIndex: this.computedDisabled ? -1 : this.computedTabIndex, target: Tag === 'a' ? this.target : undefined, type: Tag === 'a' ? undefined : this.buttonType, value: Tag === 'a' ? undefined : this.value, ...this.inheritedAttributes }, this.iconName !== undefined && this.iconName !== '' && (h("qds-icon", { class: "qds-icon", "data-size": this.computedSize, "data-variant": this.variant, library: this.iconLibrary, name: this.iconName })), this.text, this.badge !== undefined && this.badge !== '' && (h("div", { class: "qds-badge", "data-importance": this.computedImportance, "data-variant": this.variant }, this.badge)), this.computedAction !== undefined && (h("qds-icon", { class: "qds-icon qds-action", library: "core", name: this.computedAction }))));
142
+ }, "data-importance": this.computedImportance, "data-size": this.computedSize, "data-variant": this.variant, disabled: Tag === 'a' ? undefined : this.disabled, download: Tag === 'a' ? this.download : undefined, href: Tag === 'a' ? this.href : undefined, name: Tag === 'a' ? undefined : this.name, onBlur: this.onBlur, onFocus: this.onFocus, rel: Tag === 'a' ? 'noreferrer noopener' : undefined, role: Tag === 'a' ? 'button' : undefined, tabIndex: this.computedDisabled ? -1 : this.computedTabIndex, target: Tag === 'a' ? this.target : undefined, type: Tag === 'a' ? undefined : this.buttonType, value: Tag === 'a' ? undefined : this.value, ...this.inheritedAttributes }, this.iconName !== undefined && this.iconName !== '' && (h("qds-icon", { class: "qds-icon", "data-size": this.computedSize, library: this.iconLibrary, name: this.iconName })), this.text, this.badge !== undefined && this.badge !== '' && (h("div", { class: "qds-badge", "data-importance": this.computedImportance, "data-variant": this.variant }, this.badge)), this.computedAction !== undefined && (h("qds-icon", { class: "qds-icon qds-action", library: "core", name: this.computedAction }))), h("div", { key: '54277f5f5c4cfa4c52e85a34fe80791b8464167d', class: {
143
+ 'qds-focus-ring': true,
144
+ 'qds-icon-only': this.iconOnly,
145
+ }, "data-importance": this.computedImportance, "data-size": this.computedSize, "data-variant": this.variant })));
143
146
  }
144
147
  static get delegatesFocus() { return true; }
145
148
  get element() { return this; }
@@ -1 +1 @@
1
- {"file":"qds-button.js","mappings":";;;;;;;;;AAAA,MAAM,SAAS,GAAG,0jNAA0jN,CAAC;AAC7kN,wBAAe,SAAS;;MC+BX,MAAM;;;;;;;QAiOT,wBAAmB,GAAe,EAAE,CAAA;QAiK3B,WAAM,GAAG,CAAC,KAAiB;YAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;SACvD,CAAA;QAEgB,YAAO,GAAG,CAAC,KAAiB;YAC3C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;SACxD,CAAA;;;;2BAnX6C,SAAS;0BAKL,UAAU;oBAKtB,UAAU;;;;;;;;8BAyFN,KAAK;0BA4BkB,OAAO;;;;;;;IA+ExE,IAAY,WAAW;QACrB,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE;cAC9C,QAAQ,CAAC,aAAa,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;cACvC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;KACjC;IAED,IAAY,UAAU;QACpB,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;YAAE,OAAO,IAAI,CA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,mBAAmB,IAE3B,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,KAAK,EAAE,KAClD,gBACE,KAAK,EAAC,UAAU,eACL,IAAI,CAAC,YAAY,kBACd,IAAI,CAAC,OAAO,EAC1B,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAE,IAAI,CAAC,QAAQ,GACnB,CACH,EACA,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,EAAE,KAC5C,WACE,KAAK,EAAC,WAAW,qBACA,IAAI,CAAC,kBAAkB,kBAC1B,IAAI,CAAC,OAAO,IAEzB,IAAI,CAAC,KAAK,CACP,CACP,EACA,IAAI,CAAC,cAAc,KAAK,SAAS,KAChC,gBACE,KAAK,EAAC,qBAAqB,EAC3B,OAAO,EAAC,MAAM,EACd,IAAI,EAAE,IAAI,CAAC,cAAc,GACzB,CACH,CACG,EACP;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/button/button.css?tag=qds-button&encapsulation=shadow","src/components/button/button.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2024 Schneider Electric\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n}\n\n.qds-action {\n transform: scaleX(var(--qds-direction-factor, 1));\n}\n\n.qds-button {\n align-items: center;\n appearance: none;\n background-color: initial;\n border: none;\n box-sizing: border-box;\n cursor: pointer;\n display: inline-flex;\n justify-content: center;\n padding-block: 0;\n print-color-adjust: exact;\n user-select: none;\n white-space: var(--qds-internal-white-space-property, nowrap);\n width: 100%;\n\n &:any-link {\n text-decoration: none;\n }\n\n &:focus-visible {\n outline: var(--qds-theme-focus-border) solid var(--qds-focus-border-width);\n outline-offset: var(--qds-focus-border-offset);\n }\n}\n\n.qds-badge {\n border-radius: var(--qds-control-rounded-border-radius);\n font: var(--qds-badge-text);\n height: var(--qds-badge-height);\n padding-inline: var(--qds-badge-padding-horizontal);\n}\n\n[aria-disabled='true'] {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n}\n\n[data-size='small'] {\n font: var(--qds-control-small-text);\n\n &.qds-button {\n gap: var(--qds-control-small-gap-internal);\n height: var(--qds-control-small-height);\n padding-inline: var(--qds-control-button-small-padding-horizontal);\n }\n\n &.qds-icon-only {\n width: var(--qds-control-small-height);\n }\n\n &.qds-icon {\n font-size: var(--qds-control-small-icon-size);\n }\n}\n\n[data-size='standard'] {\n font: var(--qds-control-standard-text);\n\n &.qds-button {\n gap: var(--qds-control-standard-gap-internal);\n height: var(--qds-control-standard-height);\n padding-inline: var(--qds-control-button-standard-padding-horizontal);\n }\n\n &.qds-icon-only {\n width: var(--qds-control-standard-height);\n }\n\n &.qds-icon {\n font-size: var(--qds-control-standard-icon-size);\n }\n}\n\n[data-size='large'] {\n font: var(--qds-control-large-text);\n\n &.qds-button {\n gap: var(--qds-control-large-gap-internal);\n height: var(--qds-control-large-height);\n padding-inline: var(--qds-control-button-large-padding-horizontal);\n }\n\n &.qds-icon-only {\n width: var(--qds-control-large-height);\n }\n\n &.qds-icon {\n font-size: var(--qds-control-large-icon-size);\n }\n}\n\n[data-importance='standard'],\n[data-importance='emphasized'],\n[data-variant='destructive'] {\n &.qds-button {\n border-radius: var(--qds-control-border-radius);\n }\n}\n\n[data-importance='subdued'] {\n color: var(--qds-theme-link-standard-default);\n\n &.qds-badge {\n background-color: var(--qds-theme-feedback-message-informational);\n color: var(--qds-theme-feedback-message-informational-contrast);\n }\n\n &.qds-icon-only {\n color: var(--qds-theme-control-text-standard);\n }\n\n &.qds-button {\n padding-inline: 0;\n border-block-end: var(--qds-control-border-width) solid transparent;\n\n &:hover {\n border-block-end: var(--qds-control-border-width) solid\n var(--qds-theme-link-standard-hover);\n color: var(--qds-theme-link-standard-hover);\n\n .qds-badge {\n background-color: var(--qds-theme-link-standard-hover);\n }\n\n &.qds-icon-only {\n background-color: var(--qds-theme-interactive-background-hover);\n border: none;\n color: var(--qds-theme-control-text-standard);\n }\n }\n\n &:active {\n border-block-end: var(--qds-control-border-width) solid\n var(--qds-theme-link-standard-pressed);\n color: var(--qds-theme-link-standard-pressed);\n\n .qds-badge {\n background-color: var(--qds-theme-link-standard-pressed);\n }\n\n &.qds-icon-only {\n background-color: var(--qds-theme-interactive-background-pressed);\n border: none;\n color: var(--qds-theme-control-text-standard);\n }\n }\n }\n}\n\n[data-importance='standard'] {\n color: var(--qds-theme-control-text-standard);\n\n &.qds-badge {\n background-color: var(--qds-theme-feedback-message-neutral);\n color: var(--qds-theme-feedback-message-neutral-contrast);\n }\n\n &.qds-button {\n border: var(--qds-control-border-width) solid\n var(--qds-theme-control-border);\n\n &:hover {\n background-color: var(--qds-theme-interactive-background-hover);\n\n .qds-badge {\n color: var(--qds-theme-interactive-background-hover);\n }\n }\n\n &:active {\n background-color: var(--qds-theme-interactive-background-pressed);\n\n .qds-badge {\n color: var(--qds-theme-interactive-background-pressed);\n }\n }\n }\n}\n\n[data-importance='emphasized'] {\n &.qds-badge {\n background-color: var(--qds-theme-signature-color-contrast);\n color: var(--qds-theme-signature-color-default);\n }\n\n &.qds-button {\n background-color: var(--qds-theme-signature-color-default);\n color: var(--qds-theme-signature-color-contrast);\n\n &:hover {\n background-color: var(--qds-theme-signature-color-hover);\n\n .qds-badge {\n color: var(--qds-theme-signature-color-hover);\n }\n }\n\n &:active {\n background-color: var(--qds-theme-signature-color-pressed);\n\n .qds-badge {\n color: var(--qds-theme-signature-color-pressed);\n }\n }\n }\n}\n\n[data-variant='destructive'] {\n &.qds-badge {\n background-color: var(--qds-theme-feedback-action-destructive-contrast);\n color: var(--qds-theme-feedback-action-destructive-default);\n }\n\n &.qds-button {\n background-color: var(--qds-theme-feedback-action-destructive-default);\n color: var(--qds-theme-feedback-action-destructive-contrast);\n\n &:hover {\n background-color: var(--qds-theme-feedback-action-destructive-hover);\n\n .qds-badge {\n color: var(--qds-theme-feedback-action-destructive-hover);\n }\n }\n\n &:active {\n background-color: var(--qds-theme-feedback-action-destructive-pressed);\n\n .qds-badge {\n color: var(--qds-theme-feedback-action-destructive-pressed);\n }\n }\n }\n}\n\n[data-variant='hero'] {\n &.qds-button {\n border-radius: var(--qds-control-hero-border-radius);\n font: var(--qds-control-hero-text);\n gap: var(--qds-control-hero-gap-internal);\n white-space: normal;\n padding-block: var(--qds-control-hero-padding-auto-height);\n }\n\n &.qds-button:not([data-importance='subdued']) {\n padding-inline: var(--qds-control-button-hero-padding-horizontal);\n }\n\n &.qds-icon-only {\n width: var(--qds-control-hero-height);\n }\n\n &.qds-icon {\n font-size: var(--qds-control-hero-icon-size);\n }\n}\n\n[data-size='small'],\n[data-size='standard'],\n[data-size='large'],\n[data-variant='hero'] {\n &.qds-icon-only {\n padding-inline: 0;\n }\n}\n","// SPDX-FileCopyrightText: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport { Component, Element, Event, h, Listen, Prop } from '@stencil/core'\nimport type { LiteralUnion } from 'type-fest'\n\nimport type { Attributes, QdsFocusEventDetail } from '../../helpers'\nimport { inheritAriaAttributes, pickFocusEventAttributes } from '../../helpers'\nimport type { Importance, Size } from '../shared'\n\nexport type Action = 'dropdown-close' | 'dropdown' | 'next'\nexport type ButtonTarget = '_blank' | '_parent' | '_self' | '_top'\nexport type ButtonType = 'button' | 'reset' | 'submit'\nexport type FormMethod = 'dialog' | 'get' | 'post'\nexport type ButtonVariant = 'destructive' | 'hero'\n\n/**\n * The `<qds-button>` element is an interactive element activated by a user\n * with a mouse, keyboard, finger, voice command, or other assistive technology.\n * Once activated, it then performs a programmable action, such as submitting a\n * [form](https://developer.mozilla.org/docs/Learn/Forms)\n * or opening a dialog.\n *\n * @see https://quartz.se.com/build/components/button\n */\n@Component({\n tag: 'qds-button',\n shadow: { delegatesFocus: true },\n styleUrl: 'button.css',\n})\nexport class Button implements ComponentInterface {\n /**\n * The name of the action icon to render.\n */\n @Prop() public readonly action?: Action\n\n /**\n * The button's badge text.\n */\n @Prop() public readonly badge?: string\n\n /**\n * The name of the icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop() public readonly iconName?: string\n\n /**\n * The name of a registered icon library.\n */\n @Prop() public readonly iconLibrary: string = 'default'\n\n /**\n * The button's importance.\n */\n @Prop() public readonly importance?: Importance = 'standard'\n\n /**\n * The button's size.\n */\n @Prop() public readonly size?: Size = 'standard'\n\n /**\n * The button's text.\n */\n @Prop() public readonly text?: string\n\n /**\n * The button's variant.\n */\n @Prop() public readonly variant?: ButtonVariant\n\n /**\n * Prevents the button from being interacted with: it cannot be pressed or\n * focused.\n *\n * @webnative\n */\n @Prop()\n public readonly disabled?: boolean\n\n /**\n * Tells the browser to download the linked file as this filename. Only used\n * when `href` is set.\n *\n * @webnative\n */\n @Prop() public readonly download?: string\n\n /**\n * The [`<form>`](https://developer.mozilla.org/docs/Web/HTML/Element/form)\n * element to associate the button with (its form owner).\n *\n * The value of this attribute must be the id of a `<form>` in the same\n * document. If this attribute is not set, the `<button>` is associated with\n * its ancestor `<form>` element, if any.\n *\n * This attribute lets you associate `<button>` elements to `<form>`s\n * anywhere in the document, not just inside a `<form>`. It can also override\n * an ancestor `<form>` element.\n *\n * @webnative\n */\n @Prop() public readonly form?: string\n\n /**\n * The URL that processes the information submitted by the button. Overrides\n * the [`action`](https://developer.mozilla.org/docs/Web/HTML/Element/button#attr-formaction)\n * attribute of the button's form owner. Does nothing if there is no form owner.\n *\n * @webnative\n */\n @Prop({ attribute: 'formaction' }) public readonly formAction?: string\n\n /**\n * If the button is a submit button (it's inside/associated with a `<form>`\n * and doesn't have `type=\"button\"`), this attribute specifies the\n * [HTTP method][] used to submit the form, or `dialog` which won't submit\n * the form. Possible values:\n *\n * - `get`: The form data are appended to the form's action URL, with a ? as\n * a separator, and the resulting URL is sent to the server. Use this method\n * when the form has no side effects, like search forms.\n * - `post`: The data from the form are included in the body of the HTTP\n * request when sent to the server. Use when the form contains information\n * that shouldn't be public, like login credentials.\n * - `dialog`: Close the dialog box in which the button finds itself, if any,\n * and do not submit the button's form owner.\n *\n * If specified, this attribute overrides the `method` attribute of the\n * button's form owner.\n *\n * [HTTP method]: https://developer.mozilla.org/docs/Web/HTTP/Methods\n *\n * @webnative\n */\n @Prop({ attribute: 'formmethod' }) public readonly formMethod?: FormMethod\n\n /**\n * If the button is a submit button, this attribute specifies that the form\n * is not to be\n * [validated](https://developer.mozilla.org/docs/Learn/Forms/Form_validation)\n * when it is submitted. If this attribute is specified, it overrides the\n * [`novalidate`](https://developer.mozilla.org/docs/Web/HTML/Element/form#attr-novalidate)\n * attribute of the button's form owner.\n *\n * @webnative\n */\n @Prop({ attribute: 'formnovalidate' })\n public readonly formNoValidate: boolean = false\n\n /**\n * If the button is a submit button, this attribute is an author-defined name\n * or standardized, underscore-prefixed keyword indicating where to display\n * the response from submitting the form. This is the `name` of, or keyword\n * for, a browsing context (a tab, window, or\n * [`<iframe>`](https://developer.mozilla.org/docs/Web/HTML/Element/iframe)).\n * If this attribute is specified, it overrides the\n * [`target`](https://developer.mozilla.org/docs/Web/HTML/Element/form#attr-target)\n * attribute of the button's form owner. The following keywords have special\n * meanings:\n *\n * - `_blank`: Load the response into a new unnamed browsing context — usually\n * a new tab or window, depending on the user's browser settings.\n * - `_parent`: Load the response into the parent browsing context of the\n * current one. If there is no parent, this option behaves the same way as\n * `_self`.\n * - `_self`: Load the response into the same browsing context as the current\n * one.\n * - `_top`: Load the response into the top-level browsing context (that is,\n * the browsing context that is an ancestor of the current one, and has no\n * parent). If there is no parent, this option behaves the same way as\n * `_self`.\n *\n * @webnative\n */\n @Prop({ attribute: 'formtarget' })\n public readonly formTarget: LiteralUnion<ButtonTarget, string> = '_self'\n\n /**\n * When set, the underlying button will be rendered as an `<a>` with this\n * `href` instead of a `<button>`.\n *\n * @webnative\n */\n @Prop() public readonly href?: string\n\n /**\n * The name of the button, submitted as a pair with the button's `value` as\n * part of the form data, when that button is used to submit the form.\n * Ignored when `href` is set.\n *\n * @webnative\n */\n @Prop() public readonly name?: string\n\n /**\n * Where to display the linked URL, as the name for a browsing context (a\n * tab, window, or\n * [`<iframe>`](https://developer.mozilla.org/docs/Web/HTML/Element/iframe).\n * The following keywords have special meanings for where to load the URL:\n *\n * - `_blank`: usually a new tab, but users can configure browsers to open a new\n * window instead.\n * - `_parent`: the parent browsing context of the current one. If no parent,\n * behaves as `_self`.\n * - `_self`: the current browsing context.\n * - `_top`: the topmost browsing context (the \"highest\" context that's an\n * ancestor of the current one). If no ancestors, behaves as `_self`.\n *\n * @webnative\n */\n @Prop() public readonly target?: LiteralUnion<ButtonTarget, string>\n\n /**\n * The type of button.\n *\n * `button`: The button has no default behavior, and does nothing when\n * pressed by default. It can have client-side scripts listen to the\n * element's events, which are triggered when the events occur.\n *\n * `submit`: The button submits the form data to the server. This is the\n * default if the attribute is not specified for buttons associated with a\n * `<form>`, or if the attribute is an empty or invalid value.\n *\n * `reset`: The button resets all the controls to their initial values.\n *\n * @webnative\n */\n @Prop() public readonly type?: ButtonType\n\n /**\n * Defines the value associated with the button's `name` when it's submitted\n * with the form data. This value is passed to the server in params when the\n * form is submitted using this button. Ignored when `href` is set.\n *\n * @webnative\n */\n @Prop() public readonly value?: string\n\n /**\n * Emitted when the button loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the button gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n @Element() private readonly element!: HTMLQdsButtonElement\n\n private inheritedAttributes: Attributes = {}\n\n private get formElement(): HTMLElement | null {\n return this.form !== undefined && this.form !== ''\n ? document.querySelector(`#${this.form}`)\n : this.element.closest('form')\n }\n\n private get buttonType(): ButtonType {\n if (this.type === undefined) return this.formElement ? 'submit' : 'button'\n return this.type\n }\n\n private get iconOnly(): boolean {\n const hasIcon = this.iconName !== undefined && this.iconName !== ''\n const hasNoLabel = this.text === undefined || this.text === ''\n\n return hasIcon && hasNoLabel\n }\n\n private get computedAction(): Action | undefined {\n switch (this.action) {\n case 'dropdown':\n case 'dropdown-close':\n case 'next': {\n return this.action\n }\n default: {\n return undefined\n }\n }\n }\n\n private get computedDisabled(): boolean {\n return this.disabled ?? false\n }\n\n private get computedImportance(): Importance | undefined {\n if (this.variant === 'destructive') return undefined\n\n switch (this.importance) {\n case 'emphasized':\n case 'subdued': {\n return this.importance\n }\n default: {\n return 'standard'\n }\n }\n }\n\n private get computedSize(): Size | undefined {\n if (this.variant === 'hero') return undefined\n\n switch (this.size) {\n case 'standard':\n case 'small':\n case 'large': {\n return this.size\n }\n default: {\n return 'standard'\n }\n }\n }\n\n private get computedTabIndex(): number {\n const parsedValue = Number.parseInt(\n this.inheritedAttributes.tabindex ?? '0',\n 10,\n )\n return Number.isNaN(parsedValue) ? 0 : parsedValue\n }\n\n @Listen('click')\n protected onClick(event: MouseEvent): void {\n if (this.computedDisabled) {\n event.stopImmediatePropagation()\n return\n }\n\n if (this.buttonType === 'button' || !this.formElement) return\n event.preventDefault()\n\n const fakeButton = document.createElement('button')\n fakeButton.type = this.buttonType\n if (this.name !== undefined) fakeButton.name = this.name\n if (this.value !== undefined) fakeButton.value = this.value\n if (this.formAction !== undefined) fakeButton.formAction = this.formAction\n if (this.formMethod !== undefined) fakeButton.formMethod = this.formMethod\n fakeButton.formNoValidate = this.formNoValidate\n fakeButton.formTarget = this.formTarget\n fakeButton.style.display = 'none'\n\n this.formElement.append(fakeButton)\n fakeButton.click()\n fakeButton.remove()\n }\n\n public componentWillLoad(): void {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n }\n\n public render() {\n const Tag = this.href === undefined ? 'button' : 'a'\n\n return (\n <Tag\n aria-disabled={this.computedDisabled.toString()}\n class={{\n 'qds-button': true,\n 'qds-icon-only': this.iconOnly,\n }}\n data-importance={this.computedImportance}\n data-size={this.computedSize}\n data-variant={this.variant}\n disabled={Tag === 'a' ? undefined : this.disabled}\n download={Tag === 'a' ? this.download : undefined}\n href={Tag === 'a' ? this.href : undefined}\n name={Tag === 'a' ? undefined : this.name}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n rel={Tag === 'a' ? 'noreferrer noopener' : undefined}\n role={Tag === 'a' ? 'button' : undefined}\n tabIndex={this.computedDisabled ? -1 : this.computedTabIndex}\n target={Tag === 'a' ? this.target : undefined}\n type={Tag === 'a' ? undefined : this.buttonType}\n value={Tag === 'a' ? undefined : this.value}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n >\n {this.iconName !== undefined && this.iconName !== '' && (\n <qds-icon\n class=\"qds-icon\"\n data-size={this.computedSize}\n data-variant={this.variant}\n library={this.iconLibrary}\n name={this.iconName}\n />\n )}\n {this.text}\n {this.badge !== undefined && this.badge !== '' && (\n <div\n class=\"qds-badge\"\n data-importance={this.computedImportance}\n data-variant={this.variant}\n >\n {this.badge}\n </div>\n )}\n {this.computedAction !== undefined && (\n <qds-icon\n class=\"qds-icon qds-action\"\n library=\"core\"\n name={this.computedAction}\n />\n )}\n </Tag>\n )\n }\n\n private readonly onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n}\n"],"version":3}
1
+ {"file":"qds-button.js","mappings":";;;;;;;;;AAAA,MAAM,SAAS,GAAG,orTAAorT,CAAC;AACvsT,wBAAe,SAAS;;MC+BX,MAAM;;;;;;;QAiOT,wBAAmB,GAAe,EAAE,CAAA;QA2K3B,WAAM,GAAG,CAAC,KAAiB;YAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;SACvD,CAAA;QAEgB,YAAO,G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AI,CAAC,kBAAkB,eAC7B,IAAI,CAAC,YAAY,kBACd,IAAI,CAAC,OAAO,GAC1B,CACE,EACP;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/button/button.css?tag=qds-button&encapsulation=shadow","src/components/button/button.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2024 Schneider Electric\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n}\n\n.qds-action {\n transform: scaleX(var(--qds-direction-factor, 1));\n}\n\n.qds-container {\n display: grid;\n grid-template-areas: 'button';\n}\n\n.qds-button {\n align-items: center;\n appearance: none;\n background-color: initial;\n border: none;\n border-radius: var(\n --qds-control-border-radius-top-left,\n var(--qds-control-border-radius)\n )\n var(--qds-control-border-radius-top-right, var(--qds-control-border-radius))\n var(\n --qds-control-border-radius-bottom-right,\n var(--qds-control-border-radius)\n )\n var(\n --qds-control-border-radius-bottom-left,\n var(--qds-control-border-radius)\n );\n box-sizing: border-box;\n cursor: pointer;\n display: inline-flex;\n grid-area: button;\n justify-content: center;\n outline: none;\n padding-block: 0;\n print-color-adjust: exact;\n user-select: none;\n white-space: var(--qds-internal-white-space-property, nowrap);\n width: 100%;\n\n &:any-link {\n text-decoration: none;\n }\n}\n\n.qds-focus-ring {\n border-radius: max(\n 1px,\n var(\n --qds-control-border-radius-top-left,\n var(--qds-control-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-top-right,\n var(--qds-control-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-bottom-right,\n var(--qds-control-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-bottom-left,\n var(--qds-control-border-radius)\n )\n );\n grid-area: button;\n isolation: isolate;\n outline: var(--qds-theme-focus-border) solid var(--qds-focus-border-width);\n outline-offset: var(--qds-focus-border-offset);\n pointer-events: none;\n visibility: hidden;\n width: calc(\n 100% + var(--qds-control-border-width) -\n var(\n --qds-control-border-width-inline-end,\n var(--qds-control-border-width)\n )\n );\n height: calc(\n 100% + var(--qds-control-border-width) -\n var(--qds-control-border-width-block-end, var(--qds-control-border-width))\n );\n}\n\n.qds-badge {\n border-radius: var(--qds-control-rounded-border-radius);\n font: var(--qds-badge-text);\n height: var(--qds-badge-height);\n padding-inline: var(--qds-badge-padding-horizontal);\n}\n\n.qds-icon {\n flex-shrink: 0;\n}\n\n[aria-disabled='true'] {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n}\n\n[data-size='small'] {\n font: var(--qds-control-small-text);\n\n &.qds-button {\n gap: var(--qds-control-small-gap-internal);\n height: var(--qds-control-small-height);\n padding-inline: var(--qds-control-button-small-padding-horizontal);\n\n &.qds-icon-only {\n padding-inline: 0;\n width: var(--qds-control-small-height);\n }\n }\n\n &.qds-icon {\n font-size: var(--qds-control-small-icon-size);\n }\n}\n\n[data-size='standard'] {\n font: var(--qds-control-standard-text);\n\n &.qds-button {\n gap: var(--qds-control-standard-gap-internal);\n height: var(--qds-control-standard-height);\n padding-inline: var(--qds-control-button-standard-padding-horizontal);\n\n &.qds-icon-only {\n padding-inline: 0;\n width: var(--qds-control-standard-height);\n }\n }\n\n &.qds-icon {\n font-size: var(--qds-control-standard-icon-size);\n }\n}\n\n[data-size='large'] {\n font: var(--qds-control-large-text);\n\n &.qds-button {\n gap: var(--qds-control-large-gap-internal);\n height: var(--qds-control-large-height);\n padding-inline: var(--qds-control-button-large-padding-horizontal);\n\n &.qds-icon-only {\n padding-inline: 0;\n width: var(--qds-control-large-height);\n }\n }\n\n &.qds-icon {\n font-size: var(--qds-control-large-icon-size);\n }\n}\n\n[data-importance='subdued'] {\n color: var(--qds-theme-link-standard-default);\n\n &.qds-badge {\n background-color: var(--qds-theme-feedback-message-informational);\n color: var(--qds-theme-feedback-message-informational-contrast);\n }\n\n &.qds-button {\n border-block-end: var(--qds-control-border-width) solid transparent;\n padding-inline: 0;\n\n &:hover {\n border-block-end: var(--qds-control-border-width) solid\n var(--qds-theme-link-standard-hover);\n color: var(--qds-theme-link-standard-hover);\n\n .qds-badge {\n background-color: var(--qds-theme-link-standard-hover);\n }\n }\n\n &:active {\n border-block-end: var(--qds-control-border-width) solid\n var(--qds-theme-link-standard-pressed);\n color: var(--qds-theme-link-standard-pressed);\n\n .qds-badge {\n background-color: var(--qds-theme-link-standard-pressed);\n }\n }\n\n &:not(.qds-icon-only) {\n border-radius: 0;\n }\n\n &.qds-icon-only {\n border: none;\n color: var(--qds-theme-control-text-standard);\n\n &:hover {\n background-color: var(--qds-theme-interactive-background-hover);\n }\n\n &:active {\n background-color: var(--qds-theme-interactive-background-pressed);\n }\n }\n }\n}\n\n[data-importance='standard'] {\n color: var(--qds-theme-control-text-standard);\n\n &.qds-badge {\n background-color: var(--qds-theme-feedback-message-neutral);\n color: var(--qds-theme-feedback-message-neutral-contrast);\n }\n\n &.qds-button {\n border-color: var(--qds-theme-control-border);\n border-style: solid;\n border-width: var(--qds-control-border-width)\n var(\n --qds-control-border-width-inline-end,\n var(--qds-control-border-width)\n )\n var(--qds-control-border-width-block-end, var(--qds-control-border-width))\n var(--qds-control-border-width);\n\n &:hover {\n background-color: var(--qds-theme-interactive-background-hover);\n\n .qds-badge {\n color: var(--qds-theme-interactive-background-hover);\n }\n }\n\n &:active {\n background-color: var(--qds-theme-interactive-background-pressed);\n\n .qds-badge {\n color: var(--qds-theme-interactive-background-pressed);\n }\n }\n }\n}\n\n[data-importance='emphasized'] {\n &.qds-badge {\n background-color: var(--qds-theme-signature-color-contrast);\n color: var(--qds-theme-signature-color-default);\n }\n\n &.qds-button {\n background-color: var(--qds-theme-signature-color-default);\n color: var(--qds-theme-signature-color-contrast);\n\n &:hover {\n background-color: var(--qds-theme-signature-color-hover);\n\n .qds-badge {\n color: var(--qds-theme-signature-color-hover);\n }\n }\n\n &:active {\n background-color: var(--qds-theme-signature-color-pressed);\n\n .qds-badge {\n color: var(--qds-theme-signature-color-pressed);\n }\n }\n }\n}\n\n[data-variant='destructive'] {\n &.qds-badge {\n background-color: var(--qds-theme-feedback-action-destructive-contrast);\n color: var(--qds-theme-feedback-action-destructive-default);\n }\n\n &.qds-button {\n background-color: var(--qds-theme-feedback-action-destructive-default);\n color: var(--qds-theme-feedback-action-destructive-contrast);\n\n &:hover {\n background-color: var(--qds-theme-feedback-action-destructive-hover);\n\n .qds-badge {\n color: var(--qds-theme-feedback-action-destructive-hover);\n }\n }\n\n &:active {\n background-color: var(--qds-theme-feedback-action-destructive-pressed);\n\n .qds-badge {\n color: var(--qds-theme-feedback-action-destructive-pressed);\n }\n }\n }\n}\n\n[data-variant='hero'] {\n &.qds-button {\n border-radius: var(\n --qds-control-border-radius-top-left,\n var(--qds-control-hero-border-radius)\n )\n var(\n --qds-control-border-radius-top-right,\n var(--qds-control-hero-border-radius)\n )\n var(\n --qds-control-border-radius-bottom-right,\n var(--qds-control-hero-border-radius)\n )\n var(\n --qds-control-border-radius-bottom-left,\n var(--qds-control-hero-border-radius)\n );\n font: var(--qds-control-hero-text);\n gap: var(--qds-control-hero-gap-internal);\n padding-block: var(--qds-control-hero-padding-auto-height);\n white-space: normal;\n\n &[data-importance='standard'] {\n padding-block: calc(\n var(--qds-control-hero-padding-auto-height) -\n var(\n --qds-control-border-width-block-start,\n var(--qds-control-border-width)\n )\n )\n calc(\n var(--qds-control-hero-padding-auto-height) -\n var(\n --qds-control-border-width-block-end,\n var(--qds-control-border-width)\n )\n );\n }\n\n &:not([data-importance='subdued']) {\n padding-inline: var(--qds-control-button-hero-padding-horizontal);\n }\n\n &.qds-icon-only {\n height: var(--qds-control-hero-height);\n padding: 0;\n width: var(--qds-control-hero-height);\n }\n }\n\n &.qds-focus-ring {\n border-radius: max(\n 1px,\n var(\n --qds-control-border-radius-top-left,\n var(--qds-control-hero-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-top-right,\n var(--qds-control-hero-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-bottom-right,\n var(--qds-control-hero-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-bottom-left,\n var(--qds-control-hero-border-radius)\n )\n );\n }\n\n &.qds-icon {\n font-size: var(--qds-control-hero-icon-size);\n }\n}\n\n.qds-button:focus-visible ~ .qds-focus-ring {\n visibility: visible;\n}\n","// SPDX-FileCopyrightText: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport { Component, Element, Event, h, Listen, Prop } from '@stencil/core'\nimport type { LiteralUnion } from 'type-fest'\n\nimport type { Attributes, QdsFocusEventDetail } from '../../helpers'\nimport { inheritAriaAttributes, pickFocusEventAttributes } from '../../helpers'\nimport type { Importance, Size } from '../shared'\n\nexport type Action = 'dropdown-close' | 'dropdown' | 'next'\nexport type ButtonTarget = '_blank' | '_parent' | '_self' | '_top'\nexport type ButtonType = 'button' | 'reset' | 'submit'\nexport type FormMethod = 'dialog' | 'get' | 'post'\nexport type ButtonVariant = 'destructive' | 'hero'\n\n/**\n * The `<qds-button>` element is an interactive element activated by a user\n * with a mouse, keyboard, finger, voice command, or other assistive technology.\n * Once activated, it then performs a programmable action, such as submitting a\n * [form](https://developer.mozilla.org/docs/Learn/Forms)\n * or opening a dialog.\n *\n * @see https://quartz.se.com/build/components/button\n */\n@Component({\n tag: 'qds-button',\n shadow: { delegatesFocus: true },\n styleUrl: 'button.css',\n})\nexport class Button implements ComponentInterface {\n /**\n * The name of the action icon to render.\n */\n @Prop() public readonly action?: Action\n\n /**\n * The button's badge text.\n */\n @Prop() public readonly badge?: string\n\n /**\n * The name of the icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop() public readonly iconName?: string\n\n /**\n * The name of a registered icon library.\n */\n @Prop() public readonly iconLibrary: string = 'default'\n\n /**\n * The button's importance.\n */\n @Prop() public readonly importance?: Importance = 'standard'\n\n /**\n * The button's size.\n */\n @Prop() public readonly size?: Size = 'standard'\n\n /**\n * The button's text.\n */\n @Prop() public readonly text?: string\n\n /**\n * The button's variant.\n */\n @Prop() public readonly variant?: ButtonVariant\n\n /**\n * Prevents the button from being interacted with: it cannot be pressed or\n * focused.\n *\n * @webnative\n */\n @Prop()\n public readonly disabled?: boolean\n\n /**\n * Tells the browser to download the linked file as this filename. Only used\n * when `href` is set.\n *\n * @webnative\n */\n @Prop() public readonly download?: string\n\n /**\n * The [`<form>`](https://developer.mozilla.org/docs/Web/HTML/Element/form)\n * element to associate the button with (its form owner).\n *\n * The value of this attribute must be the id of a `<form>` in the same\n * document. If this attribute is not set, the `<button>` is associated with\n * its ancestor `<form>` element, if any.\n *\n * This attribute lets you associate `<button>` elements to `<form>`s\n * anywhere in the document, not just inside a `<form>`. It can also override\n * an ancestor `<form>` element.\n *\n * @webnative\n */\n @Prop() public readonly form?: string\n\n /**\n * The URL that processes the information submitted by the button. Overrides\n * the [`action`](https://developer.mozilla.org/docs/Web/HTML/Element/button#attr-formaction)\n * attribute of the button's form owner. Does nothing if there is no form owner.\n *\n * @webnative\n */\n @Prop({ attribute: 'formaction' }) public readonly formAction?: string\n\n /**\n * If the button is a submit button (it's inside/associated with a `<form>`\n * and doesn't have `type=\"button\"`), this attribute specifies the\n * [HTTP method][] used to submit the form, or `dialog` which won't submit\n * the form. Possible values:\n *\n * - `get`: The form data are appended to the form's action URL, with a ? as\n * a separator, and the resulting URL is sent to the server. Use this method\n * when the form has no side effects, like search forms.\n * - `post`: The data from the form are included in the body of the HTTP\n * request when sent to the server. Use when the form contains information\n * that shouldn't be public, like login credentials.\n * - `dialog`: Close the dialog box in which the button finds itself, if any,\n * and do not submit the button's form owner.\n *\n * If specified, this attribute overrides the `method` attribute of the\n * button's form owner.\n *\n * [HTTP method]: https://developer.mozilla.org/docs/Web/HTTP/Methods\n *\n * @webnative\n */\n @Prop({ attribute: 'formmethod' }) public readonly formMethod?: FormMethod\n\n /**\n * If the button is a submit button, this attribute specifies that the form\n * is not to be\n * [validated](https://developer.mozilla.org/docs/Learn/Forms/Form_validation)\n * when it is submitted. If this attribute is specified, it overrides the\n * [`novalidate`](https://developer.mozilla.org/docs/Web/HTML/Element/form#attr-novalidate)\n * attribute of the button's form owner.\n *\n * @webnative\n */\n @Prop({ attribute: 'formnovalidate' })\n public readonly formNoValidate: boolean = false\n\n /**\n * If the button is a submit button, this attribute is an author-defined name\n * or standardized, underscore-prefixed keyword indicating where to display\n * the response from submitting the form. This is the `name` of, or keyword\n * for, a browsing context (a tab, window, or\n * [`<iframe>`](https://developer.mozilla.org/docs/Web/HTML/Element/iframe)).\n * If this attribute is specified, it overrides the\n * [`target`](https://developer.mozilla.org/docs/Web/HTML/Element/form#attr-target)\n * attribute of the button's form owner. The following keywords have special\n * meanings:\n *\n * - `_blank`: Load the response into a new unnamed browsing context — usually\n * a new tab or window, depending on the user's browser settings.\n * - `_parent`: Load the response into the parent browsing context of the\n * current one. If there is no parent, this option behaves the same way as\n * `_self`.\n * - `_self`: Load the response into the same browsing context as the current\n * one.\n * - `_top`: Load the response into the top-level browsing context (that is,\n * the browsing context that is an ancestor of the current one, and has no\n * parent). If there is no parent, this option behaves the same way as\n * `_self`.\n *\n * @webnative\n */\n @Prop({ attribute: 'formtarget' })\n public readonly formTarget: LiteralUnion<ButtonTarget, string> = '_self'\n\n /**\n * When set, the underlying button will be rendered as an `<a>` with this\n * `href` instead of a `<button>`.\n *\n * @webnative\n */\n @Prop() public readonly href?: string\n\n /**\n * The name of the button, submitted as a pair with the button's `value` as\n * part of the form data, when that button is used to submit the form.\n * Ignored when `href` is set.\n *\n * @webnative\n */\n @Prop() public readonly name?: string\n\n /**\n * Where to display the linked URL, as the name for a browsing context (a\n * tab, window, or\n * [`<iframe>`](https://developer.mozilla.org/docs/Web/HTML/Element/iframe).\n * The following keywords have special meanings for where to load the URL:\n *\n * - `_blank`: usually a new tab, but users can configure browsers to open a new\n * window instead.\n * - `_parent`: the parent browsing context of the current one. If no parent,\n * behaves as `_self`.\n * - `_self`: the current browsing context.\n * - `_top`: the topmost browsing context (the \"highest\" context that's an\n * ancestor of the current one). If no ancestors, behaves as `_self`.\n *\n * @webnative\n */\n @Prop() public readonly target?: LiteralUnion<ButtonTarget, string>\n\n /**\n * The type of button.\n *\n * `button`: The button has no default behavior, and does nothing when\n * pressed by default. It can have client-side scripts listen to the\n * element's events, which are triggered when the events occur.\n *\n * `submit`: The button submits the form data to the server. This is the\n * default if the attribute is not specified for buttons associated with a\n * `<form>`, or if the attribute is an empty or invalid value.\n *\n * `reset`: The button resets all the controls to their initial values.\n *\n * @webnative\n */\n @Prop() public readonly type?: ButtonType\n\n /**\n * Defines the value associated with the button's `name` when it's submitted\n * with the form data. This value is passed to the server in params when the\n * form is submitted using this button. Ignored when `href` is set.\n *\n * @webnative\n */\n @Prop() public readonly value?: string\n\n /**\n * Emitted when the button loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the button gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n @Element() private readonly element!: HTMLQdsButtonElement\n\n private inheritedAttributes: Attributes = {}\n\n private get formElement(): HTMLElement | null {\n return this.form !== undefined && this.form !== ''\n ? document.querySelector(`#${this.form}`)\n : this.element.closest('form')\n }\n\n private get buttonType(): ButtonType {\n if (this.type === undefined) return this.formElement ? 'submit' : 'button'\n return this.type\n }\n\n private get iconOnly(): boolean {\n const hasIcon = this.iconName !== undefined && this.iconName !== ''\n const hasNoLabel = this.text === undefined || this.text === ''\n\n return hasIcon && hasNoLabel\n }\n\n private get computedAction(): Action | undefined {\n switch (this.action) {\n case 'dropdown':\n case 'dropdown-close':\n case 'next': {\n return this.action\n }\n default: {\n return undefined\n }\n }\n }\n\n private get computedDisabled(): boolean {\n return this.disabled ?? false\n }\n\n private get computedImportance(): Importance | undefined {\n if (this.variant === 'destructive') return undefined\n\n switch (this.importance) {\n case 'emphasized':\n case 'subdued': {\n return this.importance\n }\n default: {\n return 'standard'\n }\n }\n }\n\n private get computedSize(): Size | undefined {\n if (this.variant === 'hero') return undefined\n\n switch (this.size) {\n case 'standard':\n case 'small':\n case 'large': {\n return this.size\n }\n default: {\n return 'standard'\n }\n }\n }\n\n private get computedTabIndex(): number {\n const parsedValue = Number.parseInt(\n this.inheritedAttributes.tabindex ?? '0',\n 10,\n )\n return Number.isNaN(parsedValue) ? 0 : parsedValue\n }\n\n @Listen('click')\n protected onClick(event: MouseEvent): void {\n if (this.computedDisabled) {\n event.stopImmediatePropagation()\n return\n }\n\n if (this.buttonType === 'button' || !this.formElement) return\n event.preventDefault()\n\n const fakeButton = document.createElement('button')\n fakeButton.type = this.buttonType\n if (this.name !== undefined) fakeButton.name = this.name\n if (this.value !== undefined) fakeButton.value = this.value\n if (this.formAction !== undefined) fakeButton.formAction = this.formAction\n if (this.formMethod !== undefined) fakeButton.formMethod = this.formMethod\n fakeButton.formNoValidate = this.formNoValidate\n fakeButton.formTarget = this.formTarget\n fakeButton.style.display = 'none'\n\n this.formElement.append(fakeButton)\n fakeButton.click()\n fakeButton.remove()\n }\n\n public componentWillLoad(): void {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n }\n\n public render() {\n const Tag = this.href === undefined ? 'button' : 'a'\n\n return (\n <div class=\"qds-container\">\n <Tag\n aria-disabled={this.computedDisabled.toString()}\n class={{\n 'qds-button': true,\n 'qds-icon-only': this.iconOnly,\n }}\n data-importance={this.computedImportance}\n data-size={this.computedSize}\n data-variant={this.variant}\n disabled={Tag === 'a' ? undefined : this.disabled}\n download={Tag === 'a' ? this.download : undefined}\n href={Tag === 'a' ? this.href : undefined}\n name={Tag === 'a' ? undefined : this.name}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n rel={Tag === 'a' ? 'noreferrer noopener' : undefined}\n role={Tag === 'a' ? 'button' : undefined}\n tabIndex={this.computedDisabled ? -1 : this.computedTabIndex}\n target={Tag === 'a' ? this.target : undefined}\n type={Tag === 'a' ? undefined : this.buttonType}\n value={Tag === 'a' ? undefined : this.value}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n >\n {this.iconName !== undefined && this.iconName !== '' && (\n <qds-icon\n class=\"qds-icon\"\n data-size={this.computedSize}\n library={this.iconLibrary}\n name={this.iconName}\n />\n )}\n {this.text}\n {this.badge !== undefined && this.badge !== '' && (\n <div\n class=\"qds-badge\"\n data-importance={this.computedImportance}\n data-variant={this.variant}\n >\n {this.badge}\n </div>\n )}\n {this.computedAction !== undefined && (\n <qds-icon\n class=\"qds-icon qds-action\"\n library=\"core\"\n name={this.computedAction}\n />\n )}\n </Tag>\n <div\n class={{\n 'qds-focus-ring': true,\n 'qds-icon-only': this.iconOnly,\n }}\n data-importance={this.computedImportance}\n data-size={this.computedSize}\n data-variant={this.variant}\n />\n </div>\n )\n }\n\n private readonly onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n}\n"],"version":3}
@@ -147,15 +147,15 @@ const Checkbox = /*@__PURE__*/ proxyCustomElement(class Checkbox extends HTMLEle
147
147
  render() {
148
148
  return (
149
149
  // eslint-disable-next-line jsx-a11y/label-has-associated-control
150
- h("label", { key: 'ef29852daf0e5ccec3ed22af0ce97c8683239a11', "aria-disabled": this.computedDisabled.toString(), class: {
150
+ h("label", { key: '51b4490c588e94b899f25e4d989b53a1b843f696', "aria-disabled": this.computedDisabled.toString(), class: {
151
151
  'qds-inline': this.inline,
152
152
  'qds-label': true,
153
- }, "data-size": this.computedSize }, h("div", { key: 'b8423d8eaa8dab5f880770e48001350559e5f9b7', class: "qds-container" }, h("input", { key: 'bf8c6ad4717bffb1de27e741587203c07912ab1b',
153
+ }, "data-size": this.computedSize }, h("div", { key: '26c716cb00691426e339f0a64019013cccfc5020', class: "qds-container" }, h("input", { key: '5e0f5dc230b56fe3668697828c229de35555b60b',
154
154
  // eslint-disable-next-line jsx-a11y/no-autofocus
155
- autoFocus: this.autoFocus, checked: this.computedIndeterminate ? false : this.checked, class: "qds-checkbox", "data-size": this.computedSize, disabled: this.computedDisabled, indeterminate: this.indeterminate, onBlur: this.onBlur, onFocus: this.onFocus, ref: this.ref, required: this.required, type: "checkbox", ...this.inheritedAttributes }), h("qds-icon", { key: '92da0b70e5eb0ac6e56c59cab72252cb971b8c3c', "aria-hidden": "true", class: {
155
+ autoFocus: this.autoFocus, checked: this.computedIndeterminate ? false : this.checked, class: "qds-checkbox", "data-size": this.computedSize, disabled: this.computedDisabled, indeterminate: this.indeterminate, onBlur: this.onBlur, onFocus: this.onFocus, ref: this.ref, required: this.required, type: "checkbox", ...this.inheritedAttributes }), h("qds-icon", { key: '7a593295e2da79540f1b6cb1a54f448519ddd6e4', "aria-hidden": "true", class: {
156
156
  'qds-icon': true,
157
157
  'qds-checked': true,
158
- }, "data-size": this.computedSize, library: "core", name: "checked" }), h("div", { key: '1c989e04d0a27978553e87b9b7b037c2e99e2c00', class: "qds-box", "data-size": this.computedSize }), h("qds-icon", { key: '2a537455449bc2f57276d83083900a5c748e03e7', "aria-hidden": "true", class: {
158
+ }, "data-size": this.computedSize, library: "core", name: "checked" }), h("div", { key: 'a0c788af92242e023e78372b0fb6c5d2fd66215f', class: "qds-box", "data-size": this.computedSize }), h("qds-icon", { key: '279a028cd8506e2b7047a3be6ed631a47f639c7d', "aria-hidden": "true", class: {
159
159
  'qds-icon': true,
160
160
  'qds-indeterminate': true,
161
161
  }, "data-size": this.computedSize, library: "core", name: "indeterminate" })), this.hasText && (h("qds-label", { required: this.required, size: this.size, text: this.text }))));
@@ -64,7 +64,7 @@ const Dialog = /*@__PURE__*/ proxyCustomElement(class Dialog extends HTMLElement
64
64
  await this.show();
65
65
  }
66
66
  render() {
67
- return (h(Host, { key: 'fe5bf00dbbe9c834e8eafca06129d1e29cbe02c8' }, h("dialog", { key: '0d9c8cca3374f6aa8d70fc6c503d8b23bf7ed143', class: "qds-dialog", ref: this.ref, onSubmit: this.boundSubmit, onCancel: this.onCancel, onClose: this.onClose, ...this.inheritedAttributes }, h("div", { key: '21c1c57a24b1ee97abf65869d375470dc80508c7', class: "qds-content" }, h("slot", { key: '0f8da65cb2d2ed78fe09e6309f2fcc20d54fc439' }))), h("div", { key: '0de62670ebb86eb7cb7ba044171f820dbdcf85cf', class: "qds-backdrop" })));
67
+ return (h(Host, { key: '1c9e74771def22f22c952d7b0e54d1da70b8eddf' }, h("dialog", { key: '0d7eb32d2d8fa28c48e103030666cbb72b891d81', class: "qds-dialog", ref: this.ref, onSubmit: this.boundSubmit, onCancel: this.onCancel, onClose: this.onClose, ...this.inheritedAttributes }, h("div", { key: 'a48ab0d3e78cebdab45828f7c75eabd0a033d13d', class: "qds-content" }, h("slot", { key: '48362820234c381014bdc4cd73fd228cf647d7be' }))), h("div", { key: '53c2bebe31768c6b0d864d4fdae17a5e985de12d', class: "qds-backdrop" })));
68
68
  }
69
69
  async handleSubmit(event) {
70
70
  if ((event instanceof SubmitEvent &&
@@ -31,7 +31,7 @@ const Divider = /*@__PURE__*/ proxyCustomElement(class Divider extends HTMLEleme
31
31
  this.inheritedAttributes = inheritAriaAttributes(this.element);
32
32
  }
33
33
  render() {
34
- return (h("hr", { key: '3faebcac85daf88818c13a679fe409c809d11024', class: "qds-divider", "data-importance": this.computedImportance, ...this.inheritedAttributes }));
34
+ return (h("hr", { key: '6c553a48c21d1a85b1c68c24c9ca30330a58a18e', class: "qds-divider", "data-importance": this.computedImportance, ...this.inheritedAttributes }));
35
35
  }
36
36
  get element() { return this; }
37
37
  static get style() { return QdsDividerStyle0; }
@@ -162,11 +162,11 @@ const Dropdown = /*@__PURE__*/ proxyCustomElement(class Dropdown extends HTMLEle
162
162
  this.disconnectReferenceElement();
163
163
  }
164
164
  render() {
165
- return (h(Host, { key: 'b83de94628d4de15bae684dd5d49b20a95e68c3b', "aria-labelledby": this.hostAriaLabelledBy, onKeyDown: this.boundEscape, onFocusout: this.boundFocusout, style: {
165
+ return (h(Host, { key: '9ab053f73492f32be45e32d7f4ed28a343a8eb9a', "aria-labelledby": this.hostAriaLabelledBy, onKeyDown: this.boundEscape, onFocusout: this.boundFocusout, style: {
166
166
  display: this.hostDisplay,
167
167
  position: this.hostPosition,
168
168
  transform: this.hostTransform,
169
- } }, h("slot", { key: '7fa8767b0f3007f27c428c0c4ec9d6720651c261' })));
169
+ } }, h("slot", { key: 'ab10e56c3ad0b94360089280c7b2213fcf4e97c2' })));
170
170
  }
171
171
  async handleFocusout(event) {
172
172
  if (!(event instanceof FocusEvent))
@@ -40,10 +40,10 @@ const FormMessage = /*@__PURE__*/ proxyCustomElement(class FormMessage extends H
40
40
  this.inheritedAttributes = inheritAriaAttributes(this.element);
41
41
  }
42
42
  render() {
43
- return (h("span", { key: '85694e0e49c538659f466ff312604f468d7d2ae4', class: {
43
+ return (h("span", { key: '6b634984cd3f4ed3ca09ecce1f05a569fb38201d', class: {
44
44
  'qds-form-message': true,
45
45
  'qds-inline': this.inline,
46
- }, "data-size": this.computedSize, ...this.inheritedAttributes }, h("div", { key: 'e7f28bfe9ee24ef73de72d640a5615b8592f8f12', class: "qds-icon-container", "data-size": this.computedSize }, h("div", { key: 'f289508aba25cd396c47f983b04d203d818df5b1', class: "qds-icon-background", "data-size": this.computedSize, "data-status": this.status }, h("qds-icon", { key: '3c8e556732cea1f728a6f02113b4351f138f7f50', class: "qds-icon", "data-size": this.computedSize, name: `status-${this.status}`, library: "core" }))), h("span", { key: 'f802e90e48076eb984518948b59b890152a414ce', class: "qds-text", "data-status": this.computedStatus }, this.text)));
46
+ }, "data-size": this.computedSize, ...this.inheritedAttributes }, h("div", { key: '4bfcbd4a6a2f6775b8720ec9104492490c68f192', class: "qds-icon-container", "data-size": this.computedSize }, h("div", { key: '37e13931960421d1603f11fa867e2305b14475d9', class: "qds-icon-background", "data-size": this.computedSize, "data-status": this.status }, h("qds-icon", { key: '5c594b0039482afb986f9d6d88da81455e112b9e', class: "qds-icon", "data-size": this.computedSize, name: `status-${this.status}`, library: "core" }))), h("span", { key: 'ad85768d668c36ddff08d06e11ab0789e8dd5da6', class: "qds-text", "data-status": this.computedStatus }, this.text)));
47
47
  }
48
48
  get element() { return this; }
49
49
  static get style() { return QdsFormMessageStyle0; }
@@ -59,7 +59,7 @@ const InlineLink = /*@__PURE__*/ proxyCustomElement(class InlineLink extends HTM
59
59
  };
60
60
  }
61
61
  render() {
62
- return (h("a", { key: '49b9db516d7053efc083c1d2426a3ae77044d6d0', "aria-disabled": this.disabled.toString(), class: "qds-inline-link", "data-importance": this.computedImportance, download: this.download, href: this.href, hrefLang: this.hreflang, onBlur: this.onBlur, onFocus: this.onFocus, referrerPolicy: this.referrerPolicy, rel: this.rel, target: this.target, ...this.inheritedAttributes, tabIndex: this.disabled ? -1 : this.computedTabIndex }, h("slot", { key: '9eca6dfeaf9dfc377f188e25f526e4657538c2fd' }), h("qds-icon", { key: '65f897f637c02216a2ddae3227e9551e623758a9', class: "qds-external", library: "core", name: "external-link" })));
62
+ return (h("a", { key: 'cad1edcca7c22fe41f3d6a1428d59527e458278d', "aria-disabled": this.disabled.toString(), class: "qds-inline-link", "data-importance": this.computedImportance, download: this.download, href: this.href, hrefLang: this.hreflang, onBlur: this.onBlur, onFocus: this.onFocus, referrerPolicy: this.referrerPolicy, rel: this.rel, target: this.target, ...this.inheritedAttributes, tabIndex: this.disabled ? -1 : this.computedTabIndex }, h("slot", { key: '42e54b814965fbaa50f6c1427eb96011305a83f8' }), h("qds-icon", { key: 'd9acaf816c495e9318ecf0c85bb2842cbe87b461', class: "qds-external", library: "core", name: "external-link" })));
63
63
  }
64
64
  static get delegatesFocus() { return true; }
65
65
  get element() { return this; }
@@ -7,7 +7,7 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
7
7
  import { p as pickFocusEventAttributes, c as invariant, e as pickInputEventAttributes, i as inheritAriaAttributes, a as inheritAttributes } from './helpers.js';
8
8
  import { C as CUSTOM_ERROR_FLAGS, N as NO_ERROR_FLAGS, V as VALID_STATE } from './controls.js';
9
9
 
10
- const inputCss = ":host([hidden]){display:none !important}:host{display:inline-block}.qds-input{-webkit-appearance:textfield;appearance:textfield;background-color:var(--qds-theme-control-input-background);border-radius:var(--qds-control-border-radius);border:var(--qds-control-border-width) solid var(--qds-theme-control-border);box-sizing:border-box;color:var(--qds-theme-control-text-standard);padding-block:0;padding-inline:var(--qds-control-input-padding-horizontal);width:100%}.qds-input[aria-invalid='true']:not(:focus){border-color:var(--qds-theme-feedback-result-failure)}.qds-input[type='color']{-webkit-appearance:none;appearance:none;min-width:50px;padding-block:var(--qds-control-input-padding-horizontal);cursor:pointer}.qds-input[type='color']::-webkit-color-swatch-wrapper{padding:0}.qds-input[type='color']::-webkit-color-swatch{border:var(--qds-control-border-width) solid\n var(--qds-theme-control-border);border-radius:var(--qds-control-border-radius)}.qds-input[type='color']::-moz-color-swatch{border:var(--qds-control-border-width) solid\n var(--qds-theme-control-border);border-radius:var(--qds-control-border-radius)}.qds-input[type='color']:hover{background-color:var(--qds-theme-interactive-background-hover)}.qds-input[type='color']:active{background-color:var(--qds-theme-interactive-background-pressed)}.qds-input:disabled{opacity:var(--qds-theme-disabled);pointer-events:none}.qds-input:focus-visible{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}.qds-input:placeholder-shown{color:var(--qds-theme-control-text-placeholder)}[data-size='small']{font:var(--qds-control-small-text);height:var(--qds-control-small-height)}[data-size='standard']{font:var(--qds-control-standard-text);height:var(--qds-control-standard-height)}[data-size='large']{font:var(--qds-control-large-text);height:var(--qds-control-large-height)}";
10
+ const inputCss = ":host([hidden]){display:none !important}:host{display:inline-block}.qds-container{display:grid;grid-template-areas:'input'}.qds-input{-webkit-appearance:textfield;appearance:textfield;background-color:var(--qds-theme-control-input-background);border-color:var(--qds-theme-control-border);border-radius:var(\n --qds-control-border-radius-top-left,\n var(--qds-control-border-radius)\n )\n var(--qds-control-border-radius-top-right, var(--qds-control-border-radius))\n var(\n --qds-control-border-radius-bottom-right,\n var(--qds-control-border-radius)\n )\n var(\n --qds-control-border-radius-bottom-left,\n var(--qds-control-border-radius)\n );border-style:solid;border-width:var(--qds-control-border-width)\n var(--qds-control-border-width-inline-end, var(--qds-control-border-width))\n var(--qds-control-border-width-block-end, var(--qds-control-border-width))\n var(--qds-control-border-width);box-sizing:border-box;color:var(--qds-theme-control-text-standard);grid-area:input;padding-block:0;padding-inline:var(--qds-control-input-padding-horizontal)}.qds-input[aria-invalid='true']:not(:focus){border-color:var(--qds-theme-feedback-result-failure)}.qds-input[type='color']{-webkit-appearance:none;appearance:none;min-width:50px;padding-block:var(--qds-control-input-padding-horizontal);cursor:pointer}.qds-input[type='color']::-webkit-color-swatch-wrapper{padding:0}.qds-input[type='color']::-webkit-color-swatch{border:var(--qds-control-border-width) solid\n var(--qds-theme-control-border);border-radius:var(--qds-control-border-radius)}.qds-input[type='color']::-moz-color-swatch{border:var(--qds-control-border-width) solid\n var(--qds-theme-control-border);border-radius:var(--qds-control-border-radius)}.qds-input[type='color']:hover{background-color:var(--qds-theme-interactive-background-hover)}.qds-input[type='color']:active{background-color:var(--qds-theme-interactive-background-pressed)}.qds-input:disabled{opacity:var(--qds-theme-disabled);pointer-events:none}.qds-input:focus-visible{outline:none}.qds-input:placeholder-shown{color:var(--qds-theme-control-text-placeholder)}.qds-focus-ring{border-radius:max(\n 1px,\n var(\n --qds-control-border-radius-top-left,\n var(--qds-control-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-top-right,\n var(--qds-control-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-bottom-right,\n var(--qds-control-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-bottom-left,\n var(--qds-control-border-radius)\n )\n );grid-area:input;isolation:isolate;outline:var(--qds-control-input-focus-border-width) solid\n var(--qds-theme-control-input-focus-border);pointer-events:none;visibility:hidden;width:calc(\n 100% + var(--qds-control-border-width) -\n var(\n --qds-control-border-width-inline-end,\n var(--qds-control-border-width)\n )\n );height:calc(\n 100% + var(--qds-control-border-width) -\n var(--qds-control-border-width-block-end, var(--qds-control-border-width))\n )}[data-size='small']{font:var(--qds-control-small-text);height:var(--qds-control-small-height)}[data-size='standard']{font:var(--qds-control-standard-text);height:var(--qds-control-standard-height)}[data-size='large']{font:var(--qds-control-large-text);height:var(--qds-control-large-height)}.qds-input:focus-visible~.qds-focus-ring{visibility:visible}";
11
11
  const QdsInputStyle0 = inputCss;
12
12
 
13
13
  const Input = /*@__PURE__*/ proxyCustomElement(class Input extends HTMLElement {
@@ -201,6 +201,16 @@ const Input = /*@__PURE__*/ proxyCustomElement(class Input extends HTMLElement {
201
201
  if (this.computedDisabled)
202
202
  event.stopImmediatePropagation();
203
203
  }
204
+ handleKeyDown(event) {
205
+ if (this.computedDisabled) {
206
+ event.stopImmediatePropagation();
207
+ return;
208
+ }
209
+ if (event.key === 'Enter' && this.internals.form) {
210
+ this.internals.form.requestSubmit();
211
+ event.preventDefault();
212
+ }
213
+ }
204
214
  componentWillLoad() {
205
215
  this.defineGetter('form', () => this.internals.form);
206
216
  this.defineGetter('willValidate', () => this.internals.willValidate);
@@ -230,9 +240,9 @@ const Input = /*@__PURE__*/ proxyCustomElement(class Input extends HTMLElement {
230
240
  this.selectionEnd = this.input.selectionEnd;
231
241
  }
232
242
  render() {
233
- return (h("input", { key: '0dc3596cab76eb33750288fa73a0ca341aa2d7cb', "aria-invalid": this.element.matches(':invalid').toString(), autoCapitalize: this.autoCapitalize, autoComplete: this.autoComplete,
243
+ return (h("div", { key: 'f3f9189479b8cca58be1240504da4edb6cf1cd94', class: "qds-container" }, h("input", { key: '6f6a7852a3e50c0447ca04004a40ffcdc27a5973', "aria-invalid": this.element.matches(':invalid').toString(), autoCapitalize: this.autoCapitalize, autoComplete: this.autoComplete,
234
244
  // eslint-disable-next-line jsx-a11y/no-autofocus
235
- autoFocus: this.autoFocus, class: "qds-input", "data-size": this.computedSize, disabled: this.disabled, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, max: this.max, maxLength: this.maxLength, min: this.min, minLength: this.minLength, multiple: this.multiple, onBlur: this.onBlur, onChange: this.onChange, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: this.ref, spellcheck: this.spellCheck, step: this.step, type: this.type, ...this.inheritedAttributes }));
245
+ autoFocus: this.autoFocus, class: "qds-input", "data-size": this.computedSize, disabled: this.disabled, enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, max: this.max, maxLength: this.maxLength, min: this.min, minLength: this.minLength, multiple: this.multiple, onBlur: this.onBlur, onChange: this.onChange, onFocus: this.onFocus, onInput: this.onInput, placeholder: this.placeholder, ref: this.ref, spellcheck: this.spellCheck, step: this.step, type: this.type, ...this.inheritedAttributes }), h("div", { key: 'd57f6bb97c3dee7b5b9b8737bdb0e58daf3f2d29', class: "qds-focus-ring" })));
236
246
  }
237
247
  defineGetter(p, get) {
238
248
  Object.defineProperty(this.element, p, { enumerable: true, get });
@@ -287,7 +297,7 @@ const Input = /*@__PURE__*/ proxyCustomElement(class Input extends HTMLElement {
287
297
  "value": [1032],
288
298
  "willValidate": [4, "will-validate"],
289
299
  "inheritedAttributes": [32]
290
- }, [[0, "click", "onClick"]], {
300
+ }, [[0, "click", "onClick"], [0, "keydown", "handleKeyDown"]], {
291
301
  "disabled": ["disabledChanged"],
292
302
  "selectionDirection": ["selectionDirectionChanged"],
293
303
  "selectionEnd": ["selectionEndChanged"],
@@ -1 +1 @@
1
- {"file":"qds-input.js","mappings":";;;;;;;;;AAAA,MAAM,QAAQ,GAAG,63DAA63D,CAAC;AAC/4D,uBAAe,QAAQ;;MCoEV,KAAK;;;;;;;;;;QAwlBC,QAAG,GAAG,CAAC,KAAwB;YAC9C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;SACnB,CAAA;QAEg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yBO,YAAY,CAAC,CAAc,EAAE,GAAkB;QACrD,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAA;KAClE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/input/input.css?tag=qds-input&encapsulation=shadow","src/components/input/input.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2024 Schneider Electric\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n}\n\n.qds-input {\n appearance: textfield;\n background-color: var(--qds-theme-control-input-background);\n border-radius: var(--qds-control-border-radius);\n border: var(--qds-control-border-width) solid var(--qds-theme-control-border);\n box-sizing: border-box;\n color: var(--qds-theme-control-text-standard);\n padding-block: 0;\n padding-inline: var(--qds-control-input-padding-horizontal);\n width: 100%;\n\n &:not(:focus)[aria-invalid='true'] {\n border-color: var(--qds-theme-feedback-result-failure);\n }\n\n &[type='color'] {\n appearance: none;\n min-width: 50px;\n padding-block: var(--qds-control-input-padding-horizontal);\n\n &::-webkit-color-swatch-wrapper {\n padding: 0;\n }\n\n &::-webkit-color-swatch {\n border: var(--qds-control-border-width) solid\n var(--qds-theme-control-border);\n border-radius: var(--qds-control-border-radius);\n }\n\n &::-moz-color-swatch {\n border: var(--qds-control-border-width) solid\n var(--qds-theme-control-border);\n border-radius: var(--qds-control-border-radius);\n }\n\n cursor: pointer;\n\n &:hover {\n background-color: var(--qds-theme-interactive-background-hover);\n }\n\n &:active {\n background-color: var(--qds-theme-interactive-background-pressed);\n }\n }\n\n &:disabled {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n }\n\n &:focus-visible {\n outline: var(--qds-theme-focus-border) solid var(--qds-focus-border-width);\n outline-offset: var(--qds-focus-border-offset);\n }\n\n &:placeholder-shown {\n color: var(--qds-theme-control-text-placeholder);\n }\n}\n\n[data-size='small'] {\n font: var(--qds-control-small-text);\n height: var(--qds-control-small-height);\n}\n\n[data-size='standard'] {\n font: var(--qds-control-standard-text);\n height: var(--qds-control-standard-height);\n}\n\n[data-size='large'] {\n font: var(--qds-control-large-text);\n height: var(--qds-control-large-height);\n}\n","// SPDX-FileCopyrightText: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport {\n AttachInternals,\n Component,\n Element,\n Event,\n h,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core'\n\nimport type {\n Attributes,\n QdsFocusEventDetail,\n QdsInputEventDetail,\n} from '../../helpers'\nimport {\n inheritAriaAttributes,\n inheritAttributes,\n invariant,\n pickFocusEventAttributes,\n pickInputEventAttributes,\n} from '../../helpers'\nimport type {\n AutoCapitalize,\n AutoComplete,\n EnterKeyHint,\n InputMode,\n Value,\n} from '../controls'\nimport { CUSTOM_ERROR_FLAGS, NO_ERROR_FLAGS, VALID_STATE } from '../controls'\nimport type { Size } from '../shared'\n\nexport type InputType =\n | 'color'\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'month'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'text'\n | 'time'\n | 'url'\n | 'week'\n\n/**\n * The `<qds-input>` element is used to create interactive controls for\n * web-based forms in order to accept data from the user; a wide variety of\n * types of input data and control widgets are available, depending on the\n * device and\n * [user agent](https://developer.mozilla.org/docs/Glossary/User_agent).\n *\n * @see https://quartz.se.com/build/components/input\n */\n@Component({\n tag: 'qds-input',\n formAssociated: true,\n shadow: { delegatesFocus: true },\n styleUrl: 'input.css',\n})\nexport class Input implements ComponentInterface {\n /**\n * The input's size.\n *\n * > **_NOTE:_** The native [`size` HTML attribute][size] is not supported.\n * CSS `width` should be used instead if this functionality is needed.\n *\n * [size]: https://developer.mozilla.org/docs/Web/HTML/Attributes/size\n */\n @Prop() public readonly size?: Size = 'standard'\n\n /**\n * Controls whether and how input is automatically capitalized as it is\n * entered/edited by the user. Only valid for `search`, `tel`, and `text`\n * inputs. Possible values:\n *\n * - `\"off\"` or `\"none\"`: No auto-capitalization is applied (all letters\n * default to lowercase).\n * - `\"on\"` or `\"sentences\"`: The first letter of each sentence defaults to a\n * capital letter; all other letters default to lowercase.\n * - `\"words\"`: The first letter of each word defaults to a capital letter;\n * all other letters default to lowercase.\n * - `\"characters\"`: All letters default to uppercase.\n *\n * @webnative\n */\n @Prop({ attribute: 'autocapitalize' })\n public readonly autoCapitalize?: AutoCapitalize\n\n /**\n * Provides a hint for a [user agent's][] autocomplete feature. See\n * [the HTML `autocomplete` attribute][autocomplete] for a complete list of\n * values and details on how to use `autoComplete`.\n *\n * [user agent's]: https://developer.mozilla.org/docs/Glossary/User_agent\n * [autocomplete]: https://developer.mozilla.org/docs/Web/HTML/Attributes/autocomplete\n *\n * @webnative\n */\n @Prop({ attribute: 'autocomplete' })\n public readonly autoComplete?: AutoComplete\n\n /**\n * Specify whether the input should have focus when the page loads.\n *\n * @webnative\n */\n @Prop({ attribute: 'autofocus' }) public readonly autoFocus?: boolean\n\n /**\n * Prevents the input from being interacted with: it cannot be pressed or\n * focused.\n *\n * @webnative\n */\n @Prop() public readonly disabled?: boolean\n\n /**\n * What action label (or icon) to present for the enter key on virtual\n * keyboards. Possible values:\n *\n * - `\"done\"`: Typically meaning there is nothing more to input and the input\n * method editor (IME) will be closed.\n * - `\"enter\"`:\tTypically inserting a new line.\n * - `\"go\"`: \tTypically meaning to take the user to the target of the text\n * they typed.\n * - `\"next\"`: \tTypically taking the user to the next field that will accept\n * text.\n * - `\"previous\"`: Typically taking the user to the previous field that will\n * accept text.\n * - `\"search\"`: Typically taking the user to the results of searching for\n * the text they have typed.\n * - `\"send\"`: Typically delivering the text to its target.\n *\n * @webnative\n */\n // FIXME: Can't use `attribute` option here to name this `enterKeyHint` instead.\n @Prop() public readonly enterkeyhint?: EnterKeyHint\n\n /**\n * The [`<form>`][] element to associate the input with (its form owner).\n *\n * The value of this attribute must be the id of a `<form>` in the same\n * document. If this attribute is not set, the `<qds-input>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This attribute lets you associate `<qds-input>` elements to `<form>`s\n * anywhere in the document, not just inside a `<form>`. It can also override\n * an ancestor `<form>` element.\n *\n * [`<form>`]: https://developer.mozilla.org/docs/Web/HTML/Element/form\n *\n * @readonly\n * @webnative\n */\n // eslint-disable-next-line unicorn/no-null\n @Prop() public readonly form: ElementInternals['form'] | string = null\n\n /**\n * Provide a hint to browsers as to the type of virtual keyboard\n * configuration to use when editing this element or its contents.\n *\n * @webnative\n */\n // FIXME: Can't use `attribute` option here to name this `inputMode` instead.\n @Prop() public readonly inputmode?: InputMode\n\n /**\n * Returns a list of the [`<label>`][] elements associated with the\n * `qds-input` element.\n *\n * [`<label>`]: https://developer.mozilla.org/docs/Web/HTML/Element/label\n *\n * @readonly\n * @webnative\n */\n // eslint-disable-next-line unicorn/no-null\n @Prop() public readonly labels: HTMLInputElement['labels'] = null\n\n /**\n * Defines the greatest value in the range of permitted values. If the\n * `value` entered into the input exceeds this, the input fails\n * [constraint validation][]. Only valid for `date`, `datetime-local`,\n * `month`, `time`, and `week` inputs.\n *\n * If this value isn't a valid number, then the input has no maximum value.\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n *\n * @webnative\n */\n @Prop() public readonly max?: number | string\n\n /**\n * The maximum number of characters (as UTF-16 code units) the user can enter\n * into the input. This must be an non-negative integer value. If no\n * `maxlength` is specified, or an invalid value is specified, the input has\n * no maximum length. Only valid for `email`, `password`, `search`, `tel`,\n * `text`, and `url` inputs.\n *\n * The input will fail [constraint validation][] if the length of the text\n * entered into the field is greater than `maxlength` UTF-16 code units long.\n * By default, browsers prevent users from entering more characters than\n * allowed by the `maxlength` attribute. See [Client-side validation][] for\n * more information.\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n * [Client-side validation]: https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation\n *\n * @webnative\n */\n @Prop({ attribute: 'maxlength' }) public readonly maxLength?: number\n\n /**\n * Defines the most negative value in the range of permitted values. If the\n * `value` entered into the input is less than this, the input fails\n * [constraint validation][]. Only valid for `date`, `datetime-local`,\n * `month`, `time`, and `week` inputs.\n *\n * This value must be less than or equal to the value of the `max` attribute.\n * If this value isn't a valid number, then the input has no minimum value.\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n *\n * @webnative\n */\n @Prop() public readonly min?: number | string\n\n /**\n * The minimum number of characters (as UTF-16 code units) the user can enter\n * into the input. This must be an non-negative integer value smaller than or\n * equal to the value specified by `maxlength`. If no `minlength` is\n * specified, or an invalid value is specified, the input has no minimum\n * length. Only valid for `email`, `password`, `search`, `tel`, `text`, and\n * `url` inputs.\n *\n * The input will fail [constraint validation][] if the length of the text\n * entered into the field is fewer than `minlength` UTF-16 code units long,\n * preventing form submission. See [Client-side validation][] for more\n * information.\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n * [Client-side validation]: https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation\n *\n * @webnative\n */\n @Prop({ attribute: 'minlength' }) public readonly minLength?: number\n\n /**\n * Specifies if multiple comma-separated email addresses can be entered. Only\n * valid for `email` inputs.\n *\n * @webnative\n */\n @Prop() public readonly multiple?: boolean\n\n /**\n * The name of the input, which is submitted with the form data.\n *\n * @webnative\n */\n @Prop() public readonly name?: string\n\n /**\n * Defines a regular expression that the input's `value` must match in order\n * for the value to pass [constraint validation][]. It must be a valid\n * JavaScript regular expression, as used by the [`RegExp`][] type, and as\n * documented in MDN's [guide on regular expressions][]; the `'u'` flag is\n * specified when compiling the regular expression, so that the pattern is\n * treated as a sequence of Unicode code points, instead of as ASCII. No\n * forward slashes should be specified around the pattern text. Only valid\n * for `email`, `password`, `search`, `tel`, `text`, and `url` inputs.\n *\n * If the `pattern` is invalid, no regular expression is applied and this\n * property is ignored. If the pattern is valid and a non-empty value does\n * not match the pattern, constraint validation will prevent form submission.\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n * [`RegExp`]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp\n * [guide on regular expressions]: https://developer.mozilla.org/docs/Web/JavaScript/Guide/Regular_Expressions\n *\n * @webnative\n */\n @Prop() public readonly pattern?: string\n\n /**\n * Text that appears in the input when it has no value set. Only valid for\n * `email`, `number`, `password`, `search`, `tel`, `text`, and `url` inputs.\n *\n * @webnative\n */\n @Prop() public readonly placeholder?: string\n\n /**\n * A value must be specified for the input before the owning form can be\n * submitted. Not valid for `color` inputs.\n *\n * See [Client-side validation][] and the\n * [HTML attribute: `required`][required] for more information.\n *\n * [Client-side validation]: https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation\n * [required]: https://developer.mozilla.org/docs/Web/HTML/Attributes/required\n *\n * @webnative\n */\n @Prop() public readonly required?: boolean\n\n /**\n * Get or set the selection direction of a text selection.\n *\n * > **_NOTE:_** This property has no effect when used as an attribute.\n *\n * @webnative\n */\n @Prop({ mutable: true })\n // eslint-disable-next-line unicorn/no-null\n public selectionDirection: HTMLInputElement['selectionDirection'] = null\n\n /**\n * Get or set the ending position or offset of a text selection.\n *\n * > **_NOTE:_** This property has no effect when used as an attribute.\n *\n * @webnative\n */\n @Prop({ mutable: true })\n // eslint-disable-next-line unicorn/no-null\n public selectionEnd: HTMLInputElement['selectionEnd'] = null\n\n /**\n * Get or set the starting position or offset of a text selection.\n *\n * > **_NOTE:_** This property has no effect when used as an attribute.\n *\n * @webnative\n */\n @Prop({ mutable: true })\n // eslint-disable-next-line unicorn/no-null\n public selectionStart: HTMLInputElement['selectionStart'] = null\n\n /**\n * Defines whether the input may be checked for spelling errors.\n *\n * @webnative\n */\n @Prop({ attribute: 'spellcheck' }) public readonly spellCheck?: boolean\n\n /**\n * Specifies the granularity that the `value` must adhere to. Only valid for\n * `date`, `datetime-local`, `month`, `number`, `time`, and `week` inputs.\n *\n * The value must be a positive number—integer or float—or the special value\n * `any`, which means no stepping is implied, and any value is allowed\n * (barring other constraints, such as `min` and `max`).\n *\n * If `any` is not explicitly set, valid values for the `number` are the\n * basis for stepping — the `min` value and increments of the step value, up\n * to the `max` value, if specified.\n *\n * @webnative\n */\n @Prop() public readonly step?: number | 'any'\n\n /**\n * The type of input to render:\n *\n * - `\"date\"`: An input for entering a date (year, month, and day, with no\n * time). Opens a date picker or numeric wheels for year, month, day when\n * active in supporting browsers.\n * - `\"datetime-local\"`: An input for entering a date and time, with no time\n * zone. Opens a date picker or numeric wheels for date and time components\n * when active in supporting browsers.\n * - `\"email\"`: An input for editing an email address. Looks like a `\"text\"`\n * input, but has validation parameters and relevant keyboard in supporting\n * browsers and devices with dynamic keyboards.\n * - `\"month\"`: An input for entering a month and year, with no time zone.\n * - `\"number\"`: An input for entering a number. Displays a spinner and adds\n * default validation when supported. Displays a numeric keypad in some\n * devices with dynamic keypads.\n * - `\"password\"`: A single-line text input whose value is obscured. Will\n * alert user if site is not secure.\n * - `\"search\"`: A single-line text input for entering search strings.\n * Line-breaks are automatically removed from the input value. May include a\n * delete icon in supporting browsers that can be used to clear the input.\n * Displays a search icon instead of enter key on some devices with dynamic\n * keypads.\n * - `\"tel\"`: An input for entering a telephone number. Displays a telephone\n * keypad in some devices with dynamic keypads.\n * - `\"text\"`: A single-line text input. Line-breaks are automatically\n * removed from the input value.\n * - `\"time\"`: An input for entering a time value with no time zone.\n * - `\"url\"`: An input for entering a URL. Looks like a `\"text\"` input, but\n * has validation parameters and relevant keyboard in supporting browsers and\n * devices with dynamic keyboards.\n * - `\"week\"`: An input for entering a date consisting of a week-year number\n * and a week number with no time zone.\n *\n * @webnative\n */\n @Prop() public readonly type?: InputType\n\n /**\n * The error message that would be shown to the user if the `<qds-select>`\n * was to be checked for validity.\n *\n * @readonly\n * @webnative\n */\n @Prop()\n public readonly validationMessage: ElementInternals['validationMessage'] = ''\n\n /**\n * The [`ValidityState`][] object for this `<qds-select>`.\n *\n * [`ValidityState`]: https://developer.mozilla.org/docs/Web/API/ValidityState\n *\n * @readonly\n * @webnative\n */\n @Prop() public readonly validity: ElementInternals['validity'] = VALID_STATE\n\n /**\n * The value of the input.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public value?: Value\n\n /**\n * True if `<qds-input>` will be validated when the form is submitted; false\n * otherwise.\n *\n * @readonly\n * @webnative\n */\n @Prop() public readonly willValidate: ElementInternals['willValidate'] = false\n\n @AttachInternals() private readonly internals!: ElementInternals\n\n /**\n * Emitted when the input loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when an alteration to the input's value is committed by the user.\n */\n @Event({ eventName: 'qdsChange', cancelable: false })\n private readonly changeEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the input gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the input's value changes.\n */\n @Event({ eventName: 'qdsInput', cancelable: false })\n private readonly inputEmitter!: EventEmitter<QdsInputEventDetail>\n\n @Element() private readonly element!: HTMLQdsInputElement\n\n @State() private inheritedAttributes: Attributes = {}\n\n private savedTabindex?: string\n\n private input?: HTMLInputElement\n\n private get computedDisabled(): boolean {\n return this.element.matches(':disabled') || (this.disabled ?? false)\n }\n\n private get computedSize(): Size {\n switch (this.size) {\n case 'standard':\n case 'small':\n case 'large': {\n return this.size\n }\n default: {\n return 'standard'\n }\n }\n }\n\n private get computedValue(): Parameters<ElementInternals['setFormValue']>[0] {\n if (typeof this.value === 'number') return this.value.toString()\n // eslint-disable-next-line unicorn/no-null\n return this.value === undefined ? null : this.value\n }\n\n @Watch('disabled')\n protected disabledChanged(): void {\n if (this.computedDisabled) {\n this.savedTabindex = this.inheritedAttributes.tabindex\n this.inheritedAttributes = {\n ...this.inheritedAttributes,\n tabindex: undefined,\n }\n // eslint-disable-next-line unicorn/no-null\n this.internals.setFormValue(null)\n } else {\n this.inheritedAttributes = {\n ...this.inheritedAttributes,\n tabindex: this.savedTabindex,\n }\n this.internals.setFormValue(this.computedValue)\n }\n }\n\n @Watch('selectionDirection')\n protected selectionDirectionChanged(): void {\n invariant(this.input)\n\n this.input.selectionDirection = this.selectionDirection\n }\n\n @Watch('selectionEnd')\n protected selectionEndChanged(): void {\n invariant(this.input)\n\n this.input.selectionEnd = this.selectionEnd\n }\n\n @Watch('selectionStart')\n protected selectionStartChanged(): void {\n invariant(this.input)\n\n this.input.selectionStart = this.selectionStart\n }\n\n @Watch('tabindex')\n protected tabindexChanged(newValue: string): void {\n if (this.computedDisabled) this.savedTabindex = newValue\n else\n this.inheritedAttributes = {\n ...this.inheritedAttributes,\n tabindex: newValue,\n }\n }\n\n @Watch('max')\n @Watch('maxLength')\n @Watch('min')\n @Watch('minLength')\n @Watch('pattern')\n @Watch('required')\n @Watch('step')\n @Watch('type')\n @Watch('value')\n protected validationChanged(): void {\n invariant(this.input)\n\n if (this.input.max !== this.max && this.max !== undefined)\n this.input.max = this.max.toString()\n if (this.maxLength !== undefined) this.input.maxLength = this.maxLength\n if (this.input.min !== this.min && this.min !== undefined)\n this.input.min = this.min.toString()\n if (this.minLength !== undefined) this.input.minLength = this.minLength\n if (this.pattern !== undefined) this.input.pattern = this.pattern\n this.input.required = this.required ?? false\n if (this.input.step !== this.step && this.step !== undefined)\n this.input.step = this.step.toString()\n if (this.type !== undefined) this.input.type = this.type\n // eslint-disable-next-line unicorn/no-null\n if (this.value != null) this.input.value = this.value.toString()\n\n if (this.input.validity.valid)\n this.internals.setValidity(NO_ERROR_FLAGS, undefined, this.input)\n else\n this.internals.setValidity(\n this.input.validity,\n this.input.validationMessage,\n this.input,\n )\n }\n\n @Watch('value')\n protected valueChanged(): void {\n if (!this.computedDisabled) this.internals.setFormValue(this.computedValue)\n }\n\n @Listen('click')\n protected onClick(event: MouseEvent): void {\n if (this.computedDisabled) event.stopImmediatePropagation()\n }\n\n public componentWillLoad(): void {\n this.defineGetter('form', () => this.internals.form)\n this.defineGetter('willValidate', () => this.internals.willValidate)\n this.defineGetter('validity', () => this.internals.validity)\n this.defineGetter(\n 'validationMessage',\n () => this.internals.validationMessage,\n )\n this.defineGetter('checkValidity', () => this.checkValidity)\n this.defineGetter('reportValidity', () => this.reportValidity)\n this.defineGetter('setCustomValidity', () => this.setCustomValidity)\n\n this.defineGetter('labels', () => this.getLabels)\n\n this.defineGetter('select', () => this.select)\n this.defineGetter('setRangeText', () => this.setRangeText)\n this.defineGetter('setSelectionRange', () => this.setSelectionRange)\n this.defineGetter('stepDown', () => this.stepDown)\n this.defineGetter('stepUp', () => this.stepUp)\n this.defineGetter('showPicker', () => this.showPicker)\n\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.element),\n ...inheritAttributes(this.element, ['tabindex']),\n }\n }\n\n public componentDidLoad(): void {\n invariant(this.input)\n\n this.validationChanged()\n this.valueChanged()\n this.selectionDirection = this.input.selectionDirection\n this.selectionStart = this.input.selectionStart\n this.selectionEnd = this.input.selectionEnd\n }\n\n public render() {\n return (\n <input\n aria-invalid={this.element.matches(':invalid').toString()}\n autoCapitalize={this.autoCapitalize}\n autoComplete={this.autoComplete}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.autoFocus}\n class=\"qds-input\"\n data-size={this.computedSize}\n disabled={this.disabled}\n enterKeyHint={this.enterkeyhint}\n inputMode={this.inputmode}\n max={this.max}\n maxLength={this.maxLength}\n min={this.min}\n minLength={this.minLength}\n multiple={this.multiple}\n onBlur={this.onBlur}\n onChange={this.onChange}\n onFocus={this.onFocus}\n onInput={this.onInput}\n placeholder={this.placeholder}\n ref={this.ref}\n spellcheck={this.spellCheck}\n step={this.step}\n type={this.type}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n />\n )\n }\n\n private readonly ref = (input?: HTMLInputElement): void => {\n this.input = input\n }\n\n private readonly onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onChange = (): void => {\n this.changeEmitter.emit()\n }\n\n private readonly onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onInput = (event: InputEvent): void => {\n invariant(this.input)\n\n this.value = this.input.value\n this.inputEmitter.emit(pickInputEventAttributes(event))\n }\n\n private defineGetter(p: PropertyKey, get: () => unknown): void {\n Object.defineProperty(this.element, p, { enumerable: true, get })\n }\n\n private readonly checkValidity: ElementInternals['checkValidity'] = () =>\n this.internals.checkValidity()\n\n private readonly reportValidity: ElementInternals['reportValidity'] = () =>\n this.internals.reportValidity()\n\n private readonly setCustomValidity: HTMLInputElement['setCustomValidity'] = (\n error,\n ) => {\n if (error) this.internals.setValidity(CUSTOM_ERROR_FLAGS, error, this.input)\n else this.internals.setValidity(NO_ERROR_FLAGS)\n }\n\n private readonly getLabels = (): HTMLInputElement['labels'] => {\n invariant(this.input)\n\n return this.input.labels\n }\n\n private readonly select: HTMLInputElement['select'] = () => {\n invariant(this.input)\n\n this.input.select()\n }\n\n private readonly setRangeText = (\n replacement: string,\n start: number,\n end: number,\n selectionMode?: SelectionMode,\n ): void => {\n invariant(this.input)\n\n this.input.setRangeText(replacement, start, end, selectionMode)\n\n if (this.value !== this.input.value) {\n this.value = this.input.value\n this.inputEmitter.emit()\n this.changeEmitter.emit()\n }\n }\n\n private readonly setSelectionRange: HTMLInputElement['setSelectionRange'] = (\n start,\n end,\n direction,\n ) => {\n invariant(this.input)\n\n this.input.setSelectionRange(start, end, direction)\n }\n\n private readonly stepDown: HTMLInputElement['stepDown'] = (n) => {\n invariant(this.input)\n\n this.input.stepDown(n)\n }\n\n private readonly stepUp: HTMLInputElement['stepUp'] = (n) => {\n invariant(this.input)\n\n this.input.stepUp(n)\n }\n\n private readonly showPicker: HTMLInputElement['showPicker'] = () => {\n invariant(this.input)\n\n this.input.showPicker()\n }\n}\n"],"version":3}
1
+ {"file":"qds-input.js","mappings":";;;;;;;;;AAAA,MAAM,QAAQ,GAAG,qhHAAqhH,CAAC;AACviH,uBAAe,QAAQ;;MCoEV,KAAK;;;;;;;;;;QAwmBC,QAAG,GAAG,CAAC,KAAwB;YAC9C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;SACnB,CAAA;QAEgB,WAAM,GAAG,CAAC,KAAiB;YAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;SACvD,CAAA;QAEgB,aAAQ,GAAG;YAC1B,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAA;SAC1B,CAAA;QAEgB,YAAO,GAAG,CAAC,KAAiB;YAC3C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;SACxD,CAAA;QAEgB,YAAO,GAAG,CAAC,KAAiB;YAC3C,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YAErB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAA;YAC7B,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;SACxD,CAAA;QAMgB,kBAAa,GAAsC,MAClE,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,CAAA;QAEf,mBAAc,GAAuC,MACpE,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,CAAA;QAEhB,sBAAiB,GAA0C,CAC1E,KAAK;YAEL,IAAI,KAAK;gBAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,kBAAkB,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;;gBACvE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,cAA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,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,YAAY,EAAE,IAAI,CAAC,YAAY,EAC/B,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,KAEX,IAAI,CAAC,mBAAmB,GAC5B,EACF,4DAAK,KAAK,EAAC,gBAAgB,GAAG,CAC1B,EACP;KACF;IAyBO,YAAY,CAAC,CAAc,EAAE,GAAkB;QACrD,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAA;KAClE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/input/input.css?tag=qds-input&encapsulation=shadow","src/components/input/input.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2024 Schneider Electric\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n}\n\n.qds-container {\n display: grid;\n grid-template-areas: 'input';\n}\n\n.qds-input {\n appearance: textfield;\n background-color: var(--qds-theme-control-input-background);\n border-color: var(--qds-theme-control-border);\n border-radius: var(\n --qds-control-border-radius-top-left,\n var(--qds-control-border-radius)\n )\n var(--qds-control-border-radius-top-right, var(--qds-control-border-radius))\n var(\n --qds-control-border-radius-bottom-right,\n var(--qds-control-border-radius)\n )\n var(\n --qds-control-border-radius-bottom-left,\n var(--qds-control-border-radius)\n );\n border-style: solid;\n border-width: var(--qds-control-border-width)\n var(--qds-control-border-width-inline-end, var(--qds-control-border-width))\n var(--qds-control-border-width-block-end, var(--qds-control-border-width))\n var(--qds-control-border-width);\n box-sizing: border-box;\n color: var(--qds-theme-control-text-standard);\n grid-area: input;\n padding-block: 0;\n padding-inline: var(--qds-control-input-padding-horizontal);\n\n &:not(:focus)[aria-invalid='true'] {\n border-color: var(--qds-theme-feedback-result-failure);\n }\n\n &[type='color'] {\n appearance: none;\n min-width: 50px;\n padding-block: var(--qds-control-input-padding-horizontal);\n\n &::-webkit-color-swatch-wrapper {\n padding: 0;\n }\n\n &::-webkit-color-swatch {\n border: var(--qds-control-border-width) solid\n var(--qds-theme-control-border);\n border-radius: var(--qds-control-border-radius);\n }\n\n &::-moz-color-swatch {\n border: var(--qds-control-border-width) solid\n var(--qds-theme-control-border);\n border-radius: var(--qds-control-border-radius);\n }\n\n cursor: pointer;\n\n &:hover {\n background-color: var(--qds-theme-interactive-background-hover);\n }\n\n &:active {\n background-color: var(--qds-theme-interactive-background-pressed);\n }\n }\n\n &:disabled {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n }\n\n &:focus-visible {\n outline: none;\n }\n\n &:placeholder-shown {\n color: var(--qds-theme-control-text-placeholder);\n }\n}\n\n.qds-focus-ring {\n border-radius: max(\n 1px,\n var(\n --qds-control-border-radius-top-left,\n var(--qds-control-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-top-right,\n var(--qds-control-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-bottom-right,\n var(--qds-control-border-radius)\n )\n )\n max(\n 1px,\n var(\n --qds-control-border-radius-bottom-left,\n var(--qds-control-border-radius)\n )\n );\n grid-area: input;\n isolation: isolate;\n outline: var(--qds-control-input-focus-border-width) solid\n var(--qds-theme-control-input-focus-border);\n pointer-events: none;\n visibility: hidden;\n width: calc(\n 100% + var(--qds-control-border-width) -\n var(\n --qds-control-border-width-inline-end,\n var(--qds-control-border-width)\n )\n );\n height: calc(\n 100% + var(--qds-control-border-width) -\n var(--qds-control-border-width-block-end, var(--qds-control-border-width))\n );\n}\n\n[data-size='small'] {\n font: var(--qds-control-small-text);\n height: var(--qds-control-small-height);\n}\n\n[data-size='standard'] {\n font: var(--qds-control-standard-text);\n height: var(--qds-control-standard-height);\n}\n\n[data-size='large'] {\n font: var(--qds-control-large-text);\n height: var(--qds-control-large-height);\n}\n\n.qds-input:focus-visible ~ .qds-focus-ring {\n visibility: visible;\n}\n","// SPDX-FileCopyrightText: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport {\n AttachInternals,\n Component,\n Element,\n Event,\n h,\n Listen,\n Prop,\n State,\n Watch,\n} from '@stencil/core'\n\nimport type {\n Attributes,\n QdsFocusEventDetail,\n QdsInputEventDetail,\n} from '../../helpers'\nimport {\n inheritAriaAttributes,\n inheritAttributes,\n invariant,\n pickFocusEventAttributes,\n pickInputEventAttributes,\n} from '../../helpers'\nimport type {\n AutoCapitalize,\n AutoComplete,\n EnterKeyHint,\n InputMode,\n Value,\n} from '../controls'\nimport { CUSTOM_ERROR_FLAGS, NO_ERROR_FLAGS, VALID_STATE } from '../controls'\nimport type { Size } from '../shared'\n\nexport type InputType =\n | 'color'\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'month'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'text'\n | 'time'\n | 'url'\n | 'week'\n\n/**\n * The `<qds-input>` element is used to create interactive controls for\n * web-based forms in order to accept data from the user; a wide variety of\n * types of input data and control widgets are available, depending on the\n * device and\n * [user agent](https://developer.mozilla.org/docs/Glossary/User_agent).\n *\n * @see https://quartz.se.com/build/components/input\n */\n@Component({\n tag: 'qds-input',\n formAssociated: true,\n shadow: { delegatesFocus: true },\n styleUrl: 'input.css',\n})\nexport class Input implements ComponentInterface {\n /**\n * The input's size.\n *\n * > **_NOTE:_** The native [`size` HTML attribute][size] is not supported.\n * CSS `width` should be used instead if this functionality is needed.\n *\n * [size]: https://developer.mozilla.org/docs/Web/HTML/Attributes/size\n */\n @Prop() public readonly size?: Size = 'standard'\n\n /**\n * Controls whether and how input is automatically capitalized as it is\n * entered/edited by the user. Only valid for `search`, `tel`, and `text`\n * inputs. Possible values:\n *\n * - `\"off\"` or `\"none\"`: No auto-capitalization is applied (all letters\n * default to lowercase).\n * - `\"on\"` or `\"sentences\"`: The first letter of each sentence defaults to a\n * capital letter; all other letters default to lowercase.\n * - `\"words\"`: The first letter of each word defaults to a capital letter;\n * all other letters default to lowercase.\n * - `\"characters\"`: All letters default to uppercase.\n *\n * @webnative\n */\n @Prop({ attribute: 'autocapitalize' })\n public readonly autoCapitalize?: AutoCapitalize\n\n /**\n * Provides a hint for a [user agent's][] autocomplete feature. See\n * [the HTML `autocomplete` attribute][autocomplete] for a complete list of\n * values and details on how to use `autoComplete`.\n *\n * [user agent's]: https://developer.mozilla.org/docs/Glossary/User_agent\n * [autocomplete]: https://developer.mozilla.org/docs/Web/HTML/Attributes/autocomplete\n *\n * @webnative\n */\n @Prop({ attribute: 'autocomplete' })\n public readonly autoComplete?: AutoComplete\n\n /**\n * Specify whether the input should have focus when the page loads.\n *\n * @webnative\n */\n @Prop({ attribute: 'autofocus' }) public readonly autoFocus?: boolean\n\n /**\n * Prevents the input from being interacted with: it cannot be pressed or\n * focused.\n *\n * @webnative\n */\n @Prop() public readonly disabled?: boolean\n\n /**\n * What action label (or icon) to present for the enter key on virtual\n * keyboards. Possible values:\n *\n * - `\"done\"`: Typically meaning there is nothing more to input and the input\n * method editor (IME) will be closed.\n * - `\"enter\"`:\tTypically inserting a new line.\n * - `\"go\"`: \tTypically meaning to take the user to the target of the text\n * they typed.\n * - `\"next\"`: \tTypically taking the user to the next field that will accept\n * text.\n * - `\"previous\"`: Typically taking the user to the previous field that will\n * accept text.\n * - `\"search\"`: Typically taking the user to the results of searching for\n * the text they have typed.\n * - `\"send\"`: Typically delivering the text to its target.\n *\n * @webnative\n */\n // FIXME: Can't use `attribute` option here to name this `enterKeyHint` instead.\n @Prop() public readonly enterkeyhint?: EnterKeyHint\n\n /**\n * The [`<form>`][] element to associate the input with (its form owner).\n *\n * The value of this attribute must be the id of a `<form>` in the same\n * document. If this attribute is not set, the `<qds-input>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This attribute lets you associate `<qds-input>` elements to `<form>`s\n * anywhere in the document, not just inside a `<form>`. It can also override\n * an ancestor `<form>` element.\n *\n * [`<form>`]: https://developer.mozilla.org/docs/Web/HTML/Element/form\n *\n * @readonly\n * @webnative\n */\n // eslint-disable-next-line unicorn/no-null\n @Prop() public readonly form: ElementInternals['form'] | string = null\n\n /**\n * Provide a hint to browsers as to the type of virtual keyboard\n * configuration to use when editing this element or its contents.\n *\n * @webnative\n */\n // FIXME: Can't use `attribute` option here to name this `inputMode` instead.\n @Prop() public readonly inputmode?: InputMode\n\n /**\n * Returns a list of the [`<label>`][] elements associated with the\n * `qds-input` element.\n *\n * [`<label>`]: https://developer.mozilla.org/docs/Web/HTML/Element/label\n *\n * @readonly\n * @webnative\n */\n // eslint-disable-next-line unicorn/no-null\n @Prop() public readonly labels: HTMLInputElement['labels'] = null\n\n /**\n * Defines the greatest value in the range of permitted values. If the\n * `value` entered into the input exceeds this, the input fails\n * [constraint validation][]. Only valid for `date`, `datetime-local`,\n * `month`, `time`, and `week` inputs.\n *\n * If this value isn't a valid number, then the input has no maximum value.\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n *\n * @webnative\n */\n @Prop() public readonly max?: number | string\n\n /**\n * The maximum number of characters (as UTF-16 code units) the user can enter\n * into the input. This must be an non-negative integer value. If no\n * `maxlength` is specified, or an invalid value is specified, the input has\n * no maximum length. Only valid for `email`, `password`, `search`, `tel`,\n * `text`, and `url` inputs.\n *\n * The input will fail [constraint validation][] if the length of the text\n * entered into the field is greater than `maxlength` UTF-16 code units long.\n * By default, browsers prevent users from entering more characters than\n * allowed by the `maxlength` attribute. See [Client-side validation][] for\n * more information.\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n * [Client-side validation]: https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation\n *\n * @webnative\n */\n @Prop({ attribute: 'maxlength' }) public readonly maxLength?: number\n\n /**\n * Defines the most negative value in the range of permitted values. If the\n * `value` entered into the input is less than this, the input fails\n * [constraint validation][]. Only valid for `date`, `datetime-local`,\n * `month`, `time`, and `week` inputs.\n *\n * This value must be less than or equal to the value of the `max` attribute.\n * If this value isn't a valid number, then the input has no minimum value.\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n *\n * @webnative\n */\n @Prop() public readonly min?: number | string\n\n /**\n * The minimum number of characters (as UTF-16 code units) the user can enter\n * into the input. This must be an non-negative integer value smaller than or\n * equal to the value specified by `maxlength`. If no `minlength` is\n * specified, or an invalid value is specified, the input has no minimum\n * length. Only valid for `email`, `password`, `search`, `tel`, `text`, and\n * `url` inputs.\n *\n * The input will fail [constraint validation][] if the length of the text\n * entered into the field is fewer than `minlength` UTF-16 code units long,\n * preventing form submission. See [Client-side validation][] for more\n * information.\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n * [Client-side validation]: https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation\n *\n * @webnative\n */\n @Prop({ attribute: 'minlength' }) public readonly minLength?: number\n\n /**\n * Specifies if multiple comma-separated email addresses can be entered. Only\n * valid for `email` inputs.\n *\n * @webnative\n */\n @Prop() public readonly multiple?: boolean\n\n /**\n * The name of the input, which is submitted with the form data.\n *\n * @webnative\n */\n @Prop() public readonly name?: string\n\n /**\n * Defines a regular expression that the input's `value` must match in order\n * for the value to pass [constraint validation][]. It must be a valid\n * JavaScript regular expression, as used by the [`RegExp`][] type, and as\n * documented in MDN's [guide on regular expressions][]; the `'u'` flag is\n * specified when compiling the regular expression, so that the pattern is\n * treated as a sequence of Unicode code points, instead of as ASCII. No\n * forward slashes should be specified around the pattern text. Only valid\n * for `email`, `password`, `search`, `tel`, `text`, and `url` inputs.\n *\n * If the `pattern` is invalid, no regular expression is applied and this\n * property is ignored. If the pattern is valid and a non-empty value does\n * not match the pattern, constraint validation will prevent form submission.\n *\n * [constraint validation]: https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation\n * [`RegExp`]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp\n * [guide on regular expressions]: https://developer.mozilla.org/docs/Web/JavaScript/Guide/Regular_Expressions\n *\n * @webnative\n */\n @Prop() public readonly pattern?: string\n\n /**\n * Text that appears in the input when it has no value set. Only valid for\n * `email`, `number`, `password`, `search`, `tel`, `text`, and `url` inputs.\n *\n * @webnative\n */\n @Prop() public readonly placeholder?: string\n\n /**\n * A value must be specified for the input before the owning form can be\n * submitted. Not valid for `color` inputs.\n *\n * See [Client-side validation][] and the\n * [HTML attribute: `required`][required] for more information.\n *\n * [Client-side validation]: https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation\n * [required]: https://developer.mozilla.org/docs/Web/HTML/Attributes/required\n *\n * @webnative\n */\n @Prop() public readonly required?: boolean\n\n /**\n * Get or set the selection direction of a text selection.\n *\n * > **_NOTE:_** This property has no effect when used as an attribute.\n *\n * @webnative\n */\n @Prop({ mutable: true })\n // eslint-disable-next-line unicorn/no-null\n public selectionDirection: HTMLInputElement['selectionDirection'] = null\n\n /**\n * Get or set the ending position or offset of a text selection.\n *\n * > **_NOTE:_** This property has no effect when used as an attribute.\n *\n * @webnative\n */\n @Prop({ mutable: true })\n // eslint-disable-next-line unicorn/no-null\n public selectionEnd: HTMLInputElement['selectionEnd'] = null\n\n /**\n * Get or set the starting position or offset of a text selection.\n *\n * > **_NOTE:_** This property has no effect when used as an attribute.\n *\n * @webnative\n */\n @Prop({ mutable: true })\n // eslint-disable-next-line unicorn/no-null\n public selectionStart: HTMLInputElement['selectionStart'] = null\n\n /**\n * Defines whether the input may be checked for spelling errors.\n *\n * @webnative\n */\n @Prop({ attribute: 'spellcheck' }) public readonly spellCheck?: boolean\n\n /**\n * Specifies the granularity that the `value` must adhere to. Only valid for\n * `date`, `datetime-local`, `month`, `number`, `time`, and `week` inputs.\n *\n * The value must be a positive number—integer or float—or the special value\n * `any`, which means no stepping is implied, and any value is allowed\n * (barring other constraints, such as `min` and `max`).\n *\n * If `any` is not explicitly set, valid values for the `number` are the\n * basis for stepping — the `min` value and increments of the step value, up\n * to the `max` value, if specified.\n *\n * @webnative\n */\n @Prop() public readonly step?: number | 'any'\n\n /**\n * The type of input to render:\n *\n * - `\"date\"`: An input for entering a date (year, month, and day, with no\n * time). Opens a date picker or numeric wheels for year, month, day when\n * active in supporting browsers.\n * - `\"datetime-local\"`: An input for entering a date and time, with no time\n * zone. Opens a date picker or numeric wheels for date and time components\n * when active in supporting browsers.\n * - `\"email\"`: An input for editing an email address. Looks like a `\"text\"`\n * input, but has validation parameters and relevant keyboard in supporting\n * browsers and devices with dynamic keyboards.\n * - `\"month\"`: An input for entering a month and year, with no time zone.\n * - `\"number\"`: An input for entering a number. Displays a spinner and adds\n * default validation when supported. Displays a numeric keypad in some\n * devices with dynamic keypads.\n * - `\"password\"`: A single-line text input whose value is obscured. Will\n * alert user if site is not secure.\n * - `\"search\"`: A single-line text input for entering search strings.\n * Line-breaks are automatically removed from the input value. May include a\n * delete icon in supporting browsers that can be used to clear the input.\n * Displays a search icon instead of enter key on some devices with dynamic\n * keypads.\n * - `\"tel\"`: An input for entering a telephone number. Displays a telephone\n * keypad in some devices with dynamic keypads.\n * - `\"text\"`: A single-line text input. Line-breaks are automatically\n * removed from the input value.\n * - `\"time\"`: An input for entering a time value with no time zone.\n * - `\"url\"`: An input for entering a URL. Looks like a `\"text\"` input, but\n * has validation parameters and relevant keyboard in supporting browsers and\n * devices with dynamic keyboards.\n * - `\"week\"`: An input for entering a date consisting of a week-year number\n * and a week number with no time zone.\n *\n * @webnative\n */\n @Prop() public readonly type?: InputType\n\n /**\n * The error message that would be shown to the user if the `<qds-select>`\n * was to be checked for validity.\n *\n * @readonly\n * @webnative\n */\n @Prop()\n public readonly validationMessage: ElementInternals['validationMessage'] = ''\n\n /**\n * The [`ValidityState`][] object for this `<qds-select>`.\n *\n * [`ValidityState`]: https://developer.mozilla.org/docs/Web/API/ValidityState\n *\n * @readonly\n * @webnative\n */\n @Prop() public readonly validity: ElementInternals['validity'] = VALID_STATE\n\n /**\n * The value of the input.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public value?: Value\n\n /**\n * True if `<qds-input>` will be validated when the form is submitted; false\n * otherwise.\n *\n * @readonly\n * @webnative\n */\n @Prop() public readonly willValidate: ElementInternals['willValidate'] = false\n\n @AttachInternals() private readonly internals!: ElementInternals\n\n /**\n * Emitted when the input loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when an alteration to the input's value is committed by the user.\n */\n @Event({ eventName: 'qdsChange', cancelable: false })\n private readonly changeEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the input gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the input's value changes.\n */\n @Event({ eventName: 'qdsInput', cancelable: false })\n private readonly inputEmitter!: EventEmitter<QdsInputEventDetail>\n\n @Element() private readonly element!: HTMLQdsInputElement\n\n @State() private inheritedAttributes: Attributes = {}\n\n private savedTabindex?: string\n\n private input?: HTMLInputElement\n\n private get computedDisabled(): boolean {\n return this.element.matches(':disabled') || (this.disabled ?? false)\n }\n\n private get computedSize(): Size {\n switch (this.size) {\n case 'standard':\n case 'small':\n case 'large': {\n return this.size\n }\n default: {\n return 'standard'\n }\n }\n }\n\n private get computedValue(): Parameters<ElementInternals['setFormValue']>[0] {\n if (typeof this.value === 'number') return this.value.toString()\n // eslint-disable-next-line unicorn/no-null\n return this.value === undefined ? null : this.value\n }\n\n @Watch('disabled')\n protected disabledChanged(): void {\n if (this.computedDisabled) {\n this.savedTabindex = this.inheritedAttributes.tabindex\n this.inheritedAttributes = {\n ...this.inheritedAttributes,\n tabindex: undefined,\n }\n // eslint-disable-next-line unicorn/no-null\n this.internals.setFormValue(null)\n } else {\n this.inheritedAttributes = {\n ...this.inheritedAttributes,\n tabindex: this.savedTabindex,\n }\n this.internals.setFormValue(this.computedValue)\n }\n }\n\n @Watch('selectionDirection')\n protected selectionDirectionChanged(): void {\n invariant(this.input)\n\n this.input.selectionDirection = this.selectionDirection\n }\n\n @Watch('selectionEnd')\n protected selectionEndChanged(): void {\n invariant(this.input)\n\n this.input.selectionEnd = this.selectionEnd\n }\n\n @Watch('selectionStart')\n protected selectionStartChanged(): void {\n invariant(this.input)\n\n this.input.selectionStart = this.selectionStart\n }\n\n @Watch('tabindex')\n protected tabindexChanged(newValue: string): void {\n if (this.computedDisabled) this.savedTabindex = newValue\n else\n this.inheritedAttributes = {\n ...this.inheritedAttributes,\n tabindex: newValue,\n }\n }\n\n @Watch('max')\n @Watch('maxLength')\n @Watch('min')\n @Watch('minLength')\n @Watch('pattern')\n @Watch('required')\n @Watch('step')\n @Watch('type')\n @Watch('value')\n protected validationChanged(): void {\n invariant(this.input)\n\n if (this.input.max !== this.max && this.max !== undefined)\n this.input.max = this.max.toString()\n if (this.maxLength !== undefined) this.input.maxLength = this.maxLength\n if (this.input.min !== this.min && this.min !== undefined)\n this.input.min = this.min.toString()\n if (this.minLength !== undefined) this.input.minLength = this.minLength\n if (this.pattern !== undefined) this.input.pattern = this.pattern\n this.input.required = this.required ?? false\n if (this.input.step !== this.step && this.step !== undefined)\n this.input.step = this.step.toString()\n if (this.type !== undefined) this.input.type = this.type\n // eslint-disable-next-line unicorn/no-null\n if (this.value != null) this.input.value = this.value.toString()\n\n if (this.input.validity.valid)\n this.internals.setValidity(NO_ERROR_FLAGS, undefined, this.input)\n else\n this.internals.setValidity(\n this.input.validity,\n this.input.validationMessage,\n this.input,\n )\n }\n\n @Watch('value')\n protected valueChanged(): void {\n if (!this.computedDisabled) this.internals.setFormValue(this.computedValue)\n }\n\n @Listen('click')\n protected onClick(event: MouseEvent): void {\n if (this.computedDisabled) event.stopImmediatePropagation()\n }\n\n @Listen('keydown')\n protected handleKeyDown(event: KeyboardEvent): void {\n if (this.computedDisabled) {\n event.stopImmediatePropagation()\n return\n }\n\n if (event.key === 'Enter' && this.internals.form) {\n this.internals.form.requestSubmit()\n event.preventDefault()\n }\n }\n\n public componentWillLoad(): void {\n this.defineGetter('form', () => this.internals.form)\n this.defineGetter('willValidate', () => this.internals.willValidate)\n this.defineGetter('validity', () => this.internals.validity)\n this.defineGetter(\n 'validationMessage',\n () => this.internals.validationMessage,\n )\n this.defineGetter('checkValidity', () => this.checkValidity)\n this.defineGetter('reportValidity', () => this.reportValidity)\n this.defineGetter('setCustomValidity', () => this.setCustomValidity)\n\n this.defineGetter('labels', () => this.getLabels)\n\n this.defineGetter('select', () => this.select)\n this.defineGetter('setRangeText', () => this.setRangeText)\n this.defineGetter('setSelectionRange', () => this.setSelectionRange)\n this.defineGetter('stepDown', () => this.stepDown)\n this.defineGetter('stepUp', () => this.stepUp)\n this.defineGetter('showPicker', () => this.showPicker)\n\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.element),\n ...inheritAttributes(this.element, ['tabindex']),\n }\n }\n\n public componentDidLoad(): void {\n invariant(this.input)\n\n this.validationChanged()\n this.valueChanged()\n this.selectionDirection = this.input.selectionDirection\n this.selectionStart = this.input.selectionStart\n this.selectionEnd = this.input.selectionEnd\n }\n\n public render() {\n return (\n <div class=\"qds-container\">\n <input\n aria-invalid={this.element.matches(':invalid').toString()}\n autoCapitalize={this.autoCapitalize}\n autoComplete={this.autoComplete}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.autoFocus}\n class=\"qds-input\"\n data-size={this.computedSize}\n disabled={this.disabled}\n enterKeyHint={this.enterkeyhint}\n inputMode={this.inputmode}\n max={this.max}\n maxLength={this.maxLength}\n min={this.min}\n minLength={this.minLength}\n multiple={this.multiple}\n onBlur={this.onBlur}\n onChange={this.onChange}\n onFocus={this.onFocus}\n onInput={this.onInput}\n placeholder={this.placeholder}\n ref={this.ref}\n spellcheck={this.spellCheck}\n step={this.step}\n type={this.type}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n />\n <div class=\"qds-focus-ring\" />\n </div>\n )\n }\n\n private readonly ref = (input?: HTMLInputElement): void => {\n this.input = input\n }\n\n private readonly onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onChange = (): void => {\n this.changeEmitter.emit()\n }\n\n private readonly onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onInput = (event: InputEvent): void => {\n invariant(this.input)\n\n this.value = this.input.value\n this.inputEmitter.emit(pickInputEventAttributes(event))\n }\n\n private defineGetter(p: PropertyKey, get: () => unknown): void {\n Object.defineProperty(this.element, p, { enumerable: true, get })\n }\n\n private readonly checkValidity: ElementInternals['checkValidity'] = () =>\n this.internals.checkValidity()\n\n private readonly reportValidity: ElementInternals['reportValidity'] = () =>\n this.internals.reportValidity()\n\n private readonly setCustomValidity: HTMLInputElement['setCustomValidity'] = (\n error,\n ) => {\n if (error) this.internals.setValidity(CUSTOM_ERROR_FLAGS, error, this.input)\n else this.internals.setValidity(NO_ERROR_FLAGS)\n }\n\n private readonly getLabels = (): HTMLInputElement['labels'] => {\n invariant(this.input)\n\n return this.input.labels\n }\n\n private readonly select: HTMLInputElement['select'] = () => {\n invariant(this.input)\n\n this.input.select()\n }\n\n private readonly setRangeText = (\n replacement: string,\n start: number,\n end: number,\n selectionMode?: SelectionMode,\n ): void => {\n invariant(this.input)\n\n this.input.setRangeText(replacement, start, end, selectionMode)\n\n if (this.value !== this.input.value) {\n this.value = this.input.value\n this.inputEmitter.emit()\n this.changeEmitter.emit()\n }\n }\n\n private readonly setSelectionRange: HTMLInputElement['setSelectionRange'] = (\n start,\n end,\n direction,\n ) => {\n invariant(this.input)\n\n this.input.setSelectionRange(start, end, direction)\n }\n\n private readonly stepDown: HTMLInputElement['stepDown'] = (n) => {\n invariant(this.input)\n\n this.input.stepDown(n)\n }\n\n private readonly stepUp: HTMLInputElement['stepUp'] = (n) => {\n invariant(this.input)\n\n this.input.stepUp(n)\n }\n\n private readonly showPicker: HTMLInputElement['showPicker'] = () => {\n invariant(this.input)\n\n this.input.showPicker()\n }\n}\n"],"version":3}