@lion/ui 0.11.1 → 0.11.3

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.
Files changed (228) hide show
  1. package/README.md +2 -2
  2. package/components/combobox/src/LionCombobox.js +1 -3
  3. package/components/combobox/test/lion-combobox.test.js +126 -1
  4. package/components/localize/src/date/parseDate.js +6 -1
  5. package/components/localize/src/date/utils/checkYearFormat.js +8 -0
  6. package/components/localize/test/date/parseDate.test.js +6 -0
  7. package/custom-elements.json +33 -0
  8. package/dist-types/components/combobox/src/LionCombobox.d.ts.map +1 -1
  9. package/dist-types/components/localize/src/date/parseDate.d.ts.map +1 -1
  10. package/dist-types/components/localize/src/date/utils/checkYearFormat.d.ts +7 -0
  11. package/dist-types/components/localize/src/date/utils/checkYearFormat.d.ts.map +1 -0
  12. package/dist-types/tsconfig.tsbuildinfo +1 -1
  13. package/docs/components/accordion/api-table.md +13 -1
  14. package/docs/components/accordion/index.md +10 -0
  15. package/docs/components/accordion/overview.md +13 -1
  16. package/docs/components/accordion/reference.md +13 -1
  17. package/docs/components/accordion/use-cases.md +13 -1
  18. package/docs/components/button/api-table.md +13 -1
  19. package/docs/components/button/examples.md +13 -1
  20. package/docs/components/button/extensions.md +13 -1
  21. package/docs/components/button/index.md +11 -1
  22. package/docs/components/button/overview.md +13 -1
  23. package/docs/components/button/use-cases.md +13 -1
  24. package/docs/components/calendar/api-table.md +13 -1
  25. package/docs/components/calendar/index.md +11 -1
  26. package/docs/components/calendar/overview.md +13 -1
  27. package/docs/components/calendar/use-cases.md +13 -1
  28. package/docs/components/checkbox-group/api-table.md +13 -1
  29. package/docs/components/checkbox-group/index.md +11 -1
  30. package/docs/components/checkbox-group/overview.md +15 -3
  31. package/docs/components/checkbox-group/use-cases.md +13 -1
  32. package/docs/components/collapsible/api-table.md +13 -1
  33. package/docs/components/collapsible/examples.md +13 -1
  34. package/docs/components/collapsible/index.md +11 -1
  35. package/docs/components/collapsible/overview.md +14 -2
  36. package/docs/components/collapsible/use-cases.md +13 -1
  37. package/docs/components/combobox/api-table.md +13 -1
  38. package/docs/components/combobox/extensions.md +13 -1
  39. package/docs/components/combobox/index.md +11 -1
  40. package/docs/components/combobox/overview.md +14 -2
  41. package/docs/components/combobox/use-cases.md +14 -2
  42. package/docs/components/dialog/api-table.md +13 -1
  43. package/docs/components/dialog/index.md +11 -1
  44. package/docs/components/dialog/overview.md +14 -2
  45. package/docs/components/dialog/use-cases.md +13 -1
  46. package/docs/components/drawer/api-table.md +13 -1
  47. package/docs/components/drawer/index.md +11 -1
  48. package/docs/components/drawer/overview.md +13 -1
  49. package/docs/components/drawer/use-cases.md +13 -1
  50. package/docs/components/fieldset/api-table.md +13 -1
  51. package/docs/components/fieldset/index.md +11 -1
  52. package/docs/components/fieldset/overview.md +18 -6
  53. package/docs/components/fieldset/use-cases.md +13 -1
  54. package/docs/components/form/api-table.md +12 -1
  55. package/docs/components/form/index.md +11 -1
  56. package/docs/components/form/overview.md +16 -4
  57. package/docs/components/form/use-cases.md +15 -3
  58. package/docs/components/icon/api-table.md +13 -1
  59. package/docs/components/icon/index.md +11 -1
  60. package/docs/components/icon/overview.md +13 -1
  61. package/docs/components/icon/use-cases.md +14 -2
  62. package/docs/components/index.md +11 -1
  63. package/docs/components/input/api-table.md +13 -1
  64. package/docs/components/input/index.md +11 -1
  65. package/docs/components/input/overview.md +14 -2
  66. package/docs/components/input/use-cases.md +13 -1
  67. package/docs/components/input-amount/api-table.md +13 -1
  68. package/docs/components/input-amount/index.md +11 -1
  69. package/docs/components/input-amount/overview.md +16 -4
  70. package/docs/components/input-amount/use-cases.md +13 -1
  71. package/docs/components/input-date/api-table.md +13 -1
  72. package/docs/components/input-date/index.md +11 -1
  73. package/docs/components/input-date/overview.md +16 -4
  74. package/docs/components/input-date/use-cases.md +13 -1
  75. package/docs/components/input-datepicker/api-table.md +13 -1
  76. package/docs/components/input-datepicker/index.md +11 -1
  77. package/docs/components/input-datepicker/overview.md +18 -6
  78. package/docs/components/input-datepicker/use-cases.md +13 -1
  79. package/docs/components/input-email/api-table.md +13 -1
  80. package/docs/components/input-email/index.md +11 -1
  81. package/docs/components/input-email/overview.md +15 -3
  82. package/docs/components/input-email/use-cases.md +13 -1
  83. package/docs/components/input-file/api-table.md +13 -1
  84. package/docs/components/input-file/index.md +11 -1
  85. package/docs/components/input-file/overview.md +14 -2
  86. package/docs/components/input-file/use-cases.md +13 -1
  87. package/docs/components/input-iban/api-table.md +13 -1
  88. package/docs/components/input-iban/index.md +11 -1
  89. package/docs/components/input-iban/overview.md +15 -3
  90. package/docs/components/input-iban/use-cases.md +13 -1
  91. package/docs/components/input-range/api-table.md +13 -1
  92. package/docs/components/input-range/index.md +11 -1
  93. package/docs/components/input-range/overview.md +15 -3
  94. package/docs/components/input-range/use-cases.md +13 -1
  95. package/docs/components/input-stepper/api-table.md +13 -1
  96. package/docs/components/input-stepper/index.md +11 -1
  97. package/docs/components/input-stepper/overview.md +14 -2
  98. package/docs/components/input-stepper/use-cases.md +13 -1
  99. package/docs/components/input-tel/api-table.md +13 -1
  100. package/docs/components/input-tel/index.md +11 -1
  101. package/docs/components/input-tel/overview.md +14 -2
  102. package/docs/components/input-tel/use-cases.md +19 -7
  103. package/docs/components/input-tel-dropdown/api-table.md +13 -1
  104. package/docs/components/input-tel-dropdown/extensions.md +13 -1
  105. package/docs/components/input-tel-dropdown/index.md +11 -1
  106. package/docs/components/input-tel-dropdown/overview.md +14 -2
  107. package/docs/components/input-tel-dropdown/use-cases.md +13 -1
  108. package/docs/components/listbox/api-table.md +13 -1
  109. package/docs/components/listbox/index.md +11 -1
  110. package/docs/components/listbox/overview.md +13 -1
  111. package/docs/components/listbox/use-cases.md +14 -2
  112. package/docs/components/pagination/api-table.md +13 -1
  113. package/docs/components/pagination/index.md +11 -1
  114. package/docs/components/pagination/overview.md +13 -1
  115. package/docs/components/pagination/use-cases.md +13 -1
  116. package/docs/components/progress-indicator/api-table.md +13 -1
  117. package/docs/components/progress-indicator/examples.md +13 -1
  118. package/docs/components/progress-indicator/index.md +11 -1
  119. package/docs/components/progress-indicator/overview.md +13 -1
  120. package/docs/components/radio-group/api-table.md +13 -1
  121. package/docs/components/radio-group/index.md +11 -1
  122. package/docs/components/radio-group/overview.md +16 -4
  123. package/docs/components/radio-group/use-cases.md +13 -1
  124. package/docs/components/select/api-table.md +13 -1
  125. package/docs/components/select/index.md +11 -1
  126. package/docs/components/select/overview.md +13 -1
  127. package/docs/components/select/use-cases.md +14 -2
  128. package/docs/components/select-rich/api-table.md +13 -1
  129. package/docs/components/select-rich/examples.md +13 -1
  130. package/docs/components/select-rich/index.md +11 -1
  131. package/docs/components/select-rich/overview.md +13 -1
  132. package/docs/components/select-rich/use-cases.md +14 -2
  133. package/docs/components/steps/api-table.md +13 -1
  134. package/docs/components/steps/index.md +11 -1
  135. package/docs/components/steps/overview.md +13 -1
  136. package/docs/components/steps/use-cases.md +13 -1
  137. package/docs/components/switch/api-table.md +13 -1
  138. package/docs/components/switch/index.md +11 -1
  139. package/docs/components/switch/overview.md +13 -1
  140. package/docs/components/switch/reference.md +13 -1
  141. package/docs/components/switch/use-cases.md +13 -1
  142. package/docs/components/tabs/api-table.md +13 -1
  143. package/docs/components/tabs/examples.md +14 -2
  144. package/docs/components/tabs/index.md +11 -1
  145. package/docs/components/tabs/overview.md +13 -1
  146. package/docs/components/tabs/use-cases.md +13 -1
  147. package/docs/components/textarea/api-table.md +13 -1
  148. package/docs/components/textarea/index.md +11 -1
  149. package/docs/components/textarea/overview.md +13 -1
  150. package/docs/components/textarea/use-cases.md +13 -1
  151. package/docs/components/tooltip/api-table.md +13 -1
  152. package/docs/components/tooltip/examples.md +13 -1
  153. package/docs/components/tooltip/index.md +11 -1
  154. package/docs/components/tooltip/overview.md +13 -1
  155. package/docs/components/tooltip/use-cases.md +13 -1
  156. package/docs/fundamentals/index.md +4 -4
  157. package/docs/fundamentals/node-tools/babel-plugin-extend-docs/index.md +12 -0
  158. package/docs/fundamentals/node-tools/babel-plugin-extend-docs/overview.md +13 -0
  159. package/docs/fundamentals/node-tools/index.md +10 -0
  160. package/docs/fundamentals/node-tools/providence-analytics/index.md +12 -0
  161. package/docs/fundamentals/node-tools/providence-analytics/overview.md +13 -0
  162. package/docs/fundamentals/node-tools/publish-docs/index.md +12 -0
  163. package/docs/fundamentals/node-tools/publish-docs/overview.md +16 -3
  164. package/docs/fundamentals/node-tools/remark-extend/index.md +12 -0
  165. package/docs/fundamentals/node-tools/remark-extend/overview.md +13 -0
  166. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/index.md +12 -0
  167. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +15 -2
  168. package/docs/fundamentals/rationales/TypeScript.md +12 -0
  169. package/docs/fundamentals/rationales/accessibility.md +13 -1
  170. package/docs/fundamentals/rationales/index.md +10 -0
  171. package/docs/fundamentals/rationales/side-effects.md +12 -0
  172. package/docs/fundamentals/rationales/versioning.md +12 -0
  173. package/docs/fundamentals/systems/core/SlotMixin.md +14 -1
  174. package/docs/fundamentals/systems/core/api-table.md +14 -1
  175. package/docs/fundamentals/systems/core/index.md +12 -0
  176. package/docs/fundamentals/systems/core/overview.md +14 -1
  177. package/docs/fundamentals/systems/form/api-table.md +14 -1
  178. package/docs/fundamentals/systems/form/formatting-and-parsing.md +17 -4
  179. package/docs/fundamentals/systems/form/index.md +12 -0
  180. package/docs/fundamentals/systems/form/interaction-states.md +13 -0
  181. package/docs/fundamentals/systems/form/model-value.md +14 -1
  182. package/docs/fundamentals/systems/form/overview.md +41 -28
  183. package/docs/fundamentals/systems/form/styling.md +13 -0
  184. package/docs/fundamentals/systems/form/use-cases.md +13 -0
  185. package/docs/fundamentals/systems/form/validate.md +15 -2
  186. package/docs/fundamentals/systems/icon/index.md +12 -0
  187. package/docs/fundamentals/systems/icon/overview.md +13 -0
  188. package/docs/fundamentals/systems/index.md +10 -0
  189. package/docs/fundamentals/systems/localize/api-table.md +14 -1
  190. package/docs/fundamentals/systems/localize/dates.md +13 -0
  191. package/docs/fundamentals/systems/localize/index.md +12 -0
  192. package/docs/fundamentals/systems/localize/numbers.md +13 -0
  193. package/docs/fundamentals/systems/localize/overview.md +17 -4
  194. package/docs/fundamentals/systems/localize/rationale.md +13 -0
  195. package/docs/fundamentals/systems/localize/text.md +13 -0
  196. package/docs/fundamentals/systems/localize/use-cases.md +13 -0
  197. package/docs/fundamentals/systems/overlays/_configuration-positioning.md +11 -0
  198. package/docs/fundamentals/systems/overlays/_edge-cases.md +10 -0
  199. package/docs/fundamentals/systems/overlays/api-table.md +14 -1
  200. package/docs/fundamentals/systems/overlays/configuration.md +15 -2
  201. package/docs/fundamentals/systems/overlays/index.md +12 -0
  202. package/docs/fundamentals/systems/overlays/overview.md +18 -5
  203. package/docs/fundamentals/systems/overlays/rationale.md +13 -0
  204. package/docs/fundamentals/systems/overlays/use-cases.md +15 -2
  205. package/docs/fundamentals/tools/ajax/index.md +12 -0
  206. package/docs/fundamentals/tools/ajax/overview.md +13 -0
  207. package/docs/fundamentals/tools/ajax/use-cases.md +13 -0
  208. package/docs/fundamentals/tools/helpers/action-logger.md +13 -0
  209. package/docs/fundamentals/tools/helpers/index.md +12 -0
  210. package/docs/fundamentals/tools/helpers/overview.md +14 -1
  211. package/docs/fundamentals/tools/index.md +10 -0
  212. package/docs/fundamentals/tools/singleton-manager/example-complex/index.md +13 -0
  213. package/docs/fundamentals/tools/singleton-manager/example-fail/index.md +13 -0
  214. package/docs/fundamentals/tools/singleton-manager/example-success/index.md +13 -0
  215. package/docs/fundamentals/tools/singleton-manager/index.md +12 -0
  216. package/docs/fundamentals/tools/singleton-manager/overview.md +17 -4
  217. package/docs/guides/how-to/create-a-custom-field.md +18 -6
  218. package/docs/guides/how-to/create-a-form.md +17 -5
  219. package/docs/guides/how-to/extend-a-native-input.md +15 -3
  220. package/docs/guides/how-to/get-started.md +13 -1
  221. package/docs/guides/how-to/index.md +11 -1
  222. package/docs/guides/index.md +19 -9
  223. package/docs/guides/principles/definitions-and-terms.md +13 -1
  224. package/docs/guides/principles/index.md +16 -6
  225. package/docs/guides/principles/scoped-elements.md +13 -1
  226. package/docs/guides/principles/styling.md +14 -2
  227. package/docs/guides/principles/subclasser-apis.md +13 -1
  228. package/package.json +1 -1
