@ionic/core 7.3.4-dev.11696436834.1e83c799 → 7.3.4-dev.11699991837.1bc64f72

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 (150) hide show
  1. package/components/button-active.js +1 -1
  2. package/components/checkbox.js +6 -3
  3. package/components/data.js +31 -7
  4. package/components/index.js +2 -2
  5. package/components/index2.js +203 -429
  6. package/components/index3.js +429 -203
  7. package/components/ion-datetime-button.js +3 -0
  8. package/components/ion-datetime.js +132 -92
  9. package/components/ion-item-sliding.js +1 -1
  10. package/components/ion-menu.js +3 -3
  11. package/components/ion-modal.js +2 -2
  12. package/components/ion-nav.js +1 -1
  13. package/components/ion-range.js +3 -3
  14. package/components/ion-refresher.js +3 -3
  15. package/components/ion-reorder-group.js +1 -1
  16. package/components/ion-router-outlet.js +1 -1
  17. package/components/ion-segment.js +1 -1
  18. package/components/ion-toggle.js +7 -4
  19. package/components/ion-toolbar.js +2 -2
  20. package/components/ios.transition.js +1 -1
  21. package/components/md.transition.js +1 -1
  22. package/components/picker-column.js +1 -1
  23. package/components/popover.js +1 -1
  24. package/components/radio.js +6 -3
  25. package/components/swipe-back.js +1 -1
  26. package/dist/cjs/{data-967b9c15.js → data-db832785.js} +31 -7
  27. package/dist/cjs/index.cjs.js +10 -9
  28. package/dist/cjs/ion-app_8.cjs.entry.js +2 -2
  29. package/dist/cjs/ion-checkbox.cjs.entry.js +5 -3
  30. package/dist/cjs/ion-datetime-button.cjs.entry.js +4 -1
  31. package/dist/cjs/ion-datetime_3.cjs.entry.js +132 -93
  32. package/dist/cjs/ion-menu_3.cjs.entry.js +2 -2
  33. package/dist/cjs/ion-radio_2.cjs.entry.js +5 -3
  34. package/dist/cjs/ion-range.cjs.entry.js +2 -2
  35. package/dist/cjs/ion-toggle.cjs.entry.js +5 -3
  36. package/dist/cjs/ionic.cjs.js +1 -1
  37. package/dist/cjs/loader.cjs.js +1 -1
  38. package/dist/collection/components/checkbox/checkbox.ios.css +35 -0
  39. package/dist/collection/components/checkbox/checkbox.js +24 -4
  40. package/dist/collection/components/checkbox/checkbox.md.css +35 -0
  41. package/dist/collection/components/checkbox/test/item/checkbox.e2e.js +13 -0
  42. package/dist/collection/components/checkbox/test/label/checkbox.e2e.js +16 -0
  43. package/dist/collection/components/datetime/datetime.ios.css +32 -29
  44. package/dist/collection/components/datetime/datetime.js +137 -93
  45. package/dist/collection/components/datetime/datetime.md.css +20 -28
  46. package/dist/collection/components/datetime/test/basic/datetime.e2e.js +25 -0
  47. package/dist/collection/components/datetime/test/color/datetime.e2e.js +1 -1
  48. package/dist/collection/components/datetime/test/custom/datetime.e2e.js +27 -1
  49. package/dist/collection/components/datetime/test/prefer-wheel/datetime.e2e.js +15 -0
  50. package/dist/collection/components/datetime/test/set-value/datetime.e2e.js +9 -12
  51. package/dist/collection/components/datetime/utils/data.js +14 -6
  52. package/dist/collection/components/datetime/utils/parse.js +18 -1
  53. package/dist/collection/components/datetime-button/datetime-button.js +3 -0
  54. package/dist/collection/components/menu/menu.ios.css +94 -0
  55. package/dist/collection/components/menu/menu.md.css +94 -0
  56. package/dist/collection/components/radio/radio.ios.css +35 -0
  57. package/dist/collection/components/radio/radio.js +24 -4
  58. package/dist/collection/components/radio/radio.md.css +35 -0
  59. package/dist/collection/components/radio/test/item/radio.e2e.js +15 -0
  60. package/dist/collection/components/radio/test/label-placement/radio.e2e.js +20 -0
  61. package/dist/collection/components/range/range.ios.css +41 -1
  62. package/dist/collection/components/range/range.js +3 -3
  63. package/dist/collection/components/range/range.md.css +41 -1
  64. package/dist/collection/components/range/test/label/range.e2e.js +48 -0
  65. package/dist/collection/components/toggle/test/item/toggle.e2e.js +15 -0
  66. package/dist/collection/components/toggle/test/label/toggle.e2e.js +16 -0
  67. package/dist/collection/components/toggle/toggle.ios.css +35 -1
  68. package/dist/collection/components/toggle/toggle.js +24 -4
  69. package/dist/collection/components/toggle/toggle.md.css +35 -1
  70. package/dist/collection/components/toolbar/toolbar.ios.css +2 -4
  71. package/dist/collection/components/toolbar/toolbar.md.css +2 -4
  72. package/dist/collection/index.js +1 -0
  73. package/dist/docs.json +147 -18
  74. package/dist/esm/{data-4b448e3a.js → data-009dbf15.js} +31 -7
  75. package/dist/esm/index.js +2 -2
  76. package/dist/esm/ion-app_8.entry.js +2 -2
  77. package/dist/esm/ion-checkbox.entry.js +5 -3
  78. package/dist/esm/ion-datetime-button.entry.js +4 -1
  79. package/dist/esm/ion-datetime_3.entry.js +132 -93
  80. package/dist/esm/ion-menu_3.entry.js +2 -2
  81. package/dist/esm/ion-radio_2.entry.js +5 -3
  82. package/dist/esm/ion-range.entry.js +2 -2
  83. package/dist/esm/ion-toggle.entry.js +5 -3
  84. package/dist/esm/ionic.js +1 -1
  85. package/dist/esm/loader.js +1 -1
  86. package/dist/esm-es5/data-009dbf15.js +4 -0
  87. package/dist/esm-es5/index.js +1 -1
  88. package/dist/esm-es5/ion-app_8.entry.js +1 -1
  89. package/dist/esm-es5/ion-checkbox.entry.js +1 -1
  90. package/dist/esm-es5/ion-datetime-button.entry.js +1 -1
  91. package/dist/esm-es5/ion-datetime_3.entry.js +1 -1
  92. package/dist/esm-es5/ion-menu_3.entry.js +1 -1
  93. package/dist/esm-es5/ion-radio_2.entry.js +1 -1
  94. package/dist/esm-es5/ion-range.entry.js +1 -1
  95. package/dist/esm-es5/ion-toggle.entry.js +1 -1
  96. package/dist/esm-es5/ionic.js +1 -1
  97. package/dist/esm-es5/loader.js +1 -1
  98. package/dist/html.html-data.json +52 -4
  99. package/dist/ionic/index.esm.js +1 -1
  100. package/dist/ionic/ionic.esm.js +1 -1
  101. package/dist/ionic/p-06902103.system.js +1 -1
  102. package/dist/ionic/p-1f4adf06.system.entry.js +4 -0
  103. package/dist/ionic/p-218b6f33.entry.js +4 -0
  104. package/dist/ionic/p-2da6ba37.system.entry.js +4 -0
  105. package/dist/ionic/p-40138199.entry.js +4 -0
  106. package/dist/ionic/p-44ef7224.system.js +4 -0
  107. package/dist/ionic/p-4ca1ce6b.system.entry.js +4 -0
  108. package/dist/ionic/p-51b165af.system.js +4 -0
  109. package/dist/ionic/p-57f0efcc.entry.js +4 -0
  110. package/dist/ionic/{p-d3b8aebf.entry.js → p-67b891af.entry.js} +1 -1
  111. package/dist/ionic/p-7cfd253c.js +4 -0
  112. package/dist/ionic/p-82f5c07e.system.entry.js +4 -0
  113. package/dist/ionic/p-86c5c320.entry.js +4 -0
  114. package/dist/ionic/p-90ec5785.system.entry.js +4 -0
  115. package/dist/ionic/{p-45ee211b.system.entry.js → p-a34669bf.system.entry.js} +1 -1
  116. package/dist/ionic/p-af986299.system.entry.js +4 -0
  117. package/dist/ionic/p-b321c999.entry.js +4 -0
  118. package/dist/ionic/p-d8a0267b.system.entry.js +4 -0
  119. package/dist/ionic/p-f5c19164.entry.js +4 -0
  120. package/dist/ionic/{p-c759a704.entry.js → p-f9567c67.entry.js} +1 -1
  121. package/dist/types/components/checkbox/checkbox.d.ts +8 -1
  122. package/dist/types/components/datetime/datetime.d.ts +23 -10
  123. package/dist/types/components/datetime/utils/data.d.ts +1 -1
  124. package/dist/types/components/datetime/utils/parse.d.ts +3 -3
  125. package/dist/types/components/radio/radio.d.ts +8 -1
  126. package/dist/types/components/range/range.d.ts +2 -1
  127. package/dist/types/components/toast/toast-interface.d.ts +3 -0
  128. package/dist/types/components/toggle/toggle.d.ts +8 -1
  129. package/dist/types/components.d.ts +40 -16
  130. package/dist/types/index.d.ts +1 -0
  131. package/dist/types/interface.d.ts +1 -0
  132. package/hydrate/index.js +196 -114
  133. package/package.json +2 -2
  134. package/dist/esm-es5/data-4b448e3a.js +0 -4
  135. package/dist/ionic/p-0053fe81.system.entry.js +0 -4
  136. package/dist/ionic/p-091cd81e.entry.js +0 -4
  137. package/dist/ionic/p-28f5715a.system.entry.js +0 -4
  138. package/dist/ionic/p-2cdcd6f2.entry.js +0 -4
  139. package/dist/ionic/p-5009cb46.entry.js +0 -4
  140. package/dist/ionic/p-5b88f780.entry.js +0 -4
  141. package/dist/ionic/p-601fd53c.js +0 -4
  142. package/dist/ionic/p-8843b046.system.js +0 -4
  143. package/dist/ionic/p-98b618ce.system.entry.js +0 -4
  144. package/dist/ionic/p-b1e8f045.entry.js +0 -4
  145. package/dist/ionic/p-b3394798.system.entry.js +0 -4
  146. package/dist/ionic/p-b3cfc6e1.system.entry.js +0 -4
  147. package/dist/ionic/p-cc8910e7.system.js +0 -4
  148. package/dist/ionic/p-e53b8af4.system.entry.js +0 -4
  149. package/dist/ionic/p-f78e60a5.entry.js +0 -4
  150. package/dist/ionic/p-fd42994b.system.entry.js +0 -4
