@baloise/ds-core 16.5.0-snapshot.1471-e419cbebb → 16.5.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 (159) hide show
  1. package/components/all.d.ts +0 -2
  2. package/components/all.js +0 -3
  3. package/components/bal-app.js +85 -1
  4. package/components/bal-field.js +3 -0
  5. package/components/bal-segment-item.js +64 -47
  6. package/components/bal-segment.js +61 -17
  7. package/components/index.js +289 -5
  8. package/components/tokens.esm.js +1 -1
  9. package/dist/baloise-design-system/baloise-design-system.esm.js +1 -1
  10. package/dist/baloise-design-system/baloise-design-system.js +1 -1
  11. package/dist/baloise-design-system/index.esm.js +1 -1
  12. package/dist/baloise-design-system/{p-f959646a.system.js → p-013b4c72.system.js} +1 -1
  13. package/dist/baloise-design-system/p-08b0e345a2.entry.js +1 -0
  14. package/dist/baloise-design-system/p-0db6b19e.js +1 -0
  15. package/dist/baloise-design-system/p-1509eaa7.system.js +1 -1
  16. package/dist/baloise-design-system/{p-9ab0f719.js → p-15a85377.js} +1 -1
  17. package/dist/baloise-design-system/{p-cd81adc228.entry.js → p-27bc71c322.entry.js} +1 -1
  18. package/dist/baloise-design-system/{p-b9203254fb.entry.js → p-3180888825.entry.js} +1 -1
  19. package/dist/baloise-design-system/{p-3e1fdd01f5.entry.js → p-342b27632b.entry.js} +1 -1
  20. package/dist/baloise-design-system/{p-ad679bd040.entry.js → p-34671b9410.entry.js} +1 -1
  21. package/dist/baloise-design-system/p-449ffc7a7e.entry.js +1 -0
  22. package/dist/baloise-design-system/{p-045b79ee4d.system.entry.js → p-52a4a89073.system.entry.js} +1 -1
  23. package/dist/baloise-design-system/p-54f81c32.js +1 -1
  24. package/dist/baloise-design-system/{p-d960c286.system.js → p-590da25b.system.js} +1 -1
  25. package/dist/baloise-design-system/{p-40878304.system.js → p-5de0bd8a.system.js} +1 -1
  26. package/dist/baloise-design-system/{p-04585f2f.system.js → p-60a6af04.system.js} +1 -1
  27. package/dist/baloise-design-system/{p-a547251249.entry.js → p-784c10d48f.entry.js} +1 -1
  28. package/dist/baloise-design-system/{p-767c357ddc.entry.js → p-80e59744a7.entry.js} +1 -1
  29. package/dist/baloise-design-system/{p-95bf6d0a8b.system.entry.js → p-8613444e15.system.entry.js} +1 -1
  30. package/dist/baloise-design-system/{p-2cb51419.system.js → p-910b2f3d.system.js} +1 -1
  31. package/dist/baloise-design-system/{p-e7d9295cf8.system.entry.js → p-a7de2305e0.system.entry.js} +1 -1
  32. package/dist/baloise-design-system/{p-78d1d35d85.system.entry.js → p-aed4d3ac0f.system.entry.js} +1 -1
  33. package/dist/baloise-design-system/{p-676e163338.system.entry.js → p-b4941441f4.system.entry.js} +1 -1
  34. package/dist/baloise-design-system/p-b60576a064.entry.js +1 -0
  35. package/dist/baloise-design-system/p-bcca1ed3.system.js +1 -0
  36. package/dist/baloise-design-system/{p-8b72df5ab4.entry.js → p-c716d30de1.entry.js} +1 -1
  37. package/dist/baloise-design-system/{p-e5a5fc1b.js → p-cfa901cb.js} +1 -1
  38. package/dist/baloise-design-system/{p-c8c9bab6e3.system.entry.js → p-d8a71bc5b4.system.entry.js} +1 -1
  39. package/dist/baloise-design-system/{p-a3eb350b5a.system.entry.js → p-d94b2cb869.system.entry.js} +1 -1
  40. package/dist/baloise-design-system/{p-5ef104a5a4.entry.js → p-d9f2d48be1.entry.js} +1 -1
  41. package/dist/baloise-design-system/{p-6590ce827f.system.entry.js → p-dd162dc12e.system.entry.js} +1 -1
  42. package/dist/baloise-design-system/{p-cb1e44b674.system.entry.js → p-e227dcfaa1.system.entry.js} +1 -1
  43. package/dist/baloise-design-system/{p-a6e88e6ab0.system.entry.js → p-e2316d2aea.system.entry.js} +1 -1
  44. package/dist/baloise-design-system/p-e45eb6121d.system.entry.js +1 -0
  45. package/dist/baloise-design-system/p-e78a6409.js +1 -0
  46. package/dist/baloise-design-system/{p-8a615db59f.entry.js → p-e829652c7a.entry.js} +1 -1
  47. package/dist/baloise-design-system/{p-8a16c8f794.entry.js → p-e8cab53413.entry.js} +1 -1
  48. package/dist/baloise-design-system/p-ec044ce124.system.entry.js +1 -0
  49. package/dist/baloise-design-system/{p-4e016ed599.system.entry.js → p-efe5a8806d.system.entry.js} +1 -1
  50. package/dist/baloise-design-system/{p-71b2968d8e.system.entry.js → p-f3bb565972.system.entry.js} +1 -1
  51. package/dist/baloise-design-system/{p-a5c78d4bf8.entry.js → p-fcfee1c692.entry.js} +1 -1
  52. package/dist/cjs/{global-2562a984.js → app-globals-ae3a8623.js} +4 -2
  53. package/dist/cjs/bal-carousel_2.cjs.entry.js +3 -3
  54. package/dist/cjs/bal-datepicker.cjs.entry.js +3 -3
  55. package/dist/cjs/bal-field_5.cjs.entry.js +3 -0
  56. package/dist/cjs/bal-hint_5.cjs.entry.js +3 -3
  57. package/dist/cjs/bal-list_8.cjs.entry.js +3 -3
  58. package/dist/cjs/bal-logo.cjs.entry.js +3 -3
  59. package/dist/cjs/bal-nav_8.cjs.entry.js +3 -3
  60. package/dist/cjs/bal-navbar_5.cjs.entry.js +3 -3
  61. package/dist/cjs/bal-pagination.cjs.entry.js +3 -3
  62. package/dist/cjs/bal-progress-bar.cjs.entry.js +4 -4
  63. package/dist/cjs/bal-segment_2.cjs.entry.js +115 -63
  64. package/dist/cjs/bal-shape.cjs.entry.js +1 -1
  65. package/dist/cjs/bal-steps.cjs.entry.js +3 -3
  66. package/dist/cjs/bal-tab-item_2.cjs.entry.js +3 -3
  67. package/dist/cjs/baloise-design-system.cjs.js +2 -3
  68. package/dist/cjs/{breakpoints.decorator-b125d386.js → breakpoints.decorator-f4da1834.js} +1 -1
  69. package/dist/cjs/{breakpoints.subject-488871c0.js → breakpoints.subject-6fc372a8.js} +1 -1
  70. package/dist/cjs/index.cjs.js +2 -2
  71. package/dist/cjs/initialize-2a19d091.js +1 -1
  72. package/dist/cjs/loader.cjs.js +2 -3
  73. package/dist/cjs/{tokens.esm-abb7c10c.js → tokens.esm-cd3fab6c.js} +1 -1
  74. package/dist/cjs/{window-resize.decorator-3e886802.js → window-resize.decorator-67e1f4de.js} +1 -1
  75. package/dist/collection/collection-manifest.json +1 -2
  76. package/dist/collection/components/bal-field/bal-field.js +3 -0
  77. package/dist/collection/components/bal-segment/bal-segment-item/bal-segment-item.js +92 -69
  78. package/dist/collection/components/bal-segment/bal-segment.js +115 -19
  79. package/dist/collection/utils/constants/version.constant.js +1 -1
  80. package/dist/esm/{global-63f4bcec.js → app-globals-b0dd0fc4.js} +4 -2
  81. package/dist/esm/bal-carousel_2.entry.js +3 -3
  82. package/dist/esm/bal-datepicker.entry.js +3 -3
  83. package/dist/esm/bal-field_5.entry.js +3 -0
  84. package/dist/esm/bal-hint_5.entry.js +3 -3
  85. package/dist/esm/bal-list_8.entry.js +3 -3
  86. package/dist/esm/bal-logo.entry.js +3 -3
  87. package/dist/esm/bal-nav_8.entry.js +3 -3
  88. package/dist/esm/bal-navbar_5.entry.js +3 -3
  89. package/dist/esm/bal-pagination.entry.js +3 -3
  90. package/dist/esm/bal-progress-bar.entry.js +4 -4
  91. package/dist/esm/bal-segment_2.entry.js +115 -63
  92. package/dist/esm/bal-shape.entry.js +1 -1
  93. package/dist/esm/bal-steps.entry.js +3 -3
  94. package/dist/esm/bal-tab-item_2.entry.js +3 -3
  95. package/dist/esm/baloise-design-system.js +2 -3
  96. package/dist/esm/{breakpoints.decorator-d3119ed5.js → breakpoints.decorator-8a50482f.js} +1 -1
  97. package/dist/esm/{breakpoints.subject-ed7a3540.js → breakpoints.subject-e3538fe7.js} +1 -1
  98. package/dist/esm/index.js +3 -3
  99. package/dist/esm/initialize-e216cfe4.js +1 -1
  100. package/dist/esm/loader.js +2 -3
  101. package/dist/esm/{tokens.esm-d31851f8.js → tokens.esm-7cf87670.js} +1 -1
  102. package/dist/esm/{window-resize.decorator-db8fd6f3.js → window-resize.decorator-9c08027e.js} +1 -1
  103. package/dist/esm-es5/app-globals-b0dd0fc4.js +1 -0
  104. package/dist/esm-es5/bal-carousel_2.entry.js +1 -1
  105. package/dist/esm-es5/bal-datepicker.entry.js +1 -1
  106. package/dist/esm-es5/bal-field_5.entry.js +1 -1
  107. package/dist/esm-es5/bal-hint_5.entry.js +1 -1
  108. package/dist/esm-es5/bal-list_8.entry.js +1 -1
  109. package/dist/esm-es5/bal-logo.entry.js +1 -1
  110. package/dist/esm-es5/bal-nav_8.entry.js +1 -1
  111. package/dist/esm-es5/bal-navbar_5.entry.js +1 -1
  112. package/dist/esm-es5/bal-pagination.entry.js +1 -1
  113. package/dist/esm-es5/bal-progress-bar.entry.js +1 -1
  114. package/dist/esm-es5/bal-segment_2.entry.js +1 -1
  115. package/dist/esm-es5/bal-shape.entry.js +1 -1
  116. package/dist/esm-es5/bal-steps.entry.js +1 -1
  117. package/dist/esm-es5/bal-tab-item_2.entry.js +1 -1
  118. package/dist/esm-es5/baloise-design-system.js +1 -1
  119. package/dist/esm-es5/{breakpoints.decorator-d3119ed5.js → breakpoints.decorator-8a50482f.js} +1 -1
  120. package/dist/esm-es5/{breakpoints.subject-ed7a3540.js → breakpoints.subject-e3538fe7.js} +1 -1
  121. package/dist/esm-es5/index.js +1 -1
  122. package/dist/esm-es5/initialize-e216cfe4.js +1 -1
  123. package/dist/esm-es5/loader.js +1 -1
  124. package/dist/esm-es5/{window-resize.decorator-db8fd6f3.js → window-resize.decorator-9c08027e.js} +1 -1
  125. package/dist/types/components/bal-segment/bal-segment-item/bal-segment-item.d.ts +17 -13
  126. package/dist/types/components/bal-segment/bal-segment.d.ts +22 -3
  127. package/dist/types/components/bal-segment/bal-segment.interfaces.d.ts +2 -0
  128. package/dist/types/components.d.ts +7 -56
  129. package/package.json +7 -7
  130. package/components/bal-app2.js +0 -87
  131. package/components/bal-doc-app.d.ts +0 -11
  132. package/components/bal-doc-app.js +0 -260
  133. package/components/initialize.js +0 -288
  134. package/dist/baloise-design-system/p-1b8739df31.system.entry.js +0 -1
  135. package/dist/baloise-design-system/p-2d373ec3.js +0 -1
  136. package/dist/baloise-design-system/p-360068a4.system.js +0 -1
  137. package/dist/baloise-design-system/p-4ff656dd48.entry.js +0 -1
  138. package/dist/baloise-design-system/p-6d1b6215.js +0 -1
  139. package/dist/baloise-design-system/p-7291766c.system.js +0 -1
  140. package/dist/baloise-design-system/p-7cc52e4a3b.system.entry.js +0 -1
  141. package/dist/baloise-design-system/p-99177a28c0.entry.js +0 -1
  142. package/dist/baloise-design-system/p-b8f085f7b5.system.entry.js +0 -1
  143. package/dist/baloise-design-system/p-d9d229a026.entry.js +0 -1
  144. package/dist/baloise-design-system/p-e8ffddeb.js +0 -1
  145. package/dist/baloise-design-system/p-ef493de9d5.entry.js +0 -1
  146. package/dist/cjs/app-globals-5fd73c0c.js +0 -7
  147. package/dist/cjs/bal-doc-app.cjs.entry.js +0 -231
  148. package/dist/collection/components/docs/bal-doc-app/bal-doc-app.css +0 -1
  149. package/dist/collection/components/docs/bal-doc-app/bal-doc-app.js +0 -229
  150. package/dist/esm/app-globals-970bab17.js +0 -5
  151. package/dist/esm/bal-doc-app.entry.js +0 -227
  152. package/dist/esm-es5/app-globals-970bab17.js +0 -1
  153. package/dist/esm-es5/bal-doc-app.entry.js +0 -1
  154. package/dist/esm-es5/global-63f4bcec.js +0 -1
  155. package/dist/types/components/docs/bal-doc-app/bal-doc-app.d.ts +0 -21
  156. package/dist/types/home/runner/work/design-system/design-system/packages/core/.stencil/packages/icons/src/index.d.ts +0 -81
  157. /package/dist/baloise-design-system/{p-445ba24a.js → p-46bed129.js} +0 -0
  158. /package/dist/baloise-design-system/{p-072d2e2e.system.js → p-9ffefe27.system.js} +0 -0
  159. /package/dist/esm-es5/{tokens.esm-d31851f8.js → tokens.esm-7cf87670.js} +0 -0
