@quartzds/core 1.0.0-beta.13 → 1.0.0-beta.15

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 (88) hide show
  1. package/components/icon.js +2 -2
  2. package/components/icon.js.map +1 -1
  3. package/components/label.js +4 -4
  4. package/components/label.js.map +1 -1
  5. package/components/qds-button.js +4 -4
  6. package/components/qds-button.js.map +1 -1
  7. package/components/qds-checkbox.js +8 -8
  8. package/components/qds-checkbox.js.map +1 -1
  9. package/components/qds-dialog.js +2 -2
  10. package/components/qds-dialog.js.map +1 -1
  11. package/components/qds-divider.js +2 -2
  12. package/components/qds-divider.js.map +1 -1
  13. package/components/qds-form-message.js +4 -4
  14. package/components/qds-form-message.js.map +1 -1
  15. package/components/qds-inline-link.js +2 -2
  16. package/components/qds-inline-link.js.map +1 -1
  17. package/components/qds-input.js +2 -2
  18. package/components/qds-input.js.map +1 -1
  19. package/components/qds-radio.js +4 -4
  20. package/components/qds-radio.js.map +1 -1
  21. package/components/qds-switch.js +7 -7
  22. package/components/qds-switch.js.map +1 -1
  23. package/components/qds-textarea.js +2 -2
  24. package/components/qds-textarea.js.map +1 -1
  25. package/components/qds-title.js +19 -17
  26. package/components/qds-title.js.map +1 -1
  27. package/components/qds-tooltip.js +3 -3
  28. package/components/qds-tooltip.js.map +1 -1
  29. package/dist/cjs/qds-button.cjs.entry.js +4 -4
  30. package/dist/cjs/qds-button.cjs.entry.js.map +1 -1
  31. package/dist/cjs/qds-checkbox.cjs.entry.js +8 -8
  32. package/dist/cjs/qds-checkbox.cjs.entry.js.map +1 -1
  33. package/dist/cjs/qds-dialog.cjs.entry.js +2 -2
  34. package/dist/cjs/qds-dialog.cjs.entry.js.map +1 -1
  35. package/dist/cjs/qds-divider.cjs.entry.js +2 -2
  36. package/dist/cjs/qds-divider.cjs.entry.js.map +1 -1
  37. package/dist/cjs/qds-form-message.cjs.entry.js +4 -4
  38. package/dist/cjs/qds-form-message.cjs.entry.js.map +1 -1
  39. package/dist/cjs/qds-icon.cjs.entry.js +2 -2
  40. package/dist/cjs/qds-icon.cjs.entry.js.map +1 -1
  41. package/dist/cjs/qds-inline-link.cjs.entry.js +2 -2
  42. package/dist/cjs/qds-inline-link.cjs.entry.js.map +1 -1
  43. package/dist/cjs/qds-input.cjs.entry.js +2 -2
  44. package/dist/cjs/qds-input.cjs.entry.js.map +1 -1
  45. package/dist/cjs/qds-label.cjs.entry.js +4 -4
  46. package/dist/cjs/qds-label.cjs.entry.js.map +1 -1
  47. package/dist/cjs/qds-radio.cjs.entry.js +4 -4
  48. package/dist/cjs/qds-radio.cjs.entry.js.map +1 -1
  49. package/dist/cjs/qds-switch.cjs.entry.js +7 -7
  50. package/dist/cjs/qds-switch.cjs.entry.js.map +1 -1
  51. package/dist/cjs/qds-textarea.cjs.entry.js +2 -2
  52. package/dist/cjs/qds-textarea.cjs.entry.js.map +1 -1
  53. package/dist/cjs/qds-title.cjs.entry.js +19 -17
  54. package/dist/cjs/qds-title.cjs.entry.js.map +1 -1
  55. package/dist/cjs/qds-tooltip.cjs.entry.js +3 -3
  56. package/dist/cjs/qds-tooltip.cjs.entry.js.map +1 -1
  57. package/dist/custom-elements.json +1 -1
  58. package/dist/docs.json +2 -2
  59. package/dist/esm/qds-button.entry.js +4 -4
  60. package/dist/esm/qds-button.entry.js.map +1 -1
  61. package/dist/esm/qds-checkbox.entry.js +8 -8
  62. package/dist/esm/qds-checkbox.entry.js.map +1 -1
  63. package/dist/esm/qds-dialog.entry.js +2 -2
  64. package/dist/esm/qds-dialog.entry.js.map +1 -1
  65. package/dist/esm/qds-divider.entry.js +2 -2
  66. package/dist/esm/qds-divider.entry.js.map +1 -1
  67. package/dist/esm/qds-form-message.entry.js +4 -4
  68. package/dist/esm/qds-form-message.entry.js.map +1 -1
  69. package/dist/esm/qds-icon.entry.js +2 -2
  70. package/dist/esm/qds-icon.entry.js.map +1 -1
  71. package/dist/esm/qds-inline-link.entry.js +2 -2
  72. package/dist/esm/qds-inline-link.entry.js.map +1 -1
  73. package/dist/esm/qds-input.entry.js +2 -2
  74. package/dist/esm/qds-input.entry.js.map +1 -1
  75. package/dist/esm/qds-label.entry.js +4 -4
  76. package/dist/esm/qds-label.entry.js.map +1 -1
  77. package/dist/esm/qds-radio.entry.js +4 -4
  78. package/dist/esm/qds-radio.entry.js.map +1 -1
  79. package/dist/esm/qds-switch.entry.js +7 -7
  80. package/dist/esm/qds-switch.entry.js.map +1 -1
  81. package/dist/esm/qds-textarea.entry.js +2 -2
  82. package/dist/esm/qds-textarea.entry.js.map +1 -1
  83. package/dist/esm/qds-title.entry.js +19 -17
  84. package/dist/esm/qds-title.entry.js.map +1 -1
  85. package/dist/esm/qds-tooltip.entry.js +3 -3
  86. package/dist/esm/qds-tooltip.entry.js.map +1 -1
  87. package/hydrate/index.js +65 -63
  88. package/package.json +8 -3
@@ -94,7 +94,7 @@ const requestIcon = async (url) => {
94
94
  return iconFileData;
95
95
  };
96
96
 
97
- const iconCss = ":host{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{contain:strict;display:inline-block;height:1em;width:1em}.wrapper{display:contents}svg{display:block;fill:currentcolor;height:100%;width:100%}";
97
+ const iconCss = ":host{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{contain:strict;display:inline-block;height:1em;width:1em}.qds-wrapper{display:contents}svg{display:block;fill:currentcolor;height:100%;width:100%}";
98
98
 
99
99
  let parser;
