@timmo001/groundwork-ui 0.9.10 → 0.9.11

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.
@@ -6401,7 +6401,7 @@
6401
6401
  "text": "Properties"
6402
6402
  },
6403
6403
  "static": true,
6404
- "default": "{ heading: {}, open: { type: \"boolean\", reflect: true }, }",
6404
+ "default": "{ heading: {}, open: { type: \"boolean\", reflect: true }, closeLabel: { attribute: \"close-label\" }, }",
6405
6405
  "inheritedFrom": {
6406
6406
  "name": "GwElement",
6407
6407
  "module": "src/element.ts"
@@ -6436,6 +6436,15 @@
6436
6436
  },
6437
6437
  "default": "false"
6438
6438
  },
6439
+ {
6440
+ "kind": "field",
6441
+ "name": "closeLabel",
6442
+ "type": {
6443
+ "text": "string"
6444
+ },
6445
+ "description": "The close button's name, for an app in another language.",
6446
+ "default": "\"Close\""
6447
+ },
6439
6448
  {
6440
6449
  "kind": "field",
6441
6450
  "name": "returnValue",
@@ -6854,6 +6863,13 @@
6854
6863
  },
6855
6864
  "description": "Whether it shows.",
6856
6865
  "name": "open"
6866
+ },
6867
+ {
6868
+ "type": {
6869
+ "text": "string"
6870
+ },
6871
+ "description": "The close button's name, for an app in another language. Defaults to `Close`.",
6872
+ "name": "close-label"
6857
6873
  }
6858
6874
  ],
6859
6875
  "superclass": {
@@ -13839,7 +13855,7 @@
13839
13855
  "text": "Properties"
13840
13856
  },
13841
13857
  "static": true,
13842
- "default": "{ heading: {}, confirm: { type: \"boolean\" }, }",
13858
+ "default": "{ heading: {}, confirm: { type: \"boolean\" }, closeLabel: { attribute: \"close-label\" }, }",
13843
13859
  "inheritedFrom": {
13844
13860
  "name": "GwElement",
13845
13861
  "module": "src/element.ts"
@@ -13874,6 +13890,15 @@
13874
13890
  },
13875
13891
  "default": "false"
13876
13892
  },
13893
+ {
13894
+ "kind": "field",
13895
+ "name": "closeLabel",
13896
+ "type": {
13897
+ "text": "string"
13898
+ },
13899
+ "description": "The close button's name, for an app in another language.",
13900
+ "default": "\"Close\""
13901
+ },
13877
13902
  {
13878
13903
  "kind": "field",
13879
13904
  "name": "returnValue",
@@ -14324,6 +14349,13 @@
14324
14349
  },
14325
14350
  "description": "Makes it an `alertdialog`, for a question that needs an answer.",
14326
14351
  "name": "confirm"
14352
+ },
14353
+ {
14354
+ "type": {
14355
+ "text": "string"
14356
+ },
14357
+ "description": "The close button's name, for an app in another language. Defaults to `Close`.",
14358
+ "name": "close-label"
14327
14359
  }
14328
14360
  ],
14329
14361
  "superclass": {
@@ -16614,7 +16646,7 @@
16614
16646
  "text": "Properties"
16615
16647
  },
16616
16648
  "static": true,
16617
- "default": "{ heading: {}, side: { reflect: true }, }",
16649
+ "default": "{ heading: {}, side: { reflect: true }, closeLabel: { attribute: \"close-label\" }, }",
16618
16650
  "inheritedFrom": {
16619
16651
  "name": "GwElement",
16620
16652
  "module": "src/element.ts"
@@ -16627,7 +16659,7 @@
16627
16659
  "text": "readonly CSSStyleSheet[]"
16628
16660
  },
16629
16661
  "static": true,
