@fluid-topics/ft-switch 1.3.14 → 1.3.16

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.
@@ -11,7 +11,7 @@ export const FtSwitchOptionCssVariables = {
11
11
  borderWidthRight: FtCssVariableFactory.create("--ft-switch-option-border-width-right", "", "SIZE", "1px"),
12
12
  borderWidthVertical: FtCssVariableFactory.create("--ft-switch-option-border-width-vertical", "", "SIZE", "1px"),
13
13
  };
14
- //language=css
14
+ // language=css
15
15
  export const optionStyles = css `
16
16
  .ft-switch-option {
17
17
  position: relative;
@@ -26,8 +26,8 @@ export const optionStyles = css `
26
26
  }
27
27
 
28
28
  .ft-switch-option--content {
29
- --ft-switch-option-internal-line-height: calc(${FtSwitchCssVariables.fontSize} + 2px);
30
- --ft-switch-option-internal-content-height: max(var(--ft-switch-option-internal-line-height), ${FtSwitchCssVariables.iconSize});
29
+ --switch-option-internal-line-height: calc(${FtSwitchCssVariables.fontSize} + 2px);
30
+ --switch-option-internal-content-height: max(var(--switch-option-internal-line-height), ${FtSwitchCssVariables.iconSize});
31
31
 
32
32
  border-style: solid;
33
33
  border-color: ${FtSwitchCssVariables.borderColor};
@@ -38,7 +38,7 @@ export const optionStyles = css `
38
38
  justify-content: center;
39
39
  overflow: hidden;
40
40
  ${setVariable(FtIconCssVariables.size, FtSwitchCssVariables.iconSize)};
41
- padding: var(--ft-switch-internal-vertical-padding, 6px) var(--ft-switch-internal-horizontal-padding, 8px);
41
+ padding: var(--switch-internal-vertical-padding, 6px) var(--switch-internal-horizontal-padding, 8px);
42
42
  background-color: ${FtSwitchCssVariables.backgroundColor};
43
43
  -webkit-mask-image: radial-gradient(white, black);
44
44
  }
@@ -65,7 +65,7 @@ export const optionStyles = css `
65
65
  display: block;
66
66
  margin: 0 8px;
67
67
  ${setVariable(FtTypographyButtonCssVariables.fontSize, FtSwitchCssVariables.fontSize)};
68
- ${setVariable(FtTypographyButtonCssVariables.lineHeight, "var(--ft-switch-option-internal-content-height)")}
68
+ ${setVariable(FtTypographyButtonCssVariables.lineHeight, "var(--switch-option-internal-content-height)")}
69
69
  }
70
70
 
71
71
  .ft-switch-option--selected .ft-switch-option--label {
@@ -34,7 +34,7 @@ class FtSwitch extends FtLitElement {
34
34
  this.updateOptions();
35
35
  }
36
36
  if (props.has("unselectable")) {
37
- this.options.forEach(o => o.unselectable = this.unselectable);
37
+ this.options.forEach((o) => o.unselectable = this.unselectable);
38
38
  }
39
39
  }
40
40
  render() {
@@ -43,7 +43,7 @@ class FtSwitch extends FtLitElement {
43
43
  "ft-switch--dense": this.dense,
44
44
  };
45
45
  return html `
46
- <div @keydown=${this.onKeyDown} tabindex="-1" class="${classMap(classes)}" role="radiogroup" aria-label=${this.label}>
46
+ <div @keydown=${this.onKeyDown} tabindex="-1" class="${classMap(classes)}" role="radiogroup" aria-label="${this.label}">
47
47
  <slot @slotchange=${this.onSlotchange}
48
48
  @option-change=${this.onOptionChangeByScript}
49
49
  @option-change-by-user=${this.onOptionChangeByUser}
@@ -81,16 +81,16 @@ class FtSwitch extends FtLitElement {
81
81
  onSlotchange() {
82
82
  var _a;
83
83
  this.options = [];
84
- (_a = this.slottedContent) === null || _a === void 0 ? void 0 : _a.assignedElements().forEach(element => {
84
+ (_a = this.slottedContent) === null || _a === void 0 ? void 0 : _a.assignedElements().forEach((element) => {
85
85
  if (element instanceof FtSwitchOption) {
86
86
  this.registerOption(element);
87
87
  }
88
88
  });
89
- this.selectedOption = this.options.find(option => option.selected);
89
+ this.selectedOption = this.options.find((option) => option.selected);
90
90
  }
91
91
  registerOption(option) {
92
92
  var _a;
93
- (_a = option.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("input").forEach(input => {
93
+ (_a = option.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll("input").forEach((input) => {
94
94
  input.setAttribute("tabindex", "-1");
95
95
  });
96
96
  option.setAttribute("tabindex", "0");
@@ -99,7 +99,7 @@ class FtSwitch extends FtLitElement {
99
99
  }
100
100
  onOptionChangeByScript(e) {
101
101
  e.stopPropagation();
102
- let option = e.target;
102
+ const option = e.target;
103
103
  this.onOptionChange(option);
104
104
  }
105
105
  onOptionChangeByUser(e) {
@@ -114,7 +114,7 @@ class FtSwitch extends FtLitElement {
114
114
  this.selectedOption = option;
115
115
  }
116
116
  else {
117
- this.selectedOption = this.options.find(option => option.selected);
117
+ this.selectedOption = this.options.find((option) => option.selected);
118
118
  }
119
119
  }
120
120
  private(option) {
@@ -122,14 +122,14 @@ class FtSwitch extends FtLitElement {
122
122
  this.selectedOption = option;
123
123
  }
124
124
  else {
125
- this.selectedOption = this.options.find(option => option.selected);
125
+ this.selectedOption = this.options.find((option) => option.selected);
126
126
  }
127
127
  }
128
128
  focus() {
129
129
  this.ftSwitchDiv.focus();
130
130
  }
131
131
  updateOptions() {
132
- this.options.forEach(option => {
132
+ this.options.forEach((option) => {
133
133
  option.selected = option === this.selectedOption;
134
134
  if (this.displayFocusWhenUsingKeyboard) {
135
135
  option.isFocused = option === this.selectedOption;
@@ -138,7 +138,7 @@ class FtSwitch extends FtLitElement {
138
138
  }
139
139
  }
140
140
  FtSwitch.elementDefinitions = {};
141
- //language=CSS
141
+ // language=CSS
142
142
  FtSwitch.styles = css `
143
143
  :host {
144
144
  display: inline-block;
@@ -170,8 +170,8 @@ FtSwitch.styles = css `
170
170
  }
171
171
 
172
172
  .ft-switch--dense slot::slotted(ft-switch-option) {
173
- --ft-switch-internal-vertical-padding: 2px;
174
- --ft-switch-internal-horizontal-padding: 4px;
173
+ --switch-internal-vertical-padding: 2px;
174
+ --switch-internal-horizontal-padding: 4px;
175
175
  }
176
176
  `;
177
177
  __decorate([