@redvars/peacock 3.6.1 → 3.6.2

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.
Files changed (71) hide show
  1. package/dist/assets/styles.css +1 -1
  2. package/dist/assets/styles.css.map +1 -1
  3. package/dist/assets/tokens.css +1 -1
  4. package/dist/assets/tokens.css.map +1 -1
  5. package/dist/{button-colors-Ccys3hvS.js → button-colors-AvGh22Zn.js} +18 -18
  6. package/dist/{button-colors-Ccys3hvS.js.map → button-colors-AvGh22Zn.js.map} +1 -1
  7. package/dist/button-group.js +2 -2
  8. package/dist/button.js +2 -3
  9. package/dist/button.js.map +1 -1
  10. package/dist/card.js +1 -1
  11. package/dist/card.js.map +1 -1
  12. package/dist/code-highlighter.js +34 -9
  13. package/dist/code-highlighter.js.map +1 -1
  14. package/dist/custom-elements-jsdocs.json +661 -73
  15. package/dist/custom-elements.json +718 -80
  16. package/dist/flow-designer.js +1402 -8
  17. package/dist/flow-designer.js.map +1 -1
  18. package/dist/icon-CueRR7wx.js +260 -0
  19. package/dist/icon-CueRR7wx.js.map +1 -0
  20. package/dist/{icon-button-CK1ZuE-2.js → icon-button-ohxHhy4t.js} +2 -2
  21. package/dist/{icon-button-CK1ZuE-2.js.map → icon-button-ohxHhy4t.js.map} +1 -1
  22. package/dist/index.js +9 -8
  23. package/dist/index.js.map +1 -1
  24. package/dist/modal.js +11 -11
  25. package/dist/modal.js.map +1 -1
  26. package/dist/{navigation-rail-DTTkqohi.js → navigation-rail-CD7IrqbN.js} +247 -123
  27. package/dist/navigation-rail-CD7IrqbN.js.map +1 -0
  28. package/dist/peacock-loader.js +30 -30
  29. package/dist/peacock-loader.js.map +1 -1
  30. package/dist/{popover-NC7b1lTq.js → popover-DUPmMVWS.js} +9 -4
  31. package/dist/{popover-NC7b1lTq.js.map → popover-DUPmMVWS.js.map} +1 -1
  32. package/dist/popover.js +1 -1
  33. package/dist/src/__controllers/floating-controller.d.ts +1 -0
  34. package/dist/src/avatar/avatar.d.ts +1 -1
  35. package/dist/src/breadcrumb/breadcrumb/breadcrumb.d.ts +0 -1
  36. package/dist/src/chip/chip/chip.d.ts +14 -11
  37. package/dist/src/chip/chip-set/chip-set.d.ts +20 -0
  38. package/dist/src/chip/chip-set/index.d.ts +1 -0
  39. package/dist/src/code-highlighter/code-highlighter.d.ts +4 -0
  40. package/dist/src/index.d.ts +1 -0
  41. package/dist/src/menu/menu/menu.d.ts +1 -0
  42. package/dist/src/modal/modal.d.ts +1 -1
  43. package/dist/test/chip.test.d.ts +1 -0
  44. package/dist/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +1 -1
  46. package/readme.md +2 -2
  47. package/scss/styles.scss +3 -3
  48. package/scss/tokens.css +1 -1
  49. package/src/__controllers/floating-controller.ts +9 -3
  50. package/src/avatar/avatar.scss +4 -4
  51. package/src/avatar/avatar.ts +1 -1
  52. package/src/breadcrumb/breadcrumb/breadcrumb.ts +0 -1
  53. package/src/button/button/button.scss +17 -17
  54. package/src/button/button/button.ts +1 -2
  55. package/src/card/card.ts +1 -1
  56. package/src/chip/chip/chip.scss +119 -45
  57. package/src/chip/chip/chip.ts +97 -38
  58. package/src/chip/chip-set/chip-set.scss +13 -0
  59. package/src/chip/chip-set/chip-set.ts +25 -0
  60. package/src/chip/chip-set/index.ts +1 -0
  61. package/src/code-highlighter/code-highlighter.ts +33 -6
  62. package/src/field/field.scss +1 -1
  63. package/src/index.ts +1 -0
  64. package/src/menu/menu/menu.ts +11 -0
  65. package/src/modal/modal.scss +10 -10
  66. package/src/modal/modal.ts +1 -1
  67. package/src/peacock-loader.ts +24 -22
  68. package/dist/flow-designer-DvTUrDp5.js +0 -1656
  69. package/dist/flow-designer-DvTUrDp5.js.map +0 -1
  70. package/dist/navigation-rail-DTTkqohi.js.map +0 -1
  71. package/src/chip/chip/chip-colors.scss +0 -31
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@redvars/peacock",
3
3
  "description": "The foundation for beautiful user interfaces",