16630
- "default": "[ base, css` [popover] { position: fixed; box-sizing: border-box; flex-direction: column; padding: 0; margin: 0; overflow: hidden; color: var(--gw-color-text-primary); background: var(--gw-color-surface-overlay); border: 0 solid var(--gw-color-border-normal); box-shadow: var(--gw-shadow-l); transition: translate var(--gw-motion-normal) var(--gw-motion-easing), display var(--gw-motion-normal) allow-discrete, overlay var(--gw-motion-normal) allow-discrete; } [popover]:popover-open { display: flex; translate: 0 0; } [popover]::backdrop { background: rgb(0 0 0 / 40%); } /* Full height from the start or end edge */ [data-side=\"start\"], [data-side=\"end\"] { inset: 0 auto; width: min(var(--gw-sheet-width, 20rem), 100vw); height: 100%; max-height: none; } [data-side=\"start\"] { inset-inline-start: 0; border-inline-end-width: max(var(--gw-border-width), 1px); translate: -100% 0; } [data-side=\"end\"] { inset-inline-end: 0; border-inline-start-width: max(var(--gw-border-width), 1px); translate: 100% 0; } :host(:dir(rtl)) [data-side=\"start\"] { translate: 100% 0; } :host(:dir(rtl)) [data-side=\"end\"] { translate: -100% 0; } /* Up from the bottom, with room for the phone's home bar */ [data-side=\"bottom\"] { inset: auto 0 0; width: 100%; max-width: none; max-height: var(--gw-sheet-height, 85vh); padding-block-end: env(safe-area-inset-bottom); border-block-start-width: max(var(--gw-border-width), 1px); border-start-start-radius: var(--gw-radius-panel); border-start-end-radius: var(--gw-radius-panel); translate: 0 100%; } @starting-style { [data-side=\"start\"]:popover-open { translate: -100% 0; } [data-side=\"end\"]:popover-open { translate: 100% 0; } [data-side=\"bottom\"]:popover-open { translate: 0 100%; } } header { display: flex; flex: none; gap: var(--gw-space-2); align-items: center; padding: var(--gw-space-2) var(--gw-space-3); border-block-end: var(--gw-border-width) solid var(--gw-color-border-quiet); } h2 { flex: 1; min-width: 0; margin: 0; font-size: var(--gw-font-size-m); font-weight: var(--gw-font-weight-strong); color: var(--gw-color-text-strong); } .body { display: flex; flex: 1; flex-direction: column; gap: var(--gw-space-3); min-height: 0; padding: var(--gw-space-4); /* It scrolls down only, so content reaching into its padding never makes it scroll sideways */ overflow: hidden auto; overscroll-behavior: contain; scrollbar-width: thin; } `, ]",
16662
+ "default": "[ base, css` [popover] { position: fixed; box-sizing: border-box; flex-direction: column; padding: 0; margin: 0; overflow: hidden; color: var(--gw-color-text-primary); background: var(--gw-color-surface-overlay); border: 0 solid var(--gw-color-border-normal); box-shadow: var(--gw-shadow-l); transition: translate var(--gw-motion-normal) var(--gw-motion-easing), display var(--gw-motion-normal) allow-discrete, overlay var(--gw-motion-normal) allow-discrete; } [popover]:popover-open { display: flex; translate: 0 0; } /* The page dims as the sheet slides in, and back as it leaves */ [popover]::backdrop { background: rgb(0 0 0 / 0%); transition: background-color var(--gw-motion-normal) var(--gw-motion-easing), display var(--gw-motion-normal) allow-discrete, overlay var(--gw-motion-normal) allow-discrete; } [popover]:popover-open::backdrop { background: rgb(0 0 0 / 40%); } @starting-style { [popover]:popover-open::backdrop { background: rgb(0 0 0 / 0%); } } /* Full height from the start or end edge */ [data-side=\"start\"], [data-side=\"end\"] { inset: 0 auto; width: min(var(--gw-sheet-width, 20rem), 100vw); height: 100%; max-height: none; } [data-side=\"start\"] { inset-inline-start: 0; border-inline-end-width: max(var(--gw-border-width), 1px); translate: -100% 0; } [data-side=\"end\"] { inset-inline-end: 0; border-inline-start-width: max(var(--gw-border-width), 1px); translate: 100% 0; } :host(:dir(rtl)) [data-side=\"start\"] { translate: 100% 0; } :host(:dir(rtl)) [data-side=\"end\"] { translate: -100% 0; } /* Up from the bottom, with room for the phone's home bar */ [data-side=\"bottom\"] { inset: auto 0 0; width: 100%; max-width: none; max-height: var(--gw-sheet-height, 85vh); padding-block-end: env(safe-area-inset-bottom); border-block-start-width: max(var(--gw-border-width), 1px); border-start-start-radius: var(--gw-radius-panel); border-start-end-radius: var(--gw-radius-panel); translate: 0 100%; } @starting-style { [data-side=\"start\"]:popover-open { translate: -100% 0; } [data-side=\"end\"]:popover-open { translate: 100% 0; } [data-side=\"bottom\"]:popover-open { translate: 0 100%; } } header { display: flex; flex: none; gap: var(--gw-space-2); align-items: center; padding: var(--gw-space-2) var(--gw-space-3); border-block-end: var(--gw-border-width) solid var(--gw-color-border-quiet); } h2 { flex: 1; min-width: 0; margin: 0; font-size: var(--gw-font-size-m); font-weight: var(--gw-font-weight-strong); color: var(--gw-color-text-strong); } .body { display: flex; flex: 1; flex-direction: column; gap: var(--gw-space-3); min-height: 0; padding: var(--gw-space-4); /* It scrolls down only, so content reaching into its padding never makes it scroll sideways */ overflow: hidden auto; overscroll-behavior: contain; scrollbar-width: thin; } `, ]",
16631
16663
  "inheritedFrom": {
16632
16664
  "name": "GwElement",
16633
16665
  "module": "src/element.ts"
@@ -16649,6 +16681,15 @@
16649
16681
  },