@@ -220,12 +220,20 @@ export const generateTime = (refParts, hourCycle = 'h12', minParts, maxParts, ho
220
220
  * Given DatetimeParts, generate the previous,
221
221
  * current, and and next months.
222
222
  */
223
- export const generateMonths = (refParts) => {
224
- return [
225
- getPreviousMonth(refParts),
226
- { month: refParts.month, year: refParts.year, day: refParts.day },
227
- getNextMonth(refParts),
228
- ];
223
+ export const generateMonths = (refParts, forcedDate) => {
224
+ const current = { month: refParts.month, year: refParts.year, day: refParts.day };
225
+ /**
226
+ * If we're forcing a month to appear, and it's different from the current month,
227
+ * ensure it appears by replacing the next or previous month as appropriate.
228
+ */
229
+ if (forcedDate !== undefined && (refParts.month !== forcedDate.month || refParts.year !== forcedDate.year)) {
230
+ const forced = { month: forcedDate.month, year: forcedDate.year, day: forcedDate.day };
231
+ const forcedMonthIsBefore = isBefore(forced, current);
232
+ return forcedMonthIsBefore
233
+ ? [forced, current, getNextMonth(refParts)]
234
+ : [getPreviousMonth(refParts), current, forced];
235
+ }
236
+ return [getPreviousMonth(refParts), current, getNextMonth(refParts)];
229
237
  };
230
238
  export const getMonthColumnData = (locale, refParts, minParts, maxParts, monthValues, formatOptions = {
231
239
  month: 'long',
@@ -1,6 +1,7 @@
1
1
  /*!
2
2
  * (C) Ionic http://ionicframework.com - MIT License
3
3
  */
4
+ import { printIonWarning } from "../../../utils/logging/index";
4
5
  import { isAfter, isBefore } from "./comparison";
5
6
  import { getNumDaysInMonth } from "./helpers";
6
7
  const ISO_8601_REGEXP =
@@ -47,7 +48,22 @@ export const getPartsFromCalendarDay = (el) => {
47
48
  };
48
49
  export function parseDate(val) {
49
50
  if (Array.isArray(val)) {
50
- return val.map((valStr) => parseDate(valStr));
51
+ const parsedArray = [];
52
+ for (const valStr of val) {
53
+ const parsedVal = parseDate(valStr);
54
+ /**
55
+ * If any of the values weren't parsed correctly, consider
56
+ * the entire batch incorrect. This simplifies the type
57
+ * signatures by having "undefined" be a general error case
58
+ * instead of returning (Datetime | undefined)[], which is
59
+ * harder for TS to perform type narrowing on.
60
+ */
61
+ if (!parsedVal) {
62
+ return undefined;
63
+ }
64
+ parsedArray.push(parsedVal);
65
+ }
66
+ return parsedArray;
51
67
  }
52
68
  // manually parse IS0 cuz Date.parse cannot be trusted
53
69
  // ISO 8601 format: 1994-12-15T13:47:20Z
@@ -67,6 +83,7 @@ export function parseDate(val) {
67
83
  }
68
84
  if (parse === null) {
69
85
  // wasn't able to parse the ISO datetime
86
+ printIonWarning(`Unable to parse date string: ${val}. Please provide a valid ISO 8601 datetime string.`);
70
87
  return undefined;
71
88
  }
72
89
  // ensure all the parse values exist with at least 0
@@ -54,6 +54,9 @@ export class DatetimeButton {
54
54
  * to today's date and time if no value is set.
55
55
  */
56
56
  const parsedDatetimes = parseDate(parsedValues.length > 0 ? parsedValues : [getToday()]);
57
+ if (!parsedDatetimes) {
58
+ return;
59
+ }
57
60
  /**
58
61
  * If developers incorrectly use multiple="true"
59
62
  * with non "date" datetimes, then just select
@@ -47,6 +47,18 @@
47
47
  }
48
48
 
49
49
  :host(.menu-side-start) .menu-inner {
50
+ /**
51
+ * Menu does not cover the whole screen so we need to set the safe area for the
52
+ * side that touches the screen edge only. Since safe area is not logical, it
53
+ * needs to be applied to the correct side depending on the language direction.
54
+ * Otherwise, the content will have less space on both sides.
55
+ *
56
+ * LTR:
57
+ * The left side of the menu touches the screen edge. The safe area padding has
58
+ * already been set in the core styles, so there's no need to set it again.
59
+ * The right side of the menu is not touching the screen edge. Padding is not
60
+ * applied to the right side of the menu. A value of 0 is set.
61
+ */
50
62
  --ion-safe-area-right: 0px;
51
63
  top: 0;
52
64
  bottom: 0;
@@ -77,8 +89,55 @@
77
89
  }
78
90
  }
79
91
  }
92
+ :host-context([dir=rtl]):host(.menu-side-start) .menu-inner, :host-context([dir=rtl]).menu-side-start .menu-inner {
93
+ /**
94
+ * Menu does not cover the whole screen so we need to set the safe area for the
95
+ * side that touches the screen edge only. Since safe area is not logical, it
96
+ * needs to be applied to the correct side depending on the language direction.
97
+ * Otherwise, the content will have less space on both sides.
98
+ *
99
+ * RTL:
100
+ * The right side of the menu touches the screen edge. The safe area padding has
101
+ * already been set in the core styles, so there's no need to set it again.
102
+ * The left side of the menu is not touching the screen edge. Padding is not
103
+ * applied to the left side of the menu. A value of 0 is set.
104
+ */
105
+ --ion-safe-area-right: env(safe-area-inset-right);
106
+ --ion-safe-area-left: 0px;
107
+ }
108
+
109
+ @supports selector(:dir(rtl)) {
110
+ :host(.menu-side-start) .menu-inner:dir(rtl) {
111
+ /**
112
+ * Menu does not cover the whole screen so we need to set the safe area for the
113
+ * side that touches the screen edge only. Since safe area is not logical, it
114
+ * needs to be applied to the correct side depending on the language direction.
115
+ * Otherwise, the content will have less space on both sides.
116
+ *
117
+ * RTL:
118
+ * The right side of the menu touches the screen edge. The safe area padding has
119
+ * already been set in the core styles, so there's no need to set it again.
120
+ * The left side of the menu is not touching the screen edge. Padding is not
121
+ * applied to the left side of the menu. A value of 0 is set.
122
+ */
123
+ --ion-safe-area-right: env(safe-area-inset-right);
124
+ --ion-safe-area-left: 0px;
125
+ }
126
+ }
80
127
 
81
128
  :host(.menu-side-end) .menu-inner {
129
+ /**
130
+ * Menu does not cover the whole screen so we need to set the safe area for the
131
+ * side that touches the screen edge only. Since safe area is not logical, it
132
+ * needs to be applied to the correct side depending on the language direction.
133
+ * Otherwise, the content will have less space on both sides.
134
+ *
135
+ * LTR:
136
+ * The right side of the menu touches the screen edge. The safe area padding has
137
+ * already been set in the core styles, so there's no need to set it again.
138
+ * The left side of the menu is not touching the screen edge. Padding is not
139
+ * applied to the left side of the menu. A value of 0 is set.
140
+ */
82
141
  --ion-safe-area-left: 0px;
83
142
  top: 0;
84
143
  bottom: 0;
@@ -109,6 +168,41 @@
109
168
  }
110
169
  }
111
170
  }
171
+ :host-context([dir=rtl]):host(.menu-side-end) .menu-inner, :host-context([dir=rtl]).menu-side-end .menu-inner {
172
+ /**
173
+ * Menu does not cover the whole screen so we need to set the safe area for the
174
+ * side that touches the screen edge only. Since safe area is not logical, it
175
+ * needs to be applied to the correct side depending on the language direction.
176
+ * Otherwise, the content will have less space on both sides.
177
+ *
178
+ * RTL:
179
+ * The left side of the menu touches the screen edge. The safe area padding has
180
+ * already been set in the core styles, so there's no need to set it again.
181
+ * The right side of the menu is not touching the screen edge. Padding is not
182
+ * applied to the right side of the menu. A value of 0 is set.
183
+ */
184
+ --ion-safe-area-left: env(safe-area-inset-left);
185
+ --ion-safe-area-right: 0px;
186
+ }
187
+
188
+ @supports selector(:dir(rtl)) {
189
+ :host(.menu-side-end) .menu-inner:dir(rtl) {
190
+ /**
191
+ * Menu does not cover the whole screen so we need to set the safe area for the
192
+ * side that touches the screen edge only. Since safe area is not logical, it
193
+ * needs to be applied to the correct side depending on the language direction.
194
+ * Otherwise, the content will have less space on both sides.
195
+ *
196
+ * RTL:
197
+ * The left side of the menu touches the screen edge. The safe area padding has
198
+ * already been set in the core styles, so there's no need to set it again.
199
+ * The right side of the menu is not touching the screen edge. Padding is not
200
+ * applied to the right side of the menu. A value of 0 is set.
201
+ */
202
+ --ion-safe-area-left: env(safe-area-inset-left);
203
+ --ion-safe-area-right: 0px;
204
+ }
205
+ }
112
206
 
113
207
  ion-backdrop {
114
208
  display: none;
@@ -47,6 +47,18 @@
47
47
  }
48
48
 
49
49
  :host(.menu-side-start) .menu-inner {
50
+ /**
51
+ * Menu does not cover the whole screen so we need to set the safe area for the
52
+ * side that touches the screen edge only. Since safe area is not logical, it
53
+ * needs to be applied to the correct side depending on the language direction.
54
+ * Otherwise, the content will have less space on both sides.
55
+ *
56
+ * LTR:
57
+ * The left side of the menu touches the screen edge. The safe area padding has
58
+ * already been set in the core styles, so there's no need to set it again.
59
+ * The right side of the menu is not touching the screen edge. Padding is not
60
+ * applied to the right side of the menu. A value of 0 is set.
61
+ */
50
62
  --ion-safe-area-right: 0px;
51
63
  top: 0;
52
64
  bottom: 0;
@@ -77,8 +89,55 @@
77
89
  }
78
90
  }
