@redvars/peacock 3.6.1 → 3.6.3
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/dist/assets/components.css.map +1 -1
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/assets/tokens.css +1 -1
- package/dist/assets/tokens.css.map +1 -1
- package/dist/{button-colors-Ccys3hvS.js → button-colors-Cg6oxiz-.js} +126 -116
- package/dist/{button-colors-Ccys3hvS.js.map → button-colors-Cg6oxiz-.js.map} +1 -1
- package/dist/button-group.js +2 -2
- package/dist/button.js +18 -16
- package/dist/button.js.map +1 -1
- package/dist/canvas.js +126 -107
- package/dist/canvas.js.map +1 -1
- package/dist/card.js +1 -1
- package/dist/card.js.map +1 -1
- package/dist/code-highlighter.js +34 -9
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +4306 -3215
- package/dist/custom-elements.json +8344 -7173
- package/dist/{flow-designer-node-BWrPuxAR.js → flow-designer-node-9Bqyn6qx.js} +2 -1
- package/dist/flow-designer-node-9Bqyn6qx.js.map +1 -0
- package/dist/flow-designer-node.js +1 -1
- package/dist/flow-designer.js +1402 -8
- package/dist/flow-designer.js.map +1 -1
- package/dist/icon-CueRR7wx.js +260 -0
- package/dist/icon-CueRR7wx.js.map +1 -0
- package/dist/{icon-button-CK1ZuE-2.js → icon-button-AdJBEoNy.js} +34 -30
- package/dist/icon-button-AdJBEoNy.js.map +1 -0
- package/dist/index.js +10 -9
- package/dist/index.js.map +1 -1
- package/dist/modal.js +11 -11
- package/dist/modal.js.map +1 -1
- package/dist/{navigation-rail-DTTkqohi.js → navigation-rail-DAUuJ_Yp.js} +975 -486
- package/dist/navigation-rail-DAUuJ_Yp.js.map +1 -0
- package/dist/peacock-loader.js +33 -30
- package/dist/peacock-loader.js.map +1 -1
- package/dist/{popover-NC7b1lTq.js → popover-DUPmMVWS.js} +9 -4
- package/dist/{popover-NC7b1lTq.js.map → popover-DUPmMVWS.js.map} +1 -1
- package/dist/popover-content.js +1 -1
- package/dist/popover-content.js.map +1 -1
- package/dist/popover.js +1 -1
- package/dist/search.js +11 -14
- package/dist/search.js.map +1 -1
- package/dist/src/__controllers/floating-controller.d.ts +1 -0
- package/dist/src/avatar/avatar.d.ts +1 -1
- package/dist/src/breadcrumb/breadcrumb/breadcrumb.d.ts +0 -1
- package/dist/src/canvas/canvas.d.ts +3 -3
- package/dist/src/chip/chip/chip.d.ts +14 -11
- package/dist/src/chip/chip-set/chip-set.d.ts +20 -0
- package/dist/src/chip/chip-set/index.d.ts +1 -0
- package/dist/src/code-highlighter/code-highlighter.d.ts +4 -0
- package/dist/src/field/field.d.ts +1 -0
- package/dist/src/flow-designer/flow-designer-node.d.ts +1 -0
- package/dist/src/image/image.d.ts +2 -2
- package/dist/src/index.d.ts +2 -0
- package/dist/src/input/input.d.ts +1 -3
- package/dist/src/item/index.d.ts +1 -0
- package/dist/src/item/item.d.ts +48 -0
- package/dist/src/menu/menu/menu.d.ts +1 -0
- package/dist/src/menu/menu-item/menu-item.d.ts +8 -9
- package/dist/src/menu/sub-menu/sub-menu.d.ts +1 -0
- package/dist/src/modal/modal.d.ts +1 -1
- package/dist/src/navigation-rail/navigation-rail.d.ts +2 -6
- package/dist/src/popover/popover-content.d.ts +1 -1
- package/dist/src/search/search.d.ts +2 -6
- package/dist/test/chip.test.d.ts +1 -0
- package/dist/test/item.test.d.ts +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/readme.md +2 -2
- package/scss/mixin.scss +23 -0
- package/scss/styles.scss +3 -3
- package/scss/tokens.css +1 -1
- package/src/__controllers/floating-controller.ts +9 -3
- package/src/avatar/avatar.scss +4 -4
- package/src/avatar/avatar.ts +1 -1
- package/src/breadcrumb/breadcrumb/breadcrumb.ts +0 -1
- package/src/button/button/button-sizes.scss +11 -11
- package/src/button/button/button.scss +96 -122
- package/src/button/button/button.ts +38 -36
- package/src/button/icon-button/icon-button-sizes.scss +8 -8
- package/src/button/icon-button/icon-button.ts +23 -20
- package/src/canvas/canvas.scss +18 -6
- package/src/canvas/canvas.ts +125 -103
- package/src/card/card.ts +1 -1
- package/src/chip/chip/chip.scss +120 -46
- package/src/chip/chip/chip.ts +97 -38
- package/src/chip/chip-set/chip-set.scss +13 -0
- package/src/chip/chip-set/chip-set.ts +25 -0
- package/src/chip/chip-set/index.ts +1 -0
- package/src/code-highlighter/code-highlighter.ts +33 -6
- package/src/empty-state/empty-state.scss +1 -0
- package/src/field/field.scss +1 -1
- package/src/field/field.ts +6 -0
- package/src/flow-designer/flow-designer-node.ts +1 -0
- package/src/image/image.scss +21 -16
- package/src/image/image.ts +13 -14
- package/src/index.ts +2 -0
- package/src/input/input.ts +16 -25
- package/src/item/index.ts +1 -0
- package/src/item/item.scss +184 -0
- package/src/item/item.ts +340 -0
- package/src/menu/menu/menu.ts +16 -9
- package/src/menu/menu-item/menu-item.scss +30 -108
- package/src/menu/menu-item/menu-item.ts +89 -129
- package/src/menu/sub-menu/sub-menu.ts +6 -2
- package/src/modal/modal.scss +10 -10
- package/src/modal/modal.ts +1 -1
- package/src/navigation-rail/navigation-rail.ts +2 -6
- package/src/peacock-loader.ts +28 -22
- package/src/popover/popover-content.ts +1 -1
- package/src/search/search.ts +11 -16
- package/src/select/option.ts +1 -1
- package/src/select/select.scss +1 -10
- package/src/select/select.ts +2 -0
- package/dist/flow-designer-DvTUrDp5.js +0 -1656
- package/dist/flow-designer-DvTUrDp5.js.map +0 -1
- package/dist/flow-designer-node-BWrPuxAR.js.map +0 -1
- package/dist/icon-button-CK1ZuE-2.js.map +0 -1
- package/dist/navigation-rail-DTTkqohi.js.map +0 -1
- package/src/chip/chip/chip-colors.scss +0 -31
package/src/chip/chip/chip.scss
CHANGED
|
@@ -3,27 +3,36 @@
|
|
|
3
3
|
@include mixin.base-styles;
|
|
4
4
|
|
|
5
5
|
:host {
|
|
6
|
-
display: inline-
|
|
6
|
+
display: inline-flex;
|
|
7
7
|
--chip-container-color: var(--color-surface);
|
|
8
8
|
--chip-label-text-color: var(--color-on-surface);
|
|
9
|
-
--chip-outline-color: var(--color-outline);
|
|
9
|
+
--chip-outline-color: var(--color-outline-variant);
|
|
10
10
|
--chip-container-shape: var(--shape-corner-small);
|
|
11
|
+
|
|
12
|
+
--chip-container-padding: 1rem;
|
|
13
|
+
/* 8dp */
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
16
|
+
/*
|
|
17
|
+
* Reset native button/link styles
|
|
18
|
+
*/
|
|
19
|
+
.button {
|
|
20
|
+
background: transparent;
|
|
21
|
+
border: none;
|
|
22
|
+
appearance: none;
|
|
23
|
+
margin: 0;
|
|
24
|
+
padding: 0;
|
|
25
|
+
outline: none;
|
|
26
|
+
text-decoration: none;
|
|
15
27
|
}
|
|
16
28
|
|
|
17
29
|
.chip {
|
|
18
30
|
position: relative;
|
|
19
31
|
display: inline-flex;
|
|
20
|
-
flex-direction: column;
|
|
21
32
|
align-items: center;
|
|
22
|
-
justify-content: center;
|
|
23
33
|
height: var(--chip-height, var(--_chip-height, 2rem));
|
|
24
|
-
padding: 0 var(--_container-padding, 1rem);
|
|
25
34
|
width: 100%;
|
|
26
|
-
|
|
35
|
+
cursor: pointer;
|
|
27
36
|
|
|
28
37
|
.tag-content {
|
|
29
38
|
position: relative;
|
|
@@ -32,86 +41,151 @@
|
|
|
32
41
|
text-overflow: ellipsis;
|
|
33
42
|
white-space: nowrap;
|
|
34
43
|
max-width: 100%;
|
|
44
|
+
height: 100%;
|
|
35
45
|
display: flex;
|
|
36
46
|
align-items: center;
|
|
37
47
|
justify-content: center;
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
48
|
+
padding-inline: var(--chip-container-padding);
|
|
49
|
+
color: var(--_chip-text-color);
|
|
50
|
+
opacity: var(--_chip-text-opacity, 1);
|
|
51
|
+
@include mixin.get-typography(label-large);
|
|
52
|
+
|
|
53
|
+
.label-container {
|
|
54
|
+
min-width: 0;
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
text-overflow: ellipsis;
|
|
57
|
+
white-space: nowrap;
|
|
58
|
+
}
|
|
41
59
|
|
|
42
60
|
|
|
43
|
-
.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
61
|
+
.close-btn {
|
|
62
|
+
height: 100%;
|
|
63
|
+
padding: 0;
|
|
64
|
+
padding-inline: calc(var(--chip-container-padding) / 2);
|
|
65
|
+
margin: 0;
|
|
66
|
+
border: none;
|
|
67
|
+
background: transparent;
|
|
68
|
+
line-height: 0;
|
|
69
|
+
cursor: pointer;
|
|
49
70
|
|
|
50
|
-
|
|
71
|
+
.close-btn-icon {
|
|
72
|
+
--icon-size: 1rem;
|
|
73
|
+
--icon-color: var(--_chip-text-color);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&:hover {
|
|
77
|
+
background: var(--chip-hover-color);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
51
80
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
border: none;
|
|
57
|
-
background: transparent;
|
|
58
|
-
line-height: 0;
|
|
59
|
-
cursor: pointer;
|
|
60
|
-
--icon-size: 1rem;
|
|
61
|
-
|
|
62
|
-
.close-btn-icon {
|
|
81
|
+
.icon-slot-container {
|
|
82
|
+
height: 100%;
|
|
83
|
+
display: flex;
|
|
84
|
+
align-items: center;
|
|
63
85
|
--icon-size: 1rem;
|
|
86
|
+
--icon-color: var(--color-primary);
|
|
64
87
|
}
|
|
65
88
|
|
|
66
|
-
|
|
67
|
-
background: var(--chip-hover-color);
|
|
89
|
+
}
|
|
68
90
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
91
|
+
.focus-ring {
|
|
92
|
+
z-index: 2;
|
|
93
|
+
display: block;
|
|
94
|
+
--focus-ring-container-shape: var(--chip-container-shape);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.ripple {
|
|
98
|
+
display: block;
|
|
99
|
+
border-radius: var(--chip-container-shape);
|
|
100
|
+
--ripple-state-opacity: var(--_chip-state-opacity, 0);
|
|
101
|
+
--ripple-pressed-color: var(--_chip-state-color);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&.disabled {
|
|
105
|
+
cursor: not-allowed;
|
|
73
106
|
}
|
|
74
107
|
|
|
108
|
+
&.dismissible .tag-content {
|
|
109
|
+
padding-inline-end: 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
&.dismissible.actionable .tag-content {
|
|
113
|
+
padding-inline-end: calc(var(--chip-container-padding) / 2);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
&.icon-slot-has-content .tag-content, &.selected .tag-content {
|
|
117
|
+
padding-inline-start: 0;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&.icon-slot-has-content .icon-slot-container, &.selected .icon-slot-container {
|
|
121
|
+
padding-inline: calc(var(--chip-container-padding) / 2);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
75
126
|
/**
|
|
76
127
|
* Tag background layers
|
|
77
128
|
*/
|
|
78
129
|
.background {
|
|
79
130
|
display: block;
|
|
80
131
|
position: absolute;
|
|
132
|
+
left: 0;
|
|
81
133
|
width: 100%;
|
|
82
134
|
height: 100%;
|
|
83
|
-
border-radius:
|
|
135
|
+
border-radius: var(--chip-container-shape);
|
|
136
|
+
|
|
84
137
|
|
|
85
|
-
background: var(--
|
|
138
|
+
background: var(--_chip-container-color);
|
|
86
139
|
pointer-events: none;
|
|
87
140
|
}
|
|
88
141
|
|
|
89
142
|
.outline {
|
|
143
|
+
z-index: 0;
|
|
90
144
|
display: block;
|
|
91
145
|
position: absolute;
|
|
146
|
+
left: 0;
|
|
92
147
|
width: 100%;
|
|
93
148
|
height: 100%;
|
|
94
|
-
border-radius:
|
|
149
|
+
border-radius: var(--chip-container-shape);
|
|
95
150
|
border: 1px solid var(--chip-outline-color);
|
|
96
151
|
}
|
|
97
152
|
|
|
98
153
|
.elevation {
|
|
99
154
|
--elevation-level: 0;
|
|
100
155
|
transition-duration: 280ms;
|
|
101
|
-
|
|
156
|
+
--elevation-container-shape: var(--chip-container-shape);
|
|
102
157
|
}
|
|
103
158
|
|
|
159
|
+
}
|
|
104
160
|
|
|
105
|
-
|
|
106
|
-
|
|
161
|
+
|
|
162
|
+
/** Color state management */
|
|
163
|
+
.chip {
|
|
164
|
+
--_chip-container-color: var(--chip-container-color);
|
|
165
|
+
--_chip-text-color: var(--chip-label-text-color);
|
|
166
|
+
--_chip-state-color: var(--_chip-text-color);
|
|
167
|
+
|
|
168
|
+
&:hover {
|
|
169
|
+
--_chip-state-opacity: 0.08;
|
|
107
170
|
}
|
|
108
171
|
|
|
172
|
+
&.pressed {
|
|
173
|
+
--_chip-state-opacity: 0.12;
|
|
174
|
+
}
|
|
175
|
+
|
|
109
176
|
&.selected {
|
|
110
|
-
color: var(--
|
|
111
|
-
|
|
177
|
+
--_chip-container-color: var(--color-secondary-container);
|
|
178
|
+
--_chip-text-color: var(--color-on-secondary-container);
|
|
179
|
+
}
|
|
112
180
|
|
|
113
|
-
|
|
114
|
-
|
|
181
|
+
&.disabled {
|
|
182
|
+
--_chip-container-color: var(--color-on-surface);
|
|
183
|
+
--_chip-container-opacity: 0.1;
|
|
184
|
+
--_chip-text-color: var(--color-on-surface);
|
|
185
|
+
--_chip-text-opacity: 0.38;
|
|
186
|
+
|
|
187
|
+
.ripple {
|
|
188
|
+
display: none;
|
|
115
189
|
}
|
|
116
190
|
}
|
|
117
|
-
}
|
|
191
|
+
}
|
package/src/chip/chip/chip.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { html,
|
|
2
|
-
import { property } from 'lit/decorators.js';
|
|
1
|
+
import { html, nothing } from 'lit';
|
|
2
|
+
import { property, query, state } from 'lit/decorators.js';
|
|
3
3
|
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
+
import { observerSlotChangesWithCallback } from '@/__utils/observe-slot-change.js';
|
|
6
|
+
import { dispatchActivationClick, isActivationClick } from '@/__utils/dispatch-event-utils.js';
|
|
4
7
|
import styles from './chip.scss';
|
|
5
|
-
import colorStyles from './chip-colors.scss';
|
|
6
8
|
import sizeStyles from './chip-sizes.scss';
|
|
9
|
+
import { spread } from '@/__directive/spread.js';
|
|
10
|
+
import { BaseButton } from '@/button/BaseButton.js';
|
|
7
11
|
|
|
8
12
|
/**
|
|
9
13
|
* @label Chip
|
|
@@ -17,30 +21,41 @@ import sizeStyles from './chip-sizes.scss';
|
|
|
17
21
|
* <wc-chip>Chip content</wc-chip>
|
|
18
22
|
* ```
|
|
19
23
|
*/
|
|
20
|
-
export class Chip extends
|
|
24
|
+
export class Chip extends BaseButton {
|
|
21
25
|
// Define styles (Lit handles Scoping via Shadow DOM by default)
|
|
22
26
|
// You would typically import your tag.scss.js here or use the css tag
|
|
23
|
-
static styles = [styles,
|
|
27
|
+
static styles = [styles, sizeStyles];
|
|
24
28
|
|
|
25
29
|
/** If true, the tag will have a close icon. */
|
|
26
30
|
@property({ type: Boolean }) dismissible = false;
|
|
27
31
|
|
|
28
|
-
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
| 'red'
|
|
34
|
-
| 'yellow' = 'default';
|
|
32
|
+
/**
|
|
33
|
+
* Additional ARIA attributes to pass to the inner button/anchor element.
|
|
34
|
+
*/
|
|
35
|
+
@property({ reflect: true })
|
|
36
|
+
configAria?: { [key: string]: any };
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
@property({ type: String, reflect: true }) value = '';
|
|
38
|
+
@state() private _hasIconSlotContent = false;
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
@property({ type: Boolean, reflect: true }) selected = false;
|
|
40
|
+
@state() private _isPressed = false;
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
override focus() {
|
|
43
|
+
this.buttonElement?.focus();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
override blur() {
|
|
47
|
+
this.buttonElement?.blur();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
override firstUpdated() {
|
|
51
|
+
observerSlotChangesWithCallback(
|
|
52
|
+
this.renderRoot.querySelector('slot[name="icon"]'),
|
|
53
|
+
hasContent => {
|
|
54
|
+
this._hasIconSlotContent = hasContent;
|
|
55
|
+
this.requestUpdate();
|
|
56
|
+
},
|
|
57
|
+
);
|
|
58
|
+
}
|
|
44
59
|
|
|
45
60
|
private _dismissClickHandler(e: MouseEvent) {
|
|
46
61
|
e.stopPropagation();
|
|
@@ -56,8 +71,9 @@ export class Chip extends LitElement {
|
|
|
56
71
|
);
|
|
57
72
|
}
|
|
58
73
|
|
|
74
|
+
|
|
59
75
|
private _renderCloseButton() {
|
|
60
|
-
if (!this.dismissible) return
|
|
76
|
+
if (!this.dismissible) return nothing;
|
|
61
77
|
|
|
62
78
|
return html`
|
|
63
79
|
<button
|
|
@@ -70,35 +86,78 @@ export class Chip extends LitElement {
|
|
|
70
86
|
`;
|
|
71
87
|
}
|
|
72
88
|
|
|
73
|
-
|
|
74
|
-
if (this.imageSrc)
|
|
75
|
-
return html`<img
|
|
76
|
-
src=${this.imageSrc}
|
|
77
|
-
class="tag-image"
|
|
78
|
-
alt="Tag Logo"
|
|
79
|
-
/>`;
|
|
80
|
-
return nothing;
|
|
81
|
-
}
|
|
89
|
+
|
|
82
90
|
|
|
83
91
|
render() {
|
|
84
|
-
const
|
|
92
|
+
const cssClasses = {
|
|
85
93
|
chip: true,
|
|
94
|
+
button: true,
|
|
86
95
|
selected: this.selected,
|
|
87
96
|
dismissible: this.dismissible,
|
|
88
|
-
|
|
97
|
+
pressed: this._isPressed,
|
|
98
|
+
'icon-slot-has-content': this._hasIconSlotContent,
|
|
89
99
|
};
|
|
90
100
|
|
|
101
|
+
if (!this.__isLink()) {
|
|
102
|
+
return html`<button
|
|
103
|
+
class=${classMap(cssClasses)}
|
|
104
|
+
id="button"
|
|
105
|
+
type=${this.htmlType}
|
|
106
|
+
@click=${this.__dispatchClickWithThrottle}
|
|
107
|
+
@mousedown=${this.__handlePress}
|
|
108
|
+
@keydown=${this.__handlePress}
|
|
109
|
+
@keyup=${this.__handlePress}
|
|
110
|
+
|
|
111
|
+
aria-describedby=${ifDefined(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
112
|
+
?aria-disabled=${this.softDisabled}
|
|
113
|
+
|
|
114
|
+
?disabled=${this.disabled}
|
|
115
|
+
${spread(this.configAria)}
|
|
116
|
+
>
|
|
117
|
+
${this.renderChipContent()}
|
|
118
|
+
</button>`;
|
|
119
|
+
}
|
|
120
|
+
return html`<a
|
|
121
|
+
class=${classMap(cssClasses)}
|
|
122
|
+
id="button"
|
|
123
|
+
href=${this.href}
|
|
124
|
+
target=${this.target}
|
|
125
|
+
tabindex=${this.disabled ? '-1' : '0'}
|
|
126
|
+
|
|
127
|
+
@click=${this.__dispatchClick}
|
|
128
|
+
@mousedown=${this.__handlePress}
|
|
129
|
+
@keydown=${this.__handlePress}
|
|
130
|
+
@keyup=${this.__handlePress}
|
|
131
|
+
role="button"
|
|
132
|
+
|
|
133
|
+
aria-describedby=${ifDefined(this.softDisabled ? BaseButton.DISABLED_REASON_ID : undefined)}
|
|
134
|
+
?aria-disabled=${this.softDisabled}
|
|
135
|
+
|
|
136
|
+
${spread(this.configAria)}
|
|
137
|
+
>
|
|
138
|
+
${this.renderChipContent()}
|
|
139
|
+
</a>`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
renderChipContent() {
|
|
91
143
|
return html`
|
|
92
|
-
<
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
144
|
+
<wc-focus-ring class="focus-ring" for="button"></wc-focus-ring>
|
|
145
|
+
<wc-elevation class="elevation"></wc-elevation>
|
|
146
|
+
<div class="background"></div>
|
|
147
|
+
<div class="outline"></div>
|
|
148
|
+
<wc-ripple class="ripple"></wc-ripple>
|
|
149
|
+
<div class="tag-content">
|
|
96
150
|
|
|
97
|
-
<div class="
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
151
|
+
<div class="icon-slot-container">
|
|
152
|
+
${this.selected
|
|
153
|
+
? html`<wc-icon class="selected-icon" name="check"></wc-icon>`
|
|
154
|
+
: html`<slot name="icon"></slot>`}
|
|
101
155
|
</div>
|
|
156
|
+
<div class="label-container">
|
|
157
|
+
<slot></slot>
|
|
158
|
+
</div>
|
|
159
|
+
|
|
160
|
+
${this._renderCloseButton()}
|
|
102
161
|
</div>
|
|
103
162
|
`;
|
|
104
163
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import styles from './chip-set.scss';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @label Chip Set
|
|
6
|
+
* @tag wc-chip-set
|
|
7
|
+
* @rawTag chip-set
|
|
8
|
+
* @summary A layout container for wrapping chips.
|
|
9
|
+
* @tags layout
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```html
|
|
13
|
+
* <wc-chip-set>
|
|
14
|
+
* <wc-chip>One</wc-chip>
|
|
15
|
+
* <wc-chip>Two</wc-chip>
|
|
16
|
+
* </wc-chip-set>
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export class ChipSet extends LitElement {
|
|
20
|
+
static styles = [styles];
|
|
21
|
+
|
|
22
|
+
override render() {
|
|
23
|
+
return html`<slot></slot>`;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChipSet } from './chip-set.js';
|
|
@@ -44,6 +44,8 @@ const locale = {
|
|
|
44
44
|
export class CodeHighlighter extends LitElement {
|
|
45
45
|
static styles = [styles];
|
|
46
46
|
|
|
47
|
+
private static readonly COPY_FEEDBACK_DURATION = 3000;
|
|
48
|
+
|
|
47
49
|
@property({ type: String, reflect: true })
|
|
48
50
|
language: BundledLanguage = 'javascript';
|
|
49
51
|
|
|
@@ -61,13 +63,25 @@ export class CodeHighlighter extends LitElement {
|
|
|
61
63
|
|
|
62
64
|
@state() private compiledCode: string | null = null;
|
|
63
65
|
|
|
66
|
+
@state() private _copied = false;
|
|
67
|
+
|
|
64
68
|
private parsedCode: string | null = null;
|
|
65
69
|
|
|
70
|
+
private _copyFeedbackTimeout: number | null = null;
|
|
71
|
+
|
|
66
72
|
async connectedCallback() {
|
|
67
73
|
// eslint-disable-next-line wc/guard-super-call
|
|
68
74
|
super.connectedCallback();
|
|
69
75
|
}
|
|
70
76
|
|
|
77
|
+
disconnectedCallback() {
|
|
78
|
+
if (this._copyFeedbackTimeout !== null) {
|
|
79
|
+
window.clearTimeout(this._copyFeedbackTimeout);
|
|
80
|
+
this._copyFeedbackTimeout = null;
|
|
81
|
+
}
|
|
82
|
+
super.disconnectedCallback();
|
|
83
|
+
}
|
|
84
|
+
|
|
71
85
|
firstUpdated() {
|
|
72
86
|
this.__highlightCode();
|
|
73
87
|
}
|
|
@@ -146,19 +160,32 @@ export class CodeHighlighter extends LitElement {
|
|
|
146
160
|
}
|
|
147
161
|
|
|
148
162
|
private async __handleCopyClick() {
|
|
149
|
-
|
|
163
|
+
if (this.parsedCode == null) {
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
await copyToClipboard(this.parsedCode);
|
|
168
|
+
this._copied = true;
|
|
169
|
+
|
|
170
|
+
if (this._copyFeedbackTimeout !== null) {
|
|
171
|
+
window.clearTimeout(this._copyFeedbackTimeout);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
this._copyFeedbackTimeout = window.setTimeout(() => {
|
|
175
|
+
this._copied = false;
|
|
176
|
+
this._copyFeedbackTimeout = null;
|
|
177
|
+
}, CodeHighlighter.COPY_FEEDBACK_DURATION);
|
|
150
178
|
}
|
|
151
179
|
|
|
152
180
|
render() {
|
|
153
181
|
if (this.compiledCode === null) {
|
|
154
182
|
return html`
|
|
155
183
|
<div class="code-loader">
|
|
156
|
-
<
|
|
184
|
+
<wc-circular-progress indeterminate></wc-circular-progress>
|
|
157
185
|
${locale.loading}
|
|
158
186
|
</div>
|
|
159
187
|
`;
|
|
160
188
|
}
|
|
161
|
-
// @click=${() => this.inline && this.handleCopyClick()}
|
|
162
189
|
|
|
163
190
|
return html`
|
|
164
191
|
<div
|
|
@@ -171,11 +198,11 @@ export class CodeHighlighter extends LitElement {
|
|
|
171
198
|
<div class="header-title">${this.language}</div>
|
|
172
199
|
<div class="header-actions">
|
|
173
200
|
<wc-icon-button
|
|
174
|
-
color
|
|
201
|
+
color=${this._copied ? 'success' : 'surface'}
|
|
175
202
|
variant="text"
|
|
176
203
|
size="xs"
|
|
177
|
-
aria-label=${locale.copyToClipboard}
|
|
178
|
-
tooltip=${locale.copyToClipboard}
|
|
204
|
+
aria-label=${this._copied ? locale.copied : locale.copyToClipboard}
|
|
205
|
+
tooltip=${this._copied ? locale.copied : locale.copyToClipboard}
|
|
179
206
|
@click=${this.__handleCopyClick}
|
|
180
207
|
>
|
|
181
208
|
<wc-icon name="content_copy"></wc-icon>
|
package/src/field/field.scss
CHANGED
package/src/field/field.ts
CHANGED
|
@@ -24,6 +24,12 @@ import styles from './field.scss';
|
|
|
24
24
|
* @tags form
|
|
25
25
|
*/
|
|
26
26
|
export class Field extends LitElement {
|
|
27
|
+
|
|
28
|
+
static shadowRootOptions: ShadowRootInit = {
|
|
29
|
+
...LitElement.shadowRootOptions,
|
|
30
|
+
delegatesFocus: true,
|
|
31
|
+
};
|
|
32
|
+
|
|
27
33
|
static styles = [styles];
|
|
28
34
|
|
|
29
35
|
@property({ type: String })
|
package/src/image/image.scss
CHANGED
|
@@ -30,27 +30,32 @@ img.clickable {
|
|
|
30
30
|
display: block;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
/*
|
|
34
|
-
|
|
35
|
-
.preview-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
inset: 0;
|
|
39
|
-
z-index: 9999;
|
|
40
|
-
background: rgba(0, 0, 0, 0.85);
|
|
41
|
-
align-items: center;
|
|
42
|
-
justify-content: center;
|
|
33
|
+
/* Lightbox preview — native <dialog> renders in the top layer,
|
|
34
|
+
bypassing any stacking context on the host page. */
|
|
35
|
+
.preview-dialog {
|
|
36
|
+
background: transparent;
|
|
37
|
+
border: none;
|
|
43
38
|
cursor: zoom-out;
|
|
39
|
+
max-height: 90dvh;
|
|
40
|
+
max-width: 90dvw;
|
|
41
|
+
padding: 0;
|
|
42
|
+
|
|
43
|
+
&[open] {
|
|
44
|
+
display: flex;
|
|
45
|
+
align-items: center;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&::backdrop {
|
|
50
|
+
background: color-mix(in srgb, var(--color-scrim), transparent 15%);
|
|
51
|
+
}
|
|
44
52
|
}
|
|
45
53
|
|
|
46
|
-
.preview-
|
|
47
|
-
display: flex;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
.preview-overlay img {
|
|
54
|
+
.preview-dialog img {
|
|
51
55
|
max-width: 90vw;
|
|
52
56
|
max-height: 90vh;
|
|
53
57
|
object-fit: contain;
|
|
54
|
-
box-shadow: 0 8px 40px
|
|
58
|
+
box-shadow: 0 8px 40px color-mix(in srgb, var(--color-shadow), transparent 40%);
|
|
55
59
|
border-radius: 4px;
|
|
60
|
+
cursor: auto;
|
|
56
61
|
}
|