@redvars/peacock 3.5.1 → 3.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/condition-builder.js +58 -0
- package/dist/condition-builder.js.map +1 -0
- package/dist/custom-elements-jsdocs.json +7976 -4294
- package/dist/custom-elements.json +14358 -7589
- 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-dZnLJOQT.js +1656 -0
- package/dist/flow-designer-dZnLJOQT.js.map +1 -0
- package/dist/flow-designer-node-XMe-jlKg.js +548 -0
- package/dist/flow-designer-node-XMe-jlKg.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 +358 -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 +418 -0
- package/dist/modal.js.map +1 -0
- package/dist/{navigation-rail-Lxetd5-Z.js → navigation-rail-DyO0oAZU.js} +306 -2197
- package/dist/navigation-rail-DyO0oAZU.js.map +1 -0
- package/dist/notification-manager.js +268 -0
- package/dist/notification-manager.js.map +1 -0
- package/dist/peacock-loader.js +84 -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 +56 -0
- package/dist/src/html-editor/index.d.ts +2 -0
- package/dist/src/index.d.ts +13 -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 +63 -0
- package/dist/src/notification-manager/index.d.ts +1 -0
- package/dist/src/notification-manager/notification-manager.d.ts +44 -0
- 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/tooltip/tooltip.d.ts +2 -15
- package/dist/test/flow-designer.test.d.ts +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
- package/readme.md +2 -2
- 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/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 +146 -0
- package/src/html-editor/html-editor.ts +276 -0
- package/src/html-editor/index.ts +3 -0
- package/src/index.ts +25 -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 +201 -0
- 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/peacock-loader.ts +71 -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/table/table.ts +2 -2
- 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,388 @@
|
|
|
1
|
+
import { a as i, _ as __decorate, I as IndividualComponent, i as i$1, b } from './IndividualComponent-DUINtMGK.js';
|
|
2
|
+
import { n } from './property-1psGvXOq.js';
|
|
3
|
+
import { r } from './state-DwbEjqVk.js';
|
|
4
|
+
import { e } from './query-QBcUV-L_.js';
|
|
5
|
+
import { e as e$1 } from './class-map-YU7g0o3B.js';
|
|
6
|
+
import './directive-ZPhl09Yt.js';
|
|
7
|
+
|
|
8
|
+
var css_248z$2 = i`@charset "UTF-8";
|
|
9
|
+
* {
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.screen-reader-only {
|
|
14
|
+
display: none !important;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:host {
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
position: relative;
|
|
20
|
+
--split-button-container-shape: var(--shape-corner-medium);
|
|
21
|
+
--split-button-gap: 0.125rem;
|
|
22
|
+
--split-button-icon-size: 1.125rem;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.split-button {
|
|
26
|
+
display: inline-flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: var(--split-button-gap);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.action-button {
|
|
32
|
+
--button-container-shape: var(--split-button-container-shape);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.dropdown-trigger {
|
|
36
|
+
--button-container-shape: var(--split-button-container-shape);
|
|
37
|
+
--button-icon-size: var(--split-button-icon-size);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.dropdown-icon {
|
|
41
|
+
transition: transform 200ms ease;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dropdown-trigger.active .dropdown-icon {
|
|
45
|
+
transform: rotate(180deg);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* ── Variant: Filled ────────────────────────────────────── */
|
|
49
|
+
.split-button.variant-filled .action-button,
|
|
50
|
+
.split-button.variant-filled .dropdown-trigger {
|
|
51
|
+
--filled-button-container-color: var(--filled-split-button-container-color);
|
|
52
|
+
--filled-button-label-text-color: var(--filled-split-button-label-text-color);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/* ── Variant: Tonal ─────────────────────────────────────── */
|
|
56
|
+
.split-button.variant-tonal .action-button,
|
|
57
|
+
.split-button.variant-tonal .dropdown-trigger {
|
|
58
|
+
--tonal-button-container-color: var(--tonal-split-button-container-color);
|
|
59
|
+
--tonal-button-label-text-color: var(--tonal-split-button-label-text-color);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/* ── Variant: Outlined ──────────────────────────────────── */
|
|
63
|
+
.split-button.variant-outlined .action-button,
|
|
64
|
+
.split-button.variant-outlined .dropdown-trigger {
|
|
65
|
+
--outlined-button-outline-color: var(--outlined-split-button-outline-color, var(--color-outline));
|
|
66
|
+
--outlined-button-label-text-color: var(--outlined-split-button-label-text-color);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
:host([block]) {
|
|
70
|
+
width: 100%;
|
|
71
|
+
}
|
|
72
|
+
:host([block]) .split-button {
|
|
73
|
+
width: 100%;
|
|
74
|
+
}
|
|
75
|
+
:host([block]) .action-button {
|
|
76
|
+
flex: 1;
|
|
77
|
+
}`;
|
|
78
|
+
|
|
79
|
+
var css_248z$1 = i`:host([color=primary]) {
|
|
80
|
+
--filled-split-button-container-color: var(--color-primary);
|
|
81
|
+
--filled-split-button-label-text-color: var(--color-on-primary);
|
|
82
|
+
--tonal-split-button-container-color: var(--color-primary-container);
|
|
83
|
+
--tonal-split-button-label-text-color: var(--color-on-primary-container);
|
|
84
|
+
--outlined-split-button-outline-color: var(--color-primary);
|
|
85
|
+
--outlined-split-button-label-text-color: var(--color-primary);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
:host([color=secondary]) {
|
|
89
|
+
--filled-split-button-container-color: var(--color-secondary);
|
|
90
|
+
--filled-split-button-label-text-color: var(--color-on-secondary);
|
|
91
|
+
--tonal-split-button-container-color: var(--color-secondary-container);
|
|
92
|
+
--tonal-split-button-label-text-color: var(--color-on-secondary-container);
|
|
93
|
+
--outlined-split-button-outline-color: var(--color-secondary);
|
|
94
|
+
--outlined-split-button-label-text-color: var(--color-secondary);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
:host([color=tertiary]) {
|
|
98
|
+
--filled-split-button-container-color: var(--color-tertiary);
|
|
99
|
+
--filled-split-button-label-text-color: var(--color-on-tertiary);
|
|
100
|
+
--tonal-split-button-container-color: var(--color-tertiary-container);
|
|
101
|
+
--tonal-split-button-label-text-color: var(--color-on-tertiary-container);
|
|
102
|
+
--outlined-split-button-outline-color: var(--color-tertiary);
|
|
103
|
+
--outlined-split-button-label-text-color: var(--color-tertiary);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
:host([color=success]) {
|
|
107
|
+
--filled-split-button-container-color: var(--color-success);
|
|
108
|
+
--filled-split-button-label-text-color: var(--color-on-success);
|
|
109
|
+
--tonal-split-button-container-color: var(--color-success-container);
|
|
110
|
+
--tonal-split-button-label-text-color: var(--color-on-success-container);
|
|
111
|
+
--outlined-split-button-outline-color: var(--color-success);
|
|
112
|
+
--outlined-split-button-label-text-color: var(--color-success);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
:host([color=danger]) {
|
|
116
|
+
--filled-split-button-container-color: var(--color-error);
|
|
117
|
+
--filled-split-button-label-text-color: var(--color-on-error);
|
|
118
|
+
--tonal-split-button-container-color: var(--color-error-container);
|
|
119
|
+
--tonal-split-button-label-text-color: var(--color-on-error-container);
|
|
120
|
+
--outlined-split-button-outline-color: var(--color-error);
|
|
121
|
+
--outlined-split-button-label-text-color: var(--color-error);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
:host([color=warning]) {
|
|
125
|
+
--filled-split-button-container-color: var(--color-warning);
|
|
126
|
+
--filled-split-button-label-text-color: var(--color-on-warning);
|
|
127
|
+
--tonal-split-button-container-color: var(--color-warning-container);
|
|
128
|
+
--tonal-split-button-label-text-color: var(--color-on-warning-container);
|
|
129
|
+
--outlined-split-button-outline-color: var(--color-warning);
|
|
130
|
+
--outlined-split-button-label-text-color: var(--color-warning);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
:host([color=on-surface]) {
|
|
134
|
+
--filled-split-button-container-color: var(--color-on-surface);
|
|
135
|
+
--filled-split-button-label-text-color: var(--color-surface);
|
|
136
|
+
--tonal-split-button-container-color: var(--color-on-surface-container);
|
|
137
|
+
--tonal-split-button-label-text-color: var(--color-surface-container-high);
|
|
138
|
+
--outlined-split-button-outline-color: var(--color-on-surface);
|
|
139
|
+
--outlined-split-button-label-text-color: var(--color-on-surface);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
:host([color=surface]) {
|
|
143
|
+
--filled-split-button-container-color: var(--color-surface-container-high);
|
|
144
|
+
--filled-split-button-label-text-color: var(--color-on-surface);
|
|
145
|
+
--tonal-split-button-container-color: var(--color-surface-container-high);
|
|
146
|
+
--tonal-split-button-label-text-color: var(--color-on-surface-container);
|
|
147
|
+
--outlined-split-button-outline-color: var(--color-on-surface);
|
|
148
|
+
--outlined-split-button-label-text-color: var(--color-on-surface);
|
|
149
|
+
}`;
|
|
150
|
+
|
|
151
|
+
var css_248z = i`:host([size=xs]),
|
|
152
|
+
:host([size=extra-small]) {
|
|
153
|
+
--split-button-icon-size: 1rem;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
:host([size=sm]),
|
|
157
|
+
:host([size=small]) {
|
|
158
|
+
--split-button-icon-size: 1.125rem;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
:host([size=md]),
|
|
162
|
+
:host([size=medium]) {
|
|
163
|
+
--split-button-icon-size: 1.25rem;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
:host([size=lg]),
|
|
167
|
+
:host([size=large]) {
|
|
168
|
+
--split-button-icon-size: 1.5rem;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
:host([size=xl]),
|
|
172
|
+
:host([size=extra-large]) {
|
|
173
|
+
--split-button-icon-size: 2rem;
|
|
174
|
+
}`;
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @label Split Button
|
|
178
|
+
* @tag wc-split-button
|
|
179
|
+
* @rawTag split-button
|
|
180
|
+
*
|
|
181
|
+
* @summary A split button lets users perform a default action or choose from a set of related actions via a dropdown menu.
|
|
182
|
+
* @overview
|
|
183
|
+
* <p>A split button combines a primary action button with a dropdown arrow that opens a menu. Following M3 Material Design, the split button provides a default action alongside a set of secondary options, reducing clutter while keeping alternative actions accessible.</p>
|
|
184
|
+
*
|
|
185
|
+
* @cssprop --split-button-container-shape: Defines the border radius of the split button container shape.
|
|
186
|
+
*
|
|
187
|
+
* @cssprop --filled-split-button-container-color: Color of the filled split button container.
|
|
188
|
+
* @cssprop --filled-split-button-label-text-color: Text color of the filled split button label.
|
|
189
|
+
*
|
|
190
|
+
* @cssprop --outlined-split-button-container-color: Color of the outlined split button container.
|
|
191
|
+
* @cssprop --outlined-split-button-label-text-color: Text color of the outlined split button label.
|
|
192
|
+
*
|
|
193
|
+
* @cssprop --tonal-split-button-container-color: Color of the tonal split button container.
|
|
194
|
+
* @cssprop --tonal-split-button-label-text-color: Text color of the tonal split button label.
|
|
195
|
+
*
|
|
196
|
+
* @fires {MouseEvent} click - Dispatched when the primary action button is clicked.
|
|
197
|
+
* @fires {CustomEvent} toggle-menu - Dispatched when the dropdown menu is opened or closed.
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```html
|
|
201
|
+
* <wc-split-button>
|
|
202
|
+
* Save
|
|
203
|
+
* <wc-menu-item slot="menu">Save as draft</wc-menu-item>
|
|
204
|
+
* <wc-menu-item slot="menu">Save and publish</wc-menu-item>
|
|
205
|
+
* </wc-split-button>
|
|
206
|
+
* ```
|
|
207
|
+
* @tags controls
|
|
208
|
+
*/
|
|
209
|
+
let SplitButton = class SplitButton extends i$1 {
|
|
210
|
+
constructor() {
|
|
211
|
+
super(...arguments);
|
|
212
|
+
/**
|
|
213
|
+
* Button size.
|
|
214
|
+
* Possible values are `"xs"`, `"sm"`, `"md"`, `"lg"`, `"xl"`. Defaults to `"sm"`.
|
|
215
|
+
*/
|
|
216
|
+
this.size = 'sm';
|
|
217
|
+
/**
|
|
218
|
+
* The visual style of the split button.
|
|
219
|
+
*
|
|
220
|
+
* Possible variant values:
|
|
221
|
+
* `"filled"` is a filled button.
|
|
222
|
+
* `"outlined"` is an outlined button.
|
|
223
|
+
* `"tonal"` is a light color button.
|
|
224
|
+
*/
|
|
225
|
+
this.variant = 'filled';
|
|
226
|
+
/**
|
|
227
|
+
* Defines the primary color of the split button.
|
|
228
|
+
*/
|
|
229
|
+
this.color = 'primary';
|
|
230
|
+
/**
|
|
231
|
+
* Whether the split button is disabled.
|
|
232
|
+
*/
|
|
233
|
+
this.disabled = false;
|
|
234
|
+
this._menuOpen = false;
|
|
235
|
+
this._menuId = `split-menu-${Math.random().toString(36).slice(2, 9)}`;
|
|
236
|
+
this._onMenuOpened = () => {
|
|
237
|
+
this._menuOpen = true;
|
|
238
|
+
this.dispatchEvent(new CustomEvent('toggle-menu', {
|
|
239
|
+
detail: { open: true },
|
|
240
|
+
bubbles: true,
|
|
241
|
+
composed: true,
|
|
242
|
+
}));
|
|
243
|
+
};
|
|
244
|
+
this._onMenuClosed = () => {
|
|
245
|
+
this._menuOpen = false;
|
|
246
|
+
this.dispatchEvent(new CustomEvent('toggle-menu', {
|
|
247
|
+
detail: { open: false },
|
|
248
|
+
bubbles: true,
|
|
249
|
+
composed: true,
|
|
250
|
+
}));
|
|
251
|
+
};
|
|
252
|
+
this._onKeyDown = (event) => {
|
|
253
|
+
if (this.disabled)
|
|
254
|
+
return;
|
|
255
|
+
if (event.key === 'ArrowDown' &&
|
|
256
|
+
event.target === this._dropdownButton) {
|
|
257
|
+
event.preventDefault();
|
|
258
|
+
if (!this._menuOpen) {
|
|
259
|
+
this._menu.anchorElement = this;
|
|
260
|
+
this._menu?.show();
|
|
261
|
+
}
|
|
262
|
+
// Focus the menu so keyboard nav works
|
|
263
|
+
requestAnimationFrame(() => this._menu?.focus());
|
|
264
|
+
}
|
|
265
|
+
if (event.key === 'Escape' && this._menuOpen) {
|
|
266
|
+
this._menu?.close();
|
|
267
|
+
this._dropdownButton?.focus();
|
|
268
|
+
}
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
focus() {
|
|
272
|
+
const btn = this.shadowRoot?.querySelector('.action-button');
|
|
273
|
+
btn?.focus();
|
|
274
|
+
}
|
|
275
|
+
_onActionClick(event) {
|
|
276
|
+
if (this.disabled) {
|
|
277
|
+
event.stopImmediatePropagation();
|
|
278
|
+
event.preventDefault();
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
// Close menu if open
|
|
282
|
+
if (this._menuOpen) {
|
|
283
|
+
this._menu?.close();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
_onDropdownClick(event) {
|
|
287
|
+
event.stopPropagation();
|
|
288
|
+
if (this.disabled)
|
|
289
|
+
return;
|
|
290
|
+
if (this._menuOpen) {
|
|
291
|
+
this._menu?.close();
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
this._menu.anchorElement = this;
|
|
295
|
+
this._menu?.show();
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
connectedCallback() {
|
|
299
|
+
super.connectedCallback();
|
|
300
|
+
this.addEventListener('keydown', this._onKeyDown);
|
|
301
|
+
}
|
|
302
|
+
disconnectedCallback() {
|
|
303
|
+
this.removeEventListener('keydown', this._onKeyDown);
|
|
304
|
+
super.disconnectedCallback();
|
|
305
|
+
}
|
|
306
|
+
render() {
|
|
307
|
+
const actionClasses = {
|
|
308
|
+
'action-button': true,
|
|
309
|
+
disabled: this.disabled,
|
|
310
|
+
};
|
|
311
|
+
const dropdownClasses = {
|
|
312
|
+
'dropdown-trigger': true,
|
|
313
|
+
active: this._menuOpen,
|
|
314
|
+
disabled: this.disabled,
|
|
315
|
+
};
|
|
316
|
+
const containerClasses = {
|
|
317
|
+
'split-button': true,
|
|
318
|
+
[`variant-${this.variant}`]: true,
|
|
319
|
+
disabled: this.disabled,
|
|
320
|
+
};
|
|
321
|
+
return b `
|
|
322
|
+
<div class=${e$1(containerClasses)}>
|
|
323
|
+
<wc-button
|
|
324
|
+
class=${e$1(actionClasses)}
|
|
325
|
+
size=${this.size}
|
|
326
|
+
variant=${this.variant}
|
|
327
|
+
?disabled=${this.disabled}
|
|
328
|
+
@click=${this._onActionClick}
|
|
329
|
+
>
|
|
330
|
+
<slot></slot>
|
|
331
|
+
</wc-button>
|
|
332
|
+
|
|
333
|
+
<wc-icon-button
|
|
334
|
+
class=${e$1(dropdownClasses)}
|
|
335
|
+
size=${this.size}
|
|
336
|
+
variant=${this.variant}
|
|
337
|
+
?disabled=${this.disabled}
|
|
338
|
+
.configAria=${{
|
|
339
|
+
'aria-haspopup': 'menu',
|
|
340
|
+
'aria-expanded': String(this._menuOpen),
|
|
341
|
+
'aria-controls': this._menuId,
|
|
342
|
+
'aria-label': 'Open split button menu',
|
|
343
|
+
}}
|
|
344
|
+
@click=${this._onDropdownClick}
|
|
345
|
+
>
|
|
346
|
+
<wc-icon class="dropdown-icon" name="arrow_drop_down" aria-hidden="true"></wc-icon>
|
|
347
|
+
</wc-icon-button>
|
|
348
|
+
</div>
|
|
349
|
+
|
|
350
|
+
<wc-menu
|
|
351
|
+
id=${this._menuId}
|
|
352
|
+
placement="bottom-end"
|
|
353
|
+
@opened=${this._onMenuOpened}
|
|
354
|
+
@closed=${this._onMenuClosed}
|
|
355
|
+
>
|
|
356
|
+
<slot name="menu"></slot>
|
|
357
|
+
</wc-menu>
|
|
358
|
+
`;
|
|
359
|
+
}
|
|
360
|
+
};
|
|
361
|
+
SplitButton.styles = [css_248z$2, css_248z$1, css_248z];
|
|
362
|
+
__decorate([
|
|
363
|
+
n({ reflect: true })
|
|
364
|
+
], SplitButton.prototype, "size", void 0);
|
|
365
|
+
__decorate([
|
|
366
|
+
n({ reflect: true })
|
|
367
|
+
], SplitButton.prototype, "variant", void 0);
|
|
368
|
+
__decorate([
|
|
369
|
+
n({ reflect: true })
|
|
370
|
+
], SplitButton.prototype, "color", void 0);
|
|
371
|
+
__decorate([
|
|
372
|
+
n({ type: Boolean, reflect: true })
|
|
373
|
+
], SplitButton.prototype, "disabled", void 0);
|
|
374
|
+
__decorate([
|
|
375
|
+
r()
|
|
376
|
+
], SplitButton.prototype, "_menuOpen", void 0);
|
|
377
|
+
__decorate([
|
|
378
|
+
e('.dropdown-trigger')
|
|
379
|
+
], SplitButton.prototype, "_dropdownButton", void 0);
|
|
380
|
+
__decorate([
|
|
381
|
+
e('wc-menu')
|
|
382
|
+
], SplitButton.prototype, "_menu", void 0);
|
|
383
|
+
SplitButton = __decorate([
|
|
384
|
+
IndividualComponent
|
|
385
|
+
], SplitButton);
|
|
386
|
+
|
|
387
|
+
export { SplitButton };
|
|
388
|
+
//# sourceMappingURL=split-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"split-button.js","sources":["../../src/split-button/split-button.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport styles from './split-button.scss';\nimport colorStyles from './split-button-colors.scss';\nimport sizeStyles from './split-button-sizes.scss';\n\n/**\n * @label Split Button\n * @tag wc-split-button\n * @rawTag split-button\n *\n * @summary A split button lets users perform a default action or choose from a set of related actions via a dropdown menu.\n * @overview\n * <p>A split button combines a primary action button with a dropdown arrow that opens a menu. Following M3 Material Design, the split button provides a default action alongside a set of secondary options, reducing clutter while keeping alternative actions accessible.</p>\n *\n * @cssprop --split-button-container-shape: Defines the border radius of the split button container shape.\n *\n * @cssprop --filled-split-button-container-color: Color of the filled split button container.\n * @cssprop --filled-split-button-label-text-color: Text color of the filled split button label.\n *\n * @cssprop --outlined-split-button-container-color: Color of the outlined split button container.\n * @cssprop --outlined-split-button-label-text-color: Text color of the outlined split button label.\n *\n * @cssprop --tonal-split-button-container-color: Color of the tonal split button container.\n * @cssprop --tonal-split-button-label-text-color: Text color of the tonal split button label.\n *\n * @fires {MouseEvent} click - Dispatched when the primary action button is clicked.\n * @fires {CustomEvent} toggle-menu - Dispatched when the dropdown menu is opened or closed.\n *\n * @example\n * ```html\n * <wc-split-button>\n * Save\n * <wc-menu-item slot=\"menu\">Save as draft</wc-menu-item>\n * <wc-menu-item slot=\"menu\">Save and publish</wc-menu-item>\n * </wc-split-button>\n * ```\n * @tags controls\n */\n@IndividualComponent\nexport class SplitButton extends LitElement {\n static override styles = [styles, colorStyles, sizeStyles];\n\n /**\n * Button size.\n * Possible values are `\"xs\"`, `\"sm\"`, `\"md\"`, `\"lg\"`, `\"xl\"`. Defaults to `\"sm\"`.\n */\n @property({ reflect: true }) size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';\n\n /**\n * The visual style of the split button.\n *\n * Possible variant values:\n * `\"filled\"` is a filled button.\n * `\"outlined\"` is an outlined button.\n * `\"tonal\"` is a light color button.\n */\n @property({ reflect: true }) variant: 'filled' | 'tonal' | 'outlined' =\n 'filled';\n\n /**\n * Defines the primary color of the split button.\n */\n @property({ reflect: true }) color:\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'success'\n | 'danger'\n | 'warning'\n | 'surface'\n | 'on-surface' = 'primary';\n\n /**\n * Whether the split button is disabled.\n */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n @state() private _menuOpen = false;\n\n @query('.dropdown-trigger') private readonly _dropdownButton!: HTMLElement;\n\n @query('wc-menu') private readonly _menu!: HTMLElement & {\n open: boolean;\n anchorElement: HTMLElement | null;\n show: () => void;\n close: () => void;\n };\n\n private _menuId = `split-menu-${Math.random().toString(36).slice(2, 9)}`;\n\n override focus() {\n const btn =\n this.shadowRoot?.querySelector<HTMLElement>('.action-button');\n btn?.focus();\n }\n\n private _onActionClick(event: MouseEvent) {\n if (this.disabled) {\n event.stopImmediatePropagation();\n event.preventDefault();\n return;\n }\n\n // Close menu if open\n if (this._menuOpen) {\n this._menu?.close();\n }\n }\n\n private _onDropdownClick(event: MouseEvent) {\n event.stopPropagation();\n if (this.disabled) return;\n\n if (this._menuOpen) {\n this._menu?.close();\n } else {\n this._menu.anchorElement = this;\n this._menu?.show();\n }\n }\n\n private _onMenuOpened = () => {\n this._menuOpen = true;\n this.dispatchEvent(\n new CustomEvent('toggle-menu', {\n detail: { open: true },\n bubbles: true,\n composed: true,\n }),\n );\n };\n\n private _onMenuClosed = () => {\n this._menuOpen = false;\n this.dispatchEvent(\n new CustomEvent('toggle-menu', {\n detail: { open: false },\n bubbles: true,\n composed: true,\n }),\n );\n };\n\n private _onKeyDown = (event: KeyboardEvent) => {\n if (this.disabled) return;\n\n if (\n event.key === 'ArrowDown' &&\n event.target === this._dropdownButton\n ) {\n event.preventDefault();\n if (!this._menuOpen) {\n this._menu.anchorElement = this;\n this._menu?.show();\n }\n // Focus the menu so keyboard nav works\n requestAnimationFrame(() => this._menu?.focus());\n }\n\n if (event.key === 'Escape' && this._menuOpen) {\n this._menu?.close();\n this._dropdownButton?.focus();\n }\n };\n\n override connectedCallback() {\n super.connectedCallback();\n this.addEventListener('keydown', this._onKeyDown);\n }\n\n override disconnectedCallback() {\n this.removeEventListener('keydown', this._onKeyDown);\n super.disconnectedCallback();\n }\n\n override render() {\n const actionClasses = {\n 'action-button': true,\n disabled: this.disabled,\n };\n\n const dropdownClasses = {\n 'dropdown-trigger': true,\n active: this._menuOpen,\n disabled: this.disabled,\n };\n\n const containerClasses = {\n 'split-button': true,\n [`variant-${this.variant}`]: true,\n disabled: this.disabled,\n };\n\n return html`\n <div class=${classMap(containerClasses)}>\n <wc-button\n class=${classMap(actionClasses)}\n size=${this.size}\n variant=${this.variant}\n ?disabled=${this.disabled}\n @click=${this._onActionClick}\n >\n <slot></slot>\n </wc-button>\n\n <wc-icon-button\n class=${classMap(dropdownClasses)}\n size=${this.size}\n variant=${this.variant}\n ?disabled=${this.disabled}\n .configAria=${{\n 'aria-haspopup': 'menu',\n 'aria-expanded': String(this._menuOpen),\n 'aria-controls': this._menuId,\n 'aria-label': 'Open split button menu',\n }}\n @click=${this._onDropdownClick}\n >\n <wc-icon class=\"dropdown-icon\" name=\"arrow_drop_down\" aria-hidden=\"true\"></wc-icon>\n </wc-icon-button>\n </div>\n\n <wc-menu\n id=${this._menuId}\n placement=\"bottom-end\"\n @opened=${this._onMenuOpened}\n @closed=${this._onMenuClosed}\n >\n <slot name=\"menu\"></slot>\n </wc-menu>\n `;\n }\n}\n"],"names":["LitElement","html","classMap","styles","colorStyles","sizeStyles","property","state","query"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgCG;AAEI,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQA,GAAU,CAAA;AAApC,IAAA,WAAA,GAAA;;AAGL;;;AAGG;QAC0B,IAAA,CAAA,IAAI,GAAqC,IAAI;AAE1E;;;;;;;AAOG;QAC0B,IAAA,CAAA,OAAO,GAClC,QAAQ;AAEV;;AAEG;QAC0B,IAAA,CAAA,KAAK,GAQf,SAAS;AAE5B;;AAEG;QACyC,IAAA,CAAA,QAAQ,GAAG,KAAK;QAE3C,IAAA,CAAA,SAAS,GAAG,KAAK;AAW1B,QAAA,IAAA,CAAA,OAAO,GAAG,CAAA,WAAA,EAAc,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE;QAiChE,IAAA,CAAA,aAAa,GAAG,MAAK;AAC3B,YAAA,IAAI,CAAC,SAAS,GAAG,IAAI;AACrB,YAAA,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAC,aAAa,EAAE;AAC7B,gBAAA,MAAM,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE;AACtB,gBAAA,OAAO,EAAE,IAAI;AACb,gBAAA,QAAQ,EAAE,IAAI;AACf,aAAA,CAAC,CACH;AACH,QAA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CA,CAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE;AAAmB,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAE5C,UAAA,CAAA;AAAhB,IAAAC,CAAK;AAA6B,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAEU,UAAA,CAAA;IAA5CC,CAAK,CAAC,mBAAmB;AAAiD,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,MAAA,CAAA;AAExC,UAAA,CAAA;IAAlCA,CAAK,CAAC,SAAS;AAKd,CAAA,EAAA,WAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AA/CS,WAAW,GAAA,UAAA,CAAA;IADvB;AACY,CAAA,EAAA,WAAW,CAiMvB;;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Placement, Strategy } from '@floating-ui/dom';
|
|
2
|
+
import { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
3
|
+
export type TriggerType = 'hover' | 'click' | 'context-menu' | 'manual' | 'focus' | 'hover-focus';
|
|
4
|
+
export interface FloatingOptions {
|
|
5
|
+
placement?: Placement;
|
|
6
|
+
strategy?: Strategy;
|
|
7
|
+
offset?: number;
|
|
8
|
+
trigger?: TriggerType;
|
|
9
|
+
closeOnClickOutside?: boolean;
|
|
10
|
+
onOpenChange?: (isOpen: boolean) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare class FloatingController implements ReactiveController {
|
|
13
|
+
private host;
|
|
14
|
+
private reference;
|
|
15
|
+
private floating;
|
|
16
|
+
private arrowElement;
|
|
17
|
+
private cleanup;
|
|
18
|
+
private options;
|
|
19
|
+
private isHostConnected;
|
|
20
|
+
isOpen: boolean;
|
|
21
|
+
constructor(host: ReactiveControllerHost, options?: FloatingOptions);
|
|
22
|
+
hostConnected(): void;
|
|
23
|
+
hostDisconnected(): void;
|
|
24
|
+
setElements(reference: HTMLElement, floating: HTMLElement, arrowElement?: HTMLElement): void;
|
|
25
|
+
setOptions(options: Partial<FloatingOptions>): void;
|
|
26
|
+
private setupEventListeners;
|
|
27
|
+
private removeEventListeners;
|
|
28
|
+
private toggle;
|
|
29
|
+
private handleContextMenu;
|
|
30
|
+
private handleFocusOut;
|
|
31
|
+
private handleOutsideClick;
|
|
32
|
+
open: () => void;
|
|
33
|
+
close: () => void;
|
|
34
|
+
private updatePosition;
|
|
35
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class BaseEvent {
|
|
2
|
+
gid: string;
|
|
3
|
+
start: Date;
|
|
4
|
+
end: Date;
|
|
5
|
+
constructor(start: Date, end: Date);
|
|
6
|
+
length(): number;
|
|
7
|
+
isOverlapping(event: BaseEvent): boolean;
|
|
8
|
+
isOverlappingWithoutTime(event: BaseEvent): boolean;
|
|
9
|
+
isOverlappingWithDate(date: Date): boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { CalendarEvent } from './calendar-event.js';
|
|
3
|
+
/**
|
|
4
|
+
* @label Calendar Column View
|
|
5
|
+
* @tag wc-calendar-column-view
|
|
6
|
+
* @rawTag calendar-column-view
|
|
7
|
+
* @parentRawTag calendar
|
|
8
|
+
* @summary Internal column view component for the calendar (day/week views).
|
|
9
|
+
*/
|
|
10
|
+
export declare class CalendarColumnView extends LitElement {
|
|
11
|
+
static styles: import("lit").CSSResultGroup[];
|
|
12
|
+
events: CalendarEvent[];
|
|
13
|
+
view: string;
|
|
14
|
+
days: number;
|
|
15
|
+
eventClickable: boolean;
|
|
16
|
+
currentTime: Date;
|
|
17
|
+
contextDate: Date;
|
|
18
|
+
private dateRange;
|
|
19
|
+
private singleDayEvents;
|
|
20
|
+
private multiDayEvents;
|
|
21
|
+
connectedCallback(): void;
|
|
22
|
+
willUpdate(changedProperties: Map<string, unknown>): void;
|
|
23
|
+
firstUpdated(): void;
|
|
24
|
+
private _processEvents;
|
|
25
|
+
private _forEachDayInRange;
|
|
26
|
+
private _getDateOnly;
|
|
27
|
+
private _getDatePercent;
|
|
28
|
+
private _getDayClass;
|
|
29
|
+
private _populateColorVars;
|
|
30
|
+
private _emitDateClick;
|
|
31
|
+
private _emitEventClick;
|
|
32
|
+
private _renderHeader;
|
|
33
|
+
private _renderMultiDayBackground;
|
|
34
|
+
private _renderScale;
|
|
35
|
+
private _renderBackgroundGrid;
|
|
36
|
+
private _renderEvents;
|
|
37
|
+
private _renderMultiDayEvents;
|
|
38
|
+
private _renderCurrentTime;
|
|
39
|
+
private _styleMap;
|
|
40
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { CalendarEvent } from './calendar-event.js';
|
|
3
|
+
/**
|
|
4
|
+
* @label Calendar Month View
|
|
5
|
+
* @tag wc-calendar-month-view
|
|
6
|
+
* @rawTag calendar-month-view
|
|
7
|
+
* @parentRawTag calendar
|
|
8
|
+
* @summary Internal month view component for the calendar.
|
|
9
|
+
*/
|
|
10
|
+
export declare class CalendarMonthView extends LitElement {
|
|
11
|
+
static styles: import("lit").CSSResultGroup[];
|
|
12
|
+
events: CalendarEvent[];
|
|
13
|
+
eventClickable: boolean;
|
|
14
|
+
currentTime: Date;
|
|
15
|
+
contextDate: Date;
|
|
16
|
+
private dateRange;
|
|
17
|
+
private weekDayEvents;
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
willUpdate(changedProperties: Map<string, unknown>): void;
|
|
20
|
+
firstUpdated(): void;
|
|
21
|
+
private _processEvents;
|
|
22
|
+
private _getDatePercent;
|
|
23
|
+
private _getDayClass;
|
|
24
|
+
private _populateColorVars;
|
|
25
|
+
private _emitEventClick;
|
|
26
|
+
private _renderHeader;
|
|
27
|
+
private _renderMultiDayBackground;
|
|
28
|
+
private _renderEvents;
|
|
29
|
+
private _styleMap;
|
|
30
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
31
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import type { CalendarViewType, EventType } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* @label Calendar
|
|
5
|
+
* @tag wc-calendar
|
|
6
|
+
* @rawTag calendar
|
|
7
|
+
* @summary A Material 3 inspired full calendar component for displaying events in day, week, or month views.
|
|
8
|
+
*
|
|
9
|
+
* @cssprop --calendar-border-color - Border color used throughout the calendar grid.
|
|
10
|
+
* @cssprop --calendar-event-bg-color - Background color for calendar events.
|
|
11
|
+
* @cssprop --calendar-event-border-color - Left border color for calendar events.
|
|
12
|
+
*
|
|
13
|
+
* @fires {CustomEvent} event-click - Dispatched when a calendar event is clicked. Detail contains `{ event }`.
|
|
14
|
+
* @fires {CustomEvent} view-change - Dispatched when the calendar view changes. Detail contains `{ view }`.
|
|
15
|
+
* @fires {CustomEvent} date-change - Dispatched when the context date changes. Detail contains `{ date }`.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```html
|
|
19
|
+
* <wc-calendar view="week" style="height: 600px"></wc-calendar>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export declare class Calendar extends LitElement {
|
|
23
|
+
static styles: import("lit").CSSResultGroup[];
|
|
24
|
+
/**
|
|
25
|
+
* Calendar events array.
|
|
26
|
+
*/
|
|
27
|
+
events: EventType[];
|
|
28
|
+
/**
|
|
29
|
+
* Available views configuration.
|
|
30
|
+
*/
|
|
31
|
+
availableViews: CalendarViewType[];
|
|
32
|
+
/**
|
|
33
|
+
* Current calendar view.
|
|
34
|
+
*/
|
|
35
|
+
view: string;
|
|
36
|
+
/**
|
|
37
|
+
* Whether events are clickable.
|
|
38
|
+
*/
|
|
39
|
+
eventClickable: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Show loading state.
|
|
42
|
+
*/
|
|
43
|
+
showLoader: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Timezone string (e.g. 'America/New_York').
|
|
46
|
+
*/
|
|
47
|
+
timezone: string;
|
|
48
|
+
/**
|
|
49
|
+
* The context date for the calendar view.
|
|
50
|
+
*/
|
|
51
|
+
contextDate: Date | null;
|
|
52
|
+
private _currentTime;
|
|
53
|
+
private _currentView;
|
|
54
|
+
connectedCallback(): void;
|
|
55
|
+
willUpdate(changedProperties: Map<string, unknown>): void;
|
|
56
|
+
private _onColumnViewDateClick;
|
|
57
|
+
private _onEventClick;
|
|
58
|
+
previous(): void;
|
|
59
|
+
next(): void;
|
|
60
|
+
private _goToToday;
|
|
61
|
+
private _onViewSegmentChange;
|
|
62
|
+
private _renderHeader;
|
|
63
|
+
private _renderCalendarView;
|
|
64
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
65
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CalendarEvent } from './calendar-event.js';
|
|
2
|
+
export declare class ColumnEvent extends CalendarEvent {
|
|
3
|
+
width: number;
|
|
4
|
+
constructor(event: CalendarEvent);
|
|
5
|
+
}
|
|
6
|
+
export declare class EventManager {
|
|
7
|
+
#private;
|
|
8
|
+
columns: ColumnEvent[][];
|
|
9
|
+
addEvents(events: CalendarEvent[]): void;
|
|
10
|
+
process(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare class MonthEventManager {
|
|
13
|
+
#private;
|
|
14
|
+
columns: ColumnEvent[][];
|
|
15
|
+
addEvents(events: CalendarEvent[]): void;
|
|
16
|
+
process(): void;
|
|
17
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure date utility functions (no external dependencies).
|
|
3
|
+
*/
|
|
4
|
+
export declare function startOfDay(date: Date): Date;
|
|
5
|
+
export declare function endOfDay(date: Date): Date;
|
|
6
|
+
export declare function addDays(date: Date, days: number): Date;
|
|
7
|
+
export declare function addMonths(date: Date, months: number): Date;
|
|
8
|
+
export declare function addHours(date: Date, hours: number): Date;
|
|
9
|
+
export declare function differenceInDays(dateA: Date, dateB: Date): number;
|
|
10
|
+
export declare function startOfWeek(date: Date, weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6): Date;
|
|
11
|
+
export declare function endOfWeek(date: Date, weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6): Date;
|
|
12
|
+
export declare function startOfMonth(date: Date): Date;
|
|
13
|
+
export declare function endOfMonth(date: Date): Date;
|
|
14
|
+
export declare function calculateMonthRange(date: Date, weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6): {
|
|
15
|
+
startDate: Date;
|
|
16
|
+
endDate: Date;
|
|
17
|
+
totalDays: number;
|
|
18
|
+
};
|
|
19
|
+
export declare function calculateWeekRange(date: Date, weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6): {
|
|
20
|
+
startDate: Date;
|
|
21
|
+
endDate: Date;
|
|
22
|
+
totalDays: number;
|
|
23
|
+
};
|
|
24
|
+
export declare function calculateDateRange(view: string, contextDate: Date, days: number): {
|
|
25
|
+
startDate: Date;
|
|
26
|
+
endDate: Date;
|
|
27
|
+
totalDays: number;
|
|
28
|
+
};
|
|
29
|
+
export declare const LONG_EVENT_PADDING = 0.25;
|
|
30
|
+
export declare function formatDate(date: Date, pattern: string): string;
|
|
31
|
+
export declare function getTimePercent(date: Date, forDay?: Date): number;
|