79
91
  }
92
+ :host-context([dir=rtl]):host(.menu-side-start) .menu-inner, :host-context([dir=rtl]).menu-side-start .menu-inner {
93
+ /**
94
+ * Menu does not cover the whole screen so we need to set the safe area for the
95
+ * side that touches the screen edge only. Since safe area is not logical, it
96
+ * needs to be applied to the correct side depending on the language direction.
97
+ * Otherwise, the content will have less space on both sides.
98
+ *
99
+ * RTL:
100
+ * The right side of the menu touches the screen edge. The safe area padding has
101
+ * already been set in the core styles, so there's no need to set it again.
102
+ * The left side of the menu is not touching the screen edge. Padding is not
103
+ * applied to the left side of the menu. A value of 0 is set.
104
+ */
105
+ --ion-safe-area-right: env(safe-area-inset-right);
106
+ --ion-safe-area-left: 0px;
107
+ }
108
+
109
+ @supports selector(:dir(rtl)) {
110
+ :host(.menu-side-start) .menu-inner:dir(rtl) {
111
+ /**
112
+ * Menu does not cover the whole screen so we need to set the safe area for the
113
+ * side that touches the screen edge only. Since safe area is not logical, it
114
+ * needs to be applied to the correct side depending on the language direction.
115
+ * Otherwise, the content will have less space on both sides.
116
+ *
117
+ * RTL:
118
+ * The right side of the menu touches the screen edge. The safe area padding has
119
+ * already been set in the core styles, so there's no need to set it again.
120
+ * The left side of the menu is not touching the screen edge. Padding is not
121
+ * applied to the left side of the menu. A value of 0 is set.
122
+ */
123
+ --ion-safe-area-right: env(safe-area-inset-right);
124
+ --ion-safe-area-left: 0px;
125
+ }
126
+ }
80
127
 
