@fluid-topics/ft-button 1.0.59 → 1.0.61

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,17 +1,8 @@
1
- import { Position } from "@fluid-topics/ft-tooltip/build/ft-tooltip.properties";
2
- import { FtIconVariants } from "@fluid-topics/ft-icon/build/ft-icon.properties";
3
- export interface FtButtonProperties {
1
+ import { FtBaseButtonProperties } from "./ft-base-button";
2
+ export interface FtButtonProperties extends FtBaseButtonProperties {
4
3
  primary?: boolean;
5
4
  outlined?: boolean;
6
5
  disabled?: boolean;
7
6
  dense?: boolean;
8
7
  round?: boolean;
9
- label?: string;
10
- icon?: string;
11
- iconVariant?: FtIconVariants;
12
- trailingIcon?: boolean;
13
- loading?: boolean;
14
- tooltipPosition?: Position;
15
- hideTooltip?: boolean;
16
- forceTooltip?: boolean;
17
8
  }
@@ -0,0 +1,2 @@
1
+ export { button as FtdsButtonCssVariables } from "@fluid-topics/design-system-variables";
2
+ export declare const designSystemStyles: import("lit").CSSResult[];
@@ -0,0 +1,230 @@
1
+ import { css, } from "lit";
2
+ import { noTextSelect, setVariable } from "@fluid-topics/ft-wc-utils";
3
+ import { FtRippleCssVariables } from "@fluid-topics/ft-ripple/build/ft-ripple.css";
4
+ import { FtLoaderCssVariables } from "@fluid-topics/ft-loader/build/ft-loader.css";
5
+ import { FtIconCssVariables } from "@fluid-topics/ft-icon/build/ft-icon.css";
6
+ import { button } from "@fluid-topics/design-system-variables";
7
+ export { button as FtdsButtonCssVariables } from "@fluid-topics/design-system-variables";
8
+ //language=css
9
+ export const designSystemStyles = [
10
+ css `
11
+ :host {
12
+ display: inline-block;
13
+ max-width: 100%;
14
+ pointer-events: none;
15
+ }
16
+
17
+ /** Remove default button styles **/
18
+
19
+ button {
20
+ box-shadow: 0 0 0 transparent;
21
+ border: 0 solid transparent;
22
+ text-shadow: 0 0 0 transparent;
23
+ }
24
+
25
+ button:hover {
26
+ box-shadow: 0 0 0 transparent;
27
+ text-shadow: 0 0 0 transparent;
28
+ }
29
+
30
+ button:active {
31
+ outline: none;
32
+ }
33
+
34
+ button:focus {
35
+ outline: 0;
36
+ }
37
+
38
+ /** Base styles **/
39
+
40
+ .ft-button {
41
+ position: relative;
42
+ display: flex;
43
+ justify-content: center;
44
+ align-items: center;
45
+ width: 100%;
46
+ overflow: hidden;
47
+ box-sizing: border-box;
48
+ pointer-events: auto;
49
+ }
50
+
51
+ .ft-button:not([disabled]):hover {
52
+ cursor: pointer;
53
+ }
54
+
55
+ .ft-button:focus {
56
+ outline: none;
57
+ }
58
+
59
+ .ft-button:focus-visible {
60
+ outline-color: ${button.focusFocusRingColor};
61
+ outline-style: solid;
62
+ }
63
+
64
+ ft-icon {
65
+ flex-shrink: 0;
66
+ position: relative;
67
+ }
68
+
69
+ .ft-button:not(.ft-button--trailing-icon) ft-icon,
70
+ .ft-button:not(.ft-button--trailing-icon) ft-loader {
71
+ order: -1;
72
+ }
73
+
74
+ .ft-button--label {
75
+ position: relative;
76
+ overflow: hidden;
77
+ white-space: nowrap;
78
+ text-overflow: ellipsis;
79
+ display: block;
80
+ }
81
+
82
+ .ft-button--label[hidden] {
83
+ display: none;
84
+ }
85
+
86
+ /** Primary styles **/
87
+
88
+ .ft-button--primary {
89
+ ${setVariable(FtLoaderCssVariables.color, button.primaryIconColor)};
90
+
91
+ ${setVariable(FtRippleCssVariables.color, button.primaryStateLayerColor)};
92
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.primaryStateLayerOpacityHover)};
93
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.primaryStateLayerOpacityFocus)};
94
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.primaryStateLayerOpacityActive)};
95
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.primaryStateLayerOpacityActive)};
96
+
97
+ background-color: ${button.primaryBackgroundColor};
98
+ color: ${button.primaryColor};
99
+ border-style: none;
100
+ }
101
+
102
+ .ft-button--primary[disabled] {
103
+ opacity: ${button.primaryComponentOpacityDisabled};
104
+ }
105
+
106
+ .ft-button--primary ft-icon {
107
+ color: ${button.primaryIconColor};
108
+ }
109
+
110
+ /** Secondary styles **/
111
+
112
+ .ft-button--secondary {
113
+ ${setVariable(FtLoaderCssVariables.color, button.secondaryIconColor)};
114
+
115
+ ${setVariable(FtRippleCssVariables.color, button.secondaryStateLayerColor)};
116
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.secondaryStateLayerOpacityHover)};
117
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.secondaryStateLayerOpacityFocus)};
118
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.secondaryStateLayerOpacityActive)};
119
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.secondaryStateLayerOpacityActive)};
120
+
121
+ background-color: ${button.secondaryBackgroundColor};
122
+ color: ${button.secondaryColor};
123
+ border-color: ${button.secondaryBorderColor};
124
+ border-style: solid;
125
+ }
126
+
127
+ .ft-button--secondary[disabled] {
128
+ opacity: ${button.secondaryComponentOpacityDisabled};
129
+ }
130
+
131
+ .ft-button--secondary ft-icon {
132
+ color: ${button.secondaryIconColor};
133
+ }
134
+
135
+ /** Tertiary styles **/
136
+
137
+ .ft-button--tertiary {
138
+ ${setVariable(FtLoaderCssVariables.color, button.tertiaryIconColor)};
139
+
140
+ ${setVariable(FtRippleCssVariables.color, button.tertiaryStateLayerColor)};
141
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.tertiaryStateLayerOpacityHover)};
142
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.tertiaryStateLayerOpacityFocus)};
143
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.tertiaryStateLayerOpacityActive)};
144
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.tertiaryStateLayerOpacityActive)};
145
+
146
+ background-color: ${button.tertiaryBackgroundColor};
147
+ color: ${button.tertiaryColor};
148
+ border-style: none;
149
+ }
150
+
151
+ .ft-button--tertiary[disabled] {
152
+ opacity: ${button.tertiaryComponentOpacityDisabled};
153
+ }
154
+
155
+ .ft-button--tertiary ft-icon {
156
+ color: ${button.tertiaryIconColor};
157
+ }
158
+
159
+ /** Neutral styles **/
160
+
161
+ .ft-button--neutral {
162
+ ${setVariable(FtLoaderCssVariables.color, button.neutralIconColor)};
163
+
164
+ ${setVariable(FtRippleCssVariables.backgroundColor, button.neutralStateLayerColor)};
165
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceHover, button.neutralStateLayerOpacityHover)};
166
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceFocused, button.neutralStateLayerOpacityFocus)};
167
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfaceSelected, button.neutralStateLayerOpacityActive)};
168
+ ${setVariable(FtRippleCssVariables.opacityContentOnSurfacePressed, button.neutralStateLayerOpacityActive)};
169
+
170
+ background-color: ${button.neutralBackgroundColor};
171
+ color: ${button.neutralColor};
172
+ border-style: none;
173
+ }
174
+
175
+ .ft-button--neutral[disabled] {
176
+ opacity: ${button.neutralComponentOpacityDisabled};
177
+ }
178
+
179
+ .ft-button--neutral ft-icon {
180
+ color: ${button.neutralIconColor};
181
+ }
182
+
183
+ /** Large styles **/
184
+
185
+ .ft-button--large {
186
+ ${setVariable(FtIconCssVariables.size, button.largeIconSize)};
187
+ ${setVariable(FtLoaderCssVariables.size, button.largeIconSize)};
188
+
189
+ height: ${button.largeHeight};
190
+ padding: 0 ${button.largeHorizontalPadding};
191
+ gap: ${button.largeGap};
192
+ border-radius: ${button.largeBorderRadius};
193
+ border-width: ${button.largeBorderWidth};
194
+ }
195
+
196
+ .ft-button--large:focus-visible {
197
+ outline-width: ${button.largeFocusOutlineWidth};
198
+ outline-offset: ${button.largeFocusOutlineOffset};
199
+ }
200
+
201
+ .ft-button--large.ft-button--icon-only {
202
+ width: ${button.largeIconOnlyWidth};
203
+ padding: unset;
204
+ }
205
+
206
+ /** Small styles **/
207
+
208
+ .ft-button--small {
209
+ ${setVariable(FtIconCssVariables.size, button.smallIconSize)};
210
+ ${setVariable(FtLoaderCssVariables.size, button.smallIconSize)};
211
+
212
+ height: ${button.smallHeight};
213
+ padding: 0 ${button.smallHorizontalPadding};
214
+ gap: ${button.smallGap};
215
+ border-radius: ${button.smallBorderRadius};
216
+ border-width: ${button.smallBorderWidth};
217
+ }
218
+
219
+ .ft-button--small:focus-visible {
220
+ outline-width: ${button.smallFocusOutlineWidth};
221
+ outline-offset: ${button.smallFocusOutlineOffset};
222
+ }
223
+
224
+ .ft-button--small.ft-button--icon-only {
225
+ width: ${button.smallIconOnlyWidth};
226
+ padding: unset;
227
+ }
228
+ `,
229
+ noTextSelect
230
+ ];
@@ -0,0 +1,13 @@
1
+ import { FtBaseButton } from "./ft-base-button";
2
+ import { FtdsButtonProperties } from "./ftds-button.properties";
3
+ import { ClassInfo } from "lit/directives/class-map.js";
4
+ export declare class FtdsButton extends FtBaseButton implements FtdsButtonProperties {
5
+ primary: boolean;
6
+ secondary: boolean;
7
+ tertiary: boolean;
8
+ neutral: boolean;
9
+ small: boolean;
10
+ static styles: (import("lit").CSSResult | import("lit").CSSResult[])[];
11
+ get buttonClasses(): ClassInfo;
12
+ get typographyVariant(): string;
13
+ }
@@ -0,0 +1,60 @@
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 { FtBaseButton } from "./ft-base-button";
8
+ import { property } from "lit/decorators.js";
9
+ import { FtTypographyVariants } from "@fluid-topics/ft-typography/build/ft-typography.properties";
10
+ import { safariEllipsisFix } from "@fluid-topics/ft-wc-utils";
11
+ import { designSystemStyles } from "./ftds-button.css";
12
+ class FtdsButton extends FtBaseButton {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.primary = false;
16
+ this.secondary = false;
17
+ this.tertiary = false;
18
+ this.neutral = false;
19
+ this.small = false;
20
+ }
21
+ get buttonClasses() {
22
+ return {
23
+ "ft-button": true,
24
+ "ft-button--primary": this.primary,
25
+ "ft-button--secondary": this.secondary,
26
+ "ft-button--tertiary": this.tertiary || (!this.primary && !this.secondary && !this.neutral),
27
+ "ft-button--neutral": this.neutral,
28
+ "ft-button--large": !this.small,
29
+ "ft-button--small": this.small,
30
+ "ft-button--icon-only": !this.hasTextContent(),
31
+ "ft-button--trailing-icon": this.trailingIcon,
32
+ "ft-button--loading": this.trailingIcon,
33
+ "ft-no-text-select": true,
34
+ "ft-button--no-icon": !this.icon,
35
+ };
36
+ }
37
+ get typographyVariant() {
38
+ return this.small ? FtTypographyVariants.caption1medium : FtTypographyVariants.body2medium;
39
+ }
40
+ }
41
+ FtdsButton.styles = [
42
+ safariEllipsisFix,
43
+ designSystemStyles
44
+ ];
45
+ __decorate([
46
+ property({ type: Boolean })
47
+ ], FtdsButton.prototype, "primary", void 0);
48
+ __decorate([
49
+ property({ type: Boolean })
50
+ ], FtdsButton.prototype, "secondary", void 0);
51
+ __decorate([
52
+ property({ type: Boolean })
53
+ ], FtdsButton.prototype, "tertiary", void 0);
54
+ __decorate([
55
+ property({ type: Boolean })
56
+ ], FtdsButton.prototype, "neutral", void 0);
57
+ __decorate([
58
+ property({ type: Boolean })
59
+ ], FtdsButton.prototype, "small", void 0);
60
+ export { FtdsButton };
@@ -0,0 +1,8 @@
1
+ import { FtBaseButtonProperties } from "./ft-base-button";
2
+ export interface FtdsButtonProperties extends FtBaseButtonProperties {
3
+ primary?: boolean;
4
+ secondary?: boolean;
5
+ tertiary?: boolean;
6
+ neutral?: boolean;
7
+ small?: boolean;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
package/build/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
1
  export * from "./ft-button";
2
2
  export * from "./ft-button.css";
3
3
  export * from "./ft-button.properties";
4
+ export * from "./ftds-button";
5
+ export * from "./ftds-button.css";
6
+ export * from "./ftds-button.properties";
package/build/index.js CHANGED
@@ -1,6 +1,11 @@
1
1
  import { customElement } from "@fluid-topics/ft-wc-utils";
2
2
  import { FtButton } from "./ft-button";
3
+ import { FtdsButton } from "./ftds-button";
3
4
  export * from "./ft-button";
4
5
  export * from "./ft-button.css";
5
6
  export * from "./ft-button.properties";
7
+ export * from "./ftds-button";
8
+ export * from "./ftds-button.css";
9
+ export * from "./ftds-button.properties";
6
10
  customElement("ft-button")(FtButton);
11
+ customElement("ftds-button")(FtdsButton);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluid-topics/ft-button",
3
- "version": "1.0.59",
3
+ "version": "1.0.61",
4
4
  "description": "A generic Fluid Topics tag",
5
5
  "keywords": [
6
6
  "Lit"
@@ -19,13 +19,13 @@
19
19
  "url": "ssh://git@scm.mrs.antidot.net:2222/fluidtopics/ft-web-components.git"
20
20
  },
21
21
  "dependencies": {
22
- "@fluid-topics/ft-icon": "1.0.59",
23
- "@fluid-topics/ft-loader": "1.0.59",
24
- "@fluid-topics/ft-ripple": "1.0.59",
25
- "@fluid-topics/ft-tooltip": "1.0.59",
26
- "@fluid-topics/ft-typography": "1.0.59",
27
- "@fluid-topics/ft-wc-utils": "1.0.59",
22
+ "@fluid-topics/ft-icon": "1.0.61",
23
+ "@fluid-topics/ft-loader": "1.0.61",
24
+ "@fluid-topics/ft-ripple": "1.0.61",
25
+ "@fluid-topics/ft-tooltip": "1.0.61",
26
+ "@fluid-topics/ft-typography": "1.0.61",
27
+ "@fluid-topics/ft-wc-utils": "1.0.61",
28
28
  "lit": "2.7.2"
29
29
  },
30
- "gitHead": "9412dc7c29ebc722b1b133bba63b1744f4bfdf60"
30
+ "gitHead": "c2a916c32bd1fe396316800c6afd78662ed27409"
31
31
  }