@xmesh/system-design 0.0.4 → 0.0.6
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/README.md +2 -1
- package/custom-elements.json +18382 -0
- package/dist/lit/components/alert/index.d.ts +5 -0
- package/dist/lit/components/alert/index.js +8 -2
- package/dist/lit/components/alert/index.styles.js +215 -0
- package/dist/lit/components/app-bar/index.d.ts +1 -0
- package/dist/lit/components/app-bar/index.js +4 -2
- package/dist/lit/components/app-bar/index.styles.js +94 -0
- package/dist/lit/components/artifact/index.d.ts +5 -0
- package/dist/lit/components/artifact/index.js +14 -10
- package/dist/lit/components/artifact/index.styles.js +180 -0
- package/dist/lit/components/autocomplete/index.d.ts +5 -0
- package/dist/lit/components/autocomplete/index.js +11 -2
- package/dist/lit/components/autocomplete/index.styles.js +185 -0
- package/dist/lit/components/avatar/index.d.ts +1 -0
- package/dist/lit/components/avatar/index.js +4 -2
- package/dist/lit/components/avatar/index.styles.js +76 -0
- package/dist/lit/components/avatar-group/index.d.ts +1 -0
- package/dist/lit/components/avatar-group/index.js +4 -2
- package/dist/lit/components/avatar-group/index.styles.js +74 -0
- package/dist/lit/components/badge/index.d.ts +1 -0
- package/dist/lit/components/badge/index.js +4 -2
- package/dist/lit/components/badge/index.styles.js +86 -0
- package/dist/lit/components/brand-mark/index.js +8 -9
- package/dist/lit/components/brand-mark/index.styles.js +123 -0
- package/dist/lit/components/breadcrumbs/index.d.ts +1 -0
- package/dist/lit/components/breadcrumbs/index.js +5 -4
- package/dist/lit/components/breadcrumbs/index.styles.js +105 -0
- package/dist/lit/components/bubble/index.d.ts +4 -0
- package/dist/lit/components/bubble/index.js +14 -11
- package/dist/lit/components/bubble/index.styles.js +196 -0
- package/dist/lit/components/button/index.d.ts +1 -0
- package/dist/lit/components/button/index.js +6 -13
- package/dist/lit/components/button/index.styles.js +356 -0
- package/dist/lit/components/card/index.d.ts +1 -0
- package/dist/lit/components/card/index.js +4 -2
- package/dist/lit/components/card/index.styles.js +113 -0
- package/dist/lit/components/chat/index.d.ts +6 -0
- package/dist/lit/components/chat/index.js +15 -10
- package/dist/lit/components/chat/index.styles.js +306 -0
- package/dist/lit/components/checkbox/index.d.ts +1 -0
- package/dist/lit/components/checkbox/index.js +7 -4
- package/dist/lit/components/checkbox/index.styles.js +140 -0
- package/dist/lit/components/chip/index.d.ts +5 -0
- package/dist/lit/components/chip/index.js +8 -2
- package/dist/lit/components/chip/index.styles.js +159 -0
- package/dist/lit/components/chip-group/index.d.ts +4 -0
- package/dist/lit/components/chip-group/index.js +7 -2
- package/dist/lit/components/chip-group/index.styles.js +33 -0
- package/dist/lit/components/code/index.d.ts +1 -0
- package/dist/lit/components/code/index.js +4 -3
- package/dist/lit/components/code/index.styles.js +56 -0
- package/dist/lit/components/composer/index.d.ts +6 -0
- package/dist/lit/components/composer/index.js +15 -10
- package/dist/lit/components/composer/index.styles.js +562 -0
- package/dist/lit/components/data-table/index.css +18 -0
- package/dist/lit/components/data-table/index.d.ts +30 -0
- package/dist/lit/components/data-table/index.js +120 -34
- package/dist/lit/components/data-table/index.styles.js +198 -0
- package/dist/lit/components/date-range/index.d.ts +4 -0
- package/dist/lit/components/date-range/index.js +7 -2
- package/dist/lit/components/date-range/index.styles.js +338 -0
- package/dist/lit/components/dialog/index.d.ts +4 -0
- package/dist/lit/components/dialog/index.js +7 -2
- package/dist/lit/components/dialog/index.styles.js +138 -0
- package/dist/lit/components/divider/index.d.ts +1 -0
- package/dist/lit/components/divider/index.js +4 -2
- package/dist/lit/components/divider/index.styles.js +41 -0
- package/dist/lit/components/empty-state/index.d.ts +1 -0
- package/dist/lit/components/empty-state/index.js +4 -2
- package/dist/lit/components/empty-state/index.styles.js +83 -0
- package/dist/lit/components/expansion-panel/index.d.ts +5 -0
- package/dist/lit/components/expansion-panel/index.js +8 -2
- package/dist/lit/components/expansion-panel/index.styles.js +134 -0
- package/dist/lit/components/field/index.d.ts +4 -0
- package/dist/lit/components/field/index.js +9 -4
- package/dist/lit/components/field/index.styles.js +237 -0
- package/dist/lit/components/file-input/index.d.ts +4 -0
- package/dist/lit/components/file-input/index.js +10 -4
- package/dist/lit/components/file-input/index.styles.js +271 -0
- package/dist/lit/components/form/index.d.ts +4 -0
- package/dist/lit/components/form/index.js +7 -2
- package/dist/lit/components/form/index.styles.js +43 -0
- package/dist/lit/components/grid/index.d.ts +1 -0
- package/dist/lit/components/grid/index.js +4 -2
- package/dist/lit/components/grid/index.styles.js +67 -0
- package/dist/lit/components/kbd/index.d.ts +1 -0
- package/dist/lit/components/kbd/index.js +4 -2
- package/dist/lit/components/kbd/index.styles.js +49 -0
- package/dist/lit/components/list/index.d.ts +4 -0
- package/dist/lit/components/list/index.js +7 -2
- package/dist/lit/components/list/index.styles.js +29 -0
- package/dist/lit/components/list-item/index.d.ts +1 -0
- package/dist/lit/components/list-item/index.js +4 -2
- package/dist/lit/components/list-item/index.styles.js +133 -0
- package/dist/lit/components/menu/index.d.ts +8 -0
- package/dist/lit/components/menu/index.js +11 -3
- package/dist/lit/components/menu/index.styles.js +108 -0
- package/dist/lit/components/multi-select/index.css +156 -0
- package/dist/lit/components/multi-select/index.d.ts +70 -0
- package/dist/lit/components/multi-select/index.js +497 -0
- package/dist/lit/components/multi-select/index.styles.js +170 -0
- package/dist/lit/components/navigation-drawer/index.d.ts +4 -0
- package/dist/lit/components/navigation-drawer/index.js +7 -2
- package/dist/lit/components/navigation-drawer/index.styles.js +128 -0
- package/dist/lit/components/overlay/index.d.ts +5 -0
- package/dist/lit/components/overlay/index.js +8 -2
- package/dist/lit/components/overlay/index.styles.js +185 -0
- package/dist/lit/components/pagination/index.d.ts +17 -0
- package/dist/lit/components/pagination/index.js +53 -8
- package/dist/lit/components/pagination/index.styles.js +116 -0
- package/dist/lit/components/popover/index.d.ts +5 -0
- package/dist/lit/components/popover/index.js +8 -2
- package/dist/lit/components/popover/index.styles.js +48 -0
- package/dist/lit/components/primitives/index.js +8 -9
- package/dist/lit/components/primitives/index.styles.js +518 -0
- package/dist/lit/components/progress/index.d.ts +1 -0
- package/dist/lit/components/progress/index.js +4 -2
- package/dist/lit/components/progress/index.styles.js +157 -0
- package/dist/lit/components/radio-group/index.d.ts +5 -0
- package/dist/lit/components/radio-group/index.js +10 -6
- package/dist/lit/components/radio-group/index.styles.js +192 -0
- package/dist/lit/components/select/index.d.ts +4 -0
- package/dist/lit/components/select/index.js +10 -2
- package/dist/lit/components/select/index.styles.js +165 -0
- package/dist/lit/components/sidebar-item/index.js +8 -9
- package/dist/lit/components/sidebar-item/index.styles.js +147 -0
- package/dist/lit/components/skeleton/index.d.ts +1 -0
- package/dist/lit/components/skeleton/index.js +4 -2
- package/dist/lit/components/skeleton/index.styles.js +95 -0
- package/dist/lit/components/slider/index.d.ts +5 -0
- package/dist/lit/components/slider/index.js +11 -4
- package/dist/lit/components/slider/index.styles.js +185 -0
- package/dist/lit/components/snackbar/index.d.ts +4 -0
- package/dist/lit/components/snackbar/index.js +14 -10
- package/dist/lit/components/snackbar/index.styles.js +293 -0
- package/dist/lit/components/stack/index.d.ts +1 -0
- package/dist/lit/components/stack/index.js +4 -2
- package/dist/lit/components/stack/index.styles.js +55 -0
- package/dist/lit/components/switch/index.d.ts +1 -0
- package/dist/lit/components/switch/index.js +7 -4
- package/dist/lit/components/switch/index.styles.js +140 -0
- package/dist/lit/components/table/index.d.ts +1 -0
- package/dist/lit/components/table/index.js +4 -2
- package/dist/lit/components/table/index.styles.js +99 -0
- package/dist/lit/components/tabs/index.d.ts +4 -0
- package/dist/lit/components/tabs/index.js +8 -4
- package/dist/lit/components/tabs/index.styles.js +130 -0
- package/dist/lit/components/text-field/index.d.ts +1 -0
- package/dist/lit/components/text-field/index.js +7 -2
- package/dist/lit/components/text-field/index.styles.js +104 -0
- package/dist/lit/components/textarea/index.d.ts +1 -0
- package/dist/lit/components/textarea/index.js +7 -2
- package/dist/lit/components/textarea/index.styles.js +69 -0
- package/dist/lit/components/tooltip/index.d.ts +1 -0
- package/dist/lit/components/tooltip/index.js +4 -2
- package/dist/lit/components/tooltip/index.styles.js +51 -0
- package/dist/lit/components/validation/index.d.ts +6 -0
- package/dist/lit/components/validation/index.js +15 -10
- package/dist/lit/components/validation/index.styles.js +400 -0
- package/dist/lit/index.d.ts +1 -0
- package/dist/lit/index.js +1 -0
- package/dist/react/XmAlert.d.ts +99 -0
- package/dist/react/XmAlert.js +47 -0
- package/dist/react/XmAppBar.d.ts +59 -0
- package/dist/react/XmAppBar.js +34 -0
- package/dist/react/XmArtifact.d.ts +113 -0
- package/dist/react/XmArtifact.js +48 -0
- package/dist/react/XmArtifactChip.d.ts +56 -0
- package/dist/react/XmArtifactChip.js +32 -0
- package/dist/react/XmAutocomplete.d.ts +153 -0
- package/dist/react/XmAutocomplete.js +70 -0
- package/dist/react/XmAvatar.d.ts +71 -0
- package/dist/react/XmAvatar.js +40 -0
- package/dist/react/XmAvatarGroup.d.ts +59 -0
- package/dist/react/XmAvatarGroup.js +34 -0
- package/dist/react/XmBadge.d.ts +67 -0
- package/dist/react/XmBadge.js +38 -0
- package/dist/react/XmBrandGlyph.d.ts +46 -0
- package/dist/react/XmBrandGlyph.js +24 -0
- package/dist/react/XmBrandMark.d.ts +71 -0
- package/dist/react/XmBrandMark.js +40 -0
- package/dist/react/XmBreadcrumbs.d.ts +56 -0
- package/dist/react/XmBreadcrumbs.js +32 -0
- package/dist/react/XmBubble.d.ts +69 -0
- package/dist/react/XmBubble.js +38 -0
- package/dist/react/XmBubbleActions.d.ts +59 -0
- package/dist/react/XmBubbleActions.js +34 -0
- package/dist/react/XmBubbleGroup.d.ts +82 -0
- package/dist/react/XmBubbleGroup.js +38 -0
- package/dist/react/XmButton.d.ts +89 -0
- package/dist/react/XmButton.js +48 -0
- package/dist/react/XmCard.d.ts +59 -0
- package/dist/react/XmCard.js +34 -0
- package/dist/react/XmChatShell.d.ts +110 -0
- package/dist/react/XmChatShell.js +48 -0
- package/dist/react/XmCheckbox.d.ts +145 -0
- package/dist/react/XmCheckbox.js +60 -0
- package/dist/react/XmChip.d.ts +99 -0
- package/dist/react/XmChip.js +48 -0
- package/dist/react/XmChipGroup.d.ts +79 -0
- package/dist/react/XmChipGroup.js +36 -0
- package/dist/react/XmCode.d.ts +55 -0
- package/dist/react/XmCode.js +32 -0
- package/dist/react/XmComposer.d.ts +123 -0
- package/dist/react/XmComposer.js +56 -0
- package/dist/react/XmDataTable.d.ts +125 -0
- package/dist/react/XmDataTable.js +66 -0
- package/dist/react/XmDateRange.d.ts +93 -0
- package/dist/react/XmDateRange.js +42 -0
- package/dist/react/XmDialog.d.ts +87 -0
- package/dist/react/XmDialog.js +41 -0
- package/dist/react/XmDivider.d.ts +55 -0
- package/dist/react/XmDivider.js +32 -0
- package/dist/react/XmEmptyState.d.ts +61 -0
- package/dist/react/XmEmptyState.js +34 -0
- package/dist/react/XmExpansionPanel.d.ts +101 -0
- package/dist/react/XmExpansionPanel.js +49 -0
- package/dist/react/XmFileInput.d.ts +151 -0
- package/dist/react/XmFileInput.js +70 -0
- package/dist/react/XmFileValidationBlock.d.ts +111 -0
- package/dist/react/XmFileValidationBlock.js +50 -0
- package/dist/react/XmForm.d.ts +91 -0
- package/dist/react/XmForm.js +38 -0
- package/dist/react/XmGrid.d.ts +59 -0
- package/dist/react/XmGrid.js +34 -0
- package/dist/react/XmKbd.d.ts +46 -0
- package/dist/react/XmKbd.js +24 -0
- package/dist/react/XmList.d.ts +83 -0
- package/dist/react/XmList.js +38 -0
- package/dist/react/XmListItem.d.ts +67 -0
- package/dist/react/XmListItem.js +38 -0
- package/dist/react/XmMenu.d.ts +98 -0
- package/dist/react/XmMenu.js +46 -0
- package/dist/react/XmMenuItem.d.ts +63 -0
- package/dist/react/XmMenuItem.js +36 -0
- package/dist/react/XmMultiSelect.d.ts +161 -0
- package/dist/react/XmMultiSelect.js +74 -0
- package/dist/react/XmNavigationDrawer.d.ts +93 -0
- package/dist/react/XmNavigationDrawer.js +42 -0
- package/dist/react/XmOverlay.d.ts +120 -0
- package/dist/react/XmOverlay.js +56 -0
- package/dist/react/XmPagination.d.ts +117 -0
- package/dist/react/XmPagination.js +58 -0
- package/dist/react/XmPopover.d.ts +90 -0
- package/dist/react/XmPopover.js +42 -0
- package/dist/react/XmProgress.d.ts +75 -0
- package/dist/react/XmProgress.js +42 -0
- package/dist/react/XmRadio.d.ts +88 -0
- package/dist/react/XmRadio.js +42 -0
- package/dist/react/XmRadioGroup.d.ts +139 -0
- package/dist/react/XmRadioGroup.js +58 -0
- package/dist/react/XmSelect.d.ts +152 -0
- package/dist/react/XmSelect.js +70 -0
- package/dist/react/XmSidebarItem.d.ts +75 -0
- package/dist/react/XmSidebarItem.js +42 -0
- package/dist/react/XmSkeleton.d.ts +71 -0
- package/dist/react/XmSkeleton.js +40 -0
- package/dist/react/XmSlider.d.ts +160 -0
- package/dist/react/XmSlider.js +76 -0
- package/dist/react/XmSnackbar.d.ts +110 -0
- package/dist/react/XmSnackbar.js +51 -0
- package/dist/react/XmStack.d.ts +71 -0
- package/dist/react/XmStack.js +40 -0
- package/dist/react/XmSwitch.d.ts +136 -0
- package/dist/react/XmSwitch.js +58 -0
- package/dist/react/XmTab.d.ts +79 -0
- package/dist/react/XmTab.js +38 -0
- package/dist/react/XmTabPanel.d.ts +55 -0
- package/dist/react/XmTabPanel.js +32 -0
- package/dist/react/XmTable.d.ts +57 -0
- package/dist/react/XmTable.js +32 -0
- package/dist/react/XmTabs.d.ts +82 -0
- package/dist/react/XmTabs.js +38 -0
- package/dist/react/XmTextField.d.ts +147 -0
- package/dist/react/XmTextField.js +62 -0
- package/dist/react/XmTextarea.d.ts +155 -0
- package/dist/react/XmTextarea.js +66 -0
- package/dist/react/XmTooltip.d.ts +67 -0
- package/dist/react/XmTooltip.js +38 -0
- package/dist/react/index.d.ts +59 -0
- package/dist/react/index.js +59 -0
- package/dist/react/react-utils.js +67 -0
- package/package.json +37 -9
- package/styles/_base-typography.css +86 -0
- package/styles/_primitives.css +54 -0
- package/styles/_reset.css +58 -0
- package/styles/base.css +23 -0
- package/vscode.css-custom-data.json +6 -0
- package/vscode.html-custom-data.json +979 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// GENERATED by scripts/gen-styles.mjs — do not edit. Source: lit/components/empty-state/index.css
|
|
2
|
+
// SSR-safe: constructable stylesheets need the DOM, so in a non-DOM context
|
|
3
|
+
// (Node/SSR import) this exports [] instead of throwing. The CSS self-declares
|
|
4
|
+
// the @layer order so the override contract holds even without ./base (AD-2).
|
|
5
|
+
let sheets = [];
|
|
6
|
+
if (typeof CSSStyleSheet !== "undefined") {
|
|
7
|
+
const sheet = new CSSStyleSheet();
|
|
8
|
+
sheet.replaceSync(`@layer reset, base, tokens, components, utilities;
|
|
9
|
+
@layer components {
|
|
10
|
+
/* ============================================
|
|
11
|
+
Empty state — the shared no-data placeholder.
|
|
12
|
+
|
|
13
|
+
A centered, stacked column: line icon · sentence-case headline ·
|
|
14
|
+
secondary copy · optional action. The component is TRANSPARENT and
|
|
15
|
+
traces its host surface (AD-13): every ink derives from the inherited
|
|
16
|
+
\`color\` (the host's on-* ink), never a hard-pinned surface token — so
|
|
17
|
+
it pairs correctly whether it sits on the desk (\`surface*\` → on-surface)
|
|
18
|
+
or on a card (\`inverse-surface\` → inverse-on-surface), in both themes.
|
|
19
|
+
|
|
20
|
+
No imagery, no illustration, no emoji, no gradient — the only graphic
|
|
21
|
+
is the Lucide-style line icon (currentColor, no fill).
|
|
22
|
+
|
|
23
|
+
BEM block: \`empty-state\`. Registered in scripts/check-bem.sh STRICT_BLOCKS.
|
|
24
|
+
============================================ */
|
|
25
|
+
|
|
26
|
+
.empty-state {
|
|
27
|
+
display: flex;
|
|
28
|
+
flex-direction: column;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
text-align: center;
|
|
32
|
+
gap: var(--s-2);
|
|
33
|
+
padding: var(--s-8) var(--s-6);
|
|
34
|
+
/* Trace the host: inherit the on-* ink the host already set on the
|
|
35
|
+
surface this empty-state sits on. No surface fill of its own. */
|
|
36
|
+
color: inherit;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.empty-state__icon {
|
|
40
|
+
display: inline-flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
margin-bottom: var(--s-1);
|
|
44
|
+
/* Icon reads as a quiet marker — softened from the host ink via the
|
|
45
|
+
inherited currentColor, not a hard-pinned token. */
|
|
46
|
+
color: color-mix(in oklab, currentColor 64%, transparent);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.empty-state__heading {
|
|
50
|
+
font-family: var(--md-sys-typescale-title-medium-font);
|
|
51
|
+
font-size: var(--md-sys-typescale-title-medium-size);
|
|
52
|
+
line-height: var(--md-sys-typescale-title-medium-line-height);
|
|
53
|
+
font-weight: var(--md-sys-typescale-title-medium-weight);
|
|
54
|
+
letter-spacing: var(--md-sys-typescale-title-medium-tracking);
|
|
55
|
+
color: currentColor;
|
|
56
|
+
text-wrap: balance;
|
|
57
|
+
}
|
|
58
|
+
.empty-state__heading.is-empty { display: none; }
|
|
59
|
+
|
|
60
|
+
.empty-state__text {
|
|
61
|
+
max-width: 44ch;
|
|
62
|
+
font-family: var(--md-sys-typescale-body-medium-font);
|
|
63
|
+
font-size: var(--md-sys-typescale-body-medium-size);
|
|
64
|
+
line-height: var(--md-sys-typescale-body-medium-line-height);
|
|
65
|
+
/* Soft tier — derived from the host ink so it works on either surface
|
|
66
|
+
family. (on-surface-variant / inverse muted both read as ~70% ink.) */
|
|
67
|
+
color: color-mix(in oklab, currentColor 70%, transparent);
|
|
68
|
+
text-wrap: pretty;
|
|
69
|
+
}
|
|
70
|
+
.empty-state__text.is-empty { display: none; }
|
|
71
|
+
|
|
72
|
+
.empty-state__action {
|
|
73
|
+
display: inline-flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: center;
|
|
76
|
+
margin-top: var(--s-3);
|
|
77
|
+
}
|
|
78
|
+
.empty-state__action.is-empty { display: none; }
|
|
79
|
+
|
|
80
|
+
}`);
|
|
81
|
+
sheets = [sheet];
|
|
82
|
+
}
|
|
83
|
+
export default sheets;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { LitElement } from "lit";
|
|
2
2
|
import type { TemplateResult } from "lit";
|
|
3
|
+
/**
|
|
4
|
+
* @fires change - Fired on commit with the new value in `detail`.
|
|
5
|
+
* @fires xm-expansion-panel-open - Coordination event (on document) so sibling panels close in single-open mode.
|
|
6
|
+
*/
|
|
3
7
|
export declare class XmExpansionPanel extends LitElement {
|
|
8
|
+
static styles: CSSStyleSheet[];
|
|
4
9
|
open: boolean;
|
|
5
10
|
heading: string;
|
|
6
11
|
disabled: boolean;
|
|
@@ -41,9 +41,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
41
41
|
};
|
|
42
42
|
import { LitElement, html } from "lit";
|
|
43
43
|
import { customElement, property } from "lit/decorators.js";
|
|
44
|
-
|
|
44
|
+
import expansionPanelSheets from "./index.styles.js";
|
|
45
45
|
const COORDINATION_EVENT = "xm-expansion-panel-open";
|
|
46
46
|
let panelInstance = 0;
|
|
47
|
+
/**
|
|
48
|
+
* @fires change - Fired on commit with the new value in `detail`.
|
|
49
|
+
* @fires xm-expansion-panel-open - Coordination event (on document) so sibling panels close in single-open mode.
|
|
50
|
+
*/
|
|
47
51
|
let XmExpansionPanel = class XmExpansionPanel extends LitElement {
|
|
48
52
|
constructor() {
|
|
49
53
|
super(...arguments);
|
|
@@ -66,6 +70,9 @@ let XmExpansionPanel = class XmExpansionPanel extends LitElement {
|
|
|
66
70
|
this._toggle();
|
|
67
71
|
};
|
|
68
72
|
}
|
|
73
|
+
// Adopted from the build-generated sheets (scripts/gen-styles.mjs) — no
|
|
74
|
+
// runtime URL fetch (ADR 0012). Cascade order preserved from the old <link>s.
|
|
75
|
+
static { this.styles = [...expansionPanelSheets]; }
|
|
69
76
|
connectedCallback() {
|
|
70
77
|
super.connectedCallback();
|
|
71
78
|
// Single-open coordination: listen on the document for sibling opens of
|
|
@@ -102,7 +109,6 @@ let XmExpansionPanel = class XmExpansionPanel extends LitElement {
|
|
|
102
109
|
const headerId = `${this._uid}-header`;
|
|
103
110
|
const bodyId = `${this._uid}-body`;
|
|
104
111
|
return html `
|
|
105
|
-
<link rel="stylesheet" href="${PANEL_CSS}" />
|
|
106
112
|
<style>
|
|
107
113
|
:host {
|
|
108
114
|
display: block;
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// GENERATED by scripts/gen-styles.mjs — do not edit. Source: lit/components/expansion-panel/index.css
|
|
2
|
+
// SSR-safe: constructable stylesheets need the DOM, so in a non-DOM context
|
|
3
|
+
// (Node/SSR import) this exports [] instead of throwing. The CSS self-declares
|
|
4
|
+
// the @layer order so the override contract holds even without ./base (AD-2).
|
|
5
|
+
let sheets = [];
|
|
6
|
+
if (typeof CSSStyleSheet !== "undefined") {
|
|
7
|
+
const sheet = new CSSStyleSheet();
|
|
8
|
+
sheet.replaceSync(`@layer reset, base, tokens, components, utilities;
|
|
9
|
+
@layer components {
|
|
10
|
+
/* ============================================
|
|
11
|
+
Expansion panel — collapsible disclosure with a rotating chevron.
|
|
12
|
+
|
|
13
|
+
<xm-expansion-panel> is a framed disclosure: a header button +
|
|
14
|
+
a collapsible body. The chevron rotates short4 / standard easing
|
|
15
|
+
on toggle (no spring, bounce, or scale-in; NFR-19).
|
|
16
|
+
|
|
17
|
+
Sits on one surface family (AD-13): surface-container-low frame,
|
|
18
|
+
ink --md-sys-color-on-surface, hairline 1px outline-variant
|
|
19
|
+
separators. No severity hue (AD-11). The chevron inherits ink via
|
|
20
|
+
currentColor.
|
|
21
|
+
============================================ */
|
|
22
|
+
|
|
23
|
+
.expansion-panel {
|
|
24
|
+
display: block;
|
|
25
|
+
border: 1px solid var(--md-sys-color-outline-variant);
|
|
26
|
+
border-radius: var(--md-sys-shape-corner-medium);
|
|
27
|
+
background: var(--md-sys-color-surface-container-low);
|
|
28
|
+
color: var(--md-sys-color-on-surface);
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.expansion-panel__header {
|
|
33
|
+
appearance: none;
|
|
34
|
+
width: 100%;
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
gap: var(--s-3);
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
padding: var(--s-3) var(--s-4);
|
|
40
|
+
border: none;
|
|
41
|
+
background: transparent;
|
|
42
|
+
color: var(--md-sys-color-on-surface);
|
|
43
|
+
text-align: start;
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
font-family: var(--md-sys-typescale-title-small-font);
|
|
46
|
+
font-size: var(--md-sys-typescale-title-small-size);
|
|
47
|
+
font-weight: 500;
|
|
48
|
+
line-height: 1.3;
|
|
49
|
+
transition: background var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
|
|
50
|
+
}
|
|
51
|
+
.expansion-panel__header:hover {
|
|
52
|
+
background: color-mix(in oklab, var(--md-sys-color-on-surface) var(--md-sys-state-hover-state-layer-opacity), transparent);
|
|
53
|
+
}
|
|
54
|
+
.expansion-panel__header:focus { outline: none; }
|
|
55
|
+
/* Inset focus ring so the accent halo stays inside the frame's rounded clip
|
|
56
|
+
rather than being cut off by overflow: hidden. Same 3px weight + coral
|
|
57
|
+
primary-container as --xm-state-focus-ring, just drawn inset. */
|
|
58
|
+
.expansion-panel__header:focus-visible {
|
|
59
|
+
outline: none;
|
|
60
|
+
box-shadow: inset 0 0 0 3px var(--md-sys-color-primary-container);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.expansion-panel__heading {
|
|
64
|
+
flex: 1;
|
|
65
|
+
min-width: 0;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.expansion-panel__chevron {
|
|
69
|
+
display: inline-flex;
|
|
70
|
+
align-items: center;
|
|
71
|
+
justify-content: center;
|
|
72
|
+
flex-shrink: 0;
|
|
73
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
74
|
+
transition: transform var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
|
|
75
|
+
}
|
|
76
|
+
.expansion-panel--open .expansion-panel__chevron {
|
|
77
|
+
transform: rotate(180deg);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/* Body — hidden when collapsed. A hairline separates it from the header
|
|
81
|
+
only while open. */
|
|
82
|
+
/* Animated reveal: the body is a 1-row grid that transitions 1fr→0fr; the inner
|
|
83
|
+
wrapper has min-height:0 + overflow:hidden so the auto-height content can be
|
|
84
|
+
clipped to zero. This animates a content-sized body (which a plain
|
|
85
|
+
height/max-height can't) with short4 standard easing — no spring/scale. */
|
|
86
|
+
.expansion-panel__body {
|
|
87
|
+
display: grid;
|
|
88
|
+
grid-template-rows: 1fr;
|
|
89
|
+
border-top: 1px solid var(--md-sys-color-outline-variant);
|
|
90
|
+
color: var(--md-sys-color-on-surface-variant);
|
|
91
|
+
font-family: var(--md-sys-typescale-body-large-font);
|
|
92
|
+
font-size: var(--md-sys-typescale-body-large-size);
|
|
93
|
+
line-height: var(--md-sys-typescale-body-large-line-height);
|
|
94
|
+
transition:
|
|
95
|
+
grid-template-rows var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard),
|
|
96
|
+
border-color var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-standard);
|
|
97
|
+
}
|
|
98
|
+
.expansion-panel__body-inner {
|
|
99
|
+
min-height: 0;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
padding: var(--s-3) var(--s-4) var(--s-4);
|
|
102
|
+
}
|
|
103
|
+
.expansion-panel__body.is-collapsed {
|
|
104
|
+
grid-template-rows: 0fr;
|
|
105
|
+
border-top-color: transparent;
|
|
106
|
+
}
|
|
107
|
+
.expansion-panel__body.is-collapsed .expansion-panel__body-inner {
|
|
108
|
+
/* Drop the vertical padding while collapsed so it doesn't hold the row open. */
|
|
109
|
+
padding-block: 0;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
@media (prefers-reduced-motion: reduce) {
|
|
113
|
+
.expansion-panel__body {
|
|
114
|
+
transition: none;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* Disabled — shared reduced emphasis, non-interactive. The chevron carries its
|
|
119
|
+
own color, so mute it too or it stays at full emphasis on a disabled panel. */
|
|
120
|
+
.expansion-panel--disabled .expansion-panel__header {
|
|
121
|
+
cursor: not-allowed;
|
|
122
|
+
color: var(--xm-color-on-surface-disabled);
|
|
123
|
+
}
|
|
124
|
+
.expansion-panel--disabled .expansion-panel__chevron {
|
|
125
|
+
color: var(--xm-color-on-surface-disabled);
|
|
126
|
+
}
|
|
127
|
+
.expansion-panel--disabled .expansion-panel__header:hover {
|
|
128
|
+
background: transparent;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
}`);
|
|
132
|
+
sheets = [sheet];
|
|
133
|
+
}
|
|
134
|
+
export default sheets;
|
|
@@ -14,8 +14,12 @@ export interface FieldControlAria {
|
|
|
14
14
|
*
|
|
15
15
|
* Subclasses register with `@customElement("xm-<name>")`; XmField itself is
|
|
16
16
|
* never registered (it is not a usable element on its own).
|
|
17
|
+
*
|
|
18
|
+
* @fires input - Fired on each edit with the current value in `detail` (inherited by every field).
|
|
19
|
+
* @fires change - Fired on commit with the new value in `detail` (inherited by every field).
|
|
17
20
|
*/
|
|
18
21
|
export declare abstract class XmField extends LitElement {
|
|
22
|
+
static styles: CSSStyleSheet[];
|
|
19
23
|
static formAssociated: boolean;
|
|
20
24
|
static shadowRootOptions: ShadowRootInit;
|
|
21
25
|
label: string;
|
|
@@ -47,18 +47,25 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
47
47
|
};
|
|
48
48
|
import { LitElement, html, nothing } from "lit";
|
|
49
49
|
import { property, state } from "lit/decorators.js";
|
|
50
|
+
import primitivesSheets from "../primitives/index.styles.js";
|
|
51
|
+
import fieldSheets from "./index.styles.js";
|
|
50
52
|
// Resolve CSS relative to the *built* file:
|
|
51
53
|
// lit/build/components/field/index.js → ../field/index.css.
|
|
52
|
-
const FIELD_CSS = new URL("../field/index.css", import.meta.url).href;
|
|
53
|
-
const PRIMITIVES_CSS = new URL("../primitives/index.css", import.meta.url).href;
|
|
54
54
|
let fieldIdSeq = 0;
|
|
55
55
|
/**
|
|
56
56
|
* Abstract chrome + lifecycle base for every xmesh form field.
|
|
57
57
|
*
|
|
58
58
|
* Subclasses register with `@customElement("xm-<name>")`; XmField itself is
|
|
59
59
|
* never registered (it is not a usable element on its own).
|
|
60
|
+
*
|
|
61
|
+
* @fires input - Fired on each edit with the current value in `detail` (inherited by every field).
|
|
62
|
+
* @fires change - Fired on commit with the new value in `detail` (inherited by every field).
|
|
60
63
|
*/
|
|
61
64
|
export class XmField extends LitElement {
|
|
65
|
+
// Adopted from build-generated sheets (gen-styles.mjs) — no runtime URL
|
|
66
|
+
// fetch (ADR 0012). Lit static styles don't merge on override, so subclasses
|
|
67
|
+
// re-include the chrome (primitives + field) sheets.
|
|
68
|
+
static { this.styles = [...primitivesSheets, ...fieldSheets]; }
|
|
62
69
|
// The contract xm-form (AD-6a / AD-12) reads against: a real form-associated
|
|
63
70
|
// custom element. Subclasses inherit this automatically.
|
|
64
71
|
static { this.formAssociated = true; }
|
|
@@ -276,8 +283,6 @@ export class XmField extends LitElement {
|
|
|
276
283
|
const helperText = this.isError ? this.error : this.helper;
|
|
277
284
|
const ctrl = this.controlAria;
|
|
278
285
|
return html `
|
|
279
|
-
<link rel="stylesheet" href="${PRIMITIVES_CSS}" />
|
|
280
|
-
<link rel="stylesheet" href="${FIELD_CSS}" />
|
|
281
286
|
<style>
|
|
282
287
|
:host {
|
|
283
288
|
display: block;
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
// GENERATED by scripts/gen-styles.mjs — do not edit. Source: lit/components/field/index.css
|
|
2
|
+
// SSR-safe: constructable stylesheets need the DOM, so in a non-DOM context
|
|
3
|
+
// (Node/SSR import) this exports [] instead of throwing. The CSS self-declares
|
|
4
|
+
// the @layer order so the override contract holds even without ./base (AD-2).
|
|
5
|
+
let sheets = [];
|
|
6
|
+
if (typeof CSSStyleSheet !== "undefined") {
|
|
7
|
+
const sheet = new CSSStyleSheet();
|
|
8
|
+
sheet.replaceSync(`@layer reset, base, tokens, components, utilities;
|
|
9
|
+
@layer components {
|
|
10
|
+
/* ============================================
|
|
11
|
+
XmField — abstract form-field chrome.
|
|
12
|
+
|
|
13
|
+
The base renders label / control wrapper / helper-or-error row; the
|
|
14
|
+
subclass drops only its concrete control into the control wrapper
|
|
15
|
+
(AD-7). One shared control height per \`size\` so a field lines up beside
|
|
16
|
+
a button of the same size (NFR-22). Surface is the card tier
|
|
17
|
+
(inverse-surface) with inverse-on-surface ink (AD-13). Severity is the
|
|
18
|
+
error icon + copy in the message row — never an error color, never a red
|
|
19
|
+
field (AD-11 / rule 3a).
|
|
20
|
+
|
|
21
|
+
Sizes mirror the button height ramp so fields snap to buttons:
|
|
22
|
+
.field--xs 22px control
|
|
23
|
+
.field--sm 26px control
|
|
24
|
+
.field--md 32px control (default)
|
|
25
|
+
.field--lg 42px control
|
|
26
|
+
|
|
27
|
+
BEM block: \`field\`. Registered in scripts/check-bem.sh STRICT_BLOCKS.
|
|
28
|
+
============================================ */
|
|
29
|
+
|
|
30
|
+
.field {
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
gap: var(--s-2);
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* ---------- Label row ---------- */
|
|
38
|
+
.field__label {
|
|
39
|
+
display: inline-flex;
|
|
40
|
+
align-items: center;
|
|
41
|
+
gap: var(--s-1);
|
|
42
|
+
color: var(--md-sys-color-inverse-on-surface);
|
|
43
|
+
font:
|
|
44
|
+
var(--md-sys-typescale-label-large-weight)
|
|
45
|
+
var(--md-sys-typescale-label-large-size) /
|
|
46
|
+
var(--md-sys-typescale-label-large-line-height)
|
|
47
|
+
var(--md-sys-typescale-label-large-font);
|
|
48
|
+
cursor: default;
|
|
49
|
+
}
|
|
50
|
+
.field__label-text {
|
|
51
|
+
letter-spacing: 0;
|
|
52
|
+
}
|
|
53
|
+
.field__required {
|
|
54
|
+
color: var(--md-sys-color-primary);
|
|
55
|
+
font-weight: 700;
|
|
56
|
+
line-height: 1;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* ---------- Control wrapper ----------
|
|
60
|
+
The wrapper carries the shared chrome: surface, border, radius, height,
|
|
61
|
+
focus ring. The concrete control (slotted or shadow-rendered by the
|
|
62
|
+
subclass) sits inside and inherits ink + type. */
|
|
63
|
+
.field__control {
|
|
64
|
+
position: relative;
|
|
65
|
+
display: flex;
|
|
66
|
+
align-items: center;
|
|
67
|
+
width: 100%;
|
|
68
|
+
box-sizing: border-box;
|
|
69
|
+
border: 1px solid var(--md-sys-color-outline-variant);
|
|
70
|
+
border-radius: var(--md-sys-shape-corner-button);
|
|
71
|
+
background: var(--md-sys-color-inverse-surface);
|
|
72
|
+
color: var(--md-sys-color-inverse-on-surface);
|
|
73
|
+
font:
|
|
74
|
+
var(--md-sys-typescale-body-large-weight)
|
|
75
|
+
var(--md-sys-typescale-body-large-size) /
|
|
76
|
+
var(--md-sys-typescale-body-large-line-height)
|
|
77
|
+
var(--md-sys-typescale-body-large-font);
|
|
78
|
+
transition:
|
|
79
|
+
border-color var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard),
|
|
80
|
+
box-shadow var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard),
|
|
81
|
+
background var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-standard);
|
|
82
|
+
}
|
|
83
|
+
.field__control:hover {
|
|
84
|
+
border-color: var(--md-sys-color-outline);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Focus — ring is the canonical visualization; outline suppressed. The wrapper
|
|
88
|
+
reacts to KEYBOARD focus of the inner control via :has(:focus-visible) so the
|
|
89
|
+
coral ring shows on tab-in but not on a plain pointer click (matches the
|
|
90
|
+
:focus-visible intent in the spec while still reacting to the slotted/native
|
|
91
|
+
control nested inside the wrapper). */
|
|
92
|
+
.field__control:has(:focus-visible) {
|
|
93
|
+
outline: none;
|
|
94
|
+
border-color: var(--md-sys-color-primary);
|
|
95
|
+
box-shadow: var(--xm-state-focus-ring);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/* Style whatever native control a subclass slots OR shadow-renders so the
|
|
99
|
+
chrome owns the box and the control is a transparent, borderless,
|
|
100
|
+
full-bleed inner. Two selector sets are required: ::slotted() matches a
|
|
101
|
+
light-DOM \`slot="control"\` child; the scoped descendant set matches a
|
|
102
|
+
control a subclass renders into shadow DOM via renderControl(). Without
|
|
103
|
+
the descendant set a UA-default input fill shows through (a dark box on
|
|
104
|
+
the light card surface) — the surface/ink foot-gun. */
|
|
105
|
+
.field__control ::slotted(input),
|
|
106
|
+
.field__control ::slotted(textarea),
|
|
107
|
+
.field__control ::slotted(select),
|
|
108
|
+
.field__control input,
|
|
109
|
+
.field__control textarea,
|
|
110
|
+
.field__control select {
|
|
111
|
+
flex: 1;
|
|
112
|
+
min-width: 0;
|
|
113
|
+
width: 100%;
|
|
114
|
+
appearance: none;
|
|
115
|
+
border: none;
|
|
116
|
+
outline: none;
|
|
117
|
+
background: transparent;
|
|
118
|
+
color: inherit;
|
|
119
|
+
font: inherit;
|
|
120
|
+
padding: 0 var(--s-3);
|
|
121
|
+
height: 100%;
|
|
122
|
+
box-sizing: border-box;
|
|
123
|
+
}
|
|
124
|
+
.field__control ::slotted(input)::placeholder,
|
|
125
|
+
.field__control ::slotted(textarea)::placeholder,
|
|
126
|
+
.field__control input::placeholder,
|
|
127
|
+
.field__control textarea::placeholder {
|
|
128
|
+
color: var(--xm-color-inverse-on-surface-muted);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* ---------- Sizes — shared control height ---------- */
|
|
132
|
+
.field--xs .field__control { min-height: 22px; }
|
|
133
|
+
.field--sm .field__control { min-height: 26px; }
|
|
134
|
+
.field--md .field__control { min-height: 32px; }
|
|
135
|
+
.field--lg .field__control { min-height: 42px; }
|
|
136
|
+
|
|
137
|
+
.field--xs .field__control ::slotted(input),
|
|
138
|
+
.field--xs .field__control ::slotted(select) { padding: 0 var(--s-2); }
|
|
139
|
+
|
|
140
|
+
/* ---------- Loading ----------
|
|
141
|
+
The control region is swapped for the spinner; the wrapper keeps its box
|
|
142
|
+
so the field height does not jump (AD-9a). */
|
|
143
|
+
.field__loading {
|
|
144
|
+
display: inline-flex;
|
|
145
|
+
align-items: center;
|
|
146
|
+
justify-content: flex-start;
|
|
147
|
+
width: 100%;
|
|
148
|
+
height: 100%;
|
|
149
|
+
padding: 0 var(--s-3);
|
|
150
|
+
color: var(--xm-color-inverse-on-surface-muted);
|
|
151
|
+
}
|
|
152
|
+
.field--loading .field__control {
|
|
153
|
+
cursor: progress;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* ---------- Disabled ----------
|
|
157
|
+
Shared reduced emphasis, cursor, reverted hover; never an error color. */
|
|
158
|
+
.field--disabled {
|
|
159
|
+
cursor: not-allowed;
|
|
160
|
+
}
|
|
161
|
+
/* No opacity on the control: it would dim the VALUE text (which inherits
|
|
162
|
+
.field__control's color) below AA. Swap the ink to the disabled token so
|
|
163
|
+
the value stays legible; the box is muted by its border + container. */
|
|
164
|
+
.field--disabled .field__control {
|
|
165
|
+
cursor: not-allowed;
|
|
166
|
+
color: var(--xm-color-inverse-on-surface-disabled);
|
|
167
|
+
box-shadow: none;
|
|
168
|
+
}
|
|
169
|
+
.field--disabled .field__control:hover {
|
|
170
|
+
border-color: var(--md-sys-color-outline-variant);
|
|
171
|
+
}
|
|
172
|
+
.field--disabled .field__control ::slotted(input)::placeholder,
|
|
173
|
+
.field--disabled .field__control ::slotted(textarea)::placeholder,
|
|
174
|
+
.field--disabled .field__control input::placeholder,
|
|
175
|
+
.field--disabled .field__control textarea::placeholder {
|
|
176
|
+
color: var(--xm-color-inverse-on-surface-disabled);
|
|
177
|
+
}
|
|
178
|
+
.field--disabled .field__label {
|
|
179
|
+
color: var(--xm-color-inverse-on-surface-disabled);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/* ---------- Readonly ----------
|
|
183
|
+
Value visible but not editable; still focusable. Stays on the card
|
|
184
|
+
(inverse-surface) family — a faint inverse-on-surface wash over the same
|
|
185
|
+
surface reads as inert without swapping in the desk surface family. */
|
|
186
|
+
.field--readonly .field__control {
|
|
187
|
+
background: color-mix(
|
|
188
|
+
in oklab,
|
|
189
|
+
var(--md-sys-color-inverse-on-surface) 5%,
|
|
190
|
+
var(--md-sys-color-inverse-surface)
|
|
191
|
+
);
|
|
192
|
+
border-color: var(--md-sys-color-outline-variant);
|
|
193
|
+
}
|
|
194
|
+
.field--readonly .field__control:hover {
|
|
195
|
+
border-color: var(--md-sys-color-outline-variant);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* ---------- Helper / error message row ----------
|
|
199
|
+
Severity is icon + copy. The error keeps the same ink as the helper —
|
|
200
|
+
the icon and string carry the severity, not a color (AD-11 / rule 3a). */
|
|
201
|
+
.field__message {
|
|
202
|
+
display: flex;
|
|
203
|
+
align-items: flex-start;
|
|
204
|
+
gap: var(--s-1);
|
|
205
|
+
min-height: 1em;
|
|
206
|
+
font:
|
|
207
|
+
var(--md-sys-typescale-body-small-weight)
|
|
208
|
+
var(--md-sys-typescale-body-small-size) /
|
|
209
|
+
var(--md-sys-typescale-body-small-line-height)
|
|
210
|
+
var(--md-sys-typescale-body-small-font);
|
|
211
|
+
}
|
|
212
|
+
.field__message--helper {
|
|
213
|
+
color: var(--xm-color-inverse-on-surface-muted);
|
|
214
|
+
}
|
|
215
|
+
.field__message--error {
|
|
216
|
+
color: var(--md-sys-color-inverse-on-surface);
|
|
217
|
+
}
|
|
218
|
+
.field__message--empty {
|
|
219
|
+
min-height: 0;
|
|
220
|
+
}
|
|
221
|
+
.field__error-icon {
|
|
222
|
+
display: inline-flex;
|
|
223
|
+
align-items: center;
|
|
224
|
+
flex-shrink: 0;
|
|
225
|
+
margin-top: 1px;
|
|
226
|
+
color: var(--md-sys-color-inverse-on-surface);
|
|
227
|
+
}
|
|
228
|
+
.field__message-text {
|
|
229
|
+
flex: 1;
|
|
230
|
+
min-width: 0;
|
|
231
|
+
text-wrap: pretty;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
}`);
|
|
235
|
+
sheets = [sheet];
|
|
236
|
+
}
|
|
237
|
+
export default sheets;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import type { TemplateResult } from "lit";
|
|
2
2
|
import { XmField } from "../field/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* @fires change - Fired on commit with the new value in `detail`.
|
|
5
|
+
*/
|
|
3
6
|
export declare class XmFileInput extends XmField {
|
|
7
|
+
static styles: CSSStyleSheet[];
|
|
4
8
|
/** Native accept filter (e.g. ".yml,.json,image/*"). */
|
|
5
9
|
accept: string;
|
|
6
10
|
/** Allow selecting more than one file. */
|
|
@@ -30,8 +30,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
30
30
|
import { html, nothing } from "lit";
|
|
31
31
|
import { customElement, property, state, query } from "lit/decorators.js";
|
|
32
32
|
import { XmField } from "../field/index.js";
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
import primitivesSheets from "../primitives/index.styles.js";
|
|
34
|
+
import fieldSheets from "../field/index.styles.js";
|
|
35
|
+
import fileInputSheets from "./index.styles.js";
|
|
35
36
|
/** Format bytes as `B` / `KB` / `MB` with one space before the unit (UX-DR4).
|
|
36
37
|
Decimal units (1 KB = 1000 B) — matches the file-size convention users see in
|
|
37
38
|
macOS / browsers, so a 412000-byte file reads "412 KB". */
|
|
@@ -44,6 +45,9 @@ function formatBytes(bytes) {
|
|
|
44
45
|
const mb = kb / 1000;
|
|
45
46
|
return `${mb < 10 ? mb.toFixed(1) : Math.round(mb)} MB`;
|
|
46
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* @fires change - Fired on commit with the new value in `detail`.
|
|
50
|
+
*/
|
|
47
51
|
let XmFileInput = class XmFileInput extends XmField {
|
|
48
52
|
constructor() {
|
|
49
53
|
super(...arguments);
|
|
@@ -96,6 +100,10 @@ let XmFileInput = class XmFileInput extends XmField {
|
|
|
96
100
|
this._setFiles(this.multiple ? picked : picked.slice(0, 1));
|
|
97
101
|
};
|
|
98
102
|
}
|
|
103
|
+
// Adopted from build-generated sheets (gen-styles.mjs) — no runtime URL
|
|
104
|
+
// fetch (ADR 0012). Lit static styles don't merge on override, so subclasses
|
|
105
|
+
// re-include the chrome (primitives + field) sheets.
|
|
106
|
+
static { this.styles = [...primitivesSheets, ...fieldSheets, ...fileInputSheets]; }
|
|
99
107
|
/** Public read contract (AD-6a) — the selected files. */
|
|
100
108
|
get files() {
|
|
101
109
|
return this._files;
|
|
@@ -165,8 +173,6 @@ let XmFileInput = class XmFileInput extends XmField {
|
|
|
165
173
|
const helperText = this.isError ? this.error : this.helper;
|
|
166
174
|
const ctrl = this.controlAria;
|
|
167
175
|
return html `
|
|
168
|
-
<link rel="stylesheet" href="${PRIMITIVES_CSS}" />
|
|
169
|
-
<link rel="stylesheet" href="${FILE_INPUT_CSS}" />
|
|
170
176
|
<style>
|
|
171
177
|
:host {
|
|
172
178
|
display: block;
|