@universal-material/web 3.0.143 → 3.0.144
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/checkbox/checkbox.d.ts +1 -1
- package/checkbox/checkbox.d.ts.map +1 -1
- package/checkbox/checkbox.js +5 -1
- package/checkbox/checkbox.js.map +1 -1
- package/checkbox/checkbox.styles.d.ts.map +1 -1
- package/checkbox/checkbox.styles.js +64 -0
- package/checkbox/checkbox.styles.js.map +1 -1
- package/custom-elements.json +7879 -7879
- package/package.json +1 -1
- package/radio/radio.d.ts +1 -1
- package/radio/radio.d.ts.map +1 -1
- package/radio/radio.js +2 -1
- package/radio/radio.js.map +1 -1
- package/radio/radio.styles.d.ts.map +1 -1
- package/radio/radio.styles.js +64 -0
- package/radio/radio.styles.js.map +1 -1
- package/switch/switch.d.ts +1 -1
- package/switch/switch.d.ts.map +1 -1
- package/switch/switch.js +5 -1
- package/switch/switch.js.map +1 -1
- package/switch/switch.styles.d.ts.map +1 -1
- package/switch/switch.styles.js +64 -0
- package/switch/switch.styles.js.map +1 -1
package/package.json
CHANGED
package/radio/radio.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { HTMLTemplateResult } from 'lit';
|
|
|
3
3
|
import { UmSelectionControl } from '../shared/selection-control/selection-control.js';
|
|
4
4
|
export declare class UmRadio extends UmSelectionControl {
|
|
5
5
|
#private;
|
|
6
|
-
static styles: import("lit").
|
|
6
|
+
static styles: import("lit").CSSResult[];
|
|
7
7
|
hideStateLayer: boolean;
|
|
8
8
|
protected inputType: 'radio' | 'checkbox';
|
|
9
9
|
protected renderIndicator(): HTMLTemplateResult;
|
package/radio/radio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../src/radio/radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAQ,kBAAkB,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"radio.d.ts","sourceRoot":"","sources":["../../src/radio/radio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAQ,kBAAkB,EAAE,MAAM,KAAK,CAAC;AAI/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AAGtF,qBACa,OAAQ,SAAQ,kBAAkB;;IAC7C,OAAgB,MAAM,4BAAwB;IAE6B,cAAc,UAAS;IAElG,UAAmB,SAAS,EAAE,OAAO,GAAG,UAAU,CAAW;cAE1C,eAAe,IAAI,kBAAkB;IAMxD,IAAa,OAAO,IAIQ,OAAO,CAFlC;IAED,IAAa,OAAO,CAAC,KAAK,EAAE,OAAO,EAYlC;;IAcQ,YAAY,CAAC,iBAAiB,EAAE,cAAc;IAM9C,iBAAiB;IAKjB,oBAAoB;IAkE7B,OAAO,CAAC,oBAAoB;IAe5B,OAAO,CAAC,eAAe;CAaxB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,SAAS,EAAE,OAAO,CAAC;KACpB;CACF"}
|
package/radio/radio.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { styles as baseStyles } from '../shared/base.styles.js';
|
|
4
5
|
import { UmSelectionControl } from '../shared/selection-control/selection-control.js';
|
|
5
6
|
import { styles } from './radio.styles.js';
|
|
6
7
|
let UmRadio = class UmRadio extends UmSelectionControl {
|
|
7
|
-
static { this.styles = [
|
|
8
|
+
static { this.styles = [baseStyles, styles]; }
|
|
8
9
|
renderIndicator() {
|
|
9
10
|
return html `
|
|
10
11
|
<div class="indicator"></div>
|
package/radio/radio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.js","sourceRoot":"","sources":["../../src/radio/radio.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAsB,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGpC,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,kBAAkB;aAC7B,WAAM,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"radio.js","sourceRoot":"","sources":["../../src/radio/radio.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAsB,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGpC,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,kBAAkB;aAC7B,WAAM,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,AAAvB,CAAwB;IAM3B,eAAe;QAChC,OAAO,IAAI,CAAA;;KAEV,CAAC;IACJ,CAAC;IAED,IAAa,OAAO;QAClB,OAAO,KAAK,CAAC,OAAO,CAAC;IACvB,CAAC;IAED,IAAa,OAAO,CAAC,KAAc;QACjC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;QAEtB,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO;QACT,CAAC;QAED,IAAI,CAAC,eAAe,EAAE,CAAC;QAEvB,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,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property } from 'lit/decorators.js';\n\nimport { styles as baseStyles } from '../shared/base.styles.js';\nimport { UmSelectionControl } from '../shared/selection-control/selection-control.js';\nimport { styles } from './radio.styles.js';\n\n@customElement('u-radio')\nexport class UmRadio extends UmSelectionControl {\n static override styles = [baseStyles, styles];\n\n @property({ type: Boolean, attribute: 'hide-state-layer', reflect: true }) hideStateLayer = false;\n\n protected override inputType: 'radio' | 'checkbox' = 'radio';\n\n protected override renderIndicator(): HTMLTemplateResult {\n return html`\n <div class=\"indicator\"></div>\n `;\n }\n\n override get checked() {\n return super.checked;\n }\n\n override set checked(value: boolean) {\n super.checked = value;\n\n if (!value) {\n return;\n }\n\n this.uncheckSiblings();\n\n if (this.input) {\n this.input.tabIndex = 0;\n }\n }\n\n get #siblings(): UmRadio[] {\n if (!this.name) {\n return [this];\n }\n\n return Array.from((this.getRootNode() as Element).querySelectorAll<UmRadio>(`${this.tagName}[name=\"${this.name}\"]`));\n }\n\n constructor() {\n super();\n }\n\n override firstUpdated(changedProperties: PropertyValues) {\n super.firstUpdated(changedProperties);\n\n this.ensureOnlyOneChecked();\n }\n\n override connectedCallback() {\n super.connectedCallback();\n this.addEventListener('keydown', this.#handleKeyDown);\n }\n\n override disconnectedCallback() {\n super.disconnectedCallback();\n this.removeEventListener('keydown', this.#handleKeyDown);\n }\n\n #handleKeyDown(event: KeyboardEvent) {\n const isDown = event.key === 'ArrowDown';\n const isUp = event.key === 'ArrowUp';\n const isLeft = event.key === 'ArrowLeft';\n const isRight = event.key === 'ArrowRight';\n\n if (!isLeft && !isRight && !isDown && !isUp) {\n return;\n }\n\n // Don't try to select another sibling if there aren't any.\n const siblings = this.#siblings;\n\n if (!siblings.length) {\n return;\n }\n\n event.preventDefault();\n\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const forwards = isRtl ? isLeft || isDown : isRight || isDown;\n const factor = forwards ? 1 : -1;\n\n const thisIndex = siblings.indexOf(this);\n let nextIndex = thisIndex + factor;\n\n while (nextIndex !== thisIndex) {\n if (nextIndex >= siblings.length) {\n // Return to start if moving past the last item.\n nextIndex = 0;\n } else if (nextIndex < 0) {\n // Go to end if moving before the first item.\n nextIndex = siblings.length - 1;\n }\n\n const nextSibling = siblings[nextIndex];\n\n if (nextSibling.disabled) {\n nextIndex += factor;\n continue;\n }\n\n const clickCanceled = !nextSibling.dispatchEvent(\n new Event('click', {\n bubbles: true,\n cancelable: true,\n }),\n );\n\n nextSibling.input.focus();\n\n if (clickCanceled) {\n break;\n }\n\n nextSibling.checked = true;\n nextSibling.dispatchEvent(new Event('change', { bubbles: true }));\n break;\n }\n }\n\n private ensureOnlyOneChecked() {\n if (!this.name) {\n return;\n }\n\n const radios = Array.from(document.querySelectorAll<UmRadio>(`${this.tagName}[name=\"${this.name}\"]`));\n const lastChecked = radios.reverse().find(r => r.checked);\n\n if (!lastChecked) {\n return;\n }\n\n lastChecked.checked = true;\n }\n\n private uncheckSiblings() {\n for (const radio of this.#siblings) {\n if (radio === this) {\n continue;\n }\n\n if (radio.input) {\n radio.input.tabIndex = -1;\n }\n\n radio.checked = false;\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-radio': UmRadio;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.styles.d.ts","sourceRoot":"","sources":["../../src/radio/radio.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"radio.styles.d.ts","sourceRoot":"","sources":["../../src/radio/radio.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBA8FlB,CAAC"}
|
package/radio/radio.styles.js
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
--_state-layer-padding: var(--u-radio-state-layer-padding, 4px);
|
|
5
|
+
--_input-size: calc(var(--_width) - var(--_state-layer-padding) * 2);
|
|
6
|
+
--_indicator-color: var(--u-radio-indicator-unselected-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));
|
|
7
|
+
display: inline-block;
|
|
8
|
+
vertical-align: middle;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.container {
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
position: relative;
|
|
14
|
+
width: var(--_width);
|
|
15
|
+
height: var(--_height);
|
|
16
|
+
padding: var(--_state-layer-padding);
|
|
17
|
+
border-radius: var(--u-shape-corner-full, 9999px);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host([hide-state-layer]) .container {
|
|
21
|
+
width: var(--_indicator-size);
|
|
22
|
+
height: var(--_indicator-size);
|
|
23
|
+
padding: 0;
|
|
24
|
+
}
|
|
25
|
+
:host([hide-state-layer]) u-ripple {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
input {
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
padding: 0;
|
|
34
|
+
margin: 0;
|
|
35
|
+
border-radius: inherit;
|
|
36
|
+
appearance: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
u-ripple {
|
|
40
|
+
padding: var(--_state-layer-padding);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.indicator-container {
|
|
44
|
+
position: absolute;
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
inset: 0;
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
input:checked ~ .indicator-container {
|
|
53
|
+
--_indicator-color: var(--u-radio-indicator-selected-color, var(--u-color-primary, rgb(103, 80, 164)));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:host([disabled]) {
|
|
57
|
+
opacity: var(--u-radio-disabled-state-opacity, 0.38);
|
|
58
|
+
}
|
|
59
|
+
:host([disabled]) input,
|
|
60
|
+
:host([disabled]) .container {
|
|
61
|
+
cursor: default;
|
|
62
|
+
}
|
|
63
|
+
:host([disabled]) .indicator-container {
|
|
64
|
+
--_indicator-color: var(--u-radio-indicator-disabled-color, var(--u-color-on-surface, rgb(29, 27, 32)));
|
|
65
|
+
}
|
|
66
|
+
|
|
3
67
|
:host {
|
|
4
68
|
--_indicator-size: var(--u-radio-indicator-size, 1.25rem);
|
|
5
69
|
--_width: var(--u-radio-size, 3rem);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.styles.js","sourceRoot":"","sources":["../../src/radio/radio.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC
|
|
1
|
+
{"version":3,"file":"radio.styles.js","sourceRoot":"","sources":["../../src/radio/radio.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8FzB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css `\n :host {\n --_state-layer-padding: var(--u-radio-state-layer-padding, 4px);\n --_input-size: calc(var(--_width) - var(--_state-layer-padding) * 2);\n --_indicator-color: var(--u-radio-indicator-unselected-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n display: inline-block;\n vertical-align: middle;\n }\n\n .container {\n cursor: pointer;\n position: relative;\n width: var(--_width);\n height: var(--_height);\n padding: var(--_state-layer-padding);\n border-radius: var(--u-shape-corner-full, 9999px);\n }\n\n :host([hide-state-layer]) .container {\n width: var(--_indicator-size);\n height: var(--_indicator-size);\n padding: 0;\n }\n :host([hide-state-layer]) u-ripple {\n display: none;\n }\n\n input {\n cursor: pointer;\n width: 100%;\n height: 100%;\n padding: 0;\n margin: 0;\n border-radius: inherit;\n appearance: none;\n }\n\n u-ripple {\n padding: var(--_state-layer-padding);\n }\n\n .indicator-container {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n inset: 0;\n pointer-events: none;\n }\n\n input:checked ~ .indicator-container {\n --_indicator-color: var(--u-radio-indicator-selected-color, var(--u-color-primary, rgb(103, 80, 164)));\n }\n\n :host([disabled]) {\n opacity: var(--u-radio-disabled-state-opacity, 0.38);\n }\n :host([disabled]) input,\n :host([disabled]) .container {\n cursor: default;\n }\n :host([disabled]) .indicator-container {\n --_indicator-color: var(--u-radio-indicator-disabled-color, var(--u-color-on-surface, rgb(29, 27, 32)));\n }\n\n :host {\n --_indicator-size: var(--u-radio-indicator-size, 1.25rem);\n --_width: var(--u-radio-size, 3rem);\n --_height: var(--_width);\n }\n\n .indicator {\n position: relative;\n display: flex;\n align-items: center;\n justify-content: center;\n width: var(--_indicator-size);\n height: var(--_indicator-size);\n border: var(--u-radio-indicator-border-width, 0.125rem) solid var(--_indicator-color);\n border-radius: 50%;\n }\n .indicator::before {\n content: \"\";\n width: calc(var(--_indicator-size) / 2);\n height: calc(var(--_indicator-size) / 2);\n background: var(--_indicator-color);\n border-radius: 50%;\n transition: transform 250ms;\n transform: scale3d(0, 0, 1);\n }\n\n input:checked ~ .indicator-container .indicator::before {\n transform: scale3d(1, 1, 1);\n }\n`;\n"]}
|
package/switch/switch.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HTMLTemplateResult } from 'lit';
|
|
2
2
|
import { UmSelectionControl } from '../shared/selection-control/selection-control.js';
|
|
3
3
|
export declare class UmSwitch extends UmSelectionControl {
|
|
4
|
-
static styles: import("lit").
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
5
|
constructor();
|
|
6
6
|
protected renderRipple: boolean;
|
|
7
7
|
protected renderIndicator(): HTMLTemplateResult;
|
package/switch/switch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/switch/switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,kBAAkB,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/switch/switch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,kBAAkB,EAAE,MAAM,KAAK,CAAC;AAI/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AAGtF,qBACa,QAAS,SAAQ,kBAAkB;IAC9C,OAAgB,MAAM,4BAGpB;;IAMF,UAAmB,YAAY,UAAS;cAErB,eAAe,IAAI,kBAAkB;CASzD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,UAAU,EAAE,QAAQ,CAAC;KACtB;CACF"}
|
package/switch/switch.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { html } from 'lit';
|
|
3
3
|
import { customElement } from 'lit/decorators.js';
|
|
4
|
+
import { styles as baseStyles } from '../shared/base.styles.js';
|
|
4
5
|
import { UmSelectionControl } from '../shared/selection-control/selection-control.js';
|
|
5
6
|
import { styles } from './switch.styles.js';
|
|
6
7
|
let UmSwitch = class UmSwitch extends UmSelectionControl {
|
|
7
|
-
static { this.styles = [
|
|
8
|
+
static { this.styles = [
|
|
9
|
+
baseStyles,
|
|
10
|
+
styles,
|
|
11
|
+
]; }
|
|
8
12
|
constructor() {
|
|
9
13
|
super();
|
|
10
14
|
this.renderRipple = false;
|
package/switch/switch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/switch/switch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAsB,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGrC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,kBAAkB;aAC9B,WAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../src/switch/switch.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAsB,MAAM,KAAK,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,MAAM,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AACtF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGrC,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,kBAAkB;aAC9B,WAAM,GAAG;QACvB,UAAU;QACV,MAAM;KACP,AAHqB,CAGpB;IAEF;QACE,KAAK,EAAE,CAAC;QAGS,iBAAY,GAAG,KAAK,CAAC;IAFxC,CAAC;IAIkB,eAAe;QAChC,OAAO,IAAI,CAAA;;;;;;KAMV,CAAC;IACJ,CAAC;;AApBU,QAAQ;IADpB,aAAa,CAAC,UAAU,CAAC;GACb,QAAQ,CAqBpB","sourcesContent":["import { html, HTMLTemplateResult } from 'lit';\nimport { customElement } from 'lit/decorators.js';\n\nimport { styles as baseStyles } from '../shared/base.styles.js';\nimport { UmSelectionControl } from '../shared/selection-control/selection-control.js';\nimport { styles } from './switch.styles.js';\n\n@customElement('u-switch')\nexport class UmSwitch extends UmSelectionControl {\n static override styles = [\n baseStyles,\n styles,\n ];\n\n constructor() {\n super();\n }\n\n protected override renderRipple = false;\n\n protected override renderIndicator(): HTMLTemplateResult {\n return html`\n <div class=\"indicator\">\n <div class=\"state-layer\">\n <div class=\"handle\"></div>\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'u-switch': UmSwitch;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.styles.d.ts","sourceRoot":"","sources":["../../src/switch/switch.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"switch.styles.d.ts","sourceRoot":"","sources":["../../src/switch/switch.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBA2IlB,CAAC"}
|
package/switch/switch.styles.js
CHANGED
|
@@ -1,5 +1,69 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
2
|
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
--_state-layer-padding: var(--u-switch-state-layer-padding, 4px);
|
|
5
|
+
--_input-size: calc(var(--_width) - var(--_state-layer-padding) * 2);
|
|
6
|
+
--_indicator-color: var(--u-switch-indicator-unselected-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));
|
|
7
|
+
display: inline-block;
|
|
8
|
+
vertical-align: middle;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.container {
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
position: relative;
|
|
14
|
+
width: var(--_width);
|
|
15
|
+
height: var(--_height);
|
|
16
|
+
padding: var(--_state-layer-padding);
|
|
17
|
+
border-radius: var(--u-shape-corner-full, 9999px);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host([hide-state-layer]) .container {
|
|
21
|
+
width: var(--_indicator-size);
|
|
22
|
+
height: var(--_indicator-size);
|
|
23
|
+
padding: 0;
|
|
24
|
+
}
|
|
25
|
+
:host([hide-state-layer]) u-ripple {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
input {
|
|
30
|
+
cursor: pointer;
|
|
31
|
+
width: 100%;
|
|
32
|
+
height: 100%;
|
|
33
|
+
padding: 0;
|
|
34
|
+
margin: 0;
|
|
35
|
+
border-radius: inherit;
|
|
36
|
+
appearance: none;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
u-ripple {
|
|
40
|
+
padding: var(--_state-layer-padding);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.indicator-container {
|
|
44
|
+
position: absolute;
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
justify-content: center;
|
|
48
|
+
inset: 0;
|
|
49
|
+
pointer-events: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
input:checked ~ .indicator-container {
|
|
53
|
+
--_indicator-color: var(--u-switch-indicator-selected-color, var(--u-color-primary, rgb(103, 80, 164)));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
:host([disabled]) {
|
|
57
|
+
opacity: var(--u-switch-disabled-state-opacity, 0.38);
|
|
58
|
+
}
|
|
59
|
+
:host([disabled]) input,
|
|
60
|
+
:host([disabled]) .container {
|
|
61
|
+
cursor: default;
|
|
62
|
+
}
|
|
63
|
+
:host([disabled]) .indicator-container {
|
|
64
|
+
--_indicator-color: var(--u-switch-indicator-disabled-color, var(--u-color-on-surface, rgb(29, 27, 32)));
|
|
65
|
+
}
|
|
66
|
+
|
|
3
67
|
:host {
|
|
4
68
|
--_width: 3.25rem;
|
|
5
69
|
--_height: 2rem;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.styles.js","sourceRoot":"","sources":["../../src/switch/switch.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC
|
|
1
|
+
{"version":3,"file":"switch.styles.js","sourceRoot":"","sources":["../../src/switch/switch.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2IzB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css `\n :host {\n --_state-layer-padding: var(--u-switch-state-layer-padding, 4px);\n --_input-size: calc(var(--_width) - var(--_state-layer-padding) * 2);\n --_indicator-color: var(--u-switch-indicator-unselected-color, var(--u-color-on-surface-variant, rgb(73, 69, 79)));\n display: inline-block;\n vertical-align: middle;\n }\n\n .container {\n cursor: pointer;\n position: relative;\n width: var(--_width);\n height: var(--_height);\n padding: var(--_state-layer-padding);\n border-radius: var(--u-shape-corner-full, 9999px);\n }\n\n :host([hide-state-layer]) .container {\n width: var(--_indicator-size);\n height: var(--_indicator-size);\n padding: 0;\n }\n :host([hide-state-layer]) u-ripple {\n display: none;\n }\n\n input {\n cursor: pointer;\n width: 100%;\n height: 100%;\n padding: 0;\n margin: 0;\n border-radius: inherit;\n appearance: none;\n }\n\n u-ripple {\n padding: var(--_state-layer-padding);\n }\n\n .indicator-container {\n position: absolute;\n display: flex;\n align-items: center;\n justify-content: center;\n inset: 0;\n pointer-events: none;\n }\n\n input:checked ~ .indicator-container {\n --_indicator-color: var(--u-switch-indicator-selected-color, var(--u-color-primary, rgb(103, 80, 164)));\n }\n\n :host([disabled]) {\n opacity: var(--u-switch-disabled-state-opacity, 0.38);\n }\n :host([disabled]) input,\n :host([disabled]) .container {\n cursor: default;\n }\n :host([disabled]) .indicator-container {\n --_indicator-color: var(--u-switch-indicator-disabled-color, var(--u-color-on-surface, rgb(29, 27, 32)));\n }\n\n :host {\n --_width: 3.25rem;\n --_height: 2rem;\n --_state-layer-padding: 0;\n --_selected-track-background: var(--u-switch-track-bg-color, var(--u-color-primary, rgb(103, 80, 164)));\n --_state-layer-size: var(--u-switch-state-layer-size, 2.5rem);\n --_unselected-color: var(--u-switch-track-outline-color, var(--u-color-outline, rgb(121, 116, 126)));\n --_unselected-handle-size: var(--u-swich-unselected-handle-size, 1rem);\n --_selected-handle-size: var(--u-swich-unselected-handle-size, 1.5rem);\n --_active-handle-size: var(--u-swich-unselected-handle-size, 1.75rem);\n }\n\n .indicator-container {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n width: var(--_height);\n transition: width 200ms;\n }\n\n .state-layer,\n .indicator {\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .indicator {\n width: var(--_height);\n height: var(--_height);\n }\n\n .state-layer {\n flex-shrink: 0;\n width: var(--_state-layer-size);\n height: var(--_state-layer-size);\n border-radius: var(--u-shape-corner-full, 9999px);\n }\n\n .handle {\n width: var(--_unselected-handle-size);\n height: var(--_unselected-handle-size);\n background-color: var(--u-switch-unselected-handle-color, var(--_unselected-color));\n border-radius: var(--u-switch-handle-shape-corner, var(--u-shape-corner-full, 9999px));\n transition: background 200ms, width 200ms, height 200ms;\n }\n\n input {\n border: var(--u-switch-track-width, 0.125rem) solid var(--u-switch-unselected-track-outline-color, var(--_unselected-color));\n background-color: var(--u-switch-unselected-track-bg-color, var(--u-color-surface-container-highest, rgb(230, 224, 233)));\n transition: background 200ms, border-color 200ms;\n }\n input:checked {\n background-color: var(--_selected-track-background);\n border-color: var(--_selected-track-background);\n }\n input:checked ~ .indicator-container {\n width: 100%;\n }\n input:checked ~ .indicator-container .handle {\n width: var(--_selected-handle-size);\n height: var(--_selected-handle-size);\n background-color: var(--u-switch-selected-handle-color, var(--u-color-on-primary, rgb(255, 255, 255)));\n }\n\n @media (hover: hover) {\n :host(:not([disabled]):hover) .state-layer {\n background-color: color-mix(in srgb, var(--u-color-on-surface, rgb(29, 27, 32)) var(--u-switch-state-layer-hover-opacity, var(--u-state-hover-opacity, 0.08)), transparent);\n }\n }\n :host(:not([disabled]):active) .indicator-container .handle {\n width: var(--_active-handle-size);\n height: var(--_active-handle-size);\n }\n`;\n"]}
|