package/README.md CHANGED
@@ -37,14 +37,14 @@
37
37
  <a href="https://lion.js.org/blog/">Blog</a>
38
38
  </p>
39
39
 
40
- **Lion is a set of highly performant, accessible and flexible Web Components.!**
40
+ **Lion is a set of highly performant, accessible, and flexible Web Components.**
41
41
 
42
42
  They provide an unopinionated, white-label layer that can be extended to your own layer of components.
43
43
 
44
44
  - **High Performance:** Focused on great performance in all relevant browsers with a minimal number of dependencies.
45
45
  - **Accessibility:** Aimed at compliance with the WCAG 2.2 AA standard to create components that are accessible for everybody.
46
46
  - **Flexibility:** Provides solutions through Web Components and JavaScript classes which can be used, adopted and extended to fit all needs.
47
- - **Modern Code:** Lion is distributes as pure es modules.
47
+ - **Modern Code:** Lion is distributed as pure es modules.
48
48
  - **Exposes functions/classes and Web Components:** Ships a functionality in its most appropriate form.
49
49
 
50
50
  > Note: Our demo examples might look simple and not very stylish. This is on purpose. They are designed to be basic so you can easily add your own styles to them to match your intended design, without dealing with styles that are already there.
@@ -1134,7 +1134,7 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
1134
1134
  }
