@fluid-topics/ft-select 0.1.5 → 0.1.8

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.
@@ -25,10 +25,11 @@ export declare const FtSelectCssVariables: {
25
25
  labelSize: FtCssVariable;
26
26
  selectedOptionSize: FtCssVariable;
27
27
  verticalSpacing: FtCssVariable;
28
+ selectedOptionColor: FtCssVariable;
28
29
  helperColor: FtCssVariable;
30
+ optionsColor: FtCssVariable;
29
31
  optionsZIndex: FtCssVariable;
30
32
  colorSurface: FtCssVariable;
31
- colorOnSurface: FtCssVariable;
32
33
  colorOnSurfaceDisabled: FtCssVariable;
33
34
  colorPrimary: FtCssVariable;
34
35
  borderRadiusS: FtCssVariable;
@@ -11,7 +11,7 @@ import { repeat } from "lit/directives/repeat.js";
11
11
  import { customElement, designSystemVariables, FtCssVariable, FtLitElement, setVariable } from "@fluid-topics/ft-wc-utils";
12
12
  import { FtTypography, FtTypographyBody1CssVariables, FtTypographyBody2, FtTypographyCaption } from "@fluid-topics/ft-typography";
13
13
  import { FtInputLabel, FtInputLabelCssVariables } from "@fluid-topics/ft-input-label";
14
- import { FtRipple } from "@fluid-topics/ft-ripple";
14
+ import { FtRipple, FtRippleCssVariables } from "@fluid-topics/ft-ripple";
15
15
  import { Icon } from "@material/mwc-icon";
16
16
  let FtSelectOption = class FtSelectOption extends FtLitElement {
17
17
  constructor() {
@@ -46,10 +46,11 @@ export const FtSelectCssVariables = {
46
46
  labelSize: FtCssVariable.create("--ft-select-label-size", "SIZE", "11px"),
47
47
  selectedOptionSize: FtCssVariable.create("--ft-select-selected-option-size", "SIZE", "14px"),
48
48
  verticalSpacing: FtCssVariable.create("--ft-select-vertical-spacing", "SIZE", "4px"),
49
+ selectedOptionColor: FtCssVariable.extend("--ft-select-selected-option-color", designSystemVariables.colorOnSurface),
49
50
  helperColor: FtCssVariable.extend("--ft-select-helper-color", designSystemVariables.colorOnSurfaceMedium),
51
+ optionsColor: FtCssVariable.extend("--ft-select-options-color", designSystemVariables.colorOnSurface),
50
52
  optionsZIndex: FtCssVariable.create("--ft-select-options-z-index", "NUMBER", "2"),
51
53
  colorSurface: FtCssVariable.external(designSystemVariables.colorSurface, "Design system"),
52
- colorOnSurface: FtCssVariable.external(designSystemVariables.colorOnSurface, "Design system"),
53
54
  colorOnSurfaceDisabled: FtCssVariable.external(designSystemVariables.colorOnSurfaceDisabled, "Design system"),
54
55
  colorPrimary: FtCssVariable.external(designSystemVariables.colorPrimary, "Design system"),
55
56
  borderRadiusS: FtCssVariable.external(designSystemVariables.borderRadiusS, "Design system"),
@@ -98,13 +99,14 @@ let FtSelect = class FtSelect extends FtLitElement {
98
99
  padding-left: 16px;
99
100
  padding-right: 8px;
100
101
  gap: 8px;
102
+ color: ${FtSelectCssVariables.selectedOptionColor};
103
+ ${setVariable(FtRippleCssVariables.color, FtSelectCssVariables.selectedOptionColor)};
101
104
  }
102
105
 
103
106
  .ft-select--input-panel,
104
107
  .ft-select--option {
105
- color: ${FtSelectCssVariables.colorOnSurface};
106
- --ft-opacity-color-content-on-surface-hover: 0.08;
107
- --ft-opacity-color-content-on-surface-dragged: 0.04;
108
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, "0.08")};
109
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceDragged, "0.04")};
108
110
  }
109
111
 
110
112
  .ft-select--disabled .ft-select--input-panel,
@@ -112,7 +114,8 @@ let FtSelect = class FtSelect extends FtLitElement {
112
114
  color: ${FtSelectCssVariables.colorOnSurfaceDisabled};
113
115
  }
114
116
 
115
- .ft-select:not(.ft-select--disabled) .ft-select--input-panel {
117
+ .ft-select:not(.ft-select--disabled) .ft-select--input-panel,
118
+ .ft-select:not(.ft-select--disabled) .ft-select--option {
116
119
  cursor: pointer;
117
120
  }
118
121
 
@@ -169,6 +172,7 @@ let FtSelect = class FtSelect extends FtLitElement {
169
172
  top: 100%;
170
173
  left: 0;
171
174
  right: 0;
175
+ color: ${FtSelectCssVariables.optionsColor};
172
176
  background: ${FtSelectCssVariables.colorSurface};
173
177
  z-index: ${FtSelectCssVariables.optionsZIndex};
174
178
  box-shadow: ${FtSelectCssVariables.elevation02};
@@ -218,14 +222,15 @@ let FtSelect = class FtSelect extends FtLitElement {
218
222
  <div class="ft-select--input-panel"
219
223
  part="selected-value"
220
224
  tabindex="${disabled ? "-1" : "0"}"
221
- @click=${() => this.optionsDisplayed = !this.optionsDisplayed}
225
+ @click=${() => {
226
+ this.optionsDisplayed = !this.optionsDisplayed;
227
+ this.focusOptions = this.optionsDisplayed;
228
+ }}
222
229
  @keydown=${this.onMainPanelKeyDown}
223
230
  aria-label="${this.label}"
224
231
  aria-haspopup="listbox"
225
232
  aria-expanded="${optionsDisplayed}">
226
- ${this.outlined ? null : html `
227
- <ft-ripple ?disabled=${disabled} activated></ft-ripple>
228
- `}
233
+ <ft-ripple ?disabled=${disabled} ?activated=${!this.outlined}></ft-ripple>
229
234
  <ft-typography variant="body1" class="ft-select--selected-option">
230
235
  ${((_c = this.selectedOption) === null || _c === void 0 ? void 0 : _c.value) != null ? (_e = (_d = this.selectedOption) === null || _d === void 0 ? void 0 : _d.label) !== null && _e !== void 0 ? _e : "" : ""}
231
236
  </ft-typography>