@skdx/web-components-blocks 0.1.0 → 0.35.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/custom-elements.json +5072 -290
- package/dist/chat-composer/ChatComposer.cjs +41 -0
- package/dist/chat-composer/ChatComposer.d.cts +125 -0
- package/dist/chat-composer/ChatComposer.d.ts +125 -0
- package/dist/chat-composer/ChatComposer.js +41 -0
- package/dist/chat-composer/index.cjs +1 -0
- package/dist/chat-composer/index.d.cts +1 -0
- package/dist/chat-composer/index.d.ts +1 -0
- package/dist/chat-composer/index.js +1 -0
- package/dist/chat-message/ChatMessage.cjs +26 -0
- package/dist/chat-message/ChatMessage.d.cts +74 -0
- package/dist/chat-message/ChatMessage.d.ts +74 -0
- package/dist/chat-message/ChatMessage.js +26 -0
- package/dist/chat-message/index.cjs +1 -0
- package/dist/chat-message/index.d.cts +1 -0
- package/dist/chat-message/index.d.ts +1 -0
- package/dist/chat-message/index.js +1 -0
- package/dist/comment/Comment.cjs +26 -0
- package/dist/comment/Comment.d.cts +66 -0
- package/dist/comment/Comment.d.ts +66 -0
- package/dist/comment/Comment.js +26 -0
- package/dist/comment/index.cjs +1 -0
- package/dist/comment/index.d.cts +1 -0
- package/dist/comment/index.d.ts +1 -0
- package/dist/comment/index.js +1 -0
- package/dist/comment-thread/CommentThread.cjs +27 -0
- package/dist/comment-thread/CommentThread.d.cts +67 -0
- package/dist/comment-thread/CommentThread.d.ts +67 -0
- package/dist/comment-thread/CommentThread.js +27 -0
- package/dist/comment-thread/index.cjs +1 -0
- package/dist/comment-thread/index.d.cts +1 -0
- package/dist/comment-thread/index.d.ts +1 -0
- package/dist/comment-thread/index.js +1 -0
- package/dist/confirm-dialog/ConfirmDialog.cjs +38 -0
- package/dist/confirm-dialog/ConfirmDialog.d.cts +101 -0
- package/dist/confirm-dialog/ConfirmDialog.d.ts +101 -0
- package/dist/confirm-dialog/ConfirmDialog.js +38 -0
- package/dist/confirm-dialog/index.cjs +1 -0
- package/dist/confirm-dialog/index.d.cts +1 -0
- package/dist/confirm-dialog/index.d.ts +1 -0
- package/dist/confirm-dialog/index.js +1 -0
- package/dist/conversation-list/ConversationList.cjs +52 -0
- package/dist/conversation-list/ConversationList.d.cts +124 -0
- package/dist/conversation-list/ConversationList.d.ts +124 -0
- package/dist/conversation-list/ConversationList.js +52 -0
- package/dist/conversation-list/index.cjs +1 -0
- package/dist/conversation-list/index.d.cts +1 -0
- package/dist/conversation-list/index.d.ts +1 -0
- package/dist/conversation-list/index.js +1 -0
- package/dist/dashboard-layout/DashboardLayout.cjs +6 -7
- package/dist/dashboard-layout/DashboardLayout.js +9 -10
- package/dist/empty-state/EmptyState.cjs +29 -0
- package/dist/empty-state/EmptyState.d.cts +69 -0
- package/dist/empty-state/EmptyState.d.ts +69 -0
- package/dist/empty-state/EmptyState.js +29 -0
- package/dist/empty-state/index.cjs +1 -0
- package/dist/empty-state/index.d.cts +1 -0
- package/dist/empty-state/index.d.ts +1 -0
- package/dist/empty-state/index.js +1 -0
- package/dist/filter-bar/FilterBar.cjs +44 -0
- package/dist/filter-bar/FilterBar.d.cts +110 -0
- package/dist/filter-bar/FilterBar.d.ts +110 -0
- package/dist/filter-bar/FilterBar.js +44 -0
- package/dist/filter-bar/index.cjs +1 -0
- package/dist/filter-bar/index.d.cts +1 -0
- package/dist/filter-bar/index.d.ts +1 -0
- package/dist/filter-bar/index.js +1 -0
- package/dist/forgot-password-page/ForgotPasswordPage.cjs +57 -0
- package/dist/forgot-password-page/ForgotPasswordPage.d.cts +95 -0
- package/dist/forgot-password-page/ForgotPasswordPage.d.ts +95 -0
- package/dist/forgot-password-page/ForgotPasswordPage.js +57 -0
- package/dist/forgot-password-page/index.cjs +1 -0
- package/dist/forgot-password-page/index.d.cts +1 -0
- package/dist/forgot-password-page/index.d.ts +1 -0
- package/dist/forgot-password-page/index.js +1 -0
- package/dist/form-section/FormSection.cjs +28 -0
- package/dist/form-section/FormSection.d.cts +63 -0
- package/dist/form-section/FormSection.d.ts +63 -0
- package/dist/form-section/FormSection.js +28 -0
- package/dist/form-section/index.cjs +1 -0
- package/dist/form-section/index.d.cts +1 -0
- package/dist/form-section/index.d.ts +1 -0
- package/dist/form-section/index.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +1 -1
- package/dist/internal/slots.cjs +1 -1
- package/dist/internal/slots.d.cts +2 -0
- package/dist/internal/slots.d.ts +2 -0
- package/dist/internal/slots.js +1 -1
- package/dist/notification-center/NotificationCenter.cjs +74 -0
- package/dist/notification-center/NotificationCenter.d.cts +147 -0
- package/dist/notification-center/NotificationCenter.d.ts +147 -0
- package/dist/notification-center/NotificationCenter.js +74 -0
- package/dist/notification-center/index.cjs +1 -0
- package/dist/notification-center/index.d.cts +1 -0
- package/dist/notification-center/index.d.ts +1 -0
- package/dist/notification-center/index.js +1 -0
- package/dist/onboarding-checklist/OnboardingChecklist.cjs +55 -0
- package/dist/onboarding-checklist/OnboardingChecklist.d.cts +89 -0
- package/dist/onboarding-checklist/OnboardingChecklist.d.ts +89 -0
- package/dist/onboarding-checklist/OnboardingChecklist.js +55 -0
- package/dist/onboarding-checklist/index.cjs +1 -0
- package/dist/onboarding-checklist/index.d.cts +1 -0
- package/dist/onboarding-checklist/index.d.ts +1 -0
- package/dist/onboarding-checklist/index.js +1 -0
- package/dist/reset-password-page/ResetPasswordPage.cjs +59 -0
- package/dist/reset-password-page/ResetPasswordPage.d.cts +104 -0
- package/dist/reset-password-page/ResetPasswordPage.d.ts +104 -0
- package/dist/reset-password-page/ResetPasswordPage.js +59 -0
- package/dist/reset-password-page/index.cjs +1 -0
- package/dist/reset-password-page/index.d.cts +1 -0
- package/dist/reset-password-page/index.d.ts +1 -0
- package/dist/reset-password-page/index.js +1 -0
- package/dist/sign-up-page/SignUpPage.cjs +97 -0
- package/dist/sign-up-page/SignUpPage.d.cts +133 -0
- package/dist/sign-up-page/SignUpPage.d.ts +133 -0
- package/dist/sign-up-page/SignUpPage.js +97 -0
- package/dist/sign-up-page/index.cjs +1 -0
- package/dist/sign-up-page/index.d.cts +1 -0
- package/dist/sign-up-page/index.d.ts +1 -0
- package/dist/sign-up-page/index.js +1 -0
- package/dist/stat-card/StatCard.cjs +61 -0
- package/dist/stat-card/StatCard.d.cts +90 -0
- package/dist/stat-card/StatCard.d.ts +90 -0
- package/dist/stat-card/StatCard.js +61 -0
- package/dist/stat-card/index.cjs +1 -0
- package/dist/stat-card/index.d.cts +1 -0
- package/dist/stat-card/index.d.ts +1 -0
- package/dist/stat-card/index.js +1 -0
- package/dist/usage-card/UsageCard.cjs +42 -0
- package/dist/usage-card/UsageCard.d.cts +81 -0
- package/dist/usage-card/UsageCard.d.ts +81 -0
- package/dist/usage-card/UsageCard.js +42 -0
- package/dist/usage-card/index.cjs +1 -0
- package/dist/usage-card/index.d.cts +1 -0
- package/dist/usage-card/index.d.ts +1 -0
- package/dist/usage-card/index.js +1 -0
- package/dist/usage-card/usage.cjs +1 -0
- package/dist/usage-card/usage.d.cts +18 -0
- package/dist/usage-card/usage.d.ts +18 -0
- package/dist/usage-card/usage.js +1 -0
- package/dist/user-menu/UserMenu.cjs +30 -0
- package/dist/user-menu/UserMenu.d.cts +84 -0
- package/dist/user-menu/UserMenu.d.ts +84 -0
- package/dist/user-menu/UserMenu.js +30 -0
- package/dist/user-menu/index.cjs +1 -0
- package/dist/user-menu/index.d.cts +1 -0
- package/dist/user-menu/index.d.ts +1 -0
- package/dist/user-menu/index.js +1 -0
- package/dist/verification-page/VerificationPage.cjs +63 -0
- package/dist/verification-page/VerificationPage.d.cts +149 -0
- package/dist/verification-page/VerificationPage.d.ts +149 -0
- package/dist/verification-page/VerificationPage.js +63 -0
- package/dist/verification-page/index.cjs +1 -0
- package/dist/verification-page/index.d.cts +1 -0
- package/dist/verification-page/index.d.ts +1 -0
- package/dist/verification-page/index.js +1 -0
- package/dist/workspace-switcher/WorkspaceSwitcher.cjs +69 -0
- package/dist/workspace-switcher/WorkspaceSwitcher.d.cts +165 -0
- package/dist/workspace-switcher/WorkspaceSwitcher.d.ts +165 -0
- package/dist/workspace-switcher/WorkspaceSwitcher.js +69 -0
- package/dist/workspace-switcher/index.cjs +1 -0
- package/dist/workspace-switcher/index.d.cts +1 -0
- package/dist/workspace-switcher/index.d.ts +1 -0
- package/dist/workspace-switcher/index.js +1 -0
- package/package.json +275 -9
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from 'lit';
|
|
2
|
+
import '@skdx/web-components/primitives/command';
|
|
3
|
+
import '@skdx/web-components/primitives/popover';
|
|
4
|
+
import '@skdx/web-components/visually-hidden';
|
|
5
|
+
/** One switchable context in the list — a workspace, organisation, team, account or project. */
|
|
6
|
+
export interface SkdxWorkspaceSwitcherItem {
|
|
7
|
+
/** Stable identifier reported to the change event and matched against the current value. */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Human-readable name rendered as the item's first line and in the closed trigger. */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Secondary line rendered under the label, such as a plan name or member count. @default undefined */
|
|
12
|
+
description?: string | undefined;
|
|
13
|
+
/** Heading of the group this item is listed under, gathering items that share it. @default undefined */
|
|
14
|
+
group?: string | undefined;
|
|
15
|
+
/** Lists the item but withholds selection, keyboard traversal and pointer highlighting. @default false */
|
|
16
|
+
disabled?: boolean | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** What a `value-change` event carries: the picked id, the one it replaced, and what drove the change. */
|
|
19
|
+
export interface SkdxWorkspaceSwitcherValueChangeDetail {
|
|
20
|
+
/** Id of the context the user picked. */
|
|
21
|
+
value: string;
|
|
22
|
+
/** Id that was active immediately before, or `null` when nothing was. */
|
|
23
|
+
previousValue: string | null;
|
|
24
|
+
/** What drove the change: a key press, a pointer, or the application. */
|
|
25
|
+
reason: 'keyboard' | 'pointer' | 'programmatic';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Switches the active context — workspace, organisation, team, account or
|
|
29
|
+
* project — from a searchable, groupable list in a popover, with loading,
|
|
30
|
+
* empty and footer regions.
|
|
31
|
+
*
|
|
32
|
+
* Renders light DOM, so its parts are classes rather than shadow `::part()`
|
|
33
|
+
* targets: `.skdx-workspace-switcher` on the host, then `__leading`,
|
|
34
|
+
* `__current`, `__description`, `__content`, `__search`, `__list`, `__loading`,
|
|
35
|
+
* `__empty`, `__group`, `__item`, `__item-leading`, `__item-label`,
|
|
36
|
+
* `__item-description` and `__footer`. `data-selected` marks the active item.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```html
|
|
40
|
+
* <skdx-workspace-switcher id="switcher" default-value="acme"></skdx-workspace-switcher>
|
|
41
|
+
* <script>
|
|
42
|
+
* const switcher = document.getElementById('switcher');
|
|
43
|
+
* switcher.items = [{ id: 'acme', label: 'Acme', description: 'Pro' }];
|
|
44
|
+
* switcher.addEventListener('value-change', (event) => switchTo(event.detail.value));
|
|
45
|
+
* </script>
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @slot trigger - Content that replaces the derived trigger button entirely.
|
|
49
|
+
* @slot actions - Controls placed in the panel's footer, such as create and manage buttons.
|
|
50
|
+
* @fires value-change - Fires with the id of the item the user picked, immediately before the panel closes.
|
|
51
|
+
* @fires open-change - Fires with the new open state whenever the panel opens or closes, controlled or not.
|
|
52
|
+
* @fires open-change-complete - Fires with the new open state once the panel's enter or exit animation has settled.
|
|
53
|
+
* @fires escape-key-down - Fires when Escape is pressed while the panel is open; `preventDefault()` keeps it open.
|
|
54
|
+
* @fires pointer-down-outside - Fires on a pointer-down outside the panel while open; `preventDefault()` keeps it open.
|
|
55
|
+
* @fires focus-outside - Fires when focus moves outside the panel while open; `preventDefault()` keeps it open.
|
|
56
|
+
* @fires interact-outside - Fires for either kind of outside interaction, just before the specific event.
|
|
57
|
+
* @fires open-auto-focus - Fires before focus moves into the panel on open; `preventDefault()` leaves focus where it is.
|
|
58
|
+
* @fires close-auto-focus - Fires before focus returns to the trigger on close; `preventDefault()` suppresses that return.
|
|
59
|
+
*/
|
|
60
|
+
export declare class SkdxWorkspaceSwitcher extends LitElement {
|
|
61
|
+
/** Light DOM, so `@skdx/skins` and consumer CSS reach the composed core elements. */
|
|
62
|
+
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
63
|
+
/** Every context the user may switch to, rendered in the order given and grouped by `group`. */
|
|
64
|
+
items: readonly SkdxWorkspaceSwitcherItem[];
|
|
65
|
+
/**
|
|
66
|
+
* Id of the active context, for controlled usage paired with `value-change`.
|
|
67
|
+
* @default undefined — uncontrolled, following `defaultValue`.
|
|
68
|
+
*/
|
|
69
|
+
value?: string | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Id of the context active on first render, for uncontrolled usage.
|
|
72
|
+
* @default '' — the trigger shows the placeholder until one is picked.
|
|
73
|
+
*/
|
|
74
|
+
defaultValue: string;
|
|
75
|
+
/**
|
|
76
|
+
* Trigger text shown while no item in the list is the active one.
|
|
77
|
+
* @default 'Select'
|
|
78
|
+
*/
|
|
79
|
+
placeholder: string;
|
|
80
|
+
/**
|
|
81
|
+
* Accessible name for the trigger and the result list, when the visible text is not enough.
|
|
82
|
+
* @default undefined — the trigger is named by its own visible text.
|
|
83
|
+
*/
|
|
84
|
+
label?: string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Accessible name of the search field inside the open panel.
|
|
87
|
+
* @default 'Search'
|
|
88
|
+
*/
|
|
89
|
+
searchLabel: string;
|
|
90
|
+
/**
|
|
91
|
+
* Placeholder text shown inside the panel's empty search field.
|
|
92
|
+
* @default undefined — the search field renders no placeholder.
|
|
93
|
+
*/
|
|
94
|
+
searchPlaceholder?: string | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Message shown in place of the list when the search matches nothing.
|
|
97
|
+
* @default 'No results'
|
|
98
|
+
*/
|
|
99
|
+
emptyMessage: string;
|
|
100
|
+
/**
|
|
101
|
+
* Message announced beside the list while results are still in flight.
|
|
102
|
+
* @default 'Loading'
|
|
103
|
+
*/
|
|
104
|
+
loadingMessage: string;
|
|
105
|
+
/**
|
|
106
|
+
* Marks the results as in flight, showing the loading message instead of the empty one.
|
|
107
|
+
* @default false
|
|
108
|
+
*/
|
|
109
|
+
loading: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Visually hidden text appended to the active item, naming it for screen readers.
|
|
112
|
+
* @default 'Current'
|
|
113
|
+
*/
|
|
114
|
+
selectedLabel: string;
|
|
115
|
+
/**
|
|
116
|
+
* Renders a decorative glyph — an avatar or a logo — for one item and for the trigger.
|
|
117
|
+
* @default undefined — no leading region renders anywhere.
|
|
118
|
+
*/
|
|
119
|
+
renderLeading?: ((item: SkdxWorkspaceSwitcherItem) => unknown) | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Whether the panel is open, for controlled usage paired with `open-change`.
|
|
122
|
+
* @default undefined — uncontrolled, following `defaultOpen`.
|
|
123
|
+
*/
|
|
124
|
+
open?: boolean | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Whether the panel is open on first render, for uncontrolled usage.
|
|
127
|
+
* @default false
|
|
128
|
+
*/
|
|
129
|
+
defaultOpen: boolean;
|
|
130
|
+
/** What the list last chose; outranked by `value` whenever the consumer controls it. */
|
|
131
|
+
private uncontrolledValue?;
|
|
132
|
+
/** What the trigger last chose; outranked by `open` whenever the consumer controls it. */
|
|
133
|
+
private uncontrolledOpen?;
|
|
134
|
+
/** Current search text, cleared whenever the panel closes so it reopens on the full list. */
|
|
135
|
+
private search;
|
|
136
|
+
/** What drove the gesture in flight, read when a selection is reported. */
|
|
137
|
+
private reason;
|
|
138
|
+
/** Id of the active context right now, controlled or not. */
|
|
139
|
+
private get currentValue();
|
|
140
|
+
/** Whether the panel is open right now, controlled or not. */
|
|
141
|
+
private get isOpen();
|
|
142
|
+
connectedCallback(): void;
|
|
143
|
+
disconnectedCallback(): void;
|
|
144
|
+
private readonly notePointer;
|
|
145
|
+
private readonly noteKeyboard;
|
|
146
|
+
/** Whether the consumer supplied their own trigger — still true once it has been moved in. */
|
|
147
|
+
private get hasTrigger();
|
|
148
|
+
/** Whether the consumer supplied footer controls — still true once they have been moved in. */
|
|
149
|
+
private get hasActions();
|
|
150
|
+
private region;
|
|
151
|
+
private readonly handleOpenChange;
|
|
152
|
+
private setOpen;
|
|
153
|
+
private readonly handleSearchChange;
|
|
154
|
+
private select;
|
|
155
|
+
private nameTrigger;
|
|
156
|
+
protected updated(): void;
|
|
157
|
+
private derivedTrigger;
|
|
158
|
+
private listedItem;
|
|
159
|
+
render(): TemplateResult;
|
|
160
|
+
}
|
|
161
|
+
declare global {
|
|
162
|
+
interface HTMLElementTagNameMap {
|
|
163
|
+
'skdx-workspace-switcher': SkdxWorkspaceSwitcher;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { LitElement, type TemplateResult } from 'lit';
|
|
2
|
+
import '@skdx/web-components/primitives/command';
|
|
3
|
+
import '@skdx/web-components/primitives/popover';
|
|
4
|
+
import '@skdx/web-components/visually-hidden';
|
|
5
|
+
/** One switchable context in the list — a workspace, organisation, team, account or project. */
|
|
6
|
+
export interface SkdxWorkspaceSwitcherItem {
|
|
7
|
+
/** Stable identifier reported to the change event and matched against the current value. */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Human-readable name rendered as the item's first line and in the closed trigger. */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Secondary line rendered under the label, such as a plan name or member count. @default undefined */
|
|
12
|
+
description?: string | undefined;
|
|
13
|
+
/** Heading of the group this item is listed under, gathering items that share it. @default undefined */
|
|
14
|
+
group?: string | undefined;
|
|
15
|
+
/** Lists the item but withholds selection, keyboard traversal and pointer highlighting. @default false */
|
|
16
|
+
disabled?: boolean | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** What a `value-change` event carries: the picked id, the one it replaced, and what drove the change. */
|
|
19
|
+
export interface SkdxWorkspaceSwitcherValueChangeDetail {
|
|
20
|
+
/** Id of the context the user picked. */
|
|
21
|
+
value: string;
|
|
22
|
+
/** Id that was active immediately before, or `null` when nothing was. */
|
|
23
|
+
previousValue: string | null;
|
|
24
|
+
/** What drove the change: a key press, a pointer, or the application. */
|
|
25
|
+
reason: 'keyboard' | 'pointer' | 'programmatic';
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Switches the active context — workspace, organisation, team, account or
|
|
29
|
+
* project — from a searchable, groupable list in a popover, with loading,
|
|
30
|
+
* empty and footer regions.
|
|
31
|
+
*
|
|
32
|
+
* Renders light DOM, so its parts are classes rather than shadow `::part()`
|
|
33
|
+
* targets: `.skdx-workspace-switcher` on the host, then `__leading`,
|
|
34
|
+
* `__current`, `__description`, `__content`, `__search`, `__list`, `__loading`,
|
|
35
|
+
* `__empty`, `__group`, `__item`, `__item-leading`, `__item-label`,
|
|
36
|
+
* `__item-description` and `__footer`. `data-selected` marks the active item.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```html
|
|
40
|
+
* <skdx-workspace-switcher id="switcher" default-value="acme"></skdx-workspace-switcher>
|
|
41
|
+
* <script>
|
|
42
|
+
* const switcher = document.getElementById('switcher');
|
|
43
|
+
* switcher.items = [{ id: 'acme', label: 'Acme', description: 'Pro' }];
|
|
44
|
+
* switcher.addEventListener('value-change', (event) => switchTo(event.detail.value));
|
|
45
|
+
* </script>
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @slot trigger - Content that replaces the derived trigger button entirely.
|
|
49
|
+
* @slot actions - Controls placed in the panel's footer, such as create and manage buttons.
|
|
50
|
+
* @fires value-change - Fires with the id of the item the user picked, immediately before the panel closes.
|
|
51
|
+
* @fires open-change - Fires with the new open state whenever the panel opens or closes, controlled or not.
|
|
52
|
+
* @fires open-change-complete - Fires with the new open state once the panel's enter or exit animation has settled.
|
|
53
|
+
* @fires escape-key-down - Fires when Escape is pressed while the panel is open; `preventDefault()` keeps it open.
|
|
54
|
+
* @fires pointer-down-outside - Fires on a pointer-down outside the panel while open; `preventDefault()` keeps it open.
|
|
55
|
+
* @fires focus-outside - Fires when focus moves outside the panel while open; `preventDefault()` keeps it open.
|
|
56
|
+
* @fires interact-outside - Fires for either kind of outside interaction, just before the specific event.
|
|
57
|
+
* @fires open-auto-focus - Fires before focus moves into the panel on open; `preventDefault()` leaves focus where it is.
|
|
58
|
+
* @fires close-auto-focus - Fires before focus returns to the trigger on close; `preventDefault()` suppresses that return.
|
|
59
|
+
*/
|
|
60
|
+
export declare class SkdxWorkspaceSwitcher extends LitElement {
|
|
61
|
+
/** Light DOM, so `@skdx/skins` and consumer CSS reach the composed core elements. */
|
|
62
|
+
createRenderRoot(): HTMLElement | DocumentFragment;
|
|
63
|
+
/** Every context the user may switch to, rendered in the order given and grouped by `group`. */
|
|
64
|
+
items: readonly SkdxWorkspaceSwitcherItem[];
|
|
65
|
+
/**
|
|
66
|
+
* Id of the active context, for controlled usage paired with `value-change`.
|
|
67
|
+
* @default undefined — uncontrolled, following `defaultValue`.
|
|
68
|
+
*/
|
|
69
|
+
value?: string | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Id of the context active on first render, for uncontrolled usage.
|
|
72
|
+
* @default '' — the trigger shows the placeholder until one is picked.
|
|
73
|
+
*/
|
|
74
|
+
defaultValue: string;
|
|
75
|
+
/**
|
|
76
|
+
* Trigger text shown while no item in the list is the active one.
|
|
77
|
+
* @default 'Select'
|
|
78
|
+
*/
|
|
79
|
+
placeholder: string;
|
|
80
|
+
/**
|
|
81
|
+
* Accessible name for the trigger and the result list, when the visible text is not enough.
|
|
82
|
+
* @default undefined — the trigger is named by its own visible text.
|
|
83
|
+
*/
|
|
84
|
+
label?: string | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Accessible name of the search field inside the open panel.
|
|
87
|
+
* @default 'Search'
|
|
88
|
+
*/
|
|
89
|
+
searchLabel: string;
|
|
90
|
+
/**
|
|
91
|
+
* Placeholder text shown inside the panel's empty search field.
|
|
92
|
+
* @default undefined — the search field renders no placeholder.
|
|
93
|
+
*/
|
|
94
|
+
searchPlaceholder?: string | undefined;
|
|
95
|
+
/**
|
|
96
|
+
* Message shown in place of the list when the search matches nothing.
|
|
97
|
+
* @default 'No results'
|
|
98
|
+
*/
|
|
99
|
+
emptyMessage: string;
|
|
100
|
+
/**
|
|
101
|
+
* Message announced beside the list while results are still in flight.
|
|
102
|
+
* @default 'Loading'
|
|
103
|
+
*/
|
|
104
|
+
loadingMessage: string;
|
|
105
|
+
/**
|
|
106
|
+
* Marks the results as in flight, showing the loading message instead of the empty one.
|
|
107
|
+
* @default false
|
|
108
|
+
*/
|
|
109
|
+
loading: boolean;
|
|
110
|
+
/**
|
|
111
|
+
* Visually hidden text appended to the active item, naming it for screen readers.
|
|
112
|
+
* @default 'Current'
|
|
113
|
+
*/
|
|
114
|
+
selectedLabel: string;
|
|
115
|
+
/**
|
|
116
|
+
* Renders a decorative glyph — an avatar or a logo — for one item and for the trigger.
|
|
117
|
+
* @default undefined — no leading region renders anywhere.
|
|
118
|
+
*/
|
|
119
|
+
renderLeading?: ((item: SkdxWorkspaceSwitcherItem) => unknown) | undefined;
|
|
120
|
+
/**
|
|
121
|
+
* Whether the panel is open, for controlled usage paired with `open-change`.
|
|
122
|
+
* @default undefined — uncontrolled, following `defaultOpen`.
|
|
123
|
+
*/
|
|
124
|
+
open?: boolean | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* Whether the panel is open on first render, for uncontrolled usage.
|
|
127
|
+
* @default false
|
|
128
|
+
*/
|
|
129
|
+
defaultOpen: boolean;
|
|
130
|
+
/** What the list last chose; outranked by `value` whenever the consumer controls it. */
|
|
131
|
+
private uncontrolledValue?;
|
|
132
|
+
/** What the trigger last chose; outranked by `open` whenever the consumer controls it. */
|
|
133
|
+
private uncontrolledOpen?;
|
|
134
|
+
/** Current search text, cleared whenever the panel closes so it reopens on the full list. */
|
|
135
|
+
private search;
|
|
136
|
+
/** What drove the gesture in flight, read when a selection is reported. */
|
|
137
|
+
private reason;
|
|
138
|
+
/** Id of the active context right now, controlled or not. */
|
|
139
|
+
private get currentValue();
|
|
140
|
+
/** Whether the panel is open right now, controlled or not. */
|
|
141
|
+
private get isOpen();
|
|
142
|
+
connectedCallback(): void;
|
|
143
|
+
disconnectedCallback(): void;
|
|
144
|
+
private readonly notePointer;
|
|
145
|
+
private readonly noteKeyboard;
|
|
146
|
+
/** Whether the consumer supplied their own trigger — still true once it has been moved in. */
|
|
147
|
+
private get hasTrigger();
|
|
148
|
+
/** Whether the consumer supplied footer controls — still true once they have been moved in. */
|
|
149
|
+
private get hasActions();
|
|
150
|
+
private region;
|
|
151
|
+
private readonly handleOpenChange;
|
|
152
|
+
private setOpen;
|
|
153
|
+
private readonly handleSearchChange;
|
|
154
|
+
private select;
|
|
155
|
+
private nameTrigger;
|
|
156
|
+
protected updated(): void;
|
|
157
|
+
private derivedTrigger;
|
|
158
|
+
private listedItem;
|
|
159
|
+
render(): TemplateResult;
|
|
160
|
+
}
|
|
161
|
+
declare global {
|
|
162
|
+
interface HTMLElementTagNameMap {
|
|
163
|
+
'skdx-workspace-switcher': SkdxWorkspaceSwitcher;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
var m=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var a=(d,c,e,t)=>{for(var s=t>1?void 0:t?v(c,e):c,p=d.length-1,i;p>=0;p--)(i=d[p])&&(s=(t?i(c,e,s):i(s))||s);return t&&s&&m(c,e,s),s};import{html as o,LitElement as k,nothing as l}from"lit";import{property as n}from"lit/decorators.js";import{customElement as b}from"../internal/define.js";import{emit as h}from"../internal/events.js";import{placeSlotted as f}from"../internal/slots.js";import"@skdx/web-components/primitives/command";import"@skdx/web-components/primitives/popover";import"@skdx/web-components/visually-hidden";var w="data-skdx-workspace-switcher-generated",x={fromAttribute:d=>d!=="false"};function g(d){d.stopPropagation()}function y(d,c){let e=c.toLowerCase(),t=new Map([[void 0,[]]]);for(let i of d){let u=t.get(i.group);u?u.push(i):t.set(i.group,[i])}let s=i=>e===""||i.id.toLowerCase().includes(e)||i.label.toLowerCase().includes(e)||(i.description?.toLowerCase().includes(e)??!1),p=[];for(let[i,u]of t)u.some(s)&&p.push({heading:i,items:u});return p}var r=class extends k{constructor(){super(...arguments);this.defaultValue="";this.placeholder="Select";this.searchLabel="Search";this.emptyMessage="No results";this.loadingMessage="Loading";this.loading=!1;this.selectedLabel="Current";this.defaultOpen=!1;this.search="";this.reason="programmatic";this.notePointer=()=>{this.reason="pointer"};this.noteKeyboard=()=>{this.reason="keyboard"};this.handleOpenChange=e=>{e.stopPropagation();let t=e.detail;t!==this.isOpen&&this.setOpen(t)};this.handleSearchChange=e=>{e.stopPropagation(),this.search=e.detail,this.requestUpdate()}}createRenderRoot(){return this}get currentValue(){return this.value??this.uncontrolledValue??this.defaultValue}get isOpen(){return this.open??this.uncontrolledOpen??this.defaultOpen}connectedCallback(){super.connectedCallback(),this.addEventListener("pointerdown",this.notePointer,!0),this.addEventListener("keydown",this.noteKeyboard,!0),queueMicrotask(()=>this.requestUpdate())}disconnectedCallback(){this.removeEventListener("pointerdown",this.notePointer,!0),this.removeEventListener("keydown",this.noteKeyboard,!0),super.disconnectedCallback()}get hasTrigger(){return this.querySelector('[slot="trigger"]')!==null}get hasActions(){return this.querySelector('[slot="actions"]')!==null}region(e){return this.querySelector(`.skdx-workspace-switcher__${e}`)}setOpen(e){e||(this.search=""),this.uncontrolledOpen=e,this.requestUpdate(),h(this,"open-change",e)}select(e,t){e.stopPropagation();let s=this.currentValue;this.uncontrolledValue=t,this.requestUpdate(),h(this,"value-change",{value:t,previousValue:s,reason:this.reason}),this.setOpen(!1)}nameTrigger(){let e=this.querySelector("skdx-popover-trigger")?.shadowRoot?.querySelector('[part="trigger"]');e&&(this.label?e.setAttribute("aria-label",this.label):e.removeAttribute("aria-label"))}updated(){let e=this.querySelector(":scope > skdx-popover-root");e&&(e.open=this.isOpen),this.querySelector("skdx-popover-trigger")?.updateComplete.then(()=>this.nameTrigger());let s=this.querySelector("skdx-command-input");s?.updateComplete.then(()=>s.querySelector("input")?.setAttribute("aria-label",this.searchLabel)),f(this,w,{trigger:this.querySelector("skdx-popover-trigger"),actions:this.region("footer")},null)}derivedTrigger(){let e=(this.items??[]).find(t=>t.id===this.currentValue);return o`${this.renderLeading&&e?o`<span
|
|
2
|
+
aria-hidden="true"
|
|
3
|
+
class="skdx-workspace-switcher__leading"
|
|
4
|
+
>${this.renderLeading(e)}</span
|
|
5
|
+
>`:l}
|
|
6
|
+
<span class="skdx-workspace-switcher__current">${e?.label??this.placeholder}</span>
|
|
7
|
+
${e?.description?o`<span class="skdx-workspace-switcher__description">${e.description}</span>`:l}`}listedItem(e){let t=e.id===this.currentValue;return o`<skdx-command-item
|
|
8
|
+
class="skdx-workspace-switcher__item"
|
|
9
|
+
.value=${e.id}
|
|
10
|
+
.keywords=${e.description?[e.label,e.description]:[e.label]}
|
|
11
|
+
?disabled=${e.disabled}
|
|
12
|
+
data-selected=${t?"":l}
|
|
13
|
+
@select=${s=>this.select(s,e.id)}
|
|
14
|
+
>
|
|
15
|
+
${this.renderLeading?o`<span
|
|
16
|
+
aria-hidden="true"
|
|
17
|
+
class="skdx-workspace-switcher__item-leading"
|
|
18
|
+
>${this.renderLeading(e)}</span
|
|
19
|
+
>`:l}
|
|
20
|
+
<span class="skdx-workspace-switcher__item-label">${e.label}</span>
|
|
21
|
+
${e.description?o`<span class="skdx-workspace-switcher__item-description">${e.description}</span>`:l}
|
|
22
|
+
${t?o`<skdx-visually-hidden>${this.selectedLabel}</skdx-visually-hidden>`:l}
|
|
23
|
+
</skdx-command-item>`}render(){let e=y(this.items??[],this.search);return o`
|
|
24
|
+
<skdx-popover-root
|
|
25
|
+
data-skdx-workspace-switcher-generated
|
|
26
|
+
modal="none"
|
|
27
|
+
@open-change=${this.handleOpenChange}
|
|
28
|
+
>
|
|
29
|
+
<skdx-popover-trigger
|
|
30
|
+
>${this.hasTrigger?l:this.derivedTrigger()}</skdx-popover-trigger
|
|
31
|
+
>
|
|
32
|
+
<skdx-popover-content
|
|
33
|
+
class="skdx-workspace-switcher__content"
|
|
34
|
+
align="start"
|
|
35
|
+
aria-label=${this.label??this.placeholder}
|
|
36
|
+
>
|
|
37
|
+
<skdx-command
|
|
38
|
+
.search=${this.search}
|
|
39
|
+
?loading=${this.loading}
|
|
40
|
+
@search-change=${this.handleSearchChange}
|
|
41
|
+
@value-change=${g}
|
|
42
|
+
@item-select=${g}
|
|
43
|
+
>
|
|
44
|
+
<skdx-command-input
|
|
45
|
+
class="skdx-workspace-switcher__search"
|
|
46
|
+
placeholder=${this.searchPlaceholder??l}
|
|
47
|
+
></skdx-command-input>
|
|
48
|
+
<skdx-command-list
|
|
49
|
+
class="skdx-workspace-switcher__list"
|
|
50
|
+
aria-label=${this.label??this.placeholder}
|
|
51
|
+
>
|
|
52
|
+
${e.map(t=>o`<skdx-command-group
|
|
53
|
+
class="skdx-workspace-switcher__group"
|
|
54
|
+
heading=${t.heading??l}
|
|
55
|
+
>
|
|
56
|
+
${t.items.map(s=>this.listedItem(s))}
|
|
57
|
+
</skdx-command-group>`)}
|
|
58
|
+
</skdx-command-list>
|
|
59
|
+
<skdx-command-loading class="skdx-workspace-switcher__loading"
|
|
60
|
+
>${this.loadingMessage}</skdx-command-loading
|
|
61
|
+
>
|
|
62
|
+
<skdx-command-empty class="skdx-workspace-switcher__empty"
|
|
63
|
+
>${this.emptyMessage}</skdx-command-empty
|
|
64
|
+
>
|
|
65
|
+
</skdx-command>
|
|
66
|
+
${this.hasActions?o`<div class="skdx-workspace-switcher__footer"></div>`:l}
|
|
67
|
+
</skdx-popover-content>
|
|
68
|
+
</skdx-popover-root>
|
|
69
|
+
`}};a([n({attribute:!1})],r.prototype,"items",2),a([n({type:String})],r.prototype,"value",2),a([n({type:String,attribute:"default-value"})],r.prototype,"defaultValue",2),a([n({type:String})],r.prototype,"placeholder",2),a([n({type:String})],r.prototype,"label",2),a([n({type:String,attribute:"search-label"})],r.prototype,"searchLabel",2),a([n({type:String,attribute:"search-placeholder"})],r.prototype,"searchPlaceholder",2),a([n({type:String,attribute:"empty-message"})],r.prototype,"emptyMessage",2),a([n({type:String,attribute:"loading-message"})],r.prototype,"loadingMessage",2),a([n({type:Boolean})],r.prototype,"loading",2),a([n({type:String,attribute:"selected-label"})],r.prototype,"selectedLabel",2),a([n({attribute:!1})],r.prototype,"renderLeading",2),a([n({converter:x})],r.prototype,"open",2),a([n({type:Boolean,attribute:"default-open"})],r.prototype,"defaultOpen",2),r=a([b("skdx-workspace-switcher","workspace-switcher","root")],r);export{r as SkdxWorkspaceSwitcher};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var c=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var i=(r,e)=>{for(var a in e)c(r,a,{get:e[a],enumerable:!0})},x=(r,e,a,k)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of o(e))!h.call(r,t)&&t!==a&&c(r,t,{get:()=>e[t],enumerable:!(k=S(e,t))||k.enumerable});return r};var d=r=>x(c({},"__esModule",{value:!0}),r);var s={};i(s,{SkdxWorkspaceSwitcher:()=>p.SkdxWorkspaceSwitcher});module.exports=d(s);var p=require("./WorkspaceSwitcher.cjs");0&&(module.exports={SkdxWorkspaceSwitcher});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SkdxWorkspaceSwitcher, type SkdxWorkspaceSwitcherItem, type SkdxWorkspaceSwitcherValueChangeDetail, } from './WorkspaceSwitcher.cjs';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SkdxWorkspaceSwitcher, type SkdxWorkspaceSwitcherItem, type SkdxWorkspaceSwitcherValueChangeDetail, } from './WorkspaceSwitcher.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{SkdxWorkspaceSwitcher as t}from"./WorkspaceSwitcher.js";export{t as SkdxWorkspaceSwitcher};
|