@ionic/core 8.7.8 → 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/hydrate/index.js CHANGED
@@ -4042,10 +4042,57 @@ const accordionMdCss = ":host{display:block;position:relative;width:100%;backgro
4042
4042
  class Accordion {
4043
4043
  constructor(hostRef) {
4044
4044
  registerInstance(this, hostRef);
4045
- this.updateListener = () => this.updateState(false);
4045
+ this.accordionGroupUpdateHandler = () => {
4046
+ /**
4047
+ * Determine if this update will cause an actual state change.
4048
+ * We only want to mark as "interacted" if the state is changing.
4049
+ */
4050
+ const accordionGroup = this.accordionGroupEl;
4051
+ if (accordionGroup) {
4052
+ const value = accordionGroup.value;
4053
+ const accordionValue = this.value;
4054
+ const shouldExpand = Array.isArray(value) ? value.includes(accordionValue) : value === accordionValue;
4055
+ const isExpanded = this.state === 4 /* AccordionState.Expanded */ || this.state === 8 /* AccordionState.Expanding */;
4056
+ const stateWillChange = shouldExpand !== isExpanded;
4057
+ /**
4058
+ * Only mark as interacted if:
4059
+ * 1. This is not the first update we've received with a defined value
4060
+ * 2. The state is actually changing (prevents redundant updates from enabling animations)
4061
+ */
4062
+ if (this.hasReceivedFirstUpdate && stateWillChange) {
4063
+ this.hasInteracted = true;
4064
+ }
4065
+ /**
4066
+ * Only count this as the first update if the group value is defined.
4067
+ * This prevents the initial undefined value from the group's componentDidLoad
4068
+ * from being treated as the first real update.
4069
+ */
4070
+ if (value !== undefined) {
4071
+ this.hasReceivedFirstUpdate = true;
4072
+ }
4073
+ }
4074
+ this.updateState();
4075
+ };
4046
4076
  this.state = 1 /* AccordionState.Collapsed */;
4047
4077
  this.isNext = false;
4048
4078
  this.isPrevious = false;
4079
+ /**
4080
+ * Tracks whether a user-initiated interaction has occurred.
4081
+ * Animations are disabled until the first interaction happens.
4082
+ * This prevents the accordion from animating when it's programmatically
4083
+ * set to an expanded or collapsed state on initial load.
4084
+ */
4085
+ this.hasInteracted = false;
4086
+ /**
4087
+ * Tracks if this accordion has ever been expanded.
4088
+ * Used to prevent the first expansion from animating.
4089
+ */
4090
+ this.hasEverBeenExpanded = false;
4091
+ /**
4092
+ * Tracks if this accordion has received its first update from the group.
4093
+ * Used to distinguish initial programmatic sets from user interactions.
4094
+ */
4095
+ this.hasReceivedFirstUpdate = false;
4049
4096
  /**
4050
4097
  * The value of the accordion. Defaults to an autogenerated
4051
4098
  * value.
@@ -4150,10 +4197,15 @@ class Accordion {
4150
4197
  iconEl.setAttribute('aria-hidden', 'true');
4151
4198
  ionItem.appendChild(iconEl);
4152
4199
  };
4153
- this.expandAccordion = (initialUpdate = false) => {
4200
+ this.expandAccordion = () => {
4154
4201
  const { contentEl, contentElWrapper } = this;
4155
- if (initialUpdate || contentEl === undefined || contentElWrapper === undefined) {
4202
+ /**
4203
+ * If the content elements aren't available yet, just set the state.
4204
+ * This happens on initial render before the DOM is ready.
4205
+ */
4206
+ if (contentEl === undefined || contentElWrapper === undefined) {
4156
4207
  this.state = 4 /* AccordionState.Expanded */;
4208
+ this.hasEverBeenExpanded = true;
4157
4209
  return;
4158
4210
  }
4159
4211
  if (this.state === 4 /* AccordionState.Expanded */) {
@@ -4162,6 +4214,11 @@ class Accordion {
4162
4214
  if (this.currentRaf !== undefined) {
4163
4215
  cancelAnimationFrame(this.currentRaf);
4164
4216
  }
4217
+ /**
4218
+ * Mark that this accordion has been expanded at least once.
4219
+ * This allows subsequent expansions to animate.
4220
+ */
4221
+ this.hasEverBeenExpanded = true;
4165
4222
  if (this.shouldAnimate()) {
4166
4223
  raf(() => {
4167
4224
  this.state = 8 /* AccordionState.Expanding */;
@@ -4179,9 +4236,13 @@ class Accordion {
4179
4236
  this.state = 4 /* AccordionState.Expanded */;
4180
4237
  }
4181
4238
  };
4182
- this.collapseAccordion = (initialUpdate = false) => {
4239
+ this.collapseAccordion = () => {
4183
4240
  const { contentEl } = this;
4184
- if (initialUpdate || contentEl === undefined) {
4241
+ /**
4242
+ * If the content element isn't available yet, just set the state.
4243
+ * This happens on initial render before the DOM is ready.
4244
+ */
4245
+ if (contentEl === undefined) {
4185
4246
  this.state = 1 /* AccordionState.Collapsed */;
4186
4247
  return;
4187
4248
  }
@@ -4216,6 +4277,18 @@ class Accordion {
4216
4277
  * of what is set in the config.
4217
4278
  */
4218
4279
  this.shouldAnimate = () => {
4280
+ /**
4281
+ * Don't animate until after the first user interaction.
4282
+ * This prevents animations on initial load when accordions
4283
+ * start in an expanded or collapsed state programmatically.
4284
+ *
4285
+ * Additionally, don't animate the very first expansion even if
4286
+ * hasInteracted is true. This handles edge cases like React StrictMode
4287
+ * where effects run twice and might incorrectly mark as interacted.
4288
+ */
4289
+ if (!this.hasInteracted || !this.hasEverBeenExpanded) {
4290
+ return false;
4291
+ }
4219
4292
  if (typeof window === 'undefined') {
4220
4293
  return false;
4221
4294
  }
@@ -4232,7 +4305,7 @@ class Accordion {
4232
4305
  }
4233
4306
  return true;
4234
4307
  };
4235
- this.updateState = async (initialUpdate = false) => {
4308
+ this.updateState = async () => {
4236
4309
  const accordionGroup = this.accordionGroupEl;
4237
4310
  const accordionValue = this.value;
4238
4311
  if (!accordionGroup) {
@@ -4241,11 +4314,11 @@ class Accordion {
4241
4314
  const value = accordionGroup.value;
4242
4315
  const shouldExpand = Array.isArray(value) ? value.includes(accordionValue) : value === accordionValue;
4243
4316
  if (shouldExpand) {
4244
- this.expandAccordion(initialUpdate);
4317
+ this.expandAccordion();
4245
4318
  this.isNext = this.isPrevious = false;
4246
4319
  }
4247
4320
  else {
4248
- this.collapseAccordion(initialUpdate);
4321
+ this.collapseAccordion();
4249
4322
  /**
4250
4323
  * When using popout or inset,
4251
4324
  * the collapsed accordion items
@@ -4293,14 +4366,14 @@ class Accordion {
4293
4366
  var _a;
4294
4367
  const accordionGroupEl = (this.accordionGroupEl = (_a = this.el) === null || _a === void 0 ? void 0 : _a.closest('ion-accordion-group'));
4295
4368
  if (accordionGroupEl) {
4296
- this.updateState(true);
4297
- addEventListener$1(accordionGroupEl, 'ionValueChange', this.updateListener);
4369
+ this.updateState();
4370
+ addEventListener$1(accordionGroupEl, 'ionValueChange', this.accordionGroupUpdateHandler);
4298
4371
  }
4299
4372
  }
4300
4373
  disconnectedCallback() {
4301
4374
  const accordionGroupEl = this.accordionGroupEl;
4302
4375
  if (accordionGroupEl) {
4303
- removeEventListener(accordionGroupEl, 'ionValueChange', this.updateListener);
4376
+ removeEventListener(accordionGroupEl, 'ionValueChange', this.accordionGroupUpdateHandler);
4304
4377
  }
4305
4378
  }
4306
4379
  componentDidLoad() {
@@ -4324,6 +4397,11 @@ class Accordion {
4324
4397
  const { accordionGroupEl, disabled, readonly, value, state } = this;
4325
4398
  if (disabled || readonly)
4326
4399
  return;
4400
+ /**
4401
+ * Mark that the user has interacted with the accordion.
4402
+ * This enables animations for all future state changes.
4403
+ */
4404
+ this.hasInteracted = true;
4327
4405
  if (accordionGroupEl) {
4328
4406
  /**
4329
4407
  * Because the accordion group may or may
@@ -4344,7 +4422,7 @@ class Accordion {
4344
4422
  const headerPart = expanded ? 'header expanded' : 'header';
4345
4423
  const contentPart = expanded ? 'content expanded' : 'content';
4346
4424
  this.setAria(expanded);
4347
- return (hAsync(Host, { key: '073e1d02c18dcbc20c68648426e87c14750c031d', class: {
4425
+ return (hAsync(Host, { key: '9c90bce01eff7e5774a19f69c872f3761d66cf3c', class: {
4348
4426
  [mode]: true,
4349
4427
  'accordion-expanding': this.state === 8 /* AccordionState.Expanding */,
4350
4428
  'accordion-expanded': this.state === 4 /* AccordionState.Expanded */,
@@ -4355,7 +4433,7 @@ class Accordion {
4355
4433
  'accordion-disabled': disabled,
4356
4434
  'accordion-readonly': readonly,
4357
4435
  'accordion-animated': this.shouldAnimate(),
4358
- } }, hAsync("div", { key: '9b4cf326de8bb6b4033992903c0c1bfd7eea9bcc', onClick: () => this.toggleExpanded(), id: "header", part: headerPart, "aria-controls": "content", ref: (headerEl) => (this.headerEl = headerEl) }, hAsync("slot", { key: '464c32a37f64655eacf4218284214f5f30b14a1e', name: "header" })), hAsync("div", { key: '8bb52e6a62d7de0106b253201a89a32e79d9a594', id: "content", part: contentPart, role: "region", "aria-labelledby": "header", ref: (contentEl) => (this.contentEl = contentEl) }, hAsync("div", { key: '1d9dfd952ad493754aaeea7a8f625b33c2dd90a0', id: "content-wrapper", ref: (contentElWrapper) => (this.contentElWrapper = contentElWrapper) }, hAsync("slot", { key: '970dfbc55a612d739d0ca3b7b1a08e5c96d0c479', name: "content" })))));
4436
+ } }, hAsync("div", { key: 'cab40d5bcf3c93fd78e70b6d3906a541e725837d', onClick: () => this.toggleExpanded(), id: "header", part: headerPart, "aria-controls": "content", ref: (headerEl) => (this.headerEl = headerEl) }, hAsync("slot", { key: '672bc7fb3f9e18076b41e20fc9eaeab7cafcf3a2', name: "header" })), hAsync("div", { key: 'fd777ca5b4ab04aa4f44c339d58c8cd987c52bcb', id: "content", part: contentPart, role: "region", "aria-labelledby": "header", ref: (contentEl) => (this.contentEl = contentEl) }, hAsync("div", { key: '0aad70a71e2cd2c16b2e98fa0bdd40421d95fe16', id: "content-wrapper", ref: (contentElWrapper) => (this.contentElWrapper = contentElWrapper) }, hAsync("slot", { key: 'd630e10ac7c56b4dbf943b523f26759b83aead55', name: "content" })))));
4359
4437
  }
4360
4438
  static get delegatesFocus() { return true; }
4361
4439
  get el() { return getElement(this); }
@@ -4377,7 +4455,8 @@ class Accordion {
4377
4455
  "toggleIconSlot": [1, "toggle-icon-slot"],
4378
4456
  "state": [32],
4379
4457
  "isNext": [32],
4380
- "isPrevious": [32]
4458
+ "isPrevious": [32],
4459
+ "hasInteracted": [32]
4381
4460
  },
4382
4461
  "$listeners$": undefined,
4383
4462
  "$lazyBundleId$": "-",
@@ -33468,6 +33547,7 @@ class Select {
33468
33547
  }
33469
33548
  }
33470
33549
  createActionSheetButtons(data, selectValue) {
33550
+ console.log('createActionSheetButtons', data, selectValue);
33471
33551
  const actionSheetButtons = data.map((option) => {
33472
33552
  const value = getOptionValue(option);
33473
33553
  // Remove hydrated before copying over classes
@@ -33475,13 +33555,17 @@ class Select {
33475
33555
  .filter((cls) => cls !== 'hydrated')
33476
33556
  .join(' ');
33477
33557
  const optClass = `${OPTION_CLASS} ${copyClasses}`;
33558
+ const isSelected = isOptionSelected(selectValue, value, this.compareWith);
33478
33559
  return {
33479
- role: isOptionSelected(selectValue, value, this.compareWith) ? 'selected' : '',
33560
+ role: isSelected ? 'selected' : '',
33480
33561
  text: option.textContent,
33481
33562
  cssClass: optClass,
33482
33563
  handler: () => {
33483
33564
  this.setValue(value);
33484
33565
  },
33566
+ htmlAttributes: {
33567
+ 'aria-selected': isSelected ? 'true' : undefined,
33568
+ },
33485
33569
  };
33486
33570
  });
33487
33571
  // Add "cancel" button
@@ -33862,7 +33946,7 @@ class Select {
33862
33946
  * TODO(FW-5592): Remove hasStartEndSlots condition
33863
33947
  */
33864
33948
  const labelShouldFloat = labelPlacement === 'stacked' || (labelPlacement === 'floating' && (hasValue || isExpanded || hasStartEndSlots));
33865
- return (hAsync(Host, { key: '35b5e18e6f79a802ff2d46d1242e80ff755cc0b9', onClick: this.onClick, class: createColorClasses$1(this.color, {
33949
+ return (hAsync(Host, { key: '6c9d106029589c111ede102fbf604f695c293e7d', onClick: this.onClick, class: createColorClasses$1(this.color, {
33866
33950
  [mode]: true,
33867
33951
  'in-item': inItem,
33868
33952
  'in-item-color': hostContext('ion-item.ion-color', el),
@@ -33880,7 +33964,7 @@ class Select {
33880
33964
  [`select-justify-${justify}`]: justifyEnabled,
33881
33965
  [`select-shape-${shape}`]: shape !== undefined,
33882
33966
  [`select-label-placement-${labelPlacement}`]: true,
33883
- }) }, hAsync("label", { key: '6005b34a0c50bc4d7653a4276bc232ecd02e083c', class: "select-wrapper", id: "select-label", onClick: this.onLabelClick }, this.renderLabelContainer(), hAsync("div", { key: 'c7e07aa81ae856c057f16275dd058f37c5670a47', class: "select-wrapper-inner" }, hAsync("slot", { key: '7fc2deefe0424404caacdbbd9e08ed43ba55d28a', name: "start" }), hAsync("div", { key: '157d74ee717b1bc30b5f1c233a09b0c8456aa68e', class: "native-wrapper", ref: (el) => (this.nativeWrapperEl = el), part: "container" }, this.renderSelectText(), this.renderListbox()), hAsync("slot", { key: 'ea66db304528b82bf9317730b6dce3db2612f235', name: "end" }), !hasFloatingOrStackedLabel && this.renderSelectIcon()), hasFloatingOrStackedLabel && this.renderSelectIcon(), shouldRenderHighlight && hAsync("div", { key: '786eb1530b7476f0615d4e7c0bf4e7e4dc66509c', class: "select-highlight" })), this.renderBottomContent()));
33967
+ }) }, hAsync("label", { key: 'bd130ecdd92670a86cb186b6f1130ef67c3db260', class: "select-wrapper", id: "select-label", onClick: this.onLabelClick }, this.renderLabelContainer(), hAsync("div", { key: '3efcc60c04462caa3f75bc33da53633b7cea5b92', class: "select-wrapper-inner" }, hAsync("slot", { key: '8a2afce3ccc3a5555e9ee479b9b0a17178dbca49', name: "start" }), hAsync("div", { key: '9e94fd7bf3691bab7cefb5c13ff88df51a5512d5', class: "native-wrapper", ref: (el) => (this.nativeWrapperEl = el), part: "container" }, this.renderSelectText(), this.renderListbox()), hAsync("slot", { key: '05e4e9581cab5b06f433e47ac2b511b6702ea466', name: "end" }), !hasFloatingOrStackedLabel && this.renderSelectIcon()), hasFloatingOrStackedLabel && this.renderSelectIcon(), shouldRenderHighlight && hAsync("div", { key: 'bcfa0153e36b8bec3c8297ced7fddae7f1542ce0', class: "select-highlight" })), this.renderBottomContent()));
33884
33968
  }
33885
33969
  get el() { return getElement(this); }
33886
33970
  static get watchers() { return {
package/hydrate/index.mjs CHANGED
@@ -4040,10 +4040,57 @@ 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 = () => this.updateState(false);
4043
+ this.accordionGroupUpdateHandler = () => {
4044
+ /**
4045
+ * Determine if this update will cause an actual state change.
4046
+ * We only want to mark as "interacted" if the state is changing.
4047
+ */
4048
+ const accordionGroup = this.accordionGroupEl;
4049
+ if (accordionGroup) {
4050
+ const value = accordionGroup.value;
4051
+ const accordionValue = this.value;
4052
+ const shouldExpand = Array.isArray(value) ? value.includes(accordionValue) : value === accordionValue;
4053
+ const isExpanded = this.state === 4 /* AccordionState.Expanded */ || this.state === 8 /* AccordionState.Expanding */;
4054
+ const stateWillChange = shouldExpand !== isExpanded;
4055
+ /**
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)
4059
+ */
4060
+ if (this.hasReceivedFirstUpdate && stateWillChange) {
4061
+ this.hasInteracted = true;
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
+ }
4071
+ }
4072
+ this.updateState();
4073
+ };
4044
4074
  this.state = 1 /* AccordionState.Collapsed */;
4045
4075
  this.isNext = false;
4046
4076
  this.isPrevious = false;
4077
+ /**
4078
+ * Tracks whether a user-initiated interaction has occurred.
4079
+ * Animations are disabled until the first interaction happens.
4080
+ * This prevents the accordion from animating when it's programmatically
4081
+ * set to an expanded or collapsed state on initial load.
4082
+ */
4083
+ this.hasInteracted = false;
4084
+ /**
4085
+ * Tracks if this accordion has ever been expanded.
4086
+ * Used to prevent the first expansion from animating.
4087
+ */
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;
4047
4094
  /**
4048
4095
  * The value of the accordion. Defaults to an autogenerated
4049
4096
  * value.
@@ -4148,10 +4195,15 @@ class Accordion {
4148
4195
  iconEl.setAttribute('aria-hidden', 'true');
4149
4196
  ionItem.appendChild(iconEl);
4150
4197
  };
4151
- this.expandAccordion = (initialUpdate = false) => {
4198
+ this.expandAccordion = () => {
4152
4199
  const { contentEl, contentElWrapper } = this;
4153
- if (initialUpdate || contentEl === undefined || contentElWrapper === undefined) {
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) {
4154
4205
  this.state = 4 /* AccordionState.Expanded */;
4206
+ this.hasEverBeenExpanded = true;
4155
4207
  return;
4156
4208
  }
4157
4209
  if (this.state === 4 /* AccordionState.Expanded */) {
@@ -4160,6 +4212,11 @@ class Accordion {
4160
4212
  if (this.currentRaf !== undefined) {
4161
4213
  cancelAnimationFrame(this.currentRaf);
4162
4214
  }
4215
+ /**
4216
+ * Mark that this accordion has been expanded at least once.
4217
+ * This allows subsequent expansions to animate.
4218
+ */
4219
+ this.hasEverBeenExpanded = true;
4163
4220
  if (this.shouldAnimate()) {
4164
4221
  raf(() => {
4165
4222
  this.state = 8 /* AccordionState.Expanding */;
@@ -4177,9 +4234,13 @@ class Accordion {
4177
4234
  this.state = 4 /* AccordionState.Expanded */;
4178
4235
  }
4179
4236
  };
4180
- this.collapseAccordion = (initialUpdate = false) => {
4237
+ this.collapseAccordion = () => {
4181
4238
  const { contentEl } = this;
4182
- if (initialUpdate || contentEl === undefined) {
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) {
4183
4244
  this.state = 1 /* AccordionState.Collapsed */;
4184
4245
  return;
4185
4246
  }
@@ -4214,6 +4275,18 @@ class Accordion {
4214
4275
  * of what is set in the config.
4215
4276
  */
4216
4277
  this.shouldAnimate = () => {
4278
+ /**
4279
+ * Don't animate until after the first user interaction.
4280
+ * This prevents animations on initial load when accordions
4281
+ * start in an expanded or collapsed state programmatically.
4282
+ *
4283
+ * Additionally, don't animate the very first expansion even if
4284
+ * hasInteracted is true. This handles edge cases like React StrictMode
4285
+ * where effects run twice and might incorrectly mark as interacted.
4286
+ */
4287
+ if (!this.hasInteracted || !this.hasEverBeenExpanded) {
4288
+ return false;
4289
+ }
4217
4290
  if (typeof window === 'undefined') {
4218
4291
  return false;
4219
4292
  }
@@ -4230,7 +4303,7 @@ class Accordion {
4230
4303
  }
4231
4304
  return true;
4232
4305
  };
4233
- this.updateState = async (initialUpdate = false) => {
4306
+ this.updateState = async () => {
4234
4307
  const accordionGroup = this.accordionGroupEl;
4235
4308
  const accordionValue = this.value;
4236
4309
  if (!accordionGroup) {
@@ -4239,11 +4312,11 @@ class Accordion {
4239
4312
  const value = accordionGroup.value;
4240
4313
  const shouldExpand = Array.isArray(value) ? value.includes(accordionValue) : value === accordionValue;
4241
4314
  if (shouldExpand) {
4242
- this.expandAccordion(initialUpdate);
4315
+ this.expandAccordion();
4243
4316
  this.isNext = this.isPrevious = false;
4244
4317
  }
4245
4318
  else {
4246
- this.collapseAccordion(initialUpdate);
4319
+ this.collapseAccordion();
4247
4320
  /**
4248
4321
  * When using popout or inset,
4249
4322
  * the collapsed accordion items
@@ -4291,14 +4364,14 @@ class Accordion {
4291
4364
  var _a;
4292
4365
  const accordionGroupEl = (this.accordionGroupEl = (_a = this.el) === null || _a === void 0 ? void 0 : _a.closest('ion-accordion-group'));
4293
4366
  if (accordionGroupEl) {
4294
- this.updateState(true);
4295
- addEventListener$1(accordionGroupEl, 'ionValueChange', this.updateListener);
4367
+ this.updateState();
4368
+ addEventListener$1(accordionGroupEl, 'ionValueChange', this.accordionGroupUpdateHandler);
4296
4369
  }
4297
4370
  }
4298
4371
  disconnectedCallback() {
4299
4372
  const accordionGroupEl = this.accordionGroupEl;
4300
4373
  if (accordionGroupEl) {
4301
- removeEventListener(accordionGroupEl, 'ionValueChange', this.updateListener);
4374
+ removeEventListener(accordionGroupEl, 'ionValueChange', this.accordionGroupUpdateHandler);
4302
4375
  }
4303
4376
  }
4304
4377
  componentDidLoad() {
@@ -4322,6 +4395,11 @@ class Accordion {
4322
4395
  const { accordionGroupEl, disabled, readonly, value, state } = this;
4323
4396
  if (disabled || readonly)
4324
4397
  return;
4398
+ /**
4399
+ * Mark that the user has interacted with the accordion.
4400
+ * This enables animations for all future state changes.
4401
+ */
4402
+ this.hasInteracted = true;
4325
4403
  if (accordionGroupEl) {
4326
4404
  /**
4327
4405
  * Because the accordion group may or may
@@ -4342,7 +4420,7 @@ class Accordion {
4342
4420
  const headerPart = expanded ? 'header expanded' : 'header';
4343
4421
  const contentPart = expanded ? 'content expanded' : 'content';
4344
4422
  this.setAria(expanded);
4345
- return (hAsync(Host, { key: '073e1d02c18dcbc20c68648426e87c14750c031d', class: {
4423
+ return (hAsync(Host, { key: '9c90bce01eff7e5774a19f69c872f3761d66cf3c', class: {
4346
4424
  [mode]: true,
4347
4425
  'accordion-expanding': this.state === 8 /* AccordionState.Expanding */,
4348
4426
  'accordion-expanded': this.state === 4 /* AccordionState.Expanded */,
@@ -4353,7 +4431,7 @@ class Accordion {
4353
4431
  'accordion-disabled': disabled,
4354
4432
  'accordion-readonly': readonly,
4355
4433
  'accordion-animated': this.shouldAnimate(),
4356
- } }, hAsync("div", { key: '9b4cf326de8bb6b4033992903c0c1bfd7eea9bcc', onClick: () => this.toggleExpanded(), id: "header", part: headerPart, "aria-controls": "content", ref: (headerEl) => (this.headerEl = headerEl) }, hAsync("slot", { key: '464c32a37f64655eacf4218284214f5f30b14a1e', name: "header" })), hAsync("div", { key: '8bb52e6a62d7de0106b253201a89a32e79d9a594', id: "content", part: contentPart, role: "region", "aria-labelledby": "header", ref: (contentEl) => (this.contentEl = contentEl) }, hAsync("div", { key: '1d9dfd952ad493754aaeea7a8f625b33c2dd90a0', id: "content-wrapper", ref: (contentElWrapper) => (this.contentElWrapper = contentElWrapper) }, hAsync("slot", { key: '970dfbc55a612d739d0ca3b7b1a08e5c96d0c479', name: "content" })))));
4434
+ } }, hAsync("div", { key: 'cab40d5bcf3c93fd78e70b6d3906a541e725837d', onClick: () => this.toggleExpanded(), id: "header", part: headerPart, "aria-controls": "content", ref: (headerEl) => (this.headerEl = headerEl) }, hAsync("slot", { key: '672bc7fb3f9e18076b41e20fc9eaeab7cafcf3a2', name: "header" })), hAsync("div", { key: 'fd777ca5b4ab04aa4f44c339d58c8cd987c52bcb', id: "content", part: contentPart, role: "region", "aria-labelledby": "header", ref: (contentEl) => (this.contentEl = contentEl) }, hAsync("div", { key: '0aad70a71e2cd2c16b2e98fa0bdd40421d95fe16', id: "content-wrapper", ref: (contentElWrapper) => (this.contentElWrapper = contentElWrapper) }, hAsync("slot", { key: 'd630e10ac7c56b4dbf943b523f26759b83aead55', name: "content" })))));
4357
4435
  }
4358
4436
  static get delegatesFocus() { return true; }
4359
4437
  get el() { return getElement(this); }
@@ -4375,7 +4453,8 @@ class Accordion {
4375
4453
  "toggleIconSlot": [1, "toggle-icon-slot"],
4376
4454
  "state": [32],
4377
4455
  "isNext": [32],
4378
- "isPrevious": [32]
4456
+ "isPrevious": [32],
4457
+ "hasInteracted": [32]
4379
4458
  },
4380
4459
  "$listeners$": undefined,
4381
4460
  "$lazyBundleId$": "-",
@@ -33466,6 +33545,7 @@ class Select {
33466
33545
  }
33467
33546
  }
33468
33547
  createActionSheetButtons(data, selectValue) {
33548
+ console.log('createActionSheetButtons', data, selectValue);
33469
33549
  const actionSheetButtons = data.map((option) => {
33470
33550
  const value = getOptionValue(option);
33471
33551
  // Remove hydrated before copying over classes
@@ -33473,13 +33553,17 @@ class Select {
33473
33553
  .filter((cls) => cls !== 'hydrated')
33474
33554
  .join(' ');
33475
33555
  const optClass = `${OPTION_CLASS} ${copyClasses}`;
33556
+ const isSelected = isOptionSelected(selectValue, value, this.compareWith);
33476
33557
  return {
33477
- role: isOptionSelected(selectValue, value, this.compareWith) ? 'selected' : '',
33558
+ role: isSelected ? 'selected' : '',
33478
33559
  text: option.textContent,
33479
33560
  cssClass: optClass,
33480
33561
  handler: () => {
33481
33562
  this.setValue(value);
33482
33563
  },
33564
+ htmlAttributes: {
33565
+ 'aria-selected': isSelected ? 'true' : undefined,
33566
+ },
33483
33567
  };
33484
33568
  });
33485
33569
  // Add "cancel" button
@@ -33860,7 +33944,7 @@ class Select {
33860
33944
  * TODO(FW-5592): Remove hasStartEndSlots condition
33861
33945
  */
33862
33946
  const labelShouldFloat = labelPlacement === 'stacked' || (labelPlacement === 'floating' && (hasValue || isExpanded || hasStartEndSlots));
33863
- return (hAsync(Host, { key: '35b5e18e6f79a802ff2d46d1242e80ff755cc0b9', onClick: this.onClick, class: createColorClasses$1(this.color, {
33947
+ return (hAsync(Host, { key: '6c9d106029589c111ede102fbf604f695c293e7d', onClick: this.onClick, class: createColorClasses$1(this.color, {
33864
33948
  [mode]: true,
33865
33949
  'in-item': inItem,
33866
33950
  'in-item-color': hostContext('ion-item.ion-color', el),
@@ -33878,7 +33962,7 @@ class Select {
33878
33962
  [`select-justify-${justify}`]: justifyEnabled,
33879
33963
  [`select-shape-${shape}`]: shape !== undefined,
33880
33964
  [`select-label-placement-${labelPlacement}`]: true,
33881
- }) }, hAsync("label", { key: '6005b34a0c50bc4d7653a4276bc232ecd02e083c', class: "select-wrapper", id: "select-label", onClick: this.onLabelClick }, this.renderLabelContainer(), hAsync("div", { key: 'c7e07aa81ae856c057f16275dd058f37c5670a47', class: "select-wrapper-inner" }, hAsync("slot", { key: '7fc2deefe0424404caacdbbd9e08ed43ba55d28a', name: "start" }), hAsync("div", { key: '157d74ee717b1bc30b5f1c233a09b0c8456aa68e', class: "native-wrapper", ref: (el) => (this.nativeWrapperEl = el), part: "container" }, this.renderSelectText(), this.renderListbox()), hAsync("slot", { key: 'ea66db304528b82bf9317730b6dce3db2612f235', name: "end" }), !hasFloatingOrStackedLabel && this.renderSelectIcon()), hasFloatingOrStackedLabel && this.renderSelectIcon(), shouldRenderHighlight && hAsync("div", { key: '786eb1530b7476f0615d4e7c0bf4e7e4dc66509c', class: "select-highlight" })), this.renderBottomContent()));
33965
+ }) }, hAsync("label", { key: 'bd130ecdd92670a86cb186b6f1130ef67c3db260', class: "select-wrapper", id: "select-label", onClick: this.onLabelClick }, this.renderLabelContainer(), hAsync("div", { key: '3efcc60c04462caa3f75bc33da53633b7cea5b92', class: "select-wrapper-inner" }, hAsync("slot", { key: '8a2afce3ccc3a5555e9ee479b9b0a17178dbca49', name: "start" }), hAsync("div", { key: '9e94fd7bf3691bab7cefb5c13ff88df51a5512d5', class: "native-wrapper", ref: (el) => (this.nativeWrapperEl = el), part: "container" }, this.renderSelectText(), this.renderListbox()), hAsync("slot", { key: '05e4e9581cab5b06f433e47ac2b511b6702ea466', name: "end" }), !hasFloatingOrStackedLabel && this.renderSelectIcon()), hasFloatingOrStackedLabel && this.renderSelectIcon(), shouldRenderHighlight && hAsync("div", { key: 'bcfa0153e36b8bec3c8297ced7fddae7f1542ce0', class: "select-highlight" })), this.renderBottomContent()));
33882
33966
  }
33883
33967
  get el() { return getElement(this); }
33884
33968
  static get watchers() { return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ionic/core",
3
- "version": "8.7.8",
3
+ "version": "8.7.9-dev.11762286926.1d5197be",
4
4
  "description": "Base components for Ionic",
5
5
  "keywords": [
6
6
  "ionic",
@@ -1,4 +0,0 @@
1
- /*!
2
- * (C) Ionic http://ionicframework.com - MIT License
3
- */
4
- import{r as o,e as t,h as i,d as n,g as e,c as a,f as s}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 g}from"./p-BFvmZNyx.js";const u=class{constructor(i){o(this,i),this.updateListener=()=>this.updateState(!1),this.state=1,this.isNext=!1,this.isPrevious=!1,this.value="ion-accordion-"+b++,this.disabled=!1,this.readonly=!1,this.toggleIcon=p,this.toggleIconSlot="end",this.setItemDefaults=()=>{const o=this.getSlottedHeaderIonItem();o&&(o.button=!0,o.detail=!1,void 0===o.lines&&(o.lines="full"))},this.getSlottedHeaderIonItem=()=>{const{headerEl:o}=this;if(!o)return;const t=o.querySelector("slot");return t&&void 0!==t.assignedElements?t.assignedElements().find((o=>"ION-ITEM"===o.tagName)):void 0},this.setAria=(o=!1)=>{const t=this.getSlottedHeaderIonItem();if(!t)return;const i=r(t).querySelector("button");i&&i.setAttribute("aria-expanded",`${o}`)},this.slotToggleIcon=()=>{const o=this.getSlottedHeaderIonItem();if(!o)return;const{toggleIconSlot:t,toggleIcon:i}=this;if(o.querySelector(".ion-accordion-toggle-icon"))return;const n=document.createElement("ion-icon");n.slot=t,n.lazy=!1,n.classList.add("ion-accordion-toggle-icon"),n.icon=i,n.setAttribute("aria-hidden","true"),o.appendChild(n)},this.expandAccordion=(o=!1)=>{const{contentEl:t,contentElWrapper:i}=this;o||void 0===t||void 0===i?this.state=4:4!==this.state&&(void 0!==this.currentRaf&&cancelAnimationFrame(this.currentRaf),this.shouldAnimate()?d((()=>{this.state=8,this.currentRaf=d((async()=>{const o=i.offsetHeight,n=l(t,2e3);t.style.setProperty("max-height",`${o}px`),await n,this.state=4,t.style.removeProperty("max-height")}))})):this.state=4)},this.collapseAccordion=(o=!1)=>{const{contentEl:t}=this;o||void 0===t?this.state=1:1!==this.state&&(void 0!==this.currentRaf&&cancelAnimationFrame(this.currentRaf),this.shouldAnimate()?this.currentRaf=d((async()=>{t.style.setProperty("max-height",`${t.offsetHeight}px`),d((async()=>{const o=l(t,2e3);this.state=2,await o,this.state=1,t.style.removeProperty("max-height")}))})):this.state=1)},this.shouldAnimate=()=>"undefined"!=typeof window&&(!matchMedia("(prefers-reduced-motion: reduce)").matches&&!(!t.get("animated",!0)||this.accordionGroupEl&&!this.accordionGroupEl.animated)),this.updateState=async(o=!1)=>{const t=this.accordionGroupEl,i=this.value;if(!t)return;const n=t.value;if(Array.isArray(n)?n.includes(i):n===i)this.expandAccordion(o),this.isNext=this.isPrevious=!1;else{this.collapseAccordion(o);const t=this.getNextSibling(),i=null==t?void 0:t.value;void 0!==i&&(this.isPrevious=Array.isArray(n)?n.includes(i):n===i);const e=this.getPreviousSibling(),a=null==e?void 0:e.value;void 0!==a&&(this.isNext=Array.isArray(n)?n.includes(a):n===a)}},this.getNextSibling=()=>{if(!this.el)return;const o=this.el.nextElementSibling;return"ION-ACCORDION"===(null==o?void 0:o.tagName)?o:void 0},this.getPreviousSibling=()=>{if(!this.el)return;const o=this.el.previousElementSibling;return"ION-ACCORDION"===(null==o?void 0:o.tagName)?o:void 0}}valueChanged(){this.updateState()}connectedCallback(){var o;const t=this.accordionGroupEl=null===(o=this.el)||void 0===o?void 0:o.closest("ion-accordion-group");t&&(this.updateState(!0),c(t,"ionValueChange",this.updateListener))}disconnectedCallback(){const o=this.accordionGroupEl;o&&h(o,"ionValueChange",this.updateListener)}componentDidLoad(){this.setItemDefaults(),this.slotToggleIcon(),d((()=>{this.setAria(4===this.state||8===this.state)}))}toggleExpanded(){const{accordionGroupEl:o,disabled:t,readonly:i,value:n,state:e}=this;t||i||!o||o.requestAccordionToggle(n,1===e||2===e)}render(){const{disabled:o,readonly:t}=this,e=g(this),a=4===this.state||8===this.state,s=a?"header expanded":"header",r=a?"content expanded":"content";return this.setAria(a),i(n,{key:"073e1d02c18dcbc20c68648426e87c14750c031d",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":o,"accordion-readonly":t,"accordion-animated":this.shouldAnimate()}},i("div",{key:"9b4cf326de8bb6b4033992903c0c1bfd7eea9bcc",onClick:()=>this.toggleExpanded(),id:"header",part:s,"aria-controls":"content",ref:o=>this.headerEl=o},i("slot",{key:"464c32a37f64655eacf4218284214f5f30b14a1e",name:"header"})),i("div",{key:"8bb52e6a62d7de0106b253201a89a32e79d9a594",id:"content",part:r,role:"region","aria-labelledby":"header",ref:o=>this.contentEl=o},i("div",{key:"1d9dfd952ad493754aaeea7a8f625b33c2dd90a0",id:"content-wrapper",ref:o=>this.contentElWrapper=o},i("slot",{key:"970dfbc55a612d739d0ca3b7b1a08e5c96d0c479",name:"content"}))))}static get delegatesFocus(){return!0}get el(){return e(this)}static get watchers(){return{value:["valueChanged"]}}};let b=0;u.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 x=class{constructor(t){o(this,t),this.ionChange=a(this,"ionChange",7),this.ionValueChange=a(this,"ionValueChange",7),this.animated=!0,this.disabled=!1,this.readonly=!1,this.expand="compact"}valueChanged(){const{value:o,multiple:t}=this;!t&&Array.isArray(o)&&s(`[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: [${o.map((o=>`'${o}'`)).join(", ")}]\n`,this.el),this.ionValueChange.emit({value:this.value})}async disabledChanged(){const{disabled:o}=this,t=await this.getAccordions();for(const i of t)i.disabled=o}async readonlyChanged(){const{readonly:o}=this,t=await this.getAccordions();for(const i of t)i.readonly=o}async onKeydown(o){const t=document.activeElement;if(!t)return;if(!t.closest('ion-accordion [slot="header"]'))return;const i="ION-ACCORDION"===t.tagName?t:t.closest("ion-accordion");if(!i)return;if(i.closest("ion-accordion-group")!==this.el)return;const n=await this.getAccordions(),e=n.findIndex((o=>o===i));if(-1===e)return;let a;"ArrowDown"===o.key?a=this.findNextAccordion(n,e):"ArrowUp"===o.key?a=this.findPreviousAccordion(n,e):"Home"===o.key?a=n[0]:"End"===o.key&&(a=n[n.length-1]),void 0!==a&&a!==t&&a.focus()}async componentDidLoad(){this.disabled&&this.disabledChanged(),this.readonly&&this.readonlyChanged(),this.valueChanged()}setValue(o){const t=this.value=o;this.ionChange.emit({value:t})}async requestAccordionToggle(o,t){const{multiple:i,value:n,readonly:e,disabled:a}=this;if(!e&&!a)if(t)if(i){const t=null!=n?n:[],i=Array.isArray(t)?t:[t];void 0===i.find((t=>t===o))&&void 0!==o&&this.setValue([...i,o])}else this.setValue(o);else if(i){const t=null!=n?n:[],i=Array.isArray(t)?t:[t];this.setValue(i.filter((t=>t!==o)))}else this.setValue(void 0)}findNextAccordion(o,t){const i=o[t+1];return void 0===i?o[0]:i}findPreviousAccordion(o,t){const i=o[t-1];return void 0===i?o[o.length-1]:i}async getAccordions(){return Array.from(this.el.querySelectorAll(":scope > ion-accordion"))}render(){const{disabled:o,readonly:t,expand:e}=this,a=g(this);return i(n,{key:"d1a79a93179474fbba66fcf11a92f4871dacc975",class:{[a]:!0,"accordion-group-disabled":o,"accordion-group-readonly":t,[`accordion-group-expand-${e}`]:!0},role:"presentation"},i("slot",{key:"e6b8954b686d1fbb4fc92adb07fddc97a24b0a31"}))}get el(){return e(this)}static get watchers(){return{value:["valueChanged"],disabled:["disabledChanged"],readonly:["readonlyChanged"]}}};x.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{u as ion_accordion,x as ion_accordion_group}