@timmo001/groundwork-ui 0.9.27 → 0.9.29
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 +172 -5
- package/package.json +1 -1
- package/src/dismiss.ts +10 -1
- package/src/gw-dialog.ts +17 -0
- package/src/gw-input.ts +10 -0
- package/src/gw-notification.ts +5 -0
- package/src/gw-popover.ts +17 -0
- package/src/gw-select.ts +5 -0
package/custom-elements.json
CHANGED
|
@@ -77,12 +77,43 @@
|
|
|
77
77
|
"privacy": "private",
|
|
78
78
|
"readonly": true
|
|
79
79
|
},
|
|
80
|
+
{
|
|
81
|
+
"kind": "field",
|
|
82
|
+
"name": "#question",
|
|
83
|
+
"privacy": "private",
|
|
84
|
+
"readonly": true
|
|
85
|
+
},
|
|
80
86
|
{
|
|
81
87
|
"kind": "field",
|
|
82
88
|
"name": "#view",
|
|
83
89
|
"privacy": "private",
|
|
84
90
|
"readonly": true
|
|
85
91
|
},
|
|
92
|
+
{
|
|
93
|
+
"kind": "method",
|
|
94
|
+
"name": "text",
|
|
95
|
+
"parameters": [
|
|
96
|
+
{
|
|
97
|
+
"name": "question",
|
|
98
|
+
"type": {
|
|
99
|
+
"text": "string"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
"name": "keep",
|
|
104
|
+
"type": {
|
|
105
|
+
"text": "string"
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"name": "discard",
|
|
110
|
+
"type": {
|
|
111
|
+
"text": "string"
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
],
|
|
115
|
+
"description": "Sets the question and its buttons' text, for an app in another language."
|
|
116
|
+
},
|
|
86
117
|
{
|
|
87
118
|
"kind": "field",
|
|
88
119
|
"name": "asking",
|
|
@@ -6552,7 +6583,7 @@
|
|
|
6552
6583
|
"text": "Properties"
|
|
6553
6584
|
},
|
|
6554
6585
|
"static": true,
|
|
6555
|
-
"default": "{ heading: {}, open: { type: \"boolean\", reflect: true }, closeLabel: { attribute: \"close-label\" }, }",
|
|
6586
|
+
"default": "{ heading: {}, open: { type: \"boolean\", reflect: true }, closeLabel: { attribute: \"close-label\" }, discardQuestion: { attribute: \"discard-question\" }, keepLabel: { attribute: \"keep-label\" }, discardLabel: { attribute: \"discard-label\" }, }",
|
|
6556
6587
|
"inheritedFrom": {
|
|
6557
6588
|
"name": "GwElement",
|
|
6558
6589
|
"module": "src/element.ts"
|
|
@@ -6596,6 +6627,30 @@
|
|
|
6596
6627
|
"description": "The close button's name, for an app in another language.",
|
|
6597
6628
|
"default": "\"Close\""
|
|
6598
6629
|
},
|
|
6630
|
+
{
|
|
6631
|
+
"kind": "field",
|
|
6632
|
+
"name": "discardQuestion",
|
|
6633
|
+
"type": {
|
|
6634
|
+
"text": "string"
|
|
6635
|
+
},
|
|
6636
|
+
"default": "\"Discard your changes?\""
|
|
6637
|
+
},
|
|
6638
|
+
{
|
|
6639
|
+
"kind": "field",
|
|
6640
|
+
"name": "keepLabel",
|
|
6641
|
+
"type": {
|
|
6642
|
+
"text": "string"
|
|
6643
|
+
},
|
|
6644
|
+
"default": "\"Keep editing\""
|
|
6645
|
+
},
|
|
6646
|
+
{
|
|
6647
|
+
"kind": "field",
|
|
6648
|
+
"name": "discardLabel",
|
|
6649
|
+
"type": {
|
|
6650
|
+
"text": "string"
|
|
6651
|
+
},
|
|
6652
|
+
"default": "\"Discard\""
|
|
6653
|
+
},
|
|
6599
6654
|
{
|
|
6600
6655
|
"kind": "field",
|
|
6601
6656
|
"name": "returnValue",
|
|
@@ -7021,6 +7076,27 @@
|
|
|
7021
7076
|
},
|
|
7022
7077
|
"description": "The close button's name, for an app in another language. Defaults to `Close`.",
|
|
7023
7078
|
"name": "close-label"
|
|
7079
|
+
},
|
|
7080
|
+
{
|
|
7081
|
+
"type": {
|
|
7082
|
+
"text": "string"
|
|
7083
|
+
},
|
|
7084
|
+
"description": "The question asked before closing with edits, for an app in another language. Defaults to `Discard your changes?`.",
|
|
7085
|
+
"name": "discard-question"
|
|
7086
|
+
},
|
|
7087
|
+
{
|
|
7088
|
+
"type": {
|
|
7089
|
+
"text": "string"
|
|
7090
|
+
},
|
|
7091
|
+
"description": "The button that goes back to editing. Defaults to `Keep editing`.",
|
|
7092
|
+
"name": "keep-label"
|
|
7093
|
+
},
|
|
7094
|
+
{
|
|
7095
|
+
"type": {
|
|
7096
|
+
"text": "string"
|
|
7097
|
+
},
|
|
7098
|
+
"description": "The button that throws the edits away. Defaults to `Discard`.",
|
|
7099
|
+
"name": "discard-label"
|
|
7024
7100
|
}
|
|
7025
7101
|
],
|
|
7026
7102
|
"superclass": {
|
|
@@ -9944,7 +10020,7 @@
|
|
|
9944
10020
|
"text": "Properties"
|
|
9945
10021
|
},
|
|
9946
10022
|
"static": true,
|
|
9947
|
-
"default": "{ label: {}, name: {}, type: {}, value: {}, placeholder: {}, autocomplete: {}, inputmode: {}, min: {}, max: {}, step: {}, hint: {}, info: {}, error: {}, required: { type: \"boolean\" }, optional: { type: \"boolean\" }, disabled: { type: \"boolean\" }, multiline: { type: \"boolean\", reflect: true }, rows: { type: \"number\" }, monospace: { type: \"boolean\", reflect: true }, reveal: { type: \"boolean\" }, size: { reflect: true }, icon: {}, labelHidden: { type: \"boolean\", attribute: \"label-hidden\", reflect: true }, }",
|
|
10023
|
+
"default": "{ label: {}, name: {}, type: {}, value: {}, placeholder: {}, autocomplete: {}, inputmode: {}, min: {}, max: {}, step: {}, maxlength: { type: \"number\" }, hint: {}, info: {}, error: {}, required: { type: \"boolean\" }, optional: { type: \"boolean\" }, disabled: { type: \"boolean\" }, multiline: { type: \"boolean\", reflect: true }, rows: { type: \"number\" }, monospace: { type: \"boolean\", reflect: true }, reveal: { type: \"boolean\" }, size: { reflect: true }, icon: {}, labelHidden: { type: \"boolean\", attribute: \"label-hidden\", reflect: true }, }",
|
|
9948
10024
|
"inheritedFrom": {
|
|
9949
10025
|
"name": "GwElement",
|
|
9950
10026
|
"module": "src/element.ts"
|
|
@@ -10034,6 +10110,15 @@
|
|
|
10034
10110
|
"description": "The step between values of a number, date or time field.",
|
|
10035
10111
|
"default": "\"\""
|
|
10036
10112
|
},
|
|
10113
|
+
{
|
|
10114
|
+
"kind": "field",
|
|
10115
|
+
"name": "maxlength",
|
|
10116
|
+
"type": {
|
|
10117
|
+
"text": "number"
|
|
10118
|
+
},
|
|
10119
|
+
"description": "The most characters it takes, or 0 for no limit.",
|
|
10120
|
+
"default": "0"
|
|
10121
|
+
},
|
|
10037
10122
|
{
|
|
10038
10123
|
"kind": "field",
|
|
10039
10124
|
"name": "hint",
|
|
@@ -10625,6 +10710,13 @@
|
|
|
10625
10710
|
"description": "The step between values of a `number`, date or time field, or `any`.",
|
|
10626
10711
|
"name": "step"
|
|
10627
10712
|
},
|
|
10713
|
+
{
|
|
10714
|
+
"type": {
|
|
10715
|
+
"text": "number"
|
|
10716
|
+
},
|
|
10717
|
+
"description": "The most characters it takes.",
|
|
10718
|
+
"name": "maxlength"
|
|
10719
|
+
},
|
|
10628
10720
|
{
|
|
10629
10721
|
"type": {
|
|
10630
10722
|
"text": "string"
|
|
@@ -12609,7 +12701,7 @@
|
|
|
12609
12701
|
"text": "Properties"
|
|
12610
12702
|
},
|
|
12611
12703
|
"static": true,
|
|
12612
|
-
"default": "{ heading: {}, icon: {}, tone: { reflect: true }, time: {}, unread: { type: \"boolean\", reflect: true }, }",
|
|
12704
|
+
"default": "{ heading: {}, icon: {}, tone: { reflect: true }, time: {}, unread: { type: \"boolean\", reflect: true }, dismissLabel: { attribute: \"dismiss-label\" }, }",
|
|
12613
12705
|
"inheritedFrom": {
|
|
12614
12706
|
"name": "GwElement",
|
|
12615
12707
|
"module": "src/element.ts"
|
|
@@ -12668,6 +12760,14 @@
|
|
|
12668
12760
|
},
|
|
12669
12761
|
"default": "false"
|
|
12670
12762
|
},
|
|
12763
|
+
{
|
|
12764
|
+
"kind": "field",
|
|
12765
|
+
"name": "dismissLabel",
|
|
12766
|
+
"type": {
|
|
12767
|
+
"text": "string"
|
|
12768
|
+
},
|
|
12769
|
+
"default": "\"Dismiss\""
|
|
12770
|
+
},
|
|
12671
12771
|
{
|
|
12672
12772
|
"kind": "field",
|
|
12673
12773
|
"name": "#icon",
|
|
@@ -13053,6 +13153,13 @@
|
|
|
13053
13153
|
},
|
|
13054
13154
|
"description": "Marks it with a stripe until it's seen.",
|
|
13055
13155
|
"name": "unread"
|
|
13156
|
+
},
|
|
13157
|
+
{
|
|
13158
|
+
"type": {
|
|
13159
|
+
"text": "string"
|
|
13160
|
+
},
|
|
13161
|
+
"description": "The close button's name, for an app in another language. Defaults to `Dismiss`.",
|
|
13162
|
+
"name": "dismiss-label"
|
|
13056
13163
|
}
|
|
13057
13164
|
],
|
|
13058
13165
|
"superclass": {
|
|
@@ -14358,7 +14465,7 @@
|
|
|
14358
14465
|
"text": "Properties"
|
|
14359
14466
|
},
|
|
14360
14467
|
"static": true,
|
|
14361
|
-
"default": "{ heading: {}, confirm: { type: \"boolean\" }, closeLabel: { attribute: \"close-label\" }, }",
|
|
14468
|
+
"default": "{ heading: {}, confirm: { type: \"boolean\" }, closeLabel: { attribute: \"close-label\" }, discardQuestion: { attribute: \"discard-question\" }, keepLabel: { attribute: \"keep-label\" }, discardLabel: { attribute: \"discard-label\" }, }",
|
|
14362
14469
|
"inheritedFrom": {
|
|
14363
14470
|
"name": "GwElement",
|
|
14364
14471
|
"module": "src/element.ts"
|
|
@@ -14402,6 +14509,30 @@
|
|
|
14402
14509
|
"description": "The close button's name, for an app in another language.",
|
|
14403
14510
|
"default": "\"Close\""
|
|
14404
14511
|
},
|
|
14512
|
+
{
|
|
14513
|
+
"kind": "field",
|
|
14514
|
+
"name": "discardQuestion",
|
|
14515
|
+
"type": {
|
|
14516
|
+
"text": "string"
|
|
14517
|
+
},
|
|
14518
|
+
"default": "\"Discard your changes?\""
|
|
14519
|
+
},
|
|
14520
|
+
{
|
|
14521
|
+
"kind": "field",
|
|
14522
|
+
"name": "keepLabel",
|
|
14523
|
+
"type": {
|
|
14524
|
+
"text": "string"
|
|
14525
|
+
},
|
|
14526
|
+
"default": "\"Keep editing\""
|
|
14527
|
+
},
|
|
14528
|
+
{
|
|
14529
|
+
"kind": "field",
|
|
14530
|
+
"name": "discardLabel",
|
|
14531
|
+
"type": {
|
|
14532
|
+
"text": "string"
|
|
14533
|
+
},
|
|
14534
|
+
"default": "\"Discard\""
|
|
14535
|
+
},
|
|
14405
14536
|
{
|
|
14406
14537
|
"kind": "field",
|
|
14407
14538
|
"name": "returnValue",
|
|
@@ -14859,6 +14990,27 @@
|
|
|
14859
14990
|
},
|
|
14860
14991
|
"description": "The close button's name, for an app in another language. Defaults to `Close`.",
|
|
14861
14992
|
"name": "close-label"
|
|
14993
|
+
},
|
|
14994
|
+
{
|
|
14995
|
+
"type": {
|
|
14996
|
+
"text": "string"
|
|
14997
|
+
},
|
|
14998
|
+
"description": "The question asked before closing with edits, for an app in another language. Defaults to `Discard your changes?`.",
|
|
14999
|
+
"name": "discard-question"
|
|
15000
|
+
},
|
|
15001
|
+
{
|
|
15002
|
+
"type": {
|
|
15003
|
+
"text": "string"
|
|
15004
|
+
},
|
|
15005
|
+
"description": "The button that goes back to editing. Defaults to `Keep editing`.",
|
|
15006
|
+
"name": "keep-label"
|
|
15007
|
+
},
|
|
15008
|
+
{
|
|
15009
|
+
"type": {
|
|
15010
|
+
"text": "string"
|
|
15011
|
+
},
|
|
15012
|
+
"description": "The button that throws the edits away. Defaults to `Discard`.",
|
|
15013
|
+
"name": "discard-label"
|
|
14862
15014
|
}
|
|
14863
15015
|
],
|
|
14864
15016
|
"superclass": {
|
|
@@ -16473,7 +16625,7 @@
|
|
|
16473
16625
|
"text": "Properties"
|
|
16474
16626
|
},
|
|
16475
16627
|
"static": true,
|
|
16476
|
-
"default": "{ label: {}, name: {}, value: {}, multiple: { type: \"boolean\", reflect: true }, values: { type: \"json\" }, hint: {}, info: {}, placeholder: {}, search: {}, disabled: { type: \"boolean\" }, open: { type: \"boolean\", reflect: true }, options: { type: \"json\" }, labelHidden: { type: \"boolean\", attribute: \"label-hidden\" }, inlineLabel: { type: \"boolean\", attribute: \"inline-label\", reflect: true }, size: { reflect: true }, }",
|
|
16628
|
+
"default": "{ label: {}, name: {}, value: {}, multiple: { type: \"boolean\", reflect: true }, values: { type: \"json\" }, hint: {}, info: {}, placeholder: {}, search: {}, disabled: { type: \"boolean\" }, open: { type: \"boolean\", reflect: true }, options: { type: \"json\" }, labelHidden: { type: \"boolean\", attribute: \"label-hidden\" }, inlineLabel: { type: \"boolean\", attribute: \"inline-label\", reflect: true }, size: { reflect: true }, clearLabel: { attribute: \"clear-label\" }, }",
|
|
16477
16629
|
"inheritedFrom": {
|
|
16478
16630
|
"name": "GwElement",
|
|
16479
16631
|
"module": "src/element.ts"
|
|
@@ -16601,6 +16753,14 @@
|
|
|
16601
16753
|
},
|
|
16602
16754
|
"default": "\"medium\""
|
|
16603
16755
|
},
|
|
16756
|
+
{
|
|
16757
|
+
"kind": "field",
|
|
16758
|
+
"name": "clearLabel",
|
|
16759
|
+
"type": {
|
|
16760
|
+
"text": "string"
|
|
16761
|
+
},
|
|
16762
|
+
"default": "\"Clear\""
|
|
16763
|
+
},
|
|
16604
16764
|
{
|
|
16605
16765
|
"kind": "field",
|
|
16606
16766
|
"name": "#id",
|
|
@@ -17170,6 +17330,13 @@
|
|
|
17170
17330
|
},
|
|
17171
17331
|
"description": "The field's size, 40px tall at medium. Defaults to `medium`.",
|
|
17172
17332
|
"name": "size"
|
|
17333
|
+
},
|
|
17334
|
+
{
|
|
17335
|
+
"type": {
|
|
17336
|
+
"text": "string"
|
|
17337
|
+
},
|
|
17338
|
+
"description": "The button that clears a multiple choice, for an app in another language. Defaults to `Clear`.",
|
|
17339
|
+
"name": "clear-label"
|
|
17173
17340
|
}
|
|
17174
17341
|
],
|
|
17175
17342
|
"superclass": {
|
package/package.json
CHANGED
package/src/dismiss.ts
CHANGED
|
@@ -74,10 +74,12 @@ export class Dismissal {
|
|
|
74
74
|
"Discard",
|
|
75
75
|
);
|
|
76
76
|
|
|
77
|
+
readonly #question = h("p", {}, "Discard your changes?");
|
|
78
|
+
|
|
77
79
|
readonly #view = h(
|
|
78
80
|
"div",
|
|
79
81
|
{ class: "discard", role: "alert" },
|
|
80
|
-
|
|
82
|
+
this.#question,
|
|
81
83
|
h("footer", {}, this.#keep, this.#discard),
|
|
82
84
|
);
|
|
83
85
|
|
|
@@ -107,6 +109,13 @@ export class Dismissal {
|
|
|
107
109
|
});
|
|
108
110
|
}
|
|
109
111
|
|
|
112
|
+
/** Sets the question and its buttons' text, for an app in another language. */
|
|
113
|
+
text(question: string, keep: string, discard: string) {
|
|
114
|
+
this.#question.textContent = question;
|
|
115
|
+
this.#keep.textContent = keep;
|
|
116
|
+
this.#discard.textContent = discard;
|
|
117
|
+
}
|
|
118
|
+
|
|
110
119
|
/** Whether it's showing the question rather than the content. */
|
|
111
120
|
get asking() {
|
|
112
121
|
return this.#surface.dataset.view === "discard";
|
package/src/gw-dialog.ts
CHANGED
|
@@ -25,6 +25,9 @@ const closeIcon =
|
|
|
25
25
|
* @attr {string} heading - The heading beside the close button.
|
|
26
26
|
* @attr {boolean} open - Whether it shows.
|
|
27
27
|
* @attr {string} close-label - The close button's name, for an app in another language. Defaults to `Close`.
|
|
28
|
+
* @attr {string} discard-question - The question asked before closing with edits, for an app in another language. Defaults to `Discard your changes?`.
|
|
29
|
+
* @attr {string} keep-label - The button that goes back to editing. Defaults to `Keep editing`.
|
|
30
|
+
* @attr {string} discard-label - The button that throws the edits away. Defaults to `Discard`.
|
|
28
31
|
*
|
|
29
32
|
* @slot - The content.
|
|
30
33
|
* @slot actions - Buttons; one with a `value` closes it with that value.
|
|
@@ -42,6 +45,9 @@ export class GwDialog extends GwElement {
|
|
|
42
45
|
heading: {},
|
|
43
46
|
open: { type: "boolean", reflect: true },
|
|
44
47
|
closeLabel: { attribute: "close-label" },
|
|
48
|
+
discardQuestion: { attribute: "discard-question" },
|
|
49
|
+
keepLabel: { attribute: "keep-label" },
|
|
50
|
+
discardLabel: { attribute: "discard-label" },
|
|
45
51
|
} as const;
|
|
46
52
|
|
|
47
53
|
static override styles = [
|
|
@@ -148,6 +154,9 @@ export class GwDialog extends GwElement {
|
|
|
148
154
|
declare open: boolean;
|
|
149
155
|
/** The close button's name, for an app in another language. */
|
|
150
156
|
declare closeLabel: string;
|
|
157
|
+
declare discardQuestion: string;
|
|
158
|
+
declare keepLabel: string;
|
|
159
|
+
declare discardLabel: string;
|
|
151
160
|
|
|
152
161
|
/** The value of the action that closed the dialog, or "" for Esc. */
|
|
153
162
|
returnValue = "";
|
|
@@ -157,6 +166,9 @@ export class GwDialog extends GwElement {
|
|
|
157
166
|
this.heading = "";
|
|
158
167
|
this.open = false;
|
|
159
168
|
this.closeLabel = "Close";
|
|
169
|
+
this.discardQuestion = "Discard your changes?";
|
|
170
|
+
this.keepLabel = "Keep editing";
|
|
171
|
+
this.discardLabel = "Discard";
|
|
160
172
|
}
|
|
161
173
|
|
|
162
174
|
readonly #heading = h("h2", { id: "heading", part: "heading" });
|
|
@@ -251,6 +263,11 @@ export class GwDialog extends GwElement {
|
|
|
251
263
|
|
|
252
264
|
this.#heading.textContent = this.heading;
|
|
253
265
|
this.#closeButton.textContent = this.closeLabel;
|
|
266
|
+
this.#dismissal.text(
|
|
267
|
+
this.discardQuestion,
|
|
268
|
+
this.keepLabel,
|
|
269
|
+
this.discardLabel,
|
|
270
|
+
);
|
|
254
271
|
|
|
255
272
|
if (this.open && !dialog.open) {
|
|
256
273
|
dialog.showModal();
|
package/src/gw-input.ts
CHANGED
|
@@ -34,6 +34,7 @@ const hideIcon =
|
|
|
34
34
|
* @attr {string} min - The lowest value of a `number`, date or time field.
|
|
35
35
|
* @attr {string} max - The highest value of a `number`, date or time field.
|
|
36
36
|
* @attr {string} step - The step between values of a `number`, date or time field, or `any`.
|
|
37
|
+
* @attr {number} maxlength - The most characters it takes.
|
|
37
38
|
* @attr {string} hint - One line of help under the field.
|
|
38
39
|
* @attr {string} info - Longer help, opened from an (i) button by the label.
|
|
39
40
|
* @attr {string} error - An error under the field, which marks it invalid and is announced.
|
|
@@ -63,6 +64,7 @@ export class GwInput extends LightElement {
|
|
|
63
64
|
min: {},
|
|
64
65
|
max: {},
|
|
65
66
|
step: {},
|
|
67
|
+
maxlength: { type: "number" },
|
|
66
68
|
hint: {},
|
|
67
69
|
info: {},
|
|
68
70
|
error: {},
|
|
@@ -92,6 +94,8 @@ export class GwInput extends LightElement {
|
|
|
92
94
|
declare max: string;
|
|
93
95
|
/** The step between values of a number, date or time field. */
|
|
94
96
|
declare step: string;
|
|
97
|
+
/** The most characters it takes, or 0 for no limit. */
|
|
98
|
+
declare maxlength: number;
|
|
95
99
|
declare hint: string;
|
|
96
100
|
/** Longer help, opened from an (i) button by the label. */
|
|
97
101
|
declare info: string;
|
|
@@ -172,6 +176,7 @@ export class GwInput extends LightElement {
|
|
|
172
176
|
this.min = "";
|
|
173
177
|
this.max = "";
|
|
174
178
|
this.step = "";
|
|
179
|
+
this.maxlength = 0;
|
|
175
180
|
this.hint = "";
|
|
176
181
|
this.info = "";
|
|
177
182
|
this.error = "";
|
|
@@ -271,6 +276,11 @@ export class GwInput extends LightElement {
|
|
|
271
276
|
setAttribute(this.#input, "min", this.min || null);
|
|
272
277
|
setAttribute(this.#input, "max", this.max || null);
|
|
273
278
|
setAttribute(this.#input, "step", this.step || null);
|
|
279
|
+
setAttribute(
|
|
280
|
+
control,
|
|
281
|
+
"maxlength",
|
|
282
|
+
this.maxlength > 0 ? String(this.maxlength) : null,
|
|
283
|
+
);
|
|
274
284
|
setAttribute(control, "spellcheck", this.monospace ? "false" : null);
|
|
275
285
|
setAttribute(control, "aria-invalid", this.error ? "true" : null);
|
|
276
286
|
setAttribute(control, "aria-describedby", described || null);
|
package/src/gw-notification.ts
CHANGED
|
@@ -28,6 +28,7 @@ const closeIcon =
|
|
|
28
28
|
* @attr {"neutral"|"accent"|"info"|"success"|"warning"|"danger"|"important"} tone - The icon's color. Defaults to `neutral`.
|
|
29
29
|
* @attr {string} time - When it happened, as shown, such as `2 min ago`.
|
|
30
30
|
* @attr {boolean} unread - Marks it with a stripe until it's seen.
|
|
31
|
+
* @attr {string} dismiss-label - The close button's name, for an app in another language. Defaults to `Dismiss`.
|
|
31
32
|
*
|
|
32
33
|
* @slot - A line of text.
|
|
33
34
|
* @slot actions - Up to two buttons.
|
|
@@ -45,6 +46,7 @@ export class GwNotification extends GwElement {
|
|
|
45
46
|
tone: { reflect: true },
|
|
46
47
|
time: {},
|
|
47
48
|
unread: { type: "boolean", reflect: true },
|
|
49
|
+
dismissLabel: { attribute: "dismiss-label" },
|
|
48
50
|
} as const;
|
|
49
51
|
|
|
50
52
|
static override styles = [
|
|
@@ -129,6 +131,7 @@ export class GwNotification extends GwElement {
|
|
|
129
131
|
declare tone: Tone;
|
|
130
132
|
declare time: string;
|
|
131
133
|
declare unread: boolean;
|
|
134
|
+
declare dismissLabel: string;
|
|
132
135
|
|
|
133
136
|
readonly #icon = createIcon("");
|
|
134
137
|
|
|
@@ -156,6 +159,7 @@ export class GwNotification extends GwElement {
|
|
|
156
159
|
this.tone = "neutral";
|
|
157
160
|
this.time = "";
|
|
158
161
|
this.unread = false;
|
|
162
|
+
this.dismissLabel = "Dismiss";
|
|
159
163
|
}
|
|
160
164
|
|
|
161
165
|
/** Fires `dismiss`, then folds away and removes itself unless that's cancelled. */
|
|
@@ -212,6 +216,7 @@ export class GwNotification extends GwElement {
|
|
|
212
216
|
this.#heading.textContent = this.heading;
|
|
213
217
|
this.#heading.hidden = !this.heading;
|
|
214
218
|
this.#time.textContent = this.time;
|
|
219
|
+
this.#close.textContent = this.dismissLabel;
|
|
215
220
|
}
|
|
216
221
|
}
|
|
217
222
|
|
package/src/gw-popover.ts
CHANGED
|
@@ -35,6 +35,9 @@ const sheetBelow = 600;
|
|
|
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
37
|
* @attr {string} close-label - The close button's name, for an app in another language. Defaults to `Close`.
|
|
38
|
+
* @attr {string} discard-question - The question asked before closing with edits, for an app in another language. Defaults to `Discard your changes?`.
|
|
39
|
+
* @attr {string} keep-label - The button that goes back to editing. Defaults to `Keep editing`.
|
|
40
|
+
* @attr {string} discard-label - The button that throws the edits away. Defaults to `Discard`.
|
|
38
41
|
*
|
|
39
42
|
* @slot - The content.
|
|
40
43
|
* @slot actions - Buttons; one with a `value` closes it with that value.
|
|
@@ -53,6 +56,9 @@ export class GwPopover extends GwElement {
|
|
|
53
56
|
heading: {},
|
|
54
57
|
confirm: { type: "boolean" },
|
|
55
58
|
closeLabel: { attribute: "close-label" },
|
|
59
|
+
discardQuestion: { attribute: "discard-question" },
|
|
60
|
+
keepLabel: { attribute: "keep-label" },
|
|
61
|
+
discardLabel: { attribute: "discard-label" },
|
|
56
62
|
} as const;
|
|
57
63
|
|
|
58
64
|
static override styles = [
|
|
@@ -197,6 +203,9 @@ export class GwPopover extends GwElement {
|
|
|
197
203
|
declare confirm: boolean;
|
|
198
204
|
/** The close button's name, for an app in another language. */
|
|
199
205
|
declare closeLabel: string;
|
|
206
|
+
declare discardQuestion: string;
|
|
207
|
+
declare keepLabel: string;
|
|
208
|
+
declare discardLabel: string;
|
|
200
209
|
|
|
201
210
|
/** The value of the action that closed it, or "" for Esc or a click outside. */
|
|
202
211
|
returnValue = "";
|
|
@@ -252,6 +261,9 @@ export class GwPopover extends GwElement {
|
|
|
252
261
|
this.heading = "";
|
|
253
262
|
this.confirm = false;
|
|
254
263
|
this.closeLabel = "Close";
|
|
264
|
+
this.discardQuestion = "Discard your changes?";
|
|
265
|
+
this.keepLabel = "Keep editing";
|
|
266
|
+
this.discardLabel = "Discard";
|
|
255
267
|
}
|
|
256
268
|
|
|
257
269
|
/** Whether its content has changed since it opened, so closing it asks first. */
|
|
@@ -399,6 +411,11 @@ export class GwPopover extends GwElement {
|
|
|
399
411
|
this.#heading.textContent = this.heading;
|
|
400
412
|
this.#heading.hidden = !this.heading;
|
|
401
413
|
this.#closeButton.textContent = this.closeLabel;
|
|
414
|
+
this.#dismissal.text(
|
|
415
|
+
this.discardQuestion,
|
|
416
|
+
this.keepLabel,
|
|
417
|
+
this.discardLabel,
|
|
418
|
+
);
|
|
402
419
|
}
|
|
403
420
|
}
|
|
404
421
|
|
package/src/gw-select.ts
CHANGED
|
@@ -63,6 +63,7 @@ const chevronIcon =
|
|
|
63
63
|
* @attr {boolean} label-hidden - Hides the label but keeps it for assistive technology.
|
|
64
64
|
* @attr {boolean} inline-label - Shows the label inside the trigger, before the value, for toolbars and filters.
|
|
65
65
|
* @attr {"xs"|"small"|"medium"|"large"|"xl"} size - The field's size, 40px tall at medium. Defaults to `medium`.
|
|
66
|
+
* @attr {string} clear-label - The button that clears a multiple choice, for an app in another language. Defaults to `Clear`.
|
|
66
67
|
*
|
|
67
68
|
* @cssprop --gw-field-scale - Scales the field, around 1 for medium.
|
|
68
69
|
* @cssprop --gw-control-scale - Scales its height with the theme's density. The theme sets it.
|
|
@@ -86,6 +87,7 @@ export class GwSelect extends LightElement {
|
|
|
86
87
|
labelHidden: { type: "boolean", attribute: "label-hidden" },
|
|
87
88
|
inlineLabel: { type: "boolean", attribute: "inline-label", reflect: true },
|
|
88
89
|
size: { reflect: true },
|
|
90
|
+
clearLabel: { attribute: "clear-label" },
|
|
89
91
|
} as const;
|
|
90
92
|
|
|
91
93
|
declare label: string;
|
|
@@ -105,6 +107,7 @@ export class GwSelect extends LightElement {
|
|
|
105
107
|
declare labelHidden: boolean;
|
|
106
108
|
declare inlineLabel: boolean;
|
|
107
109
|
declare size: "xs" | "small" | "medium" | "large" | "xl";
|
|
110
|
+
declare clearLabel: string;
|
|
108
111
|
|
|
109
112
|
readonly #id = fieldId();
|
|
110
113
|
|
|
@@ -179,6 +182,7 @@ export class GwSelect extends LightElement {
|
|
|
179
182
|
this.labelHidden = false;
|
|
180
183
|
this.inlineLabel = false;
|
|
181
184
|
this.size = "medium";
|
|
185
|
+
this.clearLabel = "Clear";
|
|
182
186
|
}
|
|
183
187
|
|
|
184
188
|
/** Opens the list, such as from a keyboard shortcut. */
|
|
@@ -439,6 +443,7 @@ export class GwSelect extends LightElement {
|
|
|
439
443
|
: []),
|
|
440
444
|
);
|
|
441
445
|
this.#clear.hidden = !this.multiple || values.length === 0;
|
|
446
|
+
this.#clear.textContent = this.clearLabel;
|
|
442
447
|
|
|
443
448
|
const list = this.#list;
|
|
444
449
|
|