@warp-ds/elements 2.8.2-next.6 → 2.9.0-next.1

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.
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { Button } from './react';
4
4
  declare const _default: {
5
5
  title: string;
6
- render(args: Omit<React.HTMLAttributes<import("./button").WarpButton>, "value" | "form" | "small" | "name" | "rel" | "_classes" | "render" | "renderOptions" | "connectedCallback" | "disconnectedCallback" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "variant" | "quiet" | "href" | "target" | "fullWidth" | "type" | "loading" | "buttonClass" | "ariaValueTextLoading" | "updated" | "firstUpdated" | "_primaryClasses" | "_secondaryClasses" | "_utilityClasses" | "_negativeClasses" | "_pillClasses" | "_linkClasses" | "_handleButtonClick" | "resetFormControl" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate"> & {} & Partial<Omit<import("./button").WarpButton, keyof HTMLElement>> & React.RefAttributes<import("./button").WarpButton>): React.JSX.Element;
6
+ render(args: Omit<React.HTMLAttributes<import("./button").WarpButton>, "value" | "form" | "small" | "name" | "rel" | "render" | "renderOptions" | "connectedCallback" | "disconnectedCallback" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "variant" | "quiet" | "href" | "disabled" | "target" | "fullWidth" | "type" | "iconOnly" | "loading" | "buttonClass" | "ariaValueTextLoading" | "updated" | "firstUpdated" | "_handleButtonClick" | "resetFormControl" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate"> & {} & Partial<Omit<import("./button").WarpButton, keyof HTMLElement>> & React.RefAttributes<import("./button").WarpButton>): React.JSX.Element;
7
7
  component: import("@lit/react").ReactWebComponent<import("./button").WarpButton, {}>;
8
8
  };
9
9
  export default _default;
@@ -0,0 +1 @@
1
+ export declare const wButtonStyles: import("lit").CSSResult;
@@ -0,0 +1,282 @@
1
+ import { css } from "lit";
2
+ export const wButtonStyles = css `
3
+ :host {
4
+ /* Local scoped variables, given the default button (the secondary variant) as a default */
5
+ --_background: var(--background, var(--w-s-color-background));
6
+ --_background-hover: var(
7
+ --background-hover,
8
+ var(--w-s-color-background-hover)
9
+ );
10
+ --_background-active: var(
11
+ --background-active,
12
+ var(--w-s-color-background-active)
13
+ );
14
+ --_text-color: var(--color, var(--w-s-color-text-link));
15
+ --_text-color-hover: var(--color-hover, var(--w-s-color-text-link));
16
+ --_text-color-active: var(--color-active, var(--w-s-color-text-link));
17
+ --_border-width: var(--border-width, 2px);
18
+ --_border: var(--border, var(--w-s-color-border));
19
+ --_border-hover: var(--border-hover, var(--w-s-color-border-hover));
20
+ --_border-active: var(--border-active, var(--w-s-color-border-active));
21
+ --_border-radius: var(--border-radius, var(--w-button-radius-default, 8px));
22
+ --_font-size: var(--font-size, var(--w-font-size-m));
23
+ --_line-height: var(--line-height, var(--w-line-height-m));
24
+ --_font-weight: var(--font-weight, bold);
25
+ --_padding-x: var(--padding-x, 16px);
26
+ --_padding-y: var(--padding-y, 13px);
27
+ }
28
+
29
+ button {
30
+ /* Base setup for all buttons */
31
+ display: inline-flex;
32
+ justify-content: center;
33
+ align-items: center;
34
+ text-align: center;
35
+ cursor: pointer;
36
+ transition:
37
+ color 150ms cubic-bezier(0.4, 0, 0.2, 1),
38
+ background-color 150ms cubic-bezier(0.4, 0, 0.2, 1),
39
+ border-color 150ms cubic-bezier(0.4, 0, 0.2, 1),
40
+ fill 150ms cubic-bezier(0.4, 0, 0.2, 1),
41
+ stroke 150ms cubic-bezier(0.4, 0, 0.2, 1);
42
+
43
+ /* Hook the local vars up to the button stuff */
44
+ background-color: var(--_background);
45
+ color: var(--_text-color);
46
+ border: var(--_border-width) solid var(--_border);
47
+ border-radius: var(--_border-radius);
48
+ padding: calc(var(--_padding-y) - var(--_border-width))
49
+ calc(var(--_padding-x) - var(--_border-width));
50
+ font-size: var(--_font-size);
51
+ line-height: var(--_line-height);
52
+ font-weight: var(--_font-weight);
53
+ }
54
+
55
+ button:hover {
56
+ background-color: var(--_background-hover);
57
+ border-color: var(--_border-hover);
58
+ color: var(--_text-color-hover);
59
+ }
60
+
61
+ button:active {
62
+ background-color: var(--_background-active);
63
+ border-color: var(--_border-active);
64
+ color: var(--_text-color-active);
65
+ }
66
+
67
+ button:focus-visible {
68
+ outline: 2px solid var(--w-s-color-border-focus);
69
+ outline-offset: var(--w-outline-offset, 1px);
70
+ }
71
+
72
+ /* Variants config */
73
+ :host([variant="primary"]) {
74
+ --background: var(--w-s-color-background-primary);
75
+ --background-hover: var(--w-s-color-background-primary-hover);
76
+ --background-active: var(--w-s-color-background-primary-active);
77
+ --color: var(--w-s-color-text-inverted);
78
+ --color-hover: var(--w-s-color-text-inverted);
79
+ --color-active: var(--w-s-color-text-inverted);
80
+ --border-width: 0px;
81
+ }
82
+ :host([variant="quiet"]),
83
+ :host([quiet]) /* deprecated, backwards compatibility, use variant="quiet" */ {
84
+ --background: transparent;
85
+ --color: var(--w-s-color-text-link);
86
+ --color-hover: var(--w-s-color-text-link-hover);
87
+ --color-active: var(--w-s-color-text-link-active);
88
+ --border-width: 0px;
89
+ }
90
+ :host([variant="negative"]) {
91
+ --background: var(--w-s-color-background-negative);
92
+ --background-hover: var(--w-s-color-background-negative-hover);
93
+ --background-active: var(--w-s-color-background-negative-active);
94
+ --color: var(--w-s-color-text-inverted);
95
+ --color-hover: var(--w-s-color-text-inverted);
96
+ --color-active: var(--w-s-color-text-inverted);
97
+ --border-width: 0px;
98
+ }
99
+ :host([variant="negativeQuiet"]),
100
+ :host([quiet][variant="negative"]) /* deprecated, backwards compatibility */ {
101
+ --background: transparent;
102
+ --background-hover: var(--w-s-color-background-negative-subtle-hover);
103
+ --background-active: var(--w-s-color-background-negative-subtle-active);
104
+ --color: var(--w-s-color-text-negative);
105
+ --color-hover: var(--w-s-color-text-negative);
106
+ --color-active: var(--w-s-color-text-negative);
107
+ --border-width: 0px;
108
+ }
109
+ :host([variant="utility"]) {
110
+ --background: var(--w-s-color-background);
111
+ --background-hover: var(--w-s-color-background-hover);
112
+ --background-active: var(--w-s-color-background-active);
113
+ --color: var(--w-s-color-text);
114
+ --color-hover: var(--w-s-color-text);
115
+ --color-active: var(--w-s-color-text);
116
+ --border-radius: var(--w-button-radius-utility, 4px);
117
+ --border-width: 1px;
118
+ }
119
+ :host([variant="utilityQuiet"]),
120
+ :host([quiet][variant="utility"]) /* deprecated, backwards compatibility */ {
121
+ --background: transparent;
122
+ --color: var(--w-s-color-text);
123
+ --color-hover: var(--w-s-color-text);
124
+ --color-active: var(--w-s-color-text);
125
+ --border-width: 0px;
126
+ }
127
+ :host([variant="overlay"]) {
128
+ --background: var(--w-color-background);
129
+ --background-hover: var(--w-color-background-hover);
130
+ --background-active: var(--w-color-background-active);
131
+ --color: var(--w-s-color-text);
132
+ --color-hover: var(--w-s-color-text);
133
+ --color-active: var(--w-s-color-text);
134
+ --border-radius: 9999px;
135
+ --border-width: 0px;
136
+ }
137
+ :host([variant="overlayQuiet"]),
138
+ :host([quiet][variant="overlay"]) /* deprecated, backwards compatibility */ {
139
+ --background: transparent;
140
+ --background-hover: var(--w-s-color-background-hover);
141
+ --background-active: var(--w-s-color-background-active);
142
+ --color: var(--w-s-color-text);
143
+ --color-hover: var(--w-s-color-text);
144
+ --color-active: var(--w-s-color-text);
145
+ --border-radius: 9999px;
146
+ --border-width: 0px;
147
+ }
148
+ :host([variant="overlayInverted"]) {
149
+ --background: var(--w-s-color-background-inverted);
150
+ --background-hover: var(--w-s-color-background-inverted-hover);
151
+ --background-active: var(--w-s-color-background-inverted-active);
152
+ --color: var(--w-s-color-text-inverted);
153
+ --color-hover: var(--w-s-color-text-inverted);
154
+ --color-active: var(--w-s-color-text-inverted);
155
+ --border-radius: 9999px;
156
+ --border-width: 0px;
157
+ }
158
+ :host([variant="overlayInvertedQuiet"]),
159
+ :host([quiet][variant="overlayInverted"]) /* deprecated, backwards compatibility */ {
160
+ --background: transparent;
161
+ --background-hover: var(--w-s-color-background-inverted-hover);
162
+ --background-active: var(--w-s-color-background-inverted-active);
163
+ --color: var(--w-s-color-text-inverted);
164
+ --color-hover: var(--w-s-color-text-inverted);
165
+ --color-active: var(--w-s-color-text-inverted);
166
+ --border-radius: 9999px;
167
+ --border-width: 0px;
168
+ }
169
+
170
+ :host([variant="link"]) {
171
+ --background: none;
172
+ --background-hover: none;
173
+ --background-active: none;
174
+ --border-width: 0px;
175
+ --font-weight: normal;
176
+ display: inline;
177
+ }
178
+
179
+ :host([variant="pill"]) {
180
+ --background: transparent;
181
+ --background-hover: var(--w-color-button-pill-background-hover); /** TODO: this should use a semantic token */
182
+ --background-active: var(--w-color-button-pill-background-active); /** TODO: this should use a semantic token */
183
+ --border-radius: 50%;
184
+ --border-width: 0px;
185
+ --color: var(--w-s-color-icon);
186
+ --color-hover: var(--w-s-color-icon-hover);
187
+ --color-active: var(--w-s-color-icon-active);
188
+ --padding-x: 14px; /* get a total height and width of 44px, matching atomic CSS variant */
189
+ --padding-y: 14px;
190
+ }
191
+
192
+ /* States config, selects --loading as well since loading is always supposed to be disabled */
193
+ :host(:disabled),
194
+ :host([disabled]) {
195
+ --background: var(--w-s-color-background-disabled);
196
+ --background-hover: var(--w-s-color-background-disabled);
197
+ --background-active: var(--w-s-color-background-disabled);
198
+ --color: var(--w-s-color-text-inverted);
199
+ --color-hover: var(--w-s-color-text-inverted);
200
+ --color-active: var(--w-s-color-text-inverted);
201
+ --border-width: 0px;
202
+ }
203
+
204
+ :host(:disabled) button,
205
+ :host([disabled]) button {
206
+ cursor: not-allowed;
207
+ pointer-events: none;
208
+ }
209
+
210
+ :host([loading]) {
211
+ --background: var(--w-s-color-background-subtle);
212
+ --background-hover: var(--w-s-color-background-subtle);
213
+ --background-active: var(--w-s-color-background-subtle);
214
+ --color: var(--w-s-color-text);
215
+ --color-hover: var(--w-s-color-text);
216
+ --color-active: var(--w-s-color-text);
217
+ --border-width: 0px;
218
+ }
219
+
220
+ :host([loading]) button {
221
+ cursor: wait;
222
+ pointer-events: none;
223
+ }
224
+
225
+ :host([variant="link"]):hover {
226
+ text-decoration: underline;
227
+ }
228
+
229
+ /* Sizes config */
230
+ :host([small]) {
231
+ --padding-x: 12px;
232
+ --padding-y: 8px;
233
+ --font-size: var(--w-font-size-xs);
234
+ --line-height: var(--w-line-height-xs);
235
+ }
236
+
237
+ :host([small][variant="pill"]) {
238
+ --padding-x: 8px; /* get a total height and width of 32px, matching atomic CSS variant */
239
+ --padding-y: 8px;
240
+ }
241
+
242
+ /* Width config */
243
+ :host([full-width]) button {
244
+ width: 100%;
245
+ max-width: 100%;
246
+ }
247
+
248
+ :host([has-icon-only]) {
249
+ --_padding-x: var(--_padding-y);
250
+ }
251
+
252
+ :host([has-icon-only]) button {
253
+ width: auto;
254
+ max-width: none;
255
+ aspect-ratio: 1 / 1;
256
+ }
257
+
258
+ /* Copy of loading animation from warp */
259
+ :host([loading]) button {
260
+ background-image: linear-gradient(
261
+ 135deg,
262
+ rgba(0, 0, 0, 0.05) 25%,
263
+ transparent 25%,
264
+ transparent 50%,
265
+ rgba(0, 0, 0, 0.05) 50%,
266
+ rgba(0, 0, 0, 0.05) 75%,
267
+ transparent 75%,
268
+ transparent
269
+ );
270
+ background-size: 30px 30px;
271
+ animation: animate-inprogress 3s linear infinite;
272
+ }
273
+
274
+ @keyframes animate-inprogress {
275
+ 0% {
276
+ background-position: 0 0;
277
+ }
278
+ 100% {
279
+ background-position: 60px 0;
280
+ }
281
+ }
282
+ `;