16650
16682
  "default": "\"auto\""
16651
16683
  },
16684
+ {
16685
+ "kind": "field",
16686
+ "name": "closeLabel",
16687
+ "type": {
16688
+ "text": "string"
16689
+ },
16690
+ "description": "The close button's name, for an app in another language.",
16691
+ "default": "\"Close\""
16692
+ },
16652
16693
  {
16653
16694
  "kind": "field",
16654
16695
  "name": "#heading",
@@ -17061,6 +17102,13 @@
17061
17102
  },
17062
17103
  "description": "The edge it slides in from. `auto` is the start edge, or the bottom on narrow screens. Defaults to `auto`.",
17063
17104
  "name": "side"
17105
+ },
17106
+ {
17107
+ "type": {
17108
+ "text": "string"
17109
+ },
17110
+ "description": "The close button's name, for an app in another language. Defaults to `Close`.",
17111
+ "name": "close-label"
17064
17112
  }
17065
17113
  ],
17066
17114
  "superclass": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@timmo001/groundwork-ui",
3
- "version": "0.9.10",
3
+ "version": "0.9.11",
4
4
  "description": "Groundwork's framework-free web components, styled by the --gw-* tokens",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
package/src/gw-dialog.ts CHANGED
@@ -24,6 +24,7 @@ const closeIcon =
24
24
  *
25
25
  * @attr {string} heading - The heading beside the close button.
26
26
  * @attr {boolean} open - Whether it shows.
27
+ * @attr {string} close-label - The close button's name, for an app in another language. Defaults to `Close`.
27
28
  *
28
29
  * @slot - The content.
29
30
  * @slot actions - Buttons; one with a `value` closes it with that value.
