@fluid-topics/ft-switch 1.0.21 → 1.0.22
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.
|
@@ -47,7 +47,7 @@ export const optionStyles = css `
|
|
|
47
47
|
position: relative;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
.ft-switch-option--
|
|
50
|
+
.ft-switch-option--selected .ft-switch-option--content:before {
|
|
51
51
|
background-color: ${FtSwitchCssVariables.selectedBackgroundColor};
|
|
52
52
|
border-radius: ${FtSwitchOptionCssVariables.borderRadiusLeft} ${FtSwitchOptionCssVariables.borderRadiusRight} ${FtSwitchOptionCssVariables.borderRadiusRight} ${FtSwitchOptionCssVariables.borderRadiusLeft};
|
|
53
53
|
position: absolute;
|
|
@@ -68,7 +68,7 @@ export const optionStyles = css `
|
|
|
68
68
|
${setVariable(FtTypographyButtonCssVariables.lineHeight, "var(--ft-switch-option-internal-content-height)")}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
.ft-switch-option--
|
|
71
|
+
.ft-switch-option--selected .ft-switch-option--label {
|
|
72
72
|
color: ${FtSwitchCssVariables.selectedTextColor};
|
|
73
73
|
}
|
|
74
74
|
|
|
@@ -93,7 +93,7 @@ export const optionStyles = css `
|
|
|
93
93
|
color: ${FtSwitchCssVariables.iconColor};
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
.ft-switch-option--
|
|
96
|
+
.ft-switch-option--selected ft-icon {
|
|
97
97
|
color: ${FtSwitchCssVariables.selectedTextColor};
|
|
98
98
|
}
|
|
99
99
|
`;
|
|
@@ -40,13 +40,14 @@ class FtSwitchOption extends FtLitElement {
|
|
|
40
40
|
render() {
|
|
41
41
|
const classes = {
|
|
42
42
|
"ft-switch-option": true,
|
|
43
|
-
"ft-switch-option--trailing-icon": this.trailingIcon
|
|
43
|
+
"ft-switch-option--trailing-icon": this.trailingIcon,
|
|
44
|
+
"ft-switch-option--selected": this.selected,
|
|
44
45
|
};
|
|
45
46
|
return this.addTooltip(html `
|
|
47
|
+
<input id="input" type="radio" class="ft-switch-option--input"
|
|
48
|
+
.checked=${this.selected}>
|
|
46
49
|
<label part="label" for="input" class=${classMap(classes)}
|
|
47
50
|
@click=${this.onChange}>
|
|
48
|
-
<input id="input" type="radio" class="ft-switch-option--input"
|
|
49
|
-
.checked=${this.selected}>
|
|
50
51
|
<div class="ft-switch-option--content">
|
|
51
52
|
<ft-ripple part="ripple" class="ft-switch-option--ripple"></ft-ripple>
|
|
52
53
|
<ft-typography part="text"
|
package/build/ft-switch.js
CHANGED
package/build/ft-switch.light.js
CHANGED
|
@@ -351,7 +351,7 @@ const tt=Symbol.for(""),it=t=>{if((null==t?void 0:t.r)===tt)return null==t?void
|
|
|
351
351
|
position: relative;
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
-
.ft-switch-option--
|
|
354
|
+
.ft-switch-option--selected .ft-switch-option--content:before {
|
|
355
355
|
background-color: ${Mi.selectedBackgroundColor};
|
|
356
356
|
border-radius: ${Wi.borderRadiusLeft} ${Wi.borderRadiusRight} ${Wi.borderRadiusRight} ${Wi.borderRadiusLeft};
|
|
357
357
|
position: absolute;
|
|
@@ -372,7 +372,7 @@ const tt=Symbol.for(""),it=t=>{if((null==t?void 0:t.r)===tt)return null==t?void
|
|
|
372
372
|
${i.setVariable(hi.lineHeight,"var(--ft-switch-option-internal-content-height)")}
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
-
.ft-switch-option--
|
|
375
|
+
.ft-switch-option--selected .ft-switch-option--label {
|
|
376
376
|
color: ${Mi.selectedTextColor};
|
|
377
377
|
}
|
|
378
378
|
|
|
@@ -397,14 +397,14 @@ const tt=Symbol.for(""),it=t=>{if((null==t?void 0:t.r)===tt)return null==t?void
|
|
|
397
397
|
color: ${Mi.iconColor};
|
|
398
398
|
}
|
|
399
399
|
|
|
400
|
-
.ft-switch-option--
|
|
400
|
+
.ft-switch-option--selected ft-icon {
|
|
401
401
|
color: ${Mi.selectedTextColor};
|
|
402
402
|
}
|
|
403
|
-
`;var Di=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class Ki extends CustomEvent{constructor(){super("option-change",{bubbles:!0,composed:!0})}}class Li extends i.FtLitElement{constructor(){super(...arguments),this.value="",this.label="",this.tooltipPosition="bottom",this.selected=!1,this.trailingIcon=!1,this.unselectable=!1}focus(){this.input.focus()}updated(t){super.updated(t),t.has("selected")&&this.dispatchEvent(new Ki)}render(){const t={"ft-switch-option":!0,"ft-switch-option--trailing-icon":this.trailingIcon};return this.addTooltip(e.html`
|
|
403
|
+
`;var Di=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class Ki extends CustomEvent{constructor(){super("option-change",{bubbles:!0,composed:!0})}}class Li extends i.FtLitElement{constructor(){super(...arguments),this.value="",this.label="",this.tooltipPosition="bottom",this.selected=!1,this.trailingIcon=!1,this.unselectable=!1}focus(){this.input.focus()}updated(t){super.updated(t),t.has("selected")&&this.dispatchEvent(new Ki)}render(){const t={"ft-switch-option":!0,"ft-switch-option--trailing-icon":this.trailingIcon,"ft-switch-option--selected":this.selected};return this.addTooltip(e.html`
|
|
404
|
+
<input id="input" type="radio" class="ft-switch-option--input"
|
|
405
|
+
.checked=${this.selected}>
|
|
404
406
|
<label part="label" for="input" class=${s.classMap(t)}
|
|
405
407
|
@click=${this.onChange}>
|
|
406
|
-
<input id="input" type="radio" class="ft-switch-option--input"
|
|
407
|
-
.checked=${this.selected}>
|
|
408
408
|
<div class="ft-switch-option--content">
|
|
409
409
|
<ft-ripple part="ripple" class="ft-switch-option--ripple"></ft-ripple>
|
|
410
410
|
<ft-typography part="text"
|
|
@@ -429,7 +429,7 @@ const tt=Symbol.for(""),it=t=>{if((null==t?void 0:t.r)===tt)return null==t?void
|
|
|
429
429
|
<slot @slotchange=${this.onSlotchange}
|
|
430
430
|
@option-change=${this.onOptionChange}></slot>
|
|
431
431
|
</div>
|
|
432
|
-
`}onKeyDown(t){let i;"ArrowDown"!=t.key&&"ArrowRight"!=t.key||(i=this.selectedOption?this.options.indexOf(this.selectedOption)+1:0),"ArrowUp"!=t.key&&"ArrowLeft"!=t.key||(i=this.selectedOption?this.options.indexOf(this.selectedOption)-1:this.options.length-1),null!=i&&(t.preventDefault(),this.options[this.fixIndex(i)].selected=!0)}fixIndex(t){return t<0?this.options.length-1:t>this.options.length-1?0:t}onSlotchange(){var t;this.options=[],null===(t=this.slottedContent)||void 0===t||t.assignedElements().forEach((t=>{t instanceof Li&&this.registerOption(t)})),this.selectedOption=this.options.find((t=>t.selected))}registerOption(t){t.setAttribute("tabindex","-1"),t.unselectable=this.unselectable,this.options.push(t)}onOptionChange(t){t.stopPropagation();let i=t.target;i.selected?this.selectedOption=i:this.selectedOption=this.options.find((t=>t.selected))}focus(){this.ftSwitchDiv.focus()}updateOptions(){this.options.forEach((t=>{t.selected=t
|
|
432
|
+
`}onKeyDown(t){let i;"ArrowDown"!=t.key&&"ArrowRight"!=t.key||(i=this.selectedOption?this.options.indexOf(this.selectedOption)+1:0),"ArrowUp"!=t.key&&"ArrowLeft"!=t.key||(i=this.selectedOption?this.options.indexOf(this.selectedOption)-1:this.options.length-1),null!=i&&(t.preventDefault(),this.options[this.fixIndex(i)].selected=!0)}fixIndex(t){return t<0?this.options.length-1:t>this.options.length-1?0:t}onSlotchange(){var t;this.options=[],null===(t=this.slottedContent)||void 0===t||t.assignedElements().forEach((t=>{t instanceof Li&&this.registerOption(t)})),this.selectedOption=this.options.find((t=>t.selected))}registerOption(t){t.setAttribute("tabindex","-1"),t.unselectable=this.unselectable,this.options.push(t)}onOptionChange(t){t.stopPropagation();let i=t.target;i.selected?this.selectedOption=i:this.selectedOption=this.options.find((t=>t.selected))}focus(){this.ftSwitchDiv.focus()}updateOptions(){this.options.forEach((t=>{t.selected=t===this.selectedOption}))}}Pi.elementDefinitions={},Pi.styles=e.css`
|
|
433
433
|
:host {
|
|
434
434
|
display: inline-block;
|
|
435
435
|
}
|
package/build/ft-switch.min.js
CHANGED
|
@@ -469,7 +469,7 @@ class ke extends zt{constructor(t){if(super(t),this.et=Y,t.type!==jt)throw Error
|
|
|
469
469
|
position: relative;
|
|
470
470
|
}
|
|
471
471
|
|
|
472
|
-
.ft-switch-option--
|
|
472
|
+
.ft-switch-option--selected .ft-switch-option--content:before {
|
|
473
473
|
background-color: ${ze.selectedBackgroundColor};
|
|
474
474
|
border-radius: ${Ae.borderRadiusLeft} ${Ae.borderRadiusRight} ${Ae.borderRadiusRight} ${Ae.borderRadiusLeft};
|
|
475
475
|
position: absolute;
|
|
@@ -490,7 +490,7 @@ class ke extends zt{constructor(t){if(super(t),this.et=Y,t.type!==jt)throw Error
|
|
|
490
490
|
${xt(ee.lineHeight,"var(--ft-switch-option-internal-content-height)")}
|
|
491
491
|
}
|
|
492
492
|
|
|
493
|
-
.ft-switch-option--
|
|
493
|
+
.ft-switch-option--selected .ft-switch-option--label {
|
|
494
494
|
color: ${ze.selectedTextColor};
|
|
495
495
|
}
|
|
496
496
|
|
|
@@ -515,14 +515,14 @@ class ke extends zt{constructor(t){if(super(t),this.et=Y,t.type!==jt)throw Error
|
|
|
515
515
|
color: ${ze.iconColor};
|
|
516
516
|
}
|
|
517
517
|
|
|
518
|
-
.ft-switch-option--
|
|
518
|
+
.ft-switch-option--selected ft-icon {
|
|
519
519
|
color: ${ze.selectedTextColor};
|
|
520
520
|
}
|
|
521
|
-
`;var Be=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class Te extends CustomEvent{constructor(){super("option-change",{bubbles:!0,composed:!0})}}class Pe extends kt{constructor(){super(...arguments),this.value="",this.label="",this.tooltipPosition="bottom",this.selected=!1,this.trailingIcon=!1,this.unselectable=!1}focus(){this.input.focus()}updated(t){super.updated(t),t.has("selected")&&this.dispatchEvent(new Te)}render(){const t={"ft-switch-option":!0,"ft-switch-option--trailing-icon":this.trailingIcon};return this.addTooltip(q`
|
|
521
|
+
`;var Be=function(t,i,e,o){for(var s,n=arguments.length,r=n<3?i:null===o?o=Object.getOwnPropertyDescriptor(i,e):o,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(n<3?s(r):n>3?s(i,e,r):s(i,e))||r);return n>3&&r&&Object.defineProperty(i,e,r),r};class Te extends CustomEvent{constructor(){super("option-change",{bubbles:!0,composed:!0})}}class Pe extends kt{constructor(){super(...arguments),this.value="",this.label="",this.tooltipPosition="bottom",this.selected=!1,this.trailingIcon=!1,this.unselectable=!1}focus(){this.input.focus()}updated(t){super.updated(t),t.has("selected")&&this.dispatchEvent(new Te)}render(){const t={"ft-switch-option":!0,"ft-switch-option--trailing-icon":this.trailingIcon,"ft-switch-option--selected":this.selected};return this.addTooltip(q`
|
|
522
|
+
<input id="input" type="radio" class="ft-switch-option--input"
|
|
523
|
+
.checked=${this.selected}>
|
|
522
524
|
<label part="label" for="input" class=${At(t)}
|
|
523
525
|
@click=${this.onChange}>
|
|
524
|
-
<input id="input" type="radio" class="ft-switch-option--input"
|
|
525
|
-
.checked=${this.selected}>
|
|
526
526
|
<div class="ft-switch-option--content">
|
|
527
527
|
<ft-ripple part="ripple" class="ft-switch-option--ripple"></ft-ripple>
|
|
528
528
|
<ft-typography part="text"
|
|
@@ -547,7 +547,7 @@ class ke extends zt{constructor(t){if(super(t),this.et=Y,t.type!==jt)throw Error
|
|
|
547
547
|
<slot @slotchange=${this.onSlotchange}
|
|
548
548
|
@option-change=${this.onOptionChange}></slot>
|
|
549
549
|
</div>
|
|
550
|
-
`}onKeyDown(t){let i;"ArrowDown"!=t.key&&"ArrowRight"!=t.key||(i=this.selectedOption?this.options.indexOf(this.selectedOption)+1:0),"ArrowUp"!=t.key&&"ArrowLeft"!=t.key||(i=this.selectedOption?this.options.indexOf(this.selectedOption)-1:this.options.length-1),null!=i&&(t.preventDefault(),this.options[this.fixIndex(i)].selected=!0)}fixIndex(t){return t<0?this.options.length-1:t>this.options.length-1?0:t}onSlotchange(){var t;this.options=[],null===(t=this.slottedContent)||void 0===t||t.assignedElements().forEach((t=>{t instanceof Pe&&this.registerOption(t)})),this.selectedOption=this.options.find((t=>t.selected))}registerOption(t){t.setAttribute("tabindex","-1"),t.unselectable=this.unselectable,this.options.push(t)}onOptionChange(t){t.stopPropagation();let i=t.target;i.selected?this.selectedOption=i:this.selectedOption=this.options.find((t=>t.selected))}focus(){this.ftSwitchDiv.focus()}updateOptions(){this.options.forEach((t=>{t.selected=t
|
|
550
|
+
`}onKeyDown(t){let i;"ArrowDown"!=t.key&&"ArrowRight"!=t.key||(i=this.selectedOption?this.options.indexOf(this.selectedOption)+1:0),"ArrowUp"!=t.key&&"ArrowLeft"!=t.key||(i=this.selectedOption?this.options.indexOf(this.selectedOption)-1:this.options.length-1),null!=i&&(t.preventDefault(),this.options[this.fixIndex(i)].selected=!0)}fixIndex(t){return t<0?this.options.length-1:t>this.options.length-1?0:t}onSlotchange(){var t;this.options=[],null===(t=this.slottedContent)||void 0===t||t.assignedElements().forEach((t=>{t instanceof Pe&&this.registerOption(t)})),this.selectedOption=this.options.find((t=>t.selected))}registerOption(t){t.setAttribute("tabindex","-1"),t.unselectable=this.unselectable,this.options.push(t)}onOptionChange(t){t.stopPropagation();let i=t.target;i.selected?this.selectedOption=i:this.selectedOption=this.options.find((t=>t.selected))}focus(){this.ftSwitchDiv.focus()}updateOptions(){this.options.forEach((t=>{t.selected=t===this.selectedOption}))}}De.elementDefinitions={},De.styles=x`
|
|
551
551
|
:host {
|
|
552
552
|
display: inline-block;
|
|
553
553
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluid-topics/ft-switch",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.22",
|
|
4
4
|
"description": "two-state",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit"
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@fluid-topics/ft-icon": "1.0.
|
|
23
|
-
"@fluid-topics/ft-ripple": "1.0.
|
|
24
|
-
"@fluid-topics/ft-tooltip": "1.0.
|
|
25
|
-
"@fluid-topics/ft-typography": "1.0.
|
|
26
|
-
"@fluid-topics/ft-wc-utils": "1.0.
|
|
22
|
+
"@fluid-topics/ft-icon": "1.0.22",
|
|
23
|
+
"@fluid-topics/ft-ripple": "1.0.22",
|
|
24
|
+
"@fluid-topics/ft-tooltip": "1.0.22",
|
|
25
|
+
"@fluid-topics/ft-typography": "1.0.22",
|
|
26
|
+
"@fluid-topics/ft-wc-utils": "1.0.22",
|
|
27
27
|
"lit": "2.7.2"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "d68f9748c223f9e8eb8da2da4f410e02a2121d36"
|
|
30
30
|
}
|