100
100
  const Icon = /*@__PURE__*/ proxyCustomElement(class Icon extends HTMLElement {
@@ -153,7 +153,7 @@ const Icon = /*@__PURE__*/ proxyCustomElement(class Icon extends HTMLElement {
153
153
  await this.setIcon();
154
154
  }
155
155
  render() {
156
- return h("span", { class: "wrapper", innerHTML: this.svg });
156
+ return h("span", { class: "qds-wrapper", innerHTML: this.svg });
157
157
  }
158
158
  get element() { return this; }
159
159
  static get watchers() {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N,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;KACzB;GACF;EAEM,MAAM,iBAAiB;IAC5B,IAAI,CAAC,mBAAmB,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC9D,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;GACrB;EAEM,MAAM;IACX,OAAO,YAAM,KAAK,EAAC,SAAS,EAAC,SAAS,EAAE,IAAI,CAAC,GAAG,GAAI,CAAA;GACrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["externalLink","checked","indeterminate","statusError","statusInfo","statusWarning","defaultLibrary"],"sources":["../../node_modules/@quartzds/generic-icons-core/dist/arrow-top-right-on-square.svg","../../node_modules/@quartzds/generic-icons-core/dist/check.svg","../../node_modules/@quartzds/generic-icons-core/dist/exclamation.svg","../../node_modules/@quartzds/generic-icons-core/dist/information.svg","../../node_modules/@quartzds/generic-icons-core/dist/minus.svg","../../node_modules/@quartzds/generic-icons-core/dist/x-mark.svg","src/components/icon/core-library.ts","src/components/icon/default-library.ts","src/components/icon/library.ts","src/components/icon/request.ts","src/components/icon/icon.css?tag=qds-icon&encapsulation=shadow","src/components/icon/icon.tsx"],"sourcesContent":["<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"M12.03 13.01H3.02v-9h5.97v-1H2.03v11h10.99V6.98h-.99v6.03ZM10.99 1.98v1h1.36L9.1 6.23l.71.7 3.16-3.16-.01 1.21 1 .01.04-3.01h-3.01Z\"/></svg>","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"M6.31 11.86 3.08 8.63l.71-.71 2.52 2.52 5.9-5.94.71.7-6.61 6.66Z\"/></svg>","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"M7.129 12.06a.83.83 0 0 1 .239-.612c.16-.157.378-.246.667-.246.289 0 .498.079.667.246.16.158.239.365.239.611s-.08.434-.24.591c-.158.158-.377.237-.666.237-.289 0-.508-.08-.667-.237a.797.797 0 0 1-.24-.59Zm1.573-2.04H7.328l-.15-6.68h1.683l-.16 6.68Z\"/></svg>","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"M6.18 13.12v-.25c.95-.16.99-.24.99-1.51V7.97c0-1.04-.06-1.11-.82-1.32v-.21c.88-.12 1.73-.33 2.48-.62-.02.35-.03 1.32-.03 2.01v3.53c0 1.25.09 1.33 1.02 1.51v.25H6.18Zm1.69-8.36c-.48 0-.9-.41-.9-.94 0-.56.42-.94.92-.94.54 0 .94.38.94.94 0 .56-.4.94-.95.94h-.01Z\"/></svg>","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"M13 7.5H3.01v1H13v-1Z\"/></svg>","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"m11.43 5.26-.71-.7-2.74 2.76-2.73-2.76-.71.7 2.74 2.77-2.74 2.77.71.71 2.73-2.77 2.74 2.77.71-.71-2.74-2.77 2.74-2.77Z\"/></svg>","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\n// FIXME: TypeScript and Webpack can resolve exports from the package.json\n// `exports` field but Rollup can't. `@quartzds/generic-icons-core/*.svg`\n// _should_ work but it doesn't.\n/* eslint-disable import/no-unresolved */\nimport externalLink from '@quartzds/generic-icons-core/dist/arrow-top-right-on-square.svg'\nimport checked from '@quartzds/generic-icons-core/dist/check.svg'\nimport statusWarning from '@quartzds/generic-icons-core/dist/exclamation.svg'\nimport statusInfo from '@quartzds/generic-icons-core/dist/information.svg'\nimport indeterminate from '@quartzds/generic-icons-core/dist/minus.svg'\nimport statusError from '@quartzds/generic-icons-core/dist/x-mark.svg'\n\n/* eslint-enable import/no-unresolved */\nimport type { IconLibrary } from './library'\n\nconst icons: Record<string, string | undefined> = {\n /* eslint-disable @typescript-eslint/naming-convention */\n 'external-link': externalLink,\n checked,\n indeterminate,\n 'status-error': statusError,\n 'status-info': statusInfo,\n 'status-success': checked,\n 'status-warning': statusWarning,\n /* eslint-enable @typescript-eslint/naming-convention */\n}\n\nconst coreLibrary: IconLibrary = {\n name: 'core',\n resolver: (name) => icons[name] ?? '',\n}\n\nexport default coreLibrary\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport { getAssetPath } from '@stencil/core'\n\nimport type { IconLibrary } from './library'\n\nconst library: IconLibrary = {\n name: 'default',\n resolver: (name) => getAssetPath(`icons/${name}.svg`),\n}\n\nexport default library\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { Except } from 'type-fest'\n\nimport coreLibrary from './core-library'\nimport defaultLibrary from './default-library'\n\nexport type IconLibraryResolver = (name: string) => string\nexport interface IconLibrary {\n name: string\n resolver: IconLibraryResolver\n}\n\nlet registry: IconLibrary[] = [defaultLibrary, coreLibrary]\n\n/**\n * Returns a library from the registry.\n */\nexport const getIconLibrary = (name: string): IconLibrary | undefined =>\n registry.find((library) => library.name === name)\n\n/**\n * Removes an icon library from the registry.\n */\nexport const unregisterIconLibrary = (name: string): void => {\n registry = registry.filter((library) => library.name !== name)\n}\n\n/**\n * Adds an icon library to the registry or overrides an existing one.\n */\nexport const registerIconLibrary = (\n name: string,\n options: Except<IconLibrary, 'name'>,\n): void => {\n unregisterIconLibrary(name)\n registry.push({\n name,\n ...options,\n })\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\ninterface Request {\n ok: boolean\n data: string\n}\n\ninterface IconRequestOk {\n ok: true\n data: string\n}\n\ninterface IconRequestError {\n ok: false\n data: undefined\n}\n\ntype IconRequest = IconRequestError | IconRequestOk\n\ninterface IconRequestUnknown {\n ok: boolean\n data?: string\n}\n\nconst request = async (source: string): Promise<Request> => {\n const response = await fetch(source, { mode: 'cors' })\n return {\n ok: response.ok,\n data: await response.text(),\n }\n}\n\nconst cachedIconRequests = new Map<string, IconRequest>()\n\nconst requestIcon = async (url: string): Promise<IconRequest> => {\n const cachedIconRequest = cachedIconRequests.get(url)\n if (cachedIconRequest) return cachedIconRequest\n\n const fileData = await request(url)\n const iconFileData: IconRequestUnknown = {\n ok: fileData.ok,\n }\n if (fileData.ok) {\n const div = document.createElement('div')\n div.innerHTML = fileData.data\n const child = div.firstElementChild\n iconFileData.data =\n child?.tagName.toLowerCase() === 'svg' ? child.outerHTML : ''\n }\n\n cachedIconRequests.set(url, iconFileData as IconRequest)\n return iconFileData as IconRequest\n}\n\nexport default requestIcon\n","/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n contain: strict;\n display: inline-block;\n height: 1em;\n width: 1em;\n}\n\n.wrapper {\n display: contents;\n}\n\nsvg {\n display: block;\n fill: currentcolor;\n height: 100%;\n width: 100%;\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport { Component, Element, Event, h, Prop, State, Watch } from '@stencil/core'\n\nimport type { Attributes } from '../../helpers'\nimport { inheritAriaAttributes } from '../../helpers'\nimport { getIconLibrary } from './library'\nimport requestIcon from './request'\n\nlet parser: DOMParser | undefined\n\n/**\n * @experimental\n */\n@Component({\n tag: 'qds-icon',\n shadow: true,\n styleUrl: 'icon.css',\n})\nexport class Icon implements ComponentInterface {\n /**\n * The name of the icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop({ reflect: true }) public readonly name!: string\n\n /**\n * The name of a registered icon library.\n */\n @Prop({ reflect: true }) public readonly library: string = 'default'\n\n /**\n * Emitted when the icon has loaded.\n */\n @Event({ eventName: 'qdsLoad', cancelable: false })\n private readonly loadEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the icon fails to load due to an error.\n */\n @Event({ eventName: 'qdsError', cancelable: false })\n private readonly errorEmitter!: EventEmitter<void>\n\n @Element() private readonly element!: HTMLQdsIconElement\n\n @State() private svg = ''\n\n private inheritedAttributes: Attributes = {}\n\n @Watch('name')\n @Watch('library')\n private async setIcon(): Promise<void> {\n if (!this.name) return\n\n const library = getIconLibrary(this.library)\n if (!library) return\n\n const url = library.resolver(this.name)\n if (!url) {\n this.svg = ''\n return\n }\n\n try {\n const request = await requestIcon(url)\n if (!request.ok) {\n this.svg = ''\n this.errorEmitter.emit()\n return\n }\n\n // Create an instance of the DOM parser. We do it here instead of at the\n // top-level to support SSR while maintaining a single parser instance\n // for optimal performance.\n parser ||= new DOMParser()\n const document = parser.parseFromString(request.data, 'text/html')\n const svgElement = document.body.querySelector('svg')\n if (svgElement === null) {\n this.svg = ''\n this.errorEmitter.emit()\n } else {\n for (const [key, value] of Object.entries(this.inheritedAttributes))\n svgElement.setAttribute(key, value)\n this.svg = svgElement.outerHTML\n this.loadEmitter.emit()\n }\n } catch {\n this.errorEmitter.emit()\n }\n }\n\n public async componentWillLoad(): Promise<void> {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n await this.setIcon()\n }\n\n public render() {\n return <span class=\"wrapper\" innerHTML={this.svg} />\n }\n}\n"],"version":3}
1
+ {"file":"icon.js","mappings":";;;;;;;;AAAA,MAAM,wBAAwB,GAAG,oTAAoT;;ACArV,MAAM,QAAQ,GAAG,4NAA4N;;ACA7O,MAAM,cAAc,GAAG,gdAAgd;;ACAve,MAAM,cAAc,GAAG,geAAge;;ACAvf,MAAM,QAAQ,GAAG,gKAAgK;;ACAjL,MAAM,QAAQ,GAAG,oSAAoS;;ACArT;AAkBA,MAAM,KAAK,GAAuC;;EAEhD,eAAe,EAAEA,wBAAY;WAC7BC,QAAO;iBACPC,QAAa;EACb,cAAc,EAAEC,QAAW;EAC3B,aAAa,EAAEC,cAAU;EACzB,gBAAgB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AG,CAAC,CAAA;MACtC,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE;QACf,IAAI,CAAC,GAAG,GAAG,EAAE,CAAA;QACb,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;QACxB,OAAM;OACP;;;;MAKD,MAAM,KAAN,MAAM,GAAK,IAAI,SAAS,EAAE,EAAA;MAC1B,MAAM,QAAQ,GAAG,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,CAAA;MAClE,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAA;MACrD,IAAI,UAAU,KAAK,IAAI,EAAE;QACvB,IAAI,CAAC,GAAG,GAAG,EAAE,CAAA;QACb,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;OACzB;WAAM;QACL,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,CAAC;UACjE,UAAU,CAAC,YAAY,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QACrC,IAAI,CAAC,GAAG,GAAG,UAAU,CAAC,SAAS,CAAA;QAC/B,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,CAAA;OACxB;KACF;IAAC,MAAM;MACN,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;KACzB;GACF;EAEM,MAAM,iBAAiB;IAC5B,IAAI,CAAC,mBAAmB,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAC9D,MAAM,IAAI,CAAC,OAAO,EAAE,CAAA;GACrB;EAEM,MAAM;IACX,OAAO,YAAM,KAAK,EAAC,aAAa,EAAC,SAAS,EAAE,IAAI,CAAC,GAAG,GAAI,CAAA;GACzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["externalLink","checked","indeterminate","statusError","statusInfo","statusWarning","defaultLibrary"],"sources":["../../node_modules/@quartzds/generic-icons-core/dist/arrow-top-right-on-square.svg","../../node_modules/@quartzds/generic-icons-core/dist/check.svg","../../node_modules/@quartzds/generic-icons-core/dist/exclamation.svg","../../node_modules/@quartzds/generic-icons-core/dist/information.svg","../../node_modules/@quartzds/generic-icons-core/dist/minus.svg","../../node_modules/@quartzds/generic-icons-core/dist/x-mark.svg","src/components/icon/core-library.ts","src/components/icon/default-library.ts","src/components/icon/library.ts","src/components/icon/request.ts","src/components/icon/icon.css?tag=qds-icon&encapsulation=shadow","src/components/icon/icon.tsx"],"sourcesContent":["<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"M12.03 13.01H3.02v-9h5.97v-1H2.03v11h10.99V6.98h-.99v6.03ZM10.99 1.98v1h1.36L9.1 6.23l.71.7 3.16-3.16-.01 1.21 1 .01.04-3.01h-3.01Z\"/></svg>","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"M6.31 11.86 3.08 8.63l.71-.71 2.52 2.52 5.9-5.94.71.7-6.61 6.66Z\"/></svg>","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"M7.129 12.06a.83.83 0 0 1 .239-.612c.16-.157.378-.246.667-.246.289 0 .498.079.667.246.16.158.239.365.239.611s-.08.434-.24.591c-.158.158-.377.237-.666.237-.289 0-.508-.08-.667-.237a.797.797 0 0 1-.24-.59Zm1.573-2.04H7.328l-.15-6.68h1.683l-.16 6.68Z\"/></svg>","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"M6.18 13.12v-.25c.95-.16.99-.24.99-1.51V7.97c0-1.04-.06-1.11-.82-1.32v-.21c.88-.12 1.73-.33 2.48-.62-.02.35-.03 1.32-.03 2.01v3.53c0 1.25.09 1.33 1.02 1.51v.25H6.18Zm1.69-8.36c-.48 0-.9-.41-.9-.94 0-.56.42-.94.92-.94.54 0 .94.38.94.94 0 .56-.4.94-.95.94h-.01Z\"/></svg>","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"M13 7.5H3.01v1H13v-1Z\"/></svg>","<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\"><path d=\"m11.43 5.26-.71-.7-2.74 2.76-2.73-2.76-.71.7 2.74 2.77-2.74 2.77.71.71 2.73-2.77 2.74 2.77.71-.71-2.74-2.77 2.74-2.77Z\"/></svg>","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\n// FIXME: TypeScript and Webpack can resolve exports from the package.json\n// `exports` field but Rollup can't. `@quartzds/generic-icons-core/*.svg`\n// _should_ work but it doesn't.\n/* eslint-disable import/no-unresolved */\nimport externalLink from '@quartzds/generic-icons-core/dist/arrow-top-right-on-square.svg'\nimport checked from '@quartzds/generic-icons-core/dist/check.svg'\nimport statusWarning from '@quartzds/generic-icons-core/dist/exclamation.svg'\nimport statusInfo from '@quartzds/generic-icons-core/dist/information.svg'\nimport indeterminate from '@quartzds/generic-icons-core/dist/minus.svg'\nimport statusError from '@quartzds/generic-icons-core/dist/x-mark.svg'\n\n/* eslint-enable import/no-unresolved */\nimport type { IconLibrary } from './library'\n\nconst icons: Record<string, string | undefined> = {\n /* eslint-disable @typescript-eslint/naming-convention */\n 'external-link': externalLink,\n checked,\n indeterminate,\n 'status-error': statusError,\n 'status-info': statusInfo,\n 'status-success': checked,\n 'status-warning': statusWarning,\n /* eslint-enable @typescript-eslint/naming-convention */\n}\n\nconst coreLibrary: IconLibrary = {\n name: 'core',\n resolver: (name) => icons[name] ?? '',\n}\n\nexport default coreLibrary\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport { getAssetPath } from '@stencil/core'\n\nimport type { IconLibrary } from './library'\n\nconst library: IconLibrary = {\n name: 'default',\n resolver: (name) => getAssetPath(`icons/${name}.svg`),\n}\n\nexport default library\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { Except } from 'type-fest'\n\nimport coreLibrary from './core-library'\nimport defaultLibrary from './default-library'\n\nexport type IconLibraryResolver = (name: string) => string\nexport interface IconLibrary {\n name: string\n resolver: IconLibraryResolver\n}\n\nlet registry: IconLibrary[] = [defaultLibrary, coreLibrary]\n\n/**\n * Returns a library from the registry.\n */\nexport const getIconLibrary = (name: string): IconLibrary | undefined =>\n registry.find((library) => library.name === name)\n\n/**\n * Removes an icon library from the registry.\n */\nexport const unregisterIconLibrary = (name: string): void => {\n registry = registry.filter((library) => library.name !== name)\n}\n\n/**\n * Adds an icon library to the registry or overrides an existing one.\n */\nexport const registerIconLibrary = (\n name: string,\n options: Except<IconLibrary, 'name'>,\n): void => {\n unregisterIconLibrary(name)\n registry.push({\n name,\n ...options,\n })\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\ninterface Request {\n ok: boolean\n data: string\n}\n\ninterface IconRequestOk {\n ok: true\n data: string\n}\n\ninterface IconRequestError {\n ok: false\n data: undefined\n}\n\ntype IconRequest = IconRequestError | IconRequestOk\n\ninterface IconRequestUnknown {\n ok: boolean\n data?: string\n}\n\nconst request = async (source: string): Promise<Request> => {\n const response = await fetch(source, { mode: 'cors' })\n return {\n ok: response.ok,\n data: await response.text(),\n }\n}\n\nconst cachedIconRequests = new Map<string, IconRequest>()\n\nconst requestIcon = async (url: string): Promise<IconRequest> => {\n const cachedIconRequest = cachedIconRequests.get(url)\n if (cachedIconRequest) return cachedIconRequest\n\n const fileData = await request(url)\n const iconFileData: IconRequestUnknown = {\n ok: fileData.ok,\n }\n if (fileData.ok) {\n const div = document.createElement('div')\n div.innerHTML = fileData.data\n const child = div.firstElementChild\n iconFileData.data =\n child?.tagName.toLowerCase() === 'svg' ? child.outerHTML : ''\n }\n\n cachedIconRequests.set(url, iconFileData as IconRequest)\n return iconFileData as IconRequest\n}\n\nexport default requestIcon\n","/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n contain: strict;\n display: inline-block;\n height: 1em;\n width: 1em;\n}\n\n.qds-wrapper {\n display: contents;\n}\n\nsvg {\n display: block;\n fill: currentcolor;\n height: 100%;\n width: 100%;\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport { Component, Element, Event, h, Prop, State, Watch } from '@stencil/core'\n\nimport type { Attributes } from '../../helpers'\nimport { inheritAriaAttributes } from '../../helpers'\nimport { getIconLibrary } from './library'\nimport requestIcon from './request'\n\nlet parser: DOMParser | undefined\n\n/**\n * @experimental\n */\n@Component({\n tag: 'qds-icon',\n shadow: true,\n styleUrl: 'icon.css',\n})\nexport class Icon implements ComponentInterface {\n /**\n * The name of the icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop({ reflect: true }) public readonly name!: string\n\n /**\n * The name of a registered icon library.\n */\n @Prop({ reflect: true }) public readonly library: string = 'default'\n\n /**\n * Emitted when the icon has loaded.\n */\n @Event({ eventName: 'qdsLoad', cancelable: false })\n private readonly loadEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the icon fails to load due to an error.\n */\n @Event({ eventName: 'qdsError', cancelable: false })\n private readonly errorEmitter!: EventEmitter<void>\n\n @Element() private readonly element!: HTMLQdsIconElement\n\n @State() private svg = ''\n\n private inheritedAttributes: Attributes = {}\n\n @Watch('name')\n @Watch('library')\n private async setIcon(): Promise<void> {\n if (!this.name) return\n\n const library = getIconLibrary(this.library)\n if (!library) return\n\n const url = library.resolver(this.name)\n if (!url) {\n this.svg = ''\n return\n }\n\n try {\n const request = await requestIcon(url)\n if (!request.ok) {\n this.svg = ''\n this.errorEmitter.emit()\n return\n }\n\n // Create an instance of the DOM parser. We do it here instead of at the\n // top-level to support SSR while maintaining a single parser instance\n // for optimal performance.\n parser ||= new DOMParser()\n const document = parser.parseFromString(request.data, 'text/html')\n const svgElement = document.body.querySelector('svg')\n if (svgElement === null) {\n this.svg = ''\n this.errorEmitter.emit()\n } else {\n for (const [key, value] of Object.entries(this.inheritedAttributes))\n svgElement.setAttribute(key, value)\n this.svg = svgElement.outerHTML\n this.loadEmitter.emit()\n }\n } catch {\n this.errorEmitter.emit()\n }\n }\n\n public async componentWillLoad(): Promise<void> {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n await this.setIcon()\n }\n\n public render() {\n return <span class=\"qds-wrapper\" innerHTML={this.svg} />\n }\n}\n"],"version":3}
@@ -6,7 +6,7 @@
6
6
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
7
7
  import { i as inheritAriaAttributes } from './helpers.js';
8
8
 
9
- const labelCss = ":host{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{display:inline-block}.label{color:var(--qds-theme-control-text-standard);display:inline-block}.required{color:var(--qds-theme-feedback-field-required);-webkit-user-select:none;user-select:none}[data-size='small']{font:var(--qds-control-small-text)}.inline[data-size='small']{margin-block:var(--qds-control-small-padding-auto-height)}[data-size='standard']{font:var(--qds-control-standard-text)}.inline[data-size='standard']{margin-block:var(--qds-control-standard-padding-auto-height)}[data-size='large']{font:var(--qds-control-large-text)}.inline[data-size='large']{margin-block:var(--qds-control-large-padding-auto-height)}";
9
+ const labelCss = ":host{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{display:inline-block}.qds-label{color:var(--qds-theme-control-text-standard);display:inline-block}.qds-required{color:var(--qds-theme-feedback-field-required);-webkit-user-select:none;user-select:none}[data-size='small']{font:var(--qds-control-small-text)}.qds-inline[data-size='small']{margin-block:var(--qds-control-small-padding-auto-height)}[data-size='standard']{font:var(--qds-control-standard-text)}.qds-inline[data-size='standard']{margin-block:var(--qds-control-standard-padding-auto-height)}[data-size='large']{font:var(--qds-control-large-text)}.qds-inline[data-size='large']{margin-block:var(--qds-control-large-padding-auto-height)}";
10
10
 
11
11
  const Label = /*@__PURE__*/ proxyCustomElement(class Label extends HTMLElement {
12
12
  constructor() {
@@ -24,9 +24,9 @@ const Label = /*@__PURE__*/ proxyCustomElement(class Label extends HTMLElement {
24
24
  }
25
25
  render() {
26
26
  return (h("span", { class: {
27
- inline: this.inline,
28
- label: true,
29
- }, "data-size": this.size, ...this.inheritedAttributes }, this.required && h("span", { class: "required" }, "*"), this.text));
27
+ 'qds-inline': this.inline,
28
+ 'qds-label': true,
29
+ }, "data-size": this.size, ...this.inheritedAttributes }, this.required && h("span", { class: "qds-required" }, "*"), this.text));
30
30
  }
31
31
  get element() { return this; }
32
32
  static get style() { return labelCss; }
@@ -1 +1 @@
1
- {"file":"label.js","mappings":";;;;;;;;AAAA,MAAM,QAAQ,GAAG,wwBAAwwB;;MCsB5wB,KAAK;;;;;IA0BR,wBAAmB,GAAe,EAAE,CAAA;kBAnBF,KAAK;oBAKH,KAAK;gBAKU,UAAU;;;EAW9D,iBAAiB;IACtB,IAAI,CAAC,mBAAmB,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;GAC/D;EAEM,MAAM;IACX,QACE,YACE,KAAK,EAAE;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,IAAI;OACZ,eACU,IAAI,CAAC,IAAI,KAEhB,IAAI,CAAC,mBAAmB,IAE3B,IAAI,CAAC,QAAQ,IAAI,YAAM,KAAK,EAAC,UAAU,QAAS,EAChD,IAAI,CAAC,IAAI,CACL,EACR;GACF;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/label/label.css?tag=qds-label&encapsulation=shadow","src/components/label/label.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n}\n\n.label {\n color: var(--qds-theme-control-text-standard);\n display: inline-block;\n}\n\n.required {\n color: var(--qds-theme-feedback-field-required);\n user-select: none;\n}\n\n[data-size='small'] {\n font: var(--qds-control-small-text);\n\n &.inline {\n margin-block: var(--qds-control-small-padding-auto-height);\n }\n}\n\n[data-size='standard'] {\n font: var(--qds-control-standard-text);\n\n &.inline {\n margin-block: var(--qds-control-standard-padding-auto-height);\n }\n}\n\n[data-size='large'] {\n font: var(--qds-control-large-text);\n\n &.inline {\n margin-block: var(--qds-control-large-padding-auto-height);\n }\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface } from '@stencil/core'\nimport { Component, Element, h, Prop } from '@stencil/core'\n\nimport type { Attributes } from '../../helpers'\nimport { inheritAriaAttributes } from '../../helpers'\n\nexport type LabelSize = 'large' | 'small' | 'standard'\n\n/**\n * `<qds-label>` elements represent a caption for an item in a user interface.\n *\n * @see https://quartz.se.com/build/components/label\n */\n@Component({\n tag: 'qds-label',\n shadow: true,\n styleUrl: 'label.css',\n})\nexport class Label implements ComponentInterface {\n /**\n * Adds vertical margin to the label for alignment.\n *\n * This is useful when creating inline layouts so that the first lines have\n * the correct vertical centering.\n */\n @Prop() public readonly inline: boolean = false\n\n /**\n * Specify the labelled item as required by appending a red asterisk (*).\n */\n @Prop() public readonly required: boolean = false\n\n /**\n * The label's size.\n */\n @Prop({ reflect: true }) public readonly size: LabelSize = 'standard'\n\n /**\n * The label's text.\n */\n @Prop({ reflect: true }) public readonly text?: string\n\n @Element() private readonly element!: HTMLQdsLabelElement\n\n private inheritedAttributes: Attributes = {}\n\n public componentWillLoad(): void {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n }\n\n public render() {\n return (\n <span\n class={{\n inline: this.inline,\n label: true,\n }}\n data-size={this.size}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n >\n {this.required && <span class=\"required\">*</span>}\n {this.text}\n </span>\n )\n }\n}\n"],"version":3}
1
+ {"file":"label.js","mappings":";;;;;;;;AAAA,MAAM,QAAQ,GAAG,4xBAA4xB;;MCsBhyB,KAAK;;;;;IA0BR,wBAAmB,GAAe,EAAE,CAAA;kBAnBF,KAAK;oBAKH,KAAK;gBAKU,UAAU;;;EAW9D,iBAAiB;IACtB,IAAI,CAAC,mBAAmB,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;GAC/D;EAEM,MAAM;IACX,QACE,YACE,KAAK,EAAE;QACL,YAAY,EAAE,IAAI,CAAC,MAAM;QACzB,WAAW,EAAE,IAAI;OAClB,eACU,IAAI,CAAC,IAAI,KAEhB,IAAI,CAAC,mBAAmB,IAE3B,IAAI,CAAC,QAAQ,IAAI,YAAM,KAAK,EAAC,cAAc,QAAS,EACpD,IAAI,CAAC,IAAI,CACL,EACR;GACF;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/label/label.css?tag=qds-label&encapsulation=shadow","src/components/label/label.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n}\n\n.qds-label {\n color: var(--qds-theme-control-text-standard);\n display: inline-block;\n}\n\n.qds-required {\n color: var(--qds-theme-feedback-field-required);\n user-select: none;\n}\n\n[data-size='small'] {\n font: var(--qds-control-small-text);\n\n &.qds-inline {\n margin-block: var(--qds-control-small-padding-auto-height);\n }\n}\n\n[data-size='standard'] {\n font: var(--qds-control-standard-text);\n\n &.qds-inline {\n margin-block: var(--qds-control-standard-padding-auto-height);\n }\n}\n\n[data-size='large'] {\n font: var(--qds-control-large-text);\n\n &.qds-inline {\n margin-block: var(--qds-control-large-padding-auto-height);\n }\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface } from '@stencil/core'\nimport { Component, Element, h, Prop } from '@stencil/core'\n\nimport type { Attributes } from '../../helpers'\nimport { inheritAriaAttributes } from '../../helpers'\n\nexport type LabelSize = 'large' | 'small' | 'standard'\n\n/**\n * `<qds-label>` elements represent a caption for an item in a user interface.\n *\n * @see https://quartz.se.com/build/components/label\n */\n@Component({\n tag: 'qds-label',\n shadow: true,\n styleUrl: 'label.css',\n})\nexport class Label implements ComponentInterface {\n /**\n * Adds vertical margin to the label for alignment.\n *\n * This is useful when creating inline layouts so that the first lines have\n * the correct vertical centering.\n */\n @Prop() public readonly inline: boolean = false\n\n /**\n * Specify the labelled item as required by appending a red asterisk (*).\n */\n @Prop() public readonly required: boolean = false\n\n /**\n * The label's size.\n */\n @Prop({ reflect: true }) public readonly size: LabelSize = 'standard'\n\n /**\n * The label's text.\n */\n @Prop({ reflect: true }) public readonly text?: string\n\n @Element() private readonly element!: HTMLQdsLabelElement\n\n private inheritedAttributes: Attributes = {}\n\n public componentWillLoad(): void {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n }\n\n public render() {\n return (\n <span\n class={{\n 'qds-inline': this.inline,\n 'qds-label': true,\n }}\n data-size={this.size}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n >\n {this.required && <span class=\"qds-required\">*</span>}\n {this.text}\n </span>\n )\n }\n}\n"],"version":3}
@@ -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{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{display:inline-block}.button{-webkit-appearance:none;appearance:none;background-color:transparent;background-color:initial;border:none;padding-block:0;align-items:center;border-radius:var(--qds-control-border-radius);cursor:pointer;display:inline-flex;gap:var(--qds-control-button-gap-internal);justify-content:center;padding-inline:var(--qds-control-button-padding-horizontal);-webkit-print-color-adjust:exact;print-color-adjust:exact;-webkit-user-select:none;user-select:none;white-space:nowrap;width:100%}.button.icon-only{padding-inline:0}.button:link,.button:visited,area[href].button{-webkit-text-decoration:none;text-decoration:none}.button:any-link{-webkit-text-decoration:none;text-decoration:none}.button:focus-visible{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}[aria-disabled='true']{opacity:var(--qds-theme-disabled);pointer-events:none}[data-size='small']{font:var(--qds-control-small-text);height:var(--qds-control-small-height)}.icon-only[data-size='small']{width:var(--qds-control-small-height)}.icon[data-size='small']{font-size:var(--qds-control-small-icon-size)}[data-size='standard']{font:var(--qds-control-standard-text);height:var(--qds-control-standard-height)}.icon-only[data-size='standard']{width:var(--qds-control-standard-height)}.icon[data-size='standard']{font-size:var(--qds-control-standard-icon-size)}[data-size='large']{font:var(--qds-control-large-text);height:var(--qds-control-large-height)}.icon-only[data-size='large']{width:var(--qds-control-large-height)}.icon[data-size='large']{font-size:var(--qds-control-large-icon-size)}[data-importance='subdued']{border:var(--qds-control-border-width) solid transparent;color:var(--qds-theme-link-default)}.icon-only[data-importance='subdued']{color:var(--qds-theme-control-text-standard)}[data-importance='subdued']:hover{border:var(--qds-control-border-width) solid var(--qds-theme-link-default)}.icon-only[data-importance='subdued']:hover{background-color:var(--qds-theme-interactive-background-hover);border:none;color:var(--qds-theme-control-text-standard)}[data-importance='subdued']:active{border:var(--qds-control-border-width) solid var(--qds-theme-link-pressed);color:var(--qds-theme-link-pressed)}.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']{border:var(--qds-control-border-width) solid var(--qds-theme-control-border);color:var(--qds-theme-control-text-standard)}[data-importance='standard']:hover{background-color:var(--qds-theme-interactive-background-hover)}[data-importance='standard']:active{background-color:var(--qds-theme-interactive-background-pressed)}[data-importance='emphasized']{background-color:var(--qds-theme-signature-color-default);color:var(--qds-theme-signature-color-contrast)}[data-importance='emphasized']:hover{background-color:var(--qds-theme-signature-color-hover)}[data-importance='emphasized']:active{background-color:var(--qds-theme-signature-color-pressed)}[data-importance='destructive']{background-color:var(--qds-theme-feedback-action-destructive-default);color:var(--qds-theme-feedback-action-destructive-contrast)}[data-importance='destructive']:hover{background-color:var(--qds-theme-feedback-action-destructive-hover)}[data-importance='destructive']:active{background-color:var(--qds-theme-feedback-action-destructive-pressed)}";
10
+ const buttonCss = ":host{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{display:inline-block}.qds-button{-webkit-appearance:none;appearance:none;background-color:transparent;background-color:initial;border:none;padding-block:0;align-items:center;border-radius:var(--qds-control-border-radius);cursor:pointer;display:inline-flex;gap:var(--qds-control-button-gap-internal);justify-content:center;padding-inline:var(--qds-control-button-padding-horizontal);-webkit-print-color-adjust:exact;print-color-adjust:exact;-webkit-user-select:none;user-select:none;white-space:nowrap;width:100%}.qds-button.qds-icon-only{padding-inline:0}.qds-button:link,.qds-button:visited,area[href].qds-button{-webkit-text-decoration:none;text-decoration:none}.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)}[aria-disabled='true']{opacity:var(--qds-theme-disabled);pointer-events:none}[data-size='small']{font:var(--qds-control-small-text);height:var(--qds-control-small-height)}.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);height:var(--qds-control-standard-height)}.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);height:var(--qds-control-large-height)}.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)}[data-importance='subdued']{border:var(--qds-control-border-width) solid transparent;color:var(--qds-theme-link-default)}.qds-icon-only[data-importance='subdued']{color:var(--qds-theme-control-text-standard)}[data-importance='subdued']:hover{border:var(--qds-control-border-width) solid var(--qds-theme-link-default)}.qds-icon-only[data-importance='subdued']:hover{background-color:var(--qds-theme-interactive-background-hover);border:none;color:var(--qds-theme-control-text-standard)}[data-importance='subdued']:active{border:var(--qds-control-border-width) solid var(--qds-theme-link-pressed);color:var(--qds-theme-link-pressed)}.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']{border:var(--qds-control-border-width) solid var(--qds-theme-control-border);color:var(--qds-theme-control-text-standard)}[data-importance='standard']:hover{background-color:var(--qds-theme-interactive-background-hover)}[data-importance='standard']:active{background-color:var(--qds-theme-interactive-background-pressed)}[data-importance='emphasized']{background-color:var(--qds-theme-signature-color-default);color:var(--qds-theme-signature-color-contrast)}[data-importance='emphasized']:hover{background-color:var(--qds-theme-signature-color-hover)}[data-importance='emphasized']:active{background-color:var(--qds-theme-signature-color-pressed)}[data-importance='destructive']{background-color:var(--qds-theme-feedback-action-destructive-default);color:var(--qds-theme-feedback-action-destructive-contrast)}[data-importance='destructive']:hover{background-color:var(--qds-theme-feedback-action-destructive-hover)}[data-importance='destructive']:active{background-color:var(--qds-theme-feedback-action-destructive-pressed)}";
11
11
 
12
12
  const Button = /*@__PURE__*/ proxyCustomElement(class Button extends HTMLElement {
13
13
  constructor() {
@@ -95,9 +95,9 @@ const Button = /*@__PURE__*/ proxyCustomElement(class Button extends HTMLElement
95
95
  render() {
96
96
  const Tag = this.href === undefined ? 'button' : 'a';
97
97
  return (h(Tag, { "aria-disabled": this.computedDisabled ? 'true' : 'false', class: {
98
- button: true,
99
- 'icon-only': this.iconOnly,
100
- }, "data-importance": this.importance, "data-size": this.size, 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, onClick: this.onClick, 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: "icon", "data-size": this.size, library: this.iconLibrary, name: this.iconName })), this.text));
98
+ 'qds-button': true,
99
+ 'qds-icon-only': this.iconOnly,
100
+ }, "data-importance": this.importance, "data-size": this.size, 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, onClick: this.onClick, 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.size, library: this.iconLibrary, name: this.iconName })), this.text));
101
101
  }
