@telperion/elements 5.0.5 → 5.1.0
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.
- package/.build-manifest.json +1 -1
- package/README.md +2 -1
- package/button/button.element.cjs +60 -52
- package/button/button.element.cjs.map +1 -1
- package/button/button.element.js +60 -52
- package/button/button.element.js.map +1 -1
- package/button/index.d.cts +4 -3
- package/button/index.d.ts +4 -3
- package/fesm/elements.mjs +60 -52
- package/fesm/elements.mjs.map +1 -1
- package/iife/button/index.js +61 -53
- package/iife/button/index.js.map +1 -1
- package/iife/elements.js +60 -52
- package/iife/elements.js.map +1 -1
- package/package.json +1 -1
package/.build-manifest.json
CHANGED
package/README.md
CHANGED
|
@@ -261,7 +261,7 @@ Framework-agnostic, form-associated button built with Lit. Behaves like the nati
|
|
|
261
261
|
- `<tp-button>` — the button itself
|
|
262
262
|
|
|
263
263
|
**Features:**
|
|
264
|
-
-
|
|
264
|
+
- Four variants: `solid` · `outline` · `ghost` · `text` (`ghost` is `outline` without the border)
|
|
265
265
|
- Form-associated via `ElementInternals` — `type="submit"` calls `form.requestSubmit()`, `type="reset"` calls `form.reset()`, and `.form` mirrors `HTMLButtonElement.form`
|
|
266
266
|
- Tab-selectable out of the box (`tabindex="0"`); `disabled` removes the button from the tab order, blocks click/keyboard activation, and sets `aria-disabled`
|
|
267
267
|
- `Space` / `Enter` activation matching native button semantics
|
|
@@ -279,6 +279,7 @@ import "@telperion/elements/button";
|
|
|
279
279
|
```html
|
|
280
280
|
<tp-button>Click me</tp-button>
|
|
281
281
|
<tp-button variant="outline" color="success">Save</tp-button>
|
|
282
|
+
<tp-button variant="ghost" color="primary">Cancel</tp-button>
|
|
282
283
|
<tp-button variant="text" color="danger" disabled>Delete</tp-button>
|
|
283
284
|
|
|
284
285
|
<form>
|
|
@@ -23,7 +23,7 @@ var shadeMixerLitElement = require('../utils/shade-mixer-lit-element.cjs');
|
|
|
23
23
|
*
|
|
24
24
|
* @element tp-button
|
|
25
25
|
*
|
|
26
|
-
* @attr {"solid" | "outline" | "text"} [variant="solid"] - Visual treatment.
|
|
26
|
+
* @attr {"solid" | "outline" | "ghost" | "text"} [variant="solid"] - Visual treatment.
|
|
27
27
|
* @attr {"button" | "submit" | "reset"} [type="button"] - Native button semantics.
|
|
28
28
|
* @attr {boolean} [disabled=false] - Disables interaction and removes the button from the tab order.
|
|
29
29
|
* @attr {string} [color="contrast"] - Palette token (`primary`, `secondary`, `success`, …) inherited from {@link ShadeMixerLitElement}.
|
|
@@ -50,71 +50,79 @@ exports.ButtonElement = class ButtonElement extends shadeMixerLitElement.ShadeMi
|
|
|
50
50
|
static { this.formAssociated = true; }
|
|
51
51
|
static { this.styles = (() => {
|
|
52
52
|
const style = lit.css `
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
@layer base {
|
|
54
|
+
tp-button {
|
|
55
|
+
${shadeMixerLitElement.ShadeMixerLitElement.shadedElementStyles}
|
|
56
|
+
--tp-button-color: var(--tp-calc-element-color);
|
|
57
|
+
--tp-button-contrast-color: var(--tp-calc-contrast-color);
|
|
58
|
+
display: inline-block;
|
|
59
|
+
border: 1px solid transparent;
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
outline-offset: 1em;
|
|
62
|
+
outline: 1px solid transparent;
|
|
63
|
+
transform: scale(1);
|
|
64
|
+
transition: all 0.18s ease;
|
|
65
|
+
transition-property: background-color, color, outline-color, outline-offset, transform, border-width;
|
|
65
66
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
67
|
+
&:active {
|
|
68
|
+
transform: scale(0.98);
|
|
69
|
+
}
|
|
69
70
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
&:not(:active):focus {
|
|
72
|
+
outline-color: var(--tp-button-color);
|
|
73
|
+
outline-offset: 2px;
|
|
74
|
+
}
|
|
74
75
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
&[disabled] {
|
|
77
|
+
--tp-button-color: color-mix(in xyz, var(--tp-calc-element-color) 50%, var(--tp-color-white) 50%);
|
|
78
|
+
--tp-button-contrast-color: rgb(from var(--tp-calc-contrast-color) r g b / 50%);
|
|
79
|
+
pointer-events: none;
|
|
80
|
+
user-select: none;
|
|
81
|
+
cursor: not-allowed;
|
|
82
|
+
}
|
|
82
83
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
&[variant="solid"],
|
|
85
|
+
&[variant="outline"],
|
|
86
|
+
&[variant="ghost"] {
|
|
87
|
+
padding-inline: 1em;
|
|
88
|
+
padding-block: 0.5em;
|
|
89
|
+
}
|
|
87
90
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
+
&[variant="outline"],
|
|
92
|
+
&[variant="ghost"] {
|
|
93
|
+
color: var(--tp-button-color);
|
|
94
|
+
background-color: transparent;
|
|
91
95
|
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
&:hover {
|
|
97
|
+
background-color: color-mix(in xyz, var(--tp-button-color) 10%, transparent 90%);
|
|
98
|
+
}
|
|
94
99
|
}
|
|
95
|
-
}
|
|
96
100
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
background-color: transparent;
|
|
101
|
+
&[variant="solid"] {
|
|
102
|
+
background-color: var(--tp-button-color);
|
|
103
|
+
color: var(--tp-button-contrast-color);
|
|
101
104
|
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
&:hover {
|
|
106
|
+
background-color: color-mix(in xyz, var(--tp-button-color) 80%, var(--tp-color-black) 20%);
|
|
107
|
+
}
|
|
104
108
|
}
|
|
105
109
|
|
|
106
|
-
|
|
107
|
-
|
|
110
|
+
&[variant="outline"] {
|
|
111
|
+
border-color: var(--tp-button-color);
|
|
112
|
+
|
|
113
|
+
&:focus-visible {
|
|
114
|
+
outline-color: transparent;
|
|
115
|
+
}
|
|
108
116
|
}
|
|
109
|
-
}
|
|
110
117
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
118
|
+
&[variant="text"] {
|
|
119
|
+
color: var(--tp-button-color);
|
|
120
|
+
background-color: transparent;
|
|
114
121
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
122
|
+
&:hover {
|
|
123
|
+
color: color-mix(in xyz, var(--tp-button-color) 80%, var(--tp-color-black) 20%);
|
|
124
|
+
text-decoration: underline;
|
|
125
|
+
}
|
|
118
126
|
}
|
|
119
127
|
}
|
|
120
128
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.element.cjs","sources":["../../../../libs/elements/src/button/button.element.ts"],"sourcesContent":[null],"names":["ButtonElement","ShadeMixerLitElement","css","html","__decorate","property","customElement"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"button.element.cjs","sources":["../../../../libs/elements/src/button/button.element.ts"],"sourcesContent":[null],"names":["ButtonElement","ShadeMixerLitElement","css","html","__decorate","property","customElement"],"mappings":";;;;;;;AA6BA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCG;AAEUA,qBAAa,GAAnB,MAAM,aAAc,SAAQC,yCAAoB,CAAA;;aAE9C,IAAA,CAAA,cAAc,GAAG,IAAH,CAAQ;aACb,IAAA,CAAA,MAAM,GAAG,CAAC,MAAK;QAC7B,MAAM,KAAK,GAAGC,OAAG,CAAA,CAAA;;;AAGT,UAAA,EAAAD,yCAAoB,CAAC,mBAAmB,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA0E/C;AAED,QAAA,QAAQ,CAAC,kBAAkB,GAAG,CAAC,GAAG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AAA,SAAA,EAAA,MAAA,CAAA;AAQjCI,gBAAA,CAAA;IADCC,sBAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AACd,CAAA,EAAAL,qBAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAO5BI,gBAAA,CAAA;IADCC,sBAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AAC1B,CAAA,EAAAL,qBAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAxGNA,qBAAa,GAAAI,gBAAA,CAAA;IADzBE,2BAAa,CAAC,WAAW,CAAC;;AACd,CAAA,EAAAN,qBAAa,CA4KzB;;"}
|
package/button/button.element.js
CHANGED
|
@@ -21,7 +21,7 @@ import { ShadeMixerLitElement } from '../utils/shade-mixer-lit-element.js';
|
|
|
21
21
|
*
|
|
22
22
|
* @element tp-button
|
|
23
23
|
*
|
|
24
|
-
* @attr {"solid" | "outline" | "text"} [variant="solid"] - Visual treatment.
|
|
24
|
+
* @attr {"solid" | "outline" | "ghost" | "text"} [variant="solid"] - Visual treatment.
|
|
25
25
|
* @attr {"button" | "submit" | "reset"} [type="button"] - Native button semantics.
|
|
26
26
|
* @attr {boolean} [disabled=false] - Disables interaction and removes the button from the tab order.
|
|
27
27
|
* @attr {string} [color="contrast"] - Palette token (`primary`, `secondary`, `success`, …) inherited from {@link ShadeMixerLitElement}.
|
|
@@ -48,71 +48,79 @@ let ButtonElement = class ButtonElement extends ShadeMixerLitElement {
|
|
|
48
48
|
static { this.formAssociated = true; }
|
|
49
49
|
static { this.styles = (() => {
|
|
50
50
|
const style = css `
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
@layer base {
|
|
52
|
+
tp-button {
|
|
53
|
+
${ShadeMixerLitElement.shadedElementStyles}
|
|
54
|
+
--tp-button-color: var(--tp-calc-element-color);
|
|
55
|
+
--tp-button-contrast-color: var(--tp-calc-contrast-color);
|
|
56
|
+
display: inline-block;
|
|
57
|
+
border: 1px solid transparent;
|
|
58
|
+
cursor: pointer;
|
|
59
|
+
outline-offset: 1em;
|
|
60
|
+
outline: 1px solid transparent;
|
|
61
|
+
transform: scale(1);
|
|
62
|
+
transition: all 0.18s ease;
|
|
63
|
+
transition-property: background-color, color, outline-color, outline-offset, transform, border-width;
|
|
63
64
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
&:active {
|
|
66
|
+
transform: scale(0.98);
|
|
67
|
+
}
|
|
67
68
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
&:not(:active):focus {
|
|
70
|
+
outline-color: var(--tp-button-color);
|
|
71
|
+
outline-offset: 2px;
|
|
72
|
+
}
|
|
72
73
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
&[disabled] {
|
|
75
|
+
--tp-button-color: color-mix(in xyz, var(--tp-calc-element-color) 50%, var(--tp-color-white) 50%);
|
|
76
|
+
--tp-button-contrast-color: rgb(from var(--tp-calc-contrast-color) r g b / 50%);
|
|
77
|
+
pointer-events: none;
|
|
78
|
+
user-select: none;
|
|
79
|
+
cursor: not-allowed;
|
|
80
|
+
}
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
&[variant="solid"],
|
|
83
|
+
&[variant="outline"],
|
|
84
|
+
&[variant="ghost"] {
|
|
85
|
+
padding-inline: 1em;
|
|
86
|
+
padding-block: 0.5em;
|
|
87
|
+
}
|
|
85
88
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
+
&[variant="outline"],
|
|
90
|
+
&[variant="ghost"] {
|
|
91
|
+
color: var(--tp-button-color);
|
|
92
|
+
background-color: transparent;
|
|
89
93
|
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
&:hover {
|
|
95
|
+
background-color: color-mix(in xyz, var(--tp-button-color) 10%, transparent 90%);
|
|
96
|
+
}
|
|
92
97
|
}
|
|
93
|
-
}
|
|
94
98
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
background-color: transparent;
|
|
99
|
+
&[variant="solid"] {
|
|
100
|
+
background-color: var(--tp-button-color);
|
|
101
|
+
color: var(--tp-button-contrast-color);
|
|
99
102
|
|
|
100
|
-
|
|
101
|
-
|
|
103
|
+
&:hover {
|
|
104
|
+
background-color: color-mix(in xyz, var(--tp-button-color) 80%, var(--tp-color-black) 20%);
|
|
105
|
+
}
|
|
102
106
|
}
|
|
103
107
|
|
|
104
|
-
|
|
105
|
-
|
|
108
|
+
&[variant="outline"] {
|
|
109
|
+
border-color: var(--tp-button-color);
|
|
110
|
+
|
|
111
|
+
&:focus-visible {
|
|
112
|
+
outline-color: transparent;
|
|
113
|
+
}
|
|
106
114
|
}
|
|
107
|
-
}
|
|
108
115
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
&[variant="text"] {
|
|
117
|
+
color: var(--tp-button-color);
|
|
118
|
+
background-color: transparent;
|
|
112
119
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
120
|
+
&:hover {
|
|
121
|
+
color: color-mix(in xyz, var(--tp-button-color) 80%, var(--tp-color-black) 20%);
|
|
122
|
+
text-decoration: underline;
|
|
123
|
+
}
|
|
116
124
|
}
|
|
117
125
|
}
|
|
118
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.element.js","sources":["../../../../libs/elements/src/button/button.element.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"button.element.js","sources":["../../../../libs/elements/src/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B,YAAA,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,GAAG,IAAI,GAAG,GAAG,CAAC;AACzD,YAAA,IAAI,CAAC,UAAU,CAAC,YAAY,GAAG,IAAI,CAAC,QAAQ,GAAG,MAAM,GAAG,OAAO;QACjE;IACF;AAEA,IAAA,YAAY;AAeZ,IAAA,cAAc;IAQK,gBAAgB,GAAA;AACjC,QAAA,OAAO,IAAI;IACb;IAEmB,MAAM,GAAA;QACvB,OAAO,IAAI,CAAA,CAAA,CAAE;IACf;;AAlFA,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AACT,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAQjC,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AACd,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAO5B,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;;AAC1B,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAxGN,aAAa,GAAA,UAAA,CAAA;IADzB,aAAa,CAAC,WAAW,CAAC;;AACd,CAAA,EAAA,aAAa,CA4KzB;;;;"}
|
package/button/index.d.cts
CHANGED
|
@@ -51,10 +51,11 @@ declare class ShadeMixerLitElement extends LitElement {
|
|
|
51
51
|
* Visual treatment applied by `<tp-button>`.
|
|
52
52
|
*
|
|
53
53
|
* - `solid`: filled background using the resolved color.
|
|
54
|
-
* - `outline`: transparent background with a colored border and text.
|
|
54
|
+
* - `outline`: transparent background with a colored border and text; subtle background tint on hover.
|
|
55
|
+
* - `ghost`: like `outline` but without the border — transparent background with colored text and the same subtle tint on hover.
|
|
55
56
|
* - `text`: no background or border — just colored text with an underline on hover.
|
|
56
57
|
*/
|
|
57
|
-
type ButtonVariant = "solid" | "outline" | "text";
|
|
58
|
+
type ButtonVariant = "solid" | "outline" | "text" | "ghost";
|
|
58
59
|
/**
|
|
59
60
|
* Mirrors the native HTML `<button>` `type` attribute.
|
|
60
61
|
*
|
|
@@ -86,7 +87,7 @@ declare global {
|
|
|
86
87
|
*
|
|
87
88
|
* @element tp-button
|
|
88
89
|
*
|
|
89
|
-
* @attr {"solid" | "outline" | "text"} [variant="solid"] - Visual treatment.
|
|
90
|
+
* @attr {"solid" | "outline" | "ghost" | "text"} [variant="solid"] - Visual treatment.
|
|
90
91
|
* @attr {"button" | "submit" | "reset"} [type="button"] - Native button semantics.
|
|
91
92
|
* @attr {boolean} [disabled=false] - Disables interaction and removes the button from the tab order.
|
|
92
93
|
* @attr {string} [color="contrast"] - Palette token (`primary`, `secondary`, `success`, …) inherited from {@link ShadeMixerLitElement}.
|
package/button/index.d.ts
CHANGED
|
@@ -51,10 +51,11 @@ declare class ShadeMixerLitElement extends LitElement {
|
|
|
51
51
|
* Visual treatment applied by `<tp-button>`.
|
|
52
52
|
*
|
|
53
53
|
* - `solid`: filled background using the resolved color.
|
|
54
|
-
* - `outline`: transparent background with a colored border and text.
|
|
54
|
+
* - `outline`: transparent background with a colored border and text; subtle background tint on hover.
|
|
55
|
+
* - `ghost`: like `outline` but without the border — transparent background with colored text and the same subtle tint on hover.
|
|
55
56
|
* - `text`: no background or border — just colored text with an underline on hover.
|
|
56
57
|
*/
|
|
57
|
-
type ButtonVariant = "solid" | "outline" | "text";
|
|
58
|
+
type ButtonVariant = "solid" | "outline" | "text" | "ghost";
|
|
58
59
|
/**
|
|
59
60
|
* Mirrors the native HTML `<button>` `type` attribute.
|
|
60
61
|
*
|
|
@@ -86,7 +87,7 @@ declare global {
|
|
|
86
87
|
*
|
|
87
88
|
* @element tp-button
|
|
88
89
|
*
|
|
89
|
-
* @attr {"solid" | "outline" | "text"} [variant="solid"] - Visual treatment.
|
|
90
|
+
* @attr {"solid" | "outline" | "ghost" | "text"} [variant="solid"] - Visual treatment.
|
|
90
91
|
* @attr {"button" | "submit" | "reset"} [type="button"] - Native button semantics.
|
|
91
92
|
* @attr {boolean} [disabled=false] - Disables interaction and removes the button from the tab order.
|
|
92
93
|
* @attr {string} [color="contrast"] - Palette token (`primary`, `secondary`, `success`, …) inherited from {@link ShadeMixerLitElement}.
|
package/fesm/elements.mjs
CHANGED
|
@@ -3430,7 +3430,7 @@ __decorate([
|
|
|
3430
3430
|
*
|
|
3431
3431
|
* @element tp-button
|
|
3432
3432
|
*
|
|
3433
|
-
* @attr {"solid" | "outline" | "text"} [variant="solid"] - Visual treatment.
|
|
3433
|
+
* @attr {"solid" | "outline" | "ghost" | "text"} [variant="solid"] - Visual treatment.
|
|
3434
3434
|
* @attr {"button" | "submit" | "reset"} [type="button"] - Native button semantics.
|
|
3435
3435
|
* @attr {boolean} [disabled=false] - Disables interaction and removes the button from the tab order.
|
|
3436
3436
|
* @attr {string} [color="contrast"] - Palette token (`primary`, `secondary`, `success`, …) inherited from {@link ShadeMixerLitElement}.
|
|
@@ -3457,71 +3457,79 @@ let ButtonElement = class ButtonElement extends ShadeMixerLitElement {
|
|
|
3457
3457
|
static { this.formAssociated = true; }
|
|
3458
3458
|
static { this.styles = (() => {
|
|
3459
3459
|
const style = css `
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3460
|
+
@layer base {
|
|
3461
|
+
tp-button {
|
|
3462
|
+
${ShadeMixerLitElement.shadedElementStyles}
|
|
3463
|
+
--tp-button-color: var(--tp-calc-element-color);
|
|
3464
|
+
--tp-button-contrast-color: var(--tp-calc-contrast-color);
|
|
3465
|
+
display: inline-block;
|
|
3466
|
+
border: 1px solid transparent;
|
|
3467
|
+
cursor: pointer;
|
|
3468
|
+
outline-offset: 1em;
|
|
3469
|
+
outline: 1px solid transparent;
|
|
3470
|
+
transform: scale(1);
|
|
3471
|
+
transition: all 0.18s ease;
|
|
3472
|
+
transition-property: background-color, color, outline-color, outline-offset, transform, border-width;
|
|
3472
3473
|
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3474
|
+
&:active {
|
|
3475
|
+
transform: scale(0.98);
|
|
3476
|
+
}
|
|
3476
3477
|
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3478
|
+
&:not(:active):focus {
|
|
3479
|
+
outline-color: var(--tp-button-color);
|
|
3480
|
+
outline-offset: 2px;
|
|
3481
|
+
}
|
|
3481
3482
|
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3483
|
+
&[disabled] {
|
|
3484
|
+
--tp-button-color: color-mix(in xyz, var(--tp-calc-element-color) 50%, var(--tp-color-white) 50%);
|
|
3485
|
+
--tp-button-contrast-color: rgb(from var(--tp-calc-contrast-color) r g b / 50%);
|
|
3486
|
+
pointer-events: none;
|
|
3487
|
+
user-select: none;
|
|
3488
|
+
cursor: not-allowed;
|
|
3489
|
+
}
|
|
3489
3490
|
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3491
|
+
&[variant="solid"],
|
|
3492
|
+
&[variant="outline"],
|
|
3493
|
+
&[variant="ghost"] {
|
|
3494
|
+
padding-inline: 1em;
|
|
3495
|
+
padding-block: 0.5em;
|
|
3496
|
+
}
|
|
3494
3497
|
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
+
&[variant="outline"],
|
|
3499
|
+
&[variant="ghost"] {
|
|
3500
|
+
color: var(--tp-button-color);
|
|
3501
|
+
background-color: transparent;
|
|
3498
3502
|
|
|
3499
|
-
|
|
3500
|
-
|
|
3503
|
+
&:hover {
|
|
3504
|
+
background-color: color-mix(in xyz, var(--tp-button-color) 10%, transparent 90%);
|
|
3505
|
+
}
|
|
3501
3506
|
}
|
|
3502
|
-
}
|
|
3503
3507
|
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
background-color: transparent;
|
|
3508
|
+
&[variant="solid"] {
|
|
3509
|
+
background-color: var(--tp-button-color);
|
|
3510
|
+
color: var(--tp-button-contrast-color);
|
|
3508
3511
|
|
|
3509
|
-
|
|
3510
|
-
|
|
3512
|
+
&:hover {
|
|
3513
|
+
background-color: color-mix(in xyz, var(--tp-button-color) 80%, var(--tp-color-black) 20%);
|
|
3514
|
+
}
|
|
3511
3515
|
}
|
|
3512
3516
|
|
|
3513
|
-
|
|
3514
|
-
|
|
3517
|
+
&[variant="outline"] {
|
|
3518
|
+
border-color: var(--tp-button-color);
|
|
3519
|
+
|
|
3520
|
+
&:focus-visible {
|
|
3521
|
+
outline-color: transparent;
|
|
3522
|
+
}
|
|
3515
3523
|
}
|
|
3516
|
-
}
|
|
3517
3524
|
|
|
3518
|
-
|
|
3519
|
-
|
|
3520
|
-
|
|
3525
|
+
&[variant="text"] {
|
|
3526
|
+
color: var(--tp-button-color);
|
|
3527
|
+
background-color: transparent;
|
|
3521
3528
|
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3529
|
+
&:hover {
|
|
3530
|
+
color: color-mix(in xyz, var(--tp-button-color) 80%, var(--tp-color-black) 20%);
|
|
3531
|
+
text-decoration: underline;
|
|
3532
|
+
}
|
|
3525
3533
|
}
|
|
3526
3534
|
}
|
|
3527
3535
|
}
|