@quartzds/core 1.0.0-beta.25 → 1.0.0-beta.27
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 +5 -5
- package/components/controls.js +4 -4
- package/components/controls.js.map +1 -1
- package/components/floating-ui.dom.esm.js +2 -2
- package/components/helpers.js +4 -4
- package/components/helpers.js.map +1 -1
- package/components/icon.js +10 -7
- package/components/icon.js.map +1 -1
- package/components/index.d.ts +2 -0
- package/components/index.js +5 -4
- package/components/index.js.map +1 -1
- package/components/label.js +15 -3
- package/components/label.js.map +1 -1
- package/components/qds-button.js +48 -6
- package/components/qds-button.js.map +1 -1
- package/components/qds-checkbox.js +25 -13
- package/components/qds-checkbox.js.map +1 -1
- package/components/qds-dialog.js +3 -3
- package/components/qds-dialog.js.map +1 -1
- package/components/qds-divider.js +13 -3
- package/components/qds-divider.js.map +1 -1
- package/components/qds-dropdown.js +3 -3
- package/components/qds-dropdown.js.map +1 -1
- package/components/qds-form-message.js +19 -4
- package/components/qds-form-message.js.map +1 -1
- package/components/qds-icon.js +2 -2
- package/components/qds-inline-link.js +18 -5
- package/components/qds-inline-link.js.map +1 -1
- package/components/qds-input.js +33 -21
- package/components/qds-input.js.map +1 -1
- package/components/qds-label.js +2 -2
- package/components/qds-radio.js +17 -8
- package/components/qds-radio.js.map +1 -1
- package/components/qds-select.js +16 -7
- package/components/qds-select.js.map +1 -1
- package/components/qds-standalone-link.d.ts +11 -0
- package/components/qds-standalone-link.js +120 -0
- package/components/qds-standalone-link.js.map +1 -0
- package/components/qds-switch.js +21 -9
- package/components/qds-switch.js.map +1 -1
- package/components/qds-table-body.js +2 -2
- package/components/qds-table-body.js.map +1 -1
- package/components/qds-table-cell.js +3 -3
- package/components/qds-table-cell.js.map +1 -1
- package/components/qds-table-head-cell.js +3 -3
- package/components/qds-table-head-cell.js.map +1 -1
- package/components/qds-table-head.js +2 -2
- package/components/qds-table-head.js.map +1 -1
- package/components/qds-table-row.js +3 -3
- package/components/qds-table-row.js.map +1 -1
- package/components/qds-table.js +2 -2
- package/components/qds-table.js.map +1 -1
- package/components/qds-textarea.js +16 -16
- package/components/qds-textarea.js.map +1 -1
- package/components/qds-title.js +5 -21
- package/components/qds-title.js.map +1 -1
- package/components/qds-tooltip.js +3 -3
- package/components/qds-tooltip.js.map +1 -1
- package/dist/cjs/{controls-3efe912a.js → controls-41400abc.js} +5 -5
- package/dist/cjs/controls-41400abc.js.map +1 -0
- package/dist/cjs/{floating-ui.dom.esm-93efaa21.js → floating-ui.dom.esm-13b47220.js} +3 -3
- package/dist/cjs/{floating-ui.dom.esm-93efaa21.js.map → floating-ui.dom.esm-13b47220.js.map} +1 -1
- package/dist/cjs/{helpers-21f9a5f5.js → helpers-cc2fda81.js} +5 -5
- package/dist/cjs/helpers-cc2fda81.js.map +1 -0
- package/dist/cjs/{index-70b91d40.js → index-b70242ec.js} +15 -4
- package/dist/cjs/{index-70b91d40.js.map → index-b70242ec.js.map} +1 -1
- package/dist/cjs/index.cjs.js +6 -6
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/{library-429681d8.js → library-5e0013b5.js} +10 -7
- package/dist/cjs/library-5e0013b5.js.map +1 -0
- package/dist/cjs/loader.cjs.js +4 -4
- package/dist/cjs/qds-button.cjs.entry.js +46 -6
- package/dist/cjs/qds-button.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-checkbox.cjs.entry.js +22 -10
- package/dist/cjs/qds-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-dialog.cjs.entry.js +4 -4
- package/dist/cjs/qds-dialog.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-divider.cjs.entry.js +15 -5
- package/dist/cjs/qds-divider.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-dropdown.cjs.entry.js +5 -5
- package/dist/cjs/qds-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-form-message.cjs.entry.js +21 -6
- package/dist/cjs/qds-form-message.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-icon.cjs.entry.js +7 -7
- package/dist/cjs/qds-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-inline-link.cjs.entry.js +18 -6
- package/dist/cjs/qds-inline-link.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-input.cjs.entry.js +18 -6
- package/dist/cjs/qds-input.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-label.cjs.entry.js +17 -5
- package/dist/cjs/qds-label.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-radio.cjs.entry.js +16 -7
- package/dist/cjs/qds-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-select.cjs.entry.js +15 -6
- package/dist/cjs/qds-select.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-standalone-link.cjs.entry.js +88 -0
- package/dist/cjs/qds-standalone-link.cjs.entry.js.map +1 -0
- package/dist/cjs/qds-switch.cjs.entry.js +19 -7
- package/dist/cjs/qds-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-table-body.cjs.entry.js +4 -4
- package/dist/cjs/qds-table-body.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-table-cell.cjs.entry.js +5 -5
- package/dist/cjs/qds-table-cell.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-table-head-cell.cjs.entry.js +5 -5
- package/dist/cjs/qds-table-head-cell.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-table-head.cjs.entry.js +4 -4
- package/dist/cjs/qds-table-head.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-table-row.cjs.entry.js +5 -5
- package/dist/cjs/qds-table-row.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-table.cjs.entry.js +4 -4
- package/dist/cjs/qds-table.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-textarea.cjs.entry.js +6 -6
- package/dist/cjs/qds-textarea.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-title.cjs.entry.js +7 -23
- package/dist/cjs/qds-title.cjs.entry.js.map +1 -1
- package/dist/cjs/qds-tooltip.cjs.entry.js +5 -5
- package/dist/cjs/qds-tooltip.cjs.entry.js.map +1 -1
- package/dist/cjs/qds.cjs.js +4 -4
- package/dist/custom-elements.json +530 -36
- package/dist/docs.json +809 -235
- package/dist/esm/{controls-eec36daa.js → controls-07c4a794.js} +5 -5
- package/dist/esm/controls-07c4a794.js.map +1 -0
- package/dist/esm/{floating-ui.dom.esm-48281c44.js → floating-ui.dom.esm-0866be8d.js} +3 -3
- package/dist/esm/{floating-ui.dom.esm-48281c44.js.map → floating-ui.dom.esm-0866be8d.js.map} +1 -1
- package/dist/esm/{helpers-7aa0fd7b.js → helpers-ff47826f.js} +5 -5
- package/dist/esm/helpers-ff47826f.js.map +1 -0
- package/dist/esm/{index-7104bb46.js → index-a58e43a8.js} +15 -4
- package/dist/esm/{index-7104bb46.js.map → index-a58e43a8.js.map} +1 -1
- package/dist/esm/index.js +6 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{library-3b5966e6.js → library-7a30e588.js} +10 -7
- package/dist/esm/library-7a30e588.js.map +1 -0
- package/dist/esm/loader.js +5 -5
- package/dist/esm/qds-button.entry.js +46 -6
- package/dist/esm/qds-button.entry.js.map +1 -1
- package/dist/esm/qds-checkbox.entry.js +22 -10
- package/dist/esm/qds-checkbox.entry.js.map +1 -1
- package/dist/esm/qds-dialog.entry.js +4 -4
- package/dist/esm/qds-dialog.entry.js.map +1 -1
- package/dist/esm/qds-divider.entry.js +15 -5
- package/dist/esm/qds-divider.entry.js.map +1 -1
- package/dist/esm/qds-dropdown.entry.js +5 -5
- package/dist/esm/qds-dropdown.entry.js.map +1 -1
- package/dist/esm/qds-form-message.entry.js +21 -6
- package/dist/esm/qds-form-message.entry.js.map +1 -1
- package/dist/esm/qds-icon.entry.js +7 -7
- package/dist/esm/qds-icon.entry.js.map +1 -1
- package/dist/esm/qds-inline-link.entry.js +18 -6
- package/dist/esm/qds-inline-link.entry.js.map +1 -1
- package/dist/esm/qds-input.entry.js +18 -6
- package/dist/esm/qds-input.entry.js.map +1 -1
- package/dist/esm/qds-label.entry.js +17 -5
- package/dist/esm/qds-label.entry.js.map +1 -1
- package/dist/esm/qds-radio.entry.js +16 -7
- package/dist/esm/qds-radio.entry.js.map +1 -1
- package/dist/esm/qds-select.entry.js +15 -6
- package/dist/esm/qds-select.entry.js.map +1 -1
- package/dist/esm/qds-standalone-link.entry.js +84 -0
- package/dist/esm/qds-standalone-link.entry.js.map +1 -0
- package/dist/esm/qds-switch.entry.js +19 -7
- package/dist/esm/qds-switch.entry.js.map +1 -1
- package/dist/esm/qds-table-body.entry.js +4 -4
- package/dist/esm/qds-table-body.entry.js.map +1 -1
- package/dist/esm/qds-table-cell.entry.js +5 -5
- package/dist/esm/qds-table-cell.entry.js.map +1 -1
- package/dist/esm/qds-table-head-cell.entry.js +5 -5
- package/dist/esm/qds-table-head-cell.entry.js.map +1 -1
- package/dist/esm/qds-table-head.entry.js +4 -4
- package/dist/esm/qds-table-head.entry.js.map +1 -1
- package/dist/esm/qds-table-row.entry.js +5 -5
- package/dist/esm/qds-table-row.entry.js.map +1 -1
- package/dist/esm/qds-table.entry.js +4 -4
- package/dist/esm/qds-table.entry.js.map +1 -1
- package/dist/esm/qds-textarea.entry.js +6 -6
- package/dist/esm/qds-textarea.entry.js.map +1 -1
- package/dist/esm/qds-title.entry.js +7 -23
- package/dist/esm/qds-title.entry.js.map +1 -1
- package/dist/esm/qds-tooltip.entry.js +5 -5
- package/dist/esm/qds-tooltip.entry.js.map +1 -1
- package/dist/esm/qds.js +5 -5
- package/dist/types/components/button/button.d.ts +18 -6
- package/dist/types/components/checkbox/checkbox.d.ts +5 -4
- package/dist/types/components/divider/divider.d.ts +3 -2
- package/dist/types/components/dropdown/dropdown.d.ts +1 -1
- package/dist/types/components/form-message/form-message.d.ts +5 -3
- package/dist/types/components/inline-link/inline-link.d.ts +7 -2
- package/dist/types/components/input/input.d.ts +4 -3
- package/dist/types/components/label/label.d.ts +3 -2
- package/dist/types/components/radio/radio.d.ts +3 -3
- package/dist/types/components/select/select.d.ts +3 -3
- package/dist/types/components/shared.d.ts +4 -0
- package/dist/types/components/standalone-link/standalone-link.d.ts +228 -0
- package/dist/types/components/switch/switch.d.ts +5 -4
- package/dist/types/components/textarea/textarea.d.ts +3 -3
- package/dist/types/components/title/title.d.ts +0 -1
- package/dist/types/components/tooltip/tooltip.d.ts +1 -1
- package/dist/types/components.d.ts +233 -44
- package/dist/types/index.d.ts +1 -1
- package/dist/types/{components/interfaces.d.ts → interface-overrides.d.ts} +2 -2
- package/dist/vscode.html-custom-data.json +159 -8
- package/hydrate/index.js +356 -114
- package/loader/cdn.js +2 -2
- package/loader/index.cjs.js +2 -2
- package/loader/index.es2017.js +2 -2
- package/loader/index.js +2 -2
- package/package.json +4 -4
- package/styles/core.css +2 -2
- package/dist/cjs/controls-3efe912a.js.map +0 -1
- package/dist/cjs/helpers-21f9a5f5.js.map +0 -1
- package/dist/cjs/library-429681d8.js.map +0 -1
- package/dist/esm/controls-eec36daa.js.map +0 -1
- package/dist/esm/helpers-7aa0fd7b.js.map +0 -1
- package/dist/esm/library-3b5966e6.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
SPDX-FileCopyrightText: ©
|
|
2
|
+
SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
3
3
|
|
|
4
|
-
SPDX-License-Identifier:
|
|
4
|
+
SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
-->
|
|
6
6
|
|
|
7
7
|
# `@quartzds/core`
|
|
@@ -40,11 +40,11 @@ Next, the platform and theme CSS custom properties:
|
|
|
40
40
|
```html
|
|
41
41
|
<link
|
|
42
42
|
rel="stylesheet"
|
|
43
|
-
href="https://unpkg.com/@quartzds/generic-tokens
|
|
43
|
+
href="https://unpkg.com/@quartzds/generic-tokens/core/dist/platform/desktop.css"
|
|
44
44
|
/>
|
|
45
45
|
<link
|
|
46
46
|
rel="stylesheet"
|
|
47
|
-
href="https://unpkg.com/@quartzds/generic-tokens
|
|
47
|
+
href="https://unpkg.com/@quartzds/generic-tokens/core/dist/theme/light.css"
|
|
48
48
|
/>
|
|
49
49
|
```
|
|
50
50
|
|
|
@@ -53,7 +53,7 @@ Optionally, the dark theme:
|
|
|
53
53
|
```html
|
|
54
54
|
<link
|
|
55
55
|
rel="stylesheet"
|
|
56
|
-
href="https://unpkg.com/@quartzds/generic-tokens
|
|
56
|
+
href="https://unpkg.com/@quartzds/generic-tokens/core/dist/theme/dark.css"
|
|
57
57
|
/>
|
|
58
58
|
```
|
|
59
59
|
|
package/components/controls.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SPDX-FileCopyrightText: ©
|
|
2
|
+
* SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
3
3
|
*
|
|
4
|
-
* SPDX-License-Identifier:
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
// SPDX-FileCopyrightText: ©
|
|
6
|
+
// SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
7
7
|
//
|
|
8
|
-
// SPDX-License-Identifier:
|
|
8
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
const CUSTOM_ERROR_FLAGS = { customError: true };
|
|
10
10
|
const NO_ERROR_FLAGS = {};
|
|
11
11
|
const VALID_STATE = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"controls.js","mappings":";;;;;AAAA;AACA;AACA;MAmFa,kBAAkB,GAAuB,EAAE,WAAW,EAAE,IAAI,GAAE;MAC9D,cAAc,GAAuB,GAAE;MACvC,WAAW,GAAkB;IACxC,QAAQ,EAAE,KAAK;IACf,WAAW,EAAE,KAAK;IAClB,eAAe,EAAE,KAAK;IACtB,aAAa,EAAE,KAAK;IACpB,cAAc,EAAE,KAAK;IACrB,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,KAAK;IACf,YAAY,EAAE,KAAK;IACnB,KAAK,EAAE,IAAI;IACX,YAAY,EAAE,KAAK;;;;;","names":[],"sources":["src/components/controls.ts"],"sourcesContent":["// SPDX-FileCopyrightText: ©
|
|
1
|
+
{"file":"controls.js","mappings":";;;;;AAAA;AACA;AACA;MAmFa,kBAAkB,GAAuB,EAAE,WAAW,EAAE,IAAI,GAAE;MAC9D,cAAc,GAAuB,GAAE;MACvC,WAAW,GAAkB;IACxC,QAAQ,EAAE,KAAK;IACf,WAAW,EAAE,KAAK;IAClB,eAAe,EAAE,KAAK;IACtB,aAAa,EAAE,KAAK;IACpB,cAAc,EAAE,KAAK;IACrB,YAAY,EAAE,KAAK;IACnB,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,KAAK;IACf,YAAY,EAAE,KAAK;IACnB,KAAK,EAAE,IAAI;IACX,YAAY,EAAE,KAAK;;;;;","names":[],"sources":["src/components/controls.ts"],"sourcesContent":["// SPDX-FileCopyrightText: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\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 AutoCapitalize =\n | 'characters'\n | 'none'\n | 'off'\n | 'on'\n | 'sentences'\n | 'words'\nexport type EnterKeyHint =\n | 'done'\n | 'enter'\n | 'go'\n | 'next'\n | 'previous'\n | 'search'\n | 'send'\nexport type InputMode =\n | 'decimal'\n | 'email'\n | 'none'\n | 'numeric'\n | 'search'\n | 'tel'\n | 'text'\n | 'url'\nexport type Value = number | string | null\n\nexport const CUSTOM_ERROR_FLAGS: ValidityStateFlags = { customError: true }\nexport const NO_ERROR_FLAGS: ValidityStateFlags = {}\nexport const VALID_STATE: ValidityState = {\n badInput: false,\n customError: false,\n patternMismatch: false,\n rangeOverflow: false,\n rangeUnderflow: false,\n stepMismatch: false,\n tooLong: false,\n tooShort: false,\n typeMismatch: false,\n valid: true,\n valueMissing: false,\n}\n"],"version":3}
|
package/components/helpers.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SPDX-FileCopyrightText: ©
|
|
2
|
+
* SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
3
3
|
*
|
|
4
|
-
* SPDX-License-Identifier:
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
// SPDX-FileCopyrightText: ©
|
|
6
|
+
// SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
7
7
|
//
|
|
8
|
-
// SPDX-License-Identifier:
|
|
8
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
9
9
|
/**
|
|
10
10
|
* Elements inside of web components sometimes need to inherit global attributes
|
|
11
11
|
* set on the host. For example, the inner input in `qds-input` should inherit
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"helpers.js","mappings":";;;;;AAAA;AACA;AACA;AAUA;;;;;;;;;;;;;MAaa,iBAAiB,GAAG,CAC/B,OAAgB,EAChB,aAAuB,EAAE;IAEzB,MAAM,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C,QAAQ,CAAC,CAAA;IAC7E,MAAM,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;IACvC,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC;QAAE,OAAO,SAAS,CAAA;IAC1C,MAAM,IAAI,GAAG,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAA;IAExD,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAA;IAChE,OAAO,MAAM,GAAG,gBAAgB,CAAA;AAClC,EAAC;MAEY,aAAa,GAAG,CAAI,OAAmB;IAClD,OAAO,CAAC,KAAK,CAAC;QACZ,SAAS,CAAC,KAAK,CAAC,CAAA;KACjB,CAAC,CAAA;AACJ,EAAC;MAEY,aAAa,GAAG,MAC3B,cAAc,IAAI,UAAU;KAC3B,gBAAgB,IAAI,UAAU,IAAI,UAAU,CAAC,SAAS,CAAC,cAAc,GAAG,CAAC,EAAC;MAEhE,UAAU,GAAG,CAAC,KAAa;IACtC,MAAM,GAAG,GAAG,gBAAgB,IAAI,CAAC,CAAA;IACjC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,GAAG,CAAA;AACtC;;;;","names":[],"sources":["src/helpers.ts"],"sourcesContent":["// SPDX-FileCopyrightText: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {\n MiddlewareState,\n OffsetOptions as LibraryOffsetOptions,\n} from '@floating-ui/dom'\nimport type { Except, Replace } from 'type-fest'\n\nexport type Attributes = Record<string, string | undefined>\n\n/**\n * Elements inside of web components sometimes need to inherit global attributes\n * set on the host. For example, the inner input in `qds-input` should inherit\n * the `tabindex` attribute that developers set directly on `qds-input`. This\n * helper function should be called in componentWillLoad and assigned to a variable\n * that is later used in the render function.\n *\n * This does not need to be reactive as changing attributes on the host element\n * does not trigger a re-render.\n *\n * @param element Element to inherit attributes from.\n * @param attributes Which attributes to inherit.\n */\nexport const inheritAttributes = (\n element: Element,\n attributes: string[] = [],\n): Attributes => {\n const attributeObject: Attributes = {}\n\n for (const attribute of attributes) {\n const value = element.getAttribute(attribute)\n if (value !== null) {\n attributeObject[attribute] = value\n element.removeAttribute(attribute)\n }\n }\n\n return attributeObject\n}\n\ntype ARIAAttribute =\n | Replace<Lowercase<keyof ARIAMixin>, 'aria', 'aria-'>\n | 'aria-activedescendant'\n | 'aria-braillelabel'\n | 'aria-brailleroledescription'\n | 'aria-colindextext'\n | 'aria-controls'\n | 'aria-describedby'\n | 'aria-description'\n | 'aria-details'\n | 'aria-errormessage'\n | 'aria-flowto'\n | 'aria-labelledby'\n | 'aria-owns'\n | 'aria-relevant'\n | 'aria-rowindextext'\n\nconst ariaAttributes: ARIAAttribute[] = [\n 'aria-activedescendant',\n 'aria-atomic',\n 'aria-autocomplete',\n 'aria-braillelabel',\n 'aria-brailleroledescription',\n 'aria-busy',\n 'aria-checked',\n 'aria-colcount',\n 'aria-colindex',\n 'aria-colindextext',\n 'aria-colspan',\n 'aria-controls',\n 'aria-current',\n 'aria-describedby',\n 'aria-description',\n 'aria-details',\n 'aria-disabled',\n 'aria-errormessage',\n 'aria-expanded',\n 'aria-flowto',\n 'aria-haspopup',\n 'aria-hidden',\n 'aria-invalid',\n 'aria-keyshortcuts',\n 'aria-label',\n 'aria-labelledby',\n 'aria-level',\n 'aria-live',\n 'aria-multiline',\n 'aria-multiselectable',\n 'aria-orientation',\n 'aria-owns',\n 'aria-placeholder',\n 'aria-posinset',\n 'aria-pressed',\n 'aria-readonly',\n 'aria-relevant',\n 'aria-required',\n 'aria-roledescription',\n 'aria-rowcount',\n 'aria-rowindex',\n 'aria-rowindextext',\n 'aria-rowspan',\n 'aria-selected',\n 'aria-setsize',\n 'aria-sort',\n 'aria-valuemax',\n 'aria-valuemin',\n 'aria-valuenow',\n 'aria-valuetext',\n 'role',\n]\n\n/**\n * Returns an array of aria attributes that should be copied from\n * the shadow host element to a target within the light DOM.\n *\n * @param element The element that the attributes should be copied from.\n */\nexport const inheritAriaAttributes = (\n element: Element,\n): ReturnType<typeof inheritAttributes> =>\n inheritAttributes(element, ariaAttributes)\n\nconst isProduction = process.env.NODE_ENV === 'production'\nconst prefix = 'Invariant failed'\n\n/**\n * Throws an error if the value is falsy.\n *\n * @param value Value to test.\n * @param message Optional message to display in development builds.\n */\nexport function invariant(value: unknown, message?: string): asserts value {\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n if (value) return\n if (isProduction) throw new Error(prefix)\n\n const error = message === undefined ? prefix : `${prefix}: ${message}`\n throw new Error(error)\n}\n\n/**\n * From an object pick a set of keys.\n *\n * @param object Object to pick from.\n * @param keys They keys to pick.\n * @returns New object with only the picked keys.\n */\nexport const pick = <T, K extends keyof T>(\n object: T,\n ...keys: K[]\n): Pick<T, K> => {\n const returnValue: Partial<Pick<T, K>> = {}\n for (const key of keys) returnValue[key] = object[key]\n return returnValue as Pick<T, K>\n}\n\nexport type QdsFocusEventDetail = Pick<FocusEvent, 'relatedTarget'>\nexport type QdsInputEventDetail = Pick<\n InputEvent,\n 'data' | 'inputType' | 'isComposing'\n>\nexport const pickFocusEventAttributes = (\n event: FocusEvent,\n): QdsFocusEventDetail => pick(event, 'relatedTarget')\nexport const pickInputEventAttributes = (\n event: InputEvent,\n): QdsInputEventDetail => pick(event, 'data', 'inputType', 'isComposing')\n\nconst getConversionFactor = (\n element: Element,\n unit: string,\n): number | undefined => {\n switch (unit) {\n case 'cm': {\n return 96 / 2.54\n }\n case 'em': {\n return Number.parseFloat(\n globalThis.getComputedStyle(\n element.parentElement ?? document.documentElement,\n ).fontSize,\n )\n }\n case 'in': {\n return 96\n }\n case 'mm': {\n return 96 / 25.4\n }\n case 'pc': {\n return 16\n }\n case 'pt': {\n return 96 / 72\n }\n case 'px': {\n return 1\n }\n case 'rem': {\n return Number.parseFloat(\n globalThis.getComputedStyle(document.documentElement).fontSize,\n )\n }\n default: {\n return undefined\n }\n }\n}\n\nexport const propertyToPx = (\n element: Element,\n property: string,\n): number | undefined => {\n const value = globalThis.getComputedStyle(element).getPropertyValue(property)\n const number = Number.parseFloat(value)\n if (Number.isNaN(number)) return undefined\n const unit = /\\s*[\\d+.-]*\\s*(.*)/.exec(value)?.[1] ?? ''\n\n const conversionFactor = getConversionFactor(element, unit) ?? 1\n return number * conversionFactor\n}\n\nexport const ignorePromise = <T>(promise: Promise<T>): void => {\n promise.catch(() => {\n invariant(false)\n })\n}\n\nexport const isTouchDevice = (): boolean =>\n 'ontouchstart' in globalThis ||\n ('maxTouchPoints' in globalThis && globalThis.navigator.maxTouchPoints > 0)\n\nexport const roundByDPR = (value: number): number => {\n const dpr = devicePixelRatio || 1\n return Math.round(value * dpr) / dpr\n}\n\nexport type OffsetValue = Except<\n Exclude<\n LibraryOffsetOptions,\n // eslint-disable-next-line @typescript-eslint/ban-types\n Function | number\n >,\n 'mainAxis'\n>\nexport type OffsetFunction = (state: MiddlewareState) => OffsetValue\nexport type OffsetOptions = OffsetFunction | OffsetValue\n"],"version":3}
|
package/components/icon.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SPDX-FileCopyrightText: ©
|
|
2
|
+
* SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
3
3
|
*
|
|
4
|
-
* SPDX-License-Identifier:
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { getAssetPath, proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
7
7
|
import { i as inheritAriaAttributes } from './helpers.js';
|
|
@@ -12,6 +12,8 @@ const caretDownSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53
|
|
|
12
12
|
|
|
13
13
|
const checkSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggZD0iTTYuMzEgMTEuODYgMy4wOCA4LjYzbC43MS0uNzEgMi41MiAyLjUyIDUuOS01Ljk0LjcxLjctNi42MSA2LjY2WiIvPjwvc3ZnPg==';
|
|
14
14
|
|
|
15
|
+
const chevronRightSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggZD0ibTQuNzcgMTMuOTctLjYyLS43OCA2LjYyLTUuMjMtNi42Mi01LjExLjYxLS43OSA3LjYzIDUuODktNy42MiA2LjAyWiIvPjwvc3ZnPg==';
|
|
16
|
+
|
|
15
17
|
const exclamationSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggZD0iTTcuMTI5IDEyLjA2YS44My44MyAwIDAgMSAuMjM5LS42MTJjLjE2LS4xNTcuMzc4LS4yNDYuNjY3LS4yNDYuMjg5IDAgLjQ5OC4wNzkuNjY3LjI0Ni4xNi4xNTguMjM5LjM2NS4yMzkuNjExcy0uMDguNDM0LS4yNC41OTFjLS4xNTguMTU4LS4zNzcuMjM3LS42NjYuMjM3LS4yODkgMC0uNTA4LS4wOC0uNjY3LS4yMzdhLjc5Ny43OTcgMCAwIDEtLjI0LS41OVptMS41NzMtMi4wNEg3LjMyOGwtLjE1LTYuNjhoMS42ODNsLS4xNiA2LjY4WiIvPjwvc3ZnPg==';
|
|
16
18
|
|
|
17
19
|
const informationSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggZD0iTTYuMTggMTMuMTJ2LS4yNWMuOTUtLjE2Ljk5LS4yNC45OS0xLjUxVjcuOTdjMC0xLjA0LS4wNi0xLjExLS44Mi0xLjMydi0uMjFjLjg4LS4xMiAxLjczLS4zMyAyLjQ4LS42Mi0uMDIuMzUtLjAzIDEuMzItLjAzIDIuMDF2My41M2MwIDEuMjUuMDkgMS4zMyAxLjAyIDEuNTF2LjI1SDYuMThabTEuNjktOC4zNmMtLjQ4IDAtLjktLjQxLS45LS45NCAwLS41Ni40Mi0uOTQuOTItLjk0LjU0IDAgLjk0LjM4Ljk0Ljk0IDAgLjU2LS40Ljk0LS45NS45NGgtLjAxWiIvPjwvc3ZnPg==';
|
|
@@ -20,13 +22,14 @@ const minusSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5v
|
|
|
20
22
|
|
|
21
23
|
const xMarkSvg = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggZD0ibTExLjQzIDUuMjYtLjcxLS43LTIuNzQgMi43Ni0yLjczLTIuNzYtLjcxLjcgMi43NCAyLjc3LTIuNzQgMi43Ny43MS43MSAyLjczLTIuNzcgMi43NCAyLjc3LjcxLS43MS0yLjc0LTIuNzcgMi43NC0yLjc3WiIvPjwvc3ZnPg==';
|
|
22
24
|
|
|
23
|
-
// SPDX-FileCopyrightText: ©
|
|
25
|
+
// SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
24
26
|
const icons = {
|
|
25
27
|
/* eslint-disable @typescript-eslint/naming-convention */
|
|
26
28
|
'external-link': arrowTopRightOnSquareSvg,
|
|
27
29
|
checked: checkSvg,
|
|
28
30
|
indeterminate: minusSvg,
|
|
29
31
|
dropdown: caretDownSvg,
|
|
32
|
+
next: chevronRightSvg,
|
|
30
33
|
'status-error': xMarkSvg,
|
|
31
34
|
'status-info': informationSvg,
|
|
32
35
|
'status-success': checkSvg,
|
|
@@ -38,13 +41,13 @@ const coreLibrary = {
|
|
|
38
41
|
resolver: (name) => icons[name] ?? '',
|
|
39
42
|
};
|
|
40
43
|
|
|
41
|
-
// SPDX-FileCopyrightText: ©
|
|
44
|
+
// SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
42
45
|
const library = {
|
|
43
46
|
name: 'default',
|
|
44
47
|
resolver: (name) => getAssetPath(`icons/${name}.svg`),
|
|
45
48
|
};
|
|
46
49
|
|
|
47
|
-
// SPDX-FileCopyrightText: ©
|
|
50
|
+
// SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
48
51
|
let registry = [library, coreLibrary];
|
|
49
52
|
/**
|
|
50
53
|
* Returns a library from the registry.
|
|
@@ -67,9 +70,9 @@ const registerIconLibrary = (name, options) => {
|
|
|
67
70
|
});
|
|
68
71
|
};
|
|
69
72
|
|
|
70
|
-
// SPDX-FileCopyrightText: ©
|
|
73
|
+
// SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
71
74
|
//
|
|
72
|
-
// SPDX-License-Identifier:
|
|
75
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
73
76
|
const request = async (source) => {
|
|
74
77
|
const response = await fetch(source, { mode: 'cors' });
|
|
75
78
|
return {
|
package/components/icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"icon.js","mappings":";;;;;;;;AAAA,MAAM,wBAAwB,GAAG,oTAAoT;;ACArV,MAAM,YAAY,GAAG,wOAAwO;;ACA7P,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;AAmBA,MAAM,KAAK,GAAuC;;IAEhD,eAAe,EAAEA,wBAAY;aAC7BC,QAAO;mBACPC,QAAa;IACb,QAAQ,EAAEC,YAAS;IACnB,cAAc,EAAEC,QAAW;IAC3B,aAAa,EAAEC,cAAU;IACzB,gBAAgB,EAAEJ,QAAO;IACzB,g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","defaultLibrary"],"sources":["../../node_modules/@quartzds/generic-icons-core/dist/arrow-top-right-on-square.svg","../../node_modules/@quartzds/generic-icons-core/dist/caret-down.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=\"M8 11 1.95 5.04 14.09 5 8 11.01V11ZM4.38 6.03 8 9.6l3.64-3.59-7.27.02h.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 caretDown from '@quartzds/generic-icons-core/dist/caret-down.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 dropdown: caretDown,\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() public readonly name!: string\n\n /**\n * The name of a registered icon library.\n */\n @Prop() 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 if (value !== undefined) 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}
|
|
1
|
+
{"file":"icon.js","mappings":";;;;;;;;AAAA,MAAM,wBAAwB,GAAG,oTAAoT;;ACArV,MAAM,YAAY,GAAG,wOAAwO;;ACA7P,MAAM,QAAQ,GAAG,4NAA4N;;ACA7O,MAAM,eAAe,GAAG,gOAAgO;;ACAxP,MAAM,cAAc,GAAG,gdAAgd;;ACAve,MAAM,cAAc,GAAG,geAAge;;ACAvf,MAAM,QAAQ,GAAG,gKAAgK;;ACAjL,MAAM,QAAQ,GAAG,oSAAoS;;ACArT;AAoBA,MAAM,KAAK,GAAuC;;IAEhD,eAAe,EAAEA,wBAAY;aAC7BC,QAAO;mBACPC,QAAa;cACbC,YAAQ;UACRC,eAAI;IACJ,cAAc,EAAEC,QAAW;IAC3B,aAAa,EAAEC,cAAU;IACzB,gBAAgB,EAAEL,QAAO;IACzB,gBAAgB,EAAEM,cA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ources":["../../node_modules/@quartzds/generic-icons-core/dist/arrow-top-right-on-square.svg","../../node_modules/@quartzds/generic-icons-core/dist/caret-down.svg","../../node_modules/@quartzds/generic-icons-core/dist/check.svg","../../node_modules/@quartzds/generic-icons-core/dist/chevron-right.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=\"M8 11 1.95 5.04 14.09 5 8 11.01V11ZM4.38 6.03 8 9.6l3.64-3.59-7.27.02h.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=\"m4.77 13.97-.62-.78 6.62-5.23-6.62-5.11.61-.79 7.63 5.89-7.62 6.02Z\"/></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: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\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 dropdown from '@quartzds/generic-icons-core/dist/caret-down.svg'\nimport checked from '@quartzds/generic-icons-core/dist/check.svg'\nimport next from '@quartzds/generic-icons-core/dist/chevron-right.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 dropdown,\n next,\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: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\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: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\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: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\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: © 2024 Schneider Electric\n *\n * SPDX-License-Identifier: Apache-2.0\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: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\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() public readonly name!: string\n\n /**\n * The name of a registered icon library.\n */\n @Prop() 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 if (value !== undefined) 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}
|
package/components/index.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export { Radio as QdsRadio } from '../dist/types/components/radio/radio';
|
|
|
23
23
|
export { defineCustomElement as defineCustomElementQdsRadio } from './qds-radio';
|
|
24
24
|
export { Select as QdsSelect } from '../dist/types/components/select/select';
|
|
25
25
|
export { defineCustomElement as defineCustomElementQdsSelect } from './qds-select';
|
|
26
|
+
export { StandaloneLink as QdsStandaloneLink } from '../dist/types/components/standalone-link/standalone-link';
|
|
27
|
+
export { defineCustomElement as defineCustomElementQdsStandaloneLink } from './qds-standalone-link';
|
|
26
28
|
export { Switch as QdsSwitch } from '../dist/types/components/switch/switch';
|
|
27
29
|
export { defineCustomElement as defineCustomElementQdsSwitch } from './qds-switch';
|
|
28
30
|
export { Table as QdsTable } from '../dist/types/components/table/table';
|
package/components/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SPDX-FileCopyrightText: ©
|
|
2
|
+
* SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
3
3
|
*
|
|
4
|
-
* SPDX-License-Identifier:
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
export { getAssetPath, setAssetPath, setNonce, setPlatformOptions } from '@stencil/core/internal/client';
|
|
7
7
|
export { r as registerIconLibrary, u as unregisterIconLibrary } from './icon.js';
|
|
@@ -17,6 +17,7 @@ export { QdsInput, defineCustomElement as defineCustomElementQdsInput } from './
|
|
|
17
17
|
export { QdsLabel, defineCustomElement as defineCustomElementQdsLabel } from './qds-label.js';
|
|
18
18
|
export { QdsRadio, defineCustomElement as defineCustomElementQdsRadio } from './qds-radio.js';
|
|
19
19
|
export { QdsSelect, defineCustomElement as defineCustomElementQdsSelect } from './qds-select.js';
|
|
20
|
+
export { QdsStandaloneLink, defineCustomElement as defineCustomElementQdsStandaloneLink } from './qds-standalone-link.js';
|
|
20
21
|
export { QdsSwitch, defineCustomElement as defineCustomElementQdsSwitch } from './qds-switch.js';
|
|
21
22
|
export { QdsTable, defineCustomElement as defineCustomElementQdsTable } from './qds-table.js';
|
|
22
23
|
export { QdsTableBody, defineCustomElement as defineCustomElementQdsTableBody } from './qds-table-body.js';
|
|
@@ -28,9 +29,9 @@ export { QdsTextarea, defineCustomElement as defineCustomElementQdsTextarea } fr
|
|
|
28
29
|
export { QdsTitle, defineCustomElement as defineCustomElementQdsTitle } from './qds-title.js';
|
|
29
30
|
export { QdsTooltip, defineCustomElement as defineCustomElementQdsTooltip } from './qds-tooltip.js';
|
|
30
31
|
|
|
31
|
-
// SPDX-FileCopyrightText: ©
|
|
32
|
+
// SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
32
33
|
//
|
|
33
|
-
// SPDX-License-Identifier:
|
|
34
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
34
35
|
const toClassList = (value) => {
|
|
35
36
|
if (value === undefined)
|
|
36
37
|
return document.documentElement.classList;
|
package/components/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"index.js","mappings":"
|
|
1
|
+
{"file":"index.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAEA,MAAM,WAAW,GAAG,CAAC,KAAwB;IAC3C,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,QAAQ,CAAC,eAAe,CAAC,SAAS,CAAA;IAClE,IAAI,OAAO,KAAK,KAAK,QAAQ;QAC3B,OAAO,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,SAAS,IAAI,SAAS,CAAA;IAC9D,OAAO,KAAK,CAAC,SAAS,CAAA;AACxB,CAAC,CAAA;AAED,MAAM,UAAU,GAAG,CACjB,IAAY,EACZ,SAAoC;IAEpC,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAA;IAEhC,MAAM,MAAM,GAAG,OAAO,IAAI,GAAG,CAAA;IAE7B,OAAO,CAAC,GAAG,SAAS,CAAC;SAClB,IAAI,CAAC,CAAC,KAAa,KAAsB,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;UACjE,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;AACzB,CAAC,CAAA;AAED,MAAM,UAAU,GAAG,CACjB,IAAY,EACZ,KAAa,EACb,OAA0B;IAE1B,MAAM,SAAS,GAAG,WAAW,CAAC,OAAO,CAAC,CAAA;IACtC,IAAI,SAAS,KAAK,SAAS;QAAE,OAAM;IAEnC,MAAM,MAAM,GAAG,OAAO,IAAI,GAAG,CAAA;IAE7B,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,CAAA;IAClD,IAAI,cAAc,KAAK,SAAS;QAC9B,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,cAAc,EAAE,CAAC,CAAA;IAChD,SAAS,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,KAAK,EAAE,CAAC,CAAA;AACpC,CAAC,CAAA;AAID;;;;;;;;;;;;;;MAca,WAAW,GAAG,CACzB,OAAyB,KACF,UAAU,CAAC,UAAU,EAAE,WAAW,CAAC,OAAO,CAAC,EAAC;AAErE;;;;;;;;;;;;;;;MAea,WAAW,GAAG,CAKzB,QAAqB,EACrB,OAAyB;IAEzB,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAA;AAC3C,EAAC;AAED;;;;;;;;;;;;;;MAca,QAAQ,GAAG,CACtB,OAAyB,KACF,UAAU,CAAC,OAAO,EAAE,WAAW,CAAC,OAAO,CAAC,EAAC;AAElE;;;;;;;;;;;;;;;MAea,QAAQ,GAAG,CAKtB,KAAkB,EAClB,OAAyB;IAEzB,UAAU,CAAC,OAAO,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AACrC;;;;","names":[],"sources":["src/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\n\nconst toClassList = (value?: Element | string): DOMTokenList | undefined => {\n if (value === undefined) return document.documentElement.classList\n if (typeof value === 'string')\n return document.querySelector(value)?.classList ?? undefined\n return value.classList\n}\n\nconst getVariant = (\n type: string,\n classList?: DOMTokenList | undefined,\n): string | undefined => {\n if (!classList) return undefined\n\n const prefix = `qds-${type}-`\n\n return [...classList]\n .find((value: string): value is string => value.startsWith(prefix))\n ?.replace(prefix, '')\n}\n\nconst setVariant = (\n type: string,\n value: string,\n element?: Element | string,\n): void => {\n const classList = toClassList(element)\n if (classList === undefined) return\n\n const prefix = `qds-${type}-`\n\n const currentVariant = getVariant(type, classList)\n if (currentVariant !== undefined)\n classList.remove(`${prefix}${currentVariant}`)\n classList.add(`${prefix}${value}`)\n}\n\ntype NonEmpty<T extends string = string> = T extends '' ? never : T\n\n/**\n * Get the currently set platform.\n *\n * @param element The element where the platform will be retrieved from. Can be\n * either:\n *\n * - A non-empty CSS selector string\n * - A reference to an\n * [`Element`](https://developer.mozilla.org/docs/Web/API/Element)\n *\n * By default, this is the root node of the current document.\n *\n * @returns The currently set platform if one is set, `undefined` otherwise.\n */\nexport const getPlatform = <S extends string, E extends Element = Element>(\n element?: E | NonEmpty<S>,\n): string | undefined => getVariant('platform', toClassList(element))\n\n/**\n * Sets the current platform.\n *\n * The current platform represented by a `qds-platform-`-prefixed CSS class\n * will be removed.\n *\n * @param platform The platform to set. Must be a non-empty value.\n * @param element The element where the platform will be set. Can be either:\n *\n * - A non-empty CSS selector string\n * - A reference to an\n * [`Element`](https://developer.mozilla.org/docs/Web/API/Element)\n *\n * By default, this is the root node of the current document.\n */\nexport const setPlatform = <\n P extends string,\n S extends string = string,\n E extends Element = Element,\n>(\n platform: NonEmpty<P>,\n element?: E | NonEmpty<S>,\n): void => {\n setVariant('platform', platform, element)\n}\n\n/**\n * Get the currently set theme.\n *\n * @param element The element where the theme will be retrieved from. Can be\n * either:\n *\n * - A non-empty CSS selector string\n * - A reference to an\n * [`Element`](https://developer.mozilla.org/docs/Web/API/Element)\n *\n * By default, this is the root node of the current document.\n *\n * @returns The currently set theme if one is set, `undefined` otherwise.\n */\nexport const getTheme = <S extends string, E extends Element = Element>(\n element?: E | NonEmpty<S>,\n): string | undefined => getVariant('theme', toClassList(element))\n\n/**\n * Sets the current theme.\n *\n * The current theme represented by a `qds-theme-`-prefixed CSS class will be\n * removed.\n *\n * @param theme The theme to set. Must be a non-empty value.\n * @param element The element where the theme will be set. Can be either:\n *\n * - A non-empty CSS selector string\n * - A reference to an\n * [`Element`](https://developer.mozilla.org/docs/Web/API/Element)\n *\n * By default, this is the root node of the current document.\n */\nexport const setTheme = <\n T extends string,\n S extends string = string,\n E extends Element = Element,\n>(\n theme: NonEmpty<T>,\n element?: E | NonEmpty<S>,\n): void => {\n setVariant('theme', theme, element)\n}\n"],"version":3}
|
package/components/label.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SPDX-FileCopyrightText: ©
|
|
2
|
+
* SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
3
3
|
*
|
|
4
|
-
* SPDX-License-Identifier:
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
|
|
7
7
|
import { i as inheritAriaAttributes } from './helpers.js';
|
|
@@ -19,6 +19,18 @@ const Label = /*@__PURE__*/ proxyCustomElement(class Label extends HTMLElement {
|
|
|
19
19
|
this.size = 'standard';
|
|
20
20
|
this.text = undefined;
|
|
21
21
|
}
|
|
22
|
+
get computedSize() {
|
|
23
|
+
switch (this.size) {
|
|
24
|
+
case 'standard':
|
|
25
|
+
case 'small':
|
|
26
|
+
case 'large': {
|
|
27
|
+
return this.size;
|
|
28
|
+
}
|
|
29
|
+
default: {
|
|
30
|
+
return 'standard';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
22
34
|
componentWillLoad() {
|
|
23
35
|
this.inheritedAttributes = inheritAriaAttributes(this.element);
|
|
24
36
|
}
|
|
@@ -26,7 +38,7 @@ const Label = /*@__PURE__*/ proxyCustomElement(class Label extends HTMLElement {
|
|
|
26
38
|
return (h("span", { class: {
|
|
27
39
|
'qds-inline': this.inline,
|
|
28
40
|
'qds-label': true,
|
|
29
|
-
}, "data-size": this.
|
|
41
|
+
}, "data-size": this.computedSize, ...this.inheritedAttributes }, this.required && h("span", { class: "qds-required" }, "*"), this.text));
|
|
30
42
|
}
|
|
31
43
|
get element() { return this; }
|
|
32
44
|
static get style() { return labelCss; }
|
package/components/label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"label.js","mappings":";;;;;;;;AAAA,MAAM,QAAQ,GAAG,uuBAAuuB;;
|
|
1
|
+
{"file":"label.js","mappings":";;;;;;;;AAAA,MAAM,QAAQ,GAAG,uuBAAuuB;;MCqB3uB,KAAK;;;;;QA0BR,wBAAmB,GAAe,EAAE,CAAA;sBAnBF,KAAK;wBAKH,KAAK;oBAKX,UAAU;;;IAWhD,IAAY,YAAY;QACtB,QAAQ,IAAI,CAAC,IAAI;YACf,KAAK,UAAU,CAAC;YAChB,KAAK,OAAO,CAAC;YACb,KAAK,OAAO,EAAE;gBACZ,OAAO,IAAI,CAAC,IAAI,CAAA;aACjB;YACD,SAAS;gBACP,OAAO,UAAU,CAAA;aAClB;SACF;KACF;IAEM,iBAAiB;QACtB,IAAI,CAAC,mBAAmB,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;KAC/D;IAEM,MAAM;QACX,QACE,YACE,KAAK,EAAE;gBACL,YAAY,EAAE,IAAI,CAAC,MAAM;gBACzB,WAAW,EAAE,IAAI;aAClB,eACU,IAAI,CAAC,YAAY,KAExB,IAAI,CAAC,mBAAmB,IAE3B,IAAI,CAAC,QAAQ,IAAI,YAAM,KAAK,EAAC,cAAc,QAAS,EACpD,IAAI,CAAC,IAAI,CACL,EACR;KACF;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/components/label/label.css?tag=qds-label&encapsulation=shadow","src/components/label/label.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2024 Schneider Electric\n *\n * SPDX-License-Identifier: Apache-2.0\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n}\n\n.qds-label {\n box-sizing: border-box;\n color: var(--qds-theme-control-text-standard);\n display: inline-flex;\n gap: var(--qds-text-icon-gap);\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: © 2024 Schneider Electric\n//\n// SPDX-License-Identifier: Apache-2.0\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'\nimport type { Size } from '../shared'\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() public readonly size?: Size = 'standard'\n\n /**\n * The label's text.\n */\n @Prop() public readonly text?: string\n\n @Element() private readonly element!: HTMLQdsLabelElement\n\n private inheritedAttributes: Attributes = {}\n\n private get computedSize(): Size {\n switch (this.size) {\n case 'standard':\n case 'small':\n case 'large': {\n return this.size\n }\n default: {\n return 'standard'\n }\n }\n }\n\n 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.computedSize}\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}
|
package/components/qds-button.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SPDX-FileCopyrightText: ©
|
|
2
|
+
* SPDX-FileCopyrightText: © 2024 Schneider Electric
|
|
3
3
|
*
|
|
4
|
-
* SPDX-License-Identifier:
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
7
7
|
import { p as pickFocusEventAttributes, i as inheritAriaAttributes } from './helpers.js';
|
|
8
8
|
import { d as defineCustomElement$2 } from './icon.js';
|
|
9
9
|
|
|
10
|
-
const buttonCss = ":host([hidden]){display:none !important}:host{display:inline-block}.qds-button{align-items:center;-webkit-appearance:none;appearance:none;background-color:initial;border
|
|
10
|
+
const buttonCss = ":host([hidden]){display:none !important}:host{display:inline-block}.qds-button{align-items:center;-webkit-appearance:none;appearance:none;background-color:initial;border:none;box-sizing:border-box;cursor:pointer;display:inline-flex;justify-content:center;padding-block:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;-webkit-user-select:none;user-select:none;white-space:nowrap;width:100%}.qds-button:any-link{-webkit-text-decoration:none;text-decoration:none}.qds-button:focus-visible{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}[aria-disabled='true']{opacity:var(--qds-theme-disabled);pointer-events:none}[data-size='small']{font:var(--qds-control-small-text)}.qds-button[data-size='small']{gap:var(--qds-control-small-icon-gap);height:var(--qds-control-small-height);padding-inline:var(--qds-control-button-small-padding-horizontal)}.qds-icon-only[data-size='small']{padding-inline:0;width:var(--qds-control-small-height)}.qds-icon[data-size='small']{font-size:var(--qds-control-small-icon-size)}[data-size='standard']{font:var(--qds-control-standard-text)}.qds-button[data-size='standard']{gap:var(--qds-control-standard-icon-gap);height:var(--qds-control-standard-height);padding-inline:var(--qds-control-button-standard-padding-horizontal)}.qds-icon-only[data-size='standard']{padding-inline:0;width:var(--qds-control-standard-height)}.qds-icon[data-size='standard']{font-size:var(--qds-control-standard-icon-size)}[data-size='large']{font:var(--qds-control-large-text)}.qds-button[data-size='large']{gap:var(--qds-control-large-icon-gap);height:var(--qds-control-large-height);padding-inline:var(--qds-control-button-large-padding-horizontal)}.qds-icon-only[data-size='large']{padding-inline:0;width:var(--qds-control-large-height)}.qds-icon[data-size='large']{font-size:var(--qds-control-large-icon-size)}[data-importance='subdued']{color:var(--qds-theme-link-standard-default)}.qds-button[data-importance='subdued']{padding-inline:0}.qds-icon-only[data-importance='subdued']{color:var(--qds-theme-control-text-standard)}[data-importance='subdued']:hover{border-block-end:var(--qds-control-border-width) solid\n var(--qds-theme-link-standard-hover);color:var(--qds-theme-link-standard-hover)}.qds-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-block-end:var(--qds-control-border-width) solid\n var(--qds-theme-link-standard-pressed);color:var(--qds-theme-link-standard-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)}.qds-button[data-importance='standard']{border-radius:var(--qds-control-border-radius)}[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)}.qds-button[data-importance='emphasized']{border-radius:var(--qds-control-border-radius)}[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-variant='destructive']{background-color:var(--qds-theme-feedback-action-destructive-default);color:var(--qds-theme-feedback-action-destructive-contrast)}.qds-button[data-variant='destructive']{border-radius:var(--qds-control-border-radius)}[data-variant='destructive']:hover{background-color:var(--qds-theme-feedback-action-destructive-hover)}[data-variant='destructive']:active{background-color:var(--qds-theme-feedback-action-destructive-pressed)}[data-variant='hero']{font:var(--qds-control-hero-text)}.qds-button[data-variant='hero']{gap:var(--qds-control-hero-icon-gap);height:var(--qds-control-hero-height);border-radius:var(--qds-control-hero-border-radius)}.qds-button[data-variant='hero']:not([data-importance='subdued']){padding-inline:var(--qds-control-button-hero-padding-horizontal)}.qds-icon-only[data-variant='hero']{padding-inline:0;width:var(--qds-control-hero-height)}.qds-icon[data-variant='hero']{font-size:var(--qds-control-hero-icon-size)}";
|
|
11
11
|
|
|
12
12
|
const Button = /*@__PURE__*/ proxyCustomElement(class Button extends HTMLElement {
|
|
13
13
|
constructor() {
|
|
@@ -23,11 +23,13 @@ const Button = /*@__PURE__*/ proxyCustomElement(class Button extends HTMLElement
|
|
|
23
23
|
this.onFocus = (event) => {
|
|
24
24
|
this.focusEmitter.emit(pickFocusEventAttributes(event));
|
|
25
25
|
};
|
|
26
|
+
this.action = undefined;
|
|
26
27
|
this.iconName = undefined;
|
|
27
28
|
this.iconLibrary = 'default';
|
|
28
29
|
this.importance = 'standard';
|
|
29
30
|
this.size = 'standard';
|
|
30
31
|
this.text = undefined;
|
|
32
|
+
this.variant = undefined;
|
|
31
33
|
this.disabled = undefined;
|
|
32
34
|
this.download = undefined;
|
|
33
35
|
this.form = undefined;
|
|
@@ -56,9 +58,47 @@ const Button = /*@__PURE__*/ proxyCustomElement(class Button extends HTMLElement
|
|
|
56
58
|
const hasNoLabel = this.text === undefined || this.text === '';
|
|
57
59
|
return hasIcon && hasNoLabel;
|
|
58
60
|
}
|
|
61
|
+
get computedAction() {
|
|
62
|
+
switch (this.action) {
|
|
63
|
+
case 'dropdown':
|
|
64
|
+
case 'next': {
|
|
65
|
+
return this.action;
|
|
66
|
+
}
|
|
67
|
+
default: {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
59
72
|
get computedDisabled() {
|
|
60
73
|
return this.disabled ?? false;
|
|
61
74
|
}
|
|
75
|
+
get computedImportance() {
|
|
76
|
+
if (this.variant === 'destructive')
|
|
77
|
+
return undefined;
|
|
78
|
+
switch (this.importance) {
|
|
79
|
+
case 'emphasized':
|
|
80
|
+
case 'subdued': {
|
|
81
|
+
return this.importance;
|
|
82
|
+
}
|
|
83
|
+
default: {
|
|
84
|
+
return 'standard';
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
get computedSize() {
|
|
89
|
+
if (this.variant === 'hero')
|
|
90
|
+
return undefined;
|
|
91
|
+
switch (this.size) {
|
|
92
|
+
case 'standard':
|
|
93
|
+
case 'small':
|
|
94
|
+
case 'large': {
|
|
95
|
+
return this.size;
|
|
96
|
+
}
|
|
97
|
+
default: {
|
|
98
|
+
return 'standard';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
62
102
|
get computedTabIndex() {
|
|
63
103
|
const parsedValue = Number.parseInt(this.inheritedAttributes.tabindex ?? '0', 10);
|
|
64
104
|
return Number.isNaN(parsedValue) ? 0 : parsedValue;
|
|
@@ -96,18 +136,20 @@ const Button = /*@__PURE__*/ proxyCustomElement(class Button extends HTMLElement
|
|
|
96
136
|
return (h(Tag, { "aria-disabled": this.computedDisabled.toString(), class: {
|
|
97
137
|
'qds-button': true,
|
|
98
138
|
'qds-icon-only': this.iconOnly,
|
|
99
|
-
}, "data-importance": this.
|
|
139
|
+
}, "data-importance": this.computedImportance, "data-size": this.computedSize, "data-variant": this.variant, disabled: Tag === 'a' ? undefined : this.disabled, download: Tag === 'a' ? this.download : undefined, href: Tag === 'a' ? this.href : undefined, name: Tag === 'a' ? undefined : this.name, onBlur: this.onBlur, onFocus: this.onFocus, rel: Tag === 'a' ? 'noreferrer noopener' : undefined, role: Tag === 'a' ? 'button' : undefined, tabIndex: this.computedDisabled ? -1 : this.computedTabIndex, target: Tag === 'a' ? this.target : undefined, type: Tag === 'a' ? undefined : this.buttonType, value: Tag === 'a' ? undefined : this.value, ...this.inheritedAttributes }, this.iconName !== undefined && this.iconName !== '' && (h("qds-icon", { class: "qds-icon", "data-size": this.computedSize, "data-variant": this.variant, library: this.iconLibrary, name: this.iconName })), this.text, this.computedAction !== undefined && (h("qds-icon", { class: "qds-icon", library: "core", name: this.computedAction }))));
|
|
100
140
|
}
|
|
101
141
|
static get delegatesFocus() { return true; }
|
|
102
142
|
get element() { return this; }
|
|
103
143
|
static get style() { return buttonCss; }
|
|
104
144
|
}, [17, "qds-button", {
|
|
145
|
+
"action": [1],
|
|
105
146
|
"iconName": [1, "icon-name"],
|
|
106
147
|
"iconLibrary": [1, "icon-library"],
|
|
107
148
|
"importance": [1],
|
|
108
149
|
"size": [1],
|
|
109
|
-
"text": [
|
|
110
|
-
"
|
|
150
|
+
"text": [1],
|
|
151
|
+
"variant": [1],
|
|
152
|
+
"disabled": [4],
|
|
111
153
|
"download": [1],
|
|
112
154
|
"form": [1],
|
|
113
155
|
"formAction": [1, "formaction"],
|