@@ -1,13 +1,15 @@
1
- import { h, Host, } from "@stencil/core";
1
+ import { h, Host } from "@stencil/core";
2
2
  import { BEM } from "../../../utils/bem";
3
3
  import { inheritAttributes } from "../../../utils/attributes";
4
4
  import { addEventListener, raf, removeEventListener } from "../../../utils/helpers";
5
- let ids = 0;
5
+ import { defaultBalAriaForm } from "../../../utils/form";
6
+ let SegmentItemIds = 0;
6
7
  export class SegmentItem {
7
8
  constructor() {
8
9
  this.segmentEl = null;
9
10
  this.inheritedAttributes = {};
10
- this.id = ids++;
11
+ this.internalId = SegmentItemIds++;
12
+ this.inputId = `bal-si-${this.internalId}`;
11
13
  this.updateVertical = (ev) => {
12
14
  this.isVertical = ev.detail;
13
15
  };
@@ -15,7 +17,7 @@ export class SegmentItem {
15
17
  const { segmentEl } = this;
16
18
  if (segmentEl) {
17
19
  if (segmentEl.value === '' || segmentEl.value === undefined || segmentEl.value === null) {
18
- const items = this.items;
20
+ const items = this.allAvailableOptions;
19
21
  if (items.length > 0) {
20
22
  const first = items[0];
21
23
  this.isFocusable = first === this.el;
@@ -28,6 +30,9 @@ export class SegmentItem {
28
30
  if (segmentEl.disabled) {
29
31
  this.disabled = true;
30
32
  }
33
+ this.isLast = segmentEl.lastElementChild === this.el;
34
+ this.isFirst = segmentEl.firstElementChild === this.el;
35
+ this.calculateEmptyValue();
31
36
  }
32
37
  };
33
38
  this.onSlottedItemsChange = () => {
@@ -41,23 +46,35 @@ export class SegmentItem {
41
46
  this.hasSlotContent = false;
42
47
  this.isFocusable = false;
43
48
  this.isVertical = false;
49
+ this.isLast = false;
50
+ this.isFirst = false;
51
+ this.hasEmptyValue = true;
52
+ this.ariaForm = defaultBalAriaForm;
44
53
  this.disabled = false;
45
54
  this.invalid = false;
46
55
  this.focused = false;
47
56
  this.checked = false;
48
57
  this.label = '';
49
- this.value = 'bal-si-' + this.id;
58
+ this.value = 'bal-si-' + this.internalId;
50
59
  }
51
- valueChanged() {
52
- this.updateState();
60
+ valueChanged(newValue, oldValue) {
61
+ if (newValue !== oldValue) {
62
+ this.updateState();
63
+ }
64
+ }
65
+ componentWillLoad() {
66
+ this.inheritedAttributes = Object.assign({}, inheritAttributes(this.el, ['aria-label']));
53
67
  }
54
- connectedCallback() {
68
+ componentDidLoad() {
55
69
  const segmentEl = (this.segmentEl = this.el.closest('bal-segment'));
56
70
  if (segmentEl) {
57
- this.updateState();
58
71
  addEventListener(segmentEl, 'balSelect', this.updateState);
59
72
  addEventListener(segmentEl, 'balVertical', this.updateVertical);
60
73
  }
74
+ raf(() => {
75
+ this.checkSlotContent();
76
+ this.updateState();
77
+ });
61
78
  }
62
79
  disconnectedCallback() {
63
80
  const segmentEl = this.segmentEl;
@@ -67,11 +84,14 @@ export class SegmentItem {
67
84
  this.segmentEl = null;
68
85
  }
69
86
  }
70
- componentWillLoad() {
71
- this.inheritedAttributes = Object.assign({}, inheritAttributes(this.el, ['aria-label']));
72
- }
73
- componentDidLoad() {
74
- raf(() => this.checkSlotContent());
87
+ calculateEmptyValue() {
88
+ if (this.segmentEl) {
89
+ const segments = Array.from(this.segmentEl.querySelectorAll('bal-segment-item'));
90
+ this.hasEmptyValue = !segments.some(item => item.value === this.segmentEl.value);
91
+ }
92
+ else {
93
+ this.hasEmptyValue = false;
94
+ }
75
95
  }
76
96
  /**
77
97
  * @internal
@@ -84,54 +104,47 @@ export class SegmentItem {
84
104
  nativeEl.focus();
85
105
  }
86
106
  }
87
- get items() {
88
- return this.allItems.filter(item => !item.disabled);
107
+ /**
108
+ * @internal
109
+ */
110
+ async setAriaForm(ariaForm) {
111
+ this.ariaForm = Object.assign({}, ariaForm);
112
+ }
113
+ get allAvailableOptions() {
114
+ return this.allOptions.filter(item => !item.disabled);
89
115
  }
90
- get allItems() {
116
+ get allOptions() {
91
117
  const { segmentEl } = this;
92
118
  if (segmentEl) {
93
119
  return Array.from(segmentEl.querySelectorAll('bal-segment-item'));
94
120
  }
95
121
  return [];
96
122
  }
97
- isFirst() {
98
- const { segmentEl } = this;
99
- let items = this.items;
100
- if (segmentEl && segmentEl.disabled) {
101
- items = this.allItems;
102
- }
103
- if (items.length > 0) {
104
- const first = items[0];
105
- return first === this.el;
106
- }
107
- return false;
108
- }
109
- isLast() {
110
- const { segmentEl } = this;
111
- let items = this.items;
112
- if (segmentEl && segmentEl.disabled) {
113
- items = this.allItems;
114
- }
115
- if (items.length > 0) {
116
- const last = items[items.length - 1];
117
- return last === this.el;
118
- }
119
- return false;
120
- }
121
123
  checkSlotContent() {
122
124
  const slot = this.el.querySelector('[part="slot"]');
123
125
  const children = slot ? slot.innerHTML.trim() : '';
124
126
  this.hasSlotContent = children.length > 0;
125
127
  }
126
128
  render() {
127
- const { checked, focused, segmentEl, label, isFocusable } = this;
129
+ const { checked, focused, segmentEl, label, isFocusable, isFirst, hasEmptyValue } = this;
128
130
  const block = BEM.block('segment-item');
129
131
  const buttonBem = block.element('button');
130
132
  const indicatorBem = block.element('indicator');
131
133
  const invalid = this.invalid || (segmentEl && segmentEl.invalid);
132
134
  const disabled = this.disabled || (segmentEl && segmentEl.disabled);
133
135
  const vertical = this.isVertical;
134
- return (h(Host, { class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, block.class()), block.modifier('vertical').class(vertical)), block.modifier('disabled').class(disabled)), block.modifier('checked').class(checked)), block.modifier('invalid').class(invalid)), block.modifier('line').class(!this.isFirst() && !checked)), block.modifier('last').class(this.isLast() && !checked)) }, h("button", Object.assign({ role: "radio", "aria-checked": checked ? 'true' : 'false', class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, buttonBem.class()), buttonBem.modifier('checked').class(checked)), buttonBem.modifier('invalid').class(invalid)), buttonBem.modifier('disabled').class(disabled)), buttonBem.modifier('focused').class(focused)), buttonBem.modifier('vertical').class(vertical)), "aria-labelledby": `bal-si-${this.id}-label`, type: 'button', tabIndex: isFocusable ? 0 : -1, part: "native", onBlur: ev => this.balBlur.emit(ev), disabled: disabled, ref: el => (this.nativeEl = el) }, this.inheritedAttributes), h("bal-icon", { name: "check", size: "small", class: Object.assign(Object.assign(Object.assign({}, buttonBem.element('icon').class()), buttonBem.element('icon').modifier('animated').class(checked)), buttonBem.element('icon').modifier('vertical').class(vertical)), color: disabled ? 'grey-dark' : invalid ? 'white' : 'primary' }), h("bal-stack", { space: "x-small", layout: 'horizontal' }, h("bal-content", { space: "none" }, h("bal-label", { htmlId: `bal-si-${this.id}-label` }, label), h("span", { part: "slot", class: Object.assign({}, buttonBem.element('slot').modifier('hidden').class(!this.hasSlotContent)) }, ' ', h("slot", { onSlotchange: this.onSlottedItemsChange }))))), h("div", { class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, indicatorBem.class()), indicatorBem.modifier('animated').class()), indicatorBem.modifier('background').class()), indicatorBem.modifier('disabled').class(disabled)), indicatorBem.modifier('invalid').class(invalid)), indicatorBem.modifier('checked').class(checked)), indicatorBem.modifier('vertical').class(vertical)) })));
136
+ const hasTabindex = (hasEmptyValue && isFirst) || (isFocusable && !disabled);
137
+ const id = (hasTabindex && this.ariaForm.controlId) || this.inputId;
138
+ let buttonAttributes = {};
139
+ if (hasTabindex) {
140
+ let labelId = this.ariaForm.labelId || null;
141
+ labelId = `${labelId || ''} ${id}-lbl`.trim();
142
+ buttonAttributes = {
143
+ 'aria-labelledby': labelId,
144
+ 'aria-describedby': this.ariaForm.messageId,
145
+ };
146
+ }
147
+ return (h(Host, { class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, block.class()), block.modifier('vertical').class(vertical)), block.modifier('disabled').class(disabled)), block.modifier('checked').class(checked)), block.modifier('invalid').class(invalid)), block.modifier('last').class(this.isLast && !checked)) }, h("button", Object.assign({ id: id, role: "radio", "aria-checked": checked ? 'true' : 'false' }, buttonAttributes, { class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, buttonBem.class()), buttonBem.modifier('checked').class(checked)), buttonBem.modifier('invalid').class(invalid)), buttonBem.modifier('disabled').class(disabled)), buttonBem.modifier('focused').class(focused)), buttonBem.modifier('vertical').class(vertical)), type: 'button', tabIndex: hasTabindex ? 0 : -1, part: "native", disabled: disabled, ref: el => (this.nativeEl = el) }, this.inheritedAttributes), h("bal-icon", { name: "check", size: "small", class: Object.assign(Object.assign(Object.assign({}, buttonBem.element('icon').class()), buttonBem.element('icon').modifier('animated').class(checked)), buttonBem.element('icon').modifier('vertical').class(vertical)), color: disabled ? 'grey-dark' : invalid ? 'white' : 'primary' }), h("bal-stack", { space: "x-small", layout: 'horizontal' }, h("bal-content", { space: "none" }, h("bal-label", { htmlId: `bal-si-${this.internalId}-label` }, label), h("span", { part: "slot", class: Object.assign({}, buttonBem.element('slot').modifier('hidden').class(!this.hasSlotContent)) }, ' ', h("slot", { onSlotchange: this.onSlottedItemsChange }))))), h("div", { class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, indicatorBem.class()), indicatorBem.modifier('animated').class()), indicatorBem.modifier('background').class()), indicatorBem.modifier('disabled').class(disabled)), indicatorBem.modifier('invalid').class(invalid)), indicatorBem.modifier('checked').class(checked)), indicatorBem.modifier('vertical').class(vertical)) })));
135
148
  }
