@timmo001/groundwork-ui 0.9.11 → 0.9.12
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 +18 -2
- package/package.json +1 -1
- package/src/gw-page-header.ts +29 -2
- package/src/gw-segmented.ts +4 -1
package/custom-elements.json
CHANGED
|
@@ -13353,7 +13353,7 @@
|
|
|
13353
13353
|
"declarations": [
|
|
13354
13354
|
{
|
|
13355
13355
|
"kind": "class",
|
|
13356
|
-
"description": "A page's title, with an optional icon tile and description, and its
|
|
13356
|
+
"description": "A page's title, with an optional icon tile and description, a back button\nor similar in the `start` slot, and its controls at the top right in the\n`actions` slot.",
|
|
13357
13357
|
"name": "GwPageHeader",
|
|
13358
13358
|
"cssParts": [
|
|
13359
13359
|
{
|
|
@@ -13370,6 +13370,10 @@
|
|
|
13370
13370
|
}
|
|
13371
13371
|
],
|
|
13372
13372
|
"slots": [
|
|
13373
|
+
{
|
|
13374
|
+
"description": "Before the icon tile, such as a back button.",
|
|
13375
|
+
"name": "start"
|
|
13376
|
+
},
|
|
13373
13377
|
{
|
|
13374
13378
|
"description": "The page's controls.",
|
|
13375
13379
|
"name": "actions"
|
|
@@ -13396,7 +13400,7 @@
|
|
|
13396
13400
|
"text": "readonly CSSStyleSheet[]"
|
|
13397
13401
|
},
|
|
13398
13402
|
"static": true,
|
|
13399
|
-
"default": "[ base, css` :host { display: flex; gap: var(--gw-space-3); align-items: flex-start; } .tile { display: grid; flex: none; place-items: center; width: 3rem; height: 3rem; color: var(--gw-color-accent); background: var(--gw-color-fill-accent-quiet); border-radius: var(--gw-radius-l); --gw-icon-size: 1.625rem; } .titles { display: flex; flex: 1; flex-direction: column; gap: var(--gw-space-0-5); min-width: 0; } h1 { margin: 0; font-size: var(--gw-font-size-2xl); font-weight: var(--gw-font-weight-strong); line-height: 1.2; color: var(--gw-color-text-strong); } p { margin: 0; font-size: var(--gw-font-size-s); color: var(--gw-color-text-secondary); } .actions { display: flex; flex: none; gap: var(--gw-space-1); align-items: center; margin-inline-start: auto; } `, ]",
|
|
13403
|
+
"default": "[ base, css` :host { display: flex; gap: var(--gw-space-3); align-items: flex-start; } .start { display: flex; flex: none; align-items: center; min-height: 3rem; } .start[hidden] { display: none; } .tile { display: grid; flex: none; place-items: center; width: 3rem; height: 3rem; color: var(--gw-color-accent); background: var(--gw-color-fill-accent-quiet); border-radius: var(--gw-radius-l); --gw-icon-size: 1.625rem; } .titles { display: flex; flex: 1; flex-direction: column; gap: var(--gw-space-0-5); min-width: 0; } h1 { margin: 0; font-size: var(--gw-font-size-2xl); font-weight: var(--gw-font-weight-strong); line-height: 1.2; color: var(--gw-color-text-strong); } p { margin: 0; font-size: var(--gw-font-size-s); color: var(--gw-color-text-secondary); } .actions { display: flex; flex: none; gap: var(--gw-space-1); align-items: center; margin-inline-start: auto; } /* Centered on the tile when there is one */ .tile:not([hidden]) ~ .actions { min-height: 3rem; } `, ]",
|
|
13400
13404
|
"inheritedFrom": {
|
|
13401
13405
|
"name": "GwElement",
|
|
13402
13406
|
"module": "src/element.ts"
|
|
@@ -13432,6 +13436,18 @@
|
|
|
13432
13436
|
"privacy": "private",
|
|
13433
13437
|
"readonly": true
|
|
13434
13438
|
},
|
|
13439
|
+
{
|
|
13440
|
+
"kind": "field",
|
|
13441
|
+
"name": "#startSlot",
|
|
13442
|
+
"privacy": "private",
|
|
13443
|
+
"readonly": true
|
|
13444
|
+
},
|
|
13445
|
+
{
|
|
13446
|
+
"kind": "field",
|
|
13447
|
+
"name": "#start",
|
|
13448
|
+
"privacy": "private",
|
|
13449
|
+
"readonly": true
|
|
13450
|
+
},
|
|
13435
13451
|
{
|
|
13436
13452
|
"kind": "field",
|
|
13437
13453
|
"name": "#tile",
|
package/package.json
CHANGED
package/src/gw-page-header.ts
CHANGED
|
@@ -8,8 +8,9 @@ import { GwElement, css, h } from "./element.js";
|
|
|
8
8
|
import { base, createIcon, setIconPath } from "./styles.js";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* A page's title, with an optional icon tile and description,
|
|
12
|
-
* controls at the top right in the
|
|
11
|
+
* A page's title, with an optional icon tile and description, a back button
|
|
12
|
+
* or similar in the `start` slot, and its controls at the top right in the
|
|
13
|
+
* `actions` slot.
|
|
13
14
|
*
|
|
14
15
|
* @element gw-page-header
|
|
15
16
|
* @summary A page's title, icon, description and actions.
|
|
@@ -18,6 +19,7 @@ import { base, createIcon, setIconPath } from "./styles.js";
|
|
|
18
19
|
* @attr {string} description - A line under the title.
|
|
19
20
|
* @attr {string} icon - SVG path data for the icon tile.
|
|
20
21
|
*
|
|
22
|
+
* @slot start - Before the icon tile, such as a back button.
|
|
21
23
|
* @slot actions - The page's controls.
|
|
22
24
|
*
|
|
23
25
|
* @csspart tile - The icon tile.
|
|
@@ -40,6 +42,17 @@ export class GwPageHeader extends GwElement {
|
|
|
40
42
|
align-items: flex-start;
|
|
41
43
|
}
|
|
42
44
|
|
|
45
|
+
.start {
|
|
46
|
+
display: flex;
|
|
47
|
+
flex: none;
|
|
48
|
+
align-items: center;
|
|
49
|
+
min-height: 3rem;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.start[hidden] {
|
|
53
|
+
display: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
43
56
|
.tile {
|
|
44
57
|
display: grid;
|
|
45
58
|
flex: none;
|
|
@@ -81,6 +94,11 @@ export class GwPageHeader extends GwElement {
|
|
|
81
94
|
align-items: center;
|
|
82
95
|
margin-inline-start: auto;
|
|
83
96
|
}
|
|
97
|
+
|
|
98
|
+
/* Centered on the tile when there is one */
|
|
99
|
+
.tile:not([hidden]) ~ .actions {
|
|
100
|
+
min-height: 3rem;
|
|
101
|
+
}
|
|
84
102
|
`,
|
|
85
103
|
];
|
|
86
104
|
|
|
@@ -90,6 +108,11 @@ export class GwPageHeader extends GwElement {
|
|
|
90
108
|
|
|
91
109
|
readonly #icon = createIcon("");
|
|
92
110
|
|
|
111
|
+
readonly #startSlot = h("slot", { name: "start" });
|
|
112
|
+
|
|
113
|
+
// Centered on the tile's height, and out of the row while it's empty
|
|
114
|
+
readonly #start = h("div", { class: "start", hidden: true }, this.#startSlot);
|
|
115
|
+
|
|
93
116
|
readonly #tile = h("span", { class: "tile", part: "tile" }, this.#icon);
|
|
94
117
|
|
|
95
118
|
readonly #heading = h("h1", { part: "heading" });
|
|
@@ -104,7 +127,11 @@ export class GwPageHeader extends GwElement {
|
|
|
104
127
|
}
|
|
105
128
|
|
|
106
129
|
protected override create(root: ShadowRoot) {
|
|
130
|
+
this.#startSlot.addEventListener("slotchange", () => {
|
|
131
|
+
this.#start.hidden = this.#startSlot.assignedElements().length === 0;
|
|
132
|
+
});
|
|
107
133
|
root.append(
|
|
134
|
+
this.#start,
|
|
108
135
|
this.#tile,
|
|
109
136
|
h("div", { class: "titles" }, this.#heading, this.#description),
|
|
110
137
|
h("div", { class: "actions" }, h("slot", { name: "actions" })),
|
package/src/gw-segmented.ts
CHANGED
|
@@ -12,6 +12,8 @@ export interface Segment {
|
|
|
12
12
|
readonly label: string;
|
|
13
13
|
/** SVG path data for an icon beside, or instead of, the label. */
|
|
14
14
|
readonly icon?: string;
|
|
15
|
+
/** A longer description, shown as the option's tooltip. */
|
|
16
|
+
readonly hint?: string;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
/**
|
|
@@ -297,7 +299,8 @@ export class GwSegmented extends GwElement {
|
|
|
297
299
|
setAttribute(
|
|
298
300
|
label,
|
|
299
301
|
"title",
|
|
300
|
-
option.
|
|
302
|
+
option.hint ??
|
|
303
|
+
(option.icon && this.labels !== "show" ? option.label : null),
|
|
301
304
|
);
|
|
302
305
|
}
|
|
303
306
|
|