1135
1135
  break;
1136
1136
  case 'Enter':
1137
- if (this.multipleChoice && this.opened) {
1137
+ if (this.opened) {
1138
1138
  ev.preventDefault();
1139
1139
  }
1140
1140
 
@@ -1145,8 +1145,6 @@ export class LionCombobox extends LocalizeMixin(OverlayMixin(CustomChoiceGroupMi
1145
1145
  this.formElements[this.activeIndex].hasAttribute('aria-hidden') ||
1146
1146
  !this.opened)
1147
1147
  ) {
1148
- ev.preventDefault();
1149
-
1150
1148
  this.modelValue = this.parser([...this.modelValue, this._inputNode.value]);
1151
1149
  this._inputNode.value = '';
1152
1150
  this.opened = false;
@@ -1,4 +1,4 @@
1
- import { defineCE, expect, fixture, html, unsafeStatic } from '@open-wc/testing';
1
+ import { defineCE, expect, fixture, html, unsafeStatic, waitUntil } from '@open-wc/testing';
2
2
  import { Required, Unparseable } from '@lion/ui/form-core.js';
3
3
  import { sendKeys } from '@web/test-runner-commands';
4
4
  import { LionCombobox } from '@lion/ui/combobox.js';
@@ -48,6 +48,80 @@ async function fruitFixture({ autocomplete, matchMode } = {}) {
48
48
  }
49
49
 
50
50
  describe('lion-combobox', () => {
51
+ describe('Rendering on API change', () => {
52
+ it('renders when options changed', async () => {
53
+ const entries = [
54
+ {
55
+ id: '1',
56
+ label: 'Apple',
57
+ },
58
+ {
59
+ id: '2',
60
+ label: 'Artichoke',
61
+ },
62
+ {
63
+ id: '3',
64
+ label: 'Asparagus',
65
+ },
66
+ {
67
+ id: '4',
68
+ label: 'Banana',
69
+ },
70
+ {
71
+ id: '5',
72
+ label: 'Pineapple',
73
+ },
74
+ ];
75
+
76
+ class Wrapper extends LitElement {
77
+ static properties = {
78
+ ...super.properties,
79
+ entries: { type: Array },
80
+ };
81
+
82
+ constructor() {
83
+ super();
84
+ this.entries = entries;
85
+ }
86
+
87
+ render() {
88
+ return html`<lion-combobox name="foo">
89
+ ${this.entries.map(
90
+ entry => html`<lion-option .choiceValue="${entry.id}">${entry.label}</lion-option>`,
91
+ )}
92
+ </lion-combobox>`;
93
+ }
94
+ }
95
+
96
+ const tagString = defineCE(Wrapper);
97
+ const tag = unsafeStatic(tagString);
98
+ const wrapperElement = /** @type {Wrapper} */ (await fixture(html`<${tag}></${tag}>`));
99
+ await waitUntil(
100
+ () =>
101
+ wrapperElement?.shadowRoot?.querySelector('lion-options')?.querySelectorAll('lion-option')
102
+ .length === entries.length,
103
+ );
104
+
105
+ wrapperElement.entries = [
106
+ {
107
+ id: '4',
108
+ label: 'Banana',
109
+ },
110
+ ];
111
+
112
+ await waitUntil(
113
+ () =>
114
+ wrapperElement?.shadowRoot?.querySelector('lion-options')?.querySelectorAll('lion-option')
115
+ .length === wrapperElement.entries.length,
116
+ );
117
+
118
+ const optionElements = wrapperElement.shadowRoot?.querySelectorAll('lion-option');
119
+ expect(optionElements?.length).to.equal(wrapperElement.entries.length);
120
+ const optionElement = optionElements?.item(0);
121
+ expect(optionElement?.textContent).to.equal('Banana');
122
+ });
123
+ });
124
+
51
125
  describe('Options visibility', () => {
52
126
  it('hides options when text in input node is cleared after typing something by default', async () => {
53
127
  const el = /** @type {LionCombobox} */ (
@@ -911,6 +985,57 @@ describe('lion-combobox', () => {
911
985
  await el.updateComplete;
912
986
  expect(el.modelValue).to.eql(['Art']);
913
987
  });
988
+
989
+ it('submits form on [Enter] when listbox is closed', async () => {
990
+ const submitSpy = sinon.spy(e => e.preventDefault());
991
+ const el = /** @type {HTMLFormElement} */ (
992
+ await fixture(html`
993
+ <form @submit=${submitSpy}>
994
+ <lion-combobox name="foo">
995
+ <lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
996
+ <lion-option .choiceValue="${'Chard'}">Chard</lion-option>
997
+ <lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
998
+ <lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
999
+ </lion-combobox>
1000
+ <button type="submit">submit</button>
1001
+ </form>
1002
+ `)
1003
+ );
1004
+ const combobox = /** @type {LionCombobox} */ (el.querySelector('[name="foo"]'));
1005
+ const { _inputNode } = getComboboxMembers(combobox);
1006
+ await combobox.updateComplete;
1007
+ _inputNode.focus();
1008
+ await sendKeys({
1009
+ press: 'Enter',
1010
+ });
1011
+ expect(submitSpy.callCount).to.equal(1);
1012
+ });
1013
+
1014
+ it('does not submit form on [Enter] when listbox is opened', async () => {
1015
+ const submitSpy = sinon.spy(e => e.preventDefault());
1016
+ const el = /** @type {HTMLFormElement} */ (
1017
+ await fixture(html`
1018
+ <form @submit=${submitSpy}>
1019
+ <lion-combobox name="foo">
1020
+ <lion-option .choiceValue="${'Artichoke'}">Artichoke</lion-option>
1021
+ <lion-option .choiceValue="${'Chard'}">Chard</lion-option>
1022
+ <lion-option .choiceValue="${'Chicory'}">Chicory</lion-option>
1023
+ <lion-option .choiceValue="${'Victoria Plum'}">Victoria Plum</lion-option>
1024
+ </lion-combobox>
1025
+ <button type="submit">submit</button>
1026
+ </form>
1027
+ `)
1028
+ );
1029
+ const combobox = /** @type {LionCombobox} */ (el.querySelector('[name="foo"]'));
1030
+ const { _inputNode } = getComboboxMembers(combobox);
1031
+ combobox.opened = true;
1032
+ await combobox.updateComplete;
1033
+ _inputNode.focus();
1034
+ await sendKeys({
1035
+ press: 'Enter',
1036
+ });
1037
+ expect(submitSpy.callCount).to.equal(0);
1038
+ });
914
1039
  });
915
1040
 
916
1041
  describe('Overlay visibility', () => {
@@ -1,6 +1,7 @@
1
1
  import { getDateFormatBasedOnLocale } from './getDateFormatBasedOnLocale.js';
2
2
  import { getLocalizeManager } from '../getLocalizeManager.js';
3
3
  import { addLeadingZero } from './utils/addLeadingZero.js';
4
+ import { isCorrectYearFormat } from './utils/checkYearFormat.js';
4
5
 
5
6
  /**
6
7
  * @typedef {import('../../types/LocalizeMixinTypes.js').FormatDateOptions} FormatDateOptions
@@ -63,12 +64,16 @@ export function parseDate(dateString, options) {
63
64
  }
64
65
 
65
66
  const [year, month, day] = parsedString.split('/').map(Number);
67
+ const [yearString] = parsedString.split('/');
68
+ if (!isCorrectYearFormat(yearString)) {
69
+ return undefined;
70
+ }
66
71
  let correctedYear = year;
67
72
  if (year < 50) {
68
73
  correctedYear = 2000 + year;
69
74
  }
70
75
 
71
- const parsedDate = new Date(new Date(correctedYear, month - 1, day));
76
+ const parsedDate = new Date(correctedYear, month - 1, day);
72
77
  // Check if parsedDate is not `Invalid Date` or that the date has changed (e.g. the not existing 31.02.2020)
73
78
  if (
74
79
  year > 0 &&
@@ -0,0 +1,8 @@
1
+ /**
2
+ *
3
+ * @param {string} year
4
+ * @returns {boolean}
5
+ */
6
+ export function isCorrectYearFormat(year) {
7
+ return /^\d{2}(\d{2})?$/g.test(year);
8
+ }
@@ -91,4 +91,10 @@ describe('parseDate()', () => {
91
91
  expect(parseDate('02.31.2020')).to.equal(undefined); // non existing date
92
92
  expect(parseDate('31.12.2020')).to.equal(undefined); // day & month switched places
93
93
  });
94
+
95
+ it('returns undefined for incorrect year format', () => {
96
+ // TODO: we need a `> 0` check for day and month, but maybe consider `>= 0` for year?
97
+ expect(parseDate('12-12-0000')).to.equal(undefined);
98
+ expect(parseDate('12-12-999')).to.equal(undefined);
99
+ });
94
100
  });
@@ -145835,6 +145835,39 @@
145835
145835
  }
145836
145836
  ]
145837
145837
  },
145838
+ {
145839
+ "kind": "javascript-module",
145840
+ "path": "components/localize/src/date/utils/checkYearFormat.js",
145841
+ "declarations": [
145842
+ {
145843
+ "kind": "function",
145844
+ "name": "isCorrectYearFormat",
145845
+ "parameters": [
145846
+ {
145847
+ "name": "year",
145848
+ "type": {
145849
+ "text": "string"
145850
+ }
145851
+ }
145852
+ ],
145853
+ "return": {
145854
+ "type": {
145855
+ "text": "boolean"
145856
+ }
145857
+ }
145858
+ }
145859
+ ],
145860
+ "exports": [
145861
+ {
145862
+ "kind": "js",
145863
+ "name": "isCorrectYearFormat",
145864
+ "declaration": {
145865
+ "name": "isCorrectYearFormat",
145866
+ "module": "components/localize/src/date/utils/checkYearFormat.js"
145867
+ }
145868
+ }
145869
+ ]
145870
+ },
145838
145871
  {
145839
145872
  "kind": "javascript-module",
145840
145873
  "path": "../../node_modules/lit/directives/until.js",
@@ -1 +1 @@
1
- {"version":3,"file":"LionCombobox.d.ts","sourceRoot":"","sources":["../../../../components/combobox/src/LionCombobox.js"],"names":[],"mappings":";AAgBA;;;;;;;;;GASG;AAEH;;;GAGG;AACH;IACE,kBAAkB;IAClB,6BAoBC;IAED,wFAgCC;IAuGD,4BAA4B;IAC5B,uBASC;IAtBD;;;;;;;OAOG;IACH,oBAEC;IAOG,iCAAiC;IACjC,SADW,MAAM,GAAG,SAAS,CACL;IAe5B;;OAEG;IACH,uCAcC;IAED;;;OAGG;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EAAE,QAAQ;8BACzC,OAAO,6BAA6B,EAAE,eAAe;8BACrD,OAAO,6BAA6B,EAAE,eAAe;+BACrD,OAAO,8BAA8B,EAAE,gBAAgB;iCACvD,UAAU,GAAG;IAAE,eAAe,CAAC,WAAU;IAAC,aAAa,CAAC,WAAS;CAAE"}
@@ -1 +1 @@
1
- {"version":3,"file":"parseDate.d.ts","sourceRoot":"","sources":["../../../../../components/localize/src/date/parseDate.js"],"names":[],"mappings":"AA4BA;;;;;;GAMG;AACH,sCAJW,MAAM,wFAEJ,IAAI,GAAG,SAAS,CAiD5B;gCA7EY,OAAO,mCAAmC,EAAE,iBAAiB"}
1
+ {"version":3,"file":"parseDate.d.ts","sourceRoot":"","sources":["../../../../../components/localize/src/date/parseDate.js"],"names":[],"mappings":"AA6BA;;;;;;GAMG;AACH,sCAJW,MAAM,wFAEJ,IAAI,GAAG,SAAS,CAqD5B;gCAjFY,OAAO,mCAAmC,EAAE,iBAAiB"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ *
3
+ * @param {string} year
4
+ * @returns {boolean}
5
+ */
6
+ export function isCorrectYearFormat(year: string): boolean;
7
+ //# sourceMappingURL=checkYearFormat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkYearFormat.d.ts","sourceRoot":"","sources":["../../../../../../components/localize/src/date/utils/checkYearFormat.js"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,0CAHW,MAAM,GACJ,OAAO,CAInB"}