@ionic/core 8.7.9-dev.11761856257.1cfd8c42 → 8.7.9-dev.11762286926.1d5197be
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/ion-accordion.js +93 -14
- package/components/ion-select.js +8 -3
- package/dist/cjs/ion-accordion_2.cjs.entry.js +91 -13
- package/dist/cjs/ion-select_3.cjs.entry.js +8 -3
- package/dist/cjs/ionic.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/accordion/accordion.js +93 -14
- package/dist/collection/components/select/select.js +8 -3
- package/dist/docs.json +1 -1
- package/dist/esm/ion-accordion_2.entry.js +91 -13
- package/dist/esm/ion-select_3.entry.js +8 -3
- package/dist/esm/ionic.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-d0a2a1ab.entry.js +4 -0
- package/dist/ionic/p-faeadf5c.entry.js +4 -0
- package/dist/types/components/accordion/accordion.d.ts +18 -1
- package/hydrate/index.js +101 -17
- package/hydrate/index.mjs +101 -17
- package/package.json +1 -1
- package/dist/ionic/p-62e50f80.entry.js +0 -4
- package/dist/ionic/p-f65f9308.entry.js +0 -4
|
@@ -19,10 +19,57 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class Accordion extends HTMLE
|
|
|
19
19
|
this.__registerHost();
|
|
20
20
|
}
|
|
21
21
|
this.__attachShadow();
|
|
22
|
-
this.
|
|
22
|
+
this.accordionGroupUpdateHandler = () => {
|
|
23
|
+
/**
|
|
24
|
+
* Determine if this update will cause an actual state change.
|
|
25
|
+
* We only want to mark as "interacted" if the state is changing.
|
|
26
|
+
*/
|
|
27
|
+
const accordionGroup = this.accordionGroupEl;
|
|
28
|
+
if (accordionGroup) {
|
|
29
|
+
const value = accordionGroup.value;
|
|
30
|
+
const accordionValue = this.value;
|
|
31
|
+
const shouldExpand = Array.isArray(value) ? value.includes(accordionValue) : value === accordionValue;
|
|
32
|
+
const isExpanded = this.state === 4 /* AccordionState.Expanded */ || this.state === 8 /* AccordionState.Expanding */;
|
|
33
|
+
const stateWillChange = shouldExpand !== isExpanded;
|
|
34
|
+
/**
|
|
35
|
+
* Only mark as interacted if:
|
|
36
|
+
* 1. This is not the first update we've received with a defined value
|
|
37
|
+
* 2. The state is actually changing (prevents redundant updates from enabling animations)
|
|
38
|
+
*/
|
|
39
|
+
if (this.hasReceivedFirstUpdate && stateWillChange) {
|
|
40
|
+
this.hasInteracted = true;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Only count this as the first update if the group value is defined.
|
|
44
|
+
* This prevents the initial undefined value from the group's componentDidLoad
|
|
45
|
+
* from being treated as the first real update.
|
|
46
|
+
*/
|
|
47
|
+
if (value !== undefined) {
|
|
48
|
+
this.hasReceivedFirstUpdate = true;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
this.updateState();
|
|
52
|
+
};
|
|
23
53
|
this.state = 1 /* AccordionState.Collapsed */;
|
|
24
54
|
this.isNext = false;
|
|
25
55
|
this.isPrevious = false;
|
|
56
|
+
/**
|
|
57
|
+
* Tracks whether a user-initiated interaction has occurred.
|
|
58
|
+
* Animations are disabled until the first interaction happens.
|
|
59
|
+
* This prevents the accordion from animating when it's programmatically
|
|
60
|
+
* set to an expanded or collapsed state on initial load.
|
|
61
|
+
*/
|
|
62
|
+
this.hasInteracted = false;
|
|
63
|
+
/**
|
|
64
|
+
* Tracks if this accordion has ever been expanded.
|
|
65
|
+
* Used to prevent the first expansion from animating.
|
|
66
|
+
*/
|
|
67
|
+
this.hasEverBeenExpanded = false;
|
|
68
|
+
/**
|
|
69
|
+
* Tracks if this accordion has received its first update from the group.
|
|
70
|
+
* Used to distinguish initial programmatic sets from user interactions.
|
|
71
|
+
*/
|
|
72
|
+
this.hasReceivedFirstUpdate = false;
|
|
26
73
|
/**
|
|
27
74
|
* The value of the accordion. Defaults to an autogenerated
|
|
28
75
|
* value.
|
|
@@ -127,10 +174,15 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class Accordion extends HTMLE
|
|
|
127
174
|
iconEl.setAttribute('aria-hidden', 'true');
|
|
128
175
|
ionItem.appendChild(iconEl);
|
|
129
176
|
};
|
|
130
|
-
this.expandAccordion = (
|
|
177
|
+
this.expandAccordion = () => {
|
|
131
178
|
const { contentEl, contentElWrapper } = this;
|
|
132
|
-
|
|
179
|
+
/**
|
|
180
|
+
* If the content elements aren't available yet, just set the state.
|
|
181
|
+
* This happens on initial render before the DOM is ready.
|
|
182
|
+
*/
|
|
183
|
+
if (contentEl === undefined || contentElWrapper === undefined) {
|
|
133
184
|
this.state = 4 /* AccordionState.Expanded */;
|
|
185
|
+
this.hasEverBeenExpanded = true;
|
|
134
186
|
return;
|
|
135
187
|
}
|
|
136
188
|
if (this.state === 4 /* AccordionState.Expanded */) {
|
|
@@ -139,6 +191,11 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class Accordion extends HTMLE
|
|
|
139
191
|
if (this.currentRaf !== undefined) {
|
|
140
192
|
cancelAnimationFrame(this.currentRaf);
|
|
141
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Mark that this accordion has been expanded at least once.
|
|
196
|
+
* This allows subsequent expansions to animate.
|
|
197
|
+
*/
|
|
198
|
+
this.hasEverBeenExpanded = true;
|
|
142
199
|
if (this.shouldAnimate()) {
|
|
143
200
|
raf(() => {
|
|
144
201
|
this.state = 8 /* AccordionState.Expanding */;
|
|
@@ -156,9 +213,13 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class Accordion extends HTMLE
|
|
|
156
213
|
this.state = 4 /* AccordionState.Expanded */;
|
|
157
214
|
}
|
|
158
215
|
};
|
|
159
|
-
this.collapseAccordion = (
|
|
216
|
+
this.collapseAccordion = () => {
|
|
160
217
|
const { contentEl } = this;
|
|
161
|
-
|
|
218
|
+
/**
|
|
219
|
+
* If the content element isn't available yet, just set the state.
|
|
220
|
+
* This happens on initial render before the DOM is ready.
|
|
221
|
+
*/
|
|
222
|
+
if (contentEl === undefined) {
|
|
162
223
|
this.state = 1 /* AccordionState.Collapsed */;
|
|
163
224
|
return;
|
|
164
225
|
}
|
|
@@ -193,6 +254,18 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class Accordion extends HTMLE
|
|
|
193
254
|
* of what is set in the config.
|
|
194
255
|
*/
|
|
195
256
|
this.shouldAnimate = () => {
|
|
257
|
+
/**
|
|
258
|
+
* Don't animate until after the first user interaction.
|
|
259
|
+
* This prevents animations on initial load when accordions
|
|
260
|
+
* start in an expanded or collapsed state programmatically.
|
|
261
|
+
*
|
|
262
|
+
* Additionally, don't animate the very first expansion even if
|
|
263
|
+
* hasInteracted is true. This handles edge cases like React StrictMode
|
|
264
|
+
* where effects run twice and might incorrectly mark as interacted.
|
|
265
|
+
*/
|
|
266
|
+
if (!this.hasInteracted || !this.hasEverBeenExpanded) {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
196
269
|
if (typeof window === 'undefined') {
|
|
197
270
|
return false;
|
|
198
271
|
}
|
|
@@ -209,7 +282,7 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class Accordion extends HTMLE
|
|
|
209
282
|
}
|
|
210
283
|
return true;
|
|
211
284
|
};
|
|
212
|
-
this.updateState = async (
|
|
285
|
+
this.updateState = async () => {
|
|
213
286
|
const accordionGroup = this.accordionGroupEl;
|
|
214
287
|
const accordionValue = this.value;
|
|
215
288
|
if (!accordionGroup) {
|
|
@@ -218,11 +291,11 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class Accordion extends HTMLE
|
|
|
218
291
|
const value = accordionGroup.value;
|
|
219
292
|
const shouldExpand = Array.isArray(value) ? value.includes(accordionValue) : value === accordionValue;
|
|
220
293
|
if (shouldExpand) {
|
|
221
|
-
this.expandAccordion(
|
|
294
|
+
this.expandAccordion();
|
|
222
295
|
this.isNext = this.isPrevious = false;
|
|
223
296
|
}
|
|
224
297
|
else {
|
|
225
|
-
this.collapseAccordion(
|
|
298
|
+
this.collapseAccordion();
|
|
226
299
|
/**
|
|
227
300
|
* When using popout or inset,
|
|
228
301
|
* the collapsed accordion items
|
|
@@ -270,14 +343,14 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class Accordion extends HTMLE
|
|
|
270
343
|
var _a;
|
|
271
344
|
const accordionGroupEl = (this.accordionGroupEl = (_a = this.el) === null || _a === void 0 ? void 0 : _a.closest('ion-accordion-group'));
|
|
272
345
|
if (accordionGroupEl) {
|
|
273
|
-
this.updateState(
|
|
274
|
-
addEventListener(accordionGroupEl, 'ionValueChange', this.
|
|
346
|
+
this.updateState();
|
|
347
|
+
addEventListener(accordionGroupEl, 'ionValueChange', this.accordionGroupUpdateHandler);
|
|
275
348
|
}
|
|
276
349
|
}
|
|
277
350
|
disconnectedCallback() {
|
|
278
351
|
const accordionGroupEl = this.accordionGroupEl;
|
|
279
352
|
if (accordionGroupEl) {
|
|
280
|
-
removeEventListener(accordionGroupEl, 'ionValueChange', this.
|
|
353
|
+
removeEventListener(accordionGroupEl, 'ionValueChange', this.accordionGroupUpdateHandler);
|
|
281
354
|
}
|
|
282
355
|
}
|
|
283
356
|
componentDidLoad() {
|
|
@@ -301,6 +374,11 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class Accordion extends HTMLE
|
|
|
301
374
|
const { accordionGroupEl, disabled, readonly, value, state } = this;
|
|
302
375
|
if (disabled || readonly)
|
|
303
376
|
return;
|
|
377
|
+
/**
|
|
378
|
+
* Mark that the user has interacted with the accordion.
|
|
379
|
+
* This enables animations for all future state changes.
|
|
380
|
+
*/
|
|
381
|
+
this.hasInteracted = true;
|
|
304
382
|
if (accordionGroupEl) {
|
|
305
383
|
/**
|
|
306
384
|
* Because the accordion group may or may
|
|
@@ -321,7 +399,7 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class Accordion extends HTMLE
|
|
|
321
399
|
const headerPart = expanded ? 'header expanded' : 'header';
|
|
322
400
|
const contentPart = expanded ? 'content expanded' : 'content';
|
|
323
401
|
this.setAria(expanded);
|
|
324
|
-
return (h(Host, { key: '
|
|
402
|
+
return (h(Host, { key: '9c90bce01eff7e5774a19f69c872f3761d66cf3c', class: {
|
|
325
403
|
[mode]: true,
|
|
326
404
|
'accordion-expanding': this.state === 8 /* AccordionState.Expanding */,
|
|
327
405
|
'accordion-expanded': this.state === 4 /* AccordionState.Expanded */,
|
|
@@ -332,7 +410,7 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class Accordion extends HTMLE
|
|
|
332
410
|
'accordion-disabled': disabled,
|
|
333
411
|
'accordion-readonly': readonly,
|
|
334
412
|
'accordion-animated': this.shouldAnimate(),
|
|
335
|
-
} }, h("div", { key: '
|
|
413
|
+
} }, h("div", { key: 'cab40d5bcf3c93fd78e70b6d3906a541e725837d', onClick: () => this.toggleExpanded(), id: "header", part: headerPart, "aria-controls": "content", ref: (headerEl) => (this.headerEl = headerEl) }, h("slot", { key: '672bc7fb3f9e18076b41e20fc9eaeab7cafcf3a2', name: "header" })), h("div", { key: 'fd777ca5b4ab04aa4f44c339d58c8cd987c52bcb', id: "content", part: contentPart, role: "region", "aria-labelledby": "header", ref: (contentEl) => (this.contentEl = contentEl) }, h("div", { key: '0aad70a71e2cd2c16b2e98fa0bdd40421d95fe16', id: "content-wrapper", ref: (contentElWrapper) => (this.contentElWrapper = contentElWrapper) }, h("slot", { key: 'd630e10ac7c56b4dbf943b523f26759b83aead55', name: "content" })))));
|
|
336
414
|
}
|
|
337
415
|
static get delegatesFocus() { return true; }
|
|
338
416
|
get el() { return this; }
|
|
@@ -351,7 +429,8 @@ const Accordion = /*@__PURE__*/ proxyCustomElement(class Accordion extends HTMLE
|
|
|
351
429
|
"toggleIconSlot": [1, "toggle-icon-slot"],
|
|
352
430
|
"state": [32],
|
|
353
431
|
"isNext": [32],
|
|
354
|
-
"isPrevious": [32]
|
|
432
|
+
"isPrevious": [32],
|
|
433
|
+
"hasInteracted": [32]
|
|
355
434
|
}, undefined, {
|
|
356
435
|
"value": ["valueChanged"]
|
|
357
436
|
}]);
|
package/components/ion-select.js
CHANGED
|
@@ -409,6 +409,7 @@ const Select = /*@__PURE__*/ proxyCustomElement(class Select extends HTMLElement
|
|
|
409
409
|
}
|
|
410
410
|
}
|
|
411
411
|
createActionSheetButtons(data, selectValue) {
|
|
412
|
+
console.log('createActionSheetButtons', data, selectValue);
|
|
412
413
|
const actionSheetButtons = data.map((option) => {
|
|
413
414
|
const value = getOptionValue(option);
|
|
414
415
|
// Remove hydrated before copying over classes
|
|
@@ -416,13 +417,17 @@ const Select = /*@__PURE__*/ proxyCustomElement(class Select extends HTMLElement
|
|
|
416
417
|
.filter((cls) => cls !== 'hydrated')
|
|
417
418
|
.join(' ');
|
|
418
419
|
const optClass = `${OPTION_CLASS} ${copyClasses}`;
|
|
420
|
+
const isSelected = isOptionSelected(selectValue, value, this.compareWith);
|
|
419
421
|
return {
|
|
420
|
-
role:
|
|
422
|
+
role: isSelected ? 'selected' : '',
|
|
421
423
|
text: option.textContent,
|
|
422
424
|
cssClass: optClass,
|
|
423
425
|
handler: () => {
|
|
424
426
|
this.setValue(value);
|
|
425
427
|
},
|
|
428
|
+
htmlAttributes: {
|
|
429
|
+
'aria-selected': isSelected ? 'true' : undefined,
|
|
430
|
+
},
|
|
426
431
|
};
|
|
427
432
|
});
|
|
428
433
|
// Add "cancel" button
|
|
@@ -803,7 +808,7 @@ const Select = /*@__PURE__*/ proxyCustomElement(class Select extends HTMLElement
|
|
|
803
808
|
* TODO(FW-5592): Remove hasStartEndSlots condition
|
|
804
809
|
*/
|
|
805
810
|
const labelShouldFloat = labelPlacement === 'stacked' || (labelPlacement === 'floating' && (hasValue || isExpanded || hasStartEndSlots));
|
|
806
|
-
return (h(Host, { key: '
|
|
811
|
+
return (h(Host, { key: '6c9d106029589c111ede102fbf604f695c293e7d', onClick: this.onClick, class: createColorClasses(this.color, {
|
|
807
812
|
[mode]: true,
|
|
808
813
|
'in-item': inItem,
|
|
809
814
|
'in-item-color': hostContext('ion-item.ion-color', el),
|
|
@@ -821,7 +826,7 @@ const Select = /*@__PURE__*/ proxyCustomElement(class Select extends HTMLElement
|
|
|
821
826
|
[`select-justify-${justify}`]: justifyEnabled,
|
|
822
827
|
[`select-shape-${shape}`]: shape !== undefined,
|
|
823
828
|
[`select-label-placement-${labelPlacement}`]: true,
|
|
824
|
-
}) }, h("label", { key: '
|
|
829
|
+
}) }, h("label", { key: 'bd130ecdd92670a86cb186b6f1130ef67c3db260', class: "select-wrapper", id: "select-label", onClick: this.onLabelClick }, this.renderLabelContainer(), h("div", { key: '3efcc60c04462caa3f75bc33da53633b7cea5b92', class: "select-wrapper-inner" }, h("slot", { key: '8a2afce3ccc3a5555e9ee479b9b0a17178dbca49', name: "start" }), h("div", { key: '9e94fd7bf3691bab7cefb5c13ff88df51a5512d5', class: "native-wrapper", ref: (el) => (this.nativeWrapperEl = el), part: "container" }, this.renderSelectText(), this.renderListbox()), h("slot", { key: '05e4e9581cab5b06f433e47ac2b511b6702ea466', name: "end" }), !hasFloatingOrStackedLabel && this.renderSelectIcon()), hasFloatingOrStackedLabel && this.renderSelectIcon(), shouldRenderHighlight && h("div", { key: 'bcfa0153e36b8bec3c8297ced7fddae7f1542ce0', class: "select-highlight" })), this.renderBottomContent()));
|
|
825
830
|
}
|
|
826
831
|
get el() { return this; }
|
|
827
832
|
static get watchers() { return {
|
|
@@ -15,10 +15,57 @@ const accordionMdCss = ":host{display:block;position:relative;width:100%;backgro
|
|
|
15
15
|
const Accordion = class {
|
|
16
16
|
constructor(hostRef) {
|
|
17
17
|
index.registerInstance(this, hostRef);
|
|
18
|
-
this.
|
|
18
|
+
this.accordionGroupUpdateHandler = () => {
|
|
19
|
+
/**
|
|
20
|
+
* Determine if this update will cause an actual state change.
|
|
21
|
+
* We only want to mark as "interacted" if the state is changing.
|
|
22
|
+
*/
|
|
23
|
+
const accordionGroup = this.accordionGroupEl;
|
|
24
|
+
if (accordionGroup) {
|
|
25
|
+
const value = accordionGroup.value;
|
|
26
|
+
const accordionValue = this.value;
|
|
27
|
+
const shouldExpand = Array.isArray(value) ? value.includes(accordionValue) : value === accordionValue;
|
|
28
|
+
const isExpanded = this.state === 4 /* AccordionState.Expanded */ || this.state === 8 /* AccordionState.Expanding */;
|
|
29
|
+
const stateWillChange = shouldExpand !== isExpanded;
|
|
30
|
+
/**
|
|
31
|
+
* Only mark as interacted if:
|
|
32
|
+
* 1. This is not the first update we've received with a defined value
|
|
33
|
+
* 2. The state is actually changing (prevents redundant updates from enabling animations)
|
|
34
|
+
*/
|
|
35
|
+
if (this.hasReceivedFirstUpdate && stateWillChange) {
|
|
36
|
+
this.hasInteracted = true;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Only count this as the first update if the group value is defined.
|
|
40
|
+
* This prevents the initial undefined value from the group's componentDidLoad
|
|
41
|
+
* from being treated as the first real update.
|
|
42
|
+
*/
|
|
43
|
+
if (value !== undefined) {
|
|
44
|
+
this.hasReceivedFirstUpdate = true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
this.updateState();
|
|
48
|
+
};
|
|
19
49
|
this.state = 1 /* AccordionState.Collapsed */;
|
|
20
50
|
this.isNext = false;
|
|
21
51
|
this.isPrevious = false;
|
|
52
|
+
/**
|
|
53
|
+
* Tracks whether a user-initiated interaction has occurred.
|
|
54
|
+
* Animations are disabled until the first interaction happens.
|
|
55
|
+
* This prevents the accordion from animating when it's programmatically
|
|
56
|
+
* set to an expanded or collapsed state on initial load.
|
|
57
|
+
*/
|
|
58
|
+
this.hasInteracted = false;
|
|
59
|
+
/**
|
|
60
|
+
* Tracks if this accordion has ever been expanded.
|
|
61
|
+
* Used to prevent the first expansion from animating.
|
|
62
|
+
*/
|
|
63
|
+
this.hasEverBeenExpanded = false;
|
|
64
|
+
/**
|
|
65
|
+
* Tracks if this accordion has received its first update from the group.
|
|
66
|
+
* Used to distinguish initial programmatic sets from user interactions.
|
|
67
|
+
*/
|
|
68
|
+
this.hasReceivedFirstUpdate = false;
|
|
22
69
|
/**
|
|
23
70
|
* The value of the accordion. Defaults to an autogenerated
|
|
24
71
|
* value.
|
|
@@ -123,10 +170,15 @@ const Accordion = class {
|
|
|
123
170
|
iconEl.setAttribute('aria-hidden', 'true');
|
|
124
171
|
ionItem.appendChild(iconEl);
|
|
125
172
|
};
|
|
126
|
-
this.expandAccordion = (
|
|
173
|
+
this.expandAccordion = () => {
|
|
127
174
|
const { contentEl, contentElWrapper } = this;
|
|
128
|
-
|
|
175
|
+
/**
|
|
176
|
+
* If the content elements aren't available yet, just set the state.
|
|
177
|
+
* This happens on initial render before the DOM is ready.
|
|
178
|
+
*/
|
|
179
|
+
if (contentEl === undefined || contentElWrapper === undefined) {
|
|
129
180
|
this.state = 4 /* AccordionState.Expanded */;
|
|
181
|
+
this.hasEverBeenExpanded = true;
|
|
130
182
|
return;
|
|
131
183
|
}
|
|
132
184
|
if (this.state === 4 /* AccordionState.Expanded */) {
|
|
@@ -135,6 +187,11 @@ const Accordion = class {
|
|
|
135
187
|
if (this.currentRaf !== undefined) {
|
|
136
188
|
cancelAnimationFrame(this.currentRaf);
|
|
137
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* Mark that this accordion has been expanded at least once.
|
|
192
|
+
* This allows subsequent expansions to animate.
|
|
193
|
+
*/
|
|
194
|
+
this.hasEverBeenExpanded = true;
|
|
138
195
|
if (this.shouldAnimate()) {
|
|
139
196
|
helpers.raf(() => {
|
|
140
197
|
this.state = 8 /* AccordionState.Expanding */;
|
|
@@ -152,9 +209,13 @@ const Accordion = class {
|
|
|
152
209
|
this.state = 4 /* AccordionState.Expanded */;
|
|
153
210
|
}
|
|
154
211
|
};
|
|
155
|
-
this.collapseAccordion = (
|
|
212
|
+
this.collapseAccordion = () => {
|
|
156
213
|
const { contentEl } = this;
|
|
157
|
-
|
|
214
|
+
/**
|
|
215
|
+
* If the content element isn't available yet, just set the state.
|
|
216
|
+
* This happens on initial render before the DOM is ready.
|
|
217
|
+
*/
|
|
218
|
+
if (contentEl === undefined) {
|
|
158
219
|
this.state = 1 /* AccordionState.Collapsed */;
|
|
159
220
|
return;
|
|
160
221
|
}
|
|
@@ -189,6 +250,18 @@ const Accordion = class {
|
|
|
189
250
|
* of what is set in the config.
|
|
190
251
|
*/
|
|
191
252
|
this.shouldAnimate = () => {
|
|
253
|
+
/**
|
|
254
|
+
* Don't animate until after the first user interaction.
|
|
255
|
+
* This prevents animations on initial load when accordions
|
|
256
|
+
* start in an expanded or collapsed state programmatically.
|
|
257
|
+
*
|
|
258
|
+
* Additionally, don't animate the very first expansion even if
|
|
259
|
+
* hasInteracted is true. This handles edge cases like React StrictMode
|
|
260
|
+
* where effects run twice and might incorrectly mark as interacted.
|
|
261
|
+
*/
|
|
262
|
+
if (!this.hasInteracted || !this.hasEverBeenExpanded) {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
192
265
|
if (typeof window === 'undefined') {
|
|
193
266
|
return false;
|
|
194
267
|
}
|
|
@@ -205,7 +278,7 @@ const Accordion = class {
|
|
|
205
278
|
}
|
|
206
279
|
return true;
|
|
207
280
|
};
|
|
208
|
-
this.updateState = async (
|
|
281
|
+
this.updateState = async () => {
|
|
209
282
|
const accordionGroup = this.accordionGroupEl;
|
|
210
283
|
const accordionValue = this.value;
|
|
211
284
|
if (!accordionGroup) {
|
|
@@ -214,11 +287,11 @@ const Accordion = class {
|
|
|
214
287
|
const value = accordionGroup.value;
|
|
215
288
|
const shouldExpand = Array.isArray(value) ? value.includes(accordionValue) : value === accordionValue;
|
|
216
289
|
if (shouldExpand) {
|
|
217
|
-
this.expandAccordion(
|
|
290
|
+
this.expandAccordion();
|
|
218
291
|
this.isNext = this.isPrevious = false;
|
|
219
292
|
}
|
|
220
293
|
else {
|
|
221
|
-
this.collapseAccordion(
|
|
294
|
+
this.collapseAccordion();
|
|
222
295
|
/**
|
|
223
296
|
* When using popout or inset,
|
|
224
297
|
* the collapsed accordion items
|
|
@@ -266,14 +339,14 @@ const Accordion = class {
|
|
|
266
339
|
var _a;
|
|
267
340
|
const accordionGroupEl = (this.accordionGroupEl = (_a = this.el) === null || _a === void 0 ? void 0 : _a.closest('ion-accordion-group'));
|
|
268
341
|
if (accordionGroupEl) {
|
|
269
|
-
this.updateState(
|
|
270
|
-
helpers.addEventListener(accordionGroupEl, 'ionValueChange', this.
|
|
342
|
+
this.updateState();
|
|
343
|
+
helpers.addEventListener(accordionGroupEl, 'ionValueChange', this.accordionGroupUpdateHandler);
|
|
271
344
|
}
|
|
272
345
|
}
|
|
273
346
|
disconnectedCallback() {
|
|
274
347
|
const accordionGroupEl = this.accordionGroupEl;
|
|
275
348
|
if (accordionGroupEl) {
|
|
276
|
-
helpers.removeEventListener(accordionGroupEl, 'ionValueChange', this.
|
|
349
|
+
helpers.removeEventListener(accordionGroupEl, 'ionValueChange', this.accordionGroupUpdateHandler);
|
|
277
350
|
}
|
|
278
351
|
}
|
|
279
352
|
componentDidLoad() {
|
|
@@ -297,6 +370,11 @@ const Accordion = class {
|
|
|
297
370
|
const { accordionGroupEl, disabled, readonly, value, state } = this;
|
|
298
371
|
if (disabled || readonly)
|
|
299
372
|
return;
|
|
373
|
+
/**
|
|
374
|
+
* Mark that the user has interacted with the accordion.
|
|
375
|
+
* This enables animations for all future state changes.
|
|
376
|
+
*/
|
|
377
|
+
this.hasInteracted = true;
|
|
300
378
|
if (accordionGroupEl) {
|
|
301
379
|
/**
|
|
302
380
|
* Because the accordion group may or may
|
|
@@ -317,7 +395,7 @@ const Accordion = class {
|
|
|
317
395
|
const headerPart = expanded ? 'header expanded' : 'header';
|
|
318
396
|
const contentPart = expanded ? 'content expanded' : 'content';
|
|
319
397
|
this.setAria(expanded);
|
|
320
|
-
return (index.h(index.Host, { key: '
|
|
398
|
+
return (index.h(index.Host, { key: '9c90bce01eff7e5774a19f69c872f3761d66cf3c', class: {
|
|
321
399
|
[mode]: true,
|
|
322
400
|
'accordion-expanding': this.state === 8 /* AccordionState.Expanding */,
|
|
323
401
|
'accordion-expanded': this.state === 4 /* AccordionState.Expanded */,
|
|
@@ -328,7 +406,7 @@ const Accordion = class {
|
|
|
328
406
|
'accordion-disabled': disabled,
|
|
329
407
|
'accordion-readonly': readonly,
|
|
330
408
|
'accordion-animated': this.shouldAnimate(),
|
|
331
|
-
} }, index.h("div", { key: '
|
|
409
|
+
} }, index.h("div", { key: 'cab40d5bcf3c93fd78e70b6d3906a541e725837d', onClick: () => this.toggleExpanded(), id: "header", part: headerPart, "aria-controls": "content", ref: (headerEl) => (this.headerEl = headerEl) }, index.h("slot", { key: '672bc7fb3f9e18076b41e20fc9eaeab7cafcf3a2', name: "header" })), index.h("div", { key: 'fd777ca5b4ab04aa4f44c339d58c8cd987c52bcb', id: "content", part: contentPart, role: "region", "aria-labelledby": "header", ref: (contentEl) => (this.contentEl = contentEl) }, index.h("div", { key: '0aad70a71e2cd2c16b2e98fa0bdd40421d95fe16', id: "content-wrapper", ref: (contentElWrapper) => (this.contentElWrapper = contentElWrapper) }, index.h("slot", { key: 'd630e10ac7c56b4dbf943b523f26759b83aead55', name: "content" })))));
|
|
332
410
|
}
|
|
333
411
|
static get delegatesFocus() { return true; }
|
|
334
412
|
get el() { return index.getElement(this); }
|
|
@@ -389,6 +389,7 @@ const Select = class {
|
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
createActionSheetButtons(data, selectValue) {
|
|
392
|
+
console.log('createActionSheetButtons', data, selectValue);
|
|
392
393
|
const actionSheetButtons = data.map((option) => {
|
|
393
394
|
const value = getOptionValue(option);
|
|
394
395
|
// Remove hydrated before copying over classes
|
|
@@ -396,13 +397,17 @@ const Select = class {
|
|
|
396
397
|
.filter((cls) => cls !== 'hydrated')
|
|
397
398
|
.join(' ');
|
|
398
399
|
const optClass = `${OPTION_CLASS} ${copyClasses}`;
|
|
400
|
+
const isSelected = compareWithUtils.isOptionSelected(selectValue, value, this.compareWith);
|
|
399
401
|
return {
|
|
400
|
-
role:
|
|
402
|
+
role: isSelected ? 'selected' : '',
|
|
401
403
|
text: option.textContent,
|
|
402
404
|
cssClass: optClass,
|
|
403
405
|
handler: () => {
|
|
404
406
|
this.setValue(value);
|
|
405
407
|
},
|
|
408
|
+
htmlAttributes: {
|
|
409
|
+
'aria-selected': isSelected ? 'true' : undefined,
|
|
410
|
+
},
|
|
406
411
|
};
|
|
407
412
|
});
|
|
408
413
|
// Add "cancel" button
|
|
@@ -783,7 +788,7 @@ const Select = class {
|
|
|
783
788
|
* TODO(FW-5592): Remove hasStartEndSlots condition
|
|
784
789
|
*/
|
|
785
790
|
const labelShouldFloat = labelPlacement === 'stacked' || (labelPlacement === 'floating' && (hasValue || isExpanded || hasStartEndSlots));
|
|
786
|
-
return (index.h(index.Host, { key: '
|
|
791
|
+
return (index.h(index.Host, { key: '6c9d106029589c111ede102fbf604f695c293e7d', onClick: this.onClick, class: theme.createColorClasses(this.color, {
|
|
787
792
|
[mode]: true,
|
|
788
793
|
'in-item': inItem,
|
|
789
794
|
'in-item-color': theme.hostContext('ion-item.ion-color', el),
|
|
@@ -801,7 +806,7 @@ const Select = class {
|
|
|
801
806
|
[`select-justify-${justify}`]: justifyEnabled,
|
|
802
807
|
[`select-shape-${shape}`]: shape !== undefined,
|
|
803
808
|
[`select-label-placement-${labelPlacement}`]: true,
|
|
804
|
-
}) }, index.h("label", { key: '
|
|
809
|
+
}) }, index.h("label", { key: 'bd130ecdd92670a86cb186b6f1130ef67c3db260', class: "select-wrapper", id: "select-label", onClick: this.onLabelClick }, this.renderLabelContainer(), index.h("div", { key: '3efcc60c04462caa3f75bc33da53633b7cea5b92', class: "select-wrapper-inner" }, index.h("slot", { key: '8a2afce3ccc3a5555e9ee479b9b0a17178dbca49', name: "start" }), index.h("div", { key: '9e94fd7bf3691bab7cefb5c13ff88df51a5512d5', class: "native-wrapper", ref: (el) => (this.nativeWrapperEl = el), part: "container" }, this.renderSelectText(), this.renderListbox()), index.h("slot", { key: '05e4e9581cab5b06f433e47ac2b511b6702ea466', name: "end" }), !hasFloatingOrStackedLabel && this.renderSelectIcon()), hasFloatingOrStackedLabel && this.renderSelectIcon(), shouldRenderHighlight && index.h("div", { key: 'bcfa0153e36b8bec3c8297ced7fddae7f1542ce0', class: "select-highlight" })), this.renderBottomContent()));
|
|
805
810
|
}
|
|
806
811
|
get el() { return index.getElement(this); }
|
|
807
812
|
static get watchers() { return {
|