@@ -40,6 +41,7 @@ export class GwDialog extends GwElement {
40
41
  static override properties = {
41
42
  heading: {},
42
43
  open: { type: "boolean", reflect: true },
44
+ closeLabel: { attribute: "close-label" },
43
45
  } as const;
44
46
 
45
47
  static override styles = [
@@ -135,6 +137,8 @@ export class GwDialog extends GwElement {
135
137
 
136
138
  declare heading: string;
137
139
  declare open: boolean;
140
+ /** The close button's name, for an app in another language. */
141
+ declare closeLabel: string;
138
142
 
139
143
  /** The value of the action that closed the dialog, or "" for Esc. */
140
144
  returnValue = "";
@@ -143,6 +147,7 @@ export class GwDialog extends GwElement {
143
147
  super();
144
148
  this.heading = "";
145
149
  this.open = false;
150
+ this.closeLabel = "Close";
146
151
  }
147
152
 
148
153
  readonly #heading = h("h2", { id: "heading", part: "heading" });
@@ -236,6 +241,7 @@ export class GwDialog extends GwElement {
236
241
  const dialog = this.#dialog;
237
242
 
238
243
  this.#heading.textContent = this.heading;
244
+ this.#closeButton.textContent = this.closeLabel;
239
245
 
240
246
  if (this.open && !dialog.open) {
241
247
  dialog.showModal();
package/src/gw-popover.ts CHANGED
@@ -34,6 +34,7 @@ const sheetBelow = 600;
34
34
  *
35
35
  * @attr {string} heading - The heading beside the close button.
36
36
  * @attr {boolean} confirm - Makes it an `alertdialog`, for a question that needs an answer.
37
+ * @attr {string} close-label - The close button's name, for an app in another language. Defaults to `Close`.
37
38
  *
38
39
  * @slot - The content.
39
40
  * @slot actions - Buttons; one with a `value` closes it with that value.
@@ -51,6 +52,7 @@ export class GwPopover extends GwElement {
51
52
  static override properties = {
52
53
  heading: {},
53
54
  confirm: { type: "boolean" },
55
+ closeLabel: { attribute: "close-label" },
54
56
  } as const;
55
57
 
56
58
  static override styles = [
@@ -188,6 +190,8 @@ export class GwPopover extends GwElement {
188
190
 
189
191
  declare heading: string;
190
192
  declare confirm: boolean;
193
+ /** The close button's name, for an app in another language. */
194
+ declare closeLabel: string;
191
195
 
192
196
  /** The value of the action that closed it, or "" for Esc or a click outside. */
193
197
  returnValue = "";
@@ -242,6 +246,7 @@ export class GwPopover extends GwElement {
242
246
  super();
243
247
  this.heading = "";
244
248
  this.confirm = false;
249
+ this.closeLabel = "Close";
245
250
  }
246
251
 
247
252
  /** Whether its content has changed since it opened, so closing it asks first. */
@@ -382,6 +387,7 @@ export class GwPopover extends GwElement {
382
387
  setAttribute(popover, "aria-describedby", this.heading ? "body" : null);
383
388
  this.#heading.textContent = this.heading;
384
389
  this.#heading.hidden = !this.heading;
390
+ this.#closeButton.textContent = this.closeLabel;
385
391
  }
386
392
  }
387
393
 
package/src/gw-sheet.ts CHANGED
@@ -37,6 +37,7 @@ const narrow = "(width < 40rem)";
37
37
  *
38
38
  * @attr {string} heading - The heading beside the close button.
39
39
  * @attr {"auto"|"start"|"end"|"bottom"} side - The edge it slides in from. `auto` is the start edge, or the bottom on narrow screens. Defaults to `auto`.
40
+ * @attr {string} close-label - The close button's name, for an app in another language. Defaults to `Close`.
40
41
  *
41
42
  * @slot - The content, which scrolls.
42
43
  * @slot actions - Buttons in the header, after the heading.
@@ -55,6 +56,7 @@ export class GwSheet extends GwElement {
55
56
  static override properties = {
56
57
  heading: {},
57
58
  side: { reflect: true },
59
+ closeLabel: { attribute: "close-label" },
58
60
  } as const;
59
61
 
60
62
  static override styles = [
@@ -82,10 +84,25 @@ export class GwSheet extends GwElement {
82
84
  translate: 0 0;
83
85
  }
84
86
 
87
+ /* The page dims as the sheet slides in, and back as it leaves */
85
88
  [popover]::backdrop {
89
+ background: rgb(0 0 0 / 0%);
90
+ transition:
91
+ background-color var(--gw-motion-normal) var(--gw-motion-easing),
92
+ display var(--gw-motion-normal) allow-discrete,
93
+ overlay var(--gw-motion-normal) allow-discrete;
94
+ }
95
+
96
+ [popover]:popover-open::backdrop {
86
97
  background: rgb(0 0 0 / 40%);
87
98
  }
88
99
 
100
+ @starting-style {
101
+ [popover]:popover-open::backdrop {
102
+ background: rgb(0 0 0 / 0%);
103
+ }
104
+ }
105
+
89
106
  /* Full height from the start or end edge */
90
107
  [data-side="start"],
91
108
  [data-side="end"] {
@@ -179,6 +196,8 @@ export class GwSheet extends GwElement {
179
196
 
180
197
  declare heading: string;
181
198
  declare side: "auto" | Side;
199
+ /** The close button's name, for an app in another language. */
200
+ declare closeLabel: string;
182
201
 
183
202
  readonly #heading = h("h2", { id: "heading", part: "heading" });
184
203
 
@@ -220,6 +239,7 @@ export class GwSheet extends GwElement {
220
239
  super();
221
240
  this.heading = "";
222
241
  this.side = "auto";
242
+ this.closeLabel = "Close";
223
243
  }
224
244
 
225
245
  /** Whether it's open. */
@@ -294,6 +314,7 @@ export class GwSheet extends GwElement {
294
314
  this.heading ? "heading" : null,
295
315
  );
296
316
  this.#heading.hidden = !this.heading;
317
+ this.#closeButton.textContent = this.closeLabel;
297
318
  this.#place();
298
319
  }
299
320
  }