@grayscale-dev/dragon 0.1.9 → 0.1.10

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/README.md CHANGED
@@ -149,13 +149,13 @@ dui-input::part(input) {
149
149
  Use `prefix` and `suffix` to show fixed text around the user value.
150
150
 
151
151
  - Affixes are always displayed in the input.
152
- - Regex masking still applies to what the user types (`value` stays unprefixed/unsuffixed).
152
+ - Input masking still applies to what the user types (`value` stays unprefixed/unsuffixed).
153
153
 
154
154
  Example:
155
155
 
156
156
  ```html
157
- <dui-input label="Amount" prefix="$" regex="^\\d*$"></dui-input>
158
- <dui-input label="Width" suffix="px" regex="^\\d*$"></dui-input>
157
+ <dui-input label="Amount" prefix="$" input-mask="9{1,10}"></dui-input>
158
+ <dui-input label="Width" suffix="px" input-mask="9{1,10}"></dui-input>
159
159
  ```
160
160
 
161
161
  **Template Masks**
@@ -164,7 +164,7 @@ Use `template` to keep literal characters visible while `x` positions are filled
164
164
 
165
165
  - `x` = value slot
166
166
  - Non-`x` characters stay visible in the field
167
- - Works with `regex`, `prefix`, and `suffix`
167
+ - Works with `input-mask`, `prefix`, and `suffix`
168
168
 
169
169
  Example:
170
170
 
@@ -172,7 +172,7 @@ Example:
172
172
  <dui-input
173
173
  label="Phone"
174
174
  template="(xxx) xxx-xxxx"
175
- regex="^\\d*$"
175
+ input-mask="9{1,10}"
176
176
  ></dui-input>
177
177
  ```
178
178
 
@@ -180,12 +180,12 @@ Typing `8` shows `(8xx) xxx-xxxx`.
180
180
 
181
181
  **Masking**
182
182
 
183
- `regex` uses the IMask regex engine with full JavaScript `RegExp` syntax.
183
+ `input-mask` uses the Inputmask pattern syntax.
184
184
 
185
- - Example single digit: `\d`
186
- - Example unlimited digits: `\d*`
187
- - Example phone validation shape: `^\(\d{3}\)\s\d{3}-\d{4}$`
188
- - As the user types, input is constrained by the regex.
185
+ - Example 4 digits: `9999`
186
+ - Example 1-10 digits: `9{1,10}`
187
+ - Example phone shape: `(999) 999-9999`
188
+ - As the user types, input is constrained by the mask.
189
189
 
190
190
  Example:
191
191
 
@@ -193,7 +193,7 @@ Example:
193
193
  <dui-input
194
194
  label="Phone"
195
195
  label-position="floating"
196
- regex="^\(\d{3}\)\s\d{3}-\d{4}$"
196
+ input-mask="(999) 999-9999"
197
197
  ></dui-input>
198
198
  ```
199
199
 
@@ -14,21 +14,19 @@ export declare class DuiInput extends LitElement {
14
14
  autocomplete?: string;
15
15
  label: string;
16
16
  labelPosition: 'floating' | 'above';
17
- regex: string;
17
+ inputMask: string;
18
18
  private inputEl?;
19
19
  private internals?;
20
20
  private defaultValue?;
21
- private compiledRegex;
22
21
  constructor();
23
22
  connectedCallback(): void;
24
- willUpdate(changed: Map<string, unknown>): void;
25
23
  updated(changed: Map<string, unknown>): void;
26
24
  focus(options?: FocusOptions): void;
27
25
  blur(): void;
28
26
  formResetCallback(): void;
29
27
  formStateRestoreCallback(state: unknown): void;
30
28
  formDisabledCallback(disabled: boolean): void;
31
- private normalizeWithRegex;
29
+ private normalizeWithInputMask;
32
30
  private stripAffixes;
33
31
  private getTemplateCapacity;
34
32
  private capToTemplate;