@quartzds/core 1.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -0
- package/components/floating-ui.dom.esm.js +1402 -0
- package/components/floating-ui.dom.esm.js.map +1 -0
- package/components/helpers.js +174 -0
- package/components/helpers.js.map +1 -0
- package/components/icon.js +175 -0
- package/components/icon.js.map +1 -0
- package/components/index.d.ts +52 -0
- package/components/index.js +117 -0
- package/components/index.js.map +1 -0
- package/components/label.js +55 -0
- package/components/label.js.map +1 -0
- package/components/qds-button.d.ts +11 -0
- package/components/qds-button.js +148 -0
- package/components/qds-button.js.map +1 -0
- package/components/qds-checkbox.d.ts +11 -0
- package/components/qds-checkbox.js +156 -0
- package/components/qds-checkbox.js.map +1 -0
- package/components/qds-dropdown.d.ts +11 -0
- package/components/qds-dropdown.js +259 -0
- package/components/qds-dropdown.js.map +1 -0
- package/components/qds-icon.d.ts +11 -0
- package/components/qds-icon.js +13 -0
- package/components/qds-icon.js.map +1 -0
- package/components/qds-inline-link.d.ts +11 -0
- package/components/qds-inline-link.js +89 -0
- package/components/qds-inline-link.js.map +1 -0
- package/components/qds-input.d.ts +11 -0
- package/components/qds-input.js +244 -0
- package/components/qds-input.js.map +1 -0
- package/components/qds-label.d.ts +11 -0
- package/components/qds-label.js +13 -0
- package/components/qds-label.js.map +1 -0
- package/components/qds-radio.d.ts +11 -0
- package/components/qds-radio.js +109 -0
- package/components/qds-radio.js.map +1 -0
- package/components/qds-switch.d.ts +11 -0
- package/components/qds-switch.js +119 -0
- package/components/qds-switch.js.map +1 -0
- package/components/qds-title.d.ts +11 -0
- package/components/qds-title.js +94 -0
- package/components/qds-title.js.map +1 -0
- package/components/qds-tooltip.d.ts +11 -0
- package/components/qds-tooltip.js +325 -0
- package/components/qds-tooltip.js.map +1 -0
- package/dist/cjs/floating-ui.dom.esm-71fa96af.js +1410 -0
- package/dist/cjs/floating-ui.dom.esm-71fa96af.js.map +1 -0
- package/dist/cjs/helpers-0b23af3f.js +184 -0
- package/dist/cjs/helpers-0b23af3f.js.map +1 -0
- package/dist/cjs/index-f19b2823.js +2030 -0
- package/dist/cjs/index-f19b2823.js.map +1 -0
- package/dist/cjs/index.cjs.js +115 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/library-4803c801.js +62 -0
- package/dist/cjs/library-4803c801.js.map +1 -0
- package/dist/cjs/loader.cjs.js +29 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/qds-button.cjs.entry.js +110 -0
- package/dist/cjs/qds-button.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-checkbox.cjs.entry.js +116 -0
- package/dist/cjs/qds-checkbox.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-dropdown.cjs.entry.js +227 -0
- package/dist/cjs/qds-dropdown.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-icon.cjs.entry.js +113 -0
- package/dist/cjs/qds-icon.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-inline-link.cjs.entry.js +61 -0
- package/dist/cjs/qds-inline-link.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-input.cjs.entry.js +200 -0
- package/dist/cjs/qds-input.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-label.cjs.entry.js +39 -0
- package/dist/cjs/qds-label.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-radio.cjs.entry.js +74 -0
- package/dist/cjs/qds-radio.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-switch.cjs.entry.js +79 -0
- package/dist/cjs/qds-switch.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-title.cjs.entry.js +66 -0
- package/dist/cjs/qds-title.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-tooltip.cjs.entry.js +284 -0
- package/dist/cjs/qds-tooltip.cjs.entry.js.map +1 -0
- package/dist/cjs/qds.cjs.js +33 -0
- package/dist/cjs/qds.cjs.js.map +1 -0
- package/dist/custom-elements.json +3976 -0
- package/dist/docs.d.ts +148 -0
- package/dist/docs.json +3918 -0
- package/dist/esm/floating-ui.dom.esm-f96ac766.js +1402 -0
- package/dist/esm/floating-ui.dom.esm-f96ac766.js.map +1 -0
- package/dist/esm/helpers-5c189a19.js +174 -0
- package/dist/esm/helpers-5c189a19.js.map +1 -0
- package/dist/esm/index-1bc8e218.js +2000 -0
- package/dist/esm/index-1bc8e218.js.map +1 -0
- package/dist/esm/index.js +106 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/library-aa6893c0.js +58 -0
- package/dist/esm/library-aa6893c0.js.map +1 -0
- package/dist/esm/loader.js +25 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/qds-button.entry.js +106 -0
- package/dist/esm/qds-button.entry.js.map +1 -0
- package/dist/esm/qds-checkbox.entry.js +112 -0
- package/dist/esm/qds-checkbox.entry.js.map +1 -0
- package/dist/esm/qds-dropdown.entry.js +223 -0
- package/dist/esm/qds-dropdown.entry.js.map +1 -0
- package/dist/esm/qds-icon.entry.js +109 -0
- package/dist/esm/qds-icon.entry.js.map +1 -0
- package/dist/esm/qds-inline-link.entry.js +57 -0
- package/dist/esm/qds-inline-link.entry.js.map +1 -0
- package/dist/esm/qds-input.entry.js +196 -0
- package/dist/esm/qds-input.entry.js.map +1 -0
- package/dist/esm/qds-label.entry.js +35 -0
- package/dist/esm/qds-label.entry.js.map +1 -0
- package/dist/esm/qds-radio.entry.js +70 -0
- package/dist/esm/qds-radio.entry.js.map +1 -0
- package/dist/esm/qds-switch.entry.js +75 -0
- package/dist/esm/qds-switch.entry.js.map +1 -0
- package/dist/esm/qds-title.entry.js +62 -0
- package/dist/esm/qds-title.entry.js.map +1 -0
- package/dist/esm/qds-tooltip.entry.js +280 -0
- package/dist/esm/qds-tooltip.entry.js.map +1 -0
- package/dist/esm/qds.js +28 -0
- package/dist/esm/qds.js.map +1 -0
- package/dist/types/components/button/button.d.ts +209 -0
- package/dist/types/components/checkbox/checkbox.d.ts +136 -0
- package/dist/types/components/create-story.d.ts +5 -0
- package/dist/types/components/dropdown/dropdown.d.ts +135 -0
- package/dist/types/components/icon/default-library.d.ts +4 -0
- package/dist/types/components/icon/icon.d.ts +31 -0
- package/dist/types/components/icon/library.d.ts +19 -0
- package/dist/types/components/icon/request.d.ts +12 -0
- package/dist/types/components/icon/system-library.d.ts +4 -0
- package/dist/types/components/inline-link/inline-link.d.ts +208 -0
- package/dist/types/components/input/input.d.ts +386 -0
- package/dist/types/components/label/label.d.ts +33 -0
- package/dist/types/components/radio/radio.d.ts +110 -0
- package/dist/types/components/switch/switch.d.ts +115 -0
- package/dist/types/components/title/title.d.ts +42 -0
- package/dist/types/components/tooltip/tooltip.d.ts +147 -0
- package/dist/types/components.d.ts +1692 -0
- package/dist/types/helpers.d.ts +49 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/qds-test.d.ts +18 -0
- package/dist/types/stencil-public-runtime.d.ts +1638 -0
- package/dist/types/utils.d.ts +65 -0
- package/dist/vscode.html-custom-data.json +947 -0
- package/hydrate/index.d.ts +218 -0
- package/hydrate/index.js +9690 -0
- package/hydrate/package.json +6 -0
- package/loader/cdn.js +7 -0
- package/loader/index.cjs.js +7 -0
- package/loader/index.d.ts +21 -0
- package/loader/index.es2017.js +7 -0
- package/loader/index.js +8 -0
- package/loader/package.json +11 -0
- package/package.json +231 -0
- package/styles/core.css +379 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"qds-inline-link.js","mappings":";;;;;;;;;AAAA,MAAM,aAAa,GAAG,utBAAutB;;MCkChuB,UAAU;;;;;;;IAqMb,wBAAmB,GAAe,EAAE,CAAA;IAiD3B,WAAM,GAAG,CAAC,KAAiB;MAC1C,IAAI,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AAI,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,gBAAgB,IAEpD,eAAQ,EACR,gBACE,KAAK,EAAC,UAAU,EAChB,OAAO,EAAC,QAAQ,EAChB,IAAI,EAAC,2BAA2B,GAChC,CACA,EACL;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/inline-link/inline-link.css?tag=qds-inline-link&encapsulation=shadow","./src/components/inline-link/inline-link.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.external {\n display: none;\n height: 1.25em;\n margin-inline-start: var(--qds-text-icon-gap);\n vertical-align: text-top;\n width: 1.25em;\n}\n\n.inline-link {\n border-radius: var(--qds-focus-border-radius);\n color: var(--qds-theme-link-default);\n\n &[rel~='external'] > .external {\n display: inline-block;\n }\n\n &:focus-visible {\n outline: var(--qds-theme-focus-border) solid var(--qds-focus-border-width);\n }\n\n &:visited {\n color: var(--qds-theme-link-visited);\n }\n}\n\n[aria-disabled='true'] {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\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, Listen, Prop } from '@stencil/core'\nimport type { LiteralUnion } from 'type-fest'\n\nimport type { Attributes, QdsFocusEventDetail } from '../../helpers'\nimport {\n inheritAriaAttributes,\n inheritAttributes,\n pickFocusEventAttributes,\n} from '../../helpers'\n\nexport type Target = '_blank' | '_parent' | '_self' | '_top'\n\n/**\n * `<qds-inline-link>` elements, with their `href` property, create a hyperlink\n * to web pages, files, email addresses, locations in the same page, or\n * anything else a URL can address.\n *\n * Content within each `<qds-inline-link>` *should* indicate the inline link's\n * destination. If the `href` property is present, pressing the enter key while\n * focused on the `<qds-inline-link>` element will activate it.\n *\n * @slot Content to display for the inline link.\n * @see https://quartz.se.com/build/components/inline-link\n */\n@Component({\n tag: 'qds-inline-link',\n shadow: { delegatesFocus: true },\n styleUrl: 'inline-link.css',\n})\nexport class InlineLink implements ComponentInterface {\n /**\n * Prevents the inline link from being interacted with: it cannot be pressed\n * or focused.\n */\n @Prop({ mutable: true, reflect: true }) public disabled = false\n\n /**\n * Causes the browser to treat the linked URL as a download. Can be used with\n * or without a `filename` value:\n *\n * - Without a value, the browser will suggest a filename/extension,\n * generated from various sources:\n *\n * - The\n * [`Content-Disposition`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Disposition)\n * HTTP header\n * - The final segment in the URL\n * [path](https://developer.mozilla.org/docs/Web/API/URL/pathname)\n * - The\n * [media type](https://developer.mozilla.org/docs/Glossary/MIME_type)\n * (from the\n * [`Content-Type`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Type)\n * header, the start of a\n * [`data:` URL](https://developer.mozilla.org/docs/Web/HTTP/Basics_of_HTTP/Data_URLs),\n * or\n * [`Blob.type`](https://developer.mozilla.org/docs/Web/API/Blob/type)\n * for a\n * [`blob:` URL](https://developer.mozilla.org/docs/Web/API/URL/createObjectURL))\n * - `filename`: defining a value suggests it as the filename. `/` and `\\`\n * characters are converted to underscores (`_`). Filesystems may forbid\n * other characters in filenames, so browsers will adjust the suggested name\n * if necessary.\n *\n * @webnative\n */\n @Prop() public readonly download?: boolean | string\n\n /**\n * The URL that the inline link points to. Inline links are not restricted to\n * HTTP-based URLs — they can use any URL scheme supported by browsers:\n *\n * - Sections of a page with document fragments\n * - Specific text portions with\n * [text fragments](https://developer.mozilla.org/docs/Web/Text_fragments)\n * - Pieces of media files with media fragments\n * - Telephone numbers with `tel:` URLs\n * - Email addresses with `mailto:` URLs\n * - While web browsers may not support other URL schemes, websites can with\n * [`registerProtocolHandler()`](https://developer.mozilla.org/docs/Web/API/Navigator/registerProtocolHandler)\n *\n * @webnative\n */\n @Prop() public readonly href?: string\n\n /**\n * Hints at the human language of the linked URL. No built-in functionality.\n * Allowed values are the same as\n * [the global `lang` attribute](https://developer.mozilla.org/docs/Web/HTML/Global_attributes/lang).\n *\n * @webnative\n */\n @Prop() public readonly hreflang?: string\n\n /**\n * How much of the\n * [referrer](https://developer.mozilla.org/docs/Web/HTTP/Headers/Referer)\n * to send when following the inline link.\n *\n * - `no-referrer`: The\n * [`Referer`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Referer)\n * header will not be sent.\n * - `no-referrer-when-downgrade`: The\n * [`Referer`](https://developer.mozilla.org/docs/Web/HTTP/Headers/Referer)\n * header will not be sent to\n * [origin](https://developer.mozilla.org/docs/Glossary/Origin)s\n * without [TLS](https://developer.mozilla.org/docs/Glossary/TLS)\n * ([HTTPS](https://developer.mozilla.org/docs/Glossary/HTTPS)).\n * - `origin`: The sent referrer will be limited to the origin of the\n * referring page: its\n * [scheme](https://developer.mozilla.org/docs/Learn/Common_questions/What_is_a_URL),\n * [host](https://developer.mozilla.org/docs/Glossary/Host), and\n * [port](https://developer.mozilla.org/docs/Glossary/Port).\n * - `origin-when-cross-origin`: The referrer sent to other origins will be\n * limited to the scheme, the host, and the port. Navigations on the same\n * origin will still include the path.\n * - `same-origin`: A referrer will be sent for\n * [same origin](https://developer.mozilla.org/docs/Glossary/Same-origin_policy),\n * but cross-origin requests will contain no referrer information.\n * - `strict-origin`: Only send the origin of the document as the referrer\n * when the protocol security level stays the same (HTTPS→HTTPS), but don't\n * send it to a less secure destination (HTTPS→HTTP).\n * - `strict-origin-when-cross-origin` (default): Send a full URL when\n * performing a same-origin request, only send the origin when the protocol\n * security level stays the same (HTTPS→HTTPS), and send no header to a less\n * secure destination (HTTPS→HTTP).\n * - `unsafe-url`: The referrer will include the origin and the path (but not the\n * [fragment](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/hash),\n * [password](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/password),\n * or [username](https://developer.mozilla.org/docs/Web/API/HTMLAnchorElement/username)).\n * **This value is unsafe** because it leaks origins and paths from\n * TLS-protected resources to insecure origins.\n *\n * @webnative\n */\n @Prop({ attribute: 'referrerpolicy' })\n public readonly referrerPolicy?: ReferrerPolicy\n\n /**\n * The relationship of the linked URL as space-separated\n * [link types](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel).\n *\n * The following list includes some of the most important existing keywords.\n * Every keyword within a space-separated value should be unique within that\n * value.\n *\n * - [`alternate`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-alternate):\n * Alternate representations of the current document.\n * - [`author`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-author):\n * Author of the current document or article.\n * - [`bookmark`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-bookmark):\n * Permalink for the nearest ancestor section.\n * - [`external`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-external):\n * The referenced document is not part of the same site as the current\n * document. An icon will be rendered next to the text if this value is\n * specified.\n * - [`help`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-help):\n * Link to context-sensitive help.\n * - [`license`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-license):\n * Indicates that the main content of the current document is covered by the\n * copyright license described by the referenced document.\n * - [`me`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel/me):\n * Indicates that the current document represents the person who owns the\n * linked content.\n * - [`next`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-next):\n * Indicates that the current document is a part of a series and that the\n * next document in the series is the referenced document.\n * - [`nofollow`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-nofollow):\n * Indicates that the current document's original author or publisher does\n * not endorse the referenced document.\n * - [`noopener`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel/noopener):\n * Creates a top-level browsing context that is not an auxiliary browsing\n * context if the hyperlink would create either of those, to begin with (i.e.,\n * has an appropriate `target` attribute value).\n * - [`noreferrer`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-noreferrer):\n * No `Referer` header will be included. Additionally, has the same effect as\n * `noopener`.\n * - [`opener`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-opener):\n * Creates an auxiliary browsing context if the hyperlink would otherwise\n * create a top-level browsing context that is not an auxiliary browsing\n * context (i.e., has \"`_blank`\" as `target` attribute value).\n * - [`prev`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-prev):\n * Indicates that the current document is a part of a series and that the\n * previous document in the series is the referenced document.\n * - [`search`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-search):\n * Gives a link to a resource that can be used to search through the current\n * document and its related pages.\n * - [`tag`](https://developer.mozilla.org/docs/Web/HTML/Attributes/rel#attr-tag):\n * Gives a tag (identified by the given address) that applies to the current\n * document.\n *\n * @webnative\n */\n @Prop() public readonly rel?: 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<Target, string> = '_self'\n\n /**\n * Emitted when the inline link loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the inline link gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n @Element() private readonly element!: HTMLQdsInlineLinkElement\n\n private inheritedAttributes: Attributes = {}\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 @Listen('click')\n protected onClick(event: MouseEvent): void {\n if (this.disabled) {\n event.preventDefault()\n event.stopPropagation()\n }\n }\n\n public componentWillLoad(): void {\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.element),\n ...inheritAttributes(this.element, ['tabindex']),\n }\n }\n\n public render() {\n return (\n <a\n aria-disabled={this.disabled ? 'true' : 'false'}\n class=\"inline-link\"\n download={this.download}\n href={this.href}\n hrefLang={this.hreflang}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n referrerPolicy={this.referrerPolicy}\n rel={this.rel}\n target={this.target}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n tabIndex={this.disabled ? -1 : this.computedTabIndex}\n >\n <slot />\n <qds-icon\n class=\"external\"\n library=\"system\"\n name=\"arrow-top-right-on-square\"\n />\n </a>\n )\n }\n\n private readonly onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../dist/types/components";
|
|
2
|
+
|
|
3
|
+
interface QdsInput extends Components.QdsInput, HTMLElement {}
|
|
4
|
+
export const QdsInput: {
|
|
5
|
+
prototype: QdsInput;
|
|
6
|
+
new (): QdsInput;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: © 2023 Schneider Electric
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: LGPL-2.1-only
|
|
5
|
+
*/
|
|
6
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
7
|
+
import { p as pickFocusEventAttributes, a as invariant, e as pick, i as inheritAriaAttributes, b as inheritAttributes } from './helpers.js';
|
|
8
|
+
|
|
9
|
+
const inputCss = ".sc-qds-input-h{box-sizing:border-box}[hidden].sc-qds-input-h{display:none !important}.sc-qds-input-h *.sc-qds-input,.sc-qds-input-h *.sc-qds-input::before,.sc-qds-input-h *.sc-qds-input::after{box-sizing:inherit}.sc-qds-input-h{display:inline-block}.input.sc-qds-input{-webkit-appearance:textfield;appearance:textfield;padding:0;background-color:var(--qds-theme-control-input-background);border:var(--qds-control-border-width) solid var(--qds-theme-control-border);border-radius:var(--qds-control-border-radius);color:var(--qds-theme-control-text-standard);gap:var(--qds-control-input-gap-internal);padding-inline:var(--qds-control-input-padding-horizontal);width:100%}.input[aria-invalid='true'].sc-qds-input:not(:focus){border-color:var(--qds-theme-feedback-result-failure)}.input[type='color'].sc-qds-input{-webkit-appearance:none;appearance:none;min-width:50px;padding-block:var(--qds-control-input-padding-horizontal);cursor:pointer}.input[type='color'].sc-qds-input::-webkit-color-swatch-wrapper{padding:0}.input[type='color'].sc-qds-input::-webkit-color-swatch{border:var(--qds-control-border-width) solid\n var(--qds-theme-control-border);border-radius:var(--qds-control-border-radius)}.input[type='color'].sc-qds-input::-moz-color-swatch{border:var(--qds-control-border-width) solid\n var(--qds-theme-control-border);border-radius:var(--qds-control-border-radius)}.input[type='color'].sc-qds-input:hover{background-color:var(--qds-theme-interactive-background-hover)}.input[type='color'].sc-qds-input:active{background-color:var(--qds-theme-interactive-background-pressed)}.input.sc-qds-input:disabled{opacity:var(--qds-theme-disabled);pointer-events:none}.input.sc-qds-input:focus-visible{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}.input.sc-qds-input:placeholder-shown{color:var(--qds-theme-control-text-placeholder)}[data-size='small'].sc-qds-input{font:var(--qds-control-small-text);height:var(--qds-control-small-height)}[data-size='standard'].sc-qds-input{font:var(--qds-control-standard-text);height:var(--qds-control-standard-height)}[data-size='large'].sc-qds-input{font:var(--qds-control-large-text);height:var(--qds-control-large-height)}";
|
|
10
|
+
|
|
11
|
+
let autoIncrementingId = 1;
|
|
12
|
+
const Input = /*@__PURE__*/ proxyCustomElement(class Input extends HTMLElement {
|
|
13
|
+
constructor() {
|
|
14
|
+
super();
|
|
15
|
+
this.__registerHost();
|
|
16
|
+
this.blurEmitter = createEvent(this, "qdsBlur", 2);
|
|
17
|
+
this.changeEmitter = createEvent(this, "qdsChange", 6);
|
|
18
|
+
this.focusEmitter = createEvent(this, "qdsFocus", 2);
|
|
19
|
+
this.inputEmitter = createEvent(this, "qdsInput", 6);
|
|
20
|
+
this.inheritedAttributes = {};
|
|
21
|
+
this.ref = (input) => {
|
|
22
|
+
this.input = input;
|
|
23
|
+
};
|
|
24
|
+
this.onBlur = (event) => {
|
|
25
|
+
this.blurEmitter.emit(pickFocusEventAttributes(event));
|
|
26
|
+
};
|
|
27
|
+
this.onChange = () => {
|
|
28
|
+
invariant(this.input);
|
|
29
|
+
this.value = this.input.value;
|
|
30
|
+
this.changeEmitter.emit();
|
|
31
|
+
};
|
|
32
|
+
this.onClick = (event) => {
|
|
33
|
+
if (this.computedDisabled) {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
event.stopPropagation();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
this.onFocus = (event) => {
|
|
39
|
+
this.focusEmitter.emit(pickFocusEventAttributes(event));
|
|
40
|
+
};
|
|
41
|
+
this.onInput = (event) => {
|
|
42
|
+
invariant(this.input);
|
|
43
|
+
this.value = this.input.value;
|
|
44
|
+
this.inputEmitter.emit(pick(event, 'data', 'inputType', 'isComposing'));
|
|
45
|
+
};
|
|
46
|
+
this.onInvalid = () => {
|
|
47
|
+
this.invalid = true;
|
|
48
|
+
};
|
|
49
|
+
this.invalid = undefined;
|
|
50
|
+
this.size = 'standard';
|
|
51
|
+
this.autoCapitalize = undefined;
|
|
52
|
+
this.autoComplete = undefined;
|
|
53
|
+
this.autoFocus = undefined;
|
|
54
|
+
this.disabled = undefined;
|
|
55
|
+
this.enterkeyhint = undefined;
|
|
56
|
+
this.form = undefined;
|
|
57
|
+
this.inputmode = undefined;
|
|
58
|
+
this.max = undefined;
|
|
59
|
+
this.maxLength = undefined;
|
|
60
|
+
this.min = undefined;
|
|
61
|
+
this.minLength = undefined;
|
|
62
|
+
this.multiple = undefined;
|
|
63
|
+
this.name = `qds-input-${autoIncrementingId}`;
|
|
64
|
+
this.pattern = undefined;
|
|
65
|
+
this.placeholder = undefined;
|
|
66
|
+
this.readOnly = undefined;
|
|
67
|
+
this.required = undefined;
|
|
68
|
+
this.spellCheck = undefined;
|
|
69
|
+
this.step = undefined;
|
|
70
|
+
this.type = undefined;
|
|
71
|
+
this.value = undefined;
|
|
72
|
+
}
|
|
73
|
+
get computedDisabled() {
|
|
74
|
+
return this.disabled ?? false;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Returns true if the element's value passes validity checks; otherwise,
|
|
78
|
+
* returns false, fires an invalid event at the element, and (if the event
|
|
79
|
+
* isn't canceled) reports the problem to the user.
|
|
80
|
+
*/
|
|
81
|
+
async reportValidity() {
|
|
82
|
+
invariant(this.input);
|
|
83
|
+
return this.input.reportValidity();
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Selects the entire content of the `<qds-input>` element if the element's
|
|
87
|
+
* content is selectable.
|
|
88
|
+
*/
|
|
89
|
+
async select() {
|
|
90
|
+
invariant(this.input);
|
|
91
|
+
this.input.select();
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Sets a custom validity message for the input. If this message is not the
|
|
95
|
+
* empty string, then the element is considered invalid.
|
|
96
|
+
*/
|
|
97
|
+
async setCustomValidity(message) {
|
|
98
|
+
invariant(this.input);
|
|
99
|
+
this.input.setCustomValidity(message);
|
|
100
|
+
this.invalid = !this.input.checkValidity();
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Sets the contents of the specified range of characters in the input element to a given string.
|
|
104
|
+
*
|
|
105
|
+
* @param replacement The string to insert.
|
|
106
|
+
* @param start The 0-based index of the first character to replace. Defaults to the current selectionStart value (the start of the user's current selection).
|
|
107
|
+
* @param end The 0-based index of the character _after_ the last character to replace. Defaults to the current selectionEnd value (the end of the user's current selection).
|
|
108
|
+
* @param selectionMode A string defining how the selection should be set after the text has been replaced. Possible values:
|
|
109
|
+
*
|
|
110
|
+
* - `"select"` selects the newly inserted text.
|
|
111
|
+
* - `"start"` moves the selection to just before the inserted text.
|
|
112
|
+
* - `"end"` moves the selection to just after the inserted text.
|
|
113
|
+
* - `"preserve"` attempts to preserve the selection.
|
|
114
|
+
*/
|
|
115
|
+
async setRangeText(replacement, start, end, selectionMode = 'preserve') {
|
|
116
|
+
invariant(this.input);
|
|
117
|
+
this.input.setRangeText(replacement, start, end, selectionMode);
|
|
118
|
+
if (this.value !== this.input.value) {
|
|
119
|
+
this.value = this.input.value;
|
|
120
|
+
this.inputEmitter.emit();
|
|
121
|
+
this.changeEmitter.emit();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Selects the specified range of characters within the input.
|
|
126
|
+
*
|
|
127
|
+
* @param start The offset into the input for the start of the selection.
|
|
128
|
+
* @param end The offset into the input for the end of the selection.
|
|
129
|
+
* @param direction The direction in which the selection is performed.
|
|
130
|
+
*/
|
|
131
|
+
async setSelectionRange(start, end, direction) {
|
|
132
|
+
invariant(this.input);
|
|
133
|
+
this.input.setSelectionRange(start, end, direction);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Decrements the `value` by (`step` * n), where n defaults to 1 if not
|
|
137
|
+
* specified.
|
|
138
|
+
*
|
|
139
|
+
* @param n Amount to decrement the value by.
|
|
140
|
+
*/
|
|
141
|
+
async stepDown(n) {
|
|
142
|
+
invariant(this.input);
|
|
143
|
+
this.input.stepDown(n);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Increments the `value` by (`step` * n), where n defaults to 1 if not
|
|
147
|
+
* specified.
|
|
148
|
+
*
|
|
149
|
+
* @param n Amount to increment the value by.
|
|
150
|
+
*/
|
|
151
|
+
async stepUp(n) {
|
|
152
|
+
invariant(this.input);
|
|
153
|
+
this.input.stepUp(n);
|
|
154
|
+
}
|
|
155
|
+
disabledChanged() {
|
|
156
|
+
invariant(this.input);
|
|
157
|
+
// Disabled inputs are always valid, so we need to recheck validity when
|
|
158
|
+
// the state changes.
|
|
159
|
+
this.input.disabled = this.computedDisabled;
|
|
160
|
+
this.invalid = !this.input.checkValidity();
|
|
161
|
+
}
|
|
162
|
+
stepChanged() {
|
|
163
|
+
invariant(this.input);
|
|
164
|
+
// If step changes, the value may become invalid so we need to recheck
|
|
165
|
+
// after the update. We set the new step imperatively so we don't have to
|
|
166
|
+
// wait for the next render to report the updated validity.
|
|
167
|
+
this.input.step = String(this.step);
|
|
168
|
+
this.invalid = !this.input.checkValidity();
|
|
169
|
+
}
|
|
170
|
+
valueChanged() {
|
|
171
|
+
invariant(this.input);
|
|
172
|
+
this.invalid = !this.input.checkValidity();
|
|
173
|
+
}
|
|
174
|
+
componentWillLoad() {
|
|
175
|
+
autoIncrementingId += 1;
|
|
176
|
+
this.inheritedAttributes = {
|
|
177
|
+
...inheritAriaAttributes(this.element),
|
|
178
|
+
...inheritAttributes(this.element, ['tabindex']),
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
render() {
|
|
182
|
+
return (h("input", { "aria-invalid": this.invalid ?? false ? 'true' : 'false', autoCapitalize: this.autoCapitalize, autoComplete: this.autoComplete,
|
|
183
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
184
|
+
autoFocus: this.autoFocus, class: "input", "data-size": this.size, disabled: this.disabled, enterKeyHint: this.enterkeyhint, form: this.form, inputMode: this.inputmode, max: this.max, maxLength: this.maxLength, min: this.min, minLength: this.minLength, multiple: this.multiple, name: this.name, onBlur: this.onBlur, onChange: this.onChange, onClick: this.onClick, onFocus: this.onFocus, onInput: this.onInput, onInvalid: this.onInvalid, pattern: this.pattern, placeholder: this.placeholder, readOnly: this.readOnly, ref: this.ref, required: this.required, spellcheck: this.spellCheck, step: this.step, type: this.type, value: this.value ?? undefined, ...this.inheritedAttributes }));
|
|
185
|
+
}
|
|
186
|
+
get element() { return this; }
|
|
187
|
+
static get watchers() { return {
|
|
188
|
+
"disabled": ["disabledChanged"],
|
|
189
|
+
"step": ["stepChanged"],
|
|
190
|
+
"value": ["valueChanged"]
|
|
191
|
+
}; }
|
|
192
|
+
static get style() { return inputCss; }
|
|
193
|
+
}, [2, "qds-input", {
|
|
194
|
+
"invalid": [1540],
|
|
195
|
+
"size": [513],
|
|
196
|
+
"autoCapitalize": [1, "autocapitalize"],
|
|
197
|
+
"autoComplete": [1, "autocomplete"],
|
|
198
|
+
"autoFocus": [4, "autofocus"],
|
|
199
|
+
"disabled": [1540],
|
|
200
|
+
"enterkeyhint": [1],
|
|
201
|
+
"form": [1],
|
|
202
|
+
"inputmode": [1],
|
|
203
|
+
"max": [8],
|
|
204
|
+
"maxLength": [2, "maxlength"],
|
|
205
|
+
"min": [8],
|
|
206
|
+
"minLength": [2, "minlength"],
|
|
207
|
+
"multiple": [4],
|
|
208
|
+
"name": [1],
|
|
209
|
+
"pattern": [1],
|
|
210
|
+
"placeholder": [1],
|
|
211
|
+
"readOnly": [4, "readonly"],
|
|
212
|
+
"required": [4],
|
|
213
|
+
"spellCheck": [4, "spellcheck"],
|
|
214
|
+
"step": [8],
|
|
215
|
+
"type": [1],
|
|
216
|
+
"value": [1032],
|
|
217
|
+
"reportValidity": [64],
|
|
218
|
+
"select": [64],
|
|
219
|
+
"setCustomValidity": [64],
|
|
220
|
+
"setRangeText": [64],
|
|
221
|
+
"setSelectionRange": [64],
|
|
222
|
+
"stepDown": [64],
|
|
223
|
+
"stepUp": [64]
|
|
224
|
+
}]);
|
|
225
|
+
function defineCustomElement$1() {
|
|
226
|
+
if (typeof customElements === "undefined") {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
const components = ["qds-input"];
|
|
230
|
+
components.forEach(tagName => { switch (tagName) {
|
|
231
|
+
case "qds-input":
|
|
232
|
+
if (!customElements.get(tagName)) {
|
|
233
|
+
customElements.define(tagName, Input);
|
|
234
|
+
}
|
|
235
|
+
break;
|
|
236
|
+
} });
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const QdsInput = Input;
|
|
240
|
+
const defineCustomElement = defineCustomElement$1;
|
|
241
|
+
|
|
242
|
+
export { QdsInput, defineCustomElement };
|
|
243
|
+
|
|
244
|
+
//# sourceMappingURL=qds-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"qds-input.js","mappings":";;;;;;;;AAAA,MAAM,QAAQ,GAAG,4sEAA4sE;;AC6H7tE,IAAI,kBAAkB,GAAG,CAAC,CAAA;MAgBb,KAAK;;;;;;;;IA8UR,wBAAmB,GAAe,EAAE,CAAA;IAmM3B,QAAG,GAAG,CAAC,KAAwB;MAC9C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;KACnB,CAAA;IAEgB,WAAM,GAAG,CAAC,KAAiB;MAC1C,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;KACvD,CAAA;IAEgB,aAAQ,GAAG;MAC1B,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;MAErB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAA;MAC7B,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAA;KAC1B,CAAA;IAEgB,YAAO,GAAG,CAAC,KAAiB;MAC3C,IAAI,IAAI,CAAC,gBAAgB,EAAE;QACzB,KAAK,CAAC,cAAc,EAAE,CAAA;QACtB,KAAK,CAAC,eAAe,EAAE,CAAA;OACxB;KACF,CAAA;IAEgB,YAAO,GAAG,CAAC,KAAiB;MAC3C,IAAI,CA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AAE,IAAI,CAAC,SAAS,EACzB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,UAAU,EAAE,IAAI,CAAC,UAAU,EAC3B,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS,KAE1B,IAAI,CAAC,mBAAmB,GAC5B,EACH;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/input/input.css?tag=qds-input&encapsulation=scoped","./src/components/input/input.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.input {\n appearance: textfield;\n padding: 0;\n background-color: var(--qds-theme-control-input-background);\n border: var(--qds-control-border-width) solid var(--qds-theme-control-border);\n border-radius: var(--qds-control-border-radius);\n color: var(--qds-theme-control-text-standard);\n gap: var(--qds-control-input-gap-internal);\n padding-inline: var(--qds-control-input-padding-horizontal);\n width: 100%;\n\n &:not(:focus)[aria-invalid='true'] {\n border-color: var(--qds-theme-feedback-result-failure);\n }\n\n &[type='color'] {\n appearance: none;\n min-width: 50px;\n padding-block: var(--qds-control-input-padding-horizontal);\n\n &::-webkit-color-swatch-wrapper {\n padding: 0;\n }\n\n &::-webkit-color-swatch {\n border: var(--qds-control-border-width) solid\n var(--qds-theme-control-border);\n border-radius: var(--qds-control-border-radius);\n }\n\n &::-moz-color-swatch {\n border: var(--qds-control-border-width) solid\n var(--qds-theme-control-border);\n border-radius: var(--qds-control-border-radius);\n }\n\n cursor: pointer;\n\n &:hover {\n background-color: var(--qds-theme-interactive-background-hover);\n }\n\n &:active {\n background-color: var(--qds-theme-interactive-background-pressed);\n }\n }\n\n &:disabled {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n }\n\n &:focus-visible {\n outline: var(--qds-theme-focus-border) solid var(--qds-focus-border-width);\n outline-offset: var(--qds-focus-border-offset);\n }\n\n &:placeholder-shown {\n color: var(--qds-theme-control-text-placeholder);\n }\n}\n\n[data-size='small'] {\n font: var(--qds-control-small-text);\n height: var(--qds-control-small-height);\n}\n\n[data-size='standard'] {\n font: var(--qds-control-standard-text);\n height: var(--qds-control-standard-height);\n}\n\n[data-size='large'] {\n font: var(--qds-control-large-text);\n height: var(--qds-control-large-height);\n}\n","// SPDX-FileCopyrightText: © 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 Method,\n Prop,\n Watch,\n} from '@stencil/core'\n\nimport type { Attributes, QdsFocusEventDetail } from '../../helpers'\nimport {\n inheritAriaAttributes,\n inheritAttributes,\n invariant,\n pick,\n pickFocusEventAttributes,\n} from '../../helpers'\n\nexport type AutoCapitalize =\n | 'characters'\n | 'none'\n | 'off'\n | 'on'\n | 'sentences'\n | 'words'\nexport type AutoComplete =\n | 'additional-name'\n | 'address-level1'\n | 'address-level2'\n | 'address-level3'\n | 'address-level4'\n | 'address-line1'\n | 'address-line2'\n | 'address-line3'\n | 'bday-day'\n | 'bday-month'\n | 'bday-year'\n | 'bday'\n | 'cc-additional-name'\n | 'cc-csc'\n | 'cc-exp-month'\n | 'cc-exp-year'\n | 'cc-exp'\n | 'cc-family-name'\n | 'cc-given-name'\n | 'cc-name'\n | 'cc-number'\n | 'cc-type'\n | 'country-name'\n | 'country'\n | 'current-password'\n | 'email'\n | 'family-name'\n | 'given-name'\n | 'honorific-prefix'\n | 'honorific-suffix'\n | 'impp'\n | 'language'\n | 'name'\n | 'new-password'\n | 'nickname'\n | 'off'\n | 'on'\n | 'one-time-code'\n | 'organization-title'\n | 'organization'\n | 'photo'\n | 'postal-code'\n | 'sex'\n | 'street-address'\n | 'tel-area-code'\n | 'tel-country-code'\n | 'tel-extension'\n | 'tel-local'\n | 'tel-national'\n | 'tel'\n | 'transaction-amount'\n | 'transaction-currency'\n | 'url'\n | 'username'\nexport type EnterKeyHint =\n | 'done'\n | 'enter'\n | 'go'\n | 'next'\n | 'previous'\n | 'search'\n | 'send'\nexport type InputType =\n | 'color'\n | 'date'\n | 'datetime-local'\n | 'email'\n | 'month'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'text'\n | 'time'\n | 'url'\n | 'week'\nexport type InputMode =\n | 'decimal'\n | 'email'\n | 'none'\n | 'numeric'\n | 'search'\n | 'tel'\n | 'text'\n | 'url'\nexport type InputSize = 'large' | 'small' | 'standard'\nexport type InputValue = number | string | null\nexport type SelectDirection = 'backward' | 'forward' | 'none'\nexport type QdsInputEventDetail = Pick<\n InputEvent,\n 'data' | 'inputType' | 'isComposing'\n>\n\nlet autoIncrementingId = 1\n\n/**\n * The `<qds-input>` element is used to create interactive controls for\n * web-based forms in order to accept data from the user; a wide variety of\n * types of input data and control widgets are available, depending on the\n * device and\n * [user agent](https://developer.mozilla.org/docs/Glossary/User_agent).\n *\n * @see https://quartz.se.com/build/components/input\n */\n@Component({\n tag: 'qds-input',\n scoped: true,\n styleUrl: 'input.css',\n})\nexport class Input implements ComponentInterface {\n /**\n * Defines if the input is in an invalid state. Validity is determined by\n * attributes such as `type`, `pattern`, `min`, `max`, `required`, `step`,\n * `minlength`, and `maxlength` using\n * [constraint validation](https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation).\n */\n @Prop({ mutable: true, reflect: true }) public invalid?: boolean\n\n /**\n * The input's size.\n *\n * > **_NOTE:_** The native\n * [`size` HTML attribute](https://developer.mozilla.org/docs/Web/HTML/Attributes/size)\n * is not supported. CSS `width` should be used instead if this functionality\n * is needed.\n */\n @Prop({ reflect: true }) public readonly size: InputSize = 'standard'\n\n /**\n * Controls whether and how input is automatically capitalized as it is\n * entered/edited by the user. Only valid for `search`, `tel`, and `text`\n * inputs. Possible values:\n *\n * - `\"off\"` or `\"none\"`: No auto-capitalization is applied (all letters\n * default to lowercase).\n * - `\"on\"` or `\"sentences\"`: The first letter of each sentence defaults to a\n * capital letter; all other letters default to lowercase.\n * - `\"words\"`: The first letter of each word defaults to a capital letter;\n * all other letters default to lowercase.\n * - `\"characters\"`: All letters default to uppercase.\n *\n * @webnative\n */\n @Prop({ attribute: 'autocapitalize' })\n public readonly autoCapitalize?: AutoCapitalize\n\n /**\n * Indicates whether the value of the input can be automatically completed by\n * the browser.\n *\n * @webnative\n */\n @Prop({ attribute: 'autocomplete' })\n public readonly autoComplete?: AutoComplete\n\n /**\n * Specify whether the input should have focus when the page loads.\n *\n * @webnative\n */\n @Prop({ attribute: 'autofocus' }) public readonly autoFocus?: boolean\n\n /**\n * Prevents the input from being interacted with: it cannot be pressed or\n * focused.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public disabled?: boolean\n\n /**\n * What action label (or icon) to present for the enter key on virtual\n * keyboards. Possible values:\n *\n * - `\"done\"`: Typically meaning there is nothing more to input and the input\n * method editor (IME) will be closed.\n * - `\"enter\"`:\tTypically inserting a new line.\n * - `\"go\"`: \tTypically meaning to take the user to the target of the text\n * they typed.\n * - `\"next\"`: \tTypically taking the user to the next field that will accept\n * text.\n * - `\"previous\"`: Typically taking the user to the previous field that will\n * accept text.\n * - `\"search\"`: Typically taking the user to the results of searching for\n * the text they have typed.\n * - `\"send\"`: Typically delivering the text to its target.\n *\n * @webnative\n */\n // FIXME: Can't use `attribute` option here to name this `enterKeyHint` instead.\n @Prop() public readonly enterkeyhint?: EnterKeyHint\n\n /**\n * The [`<form>`](https://developer.mozilla.org/docs/Web/HTML/Element/form)\n * element to associate the input with (its form owner).\n *\n * The value of this attribute must be the id of a `<form>` in the same\n * document. If this attribute is not set, the `<qds-input>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This attribute lets you associate `<qds-input>` elements to `<form>`s\n * anywhere in the document, not just inside a `<form>`. It can also override\n * an ancestor `<form>` element.\n *\n * @webnative\n */\n @Prop() public readonly form?: string\n\n /**\n * Provide a hint to browsers as to the type of virtual keyboard\n * configuration to use when editing this element or its contents.\n *\n * @webnative\n */\n // FIXME: Can't use `attribute` option here to name this `inputMode` instead.\n @Prop() public readonly inputmode?: InputMode\n\n /**\n * Defines the greatest value in the range of permitted values. If the\n * `value` entered into the input exceeds this, the input fails\n * [constraint validation](https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation).\n * Only valid for `date`, `datetime-local`, `month`, `time`, and `week`\n * inputs.\n *\n * If this value isn't a valid number, then the input has no maximum value.\n *\n * @webnative\n */\n @Prop() public readonly max?: number | string\n\n /**\n * The maximum number of characters (as UTF-16 code units) the user can enter\n * into the input. This must be an non-negative integer value. If no\n * `maxlength` is specified, or an invalid value is specified, the input has\n * no maximum length. Only valid for `email`, `password`, `search`, `tel`,\n * `text`, and `url` inputs.\n *\n * The input will fail\n * [constraint validation](https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation)\n * if the length of the text entered into the field is greater than\n * `maxlength` UTF-16 code units long. By default, browsers prevent users\n * from entering more characters than allowed by the `maxlength` attribute. See\n * [Client-side validation](https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation)\n * for more information.\n *\n * @webnative\n */\n @Prop({ attribute: 'maxlength' }) public readonly maxLength?: number\n\n /**\n * Defines the most negative value in the range of permitted values. If the\n * `value` entered into the input is less than this, the input fails\n * [constraint validation](https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation).\n * Only valid for `date`, `datetime-local`, `month`, `time`, and `week`\n * inputs.\n *\n * This value must be less than or equal to the value of the `max` attribute.\n * If this value isn't a valid number, then the input has no minimum value.\n *\n * @webnative\n */\n @Prop() public readonly min?: number | string\n\n /**\n * The minimum number of characters (as UTF-16 code units) the user can enter\n * into the input. This must be an non-negative integer value smaller than or\n * equal to the value specified by `maxlength`. If no `minlength` is\n * specified, or an invalid value is specified, the input has no minimum\n * length. Only valid for `email`, `password`, `search`, `tel`, `text`, and\n * `url` inputs.\n *\n * The input will fail\n * [constraint validation](https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation)\n * if the length of the text entered into the field is fewer than `minlength`\n * UTF-16 code units long, preventing form submission. See\n * [Client-side validation](https://developer.mozilla.org/docs/Web/HTML/Element/input#client-side_validation)\n * for more information.\n *\n * @webnative\n */\n @Prop({ attribute: 'minlength' }) public readonly minLength?: number\n\n /**\n * Specifies if multiple comma-separated email addresses can be entered. Only\n * valid for `email` inputs.\n *\n * @webnative\n */\n @Prop() public readonly multiple?: boolean\n\n /**\n * The name of the control, which is submitted with the form data. An\n * incrementing input ID is used by default.\n *\n * @webnative\n */\n @Prop() public readonly name = `qds-input-${autoIncrementingId}`\n\n /**\n * Defines a regular expression that the input's `value` must match in order\n * for the value to pass\n * [constraint validation](https://developer.mozilla.org/docs/Web/Guide/HTML/Constraint_validation).\n * It must be a valid JavaScript regular expression, as used by the\n * [`RegExp`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/RegExp)\n * type, and as documented in MDN's\n * [guide on regular expressions](https://developer.mozilla.org/docs/Web/JavaScript/Guide/Regular_Expressions);\n * the `'u'` flag is specified when compiling the regular expression, so that\n * the pattern is treated as a sequence of Unicode code points, instead of as\n * ASCII. No forward slashes should be specified around the pattern text.\n * Only valid for `email`, `password`, `search`, `tel`, `text`, and `url`\n * inputs.\n *\n * If the `pattern` is invalid, no regular expression is applied and this\n * property is ignored. If the pattern is valid and a non-empty value does\n * not match the pattern, constraint validation will prevent form submission.\n *\n * @webnative\n */\n @Prop() public readonly pattern?: string\n\n /**\n * Text that appears in the input when it has no value set. Only valid for\n * `email`, `number`, `password`, `search`, `tel`, `text`, and `url` inputs.\n *\n * @webnative\n */\n @Prop() public readonly placeholder?: string\n\n /**\n * The value of the input cannot be edited. Not valid for `color` inputs.\n *\n * @webnative\n */\n @Prop({ attribute: 'readonly' }) public readonly readOnly?: boolean\n\n /**\n * A value must be specified for the input before the owning form can be\n * submitted. Not valid for `color` inputs.\n *\n * See\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 * Defines whether the input may be checked for spelling errors.\n *\n * @webnative\n */\n @Prop({ attribute: 'spellcheck' }) public readonly spellCheck?: boolean\n\n /**\n * Specifies the granularity that the `value` must adhere to. Only valid for\n * `date`, `datetime-local`, `month`, `number`, `time`, and `week` inputs.\n *\n * The value must be a positive number—integer or float—or the special value\n * `any`, which means no stepping is implied, and any value is allowed\n * (barring other constraints, such as `min` and `max`).\n *\n * If `any` is not explicitly set, valid values for the `number` are the\n * basis for stepping — the `min` value and increments of the step value, up\n * to the `max` value, if specified.\n *\n * @webnative\n */\n @Prop() public readonly step?: number | 'any'\n\n /**\n * The type of input to render:\n *\n * - `\"date\"`: An input for entering a date (year, month, and day, with no\n * time). Opens a date picker or numeric wheels for year, month, day when\n * active in supporting browsers.\n * - `\"datetime-local\"`: An input for entering a date and time, with no time\n * zone. Opens a date picker or numeric wheels for date and time components\n * when active in supporting browsers.\n * - `\"email\"`: An input for editing an email address. Looks like a `\"text\"`\n * input, but has validation parameters and relevant keyboard in supporting\n * browsers and devices with dynamic keyboards.\n * - `\"month\"`: An input for entering a month and year, with no time zone.\n * - `\"number\"`: An input for entering a number. Displays a spinner and adds\n * default validation when supported. Displays a numeric keypad in some\n * devices with dynamic keypads.\n * - `\"password\"`: A single-line text input whose value is obscured. Will\n * alert user if site is not secure.\n * - `\"search\"`: A single-line text input for entering search strings.\n * Line-breaks are automatically removed from the input value. May include a\n * delete icon in supporting browsers that can be used to clear the input.\n * Displays a search icon instead of enter key on some devices with dynamic\n * keypads.\n * - `\"tel\"`: An input for entering a telephone number. Displays a telephone\n * keypad in some devices with dynamic keypads.\n * - `\"text\"`: A single-line text input. Line-breaks are automatically\n * removed from the input value.\n * - `\"time\"`: An input for entering a time value with no time zone.\n * - `\"url\"`: An input for entering a URL. Looks like a `\"text\"` input, but\n * has validation parameters and relevant keyboard in supporting browsers and\n * devices with dynamic keyboards.\n * - `\"week\"`: An input for entering a date consisting of a week-year number\n * and a week number with no time zone.\n *\n * @webnative\n */\n @Prop() public readonly type?: InputType\n\n /**\n * The value of the input.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public value?: InputValue\n\n /**\n * Emitted when the input loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when an alteration to the input's value is committed by the user.\n */\n @Event({ eventName: 'qdsChange', cancelable: false })\n private readonly changeEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the input gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the input's value changes.\n */\n @Event({ eventName: 'qdsInput', cancelable: false })\n private readonly inputEmitter!: EventEmitter<QdsInputEventDetail>\n\n @Element() private readonly element!: HTMLQdsInputElement\n\n private inheritedAttributes: Attributes = {}\n\n private input?: HTMLInputElement\n\n private get computedDisabled(): boolean {\n return this.disabled ?? false\n }\n\n /**\n * Returns true if the element's value passes validity checks; otherwise,\n * returns false, fires an invalid event at the element, and (if the event\n * isn't canceled) reports the problem to 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 * Selects the entire content of the `<qds-input>` element if the element's\n * content is selectable.\n */\n @Method()\n public async select(): Promise<void> {\n invariant(this.input)\n\n this.input.select()\n }\n\n /**\n * Sets a custom validity message for the input. If this message is not the\n * empty string, then the element 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 this.invalid = !this.input.checkValidity()\n }\n\n /**\n * Sets the contents of the specified range of characters in the input element to a given string.\n *\n * @param replacement The string to insert.\n * @param start The 0-based index of the first character to replace. Defaults to the current selectionStart value (the start of the user's current selection).\n * @param end The 0-based index of the character _after_ the last character to replace. Defaults to the current selectionEnd value (the end of the user's current selection).\n * @param selectionMode A string defining how the selection should be set after the text has been replaced. Possible values:\n *\n * - `\"select\"` selects the newly inserted text.\n * - `\"start\"` moves the selection to just before the inserted text.\n * - `\"end\"` moves the selection to just after the inserted text.\n * - `\"preserve\"` attempts to preserve the selection.\n */\n @Method()\n public async setRangeText(\n replacement: string,\n start: number,\n end: number,\n selectionMode: SelectionMode = 'preserve',\n ): Promise<void> {\n invariant(this.input)\n\n this.input.setRangeText(replacement, start, end, selectionMode)\n\n if (this.value !== this.input.value) {\n this.value = this.input.value\n this.inputEmitter.emit()\n this.changeEmitter.emit()\n }\n }\n\n /**\n * Selects the specified range of characters within the input.\n *\n * @param start The offset into the input for the start of the selection.\n * @param end The offset into the input for the end of the selection.\n * @param direction The direction in which the selection is performed.\n */\n @Method()\n public async setSelectionRange(\n start: number | null,\n end: number | null,\n direction?: SelectDirection,\n ): Promise<void> {\n invariant(this.input)\n\n this.input.setSelectionRange(start, end, direction)\n }\n\n /**\n * Decrements the `value` by (`step` * n), where n defaults to 1 if not\n * specified.\n *\n * @param n Amount to decrement the value by.\n */\n @Method()\n public async stepDown(n?: number): Promise<void> {\n invariant(this.input)\n\n this.input.stepDown(n)\n }\n\n /**\n * Increments the `value` by (`step` * n), where n defaults to 1 if not\n * specified.\n *\n * @param n Amount to increment the value by.\n */\n @Method()\n public async stepUp(n?: number): Promise<void> {\n invariant(this.input)\n\n this.input.stepUp(n)\n }\n\n @Watch('disabled')\n protected disabledChanged(): void {\n invariant(this.input)\n\n // Disabled inputs are always valid, so we need to recheck validity when\n // the state changes.\n this.input.disabled = this.computedDisabled\n this.invalid = !this.input.checkValidity()\n }\n\n @Watch('step')\n protected stepChanged(): void {\n invariant(this.input)\n\n // If step changes, the value may become invalid so we need to recheck\n // after the update. We set the new step imperatively so we don't have to\n // wait for the next render to report the updated validity.\n this.input.step = String(this.step)\n this.invalid = !this.input.checkValidity()\n }\n\n @Watch('value')\n protected valueChanged(): void {\n invariant(this.input)\n\n this.invalid = !this.input.checkValidity()\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 <input\n aria-invalid={this.invalid ?? false ? 'true' : 'false'}\n autoCapitalize={this.autoCapitalize}\n autoComplete={this.autoComplete}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.autoFocus}\n class=\"input\"\n data-size={this.size}\n disabled={this.disabled}\n enterKeyHint={this.enterkeyhint}\n form={this.form}\n inputMode={this.inputmode}\n max={this.max}\n maxLength={this.maxLength}\n min={this.min}\n minLength={this.minLength}\n multiple={this.multiple}\n name={this.name}\n onBlur={this.onBlur}\n onChange={this.onChange}\n onClick={this.onClick}\n onFocus={this.onFocus}\n onInput={this.onInput}\n onInvalid={this.onInvalid}\n pattern={this.pattern}\n placeholder={this.placeholder}\n readOnly={this.readOnly}\n ref={this.ref}\n required={this.required}\n spellcheck={this.spellCheck}\n step={this.step}\n type={this.type}\n value={this.value ?? undefined}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n />\n )\n }\n\n private readonly ref = (input?: HTMLInputElement): void => {\n this.input = input\n }\n\n private readonly onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onChange = (): void => {\n invariant(this.input)\n\n this.value = this.input.value\n this.changeEmitter.emit()\n }\n\n private readonly onClick = (event: MouseEvent): void => {\n if (this.computedDisabled) {\n event.preventDefault()\n event.stopPropagation()\n }\n }\n\n private readonly onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onInput = (event: InputEvent): void => {\n invariant(this.input)\n\n this.value = this.input.value\n this.inputEmitter.emit(pick(event, 'data', 'inputType', 'isComposing'))\n }\n\n private readonly onInvalid = (): void => {\n this.invalid = true\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../dist/types/components";
|
|
2
|
+
|
|
3
|
+
interface QdsLabel extends Components.QdsLabel, HTMLElement {}
|
|
4
|
+
export const QdsLabel: {
|
|
5
|
+
prototype: QdsLabel;
|
|
6
|
+
new (): QdsLabel;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: © 2023 Schneider Electric
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: LGPL-2.1-only
|
|
5
|
+
*/
|
|
6
|
+
import { L as Label, d as defineCustomElement$1 } from './label.js';
|
|
7
|
+
|
|
8
|
+
const QdsLabel = Label;
|
|
9
|
+
const defineCustomElement = defineCustomElement$1;
|
|
10
|
+
|
|
11
|
+
export { QdsLabel, defineCustomElement };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=qds-label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"qds-label.js","mappings":";;;;;;;;;;;;","names":[],"sources":[],"sourcesContent":[],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../dist/types/components";
|
|
2
|
+
|
|
3
|
+
interface QdsRadio extends Components.QdsRadio, HTMLElement {}
|
|
4
|
+
export const QdsRadio: {
|
|
5
|
+
prototype: QdsRadio;
|
|
6
|
+
new (): QdsRadio;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: © 2023 Schneider Electric
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: LGPL-2.1-only
|
|
5
|
+
*/
|
|
6
|
+
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
7
|
+
import { p as pickFocusEventAttributes, a as invariant, i as inheritAriaAttributes, b as inheritAttributes } from './helpers.js';
|
|
8
|
+
import { d as defineCustomElement$3 } from './icon.js';
|
|
9
|
+
import { d as defineCustomElement$2 } from './label.js';
|
|
10
|
+
|
|
11
|
+
const radioCss = ".sc-qds-radio-h{box-sizing:border-box}[hidden].sc-qds-radio-h{display:none !important}.sc-qds-radio-h *.sc-qds-radio,.sc-qds-radio-h *.sc-qds-radio::before,.sc-qds-radio-h *.sc-qds-radio::after{box-sizing:inherit}.sc-qds-radio-h{display:inline-block;line-height:0}.icon.sc-qds-radio{display:none;color:var(--qds-theme-signature-color-contrast);inset-inline-start:0;pointer-events:none;position:absolute}.label.sc-qds-radio{cursor:pointer;display:inline-flex;position:relative}.radio.sc-qds-radio{align-items:center;-webkit-appearance:none;appearance:none;background-color:var(--qds-theme-control-input-background);border-radius:var(--qds-control-rounded-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}.radio.sc-qds-radio:focus-visible{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}.radio.sc-qds-radio::before{border-radius:var(--qds-control-rounded-border-radius);content:'';height:10px;position:absolute;width:10px}.radio.sc-qds-radio:hover::before{box-shadow:inset 1em 1em var(--qds-theme-signature-color-hover)}.radio.sc-qds-radio:active::before{box-shadow:inset 1em 1em var(--qds-theme-signature-color-pressed)}.radio.sc-qds-radio:checked{background-color:var(--qds-theme-signature-color-default);border-color:transparent}.radio.sc-qds-radio:checked~.icon.sc-qds-radio{display:inline-block}.radio.sc-qds-radio:checked:hover{background-color:var(--qds-theme-signature-color-hover)}.radio.sc-qds-radio:checked:active{background-color:var(--qds-theme-signature-color-pressed)}[aria-disabled='true'].sc-qds-radio{opacity:var(--qds-theme-disabled);pointer-events:none}.icon[data-size='small'].sc-qds-radio,.radio[data-size='small'].sc-qds-radio{width:var(--qds-control-small-icon-size);height:var(--qds-control-small-icon-size)}.inline[data-size='small'].sc-qds-radio{margin-block:var(--qds-control-small-padding-auto-height)}.label[data-size='small'].sc-qds-radio{gap:var(--qds-control-small-gap-siblings-related)}.icon[data-size='standard'].sc-qds-radio,.radio[data-size='standard'].sc-qds-radio{width:var(--qds-control-standard-icon-size);height:var(--qds-control-standard-icon-size)}.inline[data-size='standard'].sc-qds-radio{margin-block:var(--qds-control-standard-padding-auto-height)}.label[data-size='standard'].sc-qds-radio{gap:var(--qds-control-standard-gap-siblings-related)}.icon[data-size='large'].sc-qds-radio,.radio[data-size='large'].sc-qds-radio{width:var(--qds-control-large-icon-size);height:var(--qds-control-large-icon-size)}.inline[data-size='large'].sc-qds-radio{margin-block:var(--qds-control-large-padding-auto-height)}.label[data-size='large'].sc-qds-radio{gap:var(--qds-control-large-gap-siblings-related)}";
|
|
12
|
+
|
|
13
|
+
const Radio = /*@__PURE__*/ proxyCustomElement(class Radio extends HTMLElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super();
|
|
16
|
+
this.__registerHost();
|
|
17
|
+
this.blurEmitter = createEvent(this, "qdsBlur", 2);
|
|
18
|
+
this.changeEmitter = createEvent(this, "qdsChange", 6);
|
|
19
|
+
this.focusEmitter = createEvent(this, "qdsFocus", 2);
|
|
20
|
+
this.inheritedAttributes = {};
|
|
21
|
+
this.ref = (input) => {
|
|
22
|
+
this.input = input;
|
|
23
|
+
};
|
|
24
|
+
this.onBlur = (event) => {
|
|
25
|
+
this.blurEmitter.emit(pickFocusEventAttributes(event));
|
|
26
|
+
};
|
|
27
|
+
this.onChange = () => {
|
|
28
|
+
this.changeEmitter.emit();
|
|
29
|
+
};
|
|
30
|
+
this.onFocus = (event) => {
|
|
31
|
+
this.focusEmitter.emit(pickFocusEventAttributes(event));
|
|
32
|
+
};
|
|
33
|
+
this.inline = false;
|
|
34
|
+
this.size = 'standard';
|
|
35
|
+
this.text = undefined;
|
|
36
|
+
this.checked = undefined;
|
|
37
|
+
this.disabled = undefined;
|
|
38
|
+
this.form = undefined;
|
|
39
|
+
this.name = undefined;
|
|
40
|
+
this.required = undefined;
|
|
41
|
+
this.value = undefined;
|
|
42
|
+
}
|
|
43
|
+
get computedDisabled() {
|
|
44
|
+
return this.disabled ?? false;
|
|
45
|
+
}
|
|
46
|
+
get hasText() {
|
|
47
|
+
return this.text !== undefined && this.text !== '';
|
|
48
|
+
}
|
|
49
|
+
onClick() {
|
|
50
|
+
invariant(this.input);
|
|
51
|
+
this.checked = this.input.checked;
|
|
52
|
+
}
|
|
53
|
+
componentWillLoad() {
|
|
54
|
+
this.inheritedAttributes = {
|
|
55
|
+
...inheritAriaAttributes(this.element),
|
|
56
|
+
...inheritAttributes(this.element, ['tabindex']),
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
render() {
|
|
60
|
+
return (
|
|
61
|
+
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
62
|
+
h("label", { "aria-disabled": this.computedDisabled ? 'true' : 'false', class: {
|
|
63
|
+
inline: this.inline,
|
|
64
|
+
label: true,
|
|
65
|
+
}, "data-size": this.size }, h("input", { checked: this.checked, class: "radio", "data-size": this.size, disabled: this.disabled, form: this.form, name: this.name, onBlur: this.onBlur, onChange: this.onChange, onFocus: this.onFocus, ref: this.ref, required: this.required, type: "radio", value: this.value ?? undefined, ...this.inheritedAttributes }), h("qds-icon", { "aria-hidden": "true", class: "icon", "data-size": this.size, library: "system", name: "check" }), this.hasText && h("qds-label", { size: this.size, text: this.text })));
|
|
66
|
+
}
|
|
67
|
+
get element() { return this; }
|
|
68
|
+
static get style() { return radioCss; }
|
|
69
|
+
}, [2, "qds-radio", {
|
|
70
|
+
"inline": [4],
|
|
71
|
+
"size": [513],
|
|
72
|
+
"text": [1537],
|
|
73
|
+
"checked": [1540],
|
|
74
|
+
"disabled": [1540],
|
|
75
|
+
"form": [1],
|
|
76
|
+
"name": [1],
|
|
77
|
+
"required": [4],
|
|
78
|
+
"value": [1032]
|
|
79
|
+
}, [[0, "click", "onClick"]]]);
|
|
80
|
+
function defineCustomElement$1() {
|
|
81
|
+
if (typeof customElements === "undefined") {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
const components = ["qds-radio", "qds-icon", "qds-label"];
|
|
85
|
+
components.forEach(tagName => { switch (tagName) {
|
|
86
|
+
case "qds-radio":
|
|
87
|
+
if (!customElements.get(tagName)) {
|
|
88
|
+
customElements.define(tagName, Radio);
|
|
89
|
+
}
|
|
90
|
+
break;
|
|
91
|
+
case "qds-icon":
|
|
92
|
+
if (!customElements.get(tagName)) {
|
|
93
|
+
defineCustomElement$3();
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
|
+
case "qds-label":
|
|
97
|
+
if (!customElements.get(tagName)) {
|
|
98
|
+
defineCustomElement$2();
|
|
99
|
+
}
|
|
100
|
+
break;
|
|
101
|
+
} });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const QdsRadio = Radio;
|
|
105
|
+
const defineCustomElement = defineCustomElement$1;
|
|
106
|
+
|
|
107
|
+
export { QdsRadio, defineCustomElement };
|
|
108
|
+
|
|
109
|
+
//# sourceMappingURL=qds-radio.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"qds-radio.js","mappings":";;;;;;;;;;AAAA,MAAM,QAAQ,GAAG,q0FAAq0F;;MCiCz0F,KAAK;;;;;;;IAoGR,wBAAmB,G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AO,eACF,IAAI,CAAC,IAAI,EACpB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,IAAI,EAAE,IAAI,CAAC,IAAI,EACf,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,GAAG,EAAE,IAAI,CAAC,GAAG,EACb,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,IAAI,EAAC,OAAO,EACZ,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,SAAS,KAE1B,IAAI,CAAC,mBAAmB,GAC5B,EACF,+BACc,MAAM,EAClB,KAAK,EAAC,MAAM,eACD,IAAI,CAAC,IAAI,EACpB,OAAO,EAAC,QAAQ,EAChB,IAAI,EAAC,OAAO,GACZ,EACD,IAAI,CAAC,OAAO,IAAI,iBAAW,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,GAAI,CAC1D,EACT;GACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["./src/components/radio/radio.css?tag=qds-radio&encapsulation=scoped","./src/components/radio/radio.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.radio {\n align-items: center;\n appearance: none;\n background-color: var(--qds-theme-control-input-background);\n border-radius: var(--qds-control-rounded-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 border-radius: var(--qds-control-rounded-border-radius);\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 {\n background-color: var(--qds-theme-signature-color-default);\n border-color: transparent;\n\n & ~ .icon {\n display: inline-block;\n }\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, .radio) {\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, .radio) {\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, .radio) {\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 { Component, Element, Event, h, Listen, Prop } 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 RadioValue = number | string | null\nexport type RadioSize = 'large' | 'small' | 'standard'\n\n/**\n * `<qds-radio>` elements are rendered as circles that are filled when\n * selected. They are generally used in **radio groups** — collections of radio\n * buttons describing a set of related options.\n *\n * Only one radio button in a given radio group can be selected at the same\n * time.\n *\n * @see https://quartz.se.com/build/components/radio\n */\n@Component({\n tag: 'qds-radio',\n scoped: true,\n styleUrl: 'radio.css',\n})\nexport class Radio implements ComponentInterface {\n /**\n * Adds vertical margin to the radio 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 radio button's size.\n */\n @Prop({ reflect: true }) public readonly size: RadioSize = 'standard'\n\n /**\n * The radio button's text.\n */\n @Prop({ mutable: true, reflect: true }) public readonly text?: string\n\n /**\n * Sets the radio button's state.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public checked?: boolean\n\n /**\n * Prevents the radio button from being interacted with: it cannot be pressed\n * or 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 radio button 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-radio>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This property lets you associate `<qds-radio>` 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 * Specify the radio group this radio button belongs to.\n *\n * Once a radio group is established, selecting any radio button in that\n * group automatically deselects any currently-selected radio button in the\n * same group.\n *\n * @webnative\n */\n @Prop() public readonly name?: string\n\n /**\n * Specify the group the radio button belongs to as required.\n *\n * If any radio button in a same-named group of radio buttons has the\n * `required` attribute, a radio button in that group must be checked,\n * although it doesn't have to be the one with the attribute applied.\n *\n * @webnative\n */\n @Prop() public readonly required?: boolean\n\n /**\n * The value of the radio button, submitted as a name/value pair with form\n * data.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public value?: RadioValue\n\n /**\n * Emitted when the radio button loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when the radio button is checked by the user.\n */\n @Event({ eventName: 'qdsChange', cancelable: false })\n private readonly changeEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the radio button gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n @Element() private readonly element!: HTMLQdsRadioElement\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 hasText(): boolean {\n return this.text !== undefined && this.text !== ''\n }\n\n @Listen('click')\n protected onClick(): void {\n invariant(this.input)\n\n this.checked = this.input.checked\n }\n\n public componentWillLoad(): void {\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 checked={this.checked}\n class=\"radio\"\n data-size={this.size}\n disabled={this.disabled}\n form={this.form}\n name={this.name}\n onBlur={this.onBlur}\n onChange={this.onChange}\n onFocus={this.onFocus}\n ref={this.ref}\n required={this.required}\n type=\"radio\"\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=\"icon\"\n data-size={this.size}\n library=\"system\"\n name=\"check\"\n />\n {this.hasText && <qds-label size={this.size} text={this.text} />}\n </label>\n )\n }\n\n private readonly ref = (input?: HTMLInputElement): void => {\n this.input = input\n }\n\n private readonly onBlur = (event: FocusEvent): void => {\n this.blurEmitter.emit(pickFocusEventAttributes(event))\n }\n\n private readonly onChange = (): void => {\n this.changeEmitter.emit()\n }\n\n private readonly onFocus = (event: FocusEvent): void => {\n this.focusEmitter.emit(pickFocusEventAttributes(event))\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../dist/types/components";
|
|
2
|
+
|
|
3
|
+
interface QdsSwitch extends Components.QdsSwitch, HTMLElement {}
|
|
4
|
+
export const QdsSwitch: {
|
|
5
|
+
prototype: QdsSwitch;
|
|
6
|
+
new (): QdsSwitch;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|