102
102
  static get delegatesFocus() { return true; }
103
103
  get element() { return this; }
@@ -1 +1 @@
1
- {"file":"qds-button.js","mappings":";;;;;;;;;AAAA,MAAM,SAAS,GAAG,qjHAAqjH;;MC+B1jH,MAAM;;;;;;;IAiNT,wBAAmB,GAAe,EAAE,CAAA;IA0E3B,YAAO,GAAG,CAAC,KAAiB;MAC3C,IAAI,IAAI,CAAC,gBAAgB,EAAE;QACzB,KAAK,CAAC,cAAc,EAAE,CAA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,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAE,IAAI,CAAC,QAAQ,GACnB,CACH,EACA,IAAI,CAAC,IAAI,CACN,EACP;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/button/button.css?tag=qds-button&encapsulation=shadow","src/components/button/button.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n}\n\n.button {\n appearance: none;\n background-color: initial;\n border: none;\n padding-block: 0;\n align-items: center;\n border-radius: var(--qds-control-border-radius);\n cursor: pointer;\n display: inline-flex;\n gap: var(--qds-control-button-gap-internal);\n justify-content: center;\n padding-inline: var(--qds-control-button-padding-horizontal);\n print-color-adjust: exact;\n user-select: none;\n white-space: nowrap;\n width: 100%;\n\n &.icon-only {\n padding-inline: 0;\n }\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[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 height: var(--qds-control-small-height);\n\n &.icon-only {\n width: var(--qds-control-small-height);\n }\n\n &.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 height: var(--qds-control-standard-height);\n\n &.icon-only {\n width: var(--qds-control-standard-height);\n }\n\n &.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 height: var(--qds-control-large-height);\n\n &.icon-only {\n width: var(--qds-control-large-height);\n }\n\n &.icon {\n font-size: var(--qds-control-large-icon-size);\n }\n}\n\n[data-importance='subdued'] {\n border: var(--qds-control-border-width) solid transparent;\n color: var(--qds-theme-link-default);\n\n &.icon-only {\n color: var(--qds-theme-control-text-standard);\n }\n\n &:hover {\n border: var(--qds-control-border-width) solid var(--qds-theme-link-default);\n\n &.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: var(--qds-control-border-width) solid var(--qds-theme-link-pressed);\n color: var(--qds-theme-link-pressed);\n\n &.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[data-importance='standard'] {\n border: var(--qds-control-border-width) solid var(--qds-theme-control-border);\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[data-importance='emphasized'] {\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\n &:active {\n background-color: var(--qds-theme-signature-color-pressed);\n }\n}\n\n[data-importance='destructive'] {\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\n &:active {\n background-color: var(--qds-theme-feedback-action-destructive-pressed);\n }\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport { Component, Element, Event, h, Prop } from '@stencil/core'\nimport type { LiteralUnion } from 'type-fest'\n\nimport type { Attributes, QdsFocusEventDetail } from '../../helpers'\nimport { inheritAriaAttributes, pickFocusEventAttributes } from '../../helpers'\n\nexport type ButtonType = 'button' | 'reset' | 'submit'\nexport type Importance = 'destructive' | 'emphasized' | 'standard' | 'subdued'\nexport type ButtonSize = 'large' | 'small' | 'standard'\nexport type FormMethod = 'dialog' | 'get' | 'post'\nexport type ButtonTarget = '_blank' | '_parent' | '_self' | '_top'\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 icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop({ reflect: true }) public readonly iconName?: string\n\n /**\n * The name of a registered icon library.\n */\n @Prop({ reflect: true }) public readonly iconLibrary: string = 'default'\n\n /**\n * The button's importance.\n */\n @Prop({ reflect: true }) public readonly importance: Importance = 'standard'\n\n /**\n * The button's size.\n */\n @Prop({ reflect: true }) public readonly size: ButtonSize = 'standard'\n\n /**\n * The button's text.\n */\n @Prop({ mutable: true, reflect: true }) public readonly text?: string\n\n /**\n * Prevents the button from being interacted with: it cannot be pressed or\n * focused.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public 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> = '_self'\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 computedDisabled(): boolean {\n return this.disabled ?? false\n }\n\n private get computedTabIndex(): number {\n const parsedValue = Number.parseInt(this.inheritedAttributes.tabindex, 10)\n return Number.isNaN(parsedValue) ? 0 : parsedValue\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 ? 'true' : 'false'}\n class={{\n button: true,\n 'icon-only': this.iconOnly,\n }}\n data-importance={this.importance}\n data-size={this.size}\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 onClick={this.onClick}\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=\"icon\"\n data-size={this.size}\n library={this.iconLibrary}\n name={this.iconName}\n />\n )}\n {this.text}\n </Tag>\n )\n }\n\n private readonly onClick = (event: MouseEvent): void => {\n if (this.computedDisabled) {\n event.preventDefault()\n event.stopPropagation()\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 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,ynHAAynH;;MC+B9nH,MAAM;;;;;;;IAiNT,wBAAmB,GAAe,EAAE,CAAA;IA0E3B,YAAO,GAAG,CAAC,KAAiB;MAC3C,IAAI,IAAI,CAAC,gBAAgB,EAAE;QACzB,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,KAAK,CAAC,eAAe,EAAE,CAAA;QACvB,OAAM;OACP;MAED,IAAI,IAAI,CAAC,UAAU,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,WAAW;QAAE,OAAM;MAC7D,KAAK,CAAC,cAAc,EAAE,CAAA;MAEtB,MAAM,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;MACnD,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAA;MACjC,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS;QAAE,UAAU,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,CAAA;M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AI,EAAE,GAAG,KAAK,GAAG,GAAG,IAAI,CAAC,IAAI,GAAG,SAAS,EACzC,IAAI,EAAE,GAAG,KAAK,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,IAAI,EACzC,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,GAAG,EAAE,GAAG,KAAK,GAAG,GAAG,qBAAqB,GAAG,SAAS,EACpD,IAAI,EAAE,GAAG,KAAK,GAAG,GAAG,QAAQ,GAAG,SAAS,EACxC,QAAQ,EAAE,IAAI,CAAC,gBAAgB,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,gBAAgB,EAC5D,MAAM,EAAE,GAAG,KAAK,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,SAAS,EAC7C,IAAI,EAAE,GAAG,KAAK,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,UAAU,EAC/C,KAAK,EAAE,GAAG,KAAK,GAAG,GAAG,SAAS,GAAG,IAAI,CAAC,KAAK,KAEvC,IAAI,CAAC,mBAAmB,IAE3B,IAAI,CAAC,QAAQ,KAAK,SAAS,IAAI,IAAI,CAAC,QAAQ,KAAK,EAAE,KAClD,gBACE,KAAK,EAAC,UAAU,eACL,IAAI,CAAC,IAAI,EACpB,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,IAAI,EAAE,IAAI,CAAC,QAAQ,GACnB,CACH,EACA,IAAI,CAAC,IAAI,CACN,EACP;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/button/button.css?tag=qds-button&encapsulation=shadow","src/components/button/button.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n}\n\n.qds-button {\n appearance: none;\n background-color: initial;\n border: none;\n padding-block: 0;\n align-items: center;\n border-radius: var(--qds-control-border-radius);\n cursor: pointer;\n display: inline-flex;\n gap: var(--qds-control-button-gap-internal);\n justify-content: center;\n padding-inline: var(--qds-control-button-padding-horizontal);\n print-color-adjust: exact;\n user-select: none;\n white-space: nowrap;\n width: 100%;\n\n &.qds-icon-only {\n padding-inline: 0;\n }\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[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 height: var(--qds-control-small-height);\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 height: var(--qds-control-standard-height);\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 height: var(--qds-control-large-height);\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='subdued'] {\n border: var(--qds-control-border-width) solid transparent;\n color: var(--qds-theme-link-default);\n\n &.qds-icon-only {\n color: var(--qds-theme-control-text-standard);\n }\n\n &:hover {\n border: var(--qds-control-border-width) solid var(--qds-theme-link-default);\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: var(--qds-control-border-width) solid var(--qds-theme-link-pressed);\n color: var(--qds-theme-link-pressed);\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[data-importance='standard'] {\n border: var(--qds-control-border-width) solid var(--qds-theme-control-border);\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[data-importance='emphasized'] {\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\n &:active {\n background-color: var(--qds-theme-signature-color-pressed);\n }\n}\n\n[data-importance='destructive'] {\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\n &:active {\n background-color: var(--qds-theme-feedback-action-destructive-pressed);\n }\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport { Component, Element, Event, h, Prop } from '@stencil/core'\nimport type { LiteralUnion } from 'type-fest'\n\nimport type { Attributes, QdsFocusEventDetail } from '../../helpers'\nimport { inheritAriaAttributes, pickFocusEventAttributes } from '../../helpers'\n\nexport type ButtonType = 'button' | 'reset' | 'submit'\nexport type Importance = 'destructive' | 'emphasized' | 'standard' | 'subdued'\nexport type ButtonSize = 'large' | 'small' | 'standard'\nexport type FormMethod = 'dialog' | 'get' | 'post'\nexport type ButtonTarget = '_blank' | '_parent' | '_self' | '_top'\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 icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop({ reflect: true }) public readonly iconName?: string\n\n /**\n * The name of a registered icon library.\n */\n @Prop({ reflect: true }) public readonly iconLibrary: string = 'default'\n\n /**\n * The button's importance.\n */\n @Prop({ reflect: true }) public readonly importance: Importance = 'standard'\n\n /**\n * The button's size.\n */\n @Prop({ reflect: true }) public readonly size: ButtonSize = 'standard'\n\n /**\n * The button's text.\n */\n @Prop({ mutable: true, reflect: true }) public readonly text?: string\n\n /**\n * Prevents the button from being interacted with: it cannot be pressed or\n * focused.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public 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> = '_self'\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 computedDisabled(): boolean {\n return this.disabled ?? false\n }\n\n private get computedTabIndex(): number {\n const parsedValue = Number.parseInt(this.inheritedAttributes.tabindex, 10)\n return Number.isNaN(parsedValue) ? 0 : parsedValue\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 ? 'true' : 'false'}\n class={{\n 'qds-button': true,\n 'qds-icon-only': this.iconOnly,\n }}\n data-importance={this.importance}\n data-size={this.size}\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 onClick={this.onClick}\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.size}\n library={this.iconLibrary}\n name={this.iconName}\n />\n )}\n {this.text}\n </Tag>\n )\n }\n\n private readonly onClick = (event: MouseEvent): void => {\n if (this.computedDisabled) {\n event.preventDefault()\n event.stopPropagation()\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 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}
@@ -8,7 +8,7 @@ import { p as pickFocusEventAttributes, a as invariant, i as inheritAriaAttribut
8
8
  import { d as defineCustomElement$3 } from './icon.js';
9
9
  import { d as defineCustomElement$2 } from './label.js';
10
10
 
11
- const checkboxCss = ".sc-qds-checkbox-h{box-sizing:border-box}[hidden].sc-qds-checkbox-h{display:none !important}.sc-qds-checkbox-h *.sc-qds-checkbox,.sc-qds-checkbox-h *.sc-qds-checkbox::before,.sc-qds-checkbox-h *.sc-qds-checkbox::after{box-sizing:inherit}.sc-qds-checkbox-h{display:inline-block;line-height:0}.icon.sc-qds-checkbox{display:none;color:var(--qds-theme-signature-color-contrast);inset-inline-start:0;pointer-events:none;position:absolute}.label.sc-qds-checkbox{cursor:pointer;display:inline-flex;position:relative}.checkbox.sc-qds-checkbox{align-items:center;-webkit-appearance:none;appearance:none;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);cursor:pointer;display:flex;flex-shrink:0;justify-content:center;margin:0;-webkit-print-color-adjust:exact;print-color-adjust:exact}.checkbox.sc-qds-checkbox:focus-visible{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}.checkbox.sc-qds-checkbox::before{content:'';height:10px;position:absolute;width:10px}.checkbox.sc-qds-checkbox:hover::before{box-shadow:inset 1em 1em var(--qds-theme-signature-color-hover)}.checkbox.sc-qds-checkbox:active::before{box-shadow:inset 1em 1em var(--qds-theme-signature-color-pressed)}.checkbox.sc-qds-checkbox:checked~.checked.sc-qds-checkbox,.checkbox.sc-qds-checkbox:indeterminate~.indeterminate.sc-qds-checkbox{display:inline-block}.checkbox.sc-qds-checkbox:checked,.checkbox.sc-qds-checkbox:indeterminate{background-color:var(--qds-theme-signature-color-default);border-color:transparent}.checkbox.sc-qds-checkbox:checked:hover,.checkbox.sc-qds-checkbox:indeterminate:hover{background-color:var(--qds-theme-signature-color-hover)}.checkbox.sc-qds-checkbox:checked:active,.checkbox.sc-qds-checkbox:indeterminate:active{background-color:var(--qds-theme-signature-color-pressed)}[aria-disabled='true'].sc-qds-checkbox{opacity:var(--qds-theme-disabled);pointer-events:none}.icon[data-size='small'].sc-qds-checkbox,.checkbox[data-size='small'].sc-qds-checkbox{width:var(--qds-control-small-icon-size);height:var(--qds-control-small-icon-size)}.inline[data-size='small'].sc-qds-checkbox{margin-block:var(--qds-control-small-padding-auto-height)}.label[data-size='small'].sc-qds-checkbox{gap:var(--qds-control-small-gap-siblings-related)}.icon[data-size='standard'].sc-qds-checkbox,.checkbox[data-size='standard'].sc-qds-checkbox{width:var(--qds-control-standard-icon-size);height:var(--qds-control-standard-icon-size)}.inline[data-size='standard'].sc-qds-checkbox{margin-block:var(--qds-control-standard-padding-auto-height)}.label[data-size='standard'].sc-qds-checkbox{gap:var(--qds-control-standard-gap-siblings-related)}.icon[data-size='large'].sc-qds-checkbox,.checkbox[data-size='large'].sc-qds-checkbox{width:var(--qds-control-large-icon-size);height:var(--qds-control-large-icon-size)}.inline[data-size='large'].sc-qds-checkbox{margin-block:var(--qds-control-large-padding-auto-height)}.label[data-size='large'].sc-qds-checkbox{gap:var(--qds-control-large-gap-siblings-related)}";
11
+ const checkboxCss = ".sc-qds-checkbox-h{box-sizing:border-box}[hidden].sc-qds-checkbox-h{display:none !important}.sc-qds-checkbox-h *.sc-qds-checkbox,.sc-qds-checkbox-h *.sc-qds-checkbox::before,.sc-qds-checkbox-h *.sc-qds-checkbox::after{box-sizing:inherit}.sc-qds-checkbox-h{display:inline-block;line-height:0}.qds-icon.sc-qds-checkbox{display:none;color:var(--qds-theme-signature-color-contrast);inset-inline-start:0;pointer-events:none;position:absolute}.qds-label.sc-qds-checkbox{cursor:pointer;display:inline-flex;position:relative}.qds-checkbox.sc-qds-checkbox{align-items:center;-webkit-appearance:none;appearance:none;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);cursor:pointer;display:flex;flex-shrink:0;justify-content:center;margin:0;-webkit-print-color-adjust:exact;print-color-adjust:exact}.qds-checkbox.sc-qds-checkbox:focus-visible{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}.qds-checkbox.sc-qds-checkbox::before{content:'';height:10px;position:absolute;width:10px}.qds-checkbox.sc-qds-checkbox:hover::before{box-shadow:inset 1em 1em var(--qds-theme-signature-color-hover)}.qds-checkbox.sc-qds-checkbox:active::before{box-shadow:inset 1em 1em var(--qds-theme-signature-color-pressed)}.qds-checkbox.sc-qds-checkbox:checked~.qds-checked.sc-qds-checkbox,.qds-checkbox.sc-qds-checkbox:indeterminate~.qds-indeterminate.sc-qds-checkbox{display:inline-block}.qds-checkbox.sc-qds-checkbox:checked,.qds-checkbox.sc-qds-checkbox:indeterminate{background-color:var(--qds-theme-signature-color-default);border-color:transparent}.qds-checkbox.sc-qds-checkbox:checked:hover,.qds-checkbox.sc-qds-checkbox:indeterminate:hover{background-color:var(--qds-theme-signature-color-hover)}.qds-checkbox.sc-qds-checkbox:checked:active,.qds-checkbox.sc-qds-checkbox:indeterminate:active{background-color:var(--qds-theme-signature-color-pressed)}[aria-disabled='true'].sc-qds-checkbox{opacity:var(--qds-theme-disabled);pointer-events:none}.qds-icon[data-size='small'].sc-qds-checkbox,.qds-checkbox[data-size='small'].sc-qds-checkbox{width:var(--qds-control-small-icon-size);height:var(--qds-control-small-icon-size)}.qds-inline[data-size='small'].sc-qds-checkbox{margin-block:var(--qds-control-small-padding-auto-height)}.qds-label[data-size='small'].sc-qds-checkbox{gap:var(--qds-control-small-gap-siblings-related)}.qds-icon[data-size='standard'].sc-qds-checkbox,.qds-checkbox[data-size='standard'].sc-qds-checkbox{width:var(--qds-control-standard-icon-size);height:var(--qds-control-standard-icon-size)}.qds-inline[data-size='standard'].sc-qds-checkbox{margin-block:var(--qds-control-standard-padding-auto-height)}.qds-label[data-size='standard'].sc-qds-checkbox{gap:var(--qds-control-standard-gap-siblings-related)}.qds-icon[data-size='large'].sc-qds-checkbox,.qds-checkbox[data-size='large'].sc-qds-checkbox{width:var(--qds-control-large-icon-size);height:var(--qds-control-large-icon-size)}.qds-inline[data-size='large'].sc-qds-checkbox{margin-block:var(--qds-control-large-padding-auto-height)}.qds-label[data-size='large'].sc-qds-checkbox{gap:var(--qds-control-large-gap-siblings-related)}";
12
12
 
13
13
  let autoIncrementingId = 1;
14
14
  const Checkbox = /*@__PURE__*/ proxyCustomElement(class Checkbox extends HTMLElement {
@@ -93,17 +93,17 @@ const Checkbox = /*@__PURE__*/ proxyCustomElement(class Checkbox extends HTMLEle
93
93
  return (
94
94
  // eslint-disable-next-line jsx-a11y/label-has-associated-control
95
95
  h("label", { "aria-disabled": this.computedDisabled ? 'true' : 'false', class: {
96
- inline: this.inline,
97
- label: true,
96
+ 'qds-inline': this.inline,
97
+ 'qds-label': true,
98
98
  }, "data-size": this.size }, h("input", {
99
99
  // eslint-disable-next-line jsx-a11y/no-autofocus
100
- autoFocus: this.autoFocus, checked: this.computedIndeterminate ? false : this.checked, class: "checkbox", "data-size": this.size, disabled: this.disabled, form: this.form, indeterminate: this.indeterminate, name: this.name, onBlur: this.onBlur, onFocus: this.onFocus, ref: this.ref, required: this.required, type: "checkbox", value: this.value ?? undefined, ...this.inheritedAttributes
100
+ autoFocus: this.autoFocus, checked: this.computedIndeterminate ? false : this.checked, class: "qds-checkbox", "data-size": this.size, disabled: this.disabled, form: this.form, indeterminate: this.indeterminate, name: this.name, onBlur: this.onBlur, onFocus: this.onFocus, ref: this.ref, required: this.required, type: "checkbox", value: this.value ?? undefined, ...this.inheritedAttributes
101
101
  }), h("qds-icon", { "aria-hidden": "true", class: {
102
- icon: true,
103
- checked: true,
102
+ 'qds-icon': true,
103
+ 'qds-checked': true,
104
104
  }, "data-size": this.size, library: "core", name: "checked" }), h("qds-icon", { "aria-hidden": "true", class: {
105
- icon: true,
106
- indeterminate: true,
105
+ 'qds-icon': true,
106
+ 'qds-indeterminate': true,
107
107
  }, "data-size": this.size, library: "core", name: "indeterminate" }), this.hasText && (h("qds-label", { required: this.required, size: this.size, text: this.text }))));
108
108
  }
109
109
  get element() { return this; }
@@ -1 +1 @@
1
- {"file":"qds-checkbox.js","mappings":";;;;;;;;;;AAAA,MAAM,WAAW,GAAG,+lGAA+lG;;AC0BnnG,IAAI,kBAAkB,GAAG,CAAC,CAAA;MAcb,QAAQ;;;;;;;IAmHX,wBAAmB,GAAe,EAAE,CAAA;IAoI3B,QAAG,GAAG,CAAC,QAA2B;MACjD,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAA;KACtB,CAAA;IAEgB,WAAM,GAAG,CAAC,KAAiB;MAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;KACvD,CAAA;IAEgB,YAAO,GAAG,CAAC,KAAiB;MAC3C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;KACxD,CAAA;kBA1PyC,KAAK;gBAKe,UAAU;;;;;;;gBA4DzC,gBAAgB,kBAAkB,EAAE;;;;EA+CnE,IAAY,gBAAgB;IAC1B,OAAO,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAA;GAC9B;EAED,IAAY,qBAAqB;IAC/B,OAAO,IAAI,CAAC,aAAa,IAAI,KAAK,CAAA;GACnC;EAED,IAAY,OAAO;IACjB,QACE,CAAC,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE,KAAK,IAAI,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OAAO,EAAE,IAAI,CAAC,qBAAqB,GAAG,KAAK,GAAG,IAAI,CAAC,OAAO,EAC1D,KAAK,EAAC,UAAU,eACL,IAAI,CAAC,IAAI,EACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,aAAa,EAAE,IAAI,CAAC,aAAa,EACjC,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAC,UAAU,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS,KAE1B,IAAI,CAAC,mBAAmB;MAC5B,EACF,+BACc,MAAM,EAClB,KAAK,EAAE;QACL,IAAI,EAAE,IAAI;QACV,OAAO,EAAE,IAAI;OACd,eACU,IAAI,CAAC,IAAI,EACpB,OAAO,EAAC,MAAM,EACd,IAAI,EAAC,SAAS,GACd,EACF,+BACc,MAAM,EAClB,KAAK,EAAE;QACL,IAAI,EAAE,IAAI;QACV,aAAa,EAAE,IAAI;OACpB,eACU,IAAI,CAAC,IAAI,EACpB,OAAO,EAAC,MAAM,EACd,IAAI,EAAC,eAAe,GACpB,EACD,IAAI,CAAC,OAAO,KACX,iBACE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,GACf,CACH,CACK,EACT;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/checkbox/checkbox.css?tag=qds-checkbox&encapsulation=scoped","src/components/checkbox/checkbox.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n line-height: 0;\n}\n\n.icon {\n display: none;\n color: var(--qds-theme-signature-color-contrast);\n inset-inline-start: 0;\n pointer-events: none;\n position: absolute;\n}\n\n.label {\n cursor: pointer;\n display: inline-flex;\n position: relative;\n}\n\n.checkbox {\n align-items: center;\n appearance: none;\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 cursor: pointer;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n margin: 0;\n print-color-adjust: exact;\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 &::before {\n content: '';\n height: 10px;\n position: absolute;\n width: 10px;\n }\n\n &:hover::before {\n box-shadow: inset 1em 1em var(--qds-theme-signature-color-hover);\n }\n\n &:active::before {\n box-shadow: inset 1em 1em var(--qds-theme-signature-color-pressed);\n }\n\n &:checked ~ .checked,\n &:indeterminate ~ .indeterminate {\n display: inline-block;\n }\n\n &:checked,\n &:indeterminate {\n background-color: var(--qds-theme-signature-color-default);\n border-color: transparent;\n\n &:hover {\n background-color: var(--qds-theme-signature-color-hover);\n }\n\n &:active {\n background-color: var(--qds-theme-signature-color-pressed);\n }\n }\n}\n\n[aria-disabled='true'] {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n}\n\n[data-size='small'] {\n &:is(.icon, .checkbox) {\n width: var(--qds-control-small-icon-size);\n height: var(--qds-control-small-icon-size);\n }\n\n &.inline {\n margin-block: var(--qds-control-small-padding-auto-height);\n }\n\n &.label {\n gap: var(--qds-control-small-gap-siblings-related);\n }\n}\n\n[data-size='standard'] {\n &:is(.icon, .checkbox) {\n width: var(--qds-control-standard-icon-size);\n height: var(--qds-control-standard-icon-size);\n }\n\n &.inline {\n margin-block: var(--qds-control-standard-padding-auto-height);\n }\n\n &.label {\n gap: var(--qds-control-standard-gap-siblings-related);\n }\n}\n\n[data-size='large'] {\n &:is(.icon, .checkbox) {\n width: var(--qds-control-large-icon-size);\n height: var(--qds-control-large-icon-size);\n }\n\n &.inline {\n margin-block: var(--qds-control-large-padding-auto-height);\n }\n\n &.label {\n gap: var(--qds-control-large-gap-siblings-related);\n }\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport {\n Component,\n Element,\n Event,\n h,\n Listen,\n Method,\n Prop,\n} from '@stencil/core'\n\nimport type { Attributes, QdsFocusEventDetail } from '../../helpers'\nimport {\n inheritAriaAttributes,\n inheritAttributes,\n invariant,\n pickFocusEventAttributes,\n} from '../../helpers'\n\nexport type CheckboxValue = number | string | null\nexport type CheckboxSize = 'large' | 'small' | 'standard'\n\nlet autoIncrementingId = 1\n\n/**\n * `<qds-checkbox>` elements are rendered as boxes that are checked (ticked)\n * when activated, like you might see in an official government paper form. A\n * checkbox allows you to select single values for submission in a form (or not).\n *\n * @see https://quartz.se.com/build/components/checkbox\n */\n@Component({\n tag: 'qds-checkbox',\n scoped: true,\n styleUrl: 'checkbox.css',\n})\nexport class Checkbox implements ComponentInterface {\n /**\n * Adds vertical margin to the checkbox for alignment.\n *\n * This is useful when creating inline layouts so that the first lines have\n * the correct vertical centering.\n */\n @Prop() public readonly inline: boolean = false\n\n /**\n * The checkbox's size.\n */\n @Prop({ reflect: true }) public readonly size: CheckboxSize = 'standard'\n\n /**\n * The checkbox's text.\n */\n @Prop({ mutable: true, reflect: true }) public readonly text?: string\n\n /**\n * Specify whether the checkbox should have focus when the page loads.\n *\n * @webnative\n */\n @Prop({ attribute: 'autofocus' }) public readonly autoFocus?: boolean\n\n /**\n * Sets the checkbox's state.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public checked?: boolean\n\n /**\n * Prevents the checkbox from being interacted with: it cannot be pressed or\n * focused.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public disabled?: boolean\n\n /**\n * The [`<form>`](https://developer.mozilla.org/docs/Web/HTML/Element/form)\n * element to associate the checkbox with (its form owner).\n *\n * The value of this property must be the id of a `<form>` in the same\n * document. If this property is not set, the `<qds-checkbox>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This property lets you associate `<qds-checkbox>` 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 * Sets the checkbox to an indeterminate state. This is usually applied to\n * checkboxes that represents a \"select all/none\" behavior when associated\n * checkboxes have a mix of checked and unchecked states.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public indeterminate?: boolean\n\n /**\n * The name of the checkbox, which is submitted with the form data. An\n * incrementing ID is used by default.\n *\n * @webnative\n */\n @Prop() public readonly name = `qds-checkbox-${autoIncrementingId}`\n\n /**\n * A value must be specified for the checkbox before the owning form can be\n * submitted.\n *\n * See\n * [Client-side validation](https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation)\n * and the\n * [HTML attribute: `required`](https://developer.mozilla.org/docs/Web/HTML/Attributes/required)\n * for more information.\n *\n * @webnative\n */\n @Prop() public readonly required?: boolean\n\n /**\n * The value of the checkbox, submitted as a name/value pair with form data.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public value?: CheckboxValue\n\n /**\n * Emitted when the checkbox loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when a change to the checkbox's state is committed by the user.\n */\n @Event({ eventName: 'qdsChange', cancelable: false })\n private readonly changeEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the checkbox gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n @Element() private readonly element!: HTMLQdsCheckboxElement\n\n private inheritedAttributes: Attributes = {}\n\n private input?: HTMLInputElement\n\n private get computedDisabled(): boolean {\n return this.disabled ?? false\n }\n\n private get computedIndeterminate(): boolean {\n return this.indeterminate ?? false\n }\n\n private get hasText(): boolean {\n return (\n (this.text !== undefined && this.text !== '') || this.required === true\n )\n }\n\n /**\n * Returns whether a form will validate this checkbox when it is submitted\n * without having to submit it.\n */\n @Method()\n public async checkValidity(): Promise<boolean> {\n invariant(this.input)\n\n return this.input.checkValidity()\n }\n\n /**\n * Returns true if the checkbox's value passes validity checks; otherwise,\n * returns false, and (if the event isn't canceled) reports the problem to\n * the user.\n */\n @Method()\n public async reportValidity(): Promise<boolean> {\n invariant(this.input)\n\n return this.input.reportValidity()\n }\n\n /**\n * Sets a custom validity message for the checkbox. If this message is not the\n * empty string, then the checkbox is considered invalid.\n */\n @Method()\n public async setCustomValidity(message: string): Promise<void> {\n invariant(this.input)\n\n this.input.setCustomValidity(message)\n }\n\n @Listen('click')\n protected onClick(event: MouseEvent): void {\n if (this.computedDisabled) return\n\n event.preventDefault()\n\n this.checked = this.computedIndeterminate ? true : !(this.checked ?? false)\n this.changeEmitter.emit()\n this.indeterminate = false\n }\n\n public componentWillLoad(): void {\n autoIncrementingId += 1\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.element),\n ...inheritAttributes(this.element, ['tabindex']),\n }\n }\n\n public render() {\n return (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label\n aria-disabled={this.computedDisabled ? 'true' : 'false'}\n class={{\n inline: this.inline,\n label: true,\n }}\n data-size={this.size}\n >\n <input\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.autoFocus}\n checked={this.computedIndeterminate ? false : this.checked}\n class=\"checkbox\"\n data-size={this.size}\n disabled={this.disabled}\n form={this.form}\n indeterminate={this.indeterminate}\n name={this.name}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n ref={this.ref}\n required={this.required}\n type=\"checkbox\"\n value={this.value ?? undefined}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n />\n <qds-icon\n aria-hidden=\"true\"\n class={{\n icon: true,\n checked: true,\n }}\n data-size={this.size}\n library=\"core\"\n name=\"checked\"\n />\n <qds-icon\n aria-hidden=\"true\"\n class={{\n icon: true,\n indeterminate: true,\n }}\n data-size={this.size}\n library=\"core\"\n name=\"indeterminate\"\n />\n {this.hasText && (\n <qds-label\n required={this.required}\n size={this.size}\n text={this.text}\n />\n )}\n </label>\n )\n }\n\n private readonly ref = (checkbox?: HTMLInputElement): void => {\n this.input = checkbox\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-checkbox.js","mappings":";;;;;;;;;;AAAA,MAAM,WAAW,GAAG,mtGAAmtG;;AC0BvuG,IAAI,kBAAkB,GAAG,CAAC,CAAA;MAcb,QAAQ;;;;;;;IAmHX,wBAAmB,GAAe,EAAE,CAAA;IAoI3B,QAAG,GAAG,CAAC,QAA2B;MACjD,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAA;KACtB,CAAA;IAEgB,WAAM,GAAG,CAAC,KAAiB;MAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;KACvD,CAAA;IAEgB,YAAO,GAAG,CAAC,KAAiB;MAC3C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;KACxD,CAAA;kBA1PyC,KAAK;gBAKe,UAAU;;;;;;;gBA4DzC,gBAAgB,kBAAkB,EAAE;;;;EA+CnE,IAAY,gBAAgB;IAC1B,OAAO,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAA;GAC9B;EAED,IAAY,qBAAqB;IAC/B,OAAO,IAAI,CAAC,aAAa,IAAI,KAAK,CAAA;GACnC;E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,MAAM;QACzB,WAAW,EAAE,IAAI;OAClB,eACU,IAAI,CAAC,IAAI,IAEpB;;MAEE,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,OAAO,EAAE,IAAI,CAAC,qBAAqB,GAAG,KAAK,GAAG,IAAI,CAAC,OAAO,EAC1D,KAAK,EAAC,cAAc,eACT,IAAI,CAAC,IAAI,EACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,aAAa,EAAE,IAAI,CAAC,aAAa,EACjC,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAC,UAAU,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS,KAE1B,IAAI,CAAC,mBAAmB;MAC5B,EACF,+BACc,MAAM,EAClB,KAAK,EAAE;QACL,UAAU,EAAE,IAAI;QAChB,aAAa,EAAE,IAAI;OACpB,eACU,IAAI,CAAC,IAAI,EACpB,OAAO,EAAC,MAAM,EACd,IAAI,EAAC,SAAS,GACd,EACF,+BACc,MAAM,EAClB,KAAK,EAAE;QACL,UAAU,EAAE,IAAI;QAChB,mBAAmB,EAAE,IAAI;OAC1B,eACU,IAAI,CAAC,IAAI,EACpB,OAAO,EAAC,MAAM,EACd,IAAI,EAAC,eAAe,GACpB,EACD,IAAI,CAAC,OAAO,KACX,iBACE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,GACf,CACH,CACK,EACT;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/checkbox/checkbox.css?tag=qds-checkbox&encapsulation=scoped","src/components/checkbox/checkbox.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n line-height: 0;\n}\n\n.qds-icon {\n display: none;\n color: var(--qds-theme-signature-color-contrast);\n inset-inline-start: 0;\n pointer-events: none;\n position: absolute;\n}\n\n.qds-label {\n cursor: pointer;\n display: inline-flex;\n position: relative;\n}\n\n.qds-checkbox {\n align-items: center;\n appearance: none;\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 cursor: pointer;\n display: flex;\n flex-shrink: 0;\n justify-content: center;\n margin: 0;\n print-color-adjust: exact;\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 &::before {\n content: '';\n height: 10px;\n position: absolute;\n width: 10px;\n }\n\n &:hover::before {\n box-shadow: inset 1em 1em var(--qds-theme-signature-color-hover);\n }\n\n &:active::before {\n box-shadow: inset 1em 1em var(--qds-theme-signature-color-pressed);\n }\n\n &:checked ~ .qds-checked,\n &:indeterminate ~ .qds-indeterminate {\n display: inline-block;\n }\n\n &:checked,\n &:indeterminate {\n background-color: var(--qds-theme-signature-color-default);\n border-color: transparent;\n\n &:hover {\n background-color: var(--qds-theme-signature-color-hover);\n }\n\n &:active {\n background-color: var(--qds-theme-signature-color-pressed);\n }\n }\n}\n\n[aria-disabled='true'] {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n}\n\n[data-size='small'] {\n &:is(.qds-icon, .qds-checkbox) {\n width: var(--qds-control-small-icon-size);\n height: var(--qds-control-small-icon-size);\n }\n\n &.qds-inline {\n margin-block: var(--qds-control-small-padding-auto-height);\n }\n\n &.qds-label {\n gap: var(--qds-control-small-gap-siblings-related);\n }\n}\n\n[data-size='standard'] {\n &:is(.qds-icon, .qds-checkbox) {\n width: var(--qds-control-standard-icon-size);\n height: var(--qds-control-standard-icon-size);\n }\n\n &.qds-inline {\n margin-block: var(--qds-control-standard-padding-auto-height);\n }\n\n &.qds-label {\n gap: var(--qds-control-standard-gap-siblings-related);\n }\n}\n\n[data-size='large'] {\n &:is(.qds-icon, .qds-checkbox) {\n width: var(--qds-control-large-icon-size);\n height: var(--qds-control-large-icon-size);\n }\n\n &.qds-inline {\n margin-block: var(--qds-control-large-padding-auto-height);\n }\n\n &.qds-label {\n gap: var(--qds-control-large-gap-siblings-related);\n }\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport {\n Component,\n Element,\n Event,\n h,\n Listen,\n Method,\n Prop,\n} from '@stencil/core'\n\nimport type { Attributes, QdsFocusEventDetail } from '../../helpers'\nimport {\n inheritAriaAttributes,\n inheritAttributes,\n invariant,\n pickFocusEventAttributes,\n} from '../../helpers'\n\nexport type CheckboxValue = number | string | null\nexport type CheckboxSize = 'large' | 'small' | 'standard'\n\nlet autoIncrementingId = 1\n\n/**\n * `<qds-checkbox>` elements are rendered as boxes that are checked (ticked)\n * when activated, like you might see in an official government paper form. A\n * checkbox allows you to select single values for submission in a form (or not).\n *\n * @see https://quartz.se.com/build/components/checkbox\n */\n@Component({\n tag: 'qds-checkbox',\n scoped: true,\n styleUrl: 'checkbox.css',\n})\nexport class Checkbox implements ComponentInterface {\n /**\n * Adds vertical margin to the checkbox for alignment.\n *\n * This is useful when creating inline layouts so that the first lines have\n * the correct vertical centering.\n */\n @Prop() public readonly inline: boolean = false\n\n /**\n * The checkbox's size.\n */\n @Prop({ reflect: true }) public readonly size: CheckboxSize = 'standard'\n\n /**\n * The checkbox's text.\n */\n @Prop({ mutable: true, reflect: true }) public readonly text?: string\n\n /**\n * Specify whether the checkbox should have focus when the page loads.\n *\n * @webnative\n */\n @Prop({ attribute: 'autofocus' }) public readonly autoFocus?: boolean\n\n /**\n * Sets the checkbox's state.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public checked?: boolean\n\n /**\n * Prevents the checkbox from being interacted with: it cannot be pressed or\n * focused.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public disabled?: boolean\n\n /**\n * The [`<form>`](https://developer.mozilla.org/docs/Web/HTML/Element/form)\n * element to associate the checkbox with (its form owner).\n *\n * The value of this property must be the id of a `<form>` in the same\n * document. If this property is not set, the `<qds-checkbox>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This property lets you associate `<qds-checkbox>` 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 * Sets the checkbox to an indeterminate state. This is usually applied to\n * checkboxes that represents a \"select all/none\" behavior when associated\n * checkboxes have a mix of checked and unchecked states.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public indeterminate?: boolean\n\n /**\n * The name of the checkbox, which is submitted with the form data. An\n * incrementing ID is used by default.\n *\n * @webnative\n */\n @Prop() public readonly name = `qds-checkbox-${autoIncrementingId}`\n\n /**\n * A value must be specified for the checkbox before the owning form can be\n * submitted.\n *\n * See\n * [Client-side validation](https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation)\n * and the\n * [HTML attribute: `required`](https://developer.mozilla.org/docs/Web/HTML/Attributes/required)\n * for more information.\n *\n * @webnative\n */\n @Prop() public readonly required?: boolean\n\n /**\n * The value of the checkbox, submitted as a name/value pair with form data.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public value?: CheckboxValue\n\n /**\n * Emitted when the checkbox loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when a change to the checkbox's state is committed by the user.\n */\n @Event({ eventName: 'qdsChange', cancelable: false })\n private readonly changeEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the checkbox gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n @Element() private readonly element!: HTMLQdsCheckboxElement\n\n private inheritedAttributes: Attributes = {}\n\n private input?: HTMLInputElement\n\n private get computedDisabled(): boolean {\n return this.disabled ?? false\n }\n\n private get computedIndeterminate(): boolean {\n return this.indeterminate ?? false\n }\n\n private get hasText(): boolean {\n return (\n (this.text !== undefined && this.text !== '') || this.required === true\n )\n }\n\n /**\n * Returns whether a form will validate this checkbox when it is submitted\n * without having to submit it.\n */\n @Method()\n public async checkValidity(): Promise<boolean> {\n invariant(this.input)\n\n return this.input.checkValidity()\n }\n\n /**\n * Returns true if the checkbox's value passes validity checks; otherwise,\n * returns false, and (if the event isn't canceled) reports the problem to\n * the user.\n */\n @Method()\n public async reportValidity(): Promise<boolean> {\n invariant(this.input)\n\n return this.input.reportValidity()\n }\n\n /**\n * Sets a custom validity message for the checkbox. If this message is not the\n * empty string, then the checkbox is considered invalid.\n */\n @Method()\n public async setCustomValidity(message: string): Promise<void> {\n invariant(this.input)\n\n this.input.setCustomValidity(message)\n }\n\n @Listen('click')\n protected onClick(event: MouseEvent): void {\n if (this.computedDisabled) return\n\n event.preventDefault()\n\n this.checked = this.computedIndeterminate ? true : !(this.checked ?? false)\n this.changeEmitter.emit()\n this.indeterminate = false\n }\n\n public componentWillLoad(): void {\n autoIncrementingId += 1\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.element),\n ...inheritAttributes(this.element, ['tabindex']),\n }\n }\n\n public render() {\n return (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label\n aria-disabled={this.computedDisabled ? 'true' : 'false'}\n class={{\n 'qds-inline': this.inline,\n 'qds-label': true,\n }}\n data-size={this.size}\n >\n <input\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.autoFocus}\n checked={this.computedIndeterminate ? false : this.checked}\n class=\"qds-checkbox\"\n data-size={this.size}\n disabled={this.disabled}\n form={this.form}\n indeterminate={this.indeterminate}\n name={this.name}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n ref={this.ref}\n required={this.required}\n type=\"checkbox\"\n value={this.value ?? undefined}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n />\n <qds-icon\n aria-hidden=\"true\"\n class={{\n 'qds-icon': true,\n 'qds-checked': true,\n }}\n data-size={this.size}\n library=\"core\"\n name=\"checked\"\n />\n <qds-icon\n aria-hidden=\"true\"\n class={{\n 'qds-icon': true,\n 'qds-indeterminate': true,\n }}\n data-size={this.size}\n library=\"core\"\n name=\"indeterminate\"\n />\n {this.hasText && (\n <qds-label\n required={this.required}\n size={this.size}\n text={this.text}\n />\n )}\n </label>\n )\n }\n\n private readonly ref = (checkbox?: HTMLInputElement): void => {\n this.input = checkbox\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}
@@ -6,7 +6,7 @@
6
6
  import { proxyCustomElement, HTMLElement, createEvent, h, Host } from '@stencil/core/internal/client';
7
7
  import { c as ignorePromise, a as invariant, i as inheritAriaAttributes } from './helpers.js';
8
8
 
9
- const dialogCss = ":host{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{display:none;position:fixed;inset:0}:host([open]){display:block}.dialog{border-radius:var(--qds-popup-border-radius);border:none;box-shadow:var(--qds-theme-popup-elevation);padding:0}.dialog::backdrop{background:transparent none repeat 0 0 / auto auto padding-box border-box scroll;background:initial}.dialog[open]~.backdrop{-webkit-backdrop-filter:blur(var(--qds-theme-popup-overlay-blur));backdrop-filter:blur(var(--qds-theme-popup-overlay-blur));background-color:var(--qds-theme-popup-overlay-background);inset:0;opacity:var(--qds-theme-popup-overlay-opacity);position:fixed}.content{align-items:flex-start;background-color:var(--qds-theme-popup-background);display:flex;flex-direction:column;gap:var(--qds-popup-gap-children-related);padding:var(--qds-popup-padding)}::slotted(blockquote),::slotted(button),::slotted(dd),::slotted(dl),::slotted(fieldset),::slotted(figure),::slotted(h1),::slotted(h2),::slotted(h3),::slotted(h4),::slotted(h5),::slotted(h6),::slotted(hr),::slotted(input),::slotted(menu),::slotted(ol),::slotted(p),::slotted(pre),::slotted(select),::slotted(textarea),::slotted(ul){margin:0}";
9
+ const dialogCss = ":host{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{display:none;position:fixed;inset:0}:host([open]){display:block}.qds-dialog{border-radius:var(--qds-popup-border-radius);border:none;box-shadow:var(--qds-theme-popup-elevation);padding:0}.qds-dialog::backdrop{background:transparent none repeat 0 0 / auto auto padding-box border-box scroll;background:initial}.qds-dialog[open]~.qds-backdrop{-webkit-backdrop-filter:blur(var(--qds-theme-popup-overlay-blur));backdrop-filter:blur(var(--qds-theme-popup-overlay-blur));background-color:var(--qds-theme-popup-overlay-background);inset:0;opacity:var(--qds-theme-popup-overlay-opacity);position:fixed}.qds-content{align-items:flex-start;background-color:var(--qds-theme-popup-background);display:flex;flex-direction:column;gap:var(--qds-popup-gap-children-related);padding:var(--qds-popup-padding)}::slotted(blockquote),::slotted(button),::slotted(dd),::slotted(dl),::slotted(fieldset),::slotted(figure),::slotted(h1),::slotted(h2),::slotted(h3),::slotted(h4),::slotted(h5),::slotted(h6),::slotted(hr),::slotted(input),::slotted(menu),::slotted(ol),::slotted(p),::slotted(pre),::slotted(select),::slotted(textarea),::slotted(ul){margin:0}";
10
10
 
11
11
  const Dialog = /*@__PURE__*/ proxyCustomElement(class Dialog extends HTMLElement {
12
12
  constructor() {
@@ -63,7 +63,7 @@ const Dialog = /*@__PURE__*/ proxyCustomElement(class Dialog extends HTMLElement
63
63
  await this.show();
64
64
  }
65
65
  render() {
66
- return (h(Host, null, h("dialog", { class: "dialog", ref: this.ref, onSubmit: this.boundSubmit, onCancel: this.onCancel, onClose: this.onClose, ...this.inheritedAttributes }, h("div", { class: "content" }, h("slot", null))), h("div", { class: "backdrop" })));
66
+ return (h(Host, null, h("dialog", { class: "qds-dialog", ref: this.ref, onSubmit: this.boundSubmit, onCancel: this.onCancel, onClose: this.onClose, ...this.inheritedAttributes }, h("div", { class: "qds-content" }, h("slot", null))), h("div", { class: "qds-backdrop" })));
67
67
  }
68
68
  async handleSubmit(event) {
69
69
  if ((event instanceof SubmitEvent &&
@@ -1 +1 @@
1
- {"file":"qds-dialog.js","mappings":";;;;;;;;AAAA,MAAM,SAAS,GAAG,8uCAA8uC;;MC8BnvC,MAAM;;;;;;;IA8BT,wBAAmB,GAAe,EAAE,CAAA;IA6E3B,gBAAW,GAAG,CAAC,KAAY;MAC1C,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;KACxC,CAAA;IAEgB,aAAQ,GAAG,CAAC,KAAY;MACvC,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,gBAAgB;QAAE,KAAK,CAAC,cAAc,EAAE,CAAA;KACvE,CAAA;IAEgB,YAAO,GAAG;MACzB,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;MAEtB,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;MACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAA;KAC7B,CAAA;IAEgB,QAAG,GAAG,CAAC,MAA0B;MAChD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;KACrB,CAAA;gBAtHqD,KAAK;;;;;;;;;EAoCpD,MAAM,IAAI;IACf,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IAEtB,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAA;IACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CA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;;;;;;;;;;;","names":[],"sources":["src/components/dialog/dialog.css?tag=qds-dialog&encapsulation=shadow","src/components/dialog/dialog.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: none;\n position: fixed;\n inset: 0;\n}\n\n:host([open]) {\n display: block;\n}\n\n.dialog {\n border-radius: var(--qds-popup-border-radius);\n border: none;\n box-shadow: var(--qds-theme-popup-elevation);\n padding: 0;\n\n &::backdrop {\n background: initial;\n }\n\n &[open] ~ .backdrop {\n backdrop-filter: blur(var(--qds-theme-popup-overlay-blur));\n background-color: var(--qds-theme-popup-overlay-background);\n inset: 0;\n opacity: var(--qds-theme-popup-overlay-opacity);\n position: fixed;\n }\n}\n\n.content {\n align-items: flex-start;\n background-color: var(--qds-theme-popup-background);\n display: flex;\n flex-direction: column;\n gap: var(--qds-popup-gap-children-related);\n padding: var(--qds-popup-padding);\n}\n\n::slotted(blockquote),\n::slotted(button),\n::slotted(dd),\n::slotted(dl),\n::slotted(fieldset),\n::slotted(figure),\n::slotted(h1),\n::slotted(h2),\n::slotted(h3),\n::slotted(h4),\n::slotted(h5),\n::slotted(h6),\n::slotted(hr),\n::slotted(input),\n::slotted(menu),\n::slotted(ol),\n::slotted(p),\n::slotted(pre),\n::slotted(select),\n::slotted(textarea),\n::slotted(ul) {\n margin: 0;\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport {\n Component,\n Element,\n Event,\n h,\n Host,\n Method,\n Prop,\n Watch,\n} from '@stencil/core'\n\nimport type { Attributes } from '../../helpers'\nimport { ignorePromise, inheritAriaAttributes, invariant } from '../../helpers'\n\n/**\n * The `<qds-dialog>` element represent a dialog box or other interactive\n * component, such as a dismissible alert, inspector, or subwindow.\n *\n * @see https://quartz.se.com/build/components/dialog\n */\n@Component({\n tag: 'qds-dialog',\n shadow: true,\n styleUrl: 'dialog.css',\n})\nexport class Dialog implements ComponentInterface {\n /**\n * Indicates whether or not the dialog is open. You can toggle this attribute\n * to show and hide the dialog, or you can use the `show()` and `close()`\n * methods and this attribute will reflect the dialog’s open state.\n */\n @Prop({ mutable: true, reflect: true }) public open = false\n\n @Element() private readonly element!: HTMLQdsDialogElement\n\n /**\n * Emitted when the user instructs the browser that they wish to dismiss the\n * currently open dialog. The browser fires this event when the user presses\n * the `Esc` key.\n *\n * When a dialog is dismissed with the `Esc` key, both the `qdsCancel` and\n * `qdsClose` events are fired.\n */\n @Event({ eventName: 'qdsCancel', bubbles: false, composed: false })\n private readonly cancelEmitter!: EventEmitter<void>\n\n /** Emitted when the dialog has been closed. */\n @Event({\n eventName: 'qdsClose',\n bubbles: false,\n cancelable: false,\n composed: false,\n })\n private readonly closeEmitter!: EventEmitter<void>\n\n private inheritedAttributes: Attributes = {}\n\n private dialog?: HTMLDialogElement\n\n /**\n * Displays the dialog over the top of any other dialogs that might be\n * present. Everything outside of the dialog is [inert][] with interactions\n * outside of the dialog being blocked.\n *\n * [inert]: https://developer.mozilla.org/docs/Web/API/HTMLElement/inert\n */\n @Method()\n public async show(): Promise<void> {\n invariant(this.dialog)\n\n this.dialog.showModal()\n this.open = this.dialog.open\n }\n\n /**\n * Closes the dialog.\n */\n @Method()\n public async close(): Promise<void> {\n invariant(this.dialog)\n\n this.dialog.close()\n }\n\n @Watch('open')\n protected async openChanged(): Promise<void> {\n await (this.open ? this.show() : this.close())\n }\n\n public componentWillLoad(): void {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n }\n\n public async componentDidLoad(): Promise<void> {\n if (this.open) await this.show()\n }\n\n public render() {\n return (\n <Host>\n <dialog\n class=\"dialog\"\n ref={this.ref}\n onSubmit={this.boundSubmit}\n onCancel={this.onCancel}\n onClose={this.onClose}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n >\n <div class=\"content\">\n <slot />\n </div>\n </dialog>\n <div class=\"backdrop\" />\n </Host>\n )\n }\n\n private async handleSubmit(event: Event): Promise<void> {\n if (\n (event instanceof SubmitEvent &&\n (event.submitter instanceof HTMLButtonElement ||\n (event.submitter instanceof HTMLInputElement &&\n event.submitter.formMethod === 'dialog'))) ||\n (event.target instanceof HTMLFormElement &&\n event.target.method === 'dialog')\n ) {\n event.preventDefault()\n await this.close()\n }\n }\n\n private readonly boundSubmit = (event: Event): void => {\n ignorePromise(this.handleSubmit(event))\n }\n\n private readonly onCancel = (event: Event): void => {\n if (this.cancelEmitter.emit().defaultPrevented) event.preventDefault()\n }\n\n private readonly onClose = (): void => {\n invariant(this.dialog)\n\n this.closeEmitter.emit()\n this.open = this.dialog.open\n }\n\n private readonly ref = (dialog?: HTMLDialogElement): void => {\n this.dialog = dialog\n }\n}\n"],"version":3}
1
+ {"file":"qds-dialog.js","mappings":";;;;;;;;AAAA,MAAM,SAAS,GAAG,kwCAAkwC;;MC8BvwC,MAAM;;;;;;;IA8BT,wBAAmB,GAAe,EAAE,CAAA;IA6E3B,gBAAW,GAAG,CAAC,KAAY;MAC1C,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAA;KACxC,CAAA;IAEgB,aAAQ,GAAG,CAAC,KAAY;MACvC,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAC,gBAAgB;QAAE,KAAK,CAAC,cAAc,EAAE,CAAA;KACvE,CAAA;IAEgB,YAAO,GAAG;MACzB,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;MAEtB,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAA;MACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAA;KAC7B,CAAA;IAEgB,QAAG,GAAG,CAAC,MAA0B;MAChD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;KACrB,CAAA;gBAtHqD,KAAK;;;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Ae;QACtC,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,EACnC;MACA,KAAK,CAAC,cAAc,EAAE,CAAA;MACtB,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;KACnB;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/dialog/dialog.css?tag=qds-dialog&encapsulation=shadow","src/components/dialog/dialog.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: none;\n position: fixed;\n inset: 0;\n}\n\n:host([open]) {\n display: block;\n}\n\n.qds-dialog {\n border-radius: var(--qds-popup-border-radius);\n border: none;\n box-shadow: var(--qds-theme-popup-elevation);\n padding: 0;\n\n &::backdrop {\n background: initial;\n }\n\n &[open] ~ .qds-backdrop {\n backdrop-filter: blur(var(--qds-theme-popup-overlay-blur));\n background-color: var(--qds-theme-popup-overlay-background);\n inset: 0;\n opacity: var(--qds-theme-popup-overlay-opacity);\n position: fixed;\n }\n}\n\n.qds-content {\n align-items: flex-start;\n background-color: var(--qds-theme-popup-background);\n display: flex;\n flex-direction: column;\n gap: var(--qds-popup-gap-children-related);\n padding: var(--qds-popup-padding);\n}\n\n::slotted(blockquote),\n::slotted(button),\n::slotted(dd),\n::slotted(dl),\n::slotted(fieldset),\n::slotted(figure),\n::slotted(h1),\n::slotted(h2),\n::slotted(h3),\n::slotted(h4),\n::slotted(h5),\n::slotted(h6),\n::slotted(hr),\n::slotted(input),\n::slotted(menu),\n::slotted(ol),\n::slotted(p),\n::slotted(pre),\n::slotted(select),\n::slotted(textarea),\n::slotted(ul) {\n margin: 0;\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface, EventEmitter } from '@stencil/core'\nimport {\n Component,\n Element,\n Event,\n h,\n Host,\n Method,\n Prop,\n Watch,\n} from '@stencil/core'\n\nimport type { Attributes } from '../../helpers'\nimport { ignorePromise, inheritAriaAttributes, invariant } from '../../helpers'\n\n/**\n * The `<qds-dialog>` element represent a dialog box or other interactive\n * component, such as a dismissible alert, inspector, or subwindow.\n *\n * @see https://quartz.se.com/build/components/dialog\n */\n@Component({\n tag: 'qds-dialog',\n shadow: true,\n styleUrl: 'dialog.css',\n})\nexport class Dialog implements ComponentInterface {\n /**\n * Indicates whether or not the dialog is open. You can toggle this attribute\n * to show and hide the dialog, or you can use the `show()` and `close()`\n * methods and this attribute will reflect the dialog’s open state.\n */\n @Prop({ mutable: true, reflect: true }) public open = false\n\n @Element() private readonly element!: HTMLQdsDialogElement\n\n /**\n * Emitted when the user instructs the browser that they wish to dismiss the\n * currently open dialog. The browser fires this event when the user presses\n * the `Esc` key.\n *\n * When a dialog is dismissed with the `Esc` key, both the `qdsCancel` and\n * `qdsClose` events are fired.\n */\n @Event({ eventName: 'qdsCancel', bubbles: false, composed: false })\n private readonly cancelEmitter!: EventEmitter<void>\n\n /** Emitted when the dialog has been closed. */\n @Event({\n eventName: 'qdsClose',\n bubbles: false,\n cancelable: false,\n composed: false,\n })\n private readonly closeEmitter!: EventEmitter<void>\n\n private inheritedAttributes: Attributes = {}\n\n private dialog?: HTMLDialogElement\n\n /**\n * Displays the dialog over the top of any other dialogs that might be\n * present. Everything outside of the dialog is [inert][] with interactions\n * outside of the dialog being blocked.\n *\n * [inert]: https://developer.mozilla.org/docs/Web/API/HTMLElement/inert\n */\n @Method()\n public async show(): Promise<void> {\n invariant(this.dialog)\n\n this.dialog.showModal()\n this.open = this.dialog.open\n }\n\n /**\n * Closes the dialog.\n */\n @Method()\n public async close(): Promise<void> {\n invariant(this.dialog)\n\n this.dialog.close()\n }\n\n @Watch('open')\n protected async openChanged(): Promise<void> {\n await (this.open ? this.show() : this.close())\n }\n\n public componentWillLoad(): void {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n }\n\n public async componentDidLoad(): Promise<void> {\n if (this.open) await this.show()\n }\n\n public render() {\n return (\n <Host>\n <dialog\n class=\"qds-dialog\"\n ref={this.ref}\n onSubmit={this.boundSubmit}\n onCancel={this.onCancel}\n onClose={this.onClose}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n >\n <div class=\"qds-content\">\n <slot />\n </div>\n </dialog>\n <div class=\"qds-backdrop\" />\n </Host>\n )\n }\n\n private async handleSubmit(event: Event): Promise<void> {\n if (\n (event instanceof SubmitEvent &&\n (event.submitter instanceof HTMLButtonElement ||\n (event.submitter instanceof HTMLInputElement &&\n event.submitter.formMethod === 'dialog'))) ||\n (event.target instanceof HTMLFormElement &&\n event.target.method === 'dialog')\n ) {\n event.preventDefault()\n await this.close()\n }\n }\n\n private readonly boundSubmit = (event: Event): void => {\n ignorePromise(this.handleSubmit(event))\n }\n\n private readonly onCancel = (event: Event): void => {\n if (this.cancelEmitter.emit().defaultPrevented) event.preventDefault()\n }\n\n private readonly onClose = (): void => {\n invariant(this.dialog)\n\n this.closeEmitter.emit()\n this.open = this.dialog.open\n }\n\n private readonly ref = (dialog?: HTMLDialogElement): void => {\n this.dialog = dialog\n }\n}\n"],"version":3}
@@ -6,7 +6,7 @@
6
6
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
7
7
  import { i as inheritAriaAttributes } from './helpers.js';
8
8
 
9
- const dividerCss = ":host{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{display:block}.divider{border:1px solid transparent;display:flex;margin-block:0}[data-importance='standard']{border-color:var(--qds-theme-divider-standard)}[data-importance='emphasized']{border-color:var(--qds-theme-divider-emphasized)}";
9
+ const dividerCss = ":host{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{display:block}.qds-divider{border:1px solid transparent;height:100%;margin-block:0}[data-importance='standard']{border-color:var(--qds-theme-divider-standard)}[data-importance='emphasized']{border-color:var(--qds-theme-divider-emphasized)}";
10
10
 
11
11
  const Divider = /*@__PURE__*/ proxyCustomElement(class Divider extends HTMLElement {
12
12
  constructor() {
@@ -20,7 +20,7 @@ const Divider = /*@__PURE__*/ proxyCustomElement(class Divider extends HTMLEleme
20
20
  this.inheritedAttributes = inheritAriaAttributes(this.element);
21
21
  }
22
22
  render() {
23
- return (h("hr", { class: "divider", "data-importance": this.importance, ...this.inheritedAttributes }));
23
+ return (h("hr", { class: "qds-divider", "data-importance": this.importance, ...this.inheritedAttributes }));
24
24
  }
25
25
  get element() { return this; }
26
26
  static get style() { return dividerCss; }
@@ -1 +1 @@
1
- {"file":"qds-divider.js","mappings":";;;;;;;;AAAA,MAAM,UAAU,GAAG,mYAAmY;;MC0BzY,OAAO;;;;;IASV,wBAAmB,GAAe,EAAE,CAAA;sBAJ1C,UAAU;;EAML,iBAAiB;IACtB,IAAI,CAAC,mBAAmB,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;GAC/D;EAEM,MAAM;IACX,QACE,UACE,KAAK,EAAC,SAAS,qBACE,IAAI,CAAC,UAAU,KAE5B,IAAI,CAAC,mBAAmB,GAC5B,EACH;GACF;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/divider/divider.css?tag=qds-divider&encapsulation=shadow","src/components/divider/divider.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: block;\n}\n\n.divider {\n border: 1px solid transparent;\n display: flex;\n margin-block: 0;\n}\n\n[data-importance='standard'] {\n border-color: var(--qds-theme-divider-standard);\n}\n\n[data-importance='emphasized'] {\n border-color: var(--qds-theme-divider-emphasized);\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface } from '@stencil/core'\nimport { Component, Element, h, Prop } from '@stencil/core'\n\nimport type { Attributes } from '../../helpers'\nimport { inheritAriaAttributes } from '../../helpers'\n\nexport type DividerImportance = 'emphasized' | 'standard'\n\n/**\n * The `<qds-divider>` element a thematic break between paragraph-level\n * elements: for example, a change of scene in a story, or a shift of topic\n * within a section.\n *\n * Dividers can also be used to group menu items in `<qds-dropdown>` elements.\n *\n * @see https://quartz.se.com/build/components/divider\n */\n@Component({\n tag: 'qds-divider',\n shadow: true,\n styleUrl: 'divider.css',\n})\nexport class Divider implements ComponentInterface {\n /**\n * The divider's importance.\n */\n @Prop({ reflect: true }) public readonly importance: DividerImportance =\n 'standard'\n\n @Element() private readonly element!: HTMLQdsDividerElement\n\n private inheritedAttributes: Attributes = {}\n\n public componentWillLoad(): void {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n }\n\n public render() {\n return (\n <hr\n class=\"divider\"\n data-importance={this.importance}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n />\n )\n }\n}\n"],"version":3}
1
+ {"file":"qds-divider.js","mappings":";;;;;;;;AAAA,MAAM,UAAU,GAAG,sYAAsY;;MC0B5Y,OAAO;;;;;IASV,wBAAmB,GAAe,EAAE,CAAA;sBAJ1C,UAAU;;EAML,iBAAiB;IACtB,IAAI,CAAC,mBAAmB,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;GAC/D;EAEM,MAAM;IACX,QACE,UACE,KAAK,EAAC,aAAa,qBACF,IAAI,CAAC,UAAU,KAE5B,IAAI,CAAC,mBAAmB,GAC5B,EACH;GACF;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/divider/divider.css?tag=qds-divider&encapsulation=shadow","src/components/divider/divider.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: block;\n}\n\n.qds-divider {\n border: 1px solid transparent;\n height: 100%;\n margin-block: 0;\n}\n\n[data-importance='standard'] {\n border-color: var(--qds-theme-divider-standard);\n}\n\n[data-importance='emphasized'] {\n border-color: var(--qds-theme-divider-emphasized);\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface } from '@stencil/core'\nimport { Component, Element, h, Prop } from '@stencil/core'\n\nimport type { Attributes } from '../../helpers'\nimport { inheritAriaAttributes } from '../../helpers'\n\nexport type DividerImportance = 'emphasized' | 'standard'\n\n/**\n * The `<qds-divider>` element a thematic break between paragraph-level\n * elements: for example, a change of scene in a story, or a shift of topic\n * within a section.\n *\n * Dividers can also be used to group menu items in `<qds-dropdown>` elements.\n *\n * @see https://quartz.se.com/build/components/divider\n */\n@Component({\n tag: 'qds-divider',\n shadow: true,\n styleUrl: 'divider.css',\n})\nexport class Divider implements ComponentInterface {\n /**\n * The divider's importance.\n */\n @Prop({ reflect: true }) public readonly importance: DividerImportance =\n 'standard'\n\n @Element() private readonly element!: HTMLQdsDividerElement\n\n private inheritedAttributes: Attributes = {}\n\n public componentWillLoad(): void {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n }\n\n public render() {\n return (\n <hr\n class=\"qds-divider\"\n data-importance={this.importance}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n />\n )\n }\n}\n"],"version":3}
@@ -7,7 +7,7 @@ import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/clien
7
7
  import { i as inheritAriaAttributes } from './helpers.js';
8
8
  import { d as defineCustomElement$2 } from './icon.js';
9
9
 
10
- const formMessageCss = ":host{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{display:inline-block;line-height:0}.form-message{color:var(--qds-theme-control-text-standard);display:inline-flex;gap:var(--qds-text-icon-gap)}.icon-background,.icon{flex-shrink:0}.icon-background{border-radius:var(--qds-control-rounded-border-radius);position:relative}.icon{position:absolute;color:var(--qds-theme-feedback-action-destructive-contrast)}[data-size='small']{font:var(--qds-control-small-text)}.icon[data-size='small'],.icon-background[data-size='small']{width:var(--qds-control-small-icon-size);height:var(--qds-control-small-icon-size)}.inline[data-size='small']{margin-block:var(--qds-control-small-padding-auto-height)}[data-size='standard']{font:var(--qds-control-standard-text)}.icon[data-size='standard'],.icon-background[data-size='standard']{width:var(--qds-control-standard-icon-size);height:var(--qds-control-standard-icon-size)}.inline[data-size='standard']{margin-block:var(--qds-control-standard-padding-auto-height)}[data-size='large']{font:var(--qds-control-large-text)}.icon[data-size='large'],.icon-background[data-size='large']{width:var(--qds-control-large-icon-size);height:var(--qds-control-large-icon-size)}.inline[data-size='large']{margin-block:var(--qds-control-large-padding-auto-height)}.icon-background[data-status='error']{background-color:var(--qds-theme-feedback-result-failure)}.text[data-status='error']{color:var(--qds-theme-feedback-result-failure)}[data-status='info'].icon-background{background-color:var(--qds-theme-feedback-message-informational)}.icon-background[data-status='success']{background-color:var(--qds-theme-feedback-result-success)}.text[data-status='success']{color:var(--qds-theme-feedback-result-success)}[data-status='warning'].icon-background{background-color:var(--qds-theme-feedback-result-partial-success)}";
10
+ const formMessageCss = ":host{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{display:inline-block;line-height:0}.qds-form-message{color:var(--qds-theme-control-text-standard);display:inline-flex;gap:var(--qds-text-icon-gap)}.qds-icon-background,.qds-icon{flex-shrink:0}.qds-icon-background{border-radius:var(--qds-control-rounded-border-radius);position:relative}.qds-icon{position:absolute;color:var(--qds-theme-feedback-action-destructive-contrast)}[data-size='small']{font:var(--qds-control-small-text)}.qds-icon[data-size='small'],.qds-icon-background[data-size='small']{width:var(--qds-control-small-icon-size);height:var(--qds-control-small-icon-size)}.qds-inline[data-size='small']{margin-block:var(--qds-control-small-padding-auto-height)}[data-size='standard']{font:var(--qds-control-standard-text)}.qds-icon[data-size='standard'],.qds-icon-background[data-size='standard']{width:var(--qds-control-standard-icon-size);height:var(--qds-control-standard-icon-size)}.qds-inline[data-size='standard']{margin-block:var(--qds-control-standard-padding-auto-height)}[data-size='large']{font:var(--qds-control-large-text)}.qds-icon[data-size='large'],.qds-icon-background[data-size='large']{width:var(--qds-control-large-icon-size);height:var(--qds-control-large-icon-size)}.qds-inline[data-size='large']{margin-block:var(--qds-control-large-padding-auto-height)}.qds-icon-background[data-status='error']{background-color:var(--qds-theme-feedback-result-failure)}.qds-text[data-status='error']{color:var(--qds-theme-feedback-result-failure)}[data-status='info'].qds-icon-background{background-color:var(--qds-theme-feedback-message-informational)}.qds-icon-background[data-status='success']{background-color:var(--qds-theme-feedback-result-success)}.qds-text[data-status='success']{color:var(--qds-theme-feedback-result-success)}[data-status='warning'].qds-icon-background{background-color:var(--qds-theme-feedback-result-partial-success)}";
11
11
 
12
12
  const FormMessage = /*@__PURE__*/ proxyCustomElement(class FormMessage extends HTMLElement {
13
13
  constructor() {
@@ -25,9 +25,9 @@ const FormMessage = /*@__PURE__*/ proxyCustomElement(class FormMessage extends H
25
25
  }
26
26
  render() {
27
27
  return (h("span", { class: {
28
- inline: this.inline,
29
- 'form-message': true,
30
- }, "data-size": this.size, ...this.inheritedAttributes }, h("span", { class: "icon-background", "data-size": this.size, "data-status": this.status }), h("qds-icon", { class: "icon", "data-size": this.size, name: `status-${this.status}`, library: "core" }), h("span", { class: "text", "data-status": this.status }, this.text)));
28
+ 'qds-inline': this.inline,
29
+ 'qds-form-message': true,
30
+ }, "data-size": this.size, ...this.inheritedAttributes }, h("span", { class: "qds-icon-background", "data-size": this.size, "data-status": this.status }), h("qds-icon", { class: "qds-icon", "data-size": this.size, name: `status-${this.status}`, library: "core" }), h("span", { class: "qds-text", "data-status": this.status }, this.text)));
31
31
  }
32
32
  get element() { return this; }
33
33
  static get style() { return formMessageCss; }
@@ -1 +1 @@
1
- {"file":"qds-form-message.js","mappings":";;;;;;;;;AAAA,MAAM,cAAc,GAAG,64DAA64D;;MCwBv5D,WAAW;;;;;IA0Bd,wBAAmB,GAAe,EAAE,CAAA;kBAnBF,KAAK;gBAKkB,UAAU;kBAKlC,OAAO;;;EAWzC,iBAAiB;IACtB,IAAI,CAAC,mBAAmB,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;GAC/D;EAEM,MAAM;IACX,QACE,YACE,KAAK,EAAE;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,cAAc,EAAE,IAAI;OACrB,eACU,IAAI,CAAC,IAAI,KAEhB,IAAI,CAAC,mBAAmB,IAE5B,YACE,KAAK,EAAC,iBAAiB,eACZ,IAAI,CAAC,IAAI,iBACP,IAAI,CAAC,MAAM,GACxB,EACF,gBACE,KAAK,EAAC,MAAM,eACD,IAAI,CAAC,IAAI,EACpB,IAAI,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE,EAC7B,OAAO,EAAC,MAAM,GACd,EACF,YAAM,KAAK,EAAC,MAAM,iBAAc,IAAI,CAAC,MAAM,IACxC,IAAI,CAAC,IAAI,CACL,CACF,EACR;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/form-message/form-message.css?tag=qds-form-message&encapsulation=shadow","src/components/form-message/form-message.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n line-height: 0;\n}\n\n.form-message {\n color: var(--qds-theme-control-text-standard);\n display: inline-flex;\n gap: var(--qds-text-icon-gap);\n}\n\n.icon-background,\n.icon {\n flex-shrink: 0;\n}\n\n.icon-background {\n border-radius: var(--qds-control-rounded-border-radius);\n position: relative;\n}\n\n.icon {\n position: absolute;\n color: var(--qds-theme-feedback-action-destructive-contrast);\n}\n\n[data-size='small'] {\n font: var(--qds-control-small-text);\n\n &:is(.icon, .icon-background) {\n width: var(--qds-control-small-icon-size);\n height: var(--qds-control-small-icon-size);\n }\n\n &.inline {\n margin-block: var(--qds-control-small-padding-auto-height);\n }\n}\n\n[data-size='standard'] {\n font: var(--qds-control-standard-text);\n\n &:is(.icon, .icon-background) {\n width: var(--qds-control-standard-icon-size);\n height: var(--qds-control-standard-icon-size);\n }\n\n &.inline {\n margin-block: var(--qds-control-standard-padding-auto-height);\n }\n}\n\n[data-size='large'] {\n font: var(--qds-control-large-text);\n\n &:is(.icon, .icon-background) {\n width: var(--qds-control-large-icon-size);\n height: var(--qds-control-large-icon-size);\n }\n\n &.inline {\n margin-block: var(--qds-control-large-padding-auto-height);\n }\n}\n\n[data-status='error'] {\n &.icon-background {\n background-color: var(--qds-theme-feedback-result-failure);\n }\n\n &.text {\n color: var(--qds-theme-feedback-result-failure);\n }\n}\n\n[data-status='info'].icon-background {\n background-color: var(--qds-theme-feedback-message-informational);\n}\n\n[data-status='success'] {\n &.icon-background {\n background-color: var(--qds-theme-feedback-result-success);\n }\n\n &.text {\n color: var(--qds-theme-feedback-result-success);\n }\n}\n\n[data-status='warning'].icon-background {\n background-color: var(--qds-theme-feedback-result-partial-success);\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface } from '@stencil/core'\nimport { Component, Element, h, Prop } from '@stencil/core'\n\nimport type { Attributes } from '../../helpers'\nimport { inheritAriaAttributes } from '../../helpers'\n\nexport type FormMessageSize = 'large' | 'small' | 'standard'\nexport type Status = 'error' | 'info' | 'success' | 'warning'\n\n/**\n * `<qds-form-message>` elements represent messages for a form field in a user\n * interface.\n *\n * @see https://quartz.se.com/build/components/form-message\n */\n@Component({\n tag: 'qds-form-message',\n shadow: true,\n styleUrl: 'form-message.css',\n})\nexport class FormMessage implements ComponentInterface {\n /**\n * Adds vertical margin to the form message for alignment.\n *\n * This is useful when creating inline layouts so that the first lines have\n * the correct vertical centering.\n */\n @Prop() public readonly inline: boolean = false\n\n /**\n * The form message's size.\n */\n @Prop({ reflect: true }) public readonly size: FormMessageSize = 'standard'\n\n /**\n * The form message's status.\n */\n @Prop() public readonly status: Status = 'error'\n\n /**\n * The form message's text.\n */\n @Prop({ reflect: true }) public readonly text?: string\n\n @Element() private readonly element!: HTMLQdsFormMessageElement\n\n private inheritedAttributes: Attributes = {}\n\n public componentWillLoad(): void {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n }\n\n public render() {\n return (\n <span\n class={{\n inline: this.inline,\n 'form-message': true,\n }}\n data-size={this.size}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n >\n <span\n class=\"icon-background\"\n data-size={this.size}\n data-status={this.status}\n />\n <qds-icon\n class=\"icon\"\n data-size={this.size}\n name={`status-${this.status}`}\n library=\"core\"\n />\n <span class=\"text\" data-status={this.status}>\n {this.text}\n </span>\n </span>\n )\n }\n}\n"],"version":3}
1
+ {"file":"qds-form-message.js","mappings":";;;;;;;;;AAAA,MAAM,cAAc,GAAG,69DAA69D;;MCwBv+D,WAAW;;;;;IA0Bd,wBAAmB,GAAe,EAAE,CAAA;kBAnBF,KAAK;gBAKkB,UAAU;kBAKlC,OAAO;;;EAWzC,iBAAiB;IACtB,IAAI,CAAC,mBAAmB,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;GAC/D;EAEM,MAAM;IACX,QACE,YACE,KAAK,EAAE;QACL,YAAY,EAAE,IAAI,CAAC,MAAM;QACzB,kBAAkB,EAAE,IAAI;OACzB,eACU,IAAI,CAAC,IAAI,KAEhB,IAAI,CAAC,mBAAmB,IAE5B,YACE,KAAK,EAAC,qBAAqB,eAChB,IAAI,CAAC,IAAI,iBACP,IAAI,CAAC,MAAM,GACxB,EACF,gBACE,KAAK,EAAC,UAAU,eACL,IAAI,CAAC,IAAI,EACpB,IAAI,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE,EAC7B,OAAO,EAAC,MAAM,GACd,EACF,YAAM,KAAK,EAAC,UAAU,iBAAc,IAAI,CAAC,MAAM,IAC5C,IAAI,CAAC,IAAI,CACL,CACF,EACR;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/form-message/form-message.css?tag=qds-form-message&encapsulation=shadow","src/components/form-message/form-message.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n line-height: 0;\n}\n\n.qds-form-message {\n color: var(--qds-theme-control-text-standard);\n display: inline-flex;\n gap: var(--qds-text-icon-gap);\n}\n\n.qds-icon-background,\n.qds-icon {\n flex-shrink: 0;\n}\n\n.qds-icon-background {\n border-radius: var(--qds-control-rounded-border-radius);\n position: relative;\n}\n\n.qds-icon {\n position: absolute;\n color: var(--qds-theme-feedback-action-destructive-contrast);\n}\n\n[data-size='small'] {\n font: var(--qds-control-small-text);\n\n &:is(.qds-icon, .qds-icon-background) {\n width: var(--qds-control-small-icon-size);\n height: var(--qds-control-small-icon-size);\n }\n\n &.qds-inline {\n margin-block: var(--qds-control-small-padding-auto-height);\n }\n}\n\n[data-size='standard'] {\n font: var(--qds-control-standard-text);\n\n &:is(.qds-icon, .qds-icon-background) {\n width: var(--qds-control-standard-icon-size);\n height: var(--qds-control-standard-icon-size);\n }\n\n &.qds-inline {\n margin-block: var(--qds-control-standard-padding-auto-height);\n }\n}\n\n[data-size='large'] {\n font: var(--qds-control-large-text);\n\n &:is(.qds-icon, .qds-icon-background) {\n width: var(--qds-control-large-icon-size);\n height: var(--qds-control-large-icon-size);\n }\n\n &.qds-inline {\n margin-block: var(--qds-control-large-padding-auto-height);\n }\n}\n\n[data-status='error'] {\n &.qds-icon-background {\n background-color: var(--qds-theme-feedback-result-failure);\n }\n\n &.qds-text {\n color: var(--qds-theme-feedback-result-failure);\n }\n}\n\n[data-status='info'].qds-icon-background {\n background-color: var(--qds-theme-feedback-message-informational);\n}\n\n[data-status='success'] {\n &.qds-icon-background {\n background-color: var(--qds-theme-feedback-result-success);\n }\n\n &.qds-text {\n color: var(--qds-theme-feedback-result-success);\n }\n}\n\n[data-status='warning'].qds-icon-background {\n background-color: var(--qds-theme-feedback-result-partial-success);\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface } from '@stencil/core'\nimport { Component, Element, h, Prop } from '@stencil/core'\n\nimport type { Attributes } from '../../helpers'\nimport { inheritAriaAttributes } from '../../helpers'\n\nexport type FormMessageSize = 'large' | 'small' | 'standard'\nexport type Status = 'error' | 'info' | 'success' | 'warning'\n\n/**\n * `<qds-form-message>` elements represent messages for a form field in a user\n * interface.\n *\n * @see https://quartz.se.com/build/components/form-message\n */\n@Component({\n tag: 'qds-form-message',\n shadow: true,\n styleUrl: 'form-message.css',\n})\nexport class FormMessage implements ComponentInterface {\n /**\n * Adds vertical margin to the form message for alignment.\n *\n * This is useful when creating inline layouts so that the first lines have\n * the correct vertical centering.\n */\n @Prop() public readonly inline: boolean = false\n\n /**\n * The form message's size.\n */\n @Prop({ reflect: true }) public readonly size: FormMessageSize = 'standard'\n\n /**\n * The form message's status.\n */\n @Prop() public readonly status: Status = 'error'\n\n /**\n * The form message's text.\n */\n @Prop({ reflect: true }) public readonly text?: string\n\n @Element() private readonly element!: HTMLQdsFormMessageElement\n\n private inheritedAttributes: Attributes = {}\n\n public componentWillLoad(): void {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n }\n\n public render() {\n return (\n <span\n class={{\n 'qds-inline': this.inline,\n 'qds-form-message': true,\n }}\n data-size={this.size}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n >\n <span\n class=\"qds-icon-background\"\n data-size={this.size}\n data-status={this.status}\n />\n <qds-icon\n class=\"qds-icon\"\n data-size={this.size}\n name={`status-${this.status}`}\n library=\"core\"\n />\n <span class=\"qds-text\" data-status={this.status}>\n {this.text}\n </span>\n </span>\n )\n }\n}\n"],"version":3}