@fluid-topics/ft-notice 1.3.28 → 1.3.29

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,3 +1,11 @@
1
+ export declare enum FtNoticeFamily {
2
+ info = "info",
3
+ warning = "warning",
4
+ error = "error",
5
+ success = "success"
6
+ }
1
7
  export interface FtNoticeProperties {
2
- icon: string;
8
+ family: FtNoticeFamily;
9
+ dense: boolean;
10
+ icon?: string;
3
11
  }
@@ -1 +1,7 @@
1
- export {};
1
+ export var FtNoticeFamily;
2
+ (function (FtNoticeFamily) {
3
+ FtNoticeFamily["info"] = "info";
4
+ FtNoticeFamily["warning"] = "warning";
5
+ FtNoticeFamily["error"] = "error";
6
+ FtNoticeFamily["success"] = "success";
7
+ })(FtNoticeFamily || (FtNoticeFamily = {}));
@@ -2,5 +2,11 @@ export declare const FtNoticeCssVariables: {
2
2
  noticeColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
3
3
  noticeIconColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
4
4
  borderRadius: import("@fluid-topics/ft-wc-utils").FtCssVariable;
5
+ iconSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
6
+ denseIconSize: import("@fluid-topics/ft-wc-utils").FtCssVariable;
7
+ infoColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
8
+ warningColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
9
+ errorColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
10
+ successColor: import("@fluid-topics/ft-wc-utils").FtCssVariable;
5
11
  };
6
12
  export declare const styles: import("lit").CSSResult;
@@ -1,10 +1,16 @@
1
- import { designSystemVariables, FtCssVariableFactory, setVariable } from "@fluid-topics/ft-wc-utils";
1
+ import { designSystemVariables, FtCssVariableFactory } from "@fluid-topics/ft-wc-utils";
2
2
  import { FtIconCssVariables } from "@fluid-topics/ft-icon/build/ft-icon.styles";
3
3
  import { css } from "lit";
4
4
  export const FtNoticeCssVariables = {
5
5
  noticeColor: FtCssVariableFactory.extend("--ft-notice-color", "", designSystemVariables.colorPrimary),
6
6
  noticeIconColor: FtCssVariableFactory.extend("--ft-notice-icon-color", "", designSystemVariables.colorOnPrimary),
7
- borderRadius: FtCssVariableFactory.external(designSystemVariables.borderRadiusS, "Design System")
7
+ borderRadius: FtCssVariableFactory.external(designSystemVariables.borderRadiusS, "Design System"),
8
+ iconSize: FtCssVariableFactory.create("--ft-notice-icon-size", "", "SIZE", "24px"),
9
+ denseIconSize: FtCssVariableFactory.create("--ft-notice-dense-icon-size", "", "SIZE", "16px"),
10
+ infoColor: FtCssVariableFactory.extend("--ft-notice-info-color", "", designSystemVariables.colorInfo),
11
+ warningColor: FtCssVariableFactory.extend("--ft-notice-warning-color", "", designSystemVariables.colorWarning),
12
+ errorColor: FtCssVariableFactory.extend("--ft-notice-error-color", "", designSystemVariables.colorError),
13
+ successColor: FtCssVariableFactory.extend("--ft-notice-success-color", "", designSystemVariables.colorSuccess),
8
14
  };
9
15
  // language=CSS
10
16
  export const styles = css `
@@ -15,7 +21,7 @@ export const styles = css `
15
21
  }
16
22
 
