@redvars/peacock 3.6.0 → 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 (105) 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 +4973 -3553
  15. package/dist/custom-elements.json +7899 -6346
  16. package/dist/{flow-designer-node-XMe-jlKg.js → flow-designer-node-BWrPuxAR.js} +2 -2
  17. package/dist/flow-designer-node-BWrPuxAR.js.map +1 -0
  18. package/dist/flow-designer-node.js +1 -1
  19. package/dist/flow-designer.js +1402 -8
  20. package/dist/flow-designer.js.map +1 -1
  21. package/dist/html-editor.js +27245 -87
  22. package/dist/html-editor.js.map +1 -1
  23. package/dist/icon-CueRR7wx.js +260 -0
  24. package/dist/icon-CueRR7wx.js.map +1 -0
  25. package/dist/{icon-button-CK1ZuE-2.js → icon-button-ohxHhy4t.js} +2 -2
  26. package/dist/{icon-button-CK1ZuE-2.js.map → icon-button-ohxHhy4t.js.map} +1 -1
  27. package/dist/index.js +10 -9
  28. package/dist/index.js.map +1 -1
  29. package/dist/modal.js +12 -18
  30. package/dist/modal.js.map +1 -1
  31. package/dist/{navigation-rail-DyO0oAZU.js → navigation-rail-CD7IrqbN.js} +952 -279
  32. package/dist/navigation-rail-CD7IrqbN.js.map +1 -0
  33. package/dist/peacock-loader.js +39 -30
  34. package/dist/peacock-loader.js.map +1 -1
  35. package/dist/{popover-NC7b1lTq.js → popover-DUPmMVWS.js} +9 -4
  36. package/dist/{popover-NC7b1lTq.js.map → popover-DUPmMVWS.js.map} +1 -1
  37. package/dist/popover.js +1 -1
  38. package/dist/src/__controllers/floating-controller.d.ts +1 -0
  39. package/dist/src/avatar/avatar.d.ts +1 -1
  40. package/dist/src/breadcrumb/breadcrumb/breadcrumb.d.ts +0 -1
  41. package/dist/src/chip/chip/chip.d.ts +14 -11
  42. package/dist/src/chip/chip-set/chip-set.d.ts +20 -0
  43. package/dist/src/chip/chip-set/index.d.ts +1 -0
  44. package/dist/src/code-highlighter/code-highlighter.d.ts +4 -0
  45. package/dist/src/html-editor/html-editor.d.ts +44 -11
  46. package/dist/src/index.d.ts +3 -0
  47. package/dist/src/list/index.d.ts +2 -0
  48. package/dist/src/list/list-item.d.ts +35 -0
  49. package/dist/src/list/list.d.ts +28 -0
  50. package/dist/src/menu/menu/menu.d.ts +1 -0
  51. package/dist/src/modal/modal.d.ts +2 -8
  52. package/dist/src/navigation-rail/navigation-rail.d.ts +3 -7
  53. package/dist/src/number-field/number-field.d.ts +2 -2
  54. package/dist/src/svg/index.d.ts +1 -0
  55. package/dist/src/svg/svg.d.ts +38 -0
  56. package/dist/src/toolbar/toolbar.d.ts +3 -3
  57. package/dist/test/chip.test.d.ts +1 -0
  58. package/dist/toolbar.js +3 -3
  59. package/dist/toolbar.js.map +1 -1
  60. package/dist/tsconfig.tsbuildinfo +1 -1
  61. package/package.json +7 -1
  62. package/readme.md +3 -3
  63. package/scss/styles.scss +3 -3
  64. package/scss/tokens.css +1 -1
  65. package/src/__controllers/floating-controller.ts +9 -3
  66. package/src/avatar/avatar.scss +4 -4
  67. package/src/avatar/avatar.ts +1 -1
  68. package/src/breadcrumb/breadcrumb/breadcrumb.ts +0 -1
  69. package/src/button/button/button.scss +17 -17
  70. package/src/button/button/button.ts +1 -2
  71. package/src/card/card.ts +1 -1
  72. package/src/chip/chip/chip.scss +119 -45
  73. package/src/chip/chip/chip.ts +97 -38
  74. package/src/chip/chip-set/chip-set.scss +13 -0
  75. package/src/chip/chip-set/chip-set.ts +25 -0
  76. package/src/chip/chip-set/index.ts +1 -0
  77. package/src/code-highlighter/code-highlighter.ts +33 -6
  78. package/src/field/field.scss +1 -1
  79. package/src/flow-designer/flow-designer-node.ts +1 -1
  80. package/src/html-editor/html-editor.scss +44 -2
  81. package/src/html-editor/html-editor.ts +309 -94
  82. package/src/index.ts +3 -1
  83. package/src/list/index.ts +2 -0
  84. package/src/list/list-item.scss +111 -0
  85. package/src/list/list-item.ts +175 -0
  86. package/src/list/list.scss +24 -0
  87. package/src/list/list.ts +51 -0
  88. package/src/menu/menu/menu.ts +11 -0
  89. package/src/modal/modal.scss +10 -10
  90. package/src/modal/modal.ts +2 -8
  91. package/src/navigation-rail/navigation-rail-item.scss +7 -38
  92. package/src/navigation-rail/navigation-rail-item.ts +1 -2
  93. package/src/navigation-rail/navigation-rail.scss +17 -21
  94. package/src/navigation-rail/navigation-rail.ts +6 -9
  95. package/src/number-field/number-field.ts +2 -2
  96. package/src/peacock-loader.ts +36 -22
  97. package/src/svg/index.ts +1 -0
  98. package/src/svg/svg.scss +91 -0
  99. package/src/svg/svg.ts +160 -0
  100. package/src/toolbar/toolbar.ts +3 -3
  101. package/dist/flow-designer-dZnLJOQT.js +0 -1656
  102. package/dist/flow-designer-dZnLJOQT.js.map +0 -1
  103. package/dist/flow-designer-node-XMe-jlKg.js.map +0 -1
  104. package/dist/navigation-rail-DyO0oAZU.js.map +0 -1
  105. package/src/chip/chip/chip-colors.scss +0 -31
@@ -1,9 +1,13 @@
1
- import { html, LitElement, nothing } from 'lit';
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 LitElement {
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, colorStyles, sizeStyles];
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
- /** Tag color. */
29
- @property({ type: String, reflect: true }) color?:
30
- | 'default'
31
- | 'blue'
32
- | 'green'
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
- /** Tag value. */
37
- @property({ type: String, reflect: true }) value = '';
38
+ @state() private _hasIconSlotContent = false;
38
39
 
39
- /** If true, the tag will be selected. */
40
- @property({ type: Boolean, reflect: true }) selected = false;
40
+ @state() private _isPressed = false;
41
41
 
42
- /** Image source. */
43
- @property({ type: String }) imageSrc?: string;
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 null;
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
- private _renderImage() {
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 classes = {
92
+ const cssClasses = {
85
93
  chip: true,
94
+ button: true,
86
95
  selected: this.selected,
87
96
  dismissible: this.dismissible,
88
- [`color-${this.color}`]: true,
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
- <div class="${classMap(classes)}">
93
- <wc-elevation class="elevation"></wc-elevation>
94
- <div class="background"></div>
95
- <div class="outline"></div>
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="tag-content">
98
- <slot name="icon"></slot>
99
- <slot></slot>
100
- ${this._renderCloseButton()}
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,13 @@
1
+ @use '../../../scss/mixin';
2
+
3
+ @include mixin.base-styles;
4
+
5
+ :host {
6
+ display: block;
7
+ }
8
+
9
+ slot {
10
+ display: flex;
11
+ flex-wrap: wrap;
12
+ gap: 8px;
13
+ }
@@ -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
- await copyToClipboard(`${this.parsedCode}`);
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
- <p-circular-progress indeterminate></p-circular-progress>
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="dark"
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>
@@ -95,7 +95,7 @@
95
95
  display: flex;
96
96
  align-items: center;
97
97
  flex: 1;
98
- height: var(--field-height, 3.5rem);
98
+ min-height: var(--field-height, 3.5rem);
99
99
  padding-block: var(--field-padding-block);
100
100
  z-index: 1;
101
101
 
@@ -143,7 +143,7 @@ export class FlowDesignerNode extends LitElement {
143
143
 
144
144
  return html`
145
145
  <div class="node-header">
146
- <wc-icon name=${icon} class="node-icon"></wc-icon>
146
+ <wc-icon provider="carbon" name=${icon} class="node-icon"></wc-icon>
147
147
  <span class="node-title">${node.label}</span>
148
148
  </div>
149
149
  `;
@@ -13,10 +13,18 @@
13
13
  // Let the field expand to fit content vertically
14
14
  --field-height: auto;
15
15
  --field-padding-block: 0;
16
+ --code-editor-height: var(--html-editor-min-height, 8rem);
16
17
 
17
18
  width: 100%;
18
19
  }
19
20
 
21
+ .mode-switcher {
22
+ display: flex;
23
+ justify-content: flex-end;
24
+ padding: var(--spacing-075, 0.375rem) var(--spacing-100, 0.5rem)
25
+ var(--spacing-050, 0.25rem);
26
+ }
27
+
20
28
  // ── Toolbar ─────────────────────────────────────────────────────────────────
21
29
 
22
30
  .html-editor-toolbar {
@@ -76,6 +84,15 @@
76
84
  cursor: not-allowed;
77
85
  }
78
86
 
87
+ &.active {
88
+ background: color-mix(
89
+ in srgb,
90
+ var(--color-primary, #6750a4) 16%,
91
+ transparent
92
+ );
93
+ color: var(--color-primary, #6750a4);
94
+ }
95
+
79
96
  wc-icon {
80
97
  pointer-events: none;
81
98
  }
@@ -104,13 +121,27 @@
104
121
  word-break: break-word;
105
122
  overflow-wrap: break-word;
106
123
 
124
+ &.hidden {
125
+ display: none;
126
+ }
127
+
128
+ .tiptap-root {
129
+ min-height: calc(var(--html-editor-min-height, 8rem) - 2rem);
130
+ }
131
+
132
+ .ProseMirror {
133
+ outline: none;
134
+ min-height: calc(var(--html-editor-min-height, 8rem) - 2rem);
135
+ }
136
+
107
137
  // Placeholder
108
- &.is-empty::before {
138
+ .ProseMirror p.is-editor-empty:first-child::before {
109
139
  content: attr(data-placeholder);
110
140
  color: var(--color-on-surface-variant, #49454f);
111
141
  opacity: 0.6;
112
142
  pointer-events: none;
113
- position: absolute;
143
+ float: left;
144
+ height: 0;
114
145
  }
115
146
 
116
147
  // Sensible defaults for user-generated rich content
@@ -131,6 +162,12 @@
131
162
  }
132
163
  }
133
164
 
165
+ .html-source {
166
+ &.hidden {
167
+ display: none;
168
+ }
169
+ }
170
+
134
171
  // ── Read-only tag ───────────────────────────────────────────────────────────
135
172
 
136
173
  .read-only-tag {
@@ -144,3 +181,8 @@
144
181
  cursor: not-allowed;
145
182
  opacity: 0.6;
146
183
  }
184
+
185
+ :host([disabled]) .html-source,
186
+ :host([readonly]) .html-source {
187
+ opacity: 0.7;
188
+ }