136
149
  static get is() { return "bal-segment-item"; }
137
150
  static get originalStyleUrls() {
@@ -244,7 +257,7 @@ export class SegmentItem {
244
257
  },
245
258
  "value": {
246
259
  "type": "any",
247
- "mutable": false,
260
+ "mutable": true,
248
261
  "complexType": {
249
262
  "original": "SegmentValue",
250
263
  "resolved": "number | string",
@@ -264,7 +277,7 @@ export class SegmentItem {
264
277
  },
265
278
  "attribute": "value",
266
279
  "reflect": false,
267
- "defaultValue": "'bal-si-' + this.id"
280
+ "defaultValue": "'bal-si-' + this.internalId"
268
281
  }
269
282
  };
270
283
  }
@@ -272,32 +285,13 @@ export class SegmentItem {
272
285
  return {
273
286
  "hasSlotContent": {},
274
287
  "isFocusable": {},
275
- "isVertical": {}
288
+ "isVertical": {},
289
+ "isLast": {},
290
+ "isFirst": {},
291
+ "hasEmptyValue": {},
292
+ "ariaForm": {}
276
293
  };
277
294
  }
278
- static get events() {
279
- return [{
280
- "method": "balBlur",
281
- "name": "balBlur",
282
- "bubbles": true,
283
- "cancelable": true,
284
- "composed": true,
285
- "docs": {
286
- "tags": [],
287
- "text": "Emitted when the component was touched"
288
- },
289
- "complexType": {
290
- "original": "BalEvents.BalSegmentBlurDetail",
291
- "resolved": "FocusEvent",
292
- "references": {
293
- "BalEvents": {
294
- "location": "global",
295
- "id": "global::BalEvents"
296
- }
297
- }
298
- }
299
- }];
300
- }
301
295
  static get methods() {
302
296
  return {
303
297
  "setFocus": {
@@ -319,6 +313,35 @@ export class SegmentItem {
319
313
  "text": "Focuses the native <button> element\ninside of ion-segment-button."
320
314
  }]
321
315
  }
316
+ },
317
+ "setAriaForm": {
318
+ "complexType": {
319
+ "signature": "(ariaForm: BalAriaForm) => Promise<void>",
320
+ "parameters": [{
321
+ "name": "ariaForm",
322
+ "type": "BalAriaForm",
323
+ "docs": ""
324
+ }],
325
+ "references": {
326
+ "Promise": {
327
+ "location": "global",
328
+ "id": "global::Promise"
329
+ },
330
+ "BalAriaForm": {
331
+ "location": "import",
332
+ "path": "../../../utils/form",
333
+ "id": "src/utils/form.ts::BalAriaForm"
334
+ }
335
+ },
336
+ "return": "Promise<void>"
337
+ },
338
+ "docs": {
339
+ "text": "",
340
+ "tags": [{
341
+ "name": "internal",
342
+ "text": undefined
343
+ }]
344
+ }
322
345
  }