81
128
  :host(.menu-side-end) .menu-inner {
129
+ /**
130
+ * Menu does not cover the whole screen so we need to set the safe area for the
131
+ * side that touches the screen edge only. Since safe area is not logical, it
132
+ * needs to be applied to the correct side depending on the language direction.
133
+ * Otherwise, the content will have less space on both sides.
134
+ *
135
+ * LTR:
136
+ * The right side of the menu touches the screen edge. The safe area padding has
137
+ * already been set in the core styles, so there's no need to set it again.
138
+ * The left side of the menu is not touching the screen edge. Padding is not
139
+ * applied to the left side of the menu. A value of 0 is set.
140
+ */
82
141
  --ion-safe-area-left: 0px;
83
142
  top: 0;
84
143
  bottom: 0;
@@ -109,6 +168,41 @@
109
168
  }
110
169
  }
111
170
  }
171
+ :host-context([dir=rtl]):host(.menu-side-end) .menu-inner, :host-context([dir=rtl]).menu-side-end .menu-inner {
172
+ /**
173
+ * Menu does not cover the whole screen so we need to set the safe area for the
174
+ * side that touches the screen edge only. Since safe area is not logical, it
175
+ * needs to be applied to the correct side depending on the language direction.
176
+ * Otherwise, the content will have less space on both sides.
177
+ *
178
+ * RTL:
179
+ * The left side of the menu touches the screen edge. The safe area padding has
180
+ * already been set in the core styles, so there's no need to set it again.
181
+ * The right side of the menu is not touching the screen edge. Padding is not
182
+ * applied to the right side of the menu. A value of 0 is set.
183
+ */
184
+ --ion-safe-area-left: env(safe-area-inset-left);
185
+ --ion-safe-area-right: 0px;
186
+ }
187
+
188
+ @supports selector(:dir(rtl)) {
189
+ :host(.menu-side-end) .menu-inner:dir(rtl) {
190
+ /**
191
+ * Menu does not cover the whole screen so we need to set the safe area for the
192
+ * side that touches the screen edge only. Since safe area is not logical, it
193
+ * needs to be applied to the correct side depending on the language direction.
194
+ * Otherwise, the content will have less space on both sides.
195
+ *
196
+ * RTL:
197
+ * The left side of the menu touches the screen edge. The safe area padding has
198
+ * already been set in the core styles, so there's no need to set it again.
199
+ * The right side of the menu is not touching the screen edge. Padding is not
200
+ * applied to the right side of the menu. A value of 0 is set.
201
+ */
202
+ --ion-safe-area-left: env(safe-area-inset-left);
203
+ --ion-safe-area-right: 0px;
204
+ }
205
+ }
112
206
 
