@ionic/core 8.7.8-dev.11761837781.122f452f → 8.7.8-dev.11761840817.1bede576
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-group.js +7 -39
- package/components/ion-accordion.js +38 -34
- package/dist/cjs/ion-accordion_2.cjs.entry.js +45 -72
- package/dist/collection/components/accordion/accordion.js +38 -34
- package/dist/collection/components/accordion-group/accordion-group.js +7 -39
- package/dist/docs.json +2 -2
- package/dist/esm/ion-accordion_2.entry.js +46 -73
- package/dist/ionic/ionic.esm.js +1 -1
- package/dist/ionic/p-5ed15aa7.entry.js +4 -0
- package/dist/types/components/accordion/accordion.d.ts +5 -0
- package/dist/types/components/accordion-group/accordion-group-interface.d.ts +0 -1
- package/dist/types/components/accordion-group/accordion-group.d.ts +0 -3
- package/hydrate/index.js +45 -72
- package/hydrate/index.mjs +45 -72
- package/package.json +1 -1
- package/dist/ionic/p-18d454c8.entry.js +0 -4
package/hydrate/index.mjs
CHANGED
|
@@ -4040,10 +4040,7 @@ const accordionMdCss = ":host{display:block;position:relative;width:100%;backgro
|
|
|
4040
4040
|
class Accordion {
|
|
4041
4041
|
constructor(hostRef) {
|
|
4042
4042
|
registerInstance(this, hostRef);
|
|
4043
|
-
this.updateListener = (
|
|
4044
|
-
var _a, _b;
|
|
4045
|
-
const initialUpdate = (_b = (_a = ev.detail) === null || _a === void 0 ? void 0 : _a.initial) !== null && _b !== void 0 ? _b : false;
|
|
4046
|
-
console.log('[Accordion]', this.value, 'updateListener - initial:', initialUpdate, 'hasInteracted:', this.hasInteracted, 'hasEverBeenExpanded:', this.hasEverBeenExpanded, 'currentState:', this.state);
|
|
4043
|
+
this.updateListener = () => {
|
|
4047
4044
|
/**
|
|
4048
4045
|
* Determine if this update will cause an actual state change.
|
|
4049
4046
|
* We only want to mark as "interacted" if the state is changing.
|
|
@@ -4055,18 +4052,24 @@ class Accordion {
|
|
|
4055
4052
|
const shouldExpand = Array.isArray(value) ? value.includes(accordionValue) : value === accordionValue;
|
|
4056
4053
|
const isExpanded = this.state === 4 /* AccordionState.Expanded */ || this.state === 8 /* AccordionState.Expanding */;
|
|
4057
4054
|
const stateWillChange = shouldExpand !== isExpanded;
|
|
4058
|
-
console.log('[Accordion]', this.value, 'shouldExpand:', shouldExpand, 'isExpanded:', isExpanded, 'stateWillChange:', stateWillChange);
|
|
4059
4055
|
/**
|
|
4060
|
-
*
|
|
4061
|
-
*
|
|
4062
|
-
* (
|
|
4056
|
+
* Only mark as interacted if:
|
|
4057
|
+
* 1. This is not the first update we've received with a defined value
|
|
4058
|
+
* 2. The state is actually changing (prevents redundant updates from enabling animations)
|
|
4063
4059
|
*/
|
|
4064
|
-
if (
|
|
4065
|
-
console.log('[Accordion]', this.value, 'Setting hasInteracted to true');
|
|
4060
|
+
if (this.hasReceivedFirstUpdate && stateWillChange) {
|
|
4066
4061
|
this.hasInteracted = true;
|
|
4067
4062
|
}
|
|
4063
|
+
/**
|
|
4064
|
+
* Only count this as the first update if the group value is defined.
|
|
4065
|
+
* This prevents the initial undefined value from the group's componentDidLoad
|
|
4066
|
+
* from being treated as the first real update.
|
|
4067
|
+
*/
|
|
4068
|
+
if (value !== undefined) {
|
|
4069
|
+
this.hasReceivedFirstUpdate = true;
|
|
4070
|
+
}
|
|
4068
4071
|
}
|
|
4069
|
-
this.updateState(
|
|
4072
|
+
this.updateState();
|
|
4070
4073
|
};
|
|
4071
4074
|
this.state = 1 /* AccordionState.Collapsed */;
|
|
4072
4075
|
this.isNext = false;
|
|
@@ -4083,6 +4086,11 @@ class Accordion {
|
|
|
4083
4086
|
* Used to prevent the first expansion from animating.
|
|
4084
4087
|
*/
|
|
4085
4088
|
this.hasEverBeenExpanded = false;
|
|
4089
|
+
/**
|
|
4090
|
+
* Tracks if this accordion has received its first update from the group.
|
|
4091
|
+
* Used to distinguish initial programmatic sets from user interactions.
|
|
4092
|
+
*/
|
|
4093
|
+
this.hasReceivedFirstUpdate = false;
|
|
4086
4094
|
/**
|
|
4087
4095
|
* The value of the accordion. Defaults to an autogenerated
|
|
4088
4096
|
* value.
|
|
@@ -4187,21 +4195,18 @@ class Accordion {
|
|
|
4187
4195
|
iconEl.setAttribute('aria-hidden', 'true');
|
|
4188
4196
|
ionItem.appendChild(iconEl);
|
|
4189
4197
|
};
|
|
4190
|
-
this.expandAccordion = (
|
|
4191
|
-
console.log('[Accordion]', this.value, 'expandAccordion - initialUpdate:', initialUpdate, 'state:', this.state);
|
|
4198
|
+
this.expandAccordion = () => {
|
|
4192
4199
|
const { contentEl, contentElWrapper } = this;
|
|
4193
|
-
|
|
4200
|
+
/**
|
|
4201
|
+
* If the content elements aren't available yet, just set the state.
|
|
4202
|
+
* This happens on initial render before the DOM is ready.
|
|
4203
|
+
*/
|
|
4204
|
+
if (contentEl === undefined || contentElWrapper === undefined) {
|
|
4194
4205
|
this.state = 4 /* AccordionState.Expanded */;
|
|
4195
|
-
/**
|
|
4196
|
-
* Mark that this accordion has been expanded at least once.
|
|
4197
|
-
* Do this even on initial expansion so future interactions animate.
|
|
4198
|
-
*/
|
|
4199
4206
|
this.hasEverBeenExpanded = true;
|
|
4200
|
-
console.log('[Accordion]', this.value, 'expandAccordion early return - hasEverBeenExpanded set to true');
|
|
4201
4207
|
return;
|
|
4202
4208
|
}
|
|
4203
4209
|
if (this.state === 4 /* AccordionState.Expanded */) {
|
|
4204
|
-
console.log('[Accordion]', this.value, 'expandAccordion - already expanded, returning');
|
|
4205
4210
|
return;
|
|
4206
4211
|
}
|
|
4207
4212
|
if (this.currentRaf !== undefined) {
|
|
@@ -4212,9 +4217,7 @@ class Accordion {
|
|
|
4212
4217
|
* This allows subsequent expansions to animate.
|
|
4213
4218
|
*/
|
|
4214
4219
|
this.hasEverBeenExpanded = true;
|
|
4215
|
-
console.log('[Accordion]', this.value, 'expandAccordion - hasEverBeenExpanded set to true');
|
|
4216
4220
|
if (this.shouldAnimate()) {
|
|
4217
|
-
console.log('[Accordion]', this.value, 'expandAccordion - will animate');
|
|
4218
4221
|
raf(() => {
|
|
4219
4222
|
this.state = 8 /* AccordionState.Expanding */;
|
|
4220
4223
|
this.currentRaf = raf(async () => {
|
|
@@ -4231,9 +4234,13 @@ class Accordion {
|
|
|
4231
4234
|
this.state = 4 /* AccordionState.Expanded */;
|
|
4232
4235
|
}
|
|
4233
4236
|
};
|
|
4234
|
-
this.collapseAccordion = (
|
|
4237
|
+
this.collapseAccordion = () => {
|
|
4235
4238
|
const { contentEl } = this;
|
|
4236
|
-
|
|
4239
|
+
/**
|
|
4240
|
+
* If the content element isn't available yet, just set the state.
|
|
4241
|
+
* This happens on initial render before the DOM is ready.
|
|
4242
|
+
*/
|
|
4243
|
+
if (contentEl === undefined) {
|
|
4237
4244
|
this.state = 1 /* AccordionState.Collapsed */;
|
|
4238
4245
|
return;
|
|
4239
4246
|
}
|
|
@@ -4278,7 +4285,6 @@ class Accordion {
|
|
|
4278
4285
|
* where effects run twice and might incorrectly mark as interacted.
|
|
4279
4286
|
*/
|
|
4280
4287
|
if (!this.hasInteracted || !this.hasEverBeenExpanded) {
|
|
4281
|
-
console.log('[Accordion]', this.value, 'shouldAnimate: false - hasInteracted:', this.hasInteracted, 'hasEverBeenExpanded:', this.hasEverBeenExpanded);
|
|
4282
4288
|
return false;
|
|
4283
4289
|
}
|
|
4284
4290
|
if (typeof window === 'undefined') {
|
|
@@ -4297,7 +4303,7 @@ class Accordion {
|
|
|
4297
4303
|
}
|
|
4298
4304
|
return true;
|
|
4299
4305
|
};
|
|
4300
|
-
this.updateState = async (
|
|
4306
|
+
this.updateState = async () => {
|
|
4301
4307
|
const accordionGroup = this.accordionGroupEl;
|
|
4302
4308
|
const accordionValue = this.value;
|
|
4303
4309
|
if (!accordionGroup) {
|
|
@@ -4306,11 +4312,11 @@ class Accordion {
|
|
|
4306
4312
|
const value = accordionGroup.value;
|
|
4307
4313
|
const shouldExpand = Array.isArray(value) ? value.includes(accordionValue) : value === accordionValue;
|
|
4308
4314
|
if (shouldExpand) {
|
|
4309
|
-
this.expandAccordion(
|
|
4315
|
+
this.expandAccordion();
|
|
4310
4316
|
this.isNext = this.isPrevious = false;
|
|
4311
4317
|
}
|
|
4312
4318
|
else {
|
|
4313
|
-
this.collapseAccordion(
|
|
4319
|
+
this.collapseAccordion();
|
|
4314
4320
|
/**
|
|
4315
4321
|
* When using popout or inset,
|
|
4316
4322
|
* the collapsed accordion items
|
|
@@ -4358,7 +4364,7 @@ class Accordion {
|
|
|
4358
4364
|
var _a;
|
|
4359
4365
|
const accordionGroupEl = (this.accordionGroupEl = (_a = this.el) === null || _a === void 0 ? void 0 : _a.closest('ion-accordion-group'));
|
|
4360
4366
|
if (accordionGroupEl) {
|
|
4361
|
-
this.updateState(
|
|
4367
|
+
this.updateState();
|
|
4362
4368
|
addEventListener$1(accordionGroupEl, 'ionValueChange', this.updateListener);
|
|
4363
4369
|
}
|
|
4364
4370
|
}
|
|
@@ -4413,10 +4419,8 @@ class Accordion {
|
|
|
4413
4419
|
const expanded = this.state === 4 /* AccordionState.Expanded */ || this.state === 8 /* AccordionState.Expanding */;
|
|
4414
4420
|
const headerPart = expanded ? 'header expanded' : 'header';
|
|
4415
4421
|
const contentPart = expanded ? 'content expanded' : 'content';
|
|
4416
|
-
const shouldAnimate = this.shouldAnimate();
|
|
4417
|
-
console.log('[Accordion]', this.value, 'render - state:', this.state, 'shouldAnimate:', shouldAnimate, 'hasInteracted:', this.hasInteracted, 'hasEverBeenExpanded:', this.hasEverBeenExpanded);
|
|
4418
4422
|
this.setAria(expanded);
|
|
4419
|
-
return (hAsync(Host, { key: '
|
|
4423
|
+
return (hAsync(Host, { key: '0f3b65e32d6908f466e0b0535fbdad1d6d6c4c88', class: {
|
|
4420
4424
|
[mode]: true,
|
|
4421
4425
|
'accordion-expanding': this.state === 8 /* AccordionState.Expanding */,
|
|
4422
4426
|
'accordion-expanded': this.state === 4 /* AccordionState.Expanded */,
|
|
@@ -4426,8 +4430,8 @@ class Accordion {
|
|
|
4426
4430
|
'accordion-previous': this.isPrevious,
|
|
4427
4431
|
'accordion-disabled': disabled,
|
|
4428
4432
|
'accordion-readonly': readonly,
|
|
4429
|
-
'accordion-animated': shouldAnimate,
|
|
4430
|
-
} }, hAsync("div", { key: '
|
|
4433
|
+
'accordion-animated': this.shouldAnimate(),
|
|
4434
|
+
} }, hAsync("div", { key: '79e49dde14246e65fab5ee991a9f06fda649b8a4', onClick: () => this.toggleExpanded(), id: "header", part: headerPart, "aria-controls": "content", ref: (headerEl) => (this.headerEl = headerEl) }, hAsync("slot", { key: '8938988b9a5f87357b8351ecf5ca37ae80461170', name: "header" })), hAsync("div", { key: '636a23a49fd8daae92a584452bc3f5b35072110d', id: "content", part: contentPart, role: "region", "aria-labelledby": "header", ref: (contentEl) => (this.contentEl = contentEl) }, hAsync("div", { key: 'dd28ba52dbd28690561206aac205190aebecb793', id: "content-wrapper", ref: (contentElWrapper) => (this.contentElWrapper = contentElWrapper) }, hAsync("slot", { key: '133fb1680990303ba55b61e3fed741a31295acdf', name: "content" })))));
|
|
4431
4435
|
}
|
|
4432
4436
|
static get delegatesFocus() { return true; }
|
|
4433
4437
|
get el() { return getElement(this); }
|
|
@@ -4492,12 +4496,9 @@ class AccordionGroup {
|
|
|
4492
4496
|
* Defaults to `"compact"`.
|
|
4493
4497
|
*/
|
|
4494
4498
|
this.expand = 'compact';
|
|
4495
|
-
this.hasEmittedInitialValue = false;
|
|
4496
|
-
this.isUserInitiatedChange = false;
|
|
4497
4499
|
}
|
|
4498
4500
|
valueChanged() {
|
|
4499
|
-
this.
|
|
4500
|
-
this.isUserInitiatedChange = false;
|
|
4501
|
+
this.ionValueChange.emit({ value: this.value });
|
|
4501
4502
|
}
|
|
4502
4503
|
async disabledChanged() {
|
|
4503
4504
|
const { disabled } = this;
|
|
@@ -4571,12 +4572,11 @@ class AccordionGroup {
|
|
|
4571
4572
|
* it is possible for the value to be set after the Web Component
|
|
4572
4573
|
* initializes but before the value watcher is set up in Stencil.
|
|
4573
4574
|
* As a result, the watcher callback may not be fired.
|
|
4574
|
-
* We work around this by manually
|
|
4575
|
-
* has loaded and the watcher
|
|
4575
|
+
* We work around this by manually calling the watcher
|
|
4576
|
+
* callback when the component has loaded and the watcher
|
|
4577
|
+
* is configured.
|
|
4576
4578
|
*/
|
|
4577
|
-
|
|
4578
|
-
this.emitValueChange(true);
|
|
4579
|
-
}
|
|
4579
|
+
this.valueChanged();
|
|
4580
4580
|
}
|
|
4581
4581
|
/**
|
|
4582
4582
|
* Sets the value property and emits ionChange.
|
|
@@ -4587,7 +4587,6 @@ class AccordionGroup {
|
|
|
4587
4587
|
* accordion group to an array.
|
|
4588
4588
|
*/
|
|
4589
4589
|
setValue(accordionValue) {
|
|
4590
|
-
this.isUserInitiatedChange = true;
|
|
4591
4590
|
const value = (this.value = accordionValue);
|
|
4592
4591
|
this.ionChange.emit({ value });
|
|
4593
4592
|
}
|
|
@@ -4657,41 +4656,15 @@ class AccordionGroup {
|
|
|
4657
4656
|
async getAccordions() {
|
|
4658
4657
|
return Array.from(this.el.querySelectorAll(':scope > ion-accordion'));
|
|
4659
4658
|
}
|
|
4660
|
-
emitValueChange(initial, isUserInitiated = false) {
|
|
4661
|
-
const { value, multiple } = this;
|
|
4662
|
-
if (!multiple && Array.isArray(value)) {
|
|
4663
|
-
/**
|
|
4664
|
-
* We do some processing on the `value` array so
|
|
4665
|
-
* that it looks more like an array when logged to
|
|
4666
|
-
* the console.
|
|
4667
|
-
* Example given ['a', 'b']
|
|
4668
|
-
* Default toString() behavior: a,b
|
|
4669
|
-
* Custom behavior: ['a', 'b']
|
|
4670
|
-
*/
|
|
4671
|
-
printIonWarning(`[ion-accordion-group] - An array of values was passed, but multiple is "false". This is incorrect usage and may result in unexpected behaviors. To dismiss this warning, pass a string to the "value" property when multiple="false".
|
|
4672
|
-
|
|
4673
|
-
Value Passed: [${value.map((v) => `'${v}'`).join(', ')}]
|
|
4674
|
-
`, this.el);
|
|
4675
|
-
}
|
|
4676
|
-
/**
|
|
4677
|
-
* Track if this is the initial value update so accordions
|
|
4678
|
-
* can skip transition animations when they first render.
|
|
4679
|
-
*/
|
|
4680
|
-
const shouldMarkInitial = initial || (!this.hasEmittedInitialValue && value !== undefined && !isUserInitiated);
|
|
4681
|
-
this.ionValueChange.emit({ value, initial: shouldMarkInitial });
|
|
4682
|
-
if (value !== undefined) {
|
|
4683
|
-
this.hasEmittedInitialValue = true;
|
|
4684
|
-
}
|
|
4685
|
-
}
|
|
4686
4659
|
render() {
|
|
4687
4660
|
const { disabled, readonly, expand } = this;
|
|
4688
4661
|
const mode = getIonMode$1(this);
|
|
4689
|
-
return (hAsync(Host, { key: '
|
|
4662
|
+
return (hAsync(Host, { key: '9a4a3b7811e63a0748cdcda82a840179cdfb26e1', class: {
|
|
4690
4663
|
[mode]: true,
|
|
4691
4664
|
'accordion-group-disabled': disabled,
|
|
4692
4665
|
'accordion-group-readonly': readonly,
|
|
4693
4666
|
[`accordion-group-expand-${expand}`]: true,
|
|
4694
|
-
}, role: "presentation" }, hAsync("slot", { key: '
|
|
4667
|
+
}, role: "presentation" }, hAsync("slot", { key: '183cebf7e0eb468b5c28c4105f23ec5aed36be1b' })));
|
|
4695
4668
|
}
|
|
4696
4669
|
get el() { return getElement(this); }
|
|
4697
4670
|
static get watchers() { return {
|
package/package.json
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* (C) Ionic http://ionicframework.com - MIT License
|
|
3
|
-
*/
|
|
4
|
-
import{r as t,e as o,h as i,d as n,g as e,c as s,f as a}from"./p-C8IsBmNU.js";import{g as r,r as d,f as c,m as h,t as l}from"./p-CTfR9YZG.js";import{l as p}from"./p-DV3sJJW8.js";import{b as u}from"./p-BFvmZNyx.js";const x=class{constructor(i){t(this,i),this.updateListener=t=>{var o,i;const n=null!==(i=null===(o=t.detail)||void 0===o?void 0:o.initial)&&void 0!==i&&i;console.log("[Accordion]",this.value,"updateListener - initial:",n,"hasInteracted:",this.hasInteracted,"hasEverBeenExpanded:",this.hasEverBeenExpanded,"currentState:",this.state);const e=this.accordionGroupEl;if(e){const t=e.value,o=this.value,i=Array.isArray(t)?t.includes(o):t===o,s=4===this.state||8===this.state,a=i!==s;console.log("[Accordion]",this.value,"shouldExpand:",i,"isExpanded:",s,"stateWillChange:",a),!n&&a&&(console.log("[Accordion]",this.value,"Setting hasInteracted to true"),this.hasInteracted=!0)}this.updateState(n)},this.state=1,this.isNext=!1,this.isPrevious=!1,this.hasInteracted=!1,this.hasEverBeenExpanded=!1,this.value="ion-accordion-"+g++,this.disabled=!1,this.readonly=!1,this.toggleIcon=p,this.toggleIconSlot="end",this.setItemDefaults=()=>{const t=this.getSlottedHeaderIonItem();t&&(t.button=!0,t.detail=!1,void 0===t.lines&&(t.lines="full"))},this.getSlottedHeaderIonItem=()=>{const{headerEl:t}=this;if(!t)return;const o=t.querySelector("slot");return o&&void 0!==o.assignedElements?o.assignedElements().find((t=>"ION-ITEM"===t.tagName)):void 0},this.setAria=(t=!1)=>{const o=this.getSlottedHeaderIonItem();if(!o)return;const i=r(o).querySelector("button");i&&i.setAttribute("aria-expanded",`${t}`)},this.slotToggleIcon=()=>{const t=this.getSlottedHeaderIonItem();if(!t)return;const{toggleIconSlot:o,toggleIcon:i}=this;if(t.querySelector(".ion-accordion-toggle-icon"))return;const n=document.createElement("ion-icon");n.slot=o,n.lazy=!1,n.classList.add("ion-accordion-toggle-icon"),n.icon=i,n.setAttribute("aria-hidden","true"),t.appendChild(n)},this.expandAccordion=(t=!1)=>{console.log("[Accordion]",this.value,"expandAccordion - initialUpdate:",t,"state:",this.state);const{contentEl:o,contentElWrapper:i}=this;if(t||void 0===o||void 0===i)return this.state=4,this.hasEverBeenExpanded=!0,void console.log("[Accordion]",this.value,"expandAccordion early return - hasEverBeenExpanded set to true");4!==this.state?(void 0!==this.currentRaf&&cancelAnimationFrame(this.currentRaf),this.hasEverBeenExpanded=!0,console.log("[Accordion]",this.value,"expandAccordion - hasEverBeenExpanded set to true"),this.shouldAnimate()?(console.log("[Accordion]",this.value,"expandAccordion - will animate"),d((()=>{this.state=8,this.currentRaf=d((async()=>{const t=i.offsetHeight,n=l(o,2e3);o.style.setProperty("max-height",`${t}px`),await n,this.state=4,o.style.removeProperty("max-height")}))}))):this.state=4):console.log("[Accordion]",this.value,"expandAccordion - already expanded, returning")},this.collapseAccordion=(t=!1)=>{const{contentEl:o}=this;t||void 0===o?this.state=1:1!==this.state&&(void 0!==this.currentRaf&&cancelAnimationFrame(this.currentRaf),this.shouldAnimate()?this.currentRaf=d((async()=>{o.style.setProperty("max-height",`${o.offsetHeight}px`),d((async()=>{const t=l(o,2e3);this.state=2,await t,this.state=1,o.style.removeProperty("max-height")}))})):this.state=1)},this.shouldAnimate=()=>this.hasInteracted&&this.hasEverBeenExpanded?"undefined"!=typeof window&&(!matchMedia("(prefers-reduced-motion: reduce)").matches&&!(!o.get("animated",!0)||this.accordionGroupEl&&!this.accordionGroupEl.animated)):(console.log("[Accordion]",this.value,"shouldAnimate: false - hasInteracted:",this.hasInteracted,"hasEverBeenExpanded:",this.hasEverBeenExpanded),!1),this.updateState=async(t=!1)=>{const o=this.accordionGroupEl,i=this.value;if(!o)return;const n=o.value;if(Array.isArray(n)?n.includes(i):n===i)this.expandAccordion(t),this.isNext=this.isPrevious=!1;else{this.collapseAccordion(t);const o=this.getNextSibling(),i=null==o?void 0:o.value;void 0!==i&&(this.isPrevious=Array.isArray(n)?n.includes(i):n===i);const e=this.getPreviousSibling(),s=null==e?void 0:e.value;void 0!==s&&(this.isNext=Array.isArray(n)?n.includes(s):n===s)}},this.getNextSibling=()=>{if(!this.el)return;const t=this.el.nextElementSibling;return"ION-ACCORDION"===(null==t?void 0:t.tagName)?t:void 0},this.getPreviousSibling=()=>{if(!this.el)return;const t=this.el.previousElementSibling;return"ION-ACCORDION"===(null==t?void 0:t.tagName)?t:void 0}}valueChanged(){this.updateState()}connectedCallback(){var t;const o=this.accordionGroupEl=null===(t=this.el)||void 0===t?void 0:t.closest("ion-accordion-group");o&&(this.updateState(!0),c(o,"ionValueChange",this.updateListener))}disconnectedCallback(){const t=this.accordionGroupEl;t&&h(t,"ionValueChange",this.updateListener)}componentDidLoad(){this.setItemDefaults(),this.slotToggleIcon(),d((()=>{this.setAria(4===this.state||8===this.state)}))}toggleExpanded(){const{accordionGroupEl:t,disabled:o,readonly:i,value:n,state:e}=this;o||i||(this.hasInteracted=!0,!t)||t.requestAccordionToggle(n,1===e||2===e)}render(){const{disabled:t,readonly:o}=this,e=u(this),s=4===this.state||8===this.state,a=s?"header expanded":"header",r=s?"content expanded":"content",d=this.shouldAnimate();return console.log("[Accordion]",this.value,"render - state:",this.state,"shouldAnimate:",d,"hasInteracted:",this.hasInteracted,"hasEverBeenExpanded:",this.hasEverBeenExpanded),this.setAria(s),i(n,{key:"df064b6e04171a481170075c5e7171eb47f6e991",class:{[e]:!0,"accordion-expanding":8===this.state,"accordion-expanded":4===this.state,"accordion-collapsing":2===this.state,"accordion-collapsed":1===this.state,"accordion-next":this.isNext,"accordion-previous":this.isPrevious,"accordion-disabled":t,"accordion-readonly":o,"accordion-animated":d}},i("div",{key:"b24711c72057162e6f328fee4959e0da1a09ac61",onClick:()=>this.toggleExpanded(),id:"header",part:a,"aria-controls":"content",ref:t=>this.headerEl=t},i("slot",{key:"d22719b5e50275b9368ca55c11c9ac5dfd1b4d37",name:"header"})),i("div",{key:"d8971d0c5afd10d8c57a0f2f47e41d3ae39da271",id:"content",part:r,role:"region","aria-labelledby":"header",ref:t=>this.contentEl=t},i("div",{key:"46f2a9daf8dd67594ae1591771bae286355ff7a7",id:"content-wrapper",ref:t=>this.contentElWrapper=t},i("slot",{key:"e44acd5d15f147cb7048d52528150a0e51bc924d",name:"content"}))))}static get delegatesFocus(){return!0}get el(){return e(this)}static get watchers(){return{value:["valueChanged"]}}};let g=0;x.style={ios:":host{display:block;position:relative;width:100%;background-color:var(--ion-background-color, #ffffff);overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}:host(.accordion-disabled) #header,:host(.accordion-disabled) #content{opacity:0.4}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}:host(.accordion-next) ::slotted(ion-item[slot=header]){--border-width:0.55px 0px 0.55px 0px}",md:":host{display:block;position:relative;width:100%;background-color:var(--ion-background-color, #ffffff);overflow:hidden;z-index:0}:host(.accordion-expanding) ::slotted(ion-item[slot=header]),:host(.accordion-expanded) ::slotted(ion-item[slot=header]){--border-width:0px}:host(.accordion-animated){-webkit-transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:all 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}:host(.accordion-animated) #content{-webkit-transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1);transition:max-height 300ms cubic-bezier(0.25, 0.8, 0.5, 1)}#content{overflow:hidden;will-change:max-height}:host(.accordion-collapsing) #content{max-height:0 !important}:host(.accordion-collapsed) #content{display:none}:host(.accordion-expanding) #content{max-height:0}:host(.accordion-expanding) #content-wrapper{overflow:auto}:host(.accordion-disabled) #header,:host(.accordion-readonly) #header,:host(.accordion-disabled) #content,:host(.accordion-readonly) #content{pointer-events:none}:host(.accordion-disabled) #header,:host(.accordion-disabled) #content{opacity:0.4}@media (prefers-reduced-motion: reduce){:host,#content{-webkit-transition:none !important;transition:none !important}}"};const m=class{constructor(o){t(this,o),this.ionChange=s(this,"ionChange",7),this.ionValueChange=s(this,"ionValueChange",7),this.animated=!0,this.disabled=!1,this.readonly=!1,this.expand="compact",this.hasEmittedInitialValue=!1,this.isUserInitiatedChange=!1}valueChanged(){this.emitValueChange(!1,this.isUserInitiatedChange),this.isUserInitiatedChange=!1}async disabledChanged(){const{disabled:t}=this,o=await this.getAccordions();for(const i of o)i.disabled=t}async readonlyChanged(){const{readonly:t}=this,o=await this.getAccordions();for(const i of o)i.readonly=t}async onKeydown(t){const o=document.activeElement;if(!o)return;if(!o.closest('ion-accordion [slot="header"]'))return;const i="ION-ACCORDION"===o.tagName?o:o.closest("ion-accordion");if(!i)return;if(i.closest("ion-accordion-group")!==this.el)return;const n=await this.getAccordions(),e=n.findIndex((t=>t===i));if(-1===e)return;let s;"ArrowDown"===t.key?s=this.findNextAccordion(n,e):"ArrowUp"===t.key?s=this.findPreviousAccordion(n,e):"Home"===t.key?s=n[0]:"End"===t.key&&(s=n[n.length-1]),void 0!==s&&s!==o&&s.focus()}async componentDidLoad(){this.disabled&&this.disabledChanged(),this.readonly&&this.readonlyChanged(),this.hasEmittedInitialValue||this.emitValueChange(!0)}setValue(t){this.isUserInitiatedChange=!0;const o=this.value=t;this.ionChange.emit({value:o})}async requestAccordionToggle(t,o){const{multiple:i,value:n,readonly:e,disabled:s}=this;if(!e&&!s)if(o)if(i){const o=null!=n?n:[],i=Array.isArray(o)?o:[o];void 0===i.find((o=>o===t))&&void 0!==t&&this.setValue([...i,t])}else this.setValue(t);else if(i){const o=null!=n?n:[],i=Array.isArray(o)?o:[o];this.setValue(i.filter((o=>o!==t)))}else this.setValue(void 0)}findNextAccordion(t,o){const i=t[o+1];return void 0===i?t[0]:i}findPreviousAccordion(t,o){const i=t[o-1];return void 0===i?t[t.length-1]:i}async getAccordions(){return Array.from(this.el.querySelectorAll(":scope > ion-accordion"))}emitValueChange(t,o=!1){const{value:i,multiple:n}=this;!n&&Array.isArray(i)&&a(`[ion-accordion-group] - An array of values was passed, but multiple is "false". This is incorrect usage and may result in unexpected behaviors. To dismiss this warning, pass a string to the "value" property when multiple="false".\n\n Value Passed: [${i.map((t=>`'${t}'`)).join(", ")}]\n`,this.el),this.ionValueChange.emit({value:i,initial:t||!this.hasEmittedInitialValue&&void 0!==i&&!o}),void 0!==i&&(this.hasEmittedInitialValue=!0)}render(){const{disabled:t,readonly:o,expand:e}=this,s=u(this);return i(n,{key:"fd64cd203e2c8acdfc266005f372e26c29853847",class:{[s]:!0,"accordion-group-disabled":t,"accordion-group-readonly":o,[`accordion-group-expand-${e}`]:!0},role:"presentation"},i("slot",{key:"bdd9f419fc6e20f5de6f0f52ac93af7ec9a380ef"}))}get el(){return e(this)}static get watchers(){return{value:["valueChanged"],disabled:["disabledChanged"],readonly:["readonlyChanged"]}}};m.style={ios:":host{display:block}:host(.accordion-group-expand-inset){-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:16px;margin-bottom:16px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanding),:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanded){border-bottom:none}",md:":host{display:block}:host(.accordion-group-expand-inset){-webkit-margin-start:16px;margin-inline-start:16px;-webkit-margin-end:16px;margin-inline-end:16px;margin-top:16px;margin-bottom:16px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion){-webkit-box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12);box-shadow:0px 3px 1px -2px rgba(0, 0, 0, 0.2), 0px 2px 2px 0px rgba(0, 0, 0, 0.14), 0px 1px 5px 0px rgba(0, 0, 0, 0.12)}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanding),:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-expanded){margin-left:0;margin-right:0;margin-top:16px;margin-bottom:16px;border-radius:6px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-previous){border-end-end-radius:6px;border-end-start-radius:6px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion.accordion-next){border-start-start-radius:6px;border-start-end-radius:6px}:host(.accordion-group-expand-inset) ::slotted(ion-accordion):first-of-type{margin-left:0;margin-right:0;margin-top:0;margin-bottom:0}"};export{x as ion_accordion,m as ion_accordion_group}
|