323
346
  };
324
347
  }
@@ -8,11 +8,18 @@ import { FOCUS_KEYS } from "../../utils/focus-visible";
8
8
  import { ListenToWindowResize } from "../../utils/resize";
9
9
  import { raf } from "../../utils/helpers";
10
10
  import { ListenToBreakpoints } from "../../utils/breakpoints";
11
+ import { ListenToFocus } from "../../utils/focus";
12
+ import { defaultBalAriaForm } from "../../utils/form";
11
13
  export class Segment {
12
14
  constructor() {
15
+ /**
16
+ * LISTENERS
17
+ * ------------------------------------------------------
18
+ */
19
+ this.hasFocus = false;
13
20
  this.getSegmentItem = (selector) => {
14
21
  var _a, _b;
15
- const items = this.items.filter(item => !item.disabled);
22
+ const items = this.allItems.filter(item => !item.disabled);
16
23
  const currIndex = items.findIndex(item => item === document.activeElement.closest('bal-segment-item'));
17
24
  switch (selector) {
18
25
  case 'current':
@@ -77,6 +84,7 @@ export class Segment {
77
84
  this.isVertical = false;
78
85
  this.isMobile = false;
79
86
  this.maxWidth = 0;
87
+ this.ariaForm = defaultBalAriaForm;
80
88
  this.invalid = false;
81
89
  this.disabled = false;
82
90
  this.vertical = false;
@@ -87,6 +95,9 @@ export class Segment {
87
95
  createLogger(log) {
88
96
  this.log = log;
89
97
  }
98
+ disabledChanged() {
99
+ this.allItems.map(item => (item.disabled = this.disabled));
100
+ }
90
101
  valueChanged(value) {
91
102
  /**
92
103
  * `balSelect` is emitted every time the value changes (internal or external changes).
@@ -101,6 +112,7 @@ export class Segment {
101
112
  connectedCallback() {
102
113
  this.el.addEventListener('touchstart', this.onPointerDown);
103
114
  this.el.addEventListener('mousedown', this.onPointerDown);
115
+ this.disabledChanged();
104
116
  }
105
117
  disconnectedCallback() {
106
118
  this.el.removeEventListener('touchstart', this.onPointerDown);
@@ -110,10 +122,12 @@ export class Segment {
110
122
  this.setCheckedClasses();
111
123
  this.defineWidth();
112
124
  }
113
- /**
114
- * LISTENERS
115
- * ------------------------------------------------------
116
- */
125
+ focusInListener(ev) {
126
+ this.balFocus.emit(ev);
127
+ }
128
+ focusOutListener(ev) {
129
+ this.balBlur.emit(ev);
130
+ }
117
131
  breakpointListener(breakpoints) {
118
132
  this.isMobile = breakpoints.mobile;
119
133
  }
@@ -135,9 +149,8 @@ export class Segment {
135
149
  this.emitVerticalChange(true);
136
150
  }
137
151
  }
138
- listenOnBalBlur(ev) {
139
- stopEventBubbling(ev);
140
- this.balBlur.emit(ev.detail);
152
+ listenOnKeyDownOutside() {
153
+ this.keyboardMode = true;
141
154
  }
142
155
  listenOnKeyDown(ev) {
143
156
  this.keyboardMode = FOCUS_KEYS.includes(ev.key);
@@ -145,6 +158,7 @@ export class Segment {
145
158
  if (isSpaceKey(ev)) {
146
159
  stopEventBubbling(ev);
147
160
  current = this.getSegmentItem('current');
161
+ this.value = current.value;
148
162
  }
149
163
  else if (isArrowUpKey(ev) || isArrowLeftKey(ev)) {
150
164
  stopEventBubbling(ev);
@@ -174,15 +188,25 @@ export class Segment {
174
188
  current.setFocus();
175
189
  }
176
190
  }
191
+ /**
192
+ * PUBLIC METHODS
193
+ * ------------------------------------------------------
194
+ */
195
+ /**
196
+ * @internal
197
+ */
198
+ async setAriaForm(ariaForm) {
199
+ this.ariaForm = Object.assign({}, ariaForm);
200
+ }
177
201
  /**
178
202
  * GETTERS
179
203
  * ------------------------------------------------------
180
204
  */
181
- get items() {
205
+ get allItems() {
182
206
  return Array.from(this.el.querySelectorAll('bal-segment-item'));
183
207
  }
184
208
  get checked() {
185
- return this.items.find(item => item.value === this.value);
209
+ return this.allItems.find(item => item.value === this.value);
186
210
  }
187
211
  /**
188
212
  * PRIVATE METHODS
@@ -207,8 +231,11 @@ export class Segment {
207
231
  });
208
232
  }
209
233
  getIndicator(item) {
210
- const root = item.shadowRoot || item;
211
- return root.querySelector('.bal-segment-item__indicator');
234
+ if (item) {
235
+ const root = item.shadowRoot || item;
236
+ return root.querySelector('.bal-segment-item__indicator');
237
+ }
238
+ return null;
212
239
  }
213
240
  checkButton(previous, current) {
214
241
  const previousIndicator = this.getIndicator(previous);
@@ -245,7 +272,7 @@ export class Segment {
245
272
  this.setCheckedClasses();
246
273
  }
247
274
  setCheckedClasses() {
248
- const items = this.items;
275
+ const items = this.allItems;
249
276
  const index = items.findIndex(item => item.value === this.value);
250
277
  const next = index + 1;
251
278
  const previous = index - 1;
@@ -265,9 +292,9 @@ export class Segment {
265
292
  * ------------------------------------------------------
266
293
  */
267
294
  render() {
268
- const { invalid, isVertical, scrollable, keyboardMode, expanded, isMobile } = this;
295
+ const { invalid, isVertical, scrollable, keyboardMode, expanded, isMobile, disabled } = this;
269
296
  const block = BEM.block('segment');
270
- return (h(Host, { role: "radiogroup", class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, block.class()), block.modifier('invalid').class(invalid)), block.modifier('vertical').class(isVertical)), block.modifier('scrollable').class(scrollable)), block.modifier('keyboard').class(keyboardMode)), block.modifier('expanded').class((expanded || isMobile) && !isVertical)), onClick: this.onClick }, h("slot", { onSlotchange: this.onSlottedItemsChange })));
297
+ return (h(Host, { role: "radiogroup", "aria-labelledby": this.ariaForm.labelId, "aria-describedby": this.ariaForm.messageId, class: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, block.class()), block.modifier('invalid').class(invalid)), block.modifier('vertical').class(isVertical)), block.modifier('scrollable').class(scrollable)), block.modifier('keyboard').class(keyboardMode)), block.modifier('disabled').class(disabled)), block.modifier('expanded').class((expanded || isMobile) && !isVertical)), onClick: this.onClick }, h("slot", { onSlotchange: this.onSlottedItemsChange })));
271
298
  }
