@fluid-topics/ft-select 0.3.12 → 0.3.14

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.
@@ -0,0 +1,18 @@
1
+ export declare const FtSelectCssVariables: {
2
+ labelSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
3
+ selectedOptionSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
4
+ verticalSpacing: import("@fluid-topics/ft-wc-utils").FtCssVariable;
5
+ optionsHeight: import("@fluid-topics/ft-wc-utils").FtCssVariable;
6
+ selectedOptionColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
7
+ helperColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
8
+ optionsColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
9
+ optionsZIndex: import("@fluid-topics/ft-wc-utils").FtCssVariable;
10
+ colorSurface: import("@fluid-topics/ft-wc-utils").FtCssVariable;
11
+ colorOnSurfaceDisabled: import("@fluid-topics/ft-wc-utils").FtCssVariable;
12
+ colorPrimary: import("@fluid-topics/ft-wc-utils").FtCssVariable;
13
+ borderRadiusS: import("@fluid-topics/ft-wc-utils").FtCssVariable;
14
+ elevation02: import("@fluid-topics/ft-wc-utils").FtCssVariable;
15
+ colorError: import("@fluid-topics/ft-wc-utils").FtCssVariable;
16
+ };
17
+ export declare const styles: import("lit").CSSResult;
18
+ //# sourceMappingURL=ft-select.css.d.ts.map
@@ -0,0 +1,171 @@
1
+ import { css } from "lit";
2
+ import { designSystemVariables, FtCssVariableFactory, setVariable } from "@fluid-topics/ft-wc-utils";
3
+ import { FtInputLabelCssVariables } from "@fluid-topics/ft-input-label/build/ft-input-label.css";
4
+ import { FtTypographyBody1CssVariables } from "@fluid-topics/ft-typography/build/ft-typography.css";
5
+ import { FtRippleCssVariables } from "@fluid-topics/ft-ripple/build/ft-ripple.css";
6
+ export const FtSelectCssVariables = {
7
+ labelSize: FtCssVariableFactory.create("--ft-select-label-size", "SIZE", "11px"),
8
+ selectedOptionSize: FtCssVariableFactory.create("--ft-select-selected-option-size", "SIZE", "14px"),
9
+ verticalSpacing: FtCssVariableFactory.create("--ft-select-vertical-spacing", "SIZE", "4px"),
10
+ optionsHeight: FtCssVariableFactory.create("--ft-select-options-height", "SIZE", "unset"),
11
+ selectedOptionColor: FtCssVariableFactory.extend("--ft-select-selected-option-color", designSystemVariables.colorOnSurface),
12
+ helperColor: FtCssVariableFactory.extend("--ft-select-helper-color", designSystemVariables.colorOnSurfaceMedium),
13
+ optionsColor: FtCssVariableFactory.extend("--ft-select-options-color", designSystemVariables.colorOnSurface),
14
+ optionsZIndex: FtCssVariableFactory.create("--ft-select-options-z-index", "NUMBER", "3"),
15
+ colorSurface: FtCssVariableFactory.external(designSystemVariables.colorSurface, "Design system"),
16
+ colorOnSurfaceDisabled: FtCssVariableFactory.external(designSystemVariables.colorOnSurfaceDisabled, "Design system"),
17
+ colorPrimary: FtCssVariableFactory.external(designSystemVariables.colorPrimary, "Design system"),
18
+ borderRadiusS: FtCssVariableFactory.external(designSystemVariables.borderRadiusS, "Design system"),
19
+ elevation02: FtCssVariableFactory.external(designSystemVariables.elevation02, "Design system"),
20
+ colorError: FtCssVariableFactory.external(designSystemVariables.colorError, "Design system"),
21
+ };
22
+ //language=css
23
+ export const styles = css `
24
+ *:focus {
25
+ outline: none;
26
+ }
27
+
28
+ .ft-select {
29
+ display: flex;
30
+ flex-direction: column;
31
+ align-items: stretch;
32
+ }
33
+
34
+ .ft-select--main-panel {
35
+ position: relative;
36
+ display: flex;
37
+ height: calc(4 * ${FtSelectCssVariables.verticalSpacing} + ${FtSelectCssVariables.labelSize} + ${FtSelectCssVariables.selectedOptionSize});
38
+ }
39
+
40
+ .ft-select--input-panel {
41
+ flex-grow: 1;
42
+ position: relative;
43
+ display: flex;
44
+ align-items: center;
45
+ overflow: hidden;
46
+ padding-left: 16px;
47
+ padding-right: 8px;
48
+ gap: 8px;
49
+ color: ${FtSelectCssVariables.selectedOptionColor};
50
+ ${setVariable(FtRippleCssVariables.color, FtSelectCssVariables.selectedOptionColor)};
51
+ }
52
+
53
+ .ft-select--input-panel,
54
+ .ft-select--option {
55
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, "0.08")};
56
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, "0.04")};
57
+ }
58
+
59
+ .ft-select--input-panel > *:not(ft-ripple),
60
+ .ft-select--option > *:not(ft-ripple) {
61
+ position: relative;
62
+ }
63
+
64
+ .ft-select--disabled .ft-select--input-panel,
65
+ .ft-select--disabled .ft-select--option {
66
+ color: ${FtSelectCssVariables.colorOnSurfaceDisabled};
67
+ }
68
+
69
+ .ft-select:not(.ft-select--disabled) .ft-select--input-panel,
70
+ .ft-select:not(.ft-select--disabled) .ft-select--option {
71
+ cursor: pointer;
72
+ }
73
+
74
+ ft-input-label {
75
+ ${setVariable(FtInputLabelCssVariables.fontSize, FtSelectCssVariables.selectedOptionSize)};
76
+ ${setVariable(FtInputLabelCssVariables.raisedFontSize, FtSelectCssVariables.labelSize)};
77
+ ${setVariable(FtInputLabelCssVariables.verticalSpacing, FtSelectCssVariables.verticalSpacing)};
78
+ }
79
+
80
+ .ft-select:not(.ft-select--disabled):focus-within ft-icon {
81
+ color: ${FtSelectCssVariables.colorPrimary};
82
+ }
83
+
84
+ .ft-select:not(.ft-select--disabled):focus-within ft-input-label {
85
+ ${setVariable(FtInputLabelCssVariables.borderColor, FtSelectCssVariables.colorPrimary)};
86
+ ${setVariable(FtInputLabelCssVariables.textColor, FtSelectCssVariables.colorPrimary)};
87
+ }
88
+
89
+ .ft-select--selected-option {
90
+ display: block;
91
+ flex-grow: 1;
92
+ flex-shrink: 1;
93
+ overflow: hidden;
94
+ white-space: nowrap;
95
+ text-overflow: ellipsis;
96
+ ${setVariable(FtTypographyBody1CssVariables.fontSize, FtSelectCssVariables.selectedOptionSize)};
97
+ ${setVariable(FtTypographyBody1CssVariables.lineHeight, FtSelectCssVariables.selectedOptionSize)};
98
+ }
99
+
100
+ .ft-select--in-error .ft-select--selected-option {
101
+ color: ${FtSelectCssVariables.colorError};
102
+ }
103
+
104
+ ft-icon {
105
+ flex-shrink: 0;
106
+ }
107
+
108
+ slot {
109
+ display: none;
110
+ }
111
+
112
+ .ft-select--filled .ft-select--input-panel {
113
+ border-radius: ${FtSelectCssVariables.borderRadiusS} ${FtSelectCssVariables.borderRadiusS} 0 0;
114
+ }
115
+
116
+ .ft-select--filled:not(.ft-select--no-label) .ft-select--selected-option {
117
+ align-self: stretch;
118
+ padding-top: calc(${FtSelectCssVariables.labelSize} + 2 * ${FtSelectCssVariables.verticalSpacing});
119
+ }
120
+
121
+ .ft-select--outlined .ft-select--input-panel {
122
+ border-radius: ${FtSelectCssVariables.borderRadiusS};
123
+ }
124
+
125
+ .ft-select--options {
126
+ display: none;
127
+ position: absolute;
128
+ top: 100%;
129
+ left: 0;
130
+ right: 0;
131
+ color: ${FtSelectCssVariables.optionsColor};
132
+ background: ${FtSelectCssVariables.colorSurface};
133
+ z-index: ${FtSelectCssVariables.optionsZIndex};
134
+ box-shadow: ${FtSelectCssVariables.elevation02};
135
+ }
136
+
137
+ .ft-select--fixed .ft-select--options {
138
+ position: fixed;
139
+ right: unset;
140
+ /* left and top are set dynamically */
141
+ }
142
+
143
+ .ft-select--options-displayed .ft-select--options {
144
+ display: block;
145
+ max-height: ${FtSelectCssVariables.optionsHeight};
146
+ overflow-y: auto;
147
+ }
148
+
149
+ .ft-select--option {
150
+ position: relative;
151
+ padding: 4px 16px;
152
+ min-height: 32px;
153
+ display: flex;
154
+ align-items: center;
155
+ }
156
+
157
+ .ft-select--option span {
158
+ text-overflow: ellipsis;
159
+ overflow: hidden;
160
+ }
161
+
162
+ .ft-select--helper-text {
163
+ padding: 0 12px 0 16px;
164
+ color: ${FtSelectCssVariables.helperColor};
165
+ }
166
+
167
+ .ft-select--in-error .ft-select--helper-text {
168
+ color: ${FtSelectCssVariables.colorError};
169
+ }
170
+ `;
171
+ //# sourceMappingURL=ft-select.css.js.map
@@ -1,10 +1,6 @@
1
1
  import { PropertyValues } from "lit";