4
4
  "license": "Apache-2.0",
5
- "version": "3.6.1",
5
+ "version": "3.6.2",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
package/readme.md CHANGED
@@ -44,9 +44,9 @@ Visit [https://peacock.redvars.com](https://peacock.redvars.com) to view the doc
44
44
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
45
45
  <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
46
46
 
47
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.6.1/dist/assets/styles.css"></link>
47
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.6.2/dist/assets/styles.css"></link>
48
48
  <script type='module'
49
- src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.6.1/dist/peacock-loader.js'></script>
49
+ src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.6.2/dist/peacock-loader.js'></script>
50
50
  </head>
51
51
 
52
52
  <wc-button>Button</wc-button>
package/scss/styles.scss CHANGED
@@ -46,19 +46,19 @@
46
46
  --icon-color: var(--color-on-surface-variant);
47
47
  }
48
48
 
49
- ::selection {
49
+ .scrollbar-primary::selection {
50
50
  color: var(--color-surface);
51
51
  background: var(--color-primary);
52
52
  }
53
53
 
54
54
  /* width */
55
- ::-webkit-scrollbar {
55
+ .scrollbar-primary::-webkit-scrollbar {
56
56
  background-color: transparent;
57
57
  width: var(--scrollbar-width);
58
58
  }
59
59
 
60
60
  /* Handle */
61
- ::-webkit-scrollbar-thumb {
61
+ .scrollbar-primary::-webkit-scrollbar-thumb {
62
62
  background-color: var(--color-primary);
63
63
  border-radius: calc(var(--scrollbar-width) / 2);
64
64
  }
package/scss/tokens.css CHANGED
@@ -256,7 +256,7 @@
256
256
  --font-weight-medium: 500; /* Slightly heavier than regular weight. 500 weight. */
257
257
  --font-weight-regular: 400; /* Standard weight for regular text. 400 weight. */
258
258
  --font-weight-semi-bold: 600; /* Heavier than medium weight. 600 weight. */
259
- --global-avatar-border-radius: var(--shape-corner-full);
259
+ --global-avatar-container-shape: var(--shape-corner-full);
260
260
  --global-badge-color: var(--color-error);
261
261
  --scrollbar-width: 8px;
262
262
  --shape-corner-extra-large: 28px;
@@ -144,7 +144,9 @@ export class FloatingController implements ReactiveController {
144
144
  this.reference.removeEventListener('focusout', this.handleFocusOut);
145
145
  }
146
146
 
147
- private toggle = () => (this.isOpen ? this.close() : this.open());
147
+ private toggle = () => {
148
+ this.isOpen ? this.close() : this.open()
149
+ };
148
150
 
149
151
  private handleContextMenu = (e: MouseEvent) => {
150
152
  e.preventDefault();
@@ -156,13 +158,17 @@ export class FloatingController implements ReactiveController {
156
158
  this.close();
157
159
  };
158
160
 
161
+ private isEventInsideElement(event: Event, element: HTMLElement) {
162
+ return event.composedPath().some(target => target === element);
163
+ }
164
+
159
165
  private handleOutsideClick = (e: MouseEvent) => {
160
166
  if (
161
167
  this.isOpen &&
162
168
  this.reference &&
163
169
  this.floating &&
164
- !this.reference.contains(e.target as Node) &&
165
- !this.floating.contains(e.target as Node)
170
+ !this.isEventInsideElement(e, this.reference) &&
171
+ !this.isEventInsideElement(e, this.floating)
166
172
  ) {
167
173
  this.close();
168
174
  }
@@ -6,9 +6,9 @@
6
6
  display: inline-block;
7
7
  pointer-events: none;
8
8
  --avatar-size: 2rem;
9
- --avatar-background-color: var(--color-primary);
9
+ --avatar-container-color: var(--color-primary);
10
10
  --avatar-text-color: var(--color-on-primary);
11
- --avatar-border-radius: var(--global-avatar-border-radius);
11
+ --avatar-container-shape: var(--global-avatar-container-shape);
12
12
  }
13
13
 
14
14
  .avatar-container {
@@ -19,7 +19,7 @@
19
19
  }
20
20
 
21
21
  .avatar {
22
- border-radius: var(--avatar-border-radius);
22
+ border-radius: var(--avatar-container-shape);
23
23
  display: flex;
24
24
  justify-content: center;
25
25
  align-items: center;
@@ -27,7 +27,7 @@
27
27
  width: var(--avatar-size);
28
28
  height: var(--avatar-size);
29
29
  @include mixin.get-typography('body-large-emphasized');
30
- background-color: var(--avatar-background-color);
30
+ background-color: var(--avatar-container-color);
31
31
 
32
32
  font-size: calc(var(--avatar-size) * 0.5) !important;
33
33
 
@@ -10,7 +10,7 @@ import styles from './avatar.scss';
10
10
  * @summary The Avatar component is used to represent user, and displays the profile picture, initials or fallback icon.
11
11
  *
12
12
  * @cssprop --avatar-border-radius - Controls the border radius of the avatar.
13
- * @cssprop --avatar-background-color - Controls the color of the avatar.
13
+ * @cssprop --avatar-container-color - Controls the color of the avatar container.
14
14
  * @cssprop --avatar-size - Controls the size of the avatar.
15
15
  * @cssprop --avatar-text-color - Controls the color of the text inside the avatar.
16
16
  *
@@ -30,7 +30,6 @@ export class Breadcrumb extends LitElement {
30
30
 
31
31
  /**
32
32
  * Accessible label for the breadcrumb navigation landmark.
33
- * @default "Breadcrumb"
34
33
  */
35
34
  @property({ type: String }) label = 'Breadcrumb';
36
35
 
@@ -101,8 +101,8 @@ slot::slotted(*) {
101
101
  border-end-start-radius: var(--_button_container-shape-end-start);
102
102
  border-end-end-radius: var(--_button_container-shape-end-end);
103
103
  corner-shape: var(--_button_container-corner-shape-variant);
104
- --ripple-state-opacity: var(--_button_container-state-opacity, 0);
105
- --ripple-pressed-color: var(--_button_container-state-color);
104
+ --ripple-state-opacity: var(--_button_state-opacity, 0);
105
+ --ripple-pressed-color: var(--_button_state-color);
106
106
  }
107
107
 
108
108
  .background {
@@ -226,16 +226,16 @@ slot::slotted(*) {
226
226
  --_button_label-text-color: var(--elevated-button-label-text-color);
227
227
  --_button_container-elevation-level: 1;
228
228
 
229
- --_button_container-state-color: var(--_button_label-text-color);
229
+ --_button_state-color: var(--_button_label-text-color);
230
230
 
231
231
  &:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
232
232
  --_button_container-elevation-level: 2;
233
- --_button_container-state-opacity: 0.08;
233
+ --_button_state-opacity: 0.08;
234
234
  }
235
235
 
236
236
  &.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
237
237
  --_button_container-elevation-level: 1;
238
- --_button_container-state-opacity: 0.12;
238
+ --_button_state-opacity: 0.12;
239
239
  }
240
240
 
241
241
  &.disabled {
@@ -254,17 +254,17 @@ slot::slotted(*) {
254
254
  .button.variant-filled {
255
255
  --_button_container-color: var(--filled-button-container-color);
256
256
  --_button_label-text-color: var(--filled-button-label-text-color);
257
- --_button_container-state-color: var(--_button_label-text-color);
257
+ --_button_state-color: var(--_button_label-text-color);
258
258
 
259
259
 
260
260
  &:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
261
261
  --_button_container-elevation-level: 1;
262
- --_button_container-state-opacity: 0.08;
262
+ --_button_state-opacity: 0.08;
263
263
  }
264
264
 
265
265
  &.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
266
266
  --_button_container-elevation-level: 0;
267
- --_button_container-state-opacity: 0.1;
267
+ --_button_state-opacity: 0.1;
268
268
  }
269
269
 
270
270
  &.disabled {
@@ -284,16 +284,16 @@ slot::slotted(*) {
284
284
  --_button_container-color: var(--tonal-button-container-color);
285
285
  --_button_label-text-color: var(--tonal-button-label-text-color);
286
286
 
287
- --_button_container-state-color: var(--_button_label-text-color);
287
+ --_button_state-color: var(--_button_label-text-color);
288
288
 
289
289
  &:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
290
290
  --_button_container-elevation-level: 1;
291
- --_button_container-state-opacity: 0.08;
291
+ --_button_state-opacity: 0.08;
292
292
  }
293
293
 
294
294
  &.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
295
295
  --_button_container-elevation-level: 0;
296
- --_button_container-state-opacity: 0.12;
296
+ --_button_state-opacity: 0.12;
297
297
  }
298
298
 
299
299
  &.disabled {
@@ -314,18 +314,18 @@ slot::slotted(*) {
314
314
  --_button_outline-color: var(--outlined-button-outline-color);
315
315
  --_button_label-text-color: var(--outlined-button-label-text-color);
316
316
 
317
- --_button_container-state-color: var(--_button_label-text-color);
317
+ --_button_state-color: var(--_button_label-text-color);
318
318
 
319
319
  .outline {
320
320
  display: block;
321
321
  }
322
322
 
323
323
  &:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
324
- --_button_container-state-opacity: 0.08;
324
+ --_button_state-opacity: 0.08;
325
325
  }
326
326
 
327
327
  &.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
328
- --_button_container-state-opacity: 0.12;
328
+ --_button_state-opacity: 0.12;
329
329
  }
330
330
 
331
331
  &.disabled {
@@ -344,14 +344,14 @@ slot::slotted(*) {
344
344
  .button.variant-text {
345
345
 
346
346
  --_button_label-text-color: var(--text-button-label-text-color);
347
- --_button_container-state-color: var(--_button_label-text-color);
347
+ --_button_state-color: var(--_button_label-text-color);
348
348
 
349
349
  &:hover:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
350
- --_button_container-state-opacity: 0.08;
350
+ --_button_state-opacity: 0.08;
351
351
  }
352
352
 
353
353
  &.pressed:not(:where(.disabled, .soft-disabled, .show-skeleton)) {
354
- --_button_container-state-opacity: 0.12;
354
+ --_button_state-opacity: 0.12;
355
355
  }
356
356
 
357
357
  &.disabled {
@@ -155,7 +155,6 @@ export class Button extends BaseButton {
155
155
  }
156
156
 
157
157
  override render() {
158
- const isLink = this.__isLink();
159
158
 
160
159
  const cssClasses = {
161
160
  button: true,
@@ -170,7 +169,7 @@ export class Button extends BaseButton {
170
169
  [`icon-align-${this.iconAlign}`]: true,
171
170
  };
172
171
 
173
- if (!isLink) {
172
+ if (!this.__isLink()) {
174
173
  return html`<button
175
174
  class=${classMap(cssClasses)}
176
175
  id="button"
package/src/card/card.ts CHANGED
@@ -189,7 +189,7 @@ export class Card extends BaseHyperlinkMixin(LitElement) {
189
189
  tabindex=${this.#tabindex}
190
190
  href=${this.href}
191
191
  target=${this.target}
192
- @click=${this.__dispatchClickWithThrottle}
192
+ @click=${this.__dispatchClickWithThrottle}
193
193
  @mousedown=${this.__handlePress}
194
194
  @keydown=${this.__handlePress}
195
195
  @keyup=${this.__handlePress}
@@ -6,24 +6,33 @@
6
6
  display: inline-block;
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
- :host-context([data-theme="dark"]) {
14
- --chip-hover-color: var(--color-primary-30);
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
- border-radius: var(--chip-container-shape);
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
- color: var(--chip-label-text-color);
39
- @include mixin.get-typography(label-small);
40
- gap: .5rem;
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
- .tag-image {
44
- width: 1.125rem;
45
- height: 1.125rem;
46
- border-radius: 100%;
47
- background: var(--chip-hover-color);
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
- .close-btn {
53
- border-radius: 12px;
54
- padding: 0;
55
- margin: 0;
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
- &:hover {
67
- background: var(--chip-hover-color);
89
+ }
68
90
 
69
- .close-btn-icon {
70
- color: var(--background);
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: inherit;
135
+ border-radius: var(--chip-container-shape);
136
+
84
137
 
85
- background: var(--chip-container-color);
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: inherit;
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
- border-radius: inherit;
156
+ --elevation-container-shape: var(--chip-container-shape);
102
157
  }
103
158
 
159
+ }
104
160
 
105
- &.dismissible .tag-content {
106
- padding-inline-end: .25rem;
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(--background);
111
- background: var(--chip-hover-color);
177
+ --_chip-container-color: var(--color-secondary-container);
178
+ --_chip-text-color: var(--color-on-secondary-container);
179
+ }
112
180
 
113
- .close-btn-icon {
114
- color: var(--background);
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
+ }