272
299
  static get is() { return "bal-segment"; }
273
300
  static get originalStyleUrls() {
@@ -402,11 +429,32 @@ export class Segment {
402
429
  "keyboardMode": {},
403
430
  "isVertical": {},
404
431
  "isMobile": {},
405
- "maxWidth": {}
432
+ "maxWidth": {},
433
+ "ariaForm": {}
406
434
  };
407
435
  }
408
436
  static get events() {
409
437
  return [{
438
+ "method": "balFocus",
439
+ "name": "balFocus",
440
+ "bubbles": true,
441
+ "cancelable": true,
442
+ "composed": true,
443
+ "docs": {
444
+ "tags": [],
445
+ "text": "Emitted when the toggle has focus."
446
+ },
447
+ "complexType": {
448
+ "original": "BalEvents.BalSegmentFocusDetail",
449
+ "resolved": "FocusEvent",
450
+ "references": {
451
+ "BalEvents": {
452
+ "location": "global",
453
+ "id": "global::BalEvents"
454
+ }
455
+ }
456
+ }
457
+ }, {
410
458
  "method": "balBlur",
411
459
  "name": "balBlur",
412
460
  "bubbles": true,
@@ -494,18 +542,54 @@ export class Segment {
494
542
  }
495
543
  }];
496
544
  }