113
207
  ion-backdrop {
114
208
  display: none;
@@ -147,6 +147,15 @@ input {
147
147
  margin-bottom: 10px;
148
148
  }
149
149
 
150
+ :host(.in-item.radio-label-placement-stacked) .label-text-wrapper {
151
+ margin-top: 10px;
152
+ margin-bottom: 16px;
153
+ }
154
+
155
+ :host(.in-item.radio-label-placement-stacked) .native-wrapper {
156
+ margin-bottom: 10px;
157
+ }
158
+
150
159
  /**
151
160
  * If no label text is placed into the slot
152
161
  * then the element should be hidden otherwise
@@ -173,6 +182,14 @@ input {
173
182
  justify-content: end;
174
183
  }
175
184
 
185
+ :host(.radio-alignment-start) .radio-wrapper {
186
+ align-items: start;
187
+ }
188
+
189
+ :host(.radio-alignment-center) .radio-wrapper {
190
+ align-items: center;
191
+ }
192
+
176
193
  /**
177
194
  * Label is on the left of the radio in LTR and
178
195
  * on the right in RTL.
@@ -235,6 +252,24 @@ input {
235
252
  min-width: 100px;
236
253
  }
237
254
 
255
+ /**
256
+ * Label is on top of the radio.
257
+ */
258
+ :host(.radio-label-placement-stacked) .radio-wrapper {
259
+ flex-direction: column;
260
+ }
261
+
262
+ :host(.radio-label-placement-stacked) .label-text-wrapper {
263
+ /**
264
+ * The margin between the label and
265
+ * the radio should be on the bottom
266
+ * when the label sits on top.
267
+ */
268
+ margin-left: 0;
269
+ margin-right: 0;
270
+ margin-bottom: 16px;
271
+ }
272
+
238
273
  :host {
239
274
  --color-checked: var(--ion-color-primary, #3880ff);
240
275
  }
@@ -70,6 +70,7 @@ export class Radio {
70
70
  this.labelPlacement = 'start';
71
71
  this.legacy = undefined;
72
72
  this.justify = 'space-between';
73
+ this.alignment = 'center';
73
74
  }
74
75
  valueChanged() {
75
76
  /**
@@ -134,7 +135,7 @@ export class Radio {
134
135
  return legacyFormController.hasLegacyControl() ? this.renderLegacyRadio() : this.renderRadio();
135
136
  }
136
137
  renderRadio() {
137
- const { checked, disabled, color, el, justify, labelPlacement, hasLabel, buttonTabindex } = this;
138
+ const { checked, disabled, color, el, justify, labelPlacement, hasLabel, buttonTabindex, alignment } = this;
138
139
  const mode = getIonMode(this);
139
140
  const inItem = hostContext('ion-item', el);
140
141
  return (h(Host, { onFocus: this.onFocus, onBlur: this.onBlur, onClick: this.onClick, class: createColorClasses(color, {
@@ -143,6 +144,7 @@ export class Radio {
143
144
  'radio-checked': checked,
144
145
  'radio-disabled': disabled,
145
146
  [`radio-justify-${justify}`]: true,
147
+ [`radio-alignment-${alignment}`]: true,
146
148
  [`radio-label-placement-${labelPlacement}`]: true,
147
149
  // Focus and active styling should not apply when the radio is in an item
148
150
  'ion-activatable': !inItem,
@@ -275,15 +277,15 @@ Developers can dismiss this warning by removing their usage of the "legacy" prop
275
277
  "type": "string",
276
278
  "mutable": false,
277
279
  "complexType": {
278
- "original": "'start' | 'end' | 'fixed'",
279
- "resolved": "\"end\" | \"fixed\" | \"start\"",
280
+ "original": "'start' | 'end' | 'fixed' | 'stacked'",
281
+ "resolved": "\"end\" | \"fixed\" | \"stacked\" | \"start\"",
280
282
  "references": {}
281
283
  },
282
284
  "required": false,
283
285
  "optional": false,
284
286
  "docs": {
285
287
  "tags": [],
286
- "text": "Where to place the label relative to the radio.\n`\"start\"`: The label will appear to the left of the radio in LTR and to the right in RTL.\n`\"end\"`: The label will appear to the right of the radio in LTR and to the left in RTL.\n`\"fixed\"`: The label has the same behavior as `\"start\"` except it also has a fixed width. Long text will be truncated with ellipses (\"...\")."
288
+ "text": "Where to place the label relative to the radio.\n`\"start\"`: The label will appear to the left of the radio in LTR and to the right in RTL.\n`\"end\"`: The label will appear to the right of the radio in LTR and to the left in RTL.\n`\"fixed\"`: The label has the same behavior as `\"start\"` except it also has a fixed width. Long text will be truncated with ellipses (\"...\").\n`\"stacked\"`: The label will appear above the radio regardless of the direction. The alignment of the label can be controlled with the `alignment` property."
287
289
  },
288
290
  "attribute": "label-placement",
289
291
  "reflect": false,
@@ -323,6 +325,24 @@ Developers can dismiss this warning by removing their usage of the "legacy" prop
323
325
  "attribute": "justify",
324
326
  "reflect": false,
325
327
  "defaultValue": "'space-between'"
328
+ },
329
+ "alignment": {
330
+ "type": "string",
331
+ "mutable": false,
332
+ "complexType": {
333
+ "original": "'start' | 'center'",
334
+ "resolved": "\"center\" | \"start\"",
335
+ "references": {}
336
+ },
337
+ "required": false,
338
+ "optional": false,
339
+ "docs": {
340
+ "tags": [],
341
+ "text": "How to control the alignment of the radio and label on the cross axis.\n`\"start\"`: The label and control will appear on the left of the cross axis in LTR, and on the right side in RTL.\n`\"center\"`: The label and control will appear at the center of the cross axis in both LTR and RTL."
342
+ },
343
+ "attribute": "alignment",
344
+ "reflect": false,
345
+ "defaultValue": "'center'"
326
346
  }
327
347
  };
328
348
  }
@@ -147,6 +147,15 @@ input {
147
147
  margin-bottom: 10px;
148
148
  }
149
149
 
150
+ :host(.in-item.radio-label-placement-stacked) .label-text-wrapper {
151
+ margin-top: 10px;
152
+ margin-bottom: 16px;
153
+ }
154
+
155
+ :host(.in-item.radio-label-placement-stacked) .native-wrapper {
156
+ margin-bottom: 10px;
157
+ }
158
+
150
159
  /**
151
160
  * If no label text is placed into the slot
152
161
  * then the element should be hidden otherwise
@@ -173,6 +182,14 @@ input {
173
182
  justify-content: end;
174
183
  }
175
184
 
185
+ :host(.radio-alignment-start) .radio-wrapper {
186
+ align-items: start;
187
+ }
188
+
189
+ :host(.radio-alignment-center) .radio-wrapper {
190
+ align-items: center;
191
+ }
192
+
176
193
  /**
177
194
  * Label is on the left of the radio in LTR and
178
195
  * on the right in RTL.
@@ -235,6 +252,24 @@ input {
235
252
  min-width: 100px;
236
253
  }
237
254
 
255
+ /**
256
+ * Label is on top of the radio.
257
+ */
258
+ :host(.radio-label-placement-stacked) .radio-wrapper {
259
+ flex-direction: column;
260
+ }
261
+
262
+ :host(.radio-label-placement-stacked) .label-text-wrapper {
263
+ /**
264
+ * The margin between the label and
265
+ * the radio should be on the bottom
266
+ * when the label sits on top.
267
+ */
268
+ margin-left: 0;
269
+ margin-right: 0;
270
+ margin-bottom: 16px;
271
+ }
272
+
238
273
  :host {
239
274
  --color: rgb(var(--ion-text-color-rgb, 0, 0, 0), 0.6);
240
275
  --color-checked: var(--ion-color-primary, #3880ff);
@@ -51,4 +51,19 @@ configs({ directions: ['ltr'], modes: ['md'] }).forEach(({ title, screenshot, co
51
51
  await expect(list).toHaveScreenshot(screenshot(`radio-long-label-in-item`));
52
52
  });
53
53
  });
54
+ test.describe(title('radio: stacked label in item'), () => {
55
+ test('should render margins correctly when using stacked label in item', async ({ page }) => {
56
+ await page.setContent(`
57
+ <ion-list>
58
+ <ion-radio-group>
59
+ <ion-item>
60
+ <ion-radio label-placement="stacked">Enable Notifications</ion-radio>
61
+ </ion-item>
62
+ </ion-radio-group>
63
+ </ion-list>
64
+ `, config);
65
+ const list = page.locator('ion-list');
66
+ await expect(list).toHaveScreenshot(screenshot(`radio-stacked-label-in-item`));
67
+ });
68
+ });
54
69
  });
@@ -100,5 +100,25 @@ configs().forEach(({ title, screenshot, config }) => {
100
100
  await expect(radio).toHaveScreenshot(screenshot(`radio-label-fixed-justify-space-between`));
101
101
  });
102
102
  });