17
23
  ft-icon {
18
- ${setVariable(FtIconCssVariables.size, "24px")};
24
+ ${FtIconCssVariables.size.set(FtNoticeCssVariables.iconSize)};
19
25
  padding: 0 8px;
20
26
  display: flex;
21
27
  align-self: center;
@@ -36,4 +42,93 @@ export const styles = css `
36
42
  border-bottom-right-radius: ${FtNoticeCssVariables.borderRadius};
37
43
  border: 1px solid ${FtNoticeCssVariables.noticeColor};
38
44
  }
45
+
46
+
47
+ .dense {
48
+ [part="icon"] {
49
+ background-color: transparent;
50
+ padding: 0;
51
+ color: ${FtNoticeCssVariables.noticeColor};
52
+ }
53
+
54
+ ft-icon {
55
+ padding: 0 4px 0 0;
56
+ ${FtIconCssVariables.size.set(FtNoticeCssVariables.denseIconSize)};
57
+ margin-top: 1px;
58
+ }
59
+
60
+ [part="label"] {
61
+ padding: 0;
62
+ border: none;
63
+ color: ${FtNoticeCssVariables.noticeColor};
64
+ }
65
+ }
66
+
67
+ .info {
68
+ [part="icon"] {
69
+ background-color: ${FtNoticeCssVariables.infoColor};
70
+ }
71
+
72
+ [part="label"] {
73
+ border-color: ${FtNoticeCssVariables.infoColor};
74
+ }
75
+
76
+ &.dense {
77
+ [part="icon"], [part="label"] {
78
+ background-color: transparent;
79
+ color: ${FtNoticeCssVariables.infoColor};
80
+ }
81
+ }
82
+ }
83
+
84
+ .warning {
85
+ [part="icon"] {
86
+ background-color: ${FtNoticeCssVariables.warningColor};
87
+ }
88
+
89
+ [part="label"] {
90
+ border-color: ${FtNoticeCssVariables.warningColor};
91
+ }
92
+
93
+ &.dense {
94
+ [part="icon"], [part="label"] {
95
+ background-color: transparent;
96
+ color: ${FtNoticeCssVariables.warningColor};
97
+ }
98
+ }
99
+ }
100
+
101
+ .error {
102
+ [part="icon"] {
103
+ background-color: ${FtNoticeCssVariables.errorColor};
104
+ }
105
+
106
+ [part="label"] {
107
+ border-color: ${FtNoticeCssVariables.errorColor};
108
+ }
109
+
110
+ &.dense {
111
+ [part="icon"], [part="label"] {
112
+ background-color: transparent;
113
+ color: ${FtNoticeCssVariables.errorColor};
114
+ }
115
+ }
116
+ }
117
+
118
+ .success {
119
+ [part="icon"] {
120
+ background-color: ${FtNoticeCssVariables.successColor};
121
+ }
122
+
123
+ [part="label"] {
124
+ border-color: ${FtNoticeCssVariables.successColor};
125
+ }
126
+
127
+ &.dense {
128
+ [part="icon"], [part="label"] {
129
+ background-color: transparent;
130
+ color: ${FtNoticeCssVariables.successColor};
131
+ }
132
+ }
133
+ }
39
134
  `;
@@ -1,15 +1,18 @@
1
- import { FtBaseNotice } from "./ft-base-notice";
2
1
  import { FtTypographyVariants } from "@fluid-topics/ft-typography";
3
2
  import { FtdsNoticeProperties, FtdsNoticeVariant } from "./ftds-notice.properties";
4
3
  import { PropertyValues } from "lit";
5
- export declare class FtdsNotice extends FtBaseNotice implements FtdsNoticeProperties {
4
+ import { DesignSystemFamily, ElementDefinitionsMap, FtdsBase } from "@fluid-topics/ft-wc-utils";
5
+ export declare class FtdsNotice extends FtdsBase implements FtdsNoticeProperties {
6
+ static elementDefinitions: ElementDefinitionsMap;
6
7
  static styles: import("lit").CSSResult;
7
- get typographyVariant(): FtTypographyVariants;
8
- get noticeClasses(): Record<string, boolean>;
9
- variant: FtdsNoticeVariant;
10
8
  collapsible: boolean;
11
9
  dense: boolean;
12
- forcedIcon: string | undefined;
13
- private iconByVariant;
14
- protected update(props: PropertyValues): void;
10
+ icon?: string;
11
+ family: DesignSystemFamily;
12
+ variant?: FtdsNoticeVariant;
13
+ forcedIcon?: string;
14
+ private iconByFamily;
15
+ protected willUpdate(props: PropertyValues): void;
16
+ protected render(): import("lit-html").TemplateResult<1>;
17
+ get typographyVariant(): FtTypographyVariants;
15
18
  }
@@ -4,54 +4,91 @@ 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 { FtBaseNotice } from "./ft-base-notice";
8
- import { FtTypographyVariants } from "@fluid-topics/ft-typography";
7
+ import { FtTypography, FtTypographyVariants } from "@fluid-topics/ft-typography";
9
8
  import { FtdsNoticeVariant } from "./ftds-notice.properties";
10
9
  import { dsStyles } from "./ftds-notice.styles";
11
10
  import { property } from "lit/decorators.js";
12
- import { FtIcons } from "@fluid-topics/ft-icon";
13
- class FtdsNotice extends FtBaseNotice {
11
+ import { html } from "lit";
12
+ import { FtIcon, FtIcons } from "@fluid-topics/ft-icon";
13
+ import { classMap } from "lit/directives/class-map.js";
14
+ import { DesignSystemFamily, FtdsBase } from "@fluid-topics/ft-wc-utils";
15
+ class FtdsNotice extends FtdsBase {
14
16
  constructor() {
15
17
  super(...arguments);
16
- this.variant = FtdsNoticeVariant.info;
17
18
  this.collapsible = false;
18
19
  this.dense = false;
19
- this.forcedIcon = undefined;
20
- this.iconByVariant = {
21
- error: FtIcons.CLOSE_PLAIN,
22
- info: FtIcons.INFO,
23
- success: FtIcons.CHECK_PLAIN,
24
- warning: FtIcons.WARNING,
20
+ // Override default value
21
+ this.family = DesignSystemFamily.info;
22
+ this.iconByFamily = {
23
+ [DesignSystemFamily.error]: FtIcons.CLOSE_PLAIN,
24
+ [DesignSystemFamily.info]: FtIcons.INFO,
25
+ [DesignSystemFamily.success]: FtIcons.CHECK_PLAIN,
26
+ [DesignSystemFamily.warning]: FtIcons.WARNING,
25
27
  };
26
28
  }
27
- get typographyVariant() {
28
- return this.dense ? FtTypographyVariants.caption1medium : FtTypographyVariants.body2regular;
29
+ willUpdate(props) {
30
+ super.willUpdate(props);
31
+ if (props.has("variant") && this.variant) {
32
+ switch (this.variant) {
33
+ case FtdsNoticeVariant.info:
34
+ this.family = DesignSystemFamily.info;
35
+ break;
36
+ case FtdsNoticeVariant.success:
37
+ this.family = DesignSystemFamily.success;
38
+ break;
39
+ case FtdsNoticeVariant.warning:
40
+ this.family = DesignSystemFamily.warning;
41
+ break;
42
+ case FtdsNoticeVariant.error:
43
+ this.family = DesignSystemFamily.error;
44
+ break;
45
+ }
46
+ }
47
+ if (props.has("forcedIcon") && this.forcedIcon) {
48
+ this.icon = this.forcedIcon;
49
+ }
29
50
  }
30
- get noticeClasses() {
31
- return {
32
- [this.variant]: true,
33
- collapsible: this.collapsible,
34
- dense: this.dense,
51
+ render() {
52
+ const classes = {
53
+ "ftds-notice--collapsible": this.collapsible,
54
+ "ftds-notice--dense": this.dense,
55
+ ...this.getDesignSystemBaseClasses(),
35
56
  };
57
+ return html `
58
+ <div class="${classMap(classes)}" part="container">
59
+ <div part="icon">
60
+ <ft-icon value="${this.icon || this.iconByFamily[this.family]}"></ft-icon>
61
+ </div>
62
+ <ft-typography part="label" variant="${this.typographyVariant}">
63
+ <slot></slot>
64
+ </ft-typography>
65
+ </div>
66
+ `;
36
67
  }
37
- update(props) {
38
- var _a;
39
- super.update(props);
40
- if (props.has("variant") || props.has("forcedIcon")) {
41
- this.icon = (_a = this.forcedIcon) !== null && _a !== void 0 ? _a : this.iconByVariant[this.variant];
42
- }
68
+ get typographyVariant() {
69
+ return this.dense ? FtTypographyVariants.caption1medium : FtTypographyVariants.body2regular;
43
70
  }
44
71
  }
72
+ FtdsNotice.elementDefinitions = {
73
+ "ft-icon": FtIcon,
74
+ "ft-typography": FtTypography,
75
+ };
45
76
  FtdsNotice.styles = dsStyles;
46
- __decorate([
47
- property()
48
- ], FtdsNotice.prototype, "variant", void 0);
49
77
  __decorate([
50
78
  property({ type: Boolean })
51
79
  ], FtdsNotice.prototype, "collapsible", void 0);
52
80
  __decorate([
53
81
  property({ type: Boolean })
54
82
  ], FtdsNotice.prototype, "dense", void 0);
83
+ __decorate([
84
+ property({ type: String })
85
+ ], FtdsNotice.prototype, "icon", void 0);
86
+ __decorate([
87
+ property()
88
+ ], FtdsNotice.prototype, "family", void 0);
89
+ __decorate([
90
+ property()
91
+ ], FtdsNotice.prototype, "variant", void 0);
55
92
  __decorate([
56
93
  property()
57
94
  ], FtdsNotice.prototype, "forcedIcon", void 0);
@@ -1,12 +1,17 @@
1
+ import { FtdsBaseProperties } from "@fluid-topics/ft-wc-utils";
2
+ /** @deprecated */
1
3
  export declare enum FtdsNoticeVariant {
2
4
  info = "info",
3
5
  warning = "warning",
4
6
  error = "error",
5
7
  success = "success"
6
8
  }
7
- export interface FtdsNoticeProperties {
8
- variant: FtdsNoticeVariant;
9
+ export interface FtdsNoticeProperties extends Omit<FtdsBaseProperties, "size"> {
9
10
  collapsible: boolean;
10
11
  dense: boolean;
11
- forcedIcon: string | undefined;
12
+ icon?: string;
13
+ /** @deprecated */
14
+ variant?: FtdsNoticeVariant;
15
+ /** @deprecated */
16
+ forcedIcon?: string;
12
17
  }
@@ -1,3 +1,4 @@
1
+ /** @deprecated */
1
2
  export var FtdsNoticeVariant;
2
3
  (function (FtdsNoticeVariant) {
3
4
  FtdsNoticeVariant["info"] = "info";
@@ -1,4 +1,3 @@
1
- import { setVariable } from "@fluid-topics/ft-wc-utils";
2
1
  import { FtIconCssVariables } from "@fluid-topics/ft-icon/build/ft-icon.styles";
3
2
  import { css } from "lit";
4
3
  import { notice } from "@fluid-topics/design-system-variables";
@@ -14,69 +13,73 @@ export const dsStyles = css `
14
13
  border-radius: ${notice.borderRadius};
15
14
  padding: ${notice.verticalPadding} ${notice.horizontalPadding};
16
15
  gap: ${notice.gap};
16
+
17
+ ${FtIconCssVariables.size.set(notice.iconSize)};
18
+
19
+ &.ftds-notice--dense {
20
+ background-color: transparent;
21
+ border: ${notice.denseBorderWidth};
22
+ font-size: 16px;
23
+ gap: ${notice.denseGap};
24
+ padding: ${notice.denseVerticalPadding} ${notice.denseHorizontalPadding};
25
+
26
+ ${FtIconCssVariables.size.set(notice.denseIconSize)};
27
+ }
17
28
  }
18
29
 
19
- .info {
30
+ [part="icon"] {
31
+ align-self: baseline;
32
+ display: flex;
33
+ align-items: flex-start;
34
+ }
35
+
36
+ .ftds-notice--collapsible [part="label"] {
37
+ display: none;
38
+ }
39
+
40
+ .ftds-notice--collapsible:hover [part="label"] {
41
+ display: initial;
42
+ }
43
+
44
+ /** Family styles **/
45
+
46
+ .ftds--family-info {
20
47
  color: ${notice.infoColor};
21
48
  border-color: ${notice.infoBorderColor};
22
49
  background-color: ${notice.infoBackgroundColor};
23
- }
24
50
 
25
- .info [part="icon"] {
26
- color: ${notice.infoIconColor};
51
+ [part="icon"] {
52
+ color: ${notice.infoIconColor};
53
+ }
27
54
  }
28
55
 
29
- .warning {
56
+ .ftds--family-warning {
30
57
  color: ${notice.warningColor};
31
58
  border-color: ${notice.warningBorderColor};
32
59
  background-color: ${notice.warningBackgroundColor};
33
- }
34
60
 
35
- .warning [part="icon"] {
36
- color: ${notice.warningIconColor};
61
+ [part="icon"] {
62
+ color: ${notice.warningIconColor};
63
+ }
37
64
  }
38
65
 
39
- .error {
66
+ .ftds--family-error {
40
67
  color: ${notice.errorColor};
41
68
  border-color: ${notice.errorBorderColor};
42
69
  background-color: ${notice.errorBackgroundColor};
43
- }
44
70
 
45
- .error [part="icon"] {
46
- color: ${notice.errorIconColor};
71
+ [part="icon"] {
72
+ color: ${notice.errorIconColor};
73
+ }
47
74
  }
48
75
 
49
- .success {
76
+ .ftds--family-success {
50
77
  color: ${notice.successColor};
51
78
  border-color: ${notice.successBorderColor};
52
79
  background-color: ${notice.successBackgroundColor};
53
- }
54
-
55
- .success [part="icon"] {
56
- color: ${notice.successIconColor};
57
- }
58
-
59
- ft-icon {
60
- ${setVariable(FtIconCssVariables.size, notice.iconSize)};
61
- }
62
-
63
- [part="icon"] {
64
- display: flex;
65
- align-items: flex-start;
66
- }
67
-
68
- .collapsible [part="label"] {
69
- display: none;
70
- }
71
-
72
- .collapsible:hover [part="label"] {
73
- display: initial;
74
- }
75
80
 
76
- .dense {
77
- background-color: transparent;
78
- border: ${notice.denseBorderWidth};
79
- font-size: 16px;
80
- ${notice.gap.set("4px")};
81
+ [part="icon"] {
82
+ color: ${notice.successIconColor};
83
+ }
81
84
  }
82
85
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-notice",
3
- "version": "1.3.28",
3
+ "version": "1.3.29",
4
4
  "description": "Notice to display different messages",
5
5
  "keywords": [
6
6
  "Lit"
@@ -20,10 +20,10 @@
20
20
  },
21
21
  "dependencies": {
22
22
  "@fluid-topics/design-system-variables": "2.53.0",
23
- "@fluid-topics/ft-icon": "1.3.28",
24
- "@fluid-topics/ft-typography": "1.3.28",
25
- "@fluid-topics/ft-wc-utils": "1.3.28",
23
+ "@fluid-topics/ft-icon": "1.3.29",
24
+ "@fluid-topics/ft-typography": "1.3.29",
25
+ "@fluid-topics/ft-wc-utils": "1.3.29",
26
26
  "lit": "3.1.0"
27
27
  },
28
- "gitHead": "face2509aeead24e78a16af4ffd2123ef281dac2"
28
+ "gitHead": "52269062e529467d8df60dc7fe7ee1e174c90ada"
29
29
  }
@@ -1,9 +0,0 @@
1
- import { ElementDefinitionsMap, FtLitElement } from "@fluid-topics/ft-wc-utils";
2
- import { FtTypographyVariants } from "@fluid-topics/ft-typography";
3
- export declare abstract class FtBaseNotice extends FtLitElement {
4
- abstract get typographyVariant(): FtTypographyVariants;
5
- abstract get noticeClasses(): Record<string, boolean>;
6
- static elementDefinitions: ElementDefinitionsMap;
7
- icon: string;
8
- protected render(): import("lit-html").TemplateResult<1>;
9
- }
@@ -1,38 +0,0 @@
1
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
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
- return c > 3 && r && Object.defineProperty(target, key, r), r;
6
- };
7
- import { html } from "lit";
8
- import { property } from "lit/decorators.js";
9
- import { FtLitElement } from "@fluid-topics/ft-wc-utils";
10
- import { FtIcon } from "@fluid-topics/ft-icon";
11
- import { FtTypography } from "@fluid-topics/ft-typography";
12
- import { classMap } from "lit/directives/class-map.js";
13
- class FtBaseNotice extends FtLitElement {
14
- constructor() {
15
- super(...arguments);
16
- this.icon = "info";
17
- }
18
- render() {
19
- return html `
20
- <div class="${classMap(this.noticeClasses)}" part="container">
21
- <div part="icon">
22
- <ft-icon value="${this.icon}"></ft-icon>
23
- </div>
24
- <ft-typography part="label" variant="${this.typographyVariant}">
25
- <slot></slot>
26
- </ft-typography>
27
- </div>
28
- `;
29
- }
30
- }
31
- FtBaseNotice.elementDefinitions = {
32
- "ft-icon": FtIcon,
33
- "ft-typography": FtTypography
34
- };
35
- __decorate([
36
- property({ type: String })
37
- ], FtBaseNotice.prototype, "icon", void 0);
38
- export { FtBaseNotice };