@ekzo-dev/bootstrap-addons 5.2.19 → 5.2.21

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ekzo-dev/bootstrap-addons",
3
3
  "description": "Aurelia Bootstrap additional component",
4
- "version": "5.2.19",
4
+ "version": "5.2.21",
5
5
  "homepage": "https://github.com/ekzo-dev/aurelia-components/tree/main/packages/bootstrap-addons",
6
6
  "repository": {
7
7
  "type": "git",
@@ -1,19 +1,26 @@
1
1
  <template class="${floatingLabel ? 'form-floating' : ''}">
2
2
  <label for="${id}" if.bind="label && !floatingLabel" class="form-label">${label}</label>
3
- <fieldset class="${classes}" id="${id}" disabled.bind="disabled">
4
- <input type="number" min="0" value.bind="duration.years" disabled.bind="disabled" placeholder="--" />
5
- ${labels.years}
6
- <input type="number" min="0" value.bind="duration.months" disabled.bind="disabled" placeholder="--" />
7
- ${labels.months}
8
- <input type="number" min="0" value.bind="duration.days" disabled.bind="disabled" placeholder="--" />
9
- ${labels.days}
10
- <input type="number" min="0" value.bind="duration.hours" disabled.bind="disabled" placeholder="--" />
11
- ${labels.hours}
12
- <input type="number" min="0" value.bind="duration.minutes" disabled.bind="disabled" placeholder="--" />
13
- ${labels.minutes}
14
- <input type="number" min="0" value.bind="duration.seconds" disabled.bind="disabled" placeholder="--" />
15
- ${labels.seconds}
16
- <input if.bind="required" required value.bind="value" />
3
+ <fieldset class="${classes}" disabled.bind="disabled">
4
+ <input
5
+ type="text"
6
+ id="${id}"
7
+ required.bind="required"
8
+ value.bind="value"
9
+ form.bind="form & attr"
10
+ focus.trigger="focus()"
11
+ />
12
+ <input type="number" min="0" value.bind="duration.years" placeholder="--" />
13
+ <span>${labels.years}</span>
14
+ <input type="number" min="0" value.bind="duration.months" placeholder="--" />
15
+ <span>${labels.months}</span>
16
+ <input type="number" min="0" value.bind="duration.days" placeholder="--" />
17
+ <span>${labels.days}</span>
18
+ <input type="number" min="0" value.bind="duration.hours" placeholder="--" />
19
+ <span>${labels.hours}</span>
20
+ <input type="number" min="0" value.bind="duration.minutes" placeholder="--" />
21
+ <span>${labels.minutes}</span>
22
+ <input type="number" min="0" value.bind="duration.seconds" placeholder="--" />
23
+ <span>${labels.seconds}</span>
17
24
  </fieldset>
18
25
  <label for="${id}" if.bind="label && floatingLabel"><span>${label}</span></label>
19
26
  <div class="invalid-feedback" if.bind="invalidFeedback">${invalidFeedback}</div>
@@ -24,6 +24,10 @@ bs-duration-input {
24
24
  box-shadow: $input-focus-box-shadow;
25
25
  }
26
26
  }
27
+
28
+ span {
29
+ user-select: none;
30
+ }
27
31
  }
28
32
 
29
33
  input[type='number'] {
@@ -33,6 +37,7 @@ bs-duration-input {
33
37
  outline: 0;
34
38
  text-align: right;
35
39
  field-sizing: content;
40
+ background: transparent;
36
41
 
37
42
  &::-webkit-outer-spin-button,
38
43
  &::-webkit-inner-spin-button {
@@ -41,7 +46,7 @@ bs-duration-input {
41
46
  }
42
47
  }
43
48
 
44
- input[required] {
49
+ input[type='text'] {
45
50
  position: absolute;
46
51
  height: 100%;
47
52
  width: 100%;
@@ -33,7 +33,6 @@ const Validation: Story = (args): StoryFnAureliaReturnType => ({
33
33
 
34
34
  Validation.args = {
35
35
  required: true,
36
- floatingLabel: true,
37
36
  };
38
37
 
39
38
  // eslint-disable-next-line
@@ -17,6 +17,10 @@ interface IDuration {
17
17
  seconds?: string;
18
18
  }
19
19
 
20
+ /**
21
+ * https://github.com/whatwg/html/issues/5488
22
+ * https://github.com/tc39/proposal-intl-duration-format
23
+ */
20
24
  @customElement({
21
25
  name: 'bs-duration-input',
22
26
  template,
@@ -89,6 +93,10 @@ export class BsDurationInput extends BaseField implements EventListenerObject {
89
93
  }
90
94
  }
91
95
 
96
+ focus() {
97
+ this.controls.item(0).focus();
98
+ }
99
+
92
100
  private parseDuration(value: string) {
93
101
  const match = value?.match(/^P(?:(\d+)Y)?(?:(\d+)M)?(?:(\d+)D)?(?:T(?:(\d+)H)?(?:(\d+)M)?(?:(\d+)S)?)?$/);
94
102
 
@@ -190,9 +190,16 @@ export class BsJsonInput {
190
190
  }
191
191
 
192
192
  #initAjv($schema: string, ajvOptions: Options): Ajv {
193
+ const regExp = (pattern: string) => new RegExp(pattern, 'v');
194
+
195
+ regExp.code = 'regexp';
196
+
193
197
  const options: Options = {
194
198
  strict: false,
195
199
  multipleOfPrecision: 2,
200
+ code: {
201
+ regExp,
202
+ },
196
203
  ...ajvOptions,
197
204
  };
198
205
  let ajv: Ajv;