@prismora/elements 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +21 -2
- package/components.json +15600 -0
- package/custom-elements.json +56320 -0
- package/dist/base.d.ts +42 -0
- package/dist/base.js +62 -0
- package/dist/catalog.d.ts +33 -0
- package/dist/catalog.js +803 -0
- package/dist/components/accordion.d.ts +31 -0
- package/dist/components/accordion.js +63 -0
- package/dist/components/alert.d.ts +27 -0
- package/dist/components/alert.js +40 -0
- package/dist/components/avatar-group.d.ts +23 -0
- package/dist/components/avatar-group.js +43 -0
- package/dist/components/avatar.d.ts +24 -0
- package/dist/components/avatar.js +43 -0
- package/dist/components/back-to-top.d.ts +32 -0
- package/dist/components/back-to-top.js +50 -0
- package/dist/components/badge.d.ts +17 -0
- package/dist/components/badge.js +20 -0
- package/dist/components/banner.d.ts +34 -0
- package/dist/components/banner.js +54 -0
- package/dist/components/breadcrumb.d.ts +42 -0
- package/dist/components/breadcrumb.js +63 -0
- package/dist/components/button-group.d.ts +14 -0
- package/dist/components/button-group.js +28 -0
- package/dist/components/button.d.ts +59 -0
- package/dist/components/button.js +162 -0
- package/dist/components/calendar.d.ts +48 -0
- package/dist/components/calendar.js +296 -0
- package/dist/components/card.d.ts +23 -0
- package/dist/components/card.js +44 -0
- package/dist/components/carousel.d.ts +41 -0
- package/dist/components/carousel.js +156 -0
- package/dist/components/cascader.d.ts +70 -0
- package/dist/components/cascader.js +220 -0
- package/dist/components/chart.d.ts +59 -0
- package/dist/components/chart.js +267 -0
- package/dist/components/chat.d.ts +98 -0
- package/dist/components/chat.js +134 -0
- package/dist/components/checkbox-group.d.ts +48 -0
- package/dist/components/checkbox-group.js +111 -0
- package/dist/components/checkbox.d.ts +23 -0
- package/dist/components/checkbox.js +70 -0
- package/dist/components/code-block.d.ts +46 -0
- package/dist/components/code-block.js +86 -0
- package/dist/components/color-picker.d.ts +46 -0
- package/dist/components/color-picker.js +292 -0
- package/dist/components/combobox.d.ts +89 -0
- package/dist/components/combobox.js +384 -0
- package/dist/components/command.d.ts +96 -0
- package/dist/components/command.js +289 -0
- package/dist/components/context-menu.d.ts +23 -0
- package/dist/components/context-menu.js +110 -0
- package/dist/components/copy-button.d.ts +33 -0
- package/dist/components/copy-button.js +62 -0
- package/dist/components/countdown.d.ts +36 -0
- package/dist/components/countdown.js +56 -0
- package/dist/components/data-table.d.ts +180 -0
- package/dist/components/data-table.js +1060 -0
- package/dist/components/date-picker.d.ts +47 -0
- package/dist/components/date-picker.js +267 -0
- package/dist/components/description-list.d.ts +38 -0
- package/dist/components/description-list.js +41 -0
- package/dist/components/dialog.d.ts +47 -0
- package/dist/components/dialog.js +189 -0
- package/dist/components/divider.d.ts +16 -0
- package/dist/components/divider.js +23 -0
- package/dist/components/drawer.d.ts +19 -0
- package/dist/components/drawer.js +27 -0
- package/dist/components/editor.d.ts +50 -0
- package/dist/components/editor.js +474 -0
- package/dist/components/empty-state.d.ts +24 -0
- package/dist/components/empty-state.js +27 -0
- package/dist/components/file-upload.d.ts +56 -0
- package/dist/components/file-upload.js +176 -0
- package/dist/components/form-control.d.ts +69 -0
- package/dist/components/form-control.js +134 -0
- package/dist/components/form.d.ts +38 -0
- package/dist/components/form.js +161 -0
- package/dist/components/format-number.d.ts +37 -0
- package/dist/components/format-number.js +86 -0
- package/dist/components/icon.d.ts +34 -0
- package/dist/components/icon.js +47 -0
- package/dist/components/image.d.ts +44 -0
- package/dist/components/image.js +53 -0
- package/dist/components/indicator.d.ts +41 -0
- package/dist/components/indicator.js +65 -0
- package/dist/components/inline-edit.d.ts +45 -0
- package/dist/components/inline-edit.js +129 -0
- package/dist/components/input.d.ts +55 -0
- package/dist/components/input.js +186 -0
- package/dist/components/kbd.d.ts +15 -0
- package/dist/components/kbd.js +18 -0
- package/dist/components/list.d.ts +68 -0
- package/dist/components/list.js +180 -0
- package/dist/components/menu.d.ts +22 -0
- package/dist/components/menu.js +182 -0
- package/dist/components/menubar.d.ts +20 -0
- package/dist/components/menubar.js +120 -0
- package/dist/components/meter.d.ts +38 -0
- package/dist/components/meter.js +48 -0
- package/dist/components/nav.d.ts +91 -0
- package/dist/components/nav.js +228 -0
- package/dist/components/number-input.d.ts +26 -0
- package/dist/components/number-input.js +70 -0
- package/dist/components/pagination.d.ts +44 -0
- package/dist/components/pagination.js +94 -0
- package/dist/components/pin-input.d.ts +25 -0
- package/dist/components/pin-input.js +128 -0
- package/dist/components/popover.d.ts +23 -0
- package/dist/components/popover.js +140 -0
- package/dist/components/progress.d.ts +26 -0
- package/dist/components/progress.js +66 -0
- package/dist/components/pull-refresh.d.ts +41 -0
- package/dist/components/pull-refresh.js +101 -0
- package/dist/components/qr-code.d.ts +33 -0
- package/dist/components/qr-code.js +54 -0
- package/dist/components/radio-group.d.ts +37 -0
- package/dist/components/radio-group.js +82 -0
- package/dist/components/range-slider.d.ts +46 -0
- package/dist/components/range-slider.js +95 -0
- package/dist/components/rating.d.ts +38 -0
- package/dist/components/rating.js +80 -0
- package/dist/components/relative-time.d.ts +31 -0
- package/dist/components/relative-time.js +51 -0
- package/dist/components/scheduler.d.ts +84 -0
- package/dist/components/scheduler.js +187 -0
- package/dist/components/segmented.d.ts +58 -0
- package/dist/components/segmented.js +129 -0
- package/dist/components/select.d.ts +62 -0
- package/dist/components/select.js +140 -0
- package/dist/components/share-button.d.ts +37 -0
- package/dist/components/share-button.js +60 -0
- package/dist/components/signature.d.ts +54 -0
- package/dist/components/signature.js +152 -0
- package/dist/components/skeleton.d.ts +21 -0
- package/dist/components/skeleton.js +26 -0
- package/dist/components/slider.d.ts +31 -0
- package/dist/components/slider.js +80 -0
- package/dist/components/sortable.d.ts +22 -0
- package/dist/components/sortable.js +196 -0
- package/dist/components/sparkline.d.ts +28 -0
- package/dist/components/sparkline.js +46 -0
- package/dist/components/spinner.d.ts +16 -0
- package/dist/components/spinner.js +22 -0
- package/dist/components/splitter.d.ts +28 -0
- package/dist/components/splitter.js +89 -0
- package/dist/components/stat.d.ts +28 -0
- package/dist/components/stat.js +33 -0
- package/dist/components/steps.d.ts +53 -0
- package/dist/components/steps.js +91 -0
- package/dist/components/switch.d.ts +12 -0
- package/dist/components/switch.js +18 -0
- package/dist/components/table.d.ts +58 -0
- package/dist/components/table.js +96 -0
- package/dist/components/tabs.d.ts +62 -0
- package/dist/components/tabs.js +310 -0
- package/dist/components/tag.d.ts +32 -0
- package/dist/components/tag.js +58 -0
- package/dist/components/textarea.d.ts +25 -0
- package/dist/components/textarea.js +56 -0
- package/dist/components/theme-switch.d.ts +51 -0
- package/dist/components/theme-switch.js +85 -0
- package/dist/components/time-picker.d.ts +39 -0
- package/dist/components/time-picker.js +257 -0
- package/dist/components/timeline.d.ts +38 -0
- package/dist/components/timeline.js +56 -0
- package/dist/components/toaster.d.ts +25 -0
- package/dist/components/toaster.js +44 -0
- package/dist/components/toggle-group.d.ts +70 -0
- package/dist/components/toggle-group.js +172 -0
- package/dist/components/toolbar.d.ts +23 -0
- package/dist/components/toolbar.js +81 -0
- package/dist/components/tooltip.d.ts +18 -0
- package/dist/components/tooltip.js +92 -0
- package/dist/components/tour.d.ts +41 -0
- package/dist/components/tour.js +197 -0
- package/dist/components/transfer.d.ts +57 -0
- package/dist/components/transfer.js +161 -0
- package/dist/components/tree-select.d.ts +66 -0
- package/dist/components/tree-select.js +282 -0
- package/dist/components/tree.d.ts +129 -0
- package/dist/components/tree.js +427 -0
- package/dist/components/virtual-list.d.ts +41 -0
- package/dist/components/virtual-list.js +77 -0
- package/dist/confirm.d.ts +21 -0
- package/dist/confirm.js +69 -0
- package/dist/count.d.ts +5 -0
- package/dist/count.js +12 -0
- package/dist/data-table/icons.d.ts +8 -0
- package/dist/data-table/icons.js +10 -0
- package/dist/data-table/logic.d.ts +33 -0
- package/dist/data-table/logic.js +141 -0
- package/dist/data-table/strings.d.ts +37 -0
- package/dist/data-table/strings.js +36 -0
- package/dist/data-table/types.d.ts +76 -0
- package/dist/data-table/types.js +1 -0
- package/dist/define.d.ts +2 -0
- package/dist/define.js +2 -0
- package/dist/field-validity.d.ts +42 -0
- package/dist/field-validity.js +58 -0
- package/dist/floating.d.ts +13 -0
- package/dist/floating.js +65 -0
- package/dist/highlight.d.ts +11 -0
- package/dist/highlight.js +103 -0
- package/dist/id.d.ts +2 -0
- package/dist/id.js +3 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.js +102 -0
- package/dist/manifest.d.ts +51 -0
- package/dist/manifest.js +11 -0
- package/dist/named-icon.d.ts +8 -0
- package/dist/named-icon.js +8 -0
- package/dist/patterns/account.d.ts +6 -0
- package/dist/patterns/account.js +137 -0
- package/dist/patterns/app.d.ts +7 -0
- package/dist/patterns/app.js +351 -0
- package/dist/patterns/commerce.d.ts +4 -0
- package/dist/patterns/commerce.js +200 -0
- package/dist/patterns/flows.d.ts +3 -0
- package/dist/patterns/flows.js +100 -0
- package/dist/patterns/index.d.ts +9 -0
- package/dist/patterns/index.js +29 -0
- package/dist/patterns/marketing.d.ts +4 -0
- package/dist/patterns/marketing.js +173 -0
- package/dist/patterns/more.d.ts +15 -0
- package/dist/patterns/more.js +581 -0
- package/dist/patterns/shell.d.ts +9 -0
- package/dist/patterns/shell.js +48 -0
- package/dist/patterns/types.d.ts +19 -0
- package/dist/patterns/types.js +1 -0
- package/dist/position.d.ts +2 -0
- package/dist/position.js +33 -0
- package/dist/prismora.standalone.js +5222 -0
- package/dist/prismora.standalone.js.map +199 -0
- package/dist/qr.d.ts +14 -0
- package/dist/qr.js +258 -0
- package/dist/register.d.ts +8 -0
- package/dist/register.js +21 -0
- package/dist/registry.d.ts +203 -0
- package/dist/registry.js +203 -0
- package/dist/remote.d.ts +58 -0
- package/dist/remote.js +130 -0
- package/dist/sheet.d.ts +34 -0
- package/dist/sheet.js +153 -0
- package/dist/styles/accordion.d.ts +2 -0
- package/dist/styles/accordion.js +3 -0
- package/dist/styles/alert.d.ts +2 -0
- package/dist/styles/alert.js +3 -0
- package/dist/styles/avatar.d.ts +2 -0
- package/dist/styles/avatar.js +3 -0
- package/dist/styles/badge.d.ts +2 -0
- package/dist/styles/badge.js +3 -0
- package/dist/styles/banner.d.ts +2 -0
- package/dist/styles/banner.js +3 -0
- package/dist/styles/breadcrumb.d.ts +2 -0
- package/dist/styles/breadcrumb.js +3 -0
- package/dist/styles/button.d.ts +2 -0
- package/dist/styles/button.js +3 -0
- package/dist/styles/calendar.d.ts +2 -0
- package/dist/styles/calendar.js +3 -0
- package/dist/styles/card.d.ts +2 -0
- package/dist/styles/card.js +3 -0
- package/dist/styles/carousel.d.ts +2 -0
- package/dist/styles/carousel.js +3 -0
- package/dist/styles/chart.d.ts +2 -0
- package/dist/styles/chart.js +3 -0
- package/dist/styles/chat.d.ts +2 -0
- package/dist/styles/chat.js +3 -0
- package/dist/styles/checkbox.d.ts +2 -0
- package/dist/styles/checkbox.js +3 -0
- package/dist/styles/color-picker.d.ts +2 -0
- package/dist/styles/color-picker.js +3 -0
- package/dist/styles/combobox.d.ts +2 -0
- package/dist/styles/combobox.js +3 -0
- package/dist/styles/command.d.ts +2 -0
- package/dist/styles/command.js +3 -0
- package/dist/styles/data-table.d.ts +2 -0
- package/dist/styles/data-table.js +3 -0
- package/dist/styles/description-list.d.ts +2 -0
- package/dist/styles/description-list.js +3 -0
- package/dist/styles/dialog.d.ts +2 -0
- package/dist/styles/dialog.js +3 -0
- package/dist/styles/drawer.d.ts +2 -0
- package/dist/styles/drawer.js +3 -0
- package/dist/styles/editor.d.ts +2 -0
- package/dist/styles/editor.js +3 -0
- package/dist/styles/empty-state.d.ts +2 -0
- package/dist/styles/empty-state.js +3 -0
- package/dist/styles/extras.d.ts +2 -0
- package/dist/styles/extras.js +3 -0
- package/dist/styles/field.d.ts +2 -0
- package/dist/styles/field.js +3 -0
- package/dist/styles/file-upload.d.ts +2 -0
- package/dist/styles/file-upload.js +3 -0
- package/dist/styles/foundation.d.ts +2 -0
- package/dist/styles/foundation.js +3 -0
- package/dist/styles/helpers.d.ts +2 -0
- package/dist/styles/helpers.js +3 -0
- package/dist/styles/icon.d.ts +2 -0
- package/dist/styles/icon.js +3 -0
- package/dist/styles/image.d.ts +2 -0
- package/dist/styles/image.js +3 -0
- package/dist/styles/indicator.d.ts +2 -0
- package/dist/styles/indicator.js +3 -0
- package/dist/styles/input.d.ts +2 -0
- package/dist/styles/input.js +3 -0
- package/dist/styles/kbd.d.ts +2 -0
- package/dist/styles/kbd.js +3 -0
- package/dist/styles/list.d.ts +2 -0
- package/dist/styles/list.js +3 -0
- package/dist/styles/listbox.d.ts +2 -0
- package/dist/styles/listbox.js +3 -0
- package/dist/styles/meter.d.ts +2 -0
- package/dist/styles/meter.js +3 -0
- package/dist/styles/nav.d.ts +2 -0
- package/dist/styles/nav.js +3 -0
- package/dist/styles/number-input.d.ts +2 -0
- package/dist/styles/number-input.js +3 -0
- package/dist/styles/overlay.d.ts +2 -0
- package/dist/styles/overlay.js +3 -0
- package/dist/styles/pagination.d.ts +2 -0
- package/dist/styles/pagination.js +3 -0
- package/dist/styles/pickers.d.ts +2 -0
- package/dist/styles/pickers.js +3 -0
- package/dist/styles/pin-input.d.ts +2 -0
- package/dist/styles/pin-input.js +3 -0
- package/dist/styles/popover.d.ts +2 -0
- package/dist/styles/popover.js +3 -0
- package/dist/styles/progress.d.ts +2 -0
- package/dist/styles/progress.js +3 -0
- package/dist/styles/pull-refresh.d.ts +2 -0
- package/dist/styles/pull-refresh.js +3 -0
- package/dist/styles/range-slider.d.ts +2 -0
- package/dist/styles/range-slider.js +3 -0
- package/dist/styles/rating.d.ts +2 -0
- package/dist/styles/rating.js +3 -0
- package/dist/styles/scheduler.d.ts +2 -0
- package/dist/styles/scheduler.js +3 -0
- package/dist/styles/segmented.d.ts +2 -0
- package/dist/styles/segmented.js +3 -0
- package/dist/styles/select.d.ts +2 -0
- package/dist/styles/select.js +3 -0
- package/dist/styles/separator.d.ts +2 -0
- package/dist/styles/separator.js +3 -0
- package/dist/styles/sheet.d.ts +2 -0
- package/dist/styles/sheet.js +3 -0
- package/dist/styles/skeleton.d.ts +2 -0
- package/dist/styles/skeleton.js +3 -0
- package/dist/styles/slider.d.ts +2 -0
- package/dist/styles/slider.js +3 -0
- package/dist/styles/sortable.d.ts +2 -0
- package/dist/styles/sortable.js +3 -0
- package/dist/styles/spinner.d.ts +2 -0
- package/dist/styles/spinner.js +3 -0
- package/dist/styles/splitter.d.ts +2 -0
- package/dist/styles/splitter.js +3 -0
- package/dist/styles/stat.d.ts +2 -0
- package/dist/styles/stat.js +3 -0
- package/dist/styles/steps.d.ts +2 -0
- package/dist/styles/steps.js +3 -0
- package/dist/styles/surface.d.ts +2 -0
- package/dist/styles/surface.js +3 -0
- package/dist/styles/switch.d.ts +2 -0
- package/dist/styles/switch.js +3 -0
- package/dist/styles/table.d.ts +2 -0
- package/dist/styles/table.js +3 -0
- package/dist/styles/tabs.d.ts +2 -0
- package/dist/styles/tabs.js +3 -0
- package/dist/styles/tag.d.ts +2 -0
- package/dist/styles/tag.js +3 -0
- package/dist/styles/time-picker.d.ts +2 -0
- package/dist/styles/time-picker.js +3 -0
- package/dist/styles/timeline.d.ts +2 -0
- package/dist/styles/timeline.js +3 -0
- package/dist/styles/toast.d.ts +2 -0
- package/dist/styles/toast.js +3 -0
- package/dist/styles/toggle.d.ts +2 -0
- package/dist/styles/toggle.js +3 -0
- package/dist/styles/toolbar.d.ts +2 -0
- package/dist/styles/toolbar.js +3 -0
- package/dist/styles/tooltip.d.ts +2 -0
- package/dist/styles/tooltip.js +3 -0
- package/dist/styles/tree.d.ts +2 -0
- package/dist/styles/tree.js +3 -0
- package/dist/table-core.d.ts +75 -0
- package/dist/table-core.js +205 -0
- package/dist/toast.d.ts +42 -0
- package/dist/toast.js +206 -0
- package/dist/top-layer.d.ts +4 -0
- package/dist/top-layer.js +33 -0
- package/package.json +101 -4
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type PropertyDeclarations } from 'lit';
|
|
2
|
+
import { PmElement } from '../base.js';
|
|
3
|
+
type Status = 'complete' | 'current' | 'upcoming' | 'error';
|
|
4
|
+
/**
|
|
5
|
+
* Steps (wizard / checkout progress). Steps before `current` are complete.
|
|
6
|
+
* @tag pm-steps
|
|
7
|
+
* @slot - `pm-step` elements.
|
|
8
|
+
* @fires pm-change - A step was chosen (only with `clickable`). detail: { index }
|
|
9
|
+
* @example <pm-steps current="1"><pm-step label="Account"></pm-step><pm-step label="Profile" description="Tell us about you"></pm-step><pm-step label="Done"></pm-step></pm-steps>
|
|
10
|
+
*/
|
|
11
|
+
export declare class PmSteps extends PmElement {
|
|
12
|
+
#private;
|
|
13
|
+
static componentName: string;
|
|
14
|
+
static styles: import("lit").CSSResult[];
|
|
15
|
+
static properties: PropertyDeclarations;
|
|
16
|
+
/** Index (0-based) of the current step. */
|
|
17
|
+
current: number;
|
|
18
|
+
orientation: 'horizontal' | 'vertical';
|
|
19
|
+
/** Completed steps can be revisited (emits pm-change). */
|
|
20
|
+
clickable: boolean;
|
|
21
|
+
label: string;
|
|
22
|
+
constructor();
|
|
23
|
+
render(): import("lit").TemplateResult<1>;
|
|
24
|
+
protected updated(): void;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* One step in a `<pm-steps>` progress indicator.
|
|
28
|
+
* @tag pm-step
|
|
29
|
+
* @slot icon - Replaces the number in the marker.
|
|
30
|
+
* @example <pm-step label="Shipping" description="Address and method"></pm-step>
|
|
31
|
+
*/
|
|
32
|
+
export declare class PmStep extends PmElement {
|
|
33
|
+
static componentName: string;
|
|
34
|
+
static styles: import("lit").CSSResult[];
|
|
35
|
+
static properties: PropertyDeclarations;
|
|
36
|
+
/** Registered icon name (see `registerIcons`); an `icon` slot overrides it. */
|
|
37
|
+
icon?: string;
|
|
38
|
+
label?: string;
|
|
39
|
+
description?: string;
|
|
40
|
+
/** Override the derived status (e.g. `error`). */
|
|
41
|
+
status?: Status;
|
|
42
|
+
disabled: boolean;
|
|
43
|
+
index: number;
|
|
44
|
+
computedStatus: Status;
|
|
45
|
+
interactive: boolean;
|
|
46
|
+
last: boolean;
|
|
47
|
+
vertical: boolean;
|
|
48
|
+
constructor();
|
|
49
|
+
connectedCallback(): void;
|
|
50
|
+
protected updated(): void;
|
|
51
|
+
render(): import("lit").TemplateResult<1>;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { css, html, nothing } from 'lit';
|
|
2
|
+
import { PmElement, defineElement } from '../base.js';
|
|
3
|
+
import stepsCss from '../styles/steps.js';
|
|
4
|
+
import { namedIcon } from '../named-icon.js';
|
|
5
|
+
/**
|
|
6
|
+
* Steps (wizard / checkout progress). Steps before `current` are complete.
|
|
7
|
+
* @tag pm-steps
|
|
8
|
+
* @slot - `pm-step` elements.
|
|
9
|
+
* @fires pm-change - A step was chosen (only with `clickable`). detail: { index }
|
|
10
|
+
* @example <pm-steps current="1"><pm-step label="Account"></pm-step><pm-step label="Profile" description="Tell us about you"></pm-step><pm-step label="Done"></pm-step></pm-steps>
|
|
11
|
+
*/
|
|
12
|
+
export class PmSteps extends PmElement {
|
|
13
|
+
static { this.componentName = 'steps'; }
|
|
14
|
+
static { this.styles = [...PmElement.styles, stepsCss, css `:host { display: block; } .pm-steps[data-orientation='horizontal'] ::slotted(pm-step) { flex: 1; } .pm-steps ::slotted(pm-step:last-of-type) { flex: none; }`]; }
|
|
15
|
+
static { this.properties = {
|
|
16
|
+
current: { type: Number, reflect: true },
|
|
17
|
+
orientation: { reflect: true },
|
|
18
|
+
clickable: { type: Boolean, reflect: true },
|
|
19
|
+
label: {},
|
|
20
|
+
}; }
|
|
21
|
+
constructor() { super(); this.current = 0; this.orientation = 'horizontal'; this.clickable = false; this.label = 'Progress'; }
|
|
22
|
+
render() {
|
|
23
|
+
return html `<div class="pm-steps" part="base" data-orientation=${this.orientation} role="list" aria-label=${this.label}>
|
|
24
|
+
<slot @slotchange=${this.#sync} @pm-step-click=${this.#onStep}></slot>
|
|
25
|
+
</div>`;
|
|
26
|
+
}
|
|
27
|
+
updated() { this.#sync(); }
|
|
28
|
+
#steps() { return [...this.children].filter((e) => e instanceof PmStep); }
|
|
29
|
+
#sync() {
|
|
30
|
+
const steps = this.#steps();
|
|
31
|
+
steps.forEach((s, i) => {
|
|
32
|
+
s.index = i;
|
|
33
|
+
s.last = i === steps.length - 1;
|
|
34
|
+
s.vertical = this.orientation === 'vertical';
|
|
35
|
+
s.computedStatus = s.status ?? (i < this.current ? 'complete' : i === this.current ? 'current' : 'upcoming');
|
|
36
|
+
s.interactive = this.clickable && !s.disabled && i !== this.current && (i < this.current || s.status === 'complete');
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
#onStep(e) {
|
|
40
|
+
e.stopPropagation();
|
|
41
|
+
this.current = e.detail.index;
|
|
42
|
+
this.emit('pm-change', { index: e.detail.index });
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* One step in a `<pm-steps>` progress indicator.
|
|
47
|
+
* @tag pm-step
|
|
48
|
+
* @slot icon - Replaces the number in the marker.
|
|
49
|
+
* @example <pm-step label="Shipping" description="Address and method"></pm-step>
|
|
50
|
+
*/
|
|
51
|
+
export class PmStep extends PmElement {
|
|
52
|
+
static { this.componentName = 'step'; }
|
|
53
|
+
static { this.styles = [...PmElement.styles, stepsCss, css `
|
|
54
|
+
:host { display: block; min-inline-size: 0; }
|
|
55
|
+
.pm-step::after { display: block; }
|
|
56
|
+
:host([data-last]) .pm-step::after { display: none; }
|
|
57
|
+
:host([data-last]) .pm-step { padding-block-end: 0; }
|
|
58
|
+
.pm-step[data-vertical] { padding-block-end: var(--pm-space-6); }
|
|
59
|
+
:host([data-last]) .pm-step[data-vertical] { padding-block-end: 0; }
|
|
60
|
+
`]; }
|
|
61
|
+
static { this.properties = { icon: { reflect: true },
|
|
62
|
+
label: {}, description: {}, status: { reflect: true }, disabled: { type: Boolean, reflect: true },
|
|
63
|
+
index: { attribute: false }, computedStatus: { attribute: false }, interactive: { attribute: false }, last: { attribute: false }, vertical: { attribute: false },
|
|
64
|
+
}; }
|
|
65
|
+
constructor() { super(); this.disabled = false; this.index = 0; this.computedStatus = 'upcoming'; this.interactive = false; this.last = false; this.vertical = false; }
|
|
66
|
+
connectedCallback() { super.connectedCallback(); this.setAttribute('role', 'listitem'); }
|
|
67
|
+
updated() {
|
|
68
|
+
this.toggleAttribute('data-last', this.last);
|
|
69
|
+
if (this.computedStatus === 'current')
|
|
70
|
+
this.setAttribute('aria-current', 'step');
|
|
71
|
+
else
|
|
72
|
+
this.removeAttribute('aria-current');
|
|
73
|
+
}
|
|
74
|
+
render() {
|
|
75
|
+
const s = this.computedStatus;
|
|
76
|
+
const words = { complete: 'completed', current: 'current', upcoming: 'not started', error: 'has an error' };
|
|
77
|
+
const hasIcon = !!this.icon || !!this.querySelector('[slot="icon"]');
|
|
78
|
+
const marker = hasIcon ? html `<slot name="icon">${namedIcon(this.icon)}</slot>` : s === 'complete' ? '✓' : s === 'error' ? '!' : String(this.index + 1);
|
|
79
|
+
return html `<div class="pm-step" part="base" data-status=${s} ?data-vertical=${this.vertical}>
|
|
80
|
+
${this.interactive ? html `<button type="button" class="pm-step-hit" aria-label=${`Go to step ${this.index + 1}: ${this.label ?? ''}`}
|
|
81
|
+
@click=${() => this.emit('pm-step-click', { index: this.index })}></button>` : nothing}
|
|
82
|
+
<span class="pm-step-marker" part="marker" aria-hidden="true">${marker}</span>
|
|
83
|
+
<span class="pm-step-text">
|
|
84
|
+
<span class="pm-step-label" part="label">${this.label}<span class="pm-visually-hidden">, ${words[s]}</span></span>
|
|
85
|
+
${this.description ? html `<span class="pm-step-description" part="description">${this.description}</span>` : nothing}
|
|
86
|
+
</span>
|
|
87
|
+
</div>`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
defineElement('pm-steps', PmSteps);
|
|
91
|
+
defineElement('pm-step', PmStep);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PmCheckbox } from './checkbox.js';
|
|
2
|
+
/**
|
|
3
|
+
* On/off switch (form value like a checkbox).
|
|
4
|
+
* @fires pm-change - When toggled. detail: { checked, value }
|
|
5
|
+
* @tag pm-switch
|
|
6
|
+
* @example <pm-switch name="notifications" checked>Notifications</pm-switch>
|
|
7
|
+
*/
|
|
8
|
+
export declare class PmSwitch extends PmCheckbox {
|
|
9
|
+
static styles: import("lit").CSSResult[];
|
|
10
|
+
static componentName: string;
|
|
11
|
+
protected kind: "switch";
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineElement } from '../base.js';
|
|
2
|
+
import { PmCheckbox } from './checkbox.js';
|
|
3
|
+
import switchCss from '../styles/switch.js';
|
|
4
|
+
/**
|
|
5
|
+
* On/off switch (form value like a checkbox).
|
|
6
|
+
* @fires pm-change - When toggled. detail: { checked, value }
|
|
7
|
+
* @tag pm-switch
|
|
8
|
+
* @example <pm-switch name="notifications" checked>Notifications</pm-switch>
|
|
9
|
+
*/
|
|
10
|
+
export class PmSwitch extends PmCheckbox {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.kind = 'switch';
|
|
14
|
+
}
|
|
15
|
+
static { this.styles = [...PmCheckbox.styles, switchCss]; }
|
|
16
|
+
static { this.componentName = 'switch'; }
|
|
17
|
+
}
|
|
18
|
+
defineElement('pm-switch', PmSwitch);
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type PropertyDeclarations, type PropertyValues } from 'lit';
|
|
2
|
+
import { PmElement } from '../base.js';
|
|
3
|
+
import { type Row, type SortState, type TableColumn } from '../table-core.js';
|
|
4
|
+
/**
|
|
5
|
+
* Basic table: columns and rows in, an accessible table out.
|
|
6
|
+
*
|
|
7
|
+
* Sortable columns (natural, locale-aware), Intl formatting by column `type`, sticky header, striped/hover rows,
|
|
8
|
+
* loading skeleton, empty state, and labelled cards in narrow containers. About a third the size of
|
|
9
|
+
* `<pm-data-table>`; use that for search, filters, selection, paging, pinned/resizable columns, grouping and
|
|
10
|
+
* editing. For zero JS, style a plain `<table class="pm-table">`.
|
|
11
|
+
*
|
|
12
|
+
* Cell content, first match wins: `render(row)` (text, DOM node or Lit template) → a light-DOM `<template
|
|
13
|
+
* data-cell="key">` with `{{field}}` placeholders (values are escaped; also `{{value}}`, `{{text}}`) →
|
|
14
|
+
* `format(value, row)` → Intl formatting by `type` (number, currency, percent, bytes, date, datetime, time, boolean)
|
|
15
|
+
* with `formatOptions`, `prefix`/`suffix` → the plain value (arrays joined, objects as JSON). Headers:
|
|
16
|
+
* `renderHeader(col)` → `<template data-header="key">` → `label` (always the accessible name). `cellClass`,
|
|
17
|
+
* `headerClass` and `wrap` style columns.
|
|
18
|
+
* @tag pm-table
|
|
19
|
+
* @slot empty - Content when there are no rows.
|
|
20
|
+
* @fires pm-sort - detail: { key, direction }
|
|
21
|
+
* @fires pm-row-click - detail: { row, index }
|
|
22
|
+
* @example <pm-table label="Plans" columns='[{"key":"name","label":"Plan","sortable":true},{"key":"price","label":"Price","type":"currency"}]' rows='[{"name":"Pro","price":12}]'></pm-table>
|
|
23
|
+
*/
|
|
24
|
+
export declare class PmTable<R extends Row = Row> extends PmElement {
|
|
25
|
+
#private;
|
|
26
|
+
static componentName: string;
|
|
27
|
+
static styles: import("lit").CSSResult[];
|
|
28
|
+
static properties: PropertyDeclarations;
|
|
29
|
+
/** Column definitions: key, label, type, sorting, formatting and rendering. */
|
|
30
|
+
columns: TableColumn<R>[];
|
|
31
|
+
/** Row objects (or a JSON string). */
|
|
32
|
+
rows: R[];
|
|
33
|
+
/** Accessible name (caption). */
|
|
34
|
+
label?: string;
|
|
35
|
+
/** Current sort: `{ key, direction }`. */
|
|
36
|
+
sort?: SortState;
|
|
37
|
+
striped: boolean;
|
|
38
|
+
loading: boolean;
|
|
39
|
+
emptyText: string;
|
|
40
|
+
/** Narrow containers (< 36rem): `auto` shows rows as labelled cards; `never` keeps a scrolling table. */
|
|
41
|
+
stack?: 'auto' | 'never';
|
|
42
|
+
/** Scroll inside the table past this height (header stays visible), e.g. "24rem". */
|
|
43
|
+
maxHeight?: string;
|
|
44
|
+
/** BCP 47 locale for number/date formatting (default: the page's). */
|
|
45
|
+
locale?: string;
|
|
46
|
+
/** Rows are clickable and fire `pm-row-click`. */
|
|
47
|
+
rowClickable: boolean;
|
|
48
|
+
/** Rows are already sorted (server-side); just emit pm-sort. */
|
|
49
|
+
manual: boolean;
|
|
50
|
+
constructor();
|
|
51
|
+
protected willUpdate(_: PropertyValues<this>): void;
|
|
52
|
+
/** Rows in display order. */
|
|
53
|
+
get sortedRows(): R[];
|
|
54
|
+
connectedCallback(): void;
|
|
55
|
+
disconnectedCallback(): void;
|
|
56
|
+
protected updated(changed: PropertyValues<this>): void;
|
|
57
|
+
render(): import("lit").TemplateResult<1>;
|
|
58
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { css, html, nothing } from 'lit';
|
|
2
|
+
import { PmElement, defineElement } from '../base.js';
|
|
3
|
+
import skeletonCss from '../styles/skeleton.js';
|
|
4
|
+
import tableCss from '../styles/table.js';
|
|
5
|
+
import badgeCss from '../styles/badge.js';
|
|
6
|
+
import { SORT_ICON, alignOf, cellClassOf, cellContent, headerContent, nameCustomHeaders, watchTemplates, noWrap, parseArray, sortRows } from '../table-core.js';
|
|
7
|
+
/**
|
|
8
|
+
* Basic table: columns and rows in, an accessible table out.
|
|
9
|
+
*
|
|
10
|
+
* Sortable columns (natural, locale-aware), Intl formatting by column `type`, sticky header, striped/hover rows,
|
|
11
|
+
* loading skeleton, empty state, and labelled cards in narrow containers. About a third the size of
|
|
12
|
+
* `<pm-data-table>`; use that for search, filters, selection, paging, pinned/resizable columns, grouping and
|
|
13
|
+
* editing. For zero JS, style a plain `<table class="pm-table">`.
|
|
14
|
+
*
|
|
15
|
+
* Cell content, first match wins: `render(row)` (text, DOM node or Lit template) → a light-DOM `<template
|
|
16
|
+
* data-cell="key">` with `{{field}}` placeholders (values are escaped; also `{{value}}`, `{{text}}`) →
|
|
17
|
+
* `format(value, row)` → Intl formatting by `type` (number, currency, percent, bytes, date, datetime, time, boolean)
|
|
18
|
+
* with `formatOptions`, `prefix`/`suffix` → the plain value (arrays joined, objects as JSON). Headers:
|
|
19
|
+
* `renderHeader(col)` → `<template data-header="key">` → `label` (always the accessible name). `cellClass`,
|
|
20
|
+
* `headerClass` and `wrap` style columns.
|
|
21
|
+
* @tag pm-table
|
|
22
|
+
* @slot empty - Content when there are no rows.
|
|
23
|
+
* @fires pm-sort - detail: { key, direction }
|
|
24
|
+
* @fires pm-row-click - detail: { row, index }
|
|
25
|
+
* @example <pm-table label="Plans" columns='[{"key":"name","label":"Plan","sortable":true},{"key":"price","label":"Price","type":"currency"}]' rows='[{"name":"Pro","price":12}]'></pm-table>
|
|
26
|
+
*/
|
|
27
|
+
export class PmTable extends PmElement {
|
|
28
|
+
static { this.componentName = 'table'; }
|
|
29
|
+
static { this.styles = [...PmElement.styles, tableCss, badgeCss, skeletonCss, css `/* Tables fill their container: the card layout uses a size container, which has no natural width of its own. */
|
|
30
|
+
:host { display: block; inline-size: 100%; min-inline-size: 0; } :host([hidden]) { display: none; } tr[data-clickable] { cursor: pointer; }`]; }
|
|
31
|
+
static { this.properties = {
|
|
32
|
+
columns: { type: Array }, rows: { type: Array }, label: {}, sort: { type: Object }, striped: { type: Boolean },
|
|
33
|
+
loading: { type: Boolean, reflect: true }, emptyText: { attribute: 'empty-text' }, stack: {}, maxHeight: { attribute: 'max-height' },
|
|
34
|
+
locale: {}, rowClickable: { type: Boolean, attribute: 'row-clickable' }, manual: { type: Boolean },
|
|
35
|
+
}; }
|
|
36
|
+
constructor() {
|
|
37
|
+
super();
|
|
38
|
+
this.columns = [];
|
|
39
|
+
this.rows = [];
|
|
40
|
+
this.striped = false;
|
|
41
|
+
this.loading = false;
|
|
42
|
+
this.emptyText = 'No results';
|
|
43
|
+
this.rowClickable = false;
|
|
44
|
+
this.manual = false;
|
|
45
|
+
}
|
|
46
|
+
willUpdate(_) {
|
|
47
|
+
if (!Array.isArray(this.columns))
|
|
48
|
+
this.columns = parseArray(this.columns);
|
|
49
|
+
if (!Array.isArray(this.rows))
|
|
50
|
+
this.rows = parseArray(this.rows);
|
|
51
|
+
}
|
|
52
|
+
/** Rows in display order. */
|
|
53
|
+
get sortedRows() { return this.manual || !this.sort ? this.rows : sortRows(this.rows, [this.sort], this.columns); }
|
|
54
|
+
#toggle(c) {
|
|
55
|
+
const cur = this.sort?.key === c.key ? this.sort.direction : undefined;
|
|
56
|
+
this.sort = cur === 'asc' ? { key: c.key, direction: 'desc' } : cur === 'desc' ? undefined : { key: c.key, direction: 'asc' };
|
|
57
|
+
this.emit('pm-sort', this.sort ?? { key: c.key, direction: undefined });
|
|
58
|
+
}
|
|
59
|
+
#tplObserver;
|
|
60
|
+
connectedCallback() { super.connectedCallback(); this.#tplObserver ??= watchTemplates(this); }
|
|
61
|
+
disconnectedCallback() { super.disconnectedCallback(); this.#tplObserver?.disconnect(); this.#tplObserver = undefined; }
|
|
62
|
+
updated(changed) {
|
|
63
|
+
super.updated(changed);
|
|
64
|
+
nameCustomHeaders(this.renderRoot);
|
|
65
|
+
}
|
|
66
|
+
render() {
|
|
67
|
+
const rows = this.sortedRows;
|
|
68
|
+
const n = this.columns.length;
|
|
69
|
+
return html `<div class="pm-table-wrap" part="base" data-stack=${this.stack ?? 'auto'}>
|
|
70
|
+
<div class="pm-table-scroll" part="scroll" tabindex="0" role="region" aria-label=${this.label ?? 'Table'} style=${this.maxHeight ? `max-block-size:${this.maxHeight}` : nothing}>
|
|
71
|
+
<table class="pm-table" ?data-striped=${this.striped} data-hover aria-busy=${this.loading ? 'true' : 'false'}>
|
|
72
|
+
${this.label ? html `<caption class="pm-visually-hidden">${this.label}</caption>` : nothing}
|
|
73
|
+
<thead><tr>${this.columns.map((c) => {
|
|
74
|
+
const dir = this.sort?.key === c.key ? this.sort.direction : undefined;
|
|
75
|
+
const head = headerContent(c, this);
|
|
76
|
+
const custom = head !== c.label;
|
|
77
|
+
return html `<th scope="col" class=${c.headerClass ?? nothing} data-align=${alignOf(c) ?? nothing} style=${c.width ? `inline-size:${c.width}` : nothing}
|
|
78
|
+
data-custom-head=${custom && !c.sortable ? c.label : nothing}
|
|
79
|
+
aria-sort=${dir === 'asc' ? 'ascending' : dir === 'desc' ? 'descending' : c.sortable ? 'none' : nothing}>${c.sortable
|
|
80
|
+
? html `<button type="button" class="pm-sort" data-dir=${dir ?? nothing} data-custom-head=${custom ? c.label : nothing} @click=${() => this.#toggle(c)}>${head}${SORT_ICON(dir)}</button>`
|
|
81
|
+
: head}</th>`;
|
|
82
|
+
})}</tr></thead>
|
|
83
|
+
<tbody>${this.loading && !rows.length
|
|
84
|
+
? Array.from({ length: 4 }, () => html `<tr>${Array.from({ length: n }, () => html `<td><span class="pm-skeleton" style="display:block;block-size:0.9em;inline-size:70%"></span></td>`)}</tr>`)
|
|
85
|
+
: rows.length
|
|
86
|
+
? rows.map((r, i) => html `<tr ?data-clickable=${this.rowClickable}
|
|
87
|
+
@click=${(e) => { if (this.rowClickable && !e.target.closest('a,button,input'))
|
|
88
|
+
this.emit('pm-row-click', { row: r, index: i }); }}>
|
|
89
|
+
${this.columns.map((c) => html `<td class=${cellClassOf(c, r) ?? nothing} data-align=${alignOf(c) ?? nothing} ?data-nowrap=${noWrap(c)} data-label=${c.label}>${cellContent(c, r, this.locale, this)}</td>`)}</tr>`)
|
|
90
|
+
: html `<tr><td colspan=${n || 1} class="pm-table-empty"><slot name="empty">${this.emptyText}</slot></td></tr>`}</tbody>
|
|
91
|
+
</table>
|
|
92
|
+
</div>
|
|
93
|
+
</div>`;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
defineElement('pm-table', PmTable);
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { type PropertyDeclarations, type PropertyValues } from 'lit';
|
|
2
|
+
import { PmElement, SafeHTMLElement } from '../base.js';
|
|
3
|
+
/**
|
|
4
|
+
* Tabs that switch between panels of related content, with keyboard support, overflow scrolling and closable tabs.
|
|
5
|
+
*
|
|
6
|
+
* Children: `<pm-tab>` (tabs) and `<pm-tab-panel>` (panels), matched by order. Arrow keys, Home/End; selection
|
|
7
|
+
* follows focus (`activation="manual"`: Enter/Space selects). Horizontal or `orientation="vertical"`. Overflowing
|
|
8
|
+
* tab lists scroll and show arrow buttons. `closable` tabs close with their ✕ or the Delete key; disabled tabs are
|
|
9
|
+
* skipped. Panels use hidden="until-found" (find-in-page).
|
|
10
|
+
* @tag pm-tabs
|
|
11
|
+
* @fires pm-change - detail: { index }
|
|
12
|
+
* @fires pm-close - Cancelable; by default the tab and its panel are removed. detail: { index, tab }
|
|
13
|
+
* @example <pm-tabs label="Settings"><pm-tab>Profile</pm-tab><pm-tab>Billing</pm-tab><pm-tab-panel>…</pm-tab-panel><pm-tab-panel>…</pm-tab-panel></pm-tabs>
|
|
14
|
+
*/
|
|
15
|
+
export declare class PmTabs extends PmElement {
|
|
16
|
+
#private;
|
|
17
|
+
static componentName: string;
|
|
18
|
+
static styles: import("lit").CSSResult[];
|
|
19
|
+
static properties: PropertyDeclarations;
|
|
20
|
+
selected: number;
|
|
21
|
+
/** Tab list direction. */
|
|
22
|
+
orientation?: 'horizontal' | 'vertical';
|
|
23
|
+
/** `auto` (default): arrow keys select. `manual`: arrow keys move focus, Enter/Space selects. */
|
|
24
|
+
activation?: 'auto' | 'manual';
|
|
25
|
+
_over: {
|
|
26
|
+
start: boolean;
|
|
27
|
+
end: boolean;
|
|
28
|
+
};
|
|
29
|
+
/** Accessible name of the tab list. */
|
|
30
|
+
label?: string;
|
|
31
|
+
variant?: 'line' | 'pills';
|
|
32
|
+
constructor();
|
|
33
|
+
connectedCallback(): void;
|
|
34
|
+
disconnectedCallback(): void;
|
|
35
|
+
/** Close a tab (fires cancelable pm-close; removes tab and panel unless prevented). */
|
|
36
|
+
close(index: number): void;
|
|
37
|
+
get tabs(): HTMLElement[];
|
|
38
|
+
get panels(): HTMLElement[];
|
|
39
|
+
render(): import("lit").TemplateResult<1>;
|
|
40
|
+
updated(changed: PropertyValues<this>): void;
|
|
41
|
+
select(index: number, focus?: boolean): void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* A tab in `pm-tabs`; matched to the `pm-tab-panel` at the same index.
|
|
45
|
+
* @tag pm-tab
|
|
46
|
+
* @attr {boolean} closable - Show a close button (also closes with Delete).
|
|
47
|
+
* @attr {boolean} disabled - Skipped by keyboard and not selectable.
|
|
48
|
+
* @attr {number} count - Count badge after the label (unread, results); hidden at 0 unless `show-zero`.
|
|
49
|
+
* @attr {number} max - Highest count shown before "+" (default 99).
|
|
50
|
+
* @attr {boolean} show-zero - Keep the count badge at 0.
|
|
51
|
+
* @attr {string} count-label - What the count means for screen readers; `{count}` is filled in ("{count} unread").
|
|
52
|
+
* @slot - Tab label (add an icon or a pm-badge for counts).
|
|
53
|
+
*/
|
|
54
|
+
export declare class PmTab extends SafeHTMLElement {
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Panel for the `pm-tab` at the same index. Hidden with `hidden=until-found` when supported.
|
|
58
|
+
* @tag pm-tab-panel
|
|
59
|
+
* @slot - Panel content.
|
|
60
|
+
*/
|
|
61
|
+
export declare class PmTabPanel extends SafeHTMLElement {
|
|
62
|
+
}
|