@umbraco-ui/uui-input-lock 1.13.0 → 1.14.0-rc.1

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.
@@ -11,6 +11,18 @@
11
11
  "type": "boolean",
12
12
  "default": "\"true\""
13
13
  },
14
+ {
15
+ "name": "unlock-label",
16
+ "description": "Define the label for the unlock button.",
17
+ "type": "string",
18
+ "default": "\"true\""
19
+ },
20
+ {
21
+ "name": "lock-label",
22
+ "description": "Define the label for the lock button.",
23
+ "type": "string",
24
+ "default": "\"true\""
25
+ },
14
26
  {
15
27
  "name": "min",
16
28
  "description": "Sets the min value of the input.\nExamples: the first date the user may pick in date and datetime-local, or the min numeric value the user can pick in a number input.",
@@ -26,7 +38,7 @@
26
38
  {
27
39
  "name": "minlength-message",
28
40
  "description": "Minlength validation message.",
29
- "type": "string",
41
+ "type": "string | ((charsLeft: number) => string)",
30
42
  "default": "\"\""
31
43
  },
32
44
  {
@@ -44,7 +56,7 @@
44
56
  {
45
57
  "name": "maxlength-message",
46
58
  "description": "Maxlength validation message.",
47
- "type": "string",
59
+ "type": "string | ((max: number, current: number) => string)",
48
60
  "default": "\"\""
49
61
  },
50
62
  {
@@ -86,7 +98,13 @@
86
98
  {
87
99
  "name": "type",
88
100
  "description": "This property specifies the type of input that will be rendered.",
89
- "type": "'text' | 'tel'| 'url'| 'email'| 'password'| 'date'| 'month'| 'week'| 'time'| 'datetime-local'| 'number'| 'color'",
101
+ "type": "'text' | 'tel' | 'url' | 'email' | 'password' | 'date' | 'month' | 'week' | 'time' | 'datetime-local' | 'number' | 'color'",
102
+ "default": "\"text\""
103
+ },
104
+ {
105
+ "name": "inputmode",
106
+ "description": "The inputmode global attribute is an enumerated attribute that hints at the type of data that might be entered by the user while editing the element or its contents. This allows a browser to display an appropriate virtual keyboard.",
107
+ "type": "'text' | 'none' | 'decimal' | 'number' | 'tel' | 'search' | 'email' | 'url'",
90
108
  "default": "\"text\""
91
109
  },
92
110
  {
@@ -95,10 +113,10 @@
95
113
  "type": "string"
96
114
  },
97
115
  {
98
- "name": "inputMode",
99
- "description": "The inputmode global attribute is an enumerated attribute that hints at the type of data that might be entered by the user while editing the element or its contents. This allows a browser to display an appropriate virtual keyboard.",
100
- "type": "string",
101
- "default": "\"\""
116
+ "name": "tabindex",
117
+ "description": "Set the input tabindex, set this to `-1` to avoid tabbing into the input.",
118
+ "type": "number",
119
+ "default": "-1"
102
120
  },
103
121
  {
104
122
  "name": "spellcheck",
@@ -161,6 +179,20 @@
161
179
  "type": "boolean",
162
180
  "default": "\"true\""
163
181
  },
182
+ {
183
+ "name": "unlockLabel",
184
+ "attribute": "unlock-label",
185
+ "description": "Define the label for the unlock button.",
186
+ "type": "string",
187
+ "default": "\"true\""
188
+ },
189
+ {
190
+ "name": "lockLabel",
191
+ "attribute": "lock-label",
192
+ "description": "Define the label for the lock button.",
193
+ "type": "string",
194
+ "default": "\"true\""
195
+ },
164
196
  {
165
197
  "name": "min",
166
198
  "attribute": "min",
@@ -179,7 +211,7 @@
179
211
  "name": "minlengthMessage",
180
212
  "attribute": "minlength-message",
181
213
  "description": "Minlength validation message.",
182
- "type": "string",
214
+ "type": "string | ((charsLeft: number) => string)",
183
215
  "default": "\"\""
184
216
  },
185
217
  {
@@ -200,7 +232,7 @@
200
232
  "name": "maxlengthMessage",
201
233
  "attribute": "maxlength-message",
202
234
  "description": "Maxlength validation message.",
203
- "type": "string",
235
+ "type": "string | ((max: number, current: number) => string)",
204
236
  "default": "\"\""
205
237
  },
206
238
  {
@@ -249,7 +281,14 @@
249
281
  "name": "type",
250
282
  "attribute": "type",
251
283
  "description": "This property specifies the type of input that will be rendered.",
252
- "type": "'text' | 'tel'| 'url'| 'email'| 'password'| 'date'| 'month'| 'week'| 'time'| 'datetime-local'| 'number'| 'color'",
284
+ "type": "'text' | 'tel' | 'url' | 'email' | 'password' | 'date' | 'month' | 'week' | 'time' | 'datetime-local' | 'number' | 'color'",
285
+ "default": "\"text\""
286
+ },
287
+ {
288
+ "name": "inputMode",
289
+ "attribute": "inputmode",
290
+ "description": "The inputmode global attribute is an enumerated attribute that hints at the type of data that might be entered by the user while editing the element or its contents. This allows a browser to display an appropriate virtual keyboard.",
291
+ "type": "'text' | 'none' | 'decimal' | 'number' | 'tel' | 'search' | 'email' | 'url'",
253
292
  "default": "\"text\""
254
293
  },
255
294
  {
@@ -259,11 +298,11 @@
259
298
  "type": "string"
260
299
  },
261
300
  {
262
- "name": "inputMode",
263
- "attribute": "inputMode",
264
- "description": "The inputmode global attribute is an enumerated attribute that hints at the type of data that might be entered by the user while editing the element or its contents. This allows a browser to display an appropriate virtual keyboard.",
265
- "type": "string",
266
- "default": "\"\""
301
+ "name": "tabIndex",
302
+ "attribute": "tabindex",
303
+ "description": "Set the input tabindex, set this to `-1` to avoid tabbing into the input.",
304
+ "type": "number",
305
+ "default": "-1"
267
306
  },
268
307
  {
269
308
  "name": "styles",
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defineElement } from '@umbraco-ui/uui-base/lib/registration';
2
2
  import { demandCustomElement } from '@umbraco-ui/uui-base/lib/utils';
3
- import { html, css } from 'lit';
3
+ import { css, html } from 'lit';
4
4
  import { UUIInputElement } from '@umbraco-ui/uui-input/lib';
5
5
  import { iconLock, iconUnlock } from '@umbraco-ui/uui-icon-registry-essential/lib/svgs';
6
6
  import { property } from 'lit/decorators.js';
@@ -18,6 +18,9 @@ UUIInputLockEvent.LOCK_CHANGE = "lock-change";
18
18
 
19
19
  var __defProp = Object.defineProperty;
20
20
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
21
+ var __typeError = (msg) => {
22
+ throw TypeError(msg);
23
+ };
21
24
  var __decorateClass = (decorators, target, key, kind) => {
22
25
  var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
23
26
  for (var i = decorators.length - 1, decorator; i >= 0; i--)
@@ -26,11 +29,26 @@ var __decorateClass = (decorators, target, key, kind) => {
26
29
  if (kind && result) __defProp(target, key, result);
27
30
  return result;
28
31
  };
32
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
33
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
34
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
35
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
36
+ var _locked;
29
37
  let UUIInputLockElement = class extends UUIInputElement {
30
38
  constructor() {
31
39
  super();
32
- this.locked = true;
40
+ __privateAdd(this, _locked, true);
41
+ this.unlockLabel = "Unlock input";
42
+ this.lockLabel = "Lock input";
33
43
  this.readonly = true;
44
+ this.tabIndex = -1;
45
+ }
46
+ set locked(lock) {
47
+ __privateSet(this, _locked, lock);
48
+ this.tabIndex = lock ? -1 : 0;
49
+ }
50
+ get locked() {
51
+ return __privateGet(this, _locked);
34
52
  }
35
53
  connectedCallback() {
36
54
  super.connectedCallback();
@@ -41,6 +59,9 @@ let UUIInputLockElement = class extends UUIInputElement {
41
59
  this.readonly = this.locked = !this.locked;
42
60
  this.pristine = false;
43
61
  this.dispatchEvent(new UUIInputLockEvent(UUIInputLockEvent.LOCK_CHANGE));
62
+ if (!this.locked) {
63
+ this._input?.focus();
64
+ }
44
65
  }
45
66
  renderIcon() {
46
67
  return this.locked === true ? html`<uui-icon name="lock" .fallback=${iconLock.strings[0]}></uui-icon>` : html`<uui-icon
@@ -53,11 +74,12 @@ let UUIInputLockElement = class extends UUIInputElement {
53
74
  @click=${this._onLockToggle}
54
75
  compact
55
76
  id="lock"
56
- label="${this.locked ? "Unlock input" : "Lock input"}">
77
+ label="${this.locked ? this.unlockLabel : this.lockLabel}">
57
78
  ${this.renderIcon()}
58
79
  </uui-button>`;
59
80
  }
60
81
  };
82
+ _locked = new WeakMap();
61
83
  UUIInputLockElement.styles = [
62
84
  ...UUIInputElement.styles,
63
85
  css`
@@ -77,7 +99,13 @@ UUIInputLockElement.styles = [
77
99
  ];
78
100
  __decorateClass([
79
101
  property({ type: Boolean, reflect: true })
80
- ], UUIInputLockElement.prototype, "locked", 2);
102
+ ], UUIInputLockElement.prototype, "locked", 1);
103
+ __decorateClass([
104
+ property({ type: String, reflect: false, attribute: "unlock-label" })
105
+ ], UUIInputLockElement.prototype, "unlockLabel", 2);
106
+ __decorateClass([
107
+ property({ type: String, reflect: false, attribute: "lock-label" })
108
+ ], UUIInputLockElement.prototype, "lockLabel", 2);
81
109
  UUIInputLockElement = __decorateClass([
82
110
  defineElement("uui-input-lock")
83
111
  ], UUIInputLockElement);
@@ -4,13 +4,29 @@ import { UUIInputElement } from '@umbraco-ui/uui-input/lib';
4
4
  * @extends uui-input
5
5
  */
6
6
  export declare class UUIInputLockElement extends UUIInputElement {
7
+ #private;
7
8
  /**
8
9
  * Determine the inputs locked state.
9
10
  * @type {boolean}
10
11
  * @attr
11
12
  * @default true
12
13
  */
13
- locked: boolean;
14
+ set locked(lock: boolean);
15
+ get locked(): boolean;
16
+ /**
17
+ * Define the label for the unlock button.
18
+ * @type {string}
19
+ * @attr
20
+ * @default true
21
+ */
22
+ unlockLabel: string;
23
+ /**
24
+ * Define the label for the lock button.
25
+ * @type {string}
26
+ * @attr
27
+ * @default true
28
+ */
29
+ lockLabel: string;
14
30
  constructor();
15
31
  connectedCallback(): void;
16
32
  _onLockToggle(): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umbraco-ui/uui-input-lock",
3
- "version": "1.13.0",
3
+ "version": "1.14.0-rc.1",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "Umbraco",
@@ -30,10 +30,10 @@
30
30
  "custom-elements.json"
31
31
  ],
32
32
  "dependencies": {
33
- "@umbraco-ui/uui-base": "1.13.0",
34
- "@umbraco-ui/uui-button": "1.13.0",
35
- "@umbraco-ui/uui-icon": "1.13.0",
36
- "@umbraco-ui/uui-input": "1.13.0"
33
+ "@umbraco-ui/uui-base": "1.14.0-rc.1",
34
+ "@umbraco-ui/uui-button": "1.14.0-rc.1",
35
+ "@umbraco-ui/uui-icon": "1.14.0-rc.1",
36
+ "@umbraco-ui/uui-input": "1.14.0-rc.1"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "npm run analyze && tsc --build && rollup -c rollup.config.js",
@@ -44,5 +44,5 @@
44
44
  "access": "public"
45
45
  },
46
46
  "homepage": "https://uui.umbraco.com/?path=/story/uui-input-lock",
47
- "gitHead": "f57b1fdfea3678b843fbec706cecb3a220f6046f"
47
+ "gitHead": "c3c2fc0f8a68b897b5c88e0c3e09f549150f1034"
48
48
  }