@f-ewald/components 1.35.0 → 1.37.3
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 +138 -3
- package/dist/app-shell.d.ts +8 -0
- package/dist/app-shell.d.ts.map +1 -1
- package/dist/app-shell.js +54 -22
- package/dist/app-shell.js.map +1 -1
- package/dist/copy-link-button.js +2 -2
- package/dist/copy-link-button.js.map +1 -1
- package/dist/dropdown-button.d.ts +8 -1
- package/dist/dropdown-button.d.ts.map +1 -1
- package/dist/dropdown-button.js +25 -1
- package/dist/dropdown-button.js.map +1 -1
- package/dist/icons.d.ts +11 -1
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +11 -1
- package/dist/icons.js.map +1 -1
- package/docs/app-shell.md +7 -0
- package/docs/dropdown-button.md +5 -1
- package/docs/icons.md +6 -1
- package/llms.txt +18 -4
- package/package.json +1 -1
package/custom-elements.json
CHANGED
|
@@ -993,7 +993,7 @@
|
|
|
993
993
|
"declarations": [
|
|
994
994
|
{
|
|
995
995
|
"kind": "class",
|
|
996
|
-
"description": "The dashboard page shell: a slot-based CSS-grid backbone that arranges a\ntop bar, the main content, an optional right-hand detail column, an\noptional footer, and a sidebar. The top bar always spans the shell's full\nwidth, in every sidebar state.\n\nThe sidebar's visibility, width, and layout mode are three independent\nproperties:\n- `sidebar-open` (default closed) — whether it's shown at all.\n- `sidebar-width`: `\"full\"` (16rem, icons + labels, the default) or\n `\"icon\"` (3.5rem rail, icons only — drives the slotted `app-sidebar`'s\n own `collapsed` attribute).\n- `sidebar-mode`: `\"overlay\"` (the default) floats the sidebar above the\n shell's own content with a higher z-index, covering part of the top\n bar's corner and whatever content sits beneath it, without ever\n resizing or reflowing `main`/`footer`. `\"push\"` instead reserves a real\n grid column beside `main`/`footer` (which resize to make room) — the\n top bar still spans full width above it either way.\n\nBelow the shared 48rem breakpoint the sidebar always behaves as a\nfull-width, modal, scrim/Escape-dismissible drawer regardless of\n`sidebar-mode`/`sidebar-width` — those two properties only affect the\ndesktop presentation. Above 48rem, an `overlay`-mode sidebar is a\nnon-modal panel (no dimming scrim, no Escape-dismiss, since it reads as\nan ordinary always-interactive panel rather than a blocking dialog); a\n`push`-mode sidebar is even more clearly non-modal, since it never\ncovers anything.\n\nThe right-hand detail column is unaffected by any of the above: it still\nreserves an inline grid column on desktop and becomes a dismissible\noverlay (scrim/Escape) on mobile.\n\nWidths are tunable per instance via `--component-sidebar-width` (16rem),\n`--component-sidebar-rail-width` (3.5rem), and `--component-topbar-height`\n(3rem); the detail column reuses the 20rem/25rem panel widths. The main\ncontent area is white by default — override it with\n`--component-main-background`. Give the shell a height (e.g. `height:\n100vh`) so the sidebar and main can size and scroll.\n\nHovering or keyboard-focusing the toggle reveals a tooltip naming the\naction and its `[` shortcut — the shortcut is not shown as permanent\nchrome.",
|
|
996
|
+
"description": "The dashboard page shell: a slot-based CSS-grid backbone that arranges a\ntop bar, the main content, an optional right-hand detail column, an\noptional footer, and a sidebar. The top bar always spans the shell's full\nwidth, in every sidebar state.\n\nThe sidebar's visibility, width, and layout mode are three independent\nproperties:\n- `sidebar-open` (default closed) — whether it's shown at all.\n- `sidebar-width`: `\"full\"` (16rem, icons + labels, the default) or\n `\"icon\"` (3.5rem rail, icons only — drives the slotted `app-sidebar`'s\n own `collapsed` attribute).\n- `sidebar-mode`: `\"overlay\"` (the default) floats the sidebar above the\n shell's own content with a higher z-index, covering part of the top\n bar's corner and whatever content sits beneath it, without ever\n resizing or reflowing `main`/`footer`. `\"push\"` instead reserves a real\n grid column beside `main`/`footer` (which resize to make room) — the\n top bar still spans full width above it either way.\n\nBelow the shared 48rem breakpoint the sidebar always behaves as a\nfull-width, modal, scrim/Escape-dismissible drawer regardless of\n`sidebar-mode`/`sidebar-width` — those two properties only affect the\ndesktop presentation. Above 48rem, an `overlay`-mode sidebar is a\nnon-modal panel (no dimming scrim, no Escape-dismiss, since it reads as\nan ordinary always-interactive panel rather than a blocking dialog); a\n`push`-mode sidebar is even more clearly non-modal, since it never\ncovers anything.\n\nThe right-hand detail column is unaffected by any of the above: it still\nreserves an inline grid column on desktop and becomes a dismissible\noverlay (scrim/Escape) on mobile.\n\nWidths are tunable per instance via `--component-sidebar-width` (16rem),\n`--component-sidebar-rail-width` (3.5rem), and `--component-topbar-height`\n(3rem); the detail column reuses the 20rem/25rem panel widths. The main\ncontent area is white by default — override it with\n`--component-main-background`. Give the shell a height (e.g. `height:\n100vh`) so the sidebar and main can size and scroll.\n\nHovering or keyboard-focusing the toggle reveals a tooltip naming the\naction and its `[` shortcut — the shortcut is not shown as permanent\nchrome.\n\nConsumers with their own external top bar can set `no-topbar` to skip\nrendering the built-in topbar row and toggle button entirely (the grid\ndrops that row rather than leaving dead space). The `[`/Escape shortcuts\nstay fully active either way — drive `sidebar-open` from your own UI and\nlisten for `sidebar-toggle` to stay in sync with keyboard-driven changes.",
|
|
997
997
|
"name": "AppShell",
|
|
998
998
|
"slots": [
|
|
999
999
|
{
|
|
@@ -1072,6 +1072,17 @@
|
|
|
1072
1072
|
"description": "Detail width: `compact` (20rem) or `comfortable` (25rem).",
|
|
1073
1073
|
"attribute": "detail-width"
|
|
1074
1074
|
},
|
|
1075
|
+
{
|
|
1076
|
+
"kind": "field",
|
|
1077
|
+
"name": "noTopbar",
|
|
1078
|
+
"type": {
|
|
1079
|
+
"text": "boolean"
|
|
1080
|
+
},
|
|
1081
|
+
"default": "false",
|
|
1082
|
+
"description": "Skips rendering the built-in topbar row and its nav toggle entirely, for consumers with their own external top bar. The `[`/Escape shortcuts stay active regardless — this only affects what's rendered.",
|
|
1083
|
+
"attribute": "no-topbar",
|
|
1084
|
+
"reflects": true
|
|
1085
|
+
},
|
|
1075
1086
|
{
|
|
1076
1087
|
"kind": "field",
|
|
1077
1088
|
"name": "_mobile",
|
|
@@ -1266,6 +1277,15 @@
|
|
|
1266
1277
|
"default": "\"compact\"",
|
|
1267
1278
|
"description": "Detail width: `compact` (20rem) or `comfortable` (25rem).",
|
|
1268
1279
|
"fieldName": "detailWidth"
|
|
1280
|
+
},
|
|
1281
|
+
{
|
|
1282
|
+
"name": "no-topbar",
|
|
1283
|
+
"type": {
|
|
1284
|
+
"text": "boolean"
|
|
1285
|
+
},
|
|
1286
|
+
"default": "false",
|
|
1287
|
+
"description": "Skips rendering the built-in topbar row and its nav toggle entirely, for consumers with their own external top bar. The `[`/Escape shortcuts stay active regardless — this only affects what's rendered.",
|
|
1288
|
+
"fieldName": "noTopbar"
|
|
1269
1289
|
}
|
|
1270
1290
|
],
|
|
1271
1291
|
"superclass": {
|
|
@@ -6503,7 +6523,7 @@
|
|
|
6503
6523
|
"declarations": [
|
|
6504
6524
|
{
|
|
6505
6525
|
"kind": "class",
|
|
6506
|
-
"description": "A button that opens an anchored menu of actions — essentially `form-select`\nminus \"current value\" semantics: a menu, not a select. Use for a set of\nmutually exclusive next-step actions (e.g. a failed task's Retry / Close /\nBacklog, or a table row's overflow actions).\n\nThree trigger presentations share one base: `text` (the default — a\nprimary-filled button with a label and a rotating chevron), `text-icon`\n(the same, with `icon` ahead of the label), and `icon` (a borderless,\nsquare, low-emphasis icon target in the style of `icon-button` — the\nclassic \"three-dot\"/overflow menu, where `label` becomes the accessible\nname rather than visible text). Set `size=\"sm\"` for a compact trigger one\nstep below the default, matching `ui-button`'s `sm` size.",
|
|
6526
|
+
"description": "A button that opens an anchored menu of actions — essentially `form-select`\nminus \"current value\" semantics: a menu, not a select. Use for a set of\nmutually exclusive next-step actions (e.g. a failed task's Retry / Close /\nBacklog, or a table row's overflow actions).\n\nThree trigger presentations share one base: `text` (the default — a\nprimary-filled button with a label and a rotating chevron), `text-icon`\n(the same, with `icon` ahead of the label), and `icon` (a borderless,\nsquare, low-emphasis icon target in the style of `icon-button` — the\nclassic \"three-dot\"/overflow menu, where `label` becomes the accessible\nname rather than visible text). Set `size=\"sm\"` for a compact trigger one\nstep below the default, matching `ui-button`'s `sm` size. Set `circular`\non the `icon` variant when the trigger wraps an inherently circular\nelement (e.g. an avatar) so the hover/focus highlight matches its shape\ninstead of the default rounded-square icon-button footprint.",
|
|
6507
6527
|
"name": "DropdownButton",
|
|
6508
6528
|
"members": [
|
|
6509
6529
|
{
|
|
@@ -6566,6 +6586,17 @@
|
|
|
6566
6586
|
"attribute": "size",
|
|
6567
6587
|
"reflects": true
|
|
6568
6588
|
},
|
|
6589
|
+
{
|
|
6590
|
+
"kind": "field",
|
|
6591
|
+
"name": "circular",
|
|
6592
|
+
"type": {
|
|
6593
|
+
"text": "boolean"
|
|
6594
|
+
},
|
|
6595
|
+
"default": "false",
|
|
6596
|
+
"description": "`icon` variant only: renders the trigger's highlight as a circle instead of a rounded square, to match a wrapped circular element (e.g. an avatar).",
|
|
6597
|
+
"attribute": "circular",
|
|
6598
|
+
"reflects": true
|
|
6599
|
+
},
|
|
6569
6600
|
{
|
|
6570
6601
|
"kind": "field",
|
|
6571
6602
|
"name": "_open",
|
|
@@ -6721,6 +6752,15 @@
|
|
|
6721
6752
|
"default": "\"md\"",
|
|
6722
6753
|
"description": "Size — `sm` reduces the trigger's height/padding/font-size one step below the default.",
|
|
6723
6754
|
"fieldName": "size"
|
|
6755
|
+
},
|
|
6756
|
+
{
|
|
6757
|
+
"name": "circular",
|
|
6758
|
+
"type": {
|
|
6759
|
+
"text": "boolean"
|
|
6760
|
+
},
|
|
6761
|
+
"default": "false",
|
|
6762
|
+
"description": "`icon` variant only: renders the trigger's highlight as a circle instead of a rounded square, to match a wrapped circular element (e.g. an avatar).",
|
|
6763
|
+
"fieldName": "circular"
|
|
6724
6764
|
}
|
|
6725
6765
|
],
|
|
6726
6766
|
"superclass": {
|
|
@@ -8915,7 +8955,7 @@
|
|
|
8915
8955
|
"default": "16"
|
|
8916
8956
|
}
|
|
8917
8957
|
],
|
|
8918
|
-
"description": "
|
|
8958
|
+
"description": "Hyperlink-related actions or a linked/associated-item indicator."
|
|
8919
8959
|
},
|
|
8920
8960
|
{
|
|
8921
8961
|
"kind": "function",
|
|
@@ -9246,6 +9286,61 @@
|
|
|
9246
9286
|
}
|
|
9247
9287
|
],
|
|
9248
9288
|
"description": "\"Exit fullscreen\" actions; pair with iconArrowsPointingOut for entering fullscreen."
|
|
9289
|
+
},
|
|
9290
|
+
{
|
|
9291
|
+
"kind": "function",
|
|
9292
|
+
"name": "iconGlobeAmericas",
|
|
9293
|
+
"parameters": [
|
|
9294
|
+
{
|
|
9295
|
+
"name": "size",
|
|
9296
|
+
"default": "16"
|
|
9297
|
+
}
|
|
9298
|
+
],
|
|
9299
|
+
"description": "Terrain/outdoors content, or a Americas-centric globe/region selector."
|
|
9300
|
+
},
|
|
9301
|
+
{
|
|
9302
|
+
"kind": "function",
|
|
9303
|
+
"name": "iconGlobeAlt",
|
|
9304
|
+
"parameters": [
|
|
9305
|
+
{
|
|
9306
|
+
"name": "size",
|
|
9307
|
+
"default": "16"
|
|
9308
|
+
}
|
|
9309
|
+
],
|
|
9310
|
+
"description": "A generic globe/satellite-view toggle, or international/worldwide content."
|
|
9311
|
+
},
|
|
9312
|
+
{
|
|
9313
|
+
"kind": "function",
|
|
9314
|
+
"name": "iconSignal",
|
|
9315
|
+
"parameters": [
|
|
9316
|
+
{
|
|
9317
|
+
"name": "size",
|
|
9318
|
+
"default": "16"
|
|
9319
|
+
}
|
|
9320
|
+
],
|
|
9321
|
+
"description": "Live/real-time data, connectivity strength, or a traffic-conditions toggle."
|
|
9322
|
+
},
|
|
9323
|
+
{
|
|
9324
|
+
"kind": "function",
|
|
9325
|
+
"name": "iconClipboard",
|
|
9326
|
+
"parameters": [
|
|
9327
|
+
{
|
|
9328
|
+
"name": "size",
|
|
9329
|
+
"default": "18"
|
|
9330
|
+
}
|
|
9331
|
+
],
|
|
9332
|
+
"description": "Copy-to-clipboard actions, e.g. copy-link-button."
|
|
9333
|
+
},
|
|
9334
|
+
{
|
|
9335
|
+
"kind": "function",
|
|
9336
|
+
"name": "iconMagnifyingGlass",
|
|
9337
|
+
"parameters": [
|
|
9338
|
+
{
|
|
9339
|
+
"name": "size",
|
|
9340
|
+
"default": "16"
|
|
9341
|
+
}
|
|
9342
|
+
],
|
|
9343
|
+
"description": "Search inputs or search-triggering actions."
|
|
9249
9344
|
}
|
|
9250
9345
|
],
|
|
9251
9346
|
"exports": [
|
|
@@ -9728,6 +9823,46 @@
|
|
|
9728
9823
|
"name": "iconArrowsPointingIn",
|
|
9729
9824
|
"module": "src/icons.ts"
|
|
9730
9825
|
}
|
|
9826
|
+
},
|
|
9827
|
+
{
|
|
9828
|
+
"kind": "js",
|
|
9829
|
+
"name": "iconGlobeAmericas",
|
|
9830
|
+
"declaration": {
|
|
9831
|
+
"name": "iconGlobeAmericas",
|
|
9832
|
+
"module": "src/icons.ts"
|
|
9833
|
+
}
|
|
9834
|
+
},
|
|
9835
|
+
{
|
|
9836
|
+
"kind": "js",
|
|
9837
|
+
"name": "iconGlobeAlt",
|
|
9838
|
+
"declaration": {
|
|
9839
|
+
"name": "iconGlobeAlt",
|
|
9840
|
+
"module": "src/icons.ts"
|
|
9841
|
+
}
|
|
9842
|
+
},
|
|
9843
|
+
{
|
|
9844
|
+
"kind": "js",
|
|
9845
|
+
"name": "iconSignal",
|
|
9846
|
+
"declaration": {
|
|
9847
|
+
"name": "iconSignal",
|
|
9848
|
+
"module": "src/icons.ts"
|
|
9849
|
+
}
|
|
9850
|
+
},
|
|
9851
|
+
{
|
|
9852
|
+
"kind": "js",
|
|
9853
|
+
"name": "iconClipboard",
|
|
9854
|
+
"declaration": {
|
|
9855
|
+
"name": "iconClipboard",
|
|
9856
|
+
"module": "src/icons.ts"
|
|
9857
|
+
}
|
|
9858
|
+
},
|
|
9859
|
+
{
|
|
9860
|
+
"kind": "js",
|
|
9861
|
+
"name": "iconMagnifyingGlass",
|
|
9862
|
+
"declaration": {
|
|
9863
|
+
"name": "iconMagnifyingGlass",
|
|
9864
|
+
"module": "src/icons.ts"
|
|
9865
|
+
}
|
|
9731
9866
|
}
|
|
9732
9867
|
]
|
|
9733
9868
|
},
|
package/dist/app-shell.d.ts
CHANGED
|
@@ -48,6 +48,12 @@ export interface SidebarToggleDetail {
|
|
|
48
48
|
* action and its `[` shortcut — the shortcut is not shown as permanent
|
|
49
49
|
* chrome.
|
|
50
50
|
*
|
|
51
|
+
* Consumers with their own external top bar can set `no-topbar` to skip
|
|
52
|
+
* rendering the built-in topbar row and toggle button entirely (the grid
|
|
53
|
+
* drops that row rather than leaving dead space). The `[`/Escape shortcuts
|
|
54
|
+
* stay fully active either way — drive `sidebar-open` from your own UI and
|
|
55
|
+
* listen for `sidebar-toggle` to stay in sync with keyboard-driven changes.
|
|
56
|
+
*
|
|
51
57
|
* @element app-shell
|
|
52
58
|
* @slot - Main content area.
|
|
53
59
|
* @slot sidebar - Sidebar navigation (typically `app-sidebar`).
|
|
@@ -68,6 +74,8 @@ export declare class AppShell extends LitElement {
|
|
|
68
74
|
detailOpen: boolean;
|
|
69
75
|
/** Detail width: `compact` (20rem) or `comfortable` (25rem). */
|
|
70
76
|
detailWidth: "compact" | "comfortable";
|
|
77
|
+
/** Skips rendering the built-in topbar row and its nav toggle entirely, for consumers with their own external top bar. The `[`/Escape shortcuts stay active regardless — this only affects what's rendered. */
|
|
78
|
+
noTopbar: boolean;
|
|
71
79
|
/** Whether the viewport is at/below the 48rem breakpoint. */
|
|
72
80
|
private _mobile;
|
|
73
81
|
/** Whether the footer slot has assigned content. */
|
package/dist/app-shell.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-shell.d.ts","sourceRoot":"","sources":["../src/app-shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"app-shell.d.ts","sourceRoot":"","sources":["../src/app-shell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAG1E,OAAO,eAAe,CAAC;AAGvB,gEAAgE;AAChE,MAAM,WAAW,mBAAmB;IAClC,uCAAuC;IACvC,IAA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= (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import { LitElement, css, html } from "lit";
|
|
7
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
8
8
|
import { customElement, property, state } from "lit/decorators.js";
|
|
9
9
|
import { iconBars3 } from "./icons.js";
|
|
10
10
|
import "./kbd-hint.js";
|
|
@@ -52,6 +52,12 @@ import { tokens } from "./tokens.js";
|
|
|
52
52
|
* action and its `[` shortcut — the shortcut is not shown as permanent
|
|
53
53
|
* chrome.
|
|
54
54
|
*
|
|
55
|
+
* Consumers with their own external top bar can set `no-topbar` to skip
|
|
56
|
+
* rendering the built-in topbar row and toggle button entirely (the grid
|
|
57
|
+
* drops that row rather than leaving dead space). The `[`/Escape shortcuts
|
|
58
|
+
* stay fully active either way — drive `sidebar-open` from your own UI and
|
|
59
|
+
* listen for `sidebar-toggle` to stay in sync with keyboard-driven changes.
|
|
60
|
+
*
|
|
55
61
|
* @element app-shell
|
|
56
62
|
* @slot - Main content area.
|
|
57
63
|
* @slot sidebar - Sidebar navigation (typically `app-sidebar`).
|
|
@@ -74,6 +80,8 @@ let AppShell = class AppShell extends LitElement {
|
|
|
74
80
|
this.detailOpen = false;
|
|
75
81
|
/** Detail width: `compact` (20rem) or `comfortable` (25rem). */
|
|
76
82
|
this.detailWidth = "compact";
|
|
83
|
+
/** Skips rendering the built-in topbar row and its nav toggle entirely, for consumers with their own external top bar. The `[`/Escape shortcuts stay active regardless — this only affects what's rendered. */
|
|
84
|
+
this.noTopbar = false;
|
|
77
85
|
/** Whether the viewport is at/below the 48rem breakpoint. */
|
|
78
86
|
this._mobile = false;
|
|
79
87
|
/** Whether the footer slot has assigned content. */
|
|
@@ -131,6 +139,14 @@ let AppShell = class AppShell extends LitElement {
|
|
|
131
139
|
min-height: 0;
|
|
132
140
|
background: var(--ui-surface, #ffffff);
|
|
133
141
|
}
|
|
142
|
+
/* no-topbar drops the topbar row from the grid rather than rendering
|
|
143
|
+
an empty one — the header element itself is skipped in render(). */
|
|
144
|
+
:host([no-topbar]) .shell {
|
|
145
|
+
grid-template-rows: minmax(0, 1fr) auto;
|
|
146
|
+
grid-template-areas:
|
|
147
|
+
"sidebar main detail"
|
|
148
|
+
"sidebar footer footer";
|
|
149
|
+
}
|
|
134
150
|
:host([detail-open]) .shell {
|
|
135
151
|
--_detail-w: 20rem;
|
|
136
152
|
}
|
|
@@ -300,9 +316,18 @@ let AppShell = class AppShell extends LitElement {
|
|
|
300
316
|
"main detail"
|
|
301
317
|
"footer footer";
|
|
302
318
|
}
|
|
319
|
+
:host([no-topbar]) .shell {
|
|
320
|
+
grid-template-rows: minmax(0, 1fr) auto;
|
|
321
|
+
grid-template-areas:
|
|
322
|
+
"main detail"
|
|
323
|
+
"footer footer";
|
|
324
|
+
}
|
|
303
325
|
/* Mobile is always a full-screen, position:absolute overlay drawer,
|
|
304
326
|
regardless of sidebar-mode/sidebar-width — those two properties
|
|
305
|
-
only affect the desktop presentation.
|
|
327
|
+
only affect the desktop presentation. A full-width sidebar sits
|
|
328
|
+
above .scrim (z-index 40 vs 39), so .scrim's click target is only
|
|
329
|
+
reachable on desktop, where the sidebar doesn't span the whole
|
|
330
|
+
shell — Escape is the mobile dismiss path (see app-shell.spec.ts). */
|
|
306
331
|
.sidebar,
|
|
307
332
|
:host([sidebar-mode="push"]) .sidebar {
|
|
308
333
|
position: absolute;
|
|
@@ -436,26 +461,30 @@ let AppShell = class AppShell extends LitElement {
|
|
|
436
461
|
>
|
|
437
462
|
<slot name="sidebar" @slotchange=${this._syncSidebarWidth}></slot>
|
|
438
463
|
</aside>
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
class="
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
464
|
+
${this.noTopbar
|
|
465
|
+
? nothing
|
|
466
|
+
: html `
|
|
467
|
+
<header class="topbar">
|
|
468
|
+
<div class="nav-group">
|
|
469
|
+
<button
|
|
470
|
+
class="nav-toggle"
|
|
471
|
+
type="button"
|
|
472
|
+
aria-label="Toggle navigation"
|
|
473
|
+
aria-keyshortcuts="["
|
|
474
|
+
aria-describedby="nav-tip"
|
|
475
|
+
aria-expanded=${String(this.sidebarOpen)}
|
|
476
|
+
@click=${this._toggleSidebar}
|
|
477
|
+
>
|
|
478
|
+
${iconBars3(18)}
|
|
479
|
+
</button>
|
|
480
|
+
<span class="nav-tip" id="nav-tip" role="tooltip">
|
|
481
|
+
<span>${this.sidebarOpen ? "Hide navigation" : "Show navigation"}</span>
|
|
482
|
+
<kbd-hint keys="["></kbd-hint>
|
|
483
|
+
</span>
|
|
484
|
+
</div>
|
|
485
|
+
<div class="topbar-content"><slot name="topbar"></slot></div>
|
|
486
|
+
</header>
|
|
487
|
+
`}
|
|
459
488
|
<main class="main"><slot></slot></main>
|
|
460
489
|
<aside
|
|
461
490
|
class="detail"
|
|
@@ -499,6 +528,9 @@ __decorate([
|
|
|
499
528
|
__decorate([
|
|
500
529
|
property({ attribute: "detail-width" })
|
|
501
530
|
], AppShell.prototype, "detailWidth", void 0);
|
|
531
|
+
__decorate([
|
|
532
|
+
property({ type: Boolean, reflect: true, attribute: "no-topbar" })
|
|
533
|
+
], AppShell.prototype, "noTopbar", void 0);
|
|
502
534
|
__decorate([
|
|
503
535
|
state()
|
|
504
536
|
], AppShell.prototype, "_mobile", void 0);
|
package/dist/app-shell.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-shell.js","sourceRoot":"","sources":["../src/app-sh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AI,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;4CAAoB;AAEhD;IAAxC,QAAQ,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,CAAC;6CAAoD;AAG3E;IAAhB,KAAK,EAAE;yCAAyB;AAEhB;IAAhB,KAAK,EAAE;4CAA4B;AAfzB,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA6apB","sourcesContent":["import { LitElement, css, html, type PropertyValues } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { iconBars3 } from \"./icons.js\";\nimport \"./kbd-hint.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** Fired when the built-in toggle changes the sidebar state. */\nexport interface SidebarToggleDetail {\n /** Whether the sidebar is now open. */\n open: boolean;\n}\n\n/**\n * The dashboard page shell: a slot-based CSS-grid backbone that arranges a\n * top bar, the main content, an optional right-hand detail column, an\n * optional footer, and a sidebar. The top bar always spans the shell's full\n * width, in every sidebar state.\n *\n * The sidebar's visibility, width, and layout mode are three independent\n * properties:\n * - `sidebar-open` (default closed) — whether it's shown at all.\n * - `sidebar-width`: `\"full\"` (16rem, icons + labels, the default) or\n * `\"icon\"` (3.5rem rail, icons only — drives the slotted `app-sidebar`'s\n * own `collapsed` attribute).\n * - `sidebar-mode`: `\"overlay\"` (the default) floats the sidebar above the\n * shell's own content with a higher z-index, covering part of the top\n * bar's corner and whatever content sits beneath it, without ever\n * resizing or reflowing `main`/`footer`. `\"push\"` instead reserves a real\n * grid column beside `main`/`footer` (which resize to make room) — the\n * top bar still spans full width above it either way.\n *\n * Below the shared 48rem breakpoint the sidebar always behaves as a\n * full-width, modal, scrim/Escape-dismissible drawer regardless of\n * `sidebar-mode`/`sidebar-width` — those two properties only affect the\n * desktop presentation. Above 48rem, an `overlay`-mode sidebar is a\n * non-modal panel (no dimming scrim, no Escape-dismiss, since it reads as\n * an ordinary always-interactive panel rather than a blocking dialog); a\n * `push`-mode sidebar is even more clearly non-modal, since it never\n * covers anything.\n *\n * The right-hand detail column is unaffected by any of the above: it still\n * reserves an inline grid column on desktop and becomes a dismissible\n * overlay (scrim/Escape) on mobile.\n *\n * Widths are tunable per instance via `--component-sidebar-width` (16rem),\n * `--component-sidebar-rail-width` (3.5rem), and `--component-topbar-height`\n * (3rem); the detail column reuses the 20rem/25rem panel widths. The main\n * content area is white by default — override it with\n * `--component-main-background`. Give the shell a height (e.g. `height:\n * 100vh`) so the sidebar and main can size and scroll.\n *\n * Hovering or keyboard-focusing the toggle reveals a tooltip naming the\n * action and its `[` shortcut — the shortcut is not shown as permanent\n * chrome.\n *\n * @element app-shell\n * @slot - Main content area.\n * @slot sidebar - Sidebar navigation (typically `app-sidebar`).\n * @slot topbar - Top bar content, right of the built-in toggle.\n * @slot detail - Optional right-hand detail; shown when `detail-open` is set.\n * @slot footer - Optional footer beneath the main content.\n * @fires sidebar-toggle - The built-in toggle changed the sidebar state.\n * @fires detail-close - The scrim or Escape dismissed the mobile detail overlay.\n */\n@customElement(\"app-shell\")\nexport class AppShell extends LitElement {\n /** Whether the sidebar is open. Closed by default at every breakpoint. */\n @property({ type: Boolean, reflect: true, attribute: \"sidebar-open\" }) sidebarOpen = false;\n /** `\"overlay\"` (default) floats the sidebar above content; `\"push\"` reserves a grid column instead. */\n @property({ reflect: true, attribute: \"sidebar-mode\" }) sidebarMode: \"overlay\" | \"push\" = \"overlay\";\n /** Sidebar width when open: `\"full\"` (16rem, icons + labels) or `\"icon\"` (3.5rem rail, icons only). */\n @property({ reflect: true, attribute: \"sidebar-width\" }) sidebarWidth: \"full\" | \"icon\" = \"full\";\n /** Shows the right-hand detail region (inline column, or overlay on mobile). */\n @property({ type: Boolean, reflect: true, attribute: \"detail-open\" }) detailOpen = false;\n /** Detail width: `compact` (20rem) or `comfortable` (25rem). */\n @property({ attribute: \"detail-width\" }) detailWidth: \"compact\" | \"comfortable\" = \"compact\";\n\n /** Whether the viewport is at/below the 48rem breakpoint. */\n @state() private _mobile = false;\n /** Whether the footer slot has assigned content. */\n @state() private _hasFooter = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n block-size: 100%;\n }\n .shell {\n --_sidebar-w: 0px;\n --_detail-w: 0px;\n display: grid;\n grid-template-columns: var(--_sidebar-w) minmax(0, 1fr) var(--_detail-w);\n grid-template-rows: auto minmax(0, 1fr) auto;\n grid-template-areas:\n \"topbar topbar topbar\"\n \"sidebar main detail\"\n \"sidebar footer footer\";\n position: relative;\n block-size: 100%;\n min-height: 0;\n background: var(--ui-surface, #ffffff);\n }\n :host([detail-open]) .shell {\n --_detail-w: 20rem;\n }\n :host([detail-open][detail-width=\"comfortable\"]) .shell {\n --_detail-w: 25rem;\n }\n /* Push mode reserves a real grid column, sized only while open — the\n column width doesn't animate (custom properties feeding a grid\n track don't transition smoothly without @property registration),\n so push mode's open/close is an instant snap, unlike overlay\n mode's sliding transform. */\n :host([sidebar-mode=\"push\"][sidebar-open]) .shell {\n --_sidebar-w: var(--component-sidebar-width, 16rem);\n }\n :host([sidebar-mode=\"push\"][sidebar-open][sidebar-width=\"icon\"]) .shell {\n --_sidebar-w: var(--component-sidebar-rail-width, 3.5rem);\n }\n .sidebar {\n /* No grid-area here: an absolutely-positioned grid item's inset\n properties resolve against its OWN grid area's box, not the\n whole grid container, once grid-area is set — even with\n explicit (non-auto) insets. Overlay mode must stay anchored to\n the whole .shell (to overlap the topbar row), so grid-area is\n assigned only in push mode below, where the sidebar is a real,\n in-flow grid item instead of an absolutely-positioned one. */\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: var(--component-sidebar-width, 16rem);\n z-index: 40;\n overflow: hidden;\n border-right: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n transform: translateX(-100%);\n transition: transform 150ms ease;\n }\n :host([sidebar-open]) .sidebar {\n transform: translateX(0);\n }\n :host([sidebar-open]:not([sidebar-mode=\"push\"])) .sidebar {\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n }\n :host([sidebar-width=\"icon\"]) .sidebar {\n width: var(--component-sidebar-rail-width, 3.5rem);\n }\n :host([sidebar-mode=\"push\"]) .sidebar {\n grid-area: sidebar;\n position: static;\n width: 100%;\n transform: none;\n }\n .topbar {\n grid-area: topbar;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-height: var(--component-topbar-height, 3rem);\n padding: 0.5rem 0.75rem;\n border-bottom: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n /* Deliberately no z-index here: an explicit z-index on a CSS grid\n item creates a stacking context, which would trap .nav-toggle\n below .sidebar once an overlay-mode sidebar opens and covers this\n corner. See CLAUDE.md before adding one. */\n }\n .nav-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n width: 2rem;\n height: 2rem;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--ui-text-muted, #64748b);\n border-radius: var(--ui-radius-sm, 0.25rem);\n }\n .nav-group {\n position: relative;\n z-index: 41;\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n flex: 0 0 auto;\n }\n .nav-tip {\n position: absolute;\n top: 100%;\n left: 0;\n margin-top: 0.25rem;\n z-index: 10;\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n white-space: nowrap;\n padding: 0.25rem 0.5rem;\n border-radius: var(--ui-radius-sm, 0.25rem);\n background: var(--ui-tooltip, #0f172a);\n color: var(--ui-on-accent, #ffffff);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n opacity: 0;\n visibility: hidden;\n pointer-events: none;\n transition: opacity 120ms ease;\n }\n .nav-toggle:hover + .nav-tip,\n .nav-toggle:focus-visible + .nav-tip {\n opacity: 1;\n visibility: visible;\n }\n .nav-toggle:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .nav-toggle:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .topbar-content {\n flex: 1 1 auto;\n min-width: 0;\n }\n .main {\n grid-area: main;\n min-height: 0;\n min-width: 0;\n overflow: auto;\n padding: 1rem;\n background: var(--component-main-background, var(--ui-surface, #ffffff));\n }\n .detail {\n grid-area: detail;\n display: none;\n min-height: 0;\n overflow: auto;\n border-left: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n }\n :host([detail-open]) .detail {\n display: block;\n }\n .footer {\n grid-area: footer;\n padding: 0.5rem 0.75rem;\n border-top: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n }\n .footer.empty {\n display: none;\n }\n .scrim {\n display: none;\n }\n @media (max-width: 48rem) {\n .shell {\n grid-template-columns: minmax(0, 1fr) var(--_detail-w);\n grid-template-areas:\n \"topbar topbar\"\n \"main detail\"\n \"footer footer\";\n }\n /* Mobile is always a full-screen, position:absolute overlay drawer,\n regardless of sidebar-mode/sidebar-width — those two properties\n only affect the desktop presentation. */\n .sidebar,\n :host([sidebar-mode=\"push\"]) .sidebar {\n position: absolute;\n width: 100%;\n }\n .detail {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n width: var(--_detail-w, 20rem);\n max-width: calc(100vw - 3rem);\n z-index: 40;\n transform: translateX(110%);\n transition: transform 250ms ease;\n }\n :host([detail-open]) .detail {\n transform: translateX(0);\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n }\n .scrim.show {\n display: block;\n position: absolute;\n inset: 0;\n z-index: 39;\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n border: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .sidebar,\n .detail,\n .nav-tip {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n .nav-toggle:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .nav-tip {\n border: 1px solid CanvasText;\n }\n }\n `,\n ];\n\n private _mediaQuery: MediaQueryList | null = null;\n private _previousFocus: HTMLElement | null = null;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._mediaQuery = window.matchMedia(\"(max-width: 48rem)\");\n this._mobile = this._mediaQuery.matches;\n this._mediaQuery.addEventListener(\"change\", this._onMediaChange);\n window.addEventListener(\"keydown\", this._onKeydown);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._mediaQuery?.removeEventListener(\"change\", this._onMediaChange);\n this._mediaQuery = null;\n window.removeEventListener(\"keydown\", this._onKeydown);\n }\n\n /** Tracks the breakpoint the sidebar's width and modality depend on. */\n private _onMediaChange = (event: MediaQueryListEvent): void => {\n this._mobile = event.matches;\n };\n\n /** Handles the `[` sidebar shortcut and Escape dismissal of mobile overlays. */\n private _onKeydown = (event: KeyboardEvent): void => {\n if (event.defaultPrevented) return;\n if (event.key === \"Escape\" && this._mobile) {\n if (this.detailOpen) {\n event.preventDefault();\n this._closeDetail();\n } else if (this.sidebarOpen) {\n event.preventDefault();\n this.sidebarOpen = false;\n }\n return;\n }\n if (\n event.key === \"[\" &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.altKey &&\n !this._isEditableTarget(event)\n ) {\n event.preventDefault();\n this._toggleSidebar();\n }\n };\n\n /** Whether the keydown originated in a text field, so the shortcut defers to typing. */\n private _isEditableTarget(event: KeyboardEvent): boolean {\n const target = event.composedPath()[0] as HTMLElement | undefined;\n if (!target) return false;\n if (target.isContentEditable) return true;\n const tag = target.tagName;\n return tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\";\n }\n\n /** Toggles the sidebar and announces it. */\n private _toggleSidebar(): void {\n this.sidebarOpen = !this.sidebarOpen;\n if (this._mobile && this.sidebarOpen) {\n this._previousFocus = document.activeElement as HTMLElement | null;\n }\n this.dispatchEvent(\n new CustomEvent<SidebarToggleDetail>(\"sidebar-toggle\", {\n detail: { open: this.sidebarOpen },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n /** Closes the detail overlay and notifies the consumer that owns `detail-open`. */\n private _closeDetail(): void {\n this.detailOpen = false;\n this.dispatchEvent(new CustomEvent(\"detail-close\", { bubbles: true, composed: true }));\n }\n\n /** Scrim click dismisses whichever overlay is open. */\n private _onScrim(): void {\n if (this.detailOpen) this._closeDetail();\n if (this.sidebarOpen) this.sidebarOpen = false;\n }\n\n /** Mirrors `sidebar-width` onto the slotted sidebar's `collapsed` (icon rail) attribute. */\n private _syncSidebarWidth(): void {\n const icon = this.sidebarWidth === \"icon\";\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"sidebar\"]');\n for (const element of slot?.assignedElements() ?? []) {\n element.toggleAttribute(\"collapsed\", icon);\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(\"sidebarWidth\")) this._syncSidebarWidth();\n if (!changed.has(\"sidebarOpen\") || !this._mobile) return;\n if (this.sidebarOpen) {\n this.shadowRoot?.querySelector<HTMLElement>(\".sidebar\")?.focus();\n return;\n }\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n }\n\n override render() {\n const scrimActive = this._mobile && (this.sidebarOpen || this.detailOpen);\n return html`\n <div class=\"shell\">\n <aside\n class=\"sidebar\"\n tabindex=\"-1\"\n aria-label=\"Primary\"\n ?inert=${!this.sidebarOpen}\n aria-hidden=${String(!this.sidebarOpen)}\n >\n <slot name=\"sidebar\" @slotchange=${this._syncSidebarWidth}></slot>\n </aside>\n <header class=\"topbar\">\n <div class=\"nav-group\">\n <button\n class=\"nav-toggle\"\n type=\"button\"\n aria-label=\"Toggle navigation\"\n aria-keyshortcuts=\"[\"\n aria-describedby=\"nav-tip\"\n aria-expanded=${String(this.sidebarOpen)}\n @click=${this._toggleSidebar}\n >\n ${iconBars3(18)}\n </button>\n <span class=\"nav-tip\" id=\"nav-tip\" role=\"tooltip\">\n <span>${this.sidebarOpen ? \"Hide navigation\" : \"Show navigation\"}</span>\n <kbd-hint keys=\"[\"></kbd-hint>\n </span>\n </div>\n <div class=\"topbar-content\"><slot name=\"topbar\"></slot></div>\n </header>\n <main class=\"main\"><slot></slot></main>\n <aside\n class=\"detail\"\n aria-label=\"Detail\"\n ?inert=${!this.detailOpen}\n aria-hidden=${String(!this.detailOpen)}\n >\n <slot name=\"detail\"></slot>\n </aside>\n <footer class=\"footer ${this._hasFooter ? \"\" : \"empty\"}\">\n <slot name=\"footer\" @slotchange=${this._onFooterSlotChange}></slot>\n </footer>\n <button\n class=\"scrim ${scrimActive ? \"show\" : \"\"}\"\n type=\"button\"\n tabindex=\"-1\"\n aria-label=\"Close\"\n @click=${this._onScrim}\n ?hidden=${!scrimActive}\n ></button>\n </div>\n `;\n }\n\n /** Collapses the footer row when nothing is slotted into it. */\n private _onFooterSlotChange(event: Event): void {\n this._hasFooter = (event.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"app-shell\": AppShell;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"app-shell.js","sourceRoot":"","sources":["../src/app-shell.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAQrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyDG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS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KAAK,EAAE;yCAAyB;AAEhB;IAAhB,KAAK,EAAE;4CAA4B;AAjBzB,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAocpB","sourcesContent":["import { LitElement, css, html, nothing, type PropertyValues } from \"lit\";\nimport { customElement, property, state } from \"lit/decorators.js\";\nimport { iconBars3 } from \"./icons.js\";\nimport \"./kbd-hint.js\";\nimport { tokens } from \"./tokens.js\";\n\n/** Fired when the built-in toggle changes the sidebar state. */\nexport interface SidebarToggleDetail {\n /** Whether the sidebar is now open. */\n open: boolean;\n}\n\n/**\n * The dashboard page shell: a slot-based CSS-grid backbone that arranges a\n * top bar, the main content, an optional right-hand detail column, an\n * optional footer, and a sidebar. The top bar always spans the shell's full\n * width, in every sidebar state.\n *\n * The sidebar's visibility, width, and layout mode are three independent\n * properties:\n * - `sidebar-open` (default closed) — whether it's shown at all.\n * - `sidebar-width`: `\"full\"` (16rem, icons + labels, the default) or\n * `\"icon\"` (3.5rem rail, icons only — drives the slotted `app-sidebar`'s\n * own `collapsed` attribute).\n * - `sidebar-mode`: `\"overlay\"` (the default) floats the sidebar above the\n * shell's own content with a higher z-index, covering part of the top\n * bar's corner and whatever content sits beneath it, without ever\n * resizing or reflowing `main`/`footer`. `\"push\"` instead reserves a real\n * grid column beside `main`/`footer` (which resize to make room) — the\n * top bar still spans full width above it either way.\n *\n * Below the shared 48rem breakpoint the sidebar always behaves as a\n * full-width, modal, scrim/Escape-dismissible drawer regardless of\n * `sidebar-mode`/`sidebar-width` — those two properties only affect the\n * desktop presentation. Above 48rem, an `overlay`-mode sidebar is a\n * non-modal panel (no dimming scrim, no Escape-dismiss, since it reads as\n * an ordinary always-interactive panel rather than a blocking dialog); a\n * `push`-mode sidebar is even more clearly non-modal, since it never\n * covers anything.\n *\n * The right-hand detail column is unaffected by any of the above: it still\n * reserves an inline grid column on desktop and becomes a dismissible\n * overlay (scrim/Escape) on mobile.\n *\n * Widths are tunable per instance via `--component-sidebar-width` (16rem),\n * `--component-sidebar-rail-width` (3.5rem), and `--component-topbar-height`\n * (3rem); the detail column reuses the 20rem/25rem panel widths. The main\n * content area is white by default — override it with\n * `--component-main-background`. Give the shell a height (e.g. `height:\n * 100vh`) so the sidebar and main can size and scroll.\n *\n * Hovering or keyboard-focusing the toggle reveals a tooltip naming the\n * action and its `[` shortcut — the shortcut is not shown as permanent\n * chrome.\n *\n * Consumers with their own external top bar can set `no-topbar` to skip\n * rendering the built-in topbar row and toggle button entirely (the grid\n * drops that row rather than leaving dead space). The `[`/Escape shortcuts\n * stay fully active either way — drive `sidebar-open` from your own UI and\n * listen for `sidebar-toggle` to stay in sync with keyboard-driven changes.\n *\n * @element app-shell\n * @slot - Main content area.\n * @slot sidebar - Sidebar navigation (typically `app-sidebar`).\n * @slot topbar - Top bar content, right of the built-in toggle.\n * @slot detail - Optional right-hand detail; shown when `detail-open` is set.\n * @slot footer - Optional footer beneath the main content.\n * @fires sidebar-toggle - The built-in toggle changed the sidebar state.\n * @fires detail-close - The scrim or Escape dismissed the mobile detail overlay.\n */\n@customElement(\"app-shell\")\nexport class AppShell extends LitElement {\n /** Whether the sidebar is open. Closed by default at every breakpoint. */\n @property({ type: Boolean, reflect: true, attribute: \"sidebar-open\" }) sidebarOpen = false;\n /** `\"overlay\"` (default) floats the sidebar above content; `\"push\"` reserves a grid column instead. */\n @property({ reflect: true, attribute: \"sidebar-mode\" }) sidebarMode: \"overlay\" | \"push\" = \"overlay\";\n /** Sidebar width when open: `\"full\"` (16rem, icons + labels) or `\"icon\"` (3.5rem rail, icons only). */\n @property({ reflect: true, attribute: \"sidebar-width\" }) sidebarWidth: \"full\" | \"icon\" = \"full\";\n /** Shows the right-hand detail region (inline column, or overlay on mobile). */\n @property({ type: Boolean, reflect: true, attribute: \"detail-open\" }) detailOpen = false;\n /** Detail width: `compact` (20rem) or `comfortable` (25rem). */\n @property({ attribute: \"detail-width\" }) detailWidth: \"compact\" | \"comfortable\" = \"compact\";\n /** Skips rendering the built-in topbar row and its nav toggle entirely, for consumers with their own external top bar. The `[`/Escape shortcuts stay active regardless — this only affects what's rendered. */\n @property({ type: Boolean, reflect: true, attribute: \"no-topbar\" }) noTopbar = false;\n\n /** Whether the viewport is at/below the 48rem breakpoint. */\n @state() private _mobile = false;\n /** Whether the footer slot has assigned content. */\n @state() private _hasFooter = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: block;\n block-size: 100%;\n }\n .shell {\n --_sidebar-w: 0px;\n --_detail-w: 0px;\n display: grid;\n grid-template-columns: var(--_sidebar-w) minmax(0, 1fr) var(--_detail-w);\n grid-template-rows: auto minmax(0, 1fr) auto;\n grid-template-areas:\n \"topbar topbar topbar\"\n \"sidebar main detail\"\n \"sidebar footer footer\";\n position: relative;\n block-size: 100%;\n min-height: 0;\n background: var(--ui-surface, #ffffff);\n }\n /* no-topbar drops the topbar row from the grid rather than rendering\n an empty one — the header element itself is skipped in render(). */\n :host([no-topbar]) .shell {\n grid-template-rows: minmax(0, 1fr) auto;\n grid-template-areas:\n \"sidebar main detail\"\n \"sidebar footer footer\";\n }\n :host([detail-open]) .shell {\n --_detail-w: 20rem;\n }\n :host([detail-open][detail-width=\"comfortable\"]) .shell {\n --_detail-w: 25rem;\n }\n /* Push mode reserves a real grid column, sized only while open — the\n column width doesn't animate (custom properties feeding a grid\n track don't transition smoothly without @property registration),\n so push mode's open/close is an instant snap, unlike overlay\n mode's sliding transform. */\n :host([sidebar-mode=\"push\"][sidebar-open]) .shell {\n --_sidebar-w: var(--component-sidebar-width, 16rem);\n }\n :host([sidebar-mode=\"push\"][sidebar-open][sidebar-width=\"icon\"]) .shell {\n --_sidebar-w: var(--component-sidebar-rail-width, 3.5rem);\n }\n .sidebar {\n /* No grid-area here: an absolutely-positioned grid item's inset\n properties resolve against its OWN grid area's box, not the\n whole grid container, once grid-area is set — even with\n explicit (non-auto) insets. Overlay mode must stay anchored to\n the whole .shell (to overlap the topbar row), so grid-area is\n assigned only in push mode below, where the sidebar is a real,\n in-flow grid item instead of an absolutely-positioned one. */\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n width: var(--component-sidebar-width, 16rem);\n z-index: 40;\n overflow: hidden;\n border-right: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n transform: translateX(-100%);\n transition: transform 150ms ease;\n }\n :host([sidebar-open]) .sidebar {\n transform: translateX(0);\n }\n :host([sidebar-open]:not([sidebar-mode=\"push\"])) .sidebar {\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n }\n :host([sidebar-width=\"icon\"]) .sidebar {\n width: var(--component-sidebar-rail-width, 3.5rem);\n }\n :host([sidebar-mode=\"push\"]) .sidebar {\n grid-area: sidebar;\n position: static;\n width: 100%;\n transform: none;\n }\n .topbar {\n grid-area: topbar;\n display: flex;\n align-items: center;\n gap: 0.5rem;\n min-height: var(--component-topbar-height, 3rem);\n padding: 0.5rem 0.75rem;\n border-bottom: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n /* Deliberately no z-index here: an explicit z-index on a CSS grid\n item creates a stacking context, which would trap .nav-toggle\n below .sidebar once an overlay-mode sidebar opens and covers this\n corner. See CLAUDE.md before adding one. */\n }\n .nav-toggle {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n flex: 0 0 auto;\n width: 2rem;\n height: 2rem;\n padding: 0;\n background: none;\n border: none;\n cursor: pointer;\n color: var(--ui-text-muted, #64748b);\n border-radius: var(--ui-radius-sm, 0.25rem);\n }\n .nav-group {\n position: relative;\n z-index: 41;\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n flex: 0 0 auto;\n }\n .nav-tip {\n position: absolute;\n top: 100%;\n left: 0;\n margin-top: 0.25rem;\n z-index: 10;\n display: inline-flex;\n align-items: center;\n gap: 0.25rem;\n white-space: nowrap;\n padding: 0.25rem 0.5rem;\n border-radius: var(--ui-radius-sm, 0.25rem);\n background: var(--ui-tooltip, #0f172a);\n color: var(--ui-on-accent, #ffffff);\n box-shadow: var(--ui-shadow, 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1));\n font-size: var(--ui-font-size-sm, 0.75rem);\n line-height: var(--ui-line-height-tight, 1.25);\n opacity: 0;\n visibility: hidden;\n pointer-events: none;\n transition: opacity 120ms ease;\n }\n .nav-toggle:hover + .nav-tip,\n .nav-toggle:focus-visible + .nav-tip {\n opacity: 1;\n visibility: visible;\n }\n .nav-toggle:hover {\n background: var(--ui-surface-muted, #f8fafc);\n }\n .nav-toggle:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .topbar-content {\n flex: 1 1 auto;\n min-width: 0;\n }\n .main {\n grid-area: main;\n min-height: 0;\n min-width: 0;\n overflow: auto;\n padding: 1rem;\n background: var(--component-main-background, var(--ui-surface, #ffffff));\n }\n .detail {\n grid-area: detail;\n display: none;\n min-height: 0;\n overflow: auto;\n border-left: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n }\n :host([detail-open]) .detail {\n display: block;\n }\n .footer {\n grid-area: footer;\n padding: 0.5rem 0.75rem;\n border-top: 1px solid var(--ui-border, #e2e8f0);\n background: var(--ui-surface, #ffffff);\n }\n .footer.empty {\n display: none;\n }\n .scrim {\n display: none;\n }\n @media (max-width: 48rem) {\n .shell {\n grid-template-columns: minmax(0, 1fr) var(--_detail-w);\n grid-template-areas:\n \"topbar topbar\"\n \"main detail\"\n \"footer footer\";\n }\n :host([no-topbar]) .shell {\n grid-template-rows: minmax(0, 1fr) auto;\n grid-template-areas:\n \"main detail\"\n \"footer footer\";\n }\n /* Mobile is always a full-screen, position:absolute overlay drawer,\n regardless of sidebar-mode/sidebar-width — those two properties\n only affect the desktop presentation. A full-width sidebar sits\n above .scrim (z-index 40 vs 39), so .scrim's click target is only\n reachable on desktop, where the sidebar doesn't span the whole\n shell — Escape is the mobile dismiss path (see app-shell.spec.ts). */\n .sidebar,\n :host([sidebar-mode=\"push\"]) .sidebar {\n position: absolute;\n width: 100%;\n }\n .detail {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n width: var(--_detail-w, 20rem);\n max-width: calc(100vw - 3rem);\n z-index: 40;\n transform: translateX(110%);\n transition: transform 250ms ease;\n }\n :host([detail-open]) .detail {\n transform: translateX(0);\n box-shadow: var(\n --ui-shadow-lg,\n 0 20px 25px -5px rgb(0 0 0 / 0.1),\n 0 8px 10px -6px rgb(0 0 0 / 0.1)\n );\n }\n .scrim.show {\n display: block;\n position: absolute;\n inset: 0;\n z-index: 39;\n background: var(--ui-overlay, rgb(15 23 42 / 0.45));\n border: none;\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .sidebar,\n .detail,\n .nav-tip {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n .nav-toggle:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .nav-tip {\n border: 1px solid CanvasText;\n }\n }\n `,\n ];\n\n private _mediaQuery: MediaQueryList | null = null;\n private _previousFocus: HTMLElement | null = null;\n\n override connectedCallback(): void {\n super.connectedCallback();\n this._mediaQuery = window.matchMedia(\"(max-width: 48rem)\");\n this._mobile = this._mediaQuery.matches;\n this._mediaQuery.addEventListener(\"change\", this._onMediaChange);\n window.addEventListener(\"keydown\", this._onKeydown);\n }\n\n override disconnectedCallback(): void {\n super.disconnectedCallback();\n this._mediaQuery?.removeEventListener(\"change\", this._onMediaChange);\n this._mediaQuery = null;\n window.removeEventListener(\"keydown\", this._onKeydown);\n }\n\n /** Tracks the breakpoint the sidebar's width and modality depend on. */\n private _onMediaChange = (event: MediaQueryListEvent): void => {\n this._mobile = event.matches;\n };\n\n /** Handles the `[` sidebar shortcut and Escape dismissal of mobile overlays. */\n private _onKeydown = (event: KeyboardEvent): void => {\n if (event.defaultPrevented) return;\n if (event.key === \"Escape\" && this._mobile) {\n if (this.detailOpen) {\n event.preventDefault();\n this._closeDetail();\n } else if (this.sidebarOpen) {\n event.preventDefault();\n this.sidebarOpen = false;\n }\n return;\n }\n if (\n event.key === \"[\" &&\n !event.ctrlKey &&\n !event.metaKey &&\n !event.altKey &&\n !this._isEditableTarget(event)\n ) {\n event.preventDefault();\n this._toggleSidebar();\n }\n };\n\n /** Whether the keydown originated in a text field, so the shortcut defers to typing. */\n private _isEditableTarget(event: KeyboardEvent): boolean {\n const target = event.composedPath()[0] as HTMLElement | undefined;\n if (!target) return false;\n if (target.isContentEditable) return true;\n const tag = target.tagName;\n return tag === \"INPUT\" || tag === \"TEXTAREA\" || tag === \"SELECT\";\n }\n\n /** Toggles the sidebar and announces it. */\n private _toggleSidebar(): void {\n this.sidebarOpen = !this.sidebarOpen;\n if (this._mobile && this.sidebarOpen) {\n this._previousFocus = document.activeElement as HTMLElement | null;\n }\n this.dispatchEvent(\n new CustomEvent<SidebarToggleDetail>(\"sidebar-toggle\", {\n detail: { open: this.sidebarOpen },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n /** Closes the detail overlay and notifies the consumer that owns `detail-open`. */\n private _closeDetail(): void {\n this.detailOpen = false;\n this.dispatchEvent(new CustomEvent(\"detail-close\", { bubbles: true, composed: true }));\n }\n\n /** Scrim click dismisses whichever overlay is open. */\n private _onScrim(): void {\n if (this.detailOpen) this._closeDetail();\n if (this.sidebarOpen) this.sidebarOpen = false;\n }\n\n /** Mirrors `sidebar-width` onto the slotted sidebar's `collapsed` (icon rail) attribute. */\n private _syncSidebarWidth(): void {\n const icon = this.sidebarWidth === \"icon\";\n const slot = this.shadowRoot?.querySelector<HTMLSlotElement>('slot[name=\"sidebar\"]');\n for (const element of slot?.assignedElements() ?? []) {\n element.toggleAttribute(\"collapsed\", icon);\n }\n }\n\n protected override updated(changed: PropertyValues): void {\n if (changed.has(\"sidebarWidth\")) this._syncSidebarWidth();\n if (!changed.has(\"sidebarOpen\") || !this._mobile) return;\n if (this.sidebarOpen) {\n this.shadowRoot?.querySelector<HTMLElement>(\".sidebar\")?.focus();\n return;\n }\n if (this._previousFocus?.isConnected) this._previousFocus.focus();\n this._previousFocus = null;\n }\n\n override render() {\n const scrimActive = this._mobile && (this.sidebarOpen || this.detailOpen);\n return html`\n <div class=\"shell\">\n <aside\n class=\"sidebar\"\n tabindex=\"-1\"\n aria-label=\"Primary\"\n ?inert=${!this.sidebarOpen}\n aria-hidden=${String(!this.sidebarOpen)}\n >\n <slot name=\"sidebar\" @slotchange=${this._syncSidebarWidth}></slot>\n </aside>\n ${this.noTopbar\n ? nothing\n : html`\n <header class=\"topbar\">\n <div class=\"nav-group\">\n <button\n class=\"nav-toggle\"\n type=\"button\"\n aria-label=\"Toggle navigation\"\n aria-keyshortcuts=\"[\"\n aria-describedby=\"nav-tip\"\n aria-expanded=${String(this.sidebarOpen)}\n @click=${this._toggleSidebar}\n >\n ${iconBars3(18)}\n </button>\n <span class=\"nav-tip\" id=\"nav-tip\" role=\"tooltip\">\n <span>${this.sidebarOpen ? \"Hide navigation\" : \"Show navigation\"}</span>\n <kbd-hint keys=\"[\"></kbd-hint>\n </span>\n </div>\n <div class=\"topbar-content\"><slot name=\"topbar\"></slot></div>\n </header>\n `}\n <main class=\"main\"><slot></slot></main>\n <aside\n class=\"detail\"\n aria-label=\"Detail\"\n ?inert=${!this.detailOpen}\n aria-hidden=${String(!this.detailOpen)}\n >\n <slot name=\"detail\"></slot>\n </aside>\n <footer class=\"footer ${this._hasFooter ? \"\" : \"empty\"}\">\n <slot name=\"footer\" @slotchange=${this._onFooterSlotChange}></slot>\n </footer>\n <button\n class=\"scrim ${scrimActive ? \"show\" : \"\"}\"\n type=\"button\"\n tabindex=\"-1\"\n aria-label=\"Close\"\n @click=${this._onScrim}\n ?hidden=${!scrimActive}\n ></button>\n </div>\n `;\n }\n\n /** Collapses the footer row when nothing is slotted into it. */\n private _onFooterSlotChange(event: Event): void {\n this._hasFooter = (event.target as HTMLSlotElement).assignedNodes({ flatten: true }).length > 0;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"app-shell\": AppShell;\n }\n}\n"]}
|
package/dist/copy-link-button.js
CHANGED
|
@@ -6,7 +6,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { LitElement, css, html } from "lit";
|
|
8
8
|
import { customElement, property } from "lit/decorators.js";
|
|
9
|
-
import {
|
|
9
|
+
import { iconClipboard } from "./icons.js";
|
|
10
10
|
import { notifyError, notifySuccess } from "./toast-notification.js";
|
|
11
11
|
import { tokens } from "./tokens.js";
|
|
12
12
|
/**
|
|
@@ -97,7 +97,7 @@ let CopyLinkButton = class CopyLinkButton extends LitElement {
|
|
|
97
97
|
?disabled=${this.disabled}
|
|
98
98
|
@click=${this._onClick}
|
|
99
99
|
>
|
|
100
|
-
${
|
|
100
|
+
${iconClipboard(18)}
|
|
101
101
|
</button>
|
|
102
102
|
`;
|
|
103
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-link-button.js","sourceRoot":"","sources":["../src/copy-link-button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"copy-link-button.js","sourceRoot":"","sources":["../src/copy-link-button.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACrE,OAAO,EAAE,MAAM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ea;IAAX,QAAQ,EAAE;6CAAY;AAEX;IAAX,QAAQ,EAAE;6CAAqB;AAEH;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAkB;AANnC,cAAc;IAD1B,aAAa,CAAC,kBAAkB,CAAC;GACrB,cAAc,CA+E1B","sourcesContent":["import { LitElement, css, html } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconClipboard } from \"./icons.js\";\nimport { notifyError, notifySuccess } from \"./toast-notification.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * Small icon button that copies `value` to the clipboard and shows a toast\n * on success/failure (if a `<toast-notification>` element is present), and\n * always dispatches a `copy-success`/`copy-error` CustomEvent so consumers\n * without a toast element can react. Defaults to the current page URL if\n * `value` is unset.\n *\n * @element copy-link-button\n * @fires copy-success - The value was copied to the clipboard.\n * @fires copy-error - Copying to the clipboard failed.\n */\n@customElement(\"copy-link-button\")\nexport class CopyLinkButton extends LitElement {\n /** Text to copy. Defaults to `window.location.href` at click time. */\n @property() value = \"\";\n /** Accessible label / tooltip text. */\n @property() label = \"Copy link\";\n /** Disables clipboard copying. */\n @property({ type: Boolean }) disabled = false;\n\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-flex;\n }\n button {\n background: none;\n border: none;\n cursor: pointer;\n width: 2rem;\n height: 2rem;\n padding: 0;\n color: var(--ui-text-muted, #64748b);\n border-radius: var(--ui-radius-sm, 0.25rem);\n display: inline-flex;\n align-items: center;\n justify-content: center;\n }\n button:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n color: var(--ui-text, #0f172a);\n }\n button:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n button:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n @media (forced-colors: active) {\n button:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n button:disabled {\n color: GrayText;\n opacity: 1;\n }\n }\n `,\n ];\n\n private async _onClick() {\n if (this.disabled) return;\n const text = this.value || window.location.href;\n try {\n await navigator.clipboard.writeText(text);\n notifySuccess(\"Link copied to clipboard\");\n this.dispatchEvent(new CustomEvent(\"copy-success\", { bubbles: true, composed: true }));\n } catch {\n notifyError(\"Couldn't copy the link\");\n this.dispatchEvent(new CustomEvent(\"copy-error\", { bubbles: true, composed: true }));\n }\n }\n\n override render() {\n return html`\n <button\n type=\"button\"\n aria-label=${this.label}\n title=${this.label}\n ?disabled=${this.disabled}\n @click=${this._onClick}\n >\n ${iconClipboard(18)}\n </button>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"copy-link-button\": CopyLinkButton;\n }\n}\n"]}
|
|
@@ -3,6 +3,8 @@ import { LitElement, type PropertyValues, type TemplateResult } from "lit";
|
|
|
3
3
|
export interface DropdownOption {
|
|
4
4
|
value: string;
|
|
5
5
|
label: string;
|
|
6
|
+
/** Optional leading icon rendered ahead of the label in the menu item. */
|
|
7
|
+
icon?: TemplateResult | null;
|
|
6
8
|
/** Renders the item in the danger color, for a destructive action (e.g. Delete). */
|
|
7
9
|
danger?: boolean;
|
|
8
10
|
}
|
|
@@ -20,7 +22,10 @@ export type DropdownButtonVariant = "text" | "icon" | "text-icon";
|
|
|
20
22
|
* square, low-emphasis icon target in the style of `icon-button` — the
|
|
21
23
|
* classic "three-dot"/overflow menu, where `label` becomes the accessible
|
|
22
24
|
* name rather than visible text). Set `size="sm"` for a compact trigger one
|
|
23
|
-
* step below the default, matching `ui-button`'s `sm` size.
|
|
25
|
+
* step below the default, matching `ui-button`'s `sm` size. Set `circular`
|
|
26
|
+
* on the `icon` variant when the trigger wraps an inherently circular
|
|
27
|
+
* element (e.g. an avatar) so the hover/focus highlight matches its shape
|
|
28
|
+
* instead of the default rounded-square icon-button footprint.
|
|
24
29
|
*
|
|
25
30
|
* @element dropdown-button
|
|
26
31
|
* @fires select - Fired with `{ value: string }` when a menu item is picked.
|
|
@@ -40,6 +45,8 @@ export declare class DropdownButton extends LitElement {
|
|
|
40
45
|
icon: TemplateResult | null;
|
|
41
46
|
/** Size — `sm` reduces the trigger's height/padding/font-size one step below the default. */
|
|
42
47
|
size: "sm" | "md";
|
|
48
|
+
/** `icon` variant only: renders the trigger's highlight as a circle instead of a rounded square, to match a wrapped circular element (e.g. an avatar). */
|
|
49
|
+
circular: boolean;
|
|
43
50
|
private _open;
|
|
44
51
|
private _activeIndex;
|
|
45
52
|
disconnectedCallback(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dropdown-button.d.ts","sourceRoot":"","sources":["../src/dropdown-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAO/F,4BAA4B;AAC5B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,oFAAoF;IACpF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,+EAA+E;AAC/E,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;AAElE
|
|
1
|
+
{"version":3,"file":"dropdown-button.d.ts","sourceRoot":"","sources":["../src/dropdown-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAsB,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAO/F,4BAA4B;AAC5B,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,0EAA0E;IAC1E,IAAI,CAAC,EAAE,cAAc,GAAG,IAAI,CAAC;IAC7B,oFAAoF;IACpF,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,+EAA+E;AAC/E,MAAM,MAAM,qBAAqB,GAAG,MAAM,GAAG,MAAM,GAAG,WAAW,CAAC;AA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