@lion/ui 0.10.1 → 0.11.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.
Files changed (108) hide show
  1. package/README.md +2 -2
  2. package/components/checkbox-group/src/LionCheckboxIndeterminate.js +39 -16
  3. package/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.js +189 -1
  4. package/components/form-core/src/FocusMixin.js +4 -4
  5. package/components/form-core/src/LionField.js +1 -1
  6. package/components/input-amount/test/lion-input-amount.test.js +48 -1
  7. package/components/input-amount/test/parsers.test.js +1 -1
  8. package/components/localize/src/number/parseNumber.js +21 -12
  9. package/components/localize/test/number/parseNumber.test.js +1 -1
  10. package/components/localize/types/LocalizeMixinTypes.ts +0 -5
  11. package/components/select-rich/src/LionSelectRich.js +18 -2
  12. package/components/select-rich/test/lion-select-rich-interaction.test.js +139 -20
  13. package/components/select-rich/test/lion-select-rich.test.js +13 -1
  14. package/components/validate-messages/translations/pl.js +4 -4
  15. package/custom-elements.json +47661 -47626
  16. package/dist-types/components/checkbox-group/src/LionCheckboxIndeterminate.d.ts +10 -0
  17. package/dist-types/components/checkbox-group/src/LionCheckboxIndeterminate.d.ts.map +1 -1
  18. package/dist-types/components/checkbox-group/test-suites/CheckboxIndeterminate.suite.d.ts.map +1 -1
  19. package/dist-types/components/localize/src/number/parseNumber.d.ts.map +1 -1
  20. package/dist-types/components/localize/types/LocalizeMixinTypes.d.ts +0 -4
  21. package/dist-types/components/localize/types/LocalizeMixinTypes.d.ts.map +1 -1
  22. package/dist-types/components/select-rich/src/LionSelectRich.d.ts.map +1 -1
  23. package/dist-types/tsconfig.tsbuildinfo +1 -1
  24. package/docs/components/accordion/api-table.md +6 -6
  25. package/docs/components/button/api-table.md +27 -30
  26. package/docs/components/calendar/api-table.md +13 -13
  27. package/docs/components/checkbox-group/api-table.md +305 -329
  28. package/docs/components/checkbox-group/overview.md +2 -2
  29. package/docs/components/collapsible/api-table.md +5 -5
  30. package/docs/components/collapsible/overview.md +1 -1
  31. package/docs/components/combobox/api-table.md +150 -154
  32. package/docs/components/combobox/overview.md +1 -1
  33. package/docs/components/combobox/use-cases.md +1 -1
  34. package/docs/components/dialog/api-table.md +12 -12
  35. package/docs/components/dialog/overview.md +1 -1
  36. package/docs/components/drawer/api-table.md +9 -10
  37. package/docs/components/fieldset/api-table.md +104 -118
  38. package/docs/components/fieldset/overview.md +5 -5
  39. package/docs/components/form/overview.md +3 -3
  40. package/docs/components/form/use-cases.md +2 -2
  41. package/docs/components/icon/api-table.md +3 -3
  42. package/docs/components/icon/use-cases.md +1 -1
  43. package/docs/components/input/api-table.md +110 -120
  44. package/docs/components/input/overview.md +1 -1
  45. package/docs/components/input-amount/api-table.md +129 -142
  46. package/docs/components/input-amount/overview.md +3 -3
  47. package/docs/components/input-date/api-table.md +110 -120
  48. package/docs/components/input-date/overview.md +3 -3
  49. package/docs/components/input-datepicker/api-table.md +148 -160
  50. package/docs/components/input-datepicker/overview.md +5 -5
  51. package/docs/components/input-email/api-table.md +110 -120
  52. package/docs/components/input-email/overview.md +2 -2
  53. package/docs/components/input-file/api-table.md +132 -143
  54. package/docs/components/input-file/overview.md +1 -1
  55. package/docs/components/input-iban/api-table.md +110 -120
  56. package/docs/components/input-iban/overview.md +2 -2
  57. package/docs/components/input-range/api-table.md +116 -126
  58. package/docs/components/input-range/overview.md +2 -2
  59. package/docs/components/input-stepper/api-table.md +123 -133
  60. package/docs/components/input-stepper/overview.md +1 -1
  61. package/docs/components/input-tel/api-table.md +118 -128
  62. package/docs/components/input-tel/overview.md +1 -1
  63. package/docs/components/input-tel/use-cases.md +6 -6
  64. package/docs/components/input-tel-dropdown/api-table.md +125 -135
  65. package/docs/components/input-tel-dropdown/overview.md +1 -1
  66. package/docs/components/listbox/api-table.md +126 -131
  67. package/docs/components/listbox/use-cases.md +1 -1
  68. package/docs/components/pagination/api-table.md +5 -5
  69. package/docs/components/progress-indicator/api-table.md +9 -10
  70. package/docs/components/radio-group/api-table.md +234 -258
  71. package/docs/components/radio-group/overview.md +3 -3
  72. package/docs/components/select/api-table.md +106 -116
  73. package/docs/components/select/use-cases.md +1 -1
  74. package/docs/components/select-rich/api-table.md +169 -178
  75. package/docs/components/select-rich/use-cases.md +1 -1
  76. package/docs/components/steps/api-table.md +6 -6
  77. package/docs/components/switch/api-table.md +117 -128
  78. package/docs/components/tabs/api-table.md +1 -1
  79. package/docs/components/tabs/examples.md +1 -1
  80. package/docs/components/textarea/api-table.md +114 -124
  81. package/docs/components/tooltip/api-table.md +13 -13
  82. package/docs/fundamentals/index.md +4 -4
  83. package/docs/fundamentals/node-tools/publish-docs/overview.md +3 -3
  84. package/docs/fundamentals/node-tools/rocket-preset-extend-lion-docs/overview.md +2 -2
  85. package/docs/fundamentals/rationales/accessibility.md +1 -1
  86. package/docs/fundamentals/systems/core/SlotMixin.md +1 -1
  87. package/docs/fundamentals/systems/core/api-table.md +8 -11
  88. package/docs/fundamentals/systems/core/overview.md +1 -1
  89. package/docs/fundamentals/systems/form/api-table.md +77 -82
  90. package/docs/fundamentals/systems/form/formatting-and-parsing.md +4 -4
  91. package/docs/fundamentals/systems/form/model-value.md +1 -1
  92. package/docs/fundamentals/systems/form/overview.md +28 -28
  93. package/docs/fundamentals/systems/form/validate.md +2 -2
  94. package/docs/fundamentals/systems/localize/api-table.md +19 -19
  95. package/docs/fundamentals/systems/localize/overview.md +4 -4
  96. package/docs/fundamentals/systems/overlays/api-table.md +45 -46
  97. package/docs/fundamentals/systems/overlays/configuration.md +2 -2
  98. package/docs/fundamentals/systems/overlays/overview.md +5 -5
  99. package/docs/fundamentals/systems/overlays/use-cases.md +2 -2
  100. package/docs/fundamentals/tools/helpers/overview.md +1 -1
  101. package/docs/fundamentals/tools/singleton-manager/overview.md +4 -4
  102. package/docs/guides/how-to/create-a-custom-field.md +5 -5
  103. package/docs/guides/how-to/create-a-form.md +4 -4
  104. package/docs/guides/how-to/extend-a-native-input.md +2 -2
  105. package/docs/guides/index.md +8 -8
  106. package/docs/guides/principles/index.md +5 -5
  107. package/docs/guides/principles/styling.md +1 -1
  108. package/package.json +1 -1
