@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,196 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: © 2023 Schneider Electric
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: LGPL-2.1-only
|
|
5
|
+
*/
|
|
6
|
+
import { r as registerInstance, c as createEvent, h, a as getElement } from './index-1bc8e218.js';
|
|
7
|
+
import { p as pickFocusEventAttributes, a as invariant, e as pick, i as inheritAriaAttributes, b as inheritAttributes } from './helpers-5c189a19.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 = class {
|
|
13
|
+
constructor(hostRef) {
|
|
14
|
+
registerInstance(this, hostRef);
|
|
15
|
+
this.blurEmitter = createEvent(this, "qdsBlur", 2);
|
|
16
|
+
this.changeEmitter = createEvent(this, "qdsChange", 6);
|
|
17
|
+
this.focusEmitter = createEvent(this, "qdsFocus", 2);
|
|
18
|
+
this.inputEmitter = createEvent(this, "qdsInput", 6);
|
|
19
|
+
this.inheritedAttributes = {};
|
|
20
|
+
this.ref = (input) => {
|
|
21
|
+
this.input = input;
|
|
22
|
+
};
|
|
23
|
+
this.onBlur = (event) => {
|
|
24
|
+
this.blurEmitter.emit(pickFocusEventAttributes(event));
|
|
25
|
+
};
|
|
26
|
+
this.onChange = () => {
|
|
27
|
+
invariant(this.input);
|
|
28
|
+
this.value = this.input.value;
|
|
29
|
+
this.changeEmitter.emit();
|
|
30
|
+
};
|
|
31
|
+
this.onClick = (event) => {
|
|
32
|
+
if (this.computedDisabled) {
|
|
33
|
+
event.preventDefault();
|
|
34
|
+
event.stopPropagation();
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
this.onFocus = (event) => {
|
|
38
|
+
this.focusEmitter.emit(pickFocusEventAttributes(event));
|
|
39
|
+
};
|
|
40
|
+
this.onInput = (event) => {
|
|
41
|
+
invariant(this.input);
|
|
42
|
+
this.value = this.input.value;
|
|
43
|
+
this.inputEmitter.emit(pick(event, 'data', 'inputType', 'isComposing'));
|
|
44
|
+
};
|
|
45
|
+
this.onInvalid = () => {
|
|
46
|
+
this.invalid = true;
|
|
47
|
+
};
|
|
48
|
+
this.invalid = undefined;
|
|
49
|
+
this.size = 'standard';
|
|
50
|
+
this.autoCapitalize = undefined;
|
|
51
|
+
this.autoComplete = undefined;
|
|
52
|
+
this.autoFocus = undefined;
|
|
53
|
+
this.disabled = undefined;
|
|
54
|
+
this.enterkeyhint = undefined;
|
|
55
|
+
this.form = undefined;
|
|
56
|
+
this.inputmode = undefined;
|
|
57
|
+
this.max = undefined;
|
|
58
|
+
this.maxLength = undefined;
|
|
59
|
+
this.min = undefined;
|
|
60
|
+
this.minLength = undefined;
|
|
61
|
+
this.multiple = undefined;
|
|
62
|
+
this.name = `qds-input-${autoIncrementingId}`;
|
|
63
|
+
this.pattern = undefined;
|
|
64
|
+
this.placeholder = undefined;
|
|
65
|
+
this.readOnly = undefined;
|
|
66
|
+
this.required = undefined;
|
|
67
|
+
this.spellCheck = undefined;
|
|
68
|
+
this.step = undefined;
|
|
69
|
+
this.type = undefined;
|
|
70
|
+
this.value = undefined;
|
|
71
|
+
}
|
|
72
|
+
get computedDisabled() {
|
|
73
|
+
return this.disabled ?? false;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Returns true if the element's value passes validity checks; otherwise,
|
|
77
|
+
* returns false, fires an invalid event at the element, and (if the event
|
|
78
|
+
* isn't canceled) reports the problem to the user.
|
|
79
|
+
*/
|
|
80
|
+
async reportValidity() {
|
|
81
|
+
invariant(this.input);
|
|
82
|
+
return this.input.reportValidity();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Selects the entire content of the `<qds-input>` element if the element's
|
|
86
|
+
* content is selectable.
|
|
87
|
+
*/
|
|
88
|
+
async select() {
|
|
89
|
+
invariant(this.input);
|
|
90
|
+
this.input.select();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Sets a custom validity message for the input. If this message is not the
|
|
94
|
+
* empty string, then the element is considered invalid.
|
|
95
|
+
*/
|
|
96
|
+
async setCustomValidity(message) {
|
|
97
|
+
invariant(this.input);
|
|
98
|
+
this.input.setCustomValidity(message);
|
|
99
|
+
this.invalid = !this.input.checkValidity();
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Sets the contents of the specified range of characters in the input element to a given string.
|
|
103
|
+
*
|
|
104
|
+
* @param replacement The string to insert.
|
|
105
|
+
* @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).
|
|
106
|
+
* @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).
|
|
107
|
+
* @param selectionMode A string defining how the selection should be set after the text has been replaced. Possible values:
|
|
108
|
+
*
|
|
109
|
+
* - `"select"` selects the newly inserted text.
|
|
110
|
+
* - `"start"` moves the selection to just before the inserted text.
|
|
111
|
+
* - `"end"` moves the selection to just after the inserted text.
|
|
112
|
+
* - `"preserve"` attempts to preserve the selection.
|
|
113
|
+
*/
|
|
114
|
+
async setRangeText(replacement, start, end, selectionMode = 'preserve') {
|
|
115
|
+
invariant(this.input);
|
|
116
|
+
this.input.setRangeText(replacement, start, end, selectionMode);
|
|
117
|
+
if (this.value !== this.input.value) {
|
|
118
|
+
this.value = this.input.value;
|
|
119
|
+
this.inputEmitter.emit();
|
|
120
|
+
this.changeEmitter.emit();
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Selects the specified range of characters within the input.
|
|
125
|
+
*
|
|
126
|
+
* @param start The offset into the input for the start of the selection.
|
|
127
|
+
* @param end The offset into the input for the end of the selection.
|
|
128
|
+
* @param direction The direction in which the selection is performed.
|
|
129
|
+
*/
|
|
130
|
+
async setSelectionRange(start, end, direction) {
|
|
131
|
+
invariant(this.input);
|
|
132
|
+
this.input.setSelectionRange(start, end, direction);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Decrements the `value` by (`step` * n), where n defaults to 1 if not
|
|
136
|
+
* specified.
|
|
137
|
+
*
|
|
138
|
+
* @param n Amount to decrement the value by.
|
|
139
|
+
*/
|
|
140
|
+
async stepDown(n) {
|
|
141
|
+
invariant(this.input);
|
|
142
|
+
this.input.stepDown(n);
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Increments the `value` by (`step` * n), where n defaults to 1 if not
|
|
146
|
+
* specified.
|
|
147
|
+
*
|
|
148
|
+
* @param n Amount to increment the value by.
|
|
149
|
+
*/
|
|
150
|
+
async stepUp(n) {
|
|
151
|
+
invariant(this.input);
|
|
152
|
+
this.input.stepUp(n);
|
|
153
|
+
}
|
|
154
|
+
disabledChanged() {
|
|
155
|
+
invariant(this.input);
|
|
156
|
+
// Disabled inputs are always valid, so we need to recheck validity when
|
|
157
|
+
// the state changes.
|
|
158
|
+
this.input.disabled = this.computedDisabled;
|
|
159
|
+
this.invalid = !this.input.checkValidity();
|
|
160
|
+
}
|
|
161
|
+
stepChanged() {
|
|
162
|
+
invariant(this.input);
|
|
163
|
+
// If step changes, the value may become invalid so we need to recheck
|
|
164
|
+
// after the update. We set the new step imperatively so we don't have to
|
|
165
|
+
// wait for the next render to report the updated validity.
|
|
166
|
+
this.input.step = String(this.step);
|
|
167
|
+
this.invalid = !this.input.checkValidity();
|
|
168
|
+
}
|
|
169
|
+
valueChanged() {
|
|
170
|
+
invariant(this.input);
|
|
171
|
+
this.invalid = !this.input.checkValidity();
|
|
172
|
+
}
|
|
173
|
+
componentWillLoad() {
|
|
174
|
+
autoIncrementingId += 1;
|
|
175
|
+
this.inheritedAttributes = {
|
|
176
|
+
...inheritAriaAttributes(this.element),
|
|
177
|
+
...inheritAttributes(this.element, ['tabindex']),
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
render() {
|
|
181
|
+
return (h("input", { "aria-invalid": this.invalid ?? false ? 'true' : 'false', autoCapitalize: this.autoCapitalize, autoComplete: this.autoComplete,
|
|
182
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
183
|
+
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 }));
|
|
184
|
+
}
|
|
185
|
+
get element() { return getElement(this); }
|
|
186
|
+
static get watchers() { return {
|
|
187
|
+
"disabled": ["disabledChanged"],
|
|
188
|
+
"step": ["stepChanged"],
|
|
189
|
+
"value": ["valueChanged"]
|
|
190
|
+
}; }
|
|
191
|
+
};
|
|
192
|
+
Input.style = inputCss;
|
|
193
|
+
|
|
194
|
+
export { Input as qds_input };
|
|
195
|
+
|
|
196
|
+
//# sourceMappingURL=qds-input.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"qds-input.entry.js","mappings":"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","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,35 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: © 2023 Schneider Electric
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: LGPL-2.1-only
|
|
5
|
+
*/
|
|
6
|
+
import { r as registerInstance, h, a as getElement } from './index-1bc8e218.js';
|
|
7
|
+
import { i as inheritAriaAttributes } from './helpers-5c189a19.js';
|
|
8
|
+
|
|
9
|
+
const labelCss = ":host{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{display:inline-block}.label{color:var(--qds-theme-control-text-standard);display:inline-block}.required{color:var(--qds-theme-feedback-field-required);-webkit-user-select:none;user-select:none}[data-size='small']{font:var(--qds-control-small-text)}.inline[data-size='small']{margin-block:var(--qds-control-small-padding-auto-height)}[data-size='standard']{font:var(--qds-control-standard-text)}.inline[data-size='standard']{margin-block:var(--qds-control-standard-padding-auto-height)}[data-size='large']{font:var(--qds-control-large-text)}.inline[data-size='large']{margin-block:var(--qds-control-large-padding-auto-height)}";
|
|
10
|
+
|
|
11
|
+
const Label = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
registerInstance(this, hostRef);
|
|
14
|
+
this.inheritedAttributes = {};
|
|
15
|
+
this.inline = false;
|
|
16
|
+
this.required = false;
|
|
17
|
+
this.size = 'standard';
|
|
18
|
+
this.text = undefined;
|
|
19
|
+
}
|
|
20
|
+
componentWillLoad() {
|
|
21
|
+
this.inheritedAttributes = inheritAriaAttributes(this.element);
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
return (h("span", { class: {
|
|
25
|
+
inline: this.inline,
|
|
26
|
+
label: true,
|
|
27
|
+
}, "data-size": this.size, ...this.inheritedAttributes }, this.required && h("span", { class: "required" }, "*"), this.text));
|
|
28
|
+
}
|
|
29
|
+
get element() { return getElement(this); }
|
|
30
|
+
};
|
|
31
|
+
Label.style = labelCss;
|
|
32
|
+
|
|
33
|
+
export { Label as qds_label };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=qds-label.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"qds-label.entry.js","mappings":";;;;;;;;AAAA,MAAM,QAAQ,GAAG,wwBAAwwB;;MCsB5wB,KAAK;;;IA0BR,wBAAmB,GAAe,EAAE,CAAA;kBAnBF,KAAK;oBAKH,KAAK;gBAKU,UAAU;;;EAW9D,iBAAiB;IACtB,IAAI,CAAC,mBAAmB,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;GAC/D;EAEM,MAAM;IACX,QACE,YACE,KAAK,EAAE;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,IAAI;OACZ,eACU,IAAI,CAAC,IAAI,KAEhB,IAAI,CAAC,mBAAmB,IAE3B,IAAI,CAAC,QAAQ,IAAI,YAAM,KAAK,EAAC,UAAU,QAAS,EAChD,IAAI,CAAC,IAAI,CACL,EACR;GACF;;;;;;;","names":[],"sources":["./src/components/label/label.css?tag=qds-label&encapsulation=shadow","./src/components/label/label.tsx"],"sourcesContent":["/*\n * SPDX-FileCopyrightText: © 2023 Schneider Electric\n *\n * SPDX-License-Identifier: LGPL-2.1-only\n */\n\n@import url('../shared.css');\n\n:host {\n display: inline-block;\n}\n\n.label {\n color: var(--qds-theme-control-text-standard);\n display: inline-block;\n}\n\n.required {\n color: var(--qds-theme-feedback-field-required);\n user-select: none;\n}\n\n[data-size='small'] {\n font: var(--qds-control-small-text);\n\n &.inline {\n margin-block: var(--qds-control-small-padding-auto-height);\n }\n}\n\n[data-size='standard'] {\n font: var(--qds-control-standard-text);\n\n &.inline {\n margin-block: var(--qds-control-standard-padding-auto-height);\n }\n}\n\n[data-size='large'] {\n font: var(--qds-control-large-text);\n\n &.inline {\n margin-block: var(--qds-control-large-padding-auto-height);\n }\n}\n","// SPDX-FileCopyrightText: © 2023 Schneider Electric\n//\n// SPDX-License-Identifier: LGPL-2.1-only\n\nimport type { ComponentInterface } from '@stencil/core'\nimport { Component, Element, h, Prop } from '@stencil/core'\n\nimport type { Attributes } from '../../helpers'\nimport { inheritAriaAttributes } from '../../helpers'\n\nexport type LabelSize = 'large' | 'small' | 'standard'\n\n/**\n * `<qds-label>` elements represent a caption for an item in a user interface.\n *\n * @see https://quartz.se.com/build/components/label\n */\n@Component({\n tag: 'qds-label',\n shadow: true,\n styleUrl: 'label.css',\n})\nexport class Label implements ComponentInterface {\n /**\n * Adds vertical margin to the label for alignment.\n *\n * This is useful when creating inline layouts so that the first lines have\n * the correct vertical centering.\n */\n @Prop() public readonly inline: boolean = false\n\n /**\n * Specify the labelled item as required by appending a red asterisk (*).\n */\n @Prop() public readonly required: boolean = false\n\n /**\n * The label's size.\n */\n @Prop({ reflect: true }) public readonly size: LabelSize = 'standard'\n\n /**\n * The label's text.\n */\n @Prop({ reflect: true }) public readonly text?: string\n\n @Element() private readonly element!: HTMLQdsLabelElement\n\n private inheritedAttributes: Attributes = {}\n\n public componentWillLoad(): void {\n this.inheritedAttributes = inheritAriaAttributes(this.element)\n }\n\n public render() {\n return (\n <span\n class={{\n inline: this.inline,\n label: true,\n }}\n data-size={this.size}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n >\n {this.required && <span class=\"required\">*</span>}\n {this.text}\n </span>\n )\n }\n}\n"],"version":3}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: © 2023 Schneider Electric
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: LGPL-2.1-only
|
|
5
|
+
*/
|
|
6
|
+
import { r as registerInstance, c as createEvent, h, a as getElement } from './index-1bc8e218.js';
|
|
7
|
+
import { p as pickFocusEventAttributes, a as invariant, i as inheritAriaAttributes, b as inheritAttributes } from './helpers-5c189a19.js';
|
|
8
|
+
|
|
9
|
+
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)}";
|
|
10
|
+
|
|
11
|
+
const Radio = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
registerInstance(this, hostRef);
|
|
14
|
+
this.blurEmitter = createEvent(this, "qdsBlur", 2);
|
|
15
|
+
this.changeEmitter = createEvent(this, "qdsChange", 6);
|
|
16
|
+
this.focusEmitter = createEvent(this, "qdsFocus", 2);
|
|
17
|
+
this.inheritedAttributes = {};
|
|
18
|
+
this.ref = (input) => {
|
|
19
|
+
this.input = input;
|
|
20
|
+
};
|
|
21
|
+
this.onBlur = (event) => {
|
|
22
|
+
this.blurEmitter.emit(pickFocusEventAttributes(event));
|
|
23
|
+
};
|
|
24
|
+
this.onChange = () => {
|
|
25
|
+
this.changeEmitter.emit();
|
|
26
|
+
};
|
|
27
|
+
this.onFocus = (event) => {
|
|
28
|
+
this.focusEmitter.emit(pickFocusEventAttributes(event));
|
|
29
|
+
};
|
|
30
|
+
this.inline = false;
|
|
31
|
+
this.size = 'standard';
|
|
32
|
+
this.text = undefined;
|
|
33
|
+
this.checked = undefined;
|
|
34
|
+
this.disabled = undefined;
|
|
35
|
+
this.form = undefined;
|
|
36
|
+
this.name = undefined;
|
|
37
|
+
this.required = undefined;
|
|
38
|
+
this.value = undefined;
|
|
39
|
+
}
|
|
40
|
+
get computedDisabled() {
|
|
41
|
+
return this.disabled ?? false;
|
|
42
|
+
}
|
|
43
|
+
get hasText() {
|
|
44
|
+
return this.text !== undefined && this.text !== '';
|
|
45
|
+
}
|
|
46
|
+
onClick() {
|
|
47
|
+
invariant(this.input);
|
|
48
|
+
this.checked = this.input.checked;
|
|
49
|
+
}
|
|
50
|
+
componentWillLoad() {
|
|
51
|
+
this.inheritedAttributes = {
|
|
52
|
+
...inheritAriaAttributes(this.element),
|
|
53
|
+
...inheritAttributes(this.element, ['tabindex']),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
render() {
|
|
57
|
+
return (
|
|
58
|
+
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
59
|
+
h("label", { "aria-disabled": this.computedDisabled ? 'true' : 'false', class: {
|
|
60
|
+
inline: this.inline,
|
|
61
|
+
label: true,
|
|
62
|
+
}, "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 })));
|
|
63
|
+
}
|
|
64
|
+
get element() { return getElement(this); }
|
|
65
|
+
};
|
|
66
|
+
Radio.style = radioCss;
|
|
67
|
+
|
|
68
|
+
export { Radio as qds_radio };
|
|
69
|
+
|
|
70
|
+
//# sourceMappingURL=qds-radio.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"qds-radio.entry.js","mappings":";;;;;;;;AAAA,MAAM,QAAQ,GAAG,q0FAAq0F;;MCiCz0F,KAAK;;;;;;IAoGR,wBAAmB,GAAe,EAAE,CAAA;IAkE3B,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,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,CAAA;KAC1B,CAAA;IAEgB,YAAO,GAAG,CAAC,KAAiB;MAC3C,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAAC,CAAA;KACxD,CAAA;kBA7KyC,KAAK;gBAKY,UAAU;;;;;;;;;EA4FrE,IAAY,gBAAgB;IAC1B,OAAO,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAA;GAC9B;EAED,IAAY,OAAO;IACjB,OAAO,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,IAAI,KAAK,EAAE,CAAA;GACnD;EAGS,OAAO;IACf,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAErB,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAA;GAClC;EAEM,iBAAiB;IACtB,IAAI,CAAC,mBAAmB,GAAG;MACzB,GAAG,qBAAqB,CAAC,IAAI,CAAC,OAAO,CAAC;MACtC,GAAG,iBAAiB,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,UAAU,CAAC,CAAC;KACjD,CAAA;GACF;EAEM,MAAM;IACX;;IAEE,8BACiB,IAAI,CAAC,gBAAgB,GAAG,MAAM,GAAG,OAAO,EACvD,KAAK,EAAE;QACL,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,KAAK,EAAE,IAAI;OACZ,eACU,IAAI,CAAC,IAAI,IAEpB,aACE,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,KAAK,EAAC,OAAO,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,75 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: © 2023 Schneider Electric
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: LGPL-2.1-only
|
|
5
|
+
*/
|
|
6
|
+
import { r as registerInstance, c as createEvent, h, a as getElement } from './index-1bc8e218.js';
|
|
7
|
+
import { p as pickFocusEventAttributes, i as inheritAriaAttributes, b as inheritAttributes } from './helpers-5c189a19.js';
|
|
8
|
+
|
|
9
|
+
const switchCss = ".sc-qds-switch-h{box-sizing:border-box}[hidden].sc-qds-switch-h{display:none !important}.sc-qds-switch-h *.sc-qds-switch,.sc-qds-switch-h *.sc-qds-switch::before,.sc-qds-switch-h *.sc-qds-switch::after{box-sizing:inherit}.sc-qds-switch-h{display:inline-block}.track.sc-qds-switch,.knob.sc-qds-switch{-webkit-print-color-adjust:exact;print-color-adjust:exact}.unchecked-text.sc-qds-switch{text-align:end}.icon.sc-qds-switch{color:var(--qds-theme-control-text-standard);flex-shrink:0}.track.sc-qds-switch{align-items:center;border-radius:var(--qds-control-rounded-border-radius);display:flex;flex-shrink:0;-webkit-print-color-adjust:exact;print-color-adjust:exact;background-color:var(--qds-theme-control-slider-track-inactive)}.knob.sc-qds-switch{background-color:var(--qds-theme-accessory-background);border-radius:var(--qds-control-rounded-border-radius);border:var(--qds-control-border-width) solid var(--qds-theme-control-border);box-shadow:var(--qds-theme-accessory-elevation);box-sizing:content-box}.label.sc-qds-switch{cursor:pointer;display:flex}.switch.sc-qds-switch{-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:0;position:absolute;white-space:nowrap;width:1px}.switch.sc-qds-switch:hover~.track.sc-qds-switch>.knob.sc-qds-switch{background-color:var(--qds-theme-interactive-background-hover)}.switch.sc-qds-switch:active~.track.sc-qds-switch>.knob.sc-qds-switch{background-color:var(--qds-theme-interactive-background-pressed)}.switch.sc-qds-switch:checked~.track.sc-qds-switch{justify-content:flex-end;background-color:var(--qds-theme-signature-color-default)}.switch.sc-qds-switch:checked~.track.sc-qds-switch>.knob.sc-qds-switch{border-color:transparent;box-sizing:border-box;-webkit-margin-end:var(--qds-control-border-width);margin-inline-end:var(--qds-control-border-width)}.switch.sc-qds-switch:checked:hover~.track.sc-qds-switch>.knob.sc-qds-switch{background-color:var(--qds-theme-interactive-background-hover)}.switch.sc-qds-switch:checked:active~.track.sc-qds-switch>.knob.sc-qds-switch{background-color:var(--qds-theme-interactive-background-pressed)}.switch.sc-qds-switch:focus-visible~.track.sc-qds-switch{outline:var(--qds-theme-focus-border) solid var(--qds-focus-border-width);outline-offset:var(--qds-focus-border-offset)}[aria-disabled='true'].sc-qds-switch{opacity:var(--qds-theme-disabled);pointer-events:none}.icon[data-size='small'].sc-qds-switch{height:var(--qds-control-small-icon-size);width:var(--qds-control-small-icon-size)}.inline[data-size='small'].sc-qds-switch{margin-block:var(--qds-control-small-padding-auto-height)}.label[data-size='small'].sc-qds-switch{gap:var(--qds-control-small-gap-siblings-related)}.track[data-size='small'].sc-qds-switch{width:calc(var(--qds-control-slider-knob-small-size) * 2);height:var(--qds-control-toggle-box-small-size)}.knob[data-size='small'].sc-qds-switch{height:var(--qds-control-slider-knob-small-size);width:var(--qds-control-slider-knob-small-size)}.icon[data-size='standard'].sc-qds-switch{height:var(--qds-control-standard-icon-size);width:var(--qds-control-standard-icon-size)}.inline[data-size='standard'].sc-qds-switch{margin-block:var(--qds-control-standard-padding-auto-height)}.label[data-size='standard'].sc-qds-switch{gap:var(--qds-control-standard-gap-siblings-related)}.track[data-size='standard'].sc-qds-switch{width:calc(var(--qds-control-slider-knob-standard-size) * 2);height:var(--qds-control-toggle-box-standard-size)}.knob[data-size='standard'].sc-qds-switch{height:var(--qds-control-slider-knob-standard-size);width:var(--qds-control-slider-knob-standard-size)}.icon[data-size='large'].sc-qds-switch{height:var(--qds-control-large-icon-size);width:var(--qds-control-large-icon-size)}.inline[data-size='large'].sc-qds-switch{margin-block:var(--qds-control-large-padding-auto-height)}.label[data-size='large'].sc-qds-switch{gap:var(--qds-control-large-gap-siblings-related)}.track[data-size='large'].sc-qds-switch{width:calc(var(--qds-control-slider-knob-large-size) * 2);height:var(--qds-control-toggle-box-large-size)}.knob[data-size='large'].sc-qds-switch{height:var(--qds-control-slider-knob-large-size);width:var(--qds-control-slider-knob-large-size)}";
|
|
10
|
+
|
|
11
|
+
let autoIncrementingId = 1;
|
|
12
|
+
const Switch = class {
|
|
13
|
+
constructor(hostRef) {
|
|
14
|
+
registerInstance(this, hostRef);
|
|
15
|
+
this.blurEmitter = createEvent(this, "qdsBlur", 2);
|
|
16
|
+
this.changeEmitter = createEvent(this, "qdsChange", 6);
|
|
17
|
+
this.focusEmitter = createEvent(this, "qdsFocus", 2);
|
|
18
|
+
this.inheritedAttributes = {};
|
|
19
|
+
this.onBlur = (event) => {
|
|
20
|
+
this.blurEmitter.emit(pickFocusEventAttributes(event));
|
|
21
|
+
};
|
|
22
|
+
this.onFocus = (event) => {
|
|
23
|
+
this.focusEmitter.emit(pickFocusEventAttributes(event));
|
|
24
|
+
};
|
|
25
|
+
this.inline = false;
|
|
26
|
+
this.iconCheckedName = undefined;
|
|
27
|
+
this.iconCheckedLibrary = 'default';
|
|
28
|
+
this.iconUncheckedName = undefined;
|
|
29
|
+
this.iconUncheckedLibrary = 'default';
|
|
30
|
+
this.size = 'standard';
|
|
31
|
+
this.textChecked = undefined;
|
|
32
|
+
this.textUnchecked = undefined;
|
|
33
|
+
this.autoFocus = undefined;
|
|
34
|
+
this.checked = undefined;
|
|
35
|
+
this.disabled = undefined;
|
|
36
|
+
this.form = undefined;
|
|
37
|
+
this.name = `qds-switch-${autoIncrementingId}`;
|
|
38
|
+
this.value = undefined;
|
|
39
|
+
}
|
|
40
|
+
get computedDisabled() {
|
|
41
|
+
return this.disabled ?? false;
|
|
42
|
+
}
|
|
43
|
+
onClick(event) {
|
|
44
|
+
if (this.computedDisabled)
|
|
45
|
+
return;
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
this.checked = !(this.checked ?? false);
|
|
48
|
+
this.changeEmitter.emit();
|
|
49
|
+
}
|
|
50
|
+
componentWillLoad() {
|
|
51
|
+
autoIncrementingId += 1;
|
|
52
|
+
this.inheritedAttributes = {
|
|
53
|
+
...inheritAriaAttributes(this.element),
|
|
54
|
+
...inheritAttributes(this.element, ['tabindex']),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
render() {
|
|
58
|
+
return (
|
|
59
|
+
// eslint-disable-next-line jsx-a11y/label-has-associated-control
|
|
60
|
+
h("label", { "aria-disabled": this.computedDisabled ? 'true' : 'false', class: {
|
|
61
|
+
inline: this.inline,
|
|
62
|
+
label: true,
|
|
63
|
+
}, "data-size": this.size }, this.textUnchecked !== undefined && this.textUnchecked !== '' && (h("qds-label", { class: "unchecked-text", size: this.size, text: this.textUnchecked })), this.iconUncheckedName !== undefined &&
|
|
64
|
+
this.iconUncheckedName !== '' && (h("qds-icon", { class: "icon", "data-size": this.size, library: this.iconUncheckedLibrary, name: this.iconUncheckedName })), h("input", {
|
|
65
|
+
// eslint-disable-next-line jsx-a11y/no-autofocus
|
|
66
|
+
autoFocus: this.autoFocus, checked: this.checked, class: "switch", disabled: this.disabled, form: this.form, name: this.name, onBlur: this.onBlur, onFocus: this.onFocus, type: "checkbox", value: this.value ?? undefined, ...this.inheritedAttributes
|
|
67
|
+
}), h("div", { class: "track", "data-size": this.size }, h("div", { class: "knob", "data-size": this.size })), this.iconCheckedName !== undefined && this.iconCheckedName !== '' && (h("qds-icon", { class: "icon", "data-size": this.size, library: this.iconCheckedLibrary, name: this.iconCheckedName })), this.textChecked !== undefined && this.textChecked !== '' && (h("qds-label", { size: this.size, text: this.textChecked }))));
|
|
68
|
+
}
|
|
69
|
+
get element() { return getElement(this); }
|
|
70
|
+
};
|
|
71
|
+
Switch.style = switchCss;
|
|
72
|
+
|
|
73
|
+
export { Switch as qds_switch };
|
|
74
|
+
|
|
75
|
+
//# sourceMappingURL=qds-switch.entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"qds-switch.entry.js","mappings":"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","names":[],"sources":["./src/components/switch/switch.css?tag=qds-switch&encapsulation=scoped","./src/components/switch/switch.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.track,\n.knob {\n print-color-adjust: exact;\n}\n\n.unchecked-text {\n text-align: end;\n}\n\n.icon {\n color: var(--qds-theme-control-text-standard);\n flex-shrink: 0;\n}\n\n.track {\n align-items: center;\n border-radius: var(--qds-control-rounded-border-radius);\n display: flex;\n flex-shrink: 0;\n print-color-adjust: exact;\n background-color: var(--qds-theme-control-slider-track-inactive);\n}\n\n.knob {\n background-color: var(--qds-theme-accessory-background);\n border-radius: var(--qds-control-rounded-border-radius);\n border: var(--qds-control-border-width) solid var(--qds-theme-control-border);\n box-shadow: var(--qds-theme-accessory-elevation);\n box-sizing: content-box;\n}\n\n.label {\n cursor: pointer;\n display: flex;\n}\n\n.switch {\n clip-path: inset(50%);\n height: 1px;\n margin: 0;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n\n &:hover ~ .track > .knob {\n background-color: var(--qds-theme-interactive-background-hover);\n }\n\n &:active ~ .track > .knob {\n background-color: var(--qds-theme-interactive-background-pressed);\n }\n\n &:checked {\n & ~ .track {\n justify-content: flex-end;\n background-color: var(--qds-theme-signature-color-default);\n\n & > .knob {\n border-color: transparent;\n box-sizing: border-box;\n margin-inline-end: var(--qds-control-border-width);\n }\n }\n\n &:hover ~ .track > .knob {\n background-color: var(--qds-theme-interactive-background-hover);\n }\n\n &:active ~ .track > .knob {\n background-color: var(--qds-theme-interactive-background-pressed);\n }\n }\n\n &:focus-visible ~ .track {\n outline: var(--qds-theme-focus-border) solid var(--qds-focus-border-width);\n outline-offset: var(--qds-focus-border-offset);\n }\n}\n\n[aria-disabled='true'] {\n opacity: var(--qds-theme-disabled);\n pointer-events: none;\n}\n\n[data-size='small'] {\n &.icon {\n height: var(--qds-control-small-icon-size);\n width: 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 &.track {\n width: calc(var(--qds-control-slider-knob-small-size) * 2);\n height: var(--qds-control-toggle-box-small-size);\n }\n\n &.knob {\n height: var(--qds-control-slider-knob-small-size);\n width: var(--qds-control-slider-knob-small-size);\n }\n}\n\n[data-size='standard'] {\n &.icon {\n height: var(--qds-control-standard-icon-size);\n width: 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 &.track {\n width: calc(var(--qds-control-slider-knob-standard-size) * 2);\n height: var(--qds-control-toggle-box-standard-size);\n }\n\n &.knob {\n height: var(--qds-control-slider-knob-standard-size);\n width: var(--qds-control-slider-knob-standard-size);\n }\n}\n\n[data-size='large'] {\n &.icon {\n height: var(--qds-control-large-icon-size);\n width: 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 &.track {\n width: calc(var(--qds-control-slider-knob-large-size) * 2);\n height: var(--qds-control-toggle-box-large-size);\n }\n\n &.knob {\n height: var(--qds-control-slider-knob-large-size);\n width: var(--qds-control-slider-knob-large-size);\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 pickFocusEventAttributes,\n} from '../../helpers'\n\nexport type SwitchValue = number | string | null\nexport type SwitchSize = 'large' | 'small' | 'standard'\n\nlet autoIncrementingId = 1\n\n/**\n * @see https://quartz.se.com/build/components/switch\n */\n@Component({\n tag: 'qds-switch',\n scoped: true,\n styleUrl: 'switch.css',\n})\nexport class Switch implements ComponentInterface {\n /**\n * Adds vertical margin to the switch 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 name of the checked icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop({ reflect: true }) public readonly iconCheckedName?: string\n\n /**\n * The name of a registered checked icon library.\n */\n @Prop({ reflect: true }) public readonly iconCheckedLibrary: string =\n 'default'\n\n /**\n * The name of the unchecked icon to render.\n *\n * Available names depend on the icon library being used.\n */\n @Prop({ reflect: true }) public readonly iconUncheckedName?: string\n\n /**\n * The name of a registered unchecked icon library.\n */\n @Prop({ reflect: true }) public readonly iconUncheckedLibrary: string =\n 'default'\n\n /**\n * The switches's size.\n */\n @Prop({ reflect: true }) public readonly size: SwitchSize = 'standard'\n\n /**\n * The switch's checked text.\n */\n @Prop({ mutable: true, reflect: true }) public readonly textChecked?: string\n\n /**\n * The switch's unchecked text.\n */\n @Prop({ mutable: true, reflect: true }) public readonly textUnchecked?: string\n\n /**\n * Specify whether the switch should have focus when the page loads.\n *\n * @webnative\n */\n @Prop({ attribute: 'autofocus' }) public readonly autoFocus?: boolean\n\n /**\n *Sets the switch's state.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public checked?: boolean\n\n /**\n * Prevents the switch from being interacted with: it cannot be pressed or\n *focused.\n *\n * @webnative\n */\n @Prop({ mutable: true, reflect: true }) public disabled?: boolean\n\n /**\n * The [`<form>`](https://developer.mozilla.org/docs/Web/HTML/Element/form)\n * element to associate the switch 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-switch>` is associated\n * with its ancestor `<form>` element, if any.\n *\n * This property lets you associate `<qds-switch>` elements to `<form>`s\n * anywhere in the document, not just inside a `<form>`. It can also override\n *an ancestor `<form>` element.\n *\n * @webnative\n */\n @Prop() public readonly form?: string\n\n /**\n * The name of the switch, which is submitted with the form data. An\n *incrementing ID is used by default.\n *\n * @webnative\n */\n @Prop() public readonly name = `qds-switch-${autoIncrementingId}`\n\n /**\n * The value of the switch, submitted as a name/value pair with form data.\n *\n * @webnative\n */\n @Prop({ mutable: true }) public value?: SwitchValue\n\n /**\n * Emitted when the switch loses focus.\n */\n @Event({ eventName: 'qdsBlur', bubbles: false, cancelable: false })\n private readonly blurEmitter!: EventEmitter<QdsFocusEventDetail>\n\n /**\n * Emitted when a change to the switch's state is committed by the user.\n */\n @Event({ eventName: 'qdsChange', cancelable: false })\n private readonly changeEmitter!: EventEmitter<void>\n\n /**\n * Emitted when the switch gains focus.\n */\n @Event({ eventName: 'qdsFocus', bubbles: false, cancelable: false })\n private readonly focusEmitter!: EventEmitter<QdsFocusEventDetail>\n\n @Element() private readonly element!: HTMLQdsSwitchElement\n\n private inheritedAttributes: Attributes = {}\n\n private get computedDisabled(): boolean {\n return this.disabled ?? false\n }\n\n @Listen('click')\n protected onClick(event: MouseEvent): void {\n if (this.computedDisabled) return\n\n event.preventDefault()\n\n this.checked = !(this.checked ?? false)\n this.changeEmitter.emit()\n }\n\n public componentWillLoad(): void {\n autoIncrementingId += 1\n this.inheritedAttributes = {\n ...inheritAriaAttributes(this.element),\n ...inheritAttributes(this.element, ['tabindex']),\n }\n }\n\n public render() {\n return (\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n <label\n aria-disabled={this.computedDisabled ? 'true' : 'false'}\n class={{\n inline: this.inline,\n label: true,\n }}\n data-size={this.size}\n >\n {this.textUnchecked !== undefined && this.textUnchecked !== '' && (\n <qds-label\n class=\"unchecked-text\"\n size={this.size}\n text={this.textUnchecked}\n />\n )}\n {this.iconUncheckedName !== undefined &&\n this.iconUncheckedName !== '' && (\n <qds-icon\n class=\"icon\"\n data-size={this.size}\n library={this.iconUncheckedLibrary}\n name={this.iconUncheckedName}\n />\n )}\n <input\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.autoFocus}\n checked={this.checked}\n class=\"switch\"\n disabled={this.disabled}\n form={this.form}\n name={this.name}\n onBlur={this.onBlur}\n onFocus={this.onFocus}\n type=\"checkbox\"\n value={this.value ?? undefined}\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...this.inheritedAttributes}\n />\n <div class=\"track\" data-size={this.size}>\n <div class=\"knob\" data-size={this.size} />\n </div>\n {this.iconCheckedName !== undefined && this.iconCheckedName !== '' && (\n <qds-icon\n class=\"icon\"\n data-size={this.size}\n library={this.iconCheckedLibrary}\n name={this.iconCheckedName}\n />\n )}\n {this.textChecked !== undefined && this.textChecked !== '' && (\n <qds-label size={this.size} text={this.textChecked} />\n )}\n </label>\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,62 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* SPDX-FileCopyrightText: © 2023 Schneider Electric
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: LGPL-2.1-only
|
|
5
|
+
*/
|
|
6
|
+
import { r as registerInstance, h, a as getElement } from './index-1bc8e218.js';
|
|
7
|
+
import { i as inheritAriaAttributes } from './helpers-5c189a19.js';
|
|
8
|
+
|
|
9
|
+
const titleCss = ":host{box-sizing:border-box}:host([hidden]){display:none !important}:host([hidden]){}:host *,:host *::before,:host *::after{box-sizing:inherit}:host{display:block}.titles,.title{display:flex}.titles{flex-direction:column}.title,.subtitle,.kicker{margin-block:0}.icon{flex-shrink:0}.title{font-weight:normal;font-weight:initial;font-size:medium;font-size:initial;color:var(--qds-theme-title)}.subtitle{color:var(--qds-theme-subtitle)}.kicker{color:var(--qds-theme-kicker);order:-1}.subtitle,.kicker{word-wrap:break-word}.main.section.titles,.main.section.title{gap:var(--qds-main-section-titles-gap)}.main.section.title{font:var(--qds-main-section-title)}.main.section.title .icon{--qds-main-section-title-line-height:2rem;width:var(--qds-main-section-titles-icon-size);height:2rem;height:var(--qds-main-section-title-line-height)}.main.section.subtitle{font:var(--qds-main-section-subtitle)}.main.section.kicker{font:var(--qds-main-section-kicker)}.main.section.has-icon{-webkit-padding-start:calc(\n 0px +\n 0px\n );padding-inline-start:calc(\n 0px +\n 0px\n );-webkit-padding-start:calc(\n var(--qds-main-section-titles-icon-size, 0px) +\n var(--qds-main-section-titles-gap, 0px)\n );padding-inline-start:calc(\n var(--qds-main-section-titles-icon-size, 0px) +\n var(--qds-main-section-titles-gap, 0px)\n )}.main.section.has-icon-end{-webkit-padding-end:calc(\n 0px +\n 0px\n );padding-inline-end:calc(\n 0px +\n 0px\n );-webkit-padding-end:calc(\n var(--qds-main-section-titles-icon-size, 0px) +\n var(--qds-main-section-titles-gap, 0px)\n );padding-inline-end:calc(\n var(--qds-main-section-titles-icon-size, 0px) +\n var(--qds-main-section-titles-gap, 0px)\n )}.main.subsection.titles,.main.subsection.title{gap:var(--qds-main-subsection-titles-gap)}.main.subsection.title{font:var(--qds-main-subsection-title)}.main.subsection.title .icon{--qds-main-subsection-title-line-height:1.5rem;width:var(--qds-main-subsection-titles-icon-size);height:1.5rem;height:var(--qds-main-subsection-title-line-height)}.main.subsection.subtitle{font:var(--qds-main-subsection-subtitle)}.main.subsection.kicker{font:var(--qds-main-subsection-kicker)}.main.subsection.has-icon{-webkit-padding-start:calc(\n 0px +\n 0px\n );padding-inline-start:calc(\n 0px +\n 0px\n );-webkit-padding-start:calc(\n var(--qds-main-subsection-titles-icon-size, 0px) +\n var(--qds-main-subsection-titles-gap, 0px)\n );padding-inline-start:calc(\n var(--qds-main-subsection-titles-icon-size, 0px) +\n var(--qds-main-subsection-titles-gap, 0px)\n )}.panel.root.titles,.panel.root.title{gap:var(--qds-panel-titles-gap)}.panel.root.title{font:var(--qds-panel-title)}.panel.root.title .icon{--qds-panel-title-line-height:2rem;width:var(--qds-panel-titles-icon-size);height:2rem;height:var(--qds-panel-title-line-height)}.panel.root.subtitle{font:var(--qds-panel-subtitle)}.panel.root.kicker{font:var(--qds-panel-kicker)}.panel.root.has-icon{-webkit-padding-start:calc(\n 0px +\n 0px\n );padding-inline-start:calc(\n 0px +\n 0px\n );-webkit-padding-start:calc(\n var(--qds-panel-titles-icon-size, 0px) +\n var(--qds-panel-titles-gap, 0px)\n );padding-inline-start:calc(\n var(--qds-panel-titles-icon-size, 0px) +\n var(--qds-panel-titles-gap, 0px)\n )}.panel.section.titles,.panel.section.title{gap:var(--qds-panel-section-titles-gap)}.panel.section.title{font:var(--qds-panel-section-title)}.panel.section.title .icon{--qds-panel-section-title-line-height:1.5rem;width:var(--qds-panel-section-titles-icon-size);height:1.5rem;height:var(--qds-panel-section-title-line-height)}.panel.section.subtitle{font:var(--qds-panel-section-subtitle)}.panel.section.kicker{font:var(--qds-panel-section-kicker)}.panel.section.has-icon{-webkit-padding-start:calc(\n 0px +\n 0px\n );padding-inline-start:calc(\n 0px +\n 0px\n );-webkit-padding-start:calc(\n var(--qds-panel-section-titles-icon-size, 0px) +\n var(--qds-panel-section-titles-gap, 0px)\n );padding-inline-start:calc(\n var(--qds-panel-section-titles-icon-size, 0px) +\n var(--qds-panel-section-titles-gap, 0px)\n )}.panel.subsection.titles,.panel.subsection.title{gap:var(--qds-panel-subsection-titles-gap)}.panel.subsection.title{font:var(--qds-panel-subsection-title)}.panel.subsection.title .icon{--qds-panel-subsection-title-line-height:1.25rem;width:var(--qds-panel-subsection-titles-icon-size);height:1.25rem;height:var(--qds-panel-subsection-title-line-height)}.panel.subsection.subtitle{font:var(--qds-panel-subsection-subtitle)}.panel.subsection.kicker{font:var(--qds-panel-subsection-kicker)}.panel.subsection.has-icon{-webkit-padding-start:calc(\n 0px +\n 0px\n );padding-inline-start:calc(\n 0px +\n 0px\n );-webkit-padding-start:calc(\n var(--qds-panel-subsection-titles-icon-size, 0px) +\n var(--qds-panel-subsection-titles-gap, 0px)\n );padding-inline-start:calc(\n var(--qds-panel-subsection-titles-icon-size, 0px) +\n var(--qds-panel-subsection-titles-gap, 0px)\n )}.navigation.section.titles,.navigation.section.title{gap:var(--qds-navigation-section-titles-gap)}.navigation.section.title{font:var(--qds-navigation-section-title)}.navigation.section.title .icon{--qds-navigation-section-title-line-height:1.5rem;width:var(--qds-navigation-section-titles-icon-size);height:1.5rem;height:var(--qds-navigation-section-title-line-height)}.navigation.section.subtitle{font:var(--qds-navigation-section-subtitle)}.navigation.section.kicker{font:var(--qds-navigation-section-kicker)}.navigation.section.has-icon{-webkit-padding-start:calc(\n 0px +\n 0px\n );padding-inline-start:calc(\n 0px +\n 0px\n );-webkit-padding-start:calc(\n var(--qds-navigation-section-titles-icon-size, 0px) +\n var(--qds-navigation-section-titles-gap, 0px)\n );padding-inline-start:calc(\n var(--qds-navigation-section-titles-icon-size, 0px) +\n var(--qds-navigation-section-titles-gap, 0px)\n )}.navigation.subsection.titles,.navigation.subsection.title{gap:var(--qds-navigation-subsection-titles-gap)}.navigation.subsection.title{font:var(--qds-navigation-subsection-title)}.navigation.subsection.title .icon{--qds-navigation-subsection-title-line-height:1.25rem;width:var(--qds-navigation-subsection-titles-icon-size);height:1.25rem;height:var(--qds-navigation-subsection-title-line-height)}.navigation.subsection.subtitle{font:var(--qds-navigation-subsection-subtitle)}.navigation.subsection.kicker{font:var(--qds-navigation-subsection-kicker)}.navigation.subsection.has-icon{-webkit-padding-start:calc(\n 0px +\n 0px\n );padding-inline-start:calc(\n 0px +\n 0px\n );-webkit-padding-start:calc(\n var(--qds-navigation-subsection-titles-icon-size, 0px) +\n var(--qds-navigation-subsection-titles-gap, 0px)\n );padding-inline-start:calc(\n var(--qds-navigation-subsection-titles-icon-size, 0px) +\n var(--qds-navigation-subsection-titles-gap, 0px)\n )}.popup.root.titles,.popup.root.title{gap:var(--qds-popup-titles-gap)}.popup.root.title{font:var(--qds-popup-title)}.popup.root.title .icon{--qds-popup-title-line-height:1.75rem;width:var(--qds-popup-titles-icon-size);height:1.75rem;height:var(--qds-popup-title-line-height)}.popup.root.subtitle{font:var(--qds-popup-subtitle)}.popup.root.kicker{font:var(--qds-popup-kicker)}.popup.root.has-icon{-webkit-padding-start:calc(\n 0px +\n 0px\n );padding-inline-start:calc(\n 0px +\n 0px\n );-webkit-padding-start:calc(\n var(--qds-popup-titles-icon-size, 0px) +\n var(--qds-popup-titles-gap, 0px)\n );padding-inline-start:calc(\n var(--qds-popup-titles-icon-size, 0px) +\n var(--qds-popup-titles-gap, 0px)\n )}.popup.section.titles,.popup.section.title{gap:var(--qds-popup-section-titles-gap)}.popup.section.title{font:var(--qds-popup-section-title)}.popup.section.title .icon{--qds-popup-section-title-line-height:1.5rem;width:var(--qds-popup-section-titles-icon-size);height:1.5rem;height:var(--qds-popup-section-title-line-height)}.popup.section.subtitle{font:var(--qds-popup-section-subtitle)}.popup.section.kicker{font:var(--qds-popup-section-kicker)}.popup.section.has-icon{-webkit-padding-start:calc(\n 0px +\n 0px\n );padding-inline-start:calc(\n 0px +\n 0px\n );-webkit-padding-start:calc(\n var(--qds-popup-section-titles-icon-size, 0px) +\n var(--qds-popup-section-titles-gap, 0px)\n );padding-inline-start:calc(\n var(--qds-popup-section-titles-icon-size, 0px) +\n var(--qds-popup-section-titles-gap, 0px)\n )}.popup.subsection.titles,.popup.subsection.title{gap:var(--qds-popup-subsection-titles-gap)}.popup.subsection.title{font:var(--qds-popup-subsection-title)}.popup.subsection.title .icon{--qds-popup-subsection-title-line-height:1.25rem;width:var(--qds-popup-subsection-titles-icon-size);height:1.25rem;height:var(--qds-popup-subsection-title-line-height)}.popup.subsection.subtitle{font:var(--qds-popup-subsection-subtitle)}.popup.subsection.kicker{font:var(--qds-popup-subsection-kicker)}.popup.subsection.has-icon{-webkit-padding-start:calc(\n 0px +\n 0px\n );padding-inline-start:calc(\n 0px +\n 0px\n );-webkit-padding-start:calc(\n var(--qds-popup-subsection-titles-icon-size, 0px) +\n var(--qds-popup-subsection-titles-gap, 0px)\n );padding-inline-start:calc(\n var(--qds-popup-subsection-titles-icon-size, 0px) +\n var(--qds-popup-subsection-titles-gap, 0px)\n )}.accessory.root.titles,.accessory.root.title{gap:var(--qds-accessory-titles-gap)}.accessory.root.title{font:var(--qds-accessory-title)}.accessory.root.title .icon{--qds-accessory-title-line-height:1.5rem;width:var(--qds-accessory-titles-icon-size);height:1.5rem;height:var(--qds-accessory-title-line-height)}.accessory.root.subtitle{font:var(--qds-accessory-subtitle)}.accessory.root.kicker{font:var(--qds-accessory-kicker)}.accessory.root.has-icon{-webkit-padding-start:calc(\n 0px +\n 0px\n );padding-inline-start:calc(\n 0px +\n 0px\n );-webkit-padding-start:calc(\n var(--qds-accessory-titles-icon-size, 0px) +\n var(--qds-accessory-titles-gap, 0px)\n );padding-inline-start:calc(\n var(--qds-accessory-titles-icon-size, 0px) +\n var(--qds-accessory-titles-gap, 0px)\n )}.accessory.section.titles,.accessory.section.title{gap:var(--qds-accessory-section-titles-gap)}.accessory.section.title{font:var(--qds-accessory-section-title)}.accessory.section.title .icon{--qds-accessory-section-title-line-height:1.25rem;width:var(--qds-accessory-section-titles-icon-size);height:1.25rem;height:var(--qds-accessory-section-title-line-height)}.accessory.section.subtitle{font:var(--qds-accessory-section-subtitle)}.accessory.section.kicker{font:var(--qds-accessory-section-kicker)}.accessory.section.has-icon{-webkit-padding-start:calc(\n 0px +\n 0px\n );padding-inline-start:calc(\n 0px +\n 0px\n );-webkit-padding-start:calc(\n var(--qds-accessory-section-titles-icon-size, 0px) +\n var(--qds-accessory-section-titles-gap, 0px)\n );padding-inline-start:calc(\n var(--qds-accessory-section-titles-icon-size, 0px) +\n var(--qds-accessory-section-titles-gap, 0px)\n )}";
|
|
10
|
+
|
|
11
|
+
const Title = class {
|
|
12
|
+
constructor(hostRef) {
|
|
13
|
+
registerInstance(this, hostRef);
|
|
14
|
+
this.inheritedAttributes = {};
|
|
15
|
+
this.iconName = undefined;
|
|
16
|
+
this.iconLibrary = 'default';
|
|
17
|
+
this.kicker = undefined;
|
|
18
|
+
this.layer = 'panel';
|
|
19
|
+
this.level = 'section';
|
|
20
|
+
this.subtitle = undefined;
|
|
21
|
+
this.tag = 'h2';
|
|
22
|
+
}
|
|
23
|
+
get hasSubtitle() {
|
|
24
|
+
return this.subtitle !== undefined && this.subtitle !== '';
|
|
25
|
+
}
|
|
26
|
+
get hasKicker() {
|
|
27
|
+
return this.kicker !== undefined && this.kicker !== '';
|
|
28
|
+
}
|
|
29
|
+
get hasIcon() {
|
|
30
|
+
return this.iconName !== undefined && this.iconName !== '';
|
|
31
|
+
}
|
|
32
|
+
componentWillLoad() {
|
|
33
|
+
this.inheritedAttributes = inheritAriaAttributes(this.element);
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
|
+
return (h("hgroup", { class: {
|
|
37
|
+
[this.layer]: true,
|
|
38
|
+
[this.level ?? 'root']: true,
|
|
39
|
+
titles: true,
|
|
40
|
+
}, ...this.inheritedAttributes }, h(this.tag, { class: {
|
|
41
|
+
[this.layer]: true,
|
|
42
|
+
[this.level ?? 'root']: true,
|
|
43
|
+
title: true,
|
|
44
|
+
} }, this.iconName !== undefined && this.iconName !== '' && (h("qds-icon", { class: "icon", name: this.iconName, library: this.iconLibrary })), h("div", null, h("slot", null))), this.hasSubtitle && (h("p", { class: {
|
|
45
|
+
[this.layer]: true,
|
|
46
|
+
[this.level ?? 'root']: true,
|
|
47
|
+
subtitle: true,
|
|
48
|
+
'has-icon': this.hasIcon,
|
|
49
|
+
} }, this.subtitle)), this.hasKicker && (h("p", { class: {
|
|
50
|
+
[this.layer]: true,
|
|
51
|
+
[this.level ?? 'root']: true,
|
|
52
|
+
kicker: true,
|
|
53
|
+
'has-icon': this.hasIcon,
|
|
54
|
+
} }, this.kicker))));
|
|
55
|
+
}
|
|
56
|
+
get element() { return getElement(this); }
|
|
57
|
+
};
|
|
58
|
+
Title.style = titleCss;
|
|
59
|
+
|
|
60
|
+
export { Title as qds_title };
|
|
61
|
+
|
|
62
|
+
//# sourceMappingURL=qds-title.entry.js.map
|