@fluid-topics/ft-search-locale-selector 1.0.13 → 1.0.15
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.
|
@@ -1,12 +1,49 @@
|
|
|
1
1
|
import { css } from "lit";
|
|
2
2
|
import { designSystemVariables, FtCssVariableFactory, setVariable } from "@fluid-topics/ft-wc-utils";
|
|
3
3
|
import { FtTooltipCssVariables } from "@fluid-topics/ft-tooltip/build/ft-tooltip.css";
|
|
4
|
+
import { FtTypographyCssVariables } from "@fluid-topics/ft-typography/build/ft-typography.css";
|
|
5
|
+
import { FtFilterCssVariables } from "@fluid-topics/ft-filter/build/ft-filter.css";
|
|
4
6
|
export const FtSearchLocaleSelectorCssVariables = {
|
|
5
7
|
warningIconColor: FtCssVariableFactory.extend("--ft-search-locale-selector-warning-icon-color", designSystemVariables.colorError),
|
|
6
8
|
warningTooltipMaxWidth: FtCssVariableFactory.create("--ft-search-locale-selector-warning-tooltip-max-width", "SIZE", "270px")
|
|
7
9
|
};
|
|
8
10
|
// language=CSS
|
|
9
11
|
export const styles = css `
|
|
12
|
+
[part="container"] {
|
|
13
|
+
flex-grow: 1;
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
max-height: 100%;
|
|
17
|
+
max-width: 100%;
|
|
18
|
+
color: ${FtFilterCssVariables.colorOnSurface};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
[part="container"] > ft-radio-group {
|
|
22
|
+
flex-grow: 1;
|
|
23
|
+
flex-shrink: 1;
|
|
24
|
+
overflow: auto;
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: column;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
[part="header"] {
|
|
30
|
+
display: flex;
|
|
31
|
+
flex-wrap: wrap;
|
|
32
|
+
gap: 4px;
|
|
33
|
+
flex-shrink: 0;
|
|
34
|
+
padding: 0 10px;
|
|
35
|
+
margin-bottom: 8px;
|
|
36
|
+
${setVariable(FtTypographyCssVariables.fontSize, "14px")};
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
[part="label"] {
|
|
40
|
+
display: block;
|
|
41
|
+
flex-shrink: 1;
|
|
42
|
+
flex-grow: 1;
|
|
43
|
+
word-break: break-word;
|
|
44
|
+
${setVariable(FtTypographyCssVariables.lineHeight, "22px")};
|
|
45
|
+
${setVariable(FtTypographyCssVariables.fontWeight, "bold")};
|
|
46
|
+
}
|
|
10
47
|
|
|
11
48
|
[part="warning-tooltip"] {
|
|
12
49
|
${setVariable(FtTooltipCssVariables.maxWidth, FtSearchLocaleSelectorCssVariables.warningTooltipMaxWidth)};
|
|
@@ -16,6 +16,8 @@ import { FtIcon } from "@fluid-topics/ft-icon";
|
|
|
16
16
|
import { FtTooltip } from "@fluid-topics/ft-tooltip";
|
|
17
17
|
import { selectorContext, selectorDefaultMessages } from "./SearchLocaleSelectorMessages";
|
|
18
18
|
import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
|
|
19
|
+
import { FtRadioGroup, FtRadio, } from "@fluid-topics/ft-radio";
|
|
20
|
+
import { FtTypography } from "@fluid-topics/ft-typography";
|
|
19
21
|
class FtSearchLocaleSelector extends withI18n(FtSearchComponent) {
|
|
20
22
|
constructor() {
|
|
21
23
|
super();
|
|
@@ -37,39 +39,33 @@ class FtSearchLocaleSelector extends withI18n(FtSearchComponent) {
|
|
|
37
39
|
` : nothing;
|
|
38
40
|
}
|
|
39
41
|
return html `
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
42
|
+
<div part="container">
|
|
43
|
+
<div part="header">
|
|
44
|
+
<ft-typography variant="overline" part="label">
|
|
45
|
+
${selectorContext.messages.label()}
|
|
46
|
+
</ft-typography>
|
|
47
|
+
${this.currentSearchLocale == null ? html `
|
|
48
|
+
<ft-tooltip slot="label"
|
|
49
|
+
part="warning-tooltip"
|
|
50
|
+
position="${this.warningTooltipPosition}"
|
|
51
|
+
text="${selectorContext.messages.allLanguagesWarningMessage()}">
|
|
52
|
+
<ft-icon value="warning" part="warning-icon"></ft-icon>
|
|
53
|
+
</ft-tooltip>
|
|
54
|
+
` : nothing}
|
|
55
|
+
</div>
|
|
56
|
+
<ft-radio-group @change=${(e) => this.setContentLocale(e)}>
|
|
57
|
+
${repeat(((_c = this.locales) !== null && _c !== void 0 ? _c : []), locale => locale.lang, locale => html `
|
|
58
|
+
<ft-radio .value=${locale.lang}
|
|
59
|
+
?checked=${locale.lang == this.selectedSearchLocale}
|
|
60
|
+
>${locale.label}
|
|
61
|
+
</ft-radio>`)}
|
|
62
|
+
</ft-radio-group>
|
|
63
|
+
</div>
|
|
60
64
|
`;
|
|
61
65
|
}
|
|
62
66
|
setContentLocale(e) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
var _a;
|
|
66
|
-
if (e.detail.length > 0) {
|
|
67
|
-
this.selectedSearchLocale = (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setContentLocale(e.detail[0]);
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
this.selectedSearchLocale = this.currentSearchLocale;
|
|
71
|
-
}
|
|
72
|
-
}, 0);
|
|
67
|
+
var _a;
|
|
68
|
+
this.selectedSearchLocale = (_a = this.stateManager) === null || _a === void 0 ? void 0 : _a.setContentLocale(e.detail);
|
|
73
69
|
}
|
|
74
70
|
updated(props) {
|
|
75
71
|
super.updated(props);
|
|
@@ -83,7 +79,10 @@ FtSearchLocaleSelector.elementDefinitions = {
|
|
|
83
79
|
"ft-icon": FtIcon,
|
|
84
80
|
"ft-tooltip": FtTooltip,
|
|
85
81
|
"ft-filter": FtFilter,
|
|
86
|
-
"ft-filter-option": FtFilterOption
|
|
82
|
+
"ft-filter-option": FtFilterOption,
|
|
83
|
+
"ft-radio-group": FtRadioGroup,
|
|
84
|
+
"ft-radio": FtRadio,
|
|
85
|
+
"ft-typography": FtTypography,
|
|
87
86
|
};
|
|
88
87
|
FtSearchLocaleSelector.styles = styles;
|
|
89
88
|
__decorate([
|