@@ -24,6 +24,24 @@ function mimicKeyPress(el, key, code = '') {
24
24
  el.dispatchEvent(new KeyboardEvent('keyup', { key, code }));
25
25
  }
26
26
 
27
+ /**
28
+ * @param {LionOption[]} options
29
+ * @param {number} selectedIndex
30
+ */
31
+ function expectOnlyGivenOneOptionToBeChecked(options, selectedIndex) {
32
+ /**
33
+ * @param {{ checked: any; }} option
34
+ * @param {any} i
35
+ */
36
+ options.forEach((option, i) => {
37
+ if (i === selectedIndex) {
38
+ expect(option.checked).to.be.true;
39
+ } else {
40
+ expect(option.checked).to.be.false;
41
+ }
42
+ });
43
+ }
44
+
27
45
  describe('lion-select-rich interactions', () => {
28
46
  describe('Interaction mode', () => {
29
47
  it('autodetects interactionMode if not defined', async () => {
@@ -86,26 +104,91 @@ describe('lion-select-rich interactions', () => {
86
104
  });
87
105
  });
88
106
 
89
- describe('Invoker Keyboard navigation Windows', () => {
90
- it('navigates through list with [ArrowDown] [ArrowUp] keys checks the option while listbox unopened', async () => {
91
- /**
92
- * @param {LionOption[]} options
93
- * @param {number} selectedIndex
94
- */
95
- function expectOnlyGivenOneOptionToBeChecked(options, selectedIndex) {
96
- /**
97
- * @param {{ checked: any; }} option
98
- * @param {any} i
99
- */
100
- options.forEach((option, i) => {
101
- if (i === selectedIndex) {
102
- expect(option.checked).to.be.true;
103
- } else {
104
- expect(option.checked).to.be.false;
105
- }
106
- });
107
- }
107
+ describe('Invoker Keyboard navigation Mac', () => {
108
+ it('opens dropdown with [ArrowDown] [ArrowUp] keys or navigates through the listbox options', async () => {
109
+ const el = /** @type {LionSelectRich} */ (
110
+ await fixture(html`
111
+ <lion-select-rich interaction-mode="mac">
112
+ <lion-options slot="input">
113
+ <lion-option .choiceValue=${10}>Item 1</lion-option>
114
+ <lion-option .choiceValue=${20}>Item 2</lion-option>
115
+ <lion-option .choiceValue=${30}>Item 3</lion-option>
116
+ </lion-options>
117
+ </lion-select-rich>
118
+ `)
119
+ );
120
+
121
+ const options = el.formElements;
122
+ expect(el.checkedIndex).to.equal(0);
123
+ expectOnlyGivenOneOptionToBeChecked(options, 0);
124
+
125
+ el.dispatchEvent(new KeyboardEvent('keyup', { key: 'ArrowDown' }));
126
+
127
+ expect(el.opened).to.be.true;
128
+ expect(el.checkedIndex).to.equal(0);
129
+ expectOnlyGivenOneOptionToBeChecked(options, 0);
130
+
131
+ el.opened = false;
132
+
133
+ el.dispatchEvent(new KeyboardEvent('keyup', { key: 'ArrowUp' }));
134
+ expect(el.opened).to.be.true;
135
+ expect(el.checkedIndex).to.equal(0);
136
+ expectOnlyGivenOneOptionToBeChecked(options, 0);
137
+ });
138
+
139
+ it('does not open dropdown with [ArrowLeft] [ArrowRight] keys or navigates through the listbox options', async () => {
140
+ const el = /** @type {LionSelectRich} */ (
141
+ await fixture(html`
142
+ <lion-select-rich interaction-mode="mac">
143
+ <lion-options slot="input">
144
+ <lion-option .choiceValue=${10}>Item 1</lion-option>
145
+ <lion-option .choiceValue=${20}>Item 2</lion-option>
146
+ <lion-option .choiceValue=${30}>Item 3</lion-option>
147
+ </lion-options>
148
+ </lion-select-rich>
149
+ `)
150
+ );
151
+
152
+ const options = el.formElements;
153
+ expect(el.checkedIndex).to.equal(0);
154
+ expectOnlyGivenOneOptionToBeChecked(options, 0);
155
+
156
+ el.dispatchEvent(new KeyboardEvent('keyup', { key: 'ArrowLeft' }));
157
+
158
+ expect(el.opened).to.be.false;
159
+ expect(el.checkedIndex).to.equal(0);
160
+ expectOnlyGivenOneOptionToBeChecked(options, 0);
161
+
162
+ el.dispatchEvent(new KeyboardEvent('keyup', { key: 'ArrowRight' }));
163
+ expect(el.opened).to.be.false;
164
+ expect(el.checkedIndex).to.equal(0);
165
+ expectOnlyGivenOneOptionToBeChecked(options, 0);
166
+ });
167
+
168
+ it('checks a value with [character] keys while listbox unopened', async () => {
169
+ const el = /** @type {LionSelectRich} */ (
170
+ await fixture(html`
171
+ <lion-select-rich interaction-mode="mac">
172
+ <lion-options slot="input">
173
+ <lion-option .choiceValue=${'red'}>Red</lion-option>
174
+ <lion-option .choiceValue=${'teal'}>Teal</lion-option>
175
+ <lion-option .choiceValue=${'turquoise'}>Turquoise</lion-option>
176
+ </lion-options>
177
+ </lion-select-rich>
178
+ `)
179
+ );
108
180
 
181
+ // @ts-ignore [allow-private] in test
182
+ mimicKeyPress(el, 't', 'KeyT');
183
+ expect(el.checkedIndex).to.equal(1);
184
+
185
+ mimicKeyPress(el, 'u', 'KeyU');
186
+ expect(el.checkedIndex).to.equal(2);
187
+ });
188
+ });
189
+
190
+ describe('Invoker Keyboard navigation Windows/Linux', () => {
191
+ it('navigation through list with [ArrowDown] [ArrowUp] keys checks the option while listbox unopened', async () => {
109
192
  let isTriggeredByUser;
110
193
  const el = /** @type {LionSelectRich} */ (
111
194
  await fixture(html`
@@ -141,7 +224,43 @@ describe('lion-select-rich interactions', () => {
141
224
  expect(isTriggeredByUser).to.be.true;
142
225
  });
143
226
 
144
- it('checkes a value with [character] keys while listbox unopened', async () => {
227
+ it('navigation through list with [ArrowLeft] [ArrowRight] keys checks the option while listbox unopened', async () => {
228
+ let isTriggeredByUser;
229
+ const el = /** @type {LionSelectRich} */ (
230
+ await fixture(html`
231
+ <lion-select-rich
232
+ interaction-mode="windows/linux"
233
+ @model-value-changed="${(/** @type {CustomEvent} */ event) => {
234
+ isTriggeredByUser = event.detail.isTriggeredByUser;
235
+ }}"
236
+ >
237
+ <lion-options slot="input">
238
+ <lion-option .choiceValue=${10}>Item 1</lion-option>
239
+ <lion-option .choiceValue=${20}>Item 2</lion-option>
240
+ <lion-option .choiceValue=${30}>Item 3</lion-option>
241
+ </lion-options>
242
+ </lion-select-rich>
243
+ `)
244
+ );
245
+
246
+ const options = el.formElements;
247
+ expect(el.checkedIndex).to.equal(0);
248
+ expectOnlyGivenOneOptionToBeChecked(options, 0);
249
+
250
+ el.dispatchEvent(new KeyboardEvent('keyup', { key: 'ArrowRight' }));
251
+ expect(el.checkedIndex).to.equal(1);
252
+ expectOnlyGivenOneOptionToBeChecked(options, 1);
253
+ expect(isTriggeredByUser).to.be.true;
254
+
255
+ isTriggeredByUser = false;
256
+
257
+ el.dispatchEvent(new KeyboardEvent('keyup', { key: 'ArrowLeft' }));
258
+ expect(el.checkedIndex).to.equal(0);
259
+ expectOnlyGivenOneOptionToBeChecked(options, 0);
260
+ expect(isTriggeredByUser).to.be.true;
261
+ });
262
+
263
+ it('checks a value with [character] keys while listbox unopened', async () => {
145
264
  const el = /** @type {LionSelectRich} */ (
146
265
  await fixture(html`
147
266
  <lion-select-rich interaction-mode="windows/linux">
@@ -342,7 +342,7 @@ describe('lion-select-rich', () => {
342
342
  expect(elSingleoption.opened).to.be.false;
343
343
  });
344
344
 
345
- it('stays closed with [ArrowUp] or [ArrowDown] key in readonly mode', async () => {
345
+ it('stays closed with [ArrowUp] or [ArrowDown] key in readonly mode or has a single option', async () => {
346
346
  const elReadOnly = await fixture(html`
347
347
  <lion-select-rich readonly>
348
348
  <lion-option .choiceValue=${10}>Item 1</lion-option>
@@ -350,11 +350,23 @@ describe('lion-select-rich', () => {
350
350
  </lion-select-rich>
351
351
  `);
352
352
 
353
+ const elSingleOption = await fixture(html`
354
+ <lion-select-rich>
355
+ <lion-option .choiceValue=${10}>Item 1</lion-option>
356
+ </lion-select-rich>
357
+ `);
358
+
353
359
  elReadOnly.dispatchEvent(new KeyboardEvent('keyup', { key: 'ArrowDown' }));
354
360
  expect(elReadOnly.opened).to.be.false;
355
361
 
356
362
  elReadOnly.dispatchEvent(new KeyboardEvent('keyup', { key: 'ArrowUp' }));
357
363
  expect(elReadOnly.opened).to.be.false;
364
+
365
+ elSingleOption.dispatchEvent(new KeyboardEvent('keyup', { key: 'ArrowDown' }));
366
+ expect(elSingleOption.opened).to.be.false;
367
+
368
+ elSingleOption.dispatchEvent(new KeyboardEvent('keyup', { key: 'ArrowUp' }));
369
+ expect(elSingleOption.opened).to.be.false;
358
370
  });
359
371
 
360
372
  it('sets inheritsReferenceWidth to min by default', async () => {
@@ -10,8 +10,8 @@ export default {
10
10
  'Proszę podać prawidłową wartość {fieldName} (od {params.min} do {params.max} znaków).',
11
11
  Pattern: 'Wprowadź prawidłową wartość w polu {fieldName}.',
12
12
  IsNumber: 'Wprowadź prawidłową wartość w polu {fieldName}.',
13
- MinNumber: 'Proszę podać wartość {fieldName} większą niż {params}.',
14
- MaxNumber: 'Proszę podać wartość {fieldName} mniejszą niż {params}.',
13
+ MinNumber: 'Proszę podać wartość {fieldName} większą niż lub równą {params}.',
14
+ MaxNumber: 'Proszę podać wartość {fieldName} mniejszą niż lub równą {params}.',
15
15
  MinMaxNumber: 'Proszę podać wartość {fieldName} o długości od {params.min} do {params.max}.',
16
16
  IsDate: 'Wprowadź datę (DD MM RRRR).',
17
17
  MinDate: 'Proszę podać wartość {fieldName} przypadającą po {params, date, YYYYMMDD}.',
@@ -32,8 +32,8 @@ export default {
32
32
  MinMaxLength:
33
33
  'Proszę podać prawidłową wartość {fieldName} (od {params.min} do {params.max} znaków).',
34
34
  IsNumber: 'Wprowadź prawidłową wartość w polu {fieldName}.',
35
- MinNumber: 'Proszę podać wartość {fieldName} większą niż {params}.',
36
- MaxNumber: 'Proszę podać wartość {fieldName} mniejszą niż {params}.',
35
+ MinNumber: 'Proszę podać wartość {fieldName} większą niż lub równą {params}.',
36
+ MaxNumber: 'Proszę podać wartość {fieldName} mniejszą niż lub równą {params}.',
37
37
  MinMaxNumber: 'Proszę podać wartość {fieldName} o długości od {params.min} do {params.max}.',
38
38
  IsDate: 'Wprowadź datę (DD MM RRRR).',
39
39
  MinDate: 'Proszę podać wartość {fieldName} przypadającą po {params, date, YYYYMMDD}.',