2
2
  import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
3
- export interface FtSelectOptionProperties {
4
- label?: string;
5
- value?: any;
6
- selected?: boolean;
7
- }
3
+ import { FtSelectOptionProperties, FtSelectProperties } from "./ft-select.properties";
8
4
  export declare class FtSelectOption extends FtLitElement implements FtSelectOptionProperties {
9
5
  static elementDefinitions: ElementDefinitionsMap;
10
6
  label: string;
@@ -13,32 +9,6 @@ export declare class FtSelectOption extends FtLitElement implements FtSelectOpti
13
9
  protected render(): import("lit-html").TemplateResult<1>;
14
10
  protected updated(changedProperties: PropertyValues): void;
15
11
  }
16
- export interface FtSelectProperties {
17
- label?: string;
18
- helper?: string;
19
- outlined?: boolean;
20
- disabled?: boolean;
21
- error?: boolean;
22
- fixedMenuPosition?: boolean;
23
- options?: Array<FtSelectOptionProperties>;
24
- selectedOption?: FtSelectOptionProperties;
25
- }
26
- export declare const FtSelectCssVariables: {
27
- labelSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
28
- selectedOptionSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
29
- verticalSpacing: import("@fluid-topics/ft-wc-utils").FtCssVariable;
30
- optionsHeight: import("@fluid-topics/ft-wc-utils").FtCssVariable;
31
- selectedOptionColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
32
- helperColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
33
- optionsColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
34
- optionsZIndex: import("@fluid-topics/ft-wc-utils").FtCssVariable;
35
- colorSurface: import("@fluid-topics/ft-wc-utils").FtCssVariable;
36
- colorOnSurfaceDisabled: import("@fluid-topics/ft-wc-utils").FtCssVariable;
37
- colorPrimary: import("@fluid-topics/ft-wc-utils").FtCssVariable;
38
- borderRadiusS: import("@fluid-topics/ft-wc-utils").FtCssVariable;
39
- elevation02: import("@fluid-topics/ft-wc-utils").FtCssVariable;
40
- colorError: import("@fluid-topics/ft-wc-utils").FtCssVariable;
41
- };
42
12
  export declare class FtSelect extends FtLitElement implements FtSelectProperties {
43
13
  static elementDefinitions: ElementDefinitionsMap;
44
14
  static styles: import("lit").CSSResult[];
@@ -4,15 +4,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
4
4
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
5
  return c > 3 && r && Object.defineProperty(target, key, r), r;
6
6
  };