545
+ static get methods() {
546
+ return {
547
+ "setAriaForm": {
548
+ "complexType": {
549
+ "signature": "(ariaForm: BalAriaForm) => Promise<void>",
550
+ "parameters": [{
551
+ "name": "ariaForm",
552
+ "type": "BalAriaForm",
553
+ "docs": ""
554
+ }],
555
+ "references": {
556
+ "Promise": {
557
+ "location": "global",
558
+ "id": "global::Promise"
559
+ },
560
+ "BalAriaForm": {
561
+ "location": "import",
562
+ "path": "../../utils/form",
563
+ "id": "src/utils/form.ts::BalAriaForm"
564
+ }
565
+ },
566
+ "return": "Promise<void>"
567
+ },
568
+ "docs": {
569
+ "text": "",
570
+ "tags": [{
571
+ "name": "internal",
572
+ "text": undefined
573
+ }]
574
+ }
575
+ }
576
+ };
577
+ }
497
578
  static get elementRef() { return "el"; }
498
579
  static get watchers() {
499
580
  return [{
581
+ "propName": "disabled",
582
+ "methodName": "disabledChanged"
583
+ }, {
500
584
  "propName": "value",
501
585
  "methodName": "valueChanged"
502
586
  }];
503
587
  }
504
588
  static get listeners() {
505
589
  return [{
506
- "name": "balBlur",
507
- "method": "listenOnBalBlur",
508
- "target": undefined,
590
+ "name": "keydown",
591
+ "method": "listenOnKeyDownOutside",
592
+ "target": "document",
509
593
  "capture": false,
510
594
  "passive": false
511
595
  }, {
@@ -523,6 +607,18 @@ __decorate([
523
607
  __metadata("design:paramtypes", [Function]),
524
608
  __metadata("design:returntype", void 0)
525
609
  ], Segment.prototype, "createLogger", null);
610
+ __decorate([
611
+ ListenToFocus(),
612
+ __metadata("design:type", Function),
613
+ __metadata("design:paramtypes", [FocusEvent]),
614
+ __metadata("design:returntype", void 0)
615
+ ], Segment.prototype, "focusInListener", null);
616
+ __decorate([
617
+ ListenToFocus(),
618
+ __metadata("design:type", Function),
619
+ __metadata("design:paramtypes", [FocusEvent]),
620
+ __metadata("design:returntype", void 0)
621
+ ], Segment.prototype, "focusOutListener", null);
526
622
  __decorate([
527
623
  ListenToBreakpoints(),
528
624
  __metadata("design:type", Function),
@@ -1,2 +1,2 @@
1
1
  // generated by .build/version.js
2
- export const VERSION = '16.5.0-snapshot.1471-e419cbebb';
2
+ export const VERSION = '16.5.1';
@@ -1,7 +1,9 @@
1
1
  import { i as initializeBaloiseDesignSystem } from './initialize-e216cfe4.js';
2
2
 
3
- function globalScript () {
3
+ function appGlobalScript () {
4
4
  initializeBaloiseDesignSystem();
5
5
  }
6
6
 
7
- export { globalScript as g };
7
+ const globalScripts = appGlobalScript;
8
+
9
+ export { globalScripts as g };
@@ -3,12 +3,12 @@ import { _ as __decorate, a as __metadata } from './tslib.es6-654e2c24.js';
3
3
  import { l as raf, b as waitAfterFramePaint } from './helpers-c201154e.js';
4
4
  import { B as BEM } from './bem-8c7d2eb0.js';
5
5
  import { s as stopEventBubbling } from './form-input-a8fdaaef.js';
6
- import { L as ListenToBreakpoints } from './breakpoints.decorator-d3119ed5.js';
6
+ import { L as ListenToBreakpoints } from './breakpoints.decorator-8a50482f.js';
7
7
  import { g as getComputedWidth } from './style-ca1bd202.js';
8
8
  import { L as ListenToMutation } from './mutation.decorator-c7b24839.js';
9
9
  import { L as ListenToSwipe } from './swipe.decorator-9d904794.js';
10
10
  import { L as ListenToResize } from './resize.decorator-f70563b5.js';
11
- import { b as balBreakpoints } from './breakpoints.subject-ed7a3540.js';
11
+ import { b as balBreakpoints } from './breakpoints.subject-e3538fe7.js';
12
12
  import { d as defaultConfig } from './config.default-7efdc82d.js';
13
13
  import { L as ListenToConfig } from './config.decorator-d18abfe1.js';
14
14
  import { i as inheritAttributes } from './attributes-4fa7040f.js';
@@ -18,7 +18,7 @@ import './config.utils-6ac6c9bd.js';
18
18
  import './listener-04842ae9.js';
19
19
  import './swipe.subject-f1d64e8d.js';
20
20
  import './device-8c6d2881.js';
21
- import './tokens.esm-d31851f8.js';
21
+ import './tokens.esm-7cf87670.js';
22
22
  import './log-dfd1c19f.js';
23
23
 
24
24
  const TabControl = ({ value, items, containerId, onControlChange }) => {
@@ -12,16 +12,16 @@ import { B as BEM } from './bem-8c7d2eb0.js';
12
12
  import { L as Logger } from './log-dfd1c19f.js';
13
13
  import { d as defaultBalAriaForm } from './form-fb8dd9f5.js';
14
14
  import { d as defaultConfig, a as defaultLocale } from './config.default-7efdc82d.js';
15
- import { b as balBreakpoints } from './breakpoints.subject-ed7a3540.js';
15
+ import { b as balBreakpoints } from './breakpoints.subject-e3538fe7.js';
16
16
  import { g as useBalConfig } from './config.utils-6ac6c9bd.js';
17
- import { L as ListenToBreakpoints } from './breakpoints.decorator-d3119ed5.js';
17
+ import { L as ListenToBreakpoints } from './breakpoints.decorator-8a50482f.js';
18
18
  import { L as ListenToConfig } from './config.decorator-d18abfe1.js';
19
19
  import './browser-a8073d92.js';
20
20
  import './icons.constant-a7885631.js';
21
21
  import './_commonjsHelpers-1c8beb5f.js';
22
22
  import './device-8c6d2881.js';
23
23
  import './listener-04842ae9.js';
24
- import './tokens.esm-d31851f8.js';
24
+ import './tokens.esm-7cf87670.js';
25
25
 
26
26
  /**
27
27
  * @name addDays
@@ -33,6 +33,7 @@ const Field = class {
33
33
  'bal-input-slider',
34
34
  'bal-file-upload',
35
35
  'bal-dropdown',
36
+ 'bal-segment',
36
37
  ];
37
38
  this.formElements = [...this.formControlElement, 'bal-field-label', 'bal-field-message'];
38
39
  this.isDirectChild = (el) => {
@@ -122,6 +123,8 @@ const Field = class {
122
123
  'bal-field-control bal-dropdown',
123
124
  'bal-field-control bal-checkbox',
124
125
  'bal-field-control bal-radio',
126
+ 'bal-field-control bal-segment-item',
127
+ 'bal-field-control bal-segment',
125
128
  'bal-field-control bal-checkbox-group',
126
129
  'bal-field-control bal-radio-group',
127
130
  'bal-field-control bal-number-input',
@@ -3,8 +3,8 @@ import { _ as __decorate, a as __metadata } from './tslib.es6-654e2c24.js';
3
3
  import { B as BEM } from './bem-8c7d2eb0.js';
4
4
  import { p as preventDefault } from './utils-9fbab1d3.js';
5
5
  import { B as BalScrollHandler } from './scroll-f4b20848.js';
6
- import { b as balBreakpoints } from './breakpoints.subject-ed7a3540.js';
7
- import { L as ListenToBreakpoints } from './breakpoints.decorator-d3119ed5.js';
6
+ import { b as balBreakpoints } from './breakpoints.subject-e3538fe7.js';
7
+ import { L as ListenToBreakpoints } from './breakpoints.decorator-8a50482f.js';
8
8
  import { L as ListenToConfig } from './config.decorator-d18abfe1.js';
9
9
  import { b as balBrowser } from './browser-a8073d92.js';
10
10
  import { L as Logger } from './log-dfd1c19f.js';
@@ -14,7 +14,7 @@ import './icons.constant-a7885631.js';
14
14
  import './config.utils-6ac6c9bd.js';
15
15
  import './device-8c6d2881.js';
16
16
  import './listener-04842ae9.js';
17
- import './tokens.esm-d31851f8.js';
17
+ import './tokens.esm-7cf87670.js';
18
18
 
19
19
  const balHintCss = ":root{--bal-hint-content-background:var(--bal-color-grey-2)}.bal-hint{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:inline-block}.bal-hint__icon{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}@media (hover: hover)and (pointer: fine){.bal-hint__icon:hover svg,.bal-hint__icon:hover g,.bal-hint__icon:hover path,.bal-hint__icon:hover circle,.bal-hint__icon:focus svg,.bal-hint__icon:focus g,.bal-hint__icon:focus path,.bal-hint__icon:focus circle{fill:var(--bal-color-light-blue-5)}}.bal-hint__content{background:var(--bal-hint-content-background);display:-ms-flexbox;display:flex;gap:1.5rem;-ms-flex-direction:column;flex-direction:column}@media screen and (max-width: 768px){.bal-hint__content{padding:1.25rem;min-height:100%}.bal-hint__content>div{-ms-flex:1;flex:1}}.bal-hint__content__title{display:block;margin-bottom:1rem}.bal-hint__content__title__heading{font-family:var(--bal-title-font-family);font-weight:var(--bal-title-font-weight);font-size:var(--bal-text-size-x-large);line-height:var(--bal-line-height-x-large)}@media screen and (min-width: 769px),print{.bal-hint__content__title__heading{font-size:var(--bal-text-size-x-large-tablet);line-height:var(--bal-line-height-tablet-x-large)}}@media screen and (min-width: 1024px){.bal-hint__content__title__heading{font-size:var(--bal-text-size-x-large-desktop);line-height:var(--bal-line-height-desktop-x-large)}}@media screen and (min-width: 769px),print{.bal-hint__content__buttons--is-hidden-desktop{display:none !important}}.bal-hint__overlay__content{position:fixed;display:none;overflow:auto;top:0;left:0;right:0;bottom:0;z-index:var(--bal-z-index-popup)}.bal-hint__overlay__content--active{display:block}";
20
20
  const BalHintStyle0 = balHintCss;
@@ -4,16 +4,16 @@ import { _ as __decorate, a as __metadata } from './tslib.es6-654e2c24.js';
4
4
  import { L as Logger } from './log-dfd1c19f.js';
5
5
  import { l as raf, t as transitionEndAsync, h as debounce } from './helpers-c201154e.js';
6
6
  import { L as ListenToConfig } from './config.decorator-d18abfe1.js';
7
- import { b as balBreakpoints } from './breakpoints.subject-ed7a3540.js';
7
+ import { b as balBreakpoints } from './breakpoints.subject-e3538fe7.js';
8
8
  import { L as ListenToResize } from './resize.decorator-f70563b5.js';
9
- import { L as ListenToBreakpoints } from './breakpoints.decorator-d3119ed5.js';
9
+ import { L as ListenToBreakpoints } from './breakpoints.decorator-8a50482f.js';
10
10
  import { e as isSpaceKey, h as isEnterKey } from './index.esm-cc299511.js';
11
11
  import './browser-a8073d92.js';
12
12
  import './icons.constant-a7885631.js';
13
13
  import './config.utils-6ac6c9bd.js';
14
14
  import './device-8c6d2881.js';
15
15
  import './listener-04842ae9.js';
16
- import './tokens.esm-d31851f8.js';
16
+ import './tokens.esm-7cf87670.js';
17
17
  import './index-82aff103.js';
18
18
  import './_commonjsHelpers-1c8beb5f.js';
19
19