103
+ test.describe('radio: stacked placement', () => {
104
+ test('should align the label to the start of the container in the stacked position', async ({ page }) => {
105
+ await page.setContent(`
106
+ <ion-radio-group value="1">
107
+ <ion-radio label-placement="stacked" alignment="start" style="width: 200px" value="1">This is a long label</ion-radio>
108
+ </ion-radio-group>
109
+ `, config);
110
+ const radio = page.locator('ion-radio');
111
+ await expect(radio).toHaveScreenshot(screenshot(`radio-label-stacked-align-start`));
112
+ });
113
+ test('should align the label to the center of the container in the stacked position', async ({ page }) => {
114
+ await page.setContent(`
115
+ <ion-radio-group value="1">
116
+ <ion-radio label-placement="stacked" alignment="center" style="width: 200px" value="1">This is a long label</ion-radio>
117
+ </ion-radio-group>
118
+ `, config);
119
+ const radio = page.locator('ion-radio');
120
+ await expect(radio).toHaveScreenshot(screenshot(`radio-label-stacked-align-center`));
121
+ });
122
+ });
103
123
  });
104
124
  });
@@ -363,6 +363,25 @@
363
363
  max-width: 200px;
364
364
  }
365
365
 
366
+ /**
367
+ * Label is on top of the range.
368
+ */
369
+ :host(.range-label-placement-stacked) .range-wrapper {
370
+ flex-direction: column;
371
+ align-items: stretch;
372
+ }
373
+
374
+ :host(.range-label-placement-stacked) .label-text-wrapper {
375
+ /**
376
+ * The margin between the label and
377
+ * the range should be on the bottom
378
+ * when the label sits on top.
379
+ */
380
+ margin-left: 0;
381
+ margin-right: 0;
382
+ margin-bottom: 16px;
383
+ }
384
+
366
385
  :host {
367
386
  --knob-border-radius: 50%;
368
387
  --knob-background: #ffffff;
@@ -407,10 +426,31 @@
407
426
  margin-bottom: 0;
408
427
  }