7
- import { css, html } from "lit";
7
+ import { html } from "lit";
8
8
  import { property, query, state } from "lit/decorators.js";
9
9
  import { classMap } from "lit/directives/class-map.js";
10
10
  import { repeat } from "lit/directives/repeat.js";
11
- import { designSystemVariables, FtCssVariableFactory, FtLitElement, setVariable } from "@fluid-topics/ft-wc-utils";
12
- import { FtTypography, FtTypographyBody1CssVariables, FtTypographyBody2, FtTypographyCaption } from "@fluid-topics/ft-typography";
13
- import { FtInputLabel, FtInputLabelCssVariables } from "@fluid-topics/ft-input-label";
14
- import { FtRipple, FtRippleCssVariables } from "@fluid-topics/ft-ripple";
11
+ import { FtLitElement } from "@fluid-topics/ft-wc-utils";
12
+ import { FtTypography, FtTypographyBody2, FtTypographyCaption } from "@fluid-topics/ft-typography";
13
+ import { FtInputLabel } from "@fluid-topics/ft-input-label";
14
+ import { FtRipple } from "@fluid-topics/ft-ripple";
15
15
  import { FtIcon } from "@fluid-topics/ft-icon";
16
+ import { styles } from "./ft-select.css";
16
17
  export class FtSelectOption extends FtLitElement {
17
18
  constructor() {
18
19
  super(...arguments);
@@ -38,22 +39,6 @@ __decorate([
38
39
  __decorate([
39
40
  property({ type: Boolean, reflect: true })
40
41
  ], FtSelectOption.prototype, "selected", void 0);
41
- export const FtSelectCssVariables = {
42
- labelSize: FtCssVariableFactory.create("--ft-select-label-size", "SIZE", "11px"),
43
- selectedOptionSize: FtCssVariableFactory.create("--ft-select-selected-option-size", "SIZE", "14px"),
44
- verticalSpacing: FtCssVariableFactory.create("--ft-select-vertical-spacing", "SIZE", "4px"),
45
- optionsHeight: FtCssVariableFactory.create("--ft-select-options-height", "SIZE", "unset"),
46
- selectedOptionColor: FtCssVariableFactory.extend("--ft-select-selected-option-color", designSystemVariables.colorOnSurface),
47
- helperColor: FtCssVariableFactory.extend("--ft-select-helper-color", designSystemVariables.colorOnSurfaceMedium),
48
- optionsColor: FtCssVariableFactory.extend("--ft-select-options-color", designSystemVariables.colorOnSurface),
49
- optionsZIndex: FtCssVariableFactory.create("--ft-select-options-z-index", "NUMBER", "3"),
50
- colorSurface: FtCssVariableFactory.external(designSystemVariables.colorSurface, "Design system"),
51
- colorOnSurfaceDisabled: FtCssVariableFactory.external(designSystemVariables.colorOnSurfaceDisabled, "Design system"),
52
- colorPrimary: FtCssVariableFactory.external(designSystemVariables.colorPrimary, "Design system"),
53
- borderRadiusS: FtCssVariableFactory.external(designSystemVariables.borderRadiusS, "Design system"),
54
- elevation02: FtCssVariableFactory.external(designSystemVariables.elevation02, "Design system"),
55
- colorError: FtCssVariableFactory.external(designSystemVariables.colorError, "Design system"),
56
- };
57
42
  export class FtSelect extends FtLitElement {
58
43
  constructor() {
59
44
  super(...arguments);
@@ -263,158 +248,10 @@ FtSelect.elementDefinitions = {
263
248
  "ft-ripple": FtRipple,
264
249
  "ft-icon": FtIcon,
265
250
  };
266
- // language=CSS
267
251
  FtSelect.styles = [
268
252
  FtTypographyBody2,
269
253
  FtTypographyCaption,
270
- css `
271
- *:focus {
272
- outline: none;
273
- }
274
-
275
- .ft-select {
276
- display: flex;
277
- flex-direction: column;
278
- align-items: stretch;
279
- }
280
-
281
- .ft-select--main-panel {
282
- position: relative;
283
- display: flex;
284
- height: calc(4 * ${FtSelectCssVariables.verticalSpacing} + ${FtSelectCssVariables.labelSize} + ${FtSelectCssVariables.selectedOptionSize});
285
- }
286
-
287
- .ft-select--input-panel {
288
- flex-grow: 1;
289
- position: relative;
290
- display: flex;
291
- align-items: center;
292
- overflow: hidden;
293
- padding-left: 16px;
294
- padding-right: 8px;
295
- gap: 8px;
296
- color: ${FtSelectCssVariables.selectedOptionColor};
297
- ${setVariable(FtRippleCssVariables.color, FtSelectCssVariables.selectedOptionColor)};
298
- }
299
-
300
- .ft-select--input-panel,
301
- .ft-select--option {
302
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, "0.08")};
303
- ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, "0.04")};
304
- }
305
-
306
- .ft-select--input-panel > *:not(ft-ripple),
307
- .ft-select--option > *:not(ft-ripple) {
308
- position: relative;
309
- }
310
-
311
- .ft-select--disabled .ft-select--input-panel,
312
- .ft-select--disabled .ft-select--option {
313
- color: ${FtSelectCssVariables.colorOnSurfaceDisabled};
314
- }
315
-
316
- .ft-select:not(.ft-select--disabled) .ft-select--input-panel,
317
- .ft-select:not(.ft-select--disabled) .ft-select--option {
318
- cursor: pointer;
319
- }
320
-
321
- ft-input-label {
322
- ${setVariable(FtInputLabelCssVariables.fontSize, FtSelectCssVariables.selectedOptionSize)};
323
- ${setVariable(FtInputLabelCssVariables.raisedFontSize, FtSelectCssVariables.labelSize)};
324
- ${setVariable(FtInputLabelCssVariables.verticalSpacing, FtSelectCssVariables.verticalSpacing)};
325
- }
326
-
327
- .ft-select:not(.ft-select--disabled):focus-within ft-icon {
328
- color: ${FtSelectCssVariables.colorPrimary};
329
- }
330
-
331
- .ft-select:not(.ft-select--disabled):focus-within ft-input-label {
332
- ${setVariable(FtInputLabelCssVariables.borderColor, FtSelectCssVariables.colorPrimary)};
333
- ${setVariable(FtInputLabelCssVariables.textColor, FtSelectCssVariables.colorPrimary)};
334
- }
335
-
336
- .ft-select--selected-option {
337
- display: block;
338
- flex-grow: 1;
339
- flex-shrink: 1;
340
- overflow: hidden;
341
- white-space: nowrap;
342
- text-overflow: ellipsis;
343
- ${setVariable(FtTypographyBody1CssVariables.fontSize, FtSelectCssVariables.selectedOptionSize)};
344
- ${setVariable(FtTypographyBody1CssVariables.lineHeight, FtSelectCssVariables.selectedOptionSize)};
345
- }
346
-
347
- .ft-select--in-error .ft-select--selected-option {
348
- color: ${FtSelectCssVariables.colorError};
349
- }
350
-
351
- ft-icon {
352
- flex-shrink: 0;
353
- }
354
-
355
- slot {
356
- display: none;
357
- }
358
-
359
- .ft-select--filled .ft-select--input-panel {
360
- border-radius: ${FtSelectCssVariables.borderRadiusS} ${FtSelectCssVariables.borderRadiusS} 0 0;
361
- }
362
-
363
- .ft-select--filled:not(.ft-select--no-label) .ft-select--selected-option {
364
- align-self: stretch;
365
- padding-top: calc(${FtSelectCssVariables.labelSize} + 2 * ${FtSelectCssVariables.verticalSpacing});
366
- }
367
-
368
- .ft-select--outlined .ft-select--input-panel {
369
- border-radius: ${FtSelectCssVariables.borderRadiusS};
370
- }
371
-
372
- .ft-select--options {
373
- display: none;
374
- position: absolute;
375
- top: 100%;
376
- left: 0;
377
- right: 0;
378
- color: ${FtSelectCssVariables.optionsColor};
379
- background: ${FtSelectCssVariables.colorSurface};
380
- z-index: ${FtSelectCssVariables.optionsZIndex};
381
- box-shadow: ${FtSelectCssVariables.elevation02};
382
- }
383
-
384
- .ft-select--fixed .ft-select--options {
385
- position: fixed;
386
- right: unset;
387
- /* left and top are set dynamically */
388
- }
389
-
390
- .ft-select--options-displayed .ft-select--options {
391
- display: block;
392
- max-height: ${FtSelectCssVariables.optionsHeight};
393
- overflow-y: auto;
394
- }
395
-
396
- .ft-select--option {
397
- position: relative;
398
- padding: 4px 16px;
399
- min-height: 32px;
400
- display: flex;
401
- align-items: center;
402
- }
403
-
404
- .ft-select--option span {
405
- text-overflow: ellipsis;
406
- overflow: hidden;
407
- }
408
-
409
- .ft-select--helper-text {
410
- padding: 0 12px 0 16px;
411
- color: ${FtSelectCssVariables.helperColor};
412
- }
413
-
414
- .ft-select--in-error .ft-select--helper-text {
415
- color: ${FtSelectCssVariables.colorError};
416
- }
417
- `
254
+ styles
418
255
  ];
419
256
  __decorate([
420
257
  property({ type: String })