@redvars/peacock 3.5.1 → 3.6.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.
- package/dist/{BaseButton-DuASuVth.js → BaseButton-BNFAYn-S.js} +2 -2
- package/dist/{BaseButton-DuASuVth.js.map → BaseButton-BNFAYn-S.js.map} +1 -1
- package/dist/BaseInput-14YmcfK7.js +27 -0
- package/dist/BaseInput-14YmcfK7.js.map +1 -0
- package/dist/banner.js +2 -3
- package/dist/banner.js.map +1 -1
- package/dist/{button-DouvOfEU.js → button-colors-Ccys3hvS.js} +5 -294
- package/dist/button-colors-Ccys3hvS.js.map +1 -0
- package/dist/button-group.js +226 -6
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +294 -8
- package/dist/button.js.map +1 -1
- package/dist/calendar-column-view.js +634 -0
- package/dist/calendar-column-view.js.map +1 -0
- package/dist/calendar-event-BrQ_SEKD.js +199 -0
- package/dist/calendar-event-BrQ_SEKD.js.map +1 -0
- package/dist/calendar-month-view.js +376 -0
- package/dist/calendar-month-view.js.map +1 -0
- package/dist/calendar.js +339 -0
- package/dist/calendar.js.map +1 -0
- package/dist/canvas.js +361 -0
- package/dist/canvas.js.map +1 -0
- package/dist/cb-compound-expression.js +125 -0
- package/dist/cb-compound-expression.js.map +1 -0
- package/dist/cb-divider.js +150 -0
- package/dist/cb-divider.js.map +1 -0
- package/dist/cb-expression.js +75 -0
- package/dist/cb-expression.js.map +1 -0
- package/dist/cb-predicate.js +137 -0
- package/dist/cb-predicate.js.map +1 -0
- package/dist/code-editor.js +2 -1
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +1 -1
- package/dist/code-highlighter.js.map +1 -1
- package/dist/condition-builder.js +58 -0
- package/dist/condition-builder.js.map +1 -0
- package/dist/custom-elements-jsdocs.json +8479 -3965
- package/dist/custom-elements.json +15228 -7544
- package/dist/dropdown-button.js +216 -0
- package/dist/dropdown-button.js.map +1 -0
- package/dist/event-manager-D-QCmUgR.js +113 -0
- package/dist/event-manager-D-QCmUgR.js.map +1 -0
- package/dist/fab.js +1 -1
- package/dist/flow-designer-DvTUrDp5.js +1656 -0
- package/dist/flow-designer-DvTUrDp5.js.map +1 -0
- package/dist/flow-designer-node-BWrPuxAR.js +548 -0
- package/dist/flow-designer-node-BWrPuxAR.js.map +1 -0
- package/dist/flow-designer-node.js +4 -0
- package/dist/flow-designer-node.js.map +1 -0
- package/dist/flow-designer.js +16 -0
- package/dist/flow-designer.js.map +1 -0
- package/dist/html-editor.js +27516 -0
- package/dist/html-editor.js.map +1 -0
- package/dist/icon-button-CK1ZuE-2.js +247 -0
- package/dist/icon-button-CK1ZuE-2.js.map +1 -0
- package/dist/index.js +29 -6
- package/dist/index.js.map +1 -1
- package/dist/{is-dark-mode-DicqGkCJ.js → is-dark-mode-DOcaw4Yq.js} +2 -27
- package/dist/is-dark-mode-DOcaw4Yq.js.map +1 -0
- package/dist/modal.js +412 -0
- package/dist/modal.js.map +1 -0
- package/dist/{navigation-rail-Lxetd5-Z.js → navigation-rail-DTTkqohi.js} +1049 -2391
- package/dist/navigation-rail-DTTkqohi.js.map +1 -0
- package/dist/notification-manager.js +268 -0
- package/dist/notification-manager.js.map +1 -0
- package/dist/peacock-loader.js +93 -8
- package/dist/peacock-loader.js.map +1 -1
- package/dist/popover-NC7b1lTq.js +1971 -0
- package/dist/popover-NC7b1lTq.js.map +1 -0
- package/dist/popover-content.js +125 -0
- package/dist/popover-content.js.map +1 -0
- package/dist/popover.js +4 -0
- package/dist/popover.js.map +1 -0
- package/dist/split-button.js +388 -0
- package/dist/split-button.js.map +1 -0
- package/dist/src/__controllers/floating-controller.d.ts +35 -0
- package/dist/src/calendar/base-event.d.ts +10 -0
- package/dist/src/calendar/calendar-column-view.d.ts +41 -0
- package/dist/src/calendar/calendar-event.d.ts +7 -0
- package/dist/src/calendar/calendar-month-view.d.ts +31 -0
- package/dist/src/calendar/calendar.d.ts +65 -0
- package/dist/src/calendar/event-manager.d.ts +17 -0
- package/dist/src/calendar/index.d.ts +4 -0
- package/dist/src/calendar/types.d.ts +13 -0
- package/dist/src/calendar/utils.d.ts +31 -0
- package/dist/src/canvas/canvas.d.ts +92 -0
- package/dist/src/canvas/index.d.ts +2 -0
- package/dist/src/condition-builder/cb-compound-expression.d.ts +31 -0
- package/dist/src/condition-builder/cb-divider.d.ts +26 -0
- package/dist/src/condition-builder/cb-expression.d.ts +31 -0
- package/dist/src/condition-builder/cb-predicate.d.ts +30 -0
- package/dist/src/condition-builder/condition-builder.d.ts +27 -0
- package/dist/src/condition-builder/index.d.ts +5 -0
- package/dist/src/dropdown-button/dropdown-button.d.ts +68 -0
- package/dist/src/dropdown-button/index.d.ts +1 -0
- package/dist/src/flow-designer/commands.d.ts +66 -0
- package/dist/src/flow-designer/flow-designer-node.d.ts +46 -0
- package/dist/src/flow-designer/flow-designer.d.ts +133 -0
- package/dist/src/flow-designer/index.d.ts +7 -0
- package/dist/src/flow-designer/layout.d.ts +30 -0
- package/dist/src/flow-designer/types.d.ts +142 -0
- package/dist/src/flow-designer/validation.d.ts +43 -0
- package/dist/src/flow-designer/workflow-utils.d.ts +40 -0
- package/dist/src/html-editor/html-editor.d.ts +89 -0
- package/dist/src/html-editor/index.d.ts +2 -0
- package/dist/src/index.d.ts +15 -0
- package/dist/src/list/index.d.ts +2 -0
- package/dist/src/list/list-item.d.ts +35 -0
- package/dist/src/list/list.d.ts +28 -0
- package/dist/src/menu/menu/menu.d.ts +5 -7
- package/dist/src/menu/menu-item/menu-item.d.ts +14 -13
- package/dist/src/modal/index.d.ts +1 -0
- package/dist/src/modal/modal.d.ts +57 -0
- package/dist/src/navigation-rail/navigation-rail.d.ts +3 -7
- package/dist/src/notification-manager/index.d.ts +1 -0
- package/dist/src/notification-manager/notification-manager.d.ts +44 -0
- package/dist/src/number-field/number-field.d.ts +2 -2
- package/dist/src/popover/index.d.ts +2 -0
- package/dist/src/popover/popover-content.d.ts +29 -0
- package/dist/src/popover/popover.d.ts +62 -0
- package/dist/src/split-button/index.d.ts +1 -0
- package/dist/src/split-button/split-button.d.ts +72 -0
- package/dist/src/svg/index.d.ts +1 -0
- package/dist/src/svg/svg.d.ts +38 -0
- package/dist/src/toolbar/toolbar.d.ts +3 -3
- package/dist/src/tooltip/tooltip.d.ts +2 -15
- package/dist/test/flow-designer.test.d.ts +1 -0
- package/dist/toolbar.js +3 -3
- package/dist/toolbar.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -2
- package/readme.md +3 -3
- package/src/__controllers/floating-controller.ts +237 -0
- package/src/banner/banner.scss +2 -3
- package/src/button/button/button.ts +1 -0
- package/src/calendar/base-event.ts +49 -0
- package/src/calendar/calendar-column-view.scss +326 -0
- package/src/calendar/calendar-column-view.ts +392 -0
- package/src/calendar/calendar-event.ts +20 -0
- package/src/calendar/calendar-month-view.scss +192 -0
- package/src/calendar/calendar-month-view.ts +244 -0
- package/src/calendar/calendar.scss +71 -0
- package/src/calendar/calendar.ts +298 -0
- package/src/calendar/event-manager.ts +117 -0
- package/src/calendar/index.ts +4 -0
- package/src/calendar/types.ts +14 -0
- package/src/calendar/utils.ts +180 -0
- package/src/canvas/canvas.scss +60 -0
- package/src/canvas/canvas.ts +391 -0
- package/src/canvas/index.ts +2 -0
- package/src/code-highlighter/code-highlighter.ts +1 -1
- package/src/condition-builder/cb-compound-expression.scss +37 -0
- package/src/condition-builder/cb-compound-expression.ts +80 -0
- package/src/condition-builder/cb-divider.scss +93 -0
- package/src/condition-builder/cb-divider.ts +56 -0
- package/src/condition-builder/cb-expression.scss +14 -0
- package/src/condition-builder/cb-expression.ts +49 -0
- package/src/condition-builder/cb-predicate.scss +35 -0
- package/src/condition-builder/cb-predicate.ts +102 -0
- package/src/condition-builder/condition-builder.scss +13 -0
- package/src/condition-builder/condition-builder.ts +38 -0
- package/src/condition-builder/index.ts +5 -0
- package/src/dropdown-button/demo/index.html +110 -0
- package/src/dropdown-button/dropdown-button.scss +22 -0
- package/src/dropdown-button/dropdown-button.ts +206 -0
- package/src/dropdown-button/index.ts +1 -0
- package/src/flow-designer/DEMO.md +239 -0
- package/src/flow-designer/commands.ts +278 -0
- package/src/flow-designer/flow-designer-node.ts +172 -0
- package/src/flow-designer/flow-designer.scss +457 -0
- package/src/flow-designer/flow-designer.ts +611 -0
- package/src/flow-designer/index.ts +41 -0
- package/src/flow-designer/layout.ts +357 -0
- package/src/flow-designer/types.ts +166 -0
- package/src/flow-designer/validation.ts +284 -0
- package/src/flow-designer/workflow-utils.ts +282 -0
- package/src/html-editor/html-editor.scss +188 -0
- package/src/html-editor/html-editor.ts +491 -0
- package/src/html-editor/index.ts +3 -0
- package/src/index.ts +27 -1
- package/src/list/index.ts +2 -0
- package/src/list/list-item.scss +111 -0
- package/src/list/list-item.ts +175 -0
- package/src/list/list.scss +24 -0
- package/src/list/list.ts +51 -0
- package/src/menu/menu/menu.scss +2 -2
- package/src/menu/menu/menu.ts +91 -101
- package/src/menu/menu-item/menu-item.scss +4 -0
- package/src/menu/menu-item/menu-item.ts +82 -78
- package/src/modal/index.ts +1 -0
- package/src/modal/modal.scss +206 -0
- package/src/modal/modal.ts +195 -0
- package/src/navigation-rail/navigation-rail-item.scss +7 -38
- package/src/navigation-rail/navigation-rail-item.ts +1 -2
- package/src/navigation-rail/navigation-rail.scss +17 -21
- package/src/navigation-rail/navigation-rail.ts +6 -9
- package/src/notification-manager/index.ts +1 -0
- package/src/notification-manager/notification-manager.scss +113 -0
- package/src/notification-manager/notification-manager.ts +199 -0
- package/src/number-field/number-field.ts +2 -2
- package/src/peacock-loader.ts +83 -0
- package/src/popover/index.ts +2 -0
- package/src/popover/popover-content.scss +69 -0
- package/src/popover/popover-content.ts +51 -0
- package/src/popover/popover.scss +7 -0
- package/src/popover/popover.ts +170 -0
- package/src/split-button/index.ts +1 -0
- package/src/split-button/split-button-colors.scss +56 -0
- package/src/split-button/split-button-sizes.scss +28 -0
- package/src/split-button/split-button.scss +79 -0
- package/src/split-button/split-button.ts +236 -0
- package/src/svg/index.ts +1 -0
- package/src/svg/svg.scss +91 -0
- package/src/svg/svg.ts +160 -0
- package/src/table/table.ts +2 -2
- package/src/toolbar/toolbar.ts +3 -3
- package/src/tooltip/tooltip.scss +4 -3
- package/src/tooltip/tooltip.ts +46 -104
- package/dist/button-DouvOfEU.js.map +0 -1
- package/dist/button-group-CEdMwvJJ.js +0 -464
- package/dist/button-group-CEdMwvJJ.js.map +0 -1
- package/dist/is-dark-mode-DicqGkCJ.js.map +0 -1
- package/dist/navigation-rail-Lxetd5-Z.js.map +0 -1
- package/dist/src/menu/menu/MenuSurfaceController.d.ts +0 -18
- package/src/menu/menu/MenuSurfaceController.ts +0 -61
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { LitElement, html, nothing } from 'lit';
|
|
2
|
+
import { property, state } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
|
|
5
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
6
|
+
import styles from './notification-manager.scss';
|
|
7
|
+
|
|
8
|
+
type NotificationVariant = 'success' | 'error' | 'info' | 'warning';
|
|
9
|
+
|
|
10
|
+
type NotificationEntry = {
|
|
11
|
+
id: string;
|
|
12
|
+
title: string;
|
|
13
|
+
subtitle?: string;
|
|
14
|
+
action?: string;
|
|
15
|
+
variant: NotificationVariant;
|
|
16
|
+
dismissible: boolean;
|
|
17
|
+
timeout: number;
|
|
18
|
+
hide: boolean;
|
|
19
|
+
width?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
let notificationCounter = 0;
|
|
23
|
+
function nextId(): string {
|
|
24
|
+
return `wc-notification-${++notificationCounter}`;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @label Notification Manager
|
|
29
|
+
* @tag wc-notification-manager
|
|
30
|
+
* @rawTag notification-manager
|
|
31
|
+
* @summary The Notification Manager handles the organization and display of notifications within the application.
|
|
32
|
+
*
|
|
33
|
+
* @fires {CustomEvent} notification-manager-action - Fired when the action button of a managed notification is clicked. Detail: `{ id: string }`.
|
|
34
|
+
* @fires {CustomEvent} notification-manager-dismiss - Fired when a managed notification is dismissed. Detail: `{ id: string }`.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```html
|
|
38
|
+
* <wc-notification-manager position="bottom-right"></wc-notification-manager>
|
|
39
|
+
* <script>
|
|
40
|
+
* window.dispatchEvent(new CustomEvent('notification', {
|
|
41
|
+
* detail: { title: 'Record saved', variant: 'success', dismissible: true }
|
|
42
|
+
* }));
|
|
43
|
+
* </script>
|
|
44
|
+
* ```
|
|
45
|
+
* @tags display, feedback
|
|
46
|
+
*/
|
|
47
|
+
@IndividualComponent
|
|
48
|
+
export class NotificationManager extends LitElement {
|
|
49
|
+
static styles = [styles];
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Name of this manager instance. Only notifications whose `target` matches
|
|
53
|
+
* this name (or whose `target` is absent and this manager's `name` is
|
|
54
|
+
* `'global'`) will be handled.
|
|
55
|
+
*/
|
|
56
|
+
@property({ type: String, reflect: true }) name = 'global';
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Screen position where notifications are stacked.
|
|
60
|
+
*/
|
|
61
|
+
@property({ type: String, reflect: true })
|
|
62
|
+
position: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' =
|
|
63
|
+
'bottom-right';
|
|
64
|
+
|
|
65
|
+
@state() private notifications: NotificationEntry[] = [];
|
|
66
|
+
|
|
67
|
+
private readonly handleWindowNotification = (event: Event) => {
|
|
68
|
+
const evt = event as CustomEvent;
|
|
69
|
+
const detail = evt.detail ?? {};
|
|
70
|
+
|
|
71
|
+
// Route by target: accept if target matches our name, or if we are global
|
|
72
|
+
// and no specific target is set.
|
|
73
|
+
const target: string | undefined = detail.target;
|
|
74
|
+
const isForUs =
|
|
75
|
+
target === this.name || (!target && this.name === 'global');
|
|
76
|
+
|
|
77
|
+
if (!isForUs || detail.processed) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
evt.stopPropagation();
|
|
82
|
+
detail.processed = true;
|
|
83
|
+
|
|
84
|
+
const entry: NotificationEntry = {
|
|
85
|
+
id: nextId(),
|
|
86
|
+
title: detail.title ?? '',
|
|
87
|
+
subtitle: detail.subtitle,
|
|
88
|
+
action: detail.action,
|
|
89
|
+
variant: detail.variant ?? 'info',
|
|
90
|
+
dismissible: detail.dismissible ?? false,
|
|
91
|
+
timeout: detail.timeout ?? 5000,
|
|
92
|
+
hide: false,
|
|
93
|
+
width: detail.width,
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
this.notifications = [...this.notifications, entry];
|
|
97
|
+
|
|
98
|
+
if (typeof detail.callback === 'function') {
|
|
99
|
+
detail.callback(entry.id);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (!entry.dismissible) {
|
|
103
|
+
setTimeout(() => {
|
|
104
|
+
this._hideNotification(entry.id);
|
|
105
|
+
}, entry.timeout);
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
private readonly handleWindowDismiss = (event: Event) => {
|
|
110
|
+
const evt = event as CustomEvent;
|
|
111
|
+
const ids: string[] = evt.detail?.notifications ?? [];
|
|
112
|
+
ids.forEach(id => this._hideNotification(id));
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
connectedCallback() {
|
|
116
|
+
super.connectedCallback();
|
|
117
|
+
window.addEventListener('notification', this.handleWindowNotification);
|
|
118
|
+
window.addEventListener(
|
|
119
|
+
'notification-dismiss',
|
|
120
|
+
this.handleWindowDismiss,
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
disconnectedCallback() {
|
|
125
|
+
window.removeEventListener(
|
|
126
|
+
'notification',
|
|
127
|
+
this.handleWindowNotification,
|
|
128
|
+
);
|
|
129
|
+
window.removeEventListener(
|
|
130
|
+
'notification-dismiss',
|
|
131
|
+
this.handleWindowDismiss,
|
|
132
|
+
);
|
|
133
|
+
super.disconnectedCallback();
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
private _hideNotification(id: string) {
|
|
137
|
+
this.notifications = this.notifications.map(n =>
|
|
138
|
+
n.id === id ? { ...n, hide: true } : n,
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private _handleDismiss(id: string) {
|
|
143
|
+
this._hideNotification(id);
|
|
144
|
+
this.dispatchEvent(
|
|
145
|
+
new CustomEvent('notification-manager-dismiss', {
|
|
146
|
+
detail: { id },
|
|
147
|
+
bubbles: true,
|
|
148
|
+
composed: true,
|
|
149
|
+
}),
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
private _handleAction(id: string) {
|
|
154
|
+
this.dispatchEvent(
|
|
155
|
+
new CustomEvent('notification-manager-action', {
|
|
156
|
+
detail: { id },
|
|
157
|
+
bubbles: true,
|
|
158
|
+
composed: true,
|
|
159
|
+
}),
|
|
160
|
+
);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
private renderNotification(n: NotificationEntry) {
|
|
164
|
+
return html`
|
|
165
|
+
<div
|
|
166
|
+
id=${n.id}
|
|
167
|
+
class=${classMap({ notification: true, hidden: n.hide })}
|
|
168
|
+
style=${n.width ? `width: ${n.width}` : nothing}
|
|
169
|
+
>
|
|
170
|
+
<wc-notification
|
|
171
|
+
variant=${n.variant}
|
|
172
|
+
?dismissible=${n.dismissible}
|
|
173
|
+
managed
|
|
174
|
+
action=${n.action ?? nothing}
|
|
175
|
+
@notification-dismiss=${() => this._handleDismiss(n.id)}
|
|
176
|
+
@notification-action-click=${() => this._handleAction(n.id)}
|
|
177
|
+
>
|
|
178
|
+
<span slot="title">${n.title}</span>
|
|
179
|
+
${n.subtitle
|
|
180
|
+
? html`<span slot="subtitle">${n.subtitle}</span>`
|
|
181
|
+
: nothing}
|
|
182
|
+
</wc-notification>
|
|
183
|
+
</div>
|
|
184
|
+
`;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
render() {
|
|
188
|
+
return html`
|
|
189
|
+
<div
|
|
190
|
+
class=${classMap({
|
|
191
|
+
'notification-manager': true,
|
|
192
|
+
[`position-${this.position}`]: true,
|
|
193
|
+
})}
|
|
194
|
+
>
|
|
195
|
+
${this.notifications.map(n => this.renderNotification(n))}
|
|
196
|
+
</div>
|
|
197
|
+
`;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
@@ -10,8 +10,8 @@ import styles from './number-field.scss';
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* @label Number Field
|
|
13
|
-
* @tag number-field
|
|
14
|
-
* @rawTag number
|
|
13
|
+
* @tag wc-number-field
|
|
14
|
+
* @rawTag number-field
|
|
15
15
|
*
|
|
16
16
|
* @summary The Number Field component is used to capture numeric user input.
|
|
17
17
|
*
|
package/src/peacock-loader.ts
CHANGED
|
@@ -14,6 +14,8 @@ import { IconButton } from './button/icon-button/icon-button.js';
|
|
|
14
14
|
import { Fab } from './fab/fab.js';
|
|
15
15
|
import { SegmentedButton } from './segmented-button/segmented-button.js';
|
|
16
16
|
import { SegmentedButtonGroup } from './segmented-button/segmented-button-group.js';
|
|
17
|
+
import { SplitButton } from './split-button/split-button.js';
|
|
18
|
+
import { DropdownButton } from './dropdown-button/dropdown-button.js';
|
|
17
19
|
import { Input } from './input/input.js';
|
|
18
20
|
import { UrlField } from './url-field/url-field.js';
|
|
19
21
|
import { Field } from './field/field.js';
|
|
@@ -28,6 +30,8 @@ import { Radio } from './radio/radio.js';
|
|
|
28
30
|
import { Menu } from './menu/menu/menu.js';
|
|
29
31
|
import { MenuItem } from './menu/menu-item/menu-item.js';
|
|
30
32
|
import { SubMenu } from './menu/sub-menu/sub-menu.js';
|
|
33
|
+
import { List } from './list/list.js';
|
|
34
|
+
import { ListItem } from './list/list-item.js';
|
|
31
35
|
|
|
32
36
|
import { Accordion } from './accordion/accordion.js';
|
|
33
37
|
import { Link } from './link/link.js';
|
|
@@ -37,6 +41,8 @@ import { LinearProgress } from './progress/linear-progress/linear-progress.js';
|
|
|
37
41
|
import { CircularProgress } from './progress/circular-progress/circular-progress.js';
|
|
38
42
|
|
|
39
43
|
import { Tooltip } from './tooltip/tooltip.js';
|
|
44
|
+
import { Popover } from './popover/popover.js';
|
|
45
|
+
import { PopoverContent } from './popover/popover-content.js';
|
|
40
46
|
import { Breadcrumb, BreadcrumbItem } from './breadcrumb/index.js';
|
|
41
47
|
|
|
42
48
|
import { Skeleton } from './skeleton/skeleton.js';
|
|
@@ -45,6 +51,7 @@ import { Spinner } from './spinner/spinner.js';
|
|
|
45
51
|
import { EmptyState } from './empty-state/empty-state.js';
|
|
46
52
|
import { Container } from './container/container.js';
|
|
47
53
|
import { Image } from './image/image.js';
|
|
54
|
+
import { Svg } from './svg/svg.js';
|
|
48
55
|
|
|
49
56
|
import { LoaderConfig, LoaderUtils } from './LoaderUtils.js';
|
|
50
57
|
import { loadCSS } from './CssLoader.js';
|
|
@@ -62,15 +69,28 @@ import { Card } from './card/card.js';
|
|
|
62
69
|
import { CardContent } from './card/card-content.js';
|
|
63
70
|
import { Banner } from './banner/banner.js';
|
|
64
71
|
import { Notification } from './notification/notification.js';
|
|
72
|
+
import { NotificationManager } from './notification-manager/notification-manager.js';
|
|
65
73
|
import { Snackbar } from './snackbar/snackbar.js';
|
|
66
74
|
import { BottomSheet } from './bottom-sheet/bottom-sheet.js';
|
|
67
75
|
import { SideSheet } from './side-sheet/side-sheet.js';
|
|
76
|
+
import { Modal } from './modal/modal.js';
|
|
68
77
|
import { Select } from './select/select.js';
|
|
69
78
|
import { SelectOptionElement } from './select/option.js';
|
|
70
79
|
import { Search } from './search/search.js';
|
|
71
80
|
import { Toolbar } from './toolbar/toolbar.js';
|
|
72
81
|
import { NavigationRail } from './navigation-rail/navigation-rail.js';
|
|
73
82
|
import { NavigationRailItem } from './navigation-rail/navigation-rail-item.js';
|
|
83
|
+
import { Calendar } from './calendar/calendar.js';
|
|
84
|
+
import { CalendarColumnView } from './calendar/calendar-column-view.js';
|
|
85
|
+
import { CalendarMonthView } from './calendar/calendar-month-view.js';
|
|
86
|
+
import { Canvas } from './canvas/canvas.js';
|
|
87
|
+
import { FlowDesigner } from './flow-designer/flow-designer.js';
|
|
88
|
+
import { FlowDesignerNode } from './flow-designer/flow-designer-node.js';
|
|
89
|
+
import { ConditionBuilder } from './condition-builder/condition-builder.js';
|
|
90
|
+
import { CbPredicate } from './condition-builder/cb-predicate.js';
|
|
91
|
+
import { CbCompoundExpression } from './condition-builder/cb-compound-expression.js';
|
|
92
|
+
import { CbExpression } from './condition-builder/cb-expression.js';
|
|
93
|
+
import { CbDivider } from './condition-builder/cb-divider.js';
|
|
74
94
|
|
|
75
95
|
const distDirectory = `${import.meta.url}/..`;
|
|
76
96
|
await loadCSS(`${distDirectory}/assets/styles.css`);
|
|
@@ -128,6 +148,12 @@ const loaderConfig: LoaderConfig = {
|
|
|
128
148
|
'wc-segmented-button-group': {
|
|
129
149
|
CustomElementClass: SegmentedButtonGroup,
|
|
130
150
|
},
|
|
151
|
+
'wc-split-button': {
|
|
152
|
+
CustomElementClass: SplitButton,
|
|
153
|
+
},
|
|
154
|
+
'wc-dropdown-button': {
|
|
155
|
+
CustomElementClass: DropdownButton,
|
|
156
|
+
},
|
|
131
157
|
'wc-divider': {
|
|
132
158
|
CustomElementClass: Divider,
|
|
133
159
|
},
|
|
@@ -176,6 +202,9 @@ const loaderConfig: LoaderConfig = {
|
|
|
176
202
|
'wc-notification': {
|
|
177
203
|
CustomElementClass: Notification,
|
|
178
204
|
},
|
|
205
|
+
'wc-notification-manager': {
|
|
206
|
+
CustomElementClass: NotificationManager,
|
|
207
|
+
},
|
|
179
208
|
'wc-tag': {
|
|
180
209
|
CustomElementClass: Tag,
|
|
181
210
|
},
|
|
@@ -213,12 +242,21 @@ const loaderConfig: LoaderConfig = {
|
|
|
213
242
|
'wc-tooltip': {
|
|
214
243
|
CustomElementClass: Tooltip,
|
|
215
244
|
},
|
|
245
|
+
'wc-popover': {
|
|
246
|
+
CustomElementClass: Popover,
|
|
247
|
+
},
|
|
248
|
+
'wc-popover-content': {
|
|
249
|
+
CustomElementClass: PopoverContent,
|
|
250
|
+
},
|
|
216
251
|
'wc-number-counter': {
|
|
217
252
|
importPath: `${distDirectory}/number-counter.js`,
|
|
218
253
|
},
|
|
219
254
|
'wc-code-editor': {
|
|
220
255
|
importPath: `${distDirectory}/code-editor.js`,
|
|
221
256
|
},
|
|
257
|
+
'wc-html-editor': {
|
|
258
|
+
importPath: `${distDirectory}/html-editor.js`,
|
|
259
|
+
},
|
|
222
260
|
'wc-code-highlighter': {
|
|
223
261
|
importPath: `${distDirectory}/code-highlighter.js`,
|
|
224
262
|
},
|
|
@@ -252,12 +290,21 @@ const loaderConfig: LoaderConfig = {
|
|
|
252
290
|
'wc-sub-menu': {
|
|
253
291
|
CustomElementClass: SubMenu,
|
|
254
292
|
},
|
|
293
|
+
'wc-list': {
|
|
294
|
+
CustomElementClass: List,
|
|
295
|
+
},
|
|
296
|
+
'wc-list-item': {
|
|
297
|
+
CustomElementClass: ListItem,
|
|
298
|
+
},
|
|
255
299
|
'wc-container': {
|
|
256
300
|
CustomElementClass: Container,
|
|
257
301
|
},
|
|
258
302
|
'wc-image': {
|
|
259
303
|
CustomElementClass: Image,
|
|
260
304
|
},
|
|
305
|
+
'wc-svg': {
|
|
306
|
+
CustomElementClass: Svg,
|
|
307
|
+
},
|
|
261
308
|
'wc-slider': {
|
|
262
309
|
CustomElementClass: Slider,
|
|
263
310
|
},
|
|
@@ -285,6 +332,9 @@ const loaderConfig: LoaderConfig = {
|
|
|
285
332
|
'wc-side-sheet': {
|
|
286
333
|
CustomElementClass: SideSheet,
|
|
287
334
|
},
|
|
335
|
+
'wc-modal': {
|
|
336
|
+
CustomElementClass: Modal,
|
|
337
|
+
},
|
|
288
338
|
'wc-select': {
|
|
289
339
|
CustomElementClass: Select,
|
|
290
340
|
},
|
|
@@ -303,6 +353,24 @@ const loaderConfig: LoaderConfig = {
|
|
|
303
353
|
'wc-navigation-rail-item': {
|
|
304
354
|
CustomElementClass: NavigationRailItem,
|
|
305
355
|
},
|
|
356
|
+
'wc-calendar': {
|
|
357
|
+
CustomElementClass: Calendar,
|
|
358
|
+
},
|
|
359
|
+
'wc-calendar-column-view': {
|
|
360
|
+
CustomElementClass: CalendarColumnView,
|
|
361
|
+
},
|
|
362
|
+
'wc-calendar-month-view': {
|
|
363
|
+
CustomElementClass: CalendarMonthView,
|
|
364
|
+
},
|
|
365
|
+
'wc-canvas': {
|
|
366
|
+
CustomElementClass: Canvas,
|
|
367
|
+
},
|
|
368
|
+
'wc-flow-designer': {
|
|
369
|
+
CustomElementClass: FlowDesigner,
|
|
370
|
+
},
|
|
371
|
+
'wc-flow-designer-node': {
|
|
372
|
+
CustomElementClass: FlowDesignerNode,
|
|
373
|
+
},
|
|
306
374
|
'wc-chart-doughnut': {
|
|
307
375
|
importPath: `${distDirectory}/chart-doughnut.js`,
|
|
308
376
|
},
|
|
@@ -315,6 +383,21 @@ const loaderConfig: LoaderConfig = {
|
|
|
315
383
|
'wc-chart-stacked-bar': {
|
|
316
384
|
importPath: `${distDirectory}/chart-stacked-bar.js`,
|
|
317
385
|
},
|
|
386
|
+
'wc-condition-builder': {
|
|
387
|
+
CustomElementClass: ConditionBuilder,
|
|
388
|
+
},
|
|
389
|
+
'wc-cb-predicate': {
|
|
390
|
+
CustomElementClass: CbPredicate,
|
|
391
|
+
},
|
|
392
|
+
'wc-cb-compound-expression': {
|
|
393
|
+
CustomElementClass: CbCompoundExpression,
|
|
394
|
+
},
|
|
395
|
+
'wc-cb-expression': {
|
|
396
|
+
CustomElementClass: CbExpression,
|
|
397
|
+
},
|
|
398
|
+
'wc-cb-divider': {
|
|
399
|
+
CustomElementClass: CbDivider,
|
|
400
|
+
},
|
|
318
401
|
},
|
|
319
402
|
};
|
|
320
403
|
|
package/src/popover/index.ts
CHANGED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
@use "../../scss/mixin";
|
|
2
|
+
|
|
3
|
+
@include mixin.base-styles;
|
|
4
|
+
|
|
5
|
+
:host {
|
|
6
|
+
position: fixed;
|
|
7
|
+
top: 0;
|
|
8
|
+
left: 0;
|
|
9
|
+
z-index: var(--z-index-popover, 1000);
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @prop --popover-content-background: Background color of the popover content
|
|
14
|
+
*/
|
|
15
|
+
--popover-content-background: var(--color-surface-container);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @prop --popover-content-padding: Padding of the popover content
|
|
19
|
+
*/
|
|
20
|
+
--popover-content-padding: var(--spacing-200);
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @prop --popover-content-border-radius: Border radius of the popover content
|
|
24
|
+
*/
|
|
25
|
+
--popover-content-border-radius: var(--shape-corner-small);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @prop --popover-content-min-width: Minimum width of the popover content
|
|
29
|
+
*/
|
|
30
|
+
--popover-content-min-width: 10rem;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
:host([open]) {
|
|
34
|
+
pointer-events: auto;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.popover-content {
|
|
38
|
+
position: relative;
|
|
39
|
+
background: var(--popover-content-background);
|
|
40
|
+
padding: var(--popover-content-padding);
|
|
41
|
+
border-radius: var(--popover-content-border-radius);
|
|
42
|
+
min-width: var(--popover-content-min-width);
|
|
43
|
+
color: var(--color-on-surface);
|
|
44
|
+
|
|
45
|
+
transform: scale(0.9);
|
|
46
|
+
opacity: 0;
|
|
47
|
+
transition:
|
|
48
|
+
transform var(--duration-short2, 0.1s) var(--easing-standard, ease-in-out),
|
|
49
|
+
opacity var(--duration-short2, 0.1s) var(--easing-standard, ease-in-out);
|
|
50
|
+
|
|
51
|
+
&.open {
|
|
52
|
+
transform: scale(1);
|
|
53
|
+
opacity: 1;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.elevation {
|
|
58
|
+
--elevation-level: 2;
|
|
59
|
+
--elevation-container-shape: var(--popover-content-border-radius, var(--shape-corner-small));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.arrow {
|
|
63
|
+
width: 0.75rem;
|
|
64
|
+
height: 0.75rem;
|
|
65
|
+
background: var(--popover-content-background);
|
|
66
|
+
position: absolute;
|
|
67
|
+
z-index: -1;
|
|
68
|
+
display: none;
|
|
69
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
5
|
+
import styles from './popover-content.scss';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @label Popover Content
|
|
9
|
+
* @tag wc-popover-content
|
|
10
|
+
* @rawTag popover-content
|
|
11
|
+
* @summary Content container for the wc-popover component.
|
|
12
|
+
* @childComponent true
|
|
13
|
+
* @tags display
|
|
14
|
+
*
|
|
15
|
+
* @cssprop --popover-content-background - Background color of the popover content. Defaults to `var(--color-surface-container)`.
|
|
16
|
+
* @cssprop --popover-content-padding - Padding of the popover content. Defaults to `var(--spacing-200)`.
|
|
17
|
+
* @cssprop --popover-content-border-radius - Border radius of the popover content. Defaults to `var(--shape-corner-small)`.
|
|
18
|
+
* @cssprop --popover-content-min-width - Minimum width of the popover content. Defaults to `10rem`.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```html
|
|
22
|
+
* <wc-popover-content>
|
|
23
|
+
* <p>Popover body text</p>
|
|
24
|
+
* </wc-popover-content>
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
@IndividualComponent
|
|
28
|
+
export class PopoverContent extends LitElement {
|
|
29
|
+
static styles = [styles];
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Whether the popover content is visible.
|
|
33
|
+
*/
|
|
34
|
+
@property({ type: Boolean, reflect: true }) open = false;
|
|
35
|
+
|
|
36
|
+
render() {
|
|
37
|
+
return html`
|
|
38
|
+
<div
|
|
39
|
+
class=${classMap({
|
|
40
|
+
'popover-content': true,
|
|
41
|
+
open: this.open,
|
|
42
|
+
})}
|
|
43
|
+
part="container"
|
|
44
|
+
>
|
|
45
|
+
<slot></slot>
|
|
46
|
+
<wc-elevation class="elevation"></wc-elevation>
|
|
47
|
+
<div class="arrow" part="arrow"></div>
|
|
48
|
+
</div>
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { html, LitElement } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import type { Placement } from '@floating-ui/dom';
|
|
4
|
+
import IndividualComponent from '@/IndividualComponent.js';
|
|
5
|
+
import { FloatingController } from '../__controllers/floating-controller.js';
|
|
6
|
+
import styles from './popover.scss';
|
|
7
|
+
import type { PopoverContent } from './popover-content.js';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @label Popover
|
|
11
|
+
* @tag wc-popover
|
|
12
|
+
* @rawTag popover
|
|
13
|
+
* @summary Displays additional information in a floating panel anchored to a trigger element.
|
|
14
|
+
* @overview
|
|
15
|
+
* <p>The Popover component wraps a trigger element and a <code>wc-popover-content</code> child. It uses
|
|
16
|
+
* floating-ui to compute position, keeping the panel visible inside the viewport even on scroll.</p>
|
|
17
|
+
* @tags display
|
|
18
|
+
*
|
|
19
|
+
* @fires {CustomEvent} wc-popover--open - Fired when the popover opens.
|
|
20
|
+
* @fires {CustomEvent} wc-popover--close - Fired when the popover closes.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```html
|
|
24
|
+
* <wc-popover trigger="click">
|
|
25
|
+
* <wc-button>Open popover</wc-button>
|
|
26
|
+
* <wc-popover-content>
|
|
27
|
+
* <p>Popover body text goes here.</p>
|
|
28
|
+
* </wc-popover-content>
|
|
29
|
+
* </wc-popover>
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
@IndividualComponent
|
|
33
|
+
export class Popover extends LitElement {
|
|
34
|
+
static styles = [styles];
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Determines how the popover is triggered.
|
|
38
|
+
* Possible values are `"click"`, `"hover"`, `"manual"`.
|
|
39
|
+
*/
|
|
40
|
+
@property({ reflect: true }) trigger: 'click' | 'hover' | 'manual' = 'click';
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Preferred placement of the popover relative to the trigger element.
|
|
44
|
+
* Accepts any floating-ui `Placement` string such as `"bottom"`, `"top-start"`, `"right"`, etc.
|
|
45
|
+
*/
|
|
46
|
+
@property({ reflect: true }) placement: Placement = 'bottom';
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Whether the popover is open.
|
|
50
|
+
*/
|
|
51
|
+
@property({ type: Boolean, reflect: true }) open = false;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Distance in pixels between the trigger element and the popover panel.
|
|
55
|
+
*/
|
|
56
|
+
@property({ type: Number }) offset = 8;
|
|
57
|
+
|
|
58
|
+
private _floating: FloatingController | null = null;
|
|
59
|
+
|
|
60
|
+
private _contentEl: PopoverContent | null = null;
|
|
61
|
+
|
|
62
|
+
private _triggerEl: HTMLElement | null = null;
|
|
63
|
+
|
|
64
|
+
private _setupFloating() {
|
|
65
|
+
// Tear down any existing controller
|
|
66
|
+
if (this._floating) {
|
|
67
|
+
this._floating = null;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Resolve the content element
|
|
71
|
+
this._contentEl = this.querySelector<PopoverContent>('wc-popover-content');
|
|
72
|
+
|
|
73
|
+
// Resolve the trigger element: first light-DOM child that is NOT wc-popover-content
|
|
74
|
+
this._triggerEl =
|
|
75
|
+
(Array.from(this.children).find(
|
|
76
|
+
(c) => c.tagName.toLowerCase() !== 'wc-popover-content',
|
|
77
|
+
) as HTMLElement) ?? null;
|
|
78
|
+
|
|
79
|
+
if (!this._triggerEl || !this._contentEl) return;
|
|
80
|
+
|
|
81
|
+
const triggerMode =
|
|
82
|
+
this.trigger === 'manual'
|
|
83
|
+
? 'manual'
|
|
84
|
+
: (this.trigger as 'click' | 'hover');
|
|
85
|
+
|
|
86
|
+
this._floating = new FloatingController(this, {
|
|
87
|
+
placement: this.placement,
|
|
88
|
+
strategy: 'fixed',
|
|
89
|
+
offset: this.offset,
|
|
90
|
+
trigger: triggerMode,
|
|
91
|
+
closeOnClickOutside: true,
|
|
92
|
+
onOpenChange: (isOpen) => {
|
|
93
|
+
this.open = isOpen;
|
|
94
|
+
if (this._contentEl) {
|
|
95
|
+
this._contentEl.open = isOpen;
|
|
96
|
+
}
|
|
97
|
+
this.dispatchEvent(
|
|
98
|
+
new CustomEvent(isOpen ? 'wc-popover--open' : 'wc-popover--close', {
|
|
99
|
+
bubbles: true,
|
|
100
|
+
composed: true,
|
|
101
|
+
}),
|
|
102
|
+
);
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
this._floating.setElements(
|
|
107
|
+
this._triggerEl,
|
|
108
|
+
this._contentEl as unknown as HTMLElement,
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
if (this.open) {
|
|
112
|
+
this._floating.open();
|
|
113
|
+
this._contentEl.open = true;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
connectedCallback() {
|
|
118
|
+
super.connectedCallback();
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
firstUpdated() {
|
|
122
|
+
this._setupFloating();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
updated(changedProps: Map<string, unknown>) {
|
|
126
|
+
if (
|
|
127
|
+
changedProps.has('trigger') ||
|
|
128
|
+
changedProps.has('placement') ||
|
|
129
|
+
changedProps.has('offset')
|
|
130
|
+
) {
|
|
131
|
+
this._setupFloating();
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (changedProps.has('open') && this._floating) {
|
|
135
|
+
if (this.open && !this._floating.isOpen) {
|
|
136
|
+
this._floating.open();
|
|
137
|
+
if (this._contentEl) this._contentEl.open = true;
|
|
138
|
+
} else if (!this.open && this._floating.isOpen) {
|
|
139
|
+
this._floating.close();
|
|
140
|
+
if (this._contentEl) this._contentEl.open = false;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Programmatically opens the popover.
|
|
147
|
+
*/
|
|
148
|
+
show() {
|
|
149
|
+
if (this._floating && !this._floating.isOpen) {
|
|
150
|
+
this._floating.open();
|
|
151
|
+
} else if (!this._floating) {
|
|
152
|
+
this.open = true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Programmatically closes the popover.
|
|
158
|
+
*/
|
|
159
|
+
hide() {
|
|
160
|
+
if (this._floating && this._floating.isOpen) {
|
|
161
|
+
this._floating.close();
|
|
162
|
+
} else if (!this._floating) {
|
|
163
|
+
this.open = false;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
render() {
|
|
168
|
+
return html`<slot></slot>`;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SplitButton } from './split-button.js';
|