409
428
 
410
- :host(.range-has-pin) {
429
+ :host(.range-has-pin:not(.range-label-placement-stacked)) {
430
+ /**
431
+ * The pin should not overlap any elements that are
432
+ * above the range. By adding padding to the top of the
433
+ * range, it provides a buffer for the pin to move into
434
+ * when it is pressed.
435
+ *
436
+ * The padding is not included when the label is stacked
437
+ * because the pin is below the label.
438
+ * It still requires a buffer to prevent the pin from
439
+ * overlapping the range. The buffer is added to the
440
+ * bottom of the range label instead of the host.
441
+ */
411
442
  padding-top: 20px;
412
443
  }
413
444
 
445
+ :host(.range-has-pin.range-label-placement-stacked) .label-text-wrapper {
446
+ /**
447
+ * The pin should not overlap the stacked label. By adding
448
+ * margin to the bottom of the label, it provides a buffer
449
+ * for the pin to move into when it is pressed.
450
+ */
451
+ margin-bottom: 20px;
452
+ }
453
+
414
454
  .range-bar-active {
415
455
  bottom: 0;
416
456
  width: auto;
@@ -808,15 +808,15 @@ Developers can dismiss this warning by removing their usage of the "legacy" prop
808
808
  "type": "string",
809
809
  "mutable": false,
810
810
  "complexType": {
811
- "original": "'start' | 'end' | 'fixed'",
812
- "resolved": "\"end\" | \"fixed\" | \"start\"",
811
+ "original": "'start' | 'end' | 'fixed' | 'stacked'",
812
+ "resolved": "\"end\" | \"fixed\" | \"stacked\" | \"start\"",
813
813
  "references": {}
814
814
  },
815
815
  "required": false,
816
816
  "optional": false,
817
817
  "docs": {
818
818
  "tags": [],
819
- "text": "Where to place the label relative to the range.\n`\"start\"`: The label will appear to the left of the range in LTR and to the right in RTL.\n`\"end\"`: The label will appear to the right of the range in LTR and to the left in RTL.\n`\"fixed\"`: The label has the same behavior as `\"start\"` except it also has a fixed width. Long text will be truncated with ellipses (\"...\")."
819
+ "text": "Where to place the label relative to the range.\n`\"start\"`: The label will appear to the left of the range in LTR and to the right in RTL.\n`\"end\"`: The label will appear to the right of the range in LTR and to the left in RTL.\n`\"fixed\"`: The label has the same behavior as `\"start\"` except it also has a fixed width. Long text will be truncated with ellipses (\"...\").\n`\"stacked\"`: The label will appear above the range regardless of the direction."
820
820
  },
821
821
  "attribute": "label-placement",
822
822
  "reflect": false,
@@ -363,6 +363,25 @@
363
363
  max-width: 200px;
364
364
  }
365
365
 
366
+ /**
367
+ * Label is on top of the range.
368
+ */
369
+ :host(.range-label-placement-stacked) .range-wrapper {
370
+ flex-direction: column;
371
+ align-items: stretch;
372
+ }
373
+
374
+ :host(.range-label-placement-stacked) .label-text-wrapper {
375
+ /**
376
+ * The margin between the label and
377
+ * the range should be on the bottom
378
+ * when the label sits on top.
379
+ */
380
+ margin-left: 0;
381
+ margin-right: 0;
382
+ margin-bottom: 16px;
383
+ }
384
+
366
385
  :host {
367
386
  --knob-border-radius: 50%;
368
387
  --knob-background: var(--bar-background-active);
@@ -423,10 +442,31 @@
423
442
  margin-bottom: 0;
424
443
  }
425
444
 
426
- :host(.range-has-pin) {
445
+ :host(.range-has-pin:not(.range-label-placement-stacked)) {
446
+ /**
447
+ * The pin should not overlap any elements that are
448
+ * above the range. By adding padding to the top of the
449
+ * range, it provides a buffer for the pin to move into
450
+ * when it is pressed.
451
+ *
452
+ * The padding is not included when the label is stacked
453
+ * because the pin is below the label.
454
+ * It still requires a buffer to prevent the pin from
455
+ * overlapping the range. The buffer is added to the
456
+ * bottom of the range label instead of the host.
457
+ */
427
458
  padding-top: 28px;
428
459
  }
429
460
 
461
+ :host(.range-has-pin.range-label-placement-stacked) .label-text-wrapper {
462
+ /**
463
+ * The pin should not overlap the stacked label. By adding
464
+ * margin to the bottom of the label, it provides a buffer
465
+ * for the pin to move into when it is pressed.
466
+ */
467
+ margin-bottom: 28px;
468
+ }
469
+
430
470
  .range-bar-active {
431
471
  bottom: 0;
432
472
  width: auto;