udp-stencil-component-library 26.3.0-beta.7 → 26.3.0-beta.9

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.
@@ -3902,7 +3902,11 @@ const UdpDateInput = class {
3902
3902
  * - 'MM/DD/YYYY' - US format
3903
3903
  * - 'DD/MM/YYYY' - UK/Europe/Canada format
3904
3904
  * - 'YYYY/MM/DD' - ISO/China/Japan format
3905
- * Defaults to browser locale detection if not specified.
3905
+ *
3906
+ * @deprecated Use `dateFormat` instead. `format` collides with the reserved
3907
+ * `format` prop of form libraries (e.g. react-final-form's `<Field>`), which
3908
+ * treats it as a value-formatter function. Retained as an alias; `dateFormat`
3909
+ * takes precedence when both are set.
3906
3910
  */
3907
3911
  this.format = 'MM/DD/YYYY';
3908
3912
  /**
@@ -4040,6 +4044,11 @@ const UdpDateInput = class {
4040
4044
  this.isPopoverOpen = !this.isPopoverOpen;
4041
4045
  };
4042
4046
  }
4047
+ /** Resolved display format. `dateFormat` wins over the deprecated `format`. */
4048
+ get resolvedFormat() {
4049
+ var _a;
4050
+ return (_a = this.dateFormat) !== null && _a !== void 0 ? _a : this.format;
4051
+ }
4043
4052
  onValueChange(newValue) {
4044
4053
  // Sync external prop to internal state, normalizing through parseDateInput
4045
4054
  if (newValue !== this.internalValue) {
@@ -4047,6 +4056,13 @@ const UdpDateInput = class {
4047
4056
  this.displayValue = this.formatDateForDisplay(this.internalValue);
4048
4057
  }
4049
4058
  }
4059
+ onFormatChange() {
4060
+ // The display string is derived from the format. Props are applied
4061
+ // asynchronously (e.g. via the React wrapper), so the format can land after
4062
+ // the value has already been formatted. Re-derive the display from the
4063
+ // canonical internal value whenever the format changes.
4064
+ this.displayValue = this.formatDateForDisplay(this.internalValue);
4065
+ }
4050
4066
  componentWillLoad() {
4051
4067
  // Initialize internal state from value prop, normalizing through parseDateInput
4052
4068
  if (this.value) {
@@ -4087,7 +4103,7 @@ const UdpDateInput = class {
4087
4103
  if (!match)
4088
4104
  return isoDate; // Return as-is if not valid ISO format
4089
4105
  const [, year, month, day] = match;
4090
- switch (this.format) {
4106
+ switch (this.resolvedFormat) {
4091
4107
  case 'MM/DD/YYYY':
4092
4108
  return `${month}/${day}/${year}`;
4093
4109
  case 'DD/MM/YYYY':
@@ -4211,12 +4227,12 @@ const UdpDateInput = class {
4211
4227
  // 4. Current year shorthand: exactly 4 digits (e.g., 0113)
4212
4228
  if (/^\d{4}$/.test(cleaned)) {
4213
4229
  let month, day;
4214
- if (this.format === 'YYYY/MM/DD') {
4230
+ if (this.resolvedFormat === 'YYYY/MM/DD') {
4215
4231
  // For ISO format, interpret as MMDD
4216
4232
  month = parseInt(cleaned.substring(0, 2), 10);
4217
4233
  day = parseInt(cleaned.substring(2, 4), 10);
4218
4234
  }
4219
- else if (this.format === 'DD/MM/YYYY') {
4235
+ else if (this.resolvedFormat === 'DD/MM/YYYY') {
4220
4236
  // Day first
4221
4237
  day = parseInt(cleaned.substring(0, 2), 10);
4222
4238
  month = parseInt(cleaned.substring(2, 4), 10);
@@ -4235,13 +4251,13 @@ const UdpDateInput = class {
4235
4251
  if (separatorMatch) {
4236
4252
  const [, part1, part2, part3] = separatorMatch.map(Number);
4237
4253
  let year, month, day;
4238
- if (this.format === 'YYYY/MM/DD' || part1 > 31) {
4254
+ if (this.resolvedFormat === 'YYYY/MM/DD' || part1 > 31) {
4239
4255
  // Year first or first part is clearly a year
4240
4256
  year = part1;
4241
4257
  month = part2;
4242
4258
  day = part3;
4243
4259
  }
4244
- else if (this.format === 'DD/MM/YYYY') {
4260
+ else if (this.resolvedFormat === 'DD/MM/YYYY') {
4245
4261
  day = part1;
4246
4262
  month = part2;
4247
4263
  year = part3;
@@ -4270,7 +4286,7 @@ const UdpDateInput = class {
4270
4286
  const [, part1, part2] = twoPartMatch.map(Number);
4271
4287
  const year = today.getFullYear();
4272
4288
  let month, day;
4273
- if (this.format === 'DD/MM/YYYY' || this.format === 'YYYY/MM/DD') {
4289
+ if (this.resolvedFormat === 'DD/MM/YYYY' || this.resolvedFormat === 'YYYY/MM/DD') {
4274
4290
  // For DD/MM and YYYY/MM/DD, when only two parts, assume DD/MM
4275
4291
  day = part1;
4276
4292
  month = part2;
@@ -4423,14 +4439,14 @@ const UdpDateInput = class {
4423
4439
  render() {
4424
4440
  const hasError = !!this.error || !!this.internalError;
4425
4441
  const message = this.internalError || this.error || this.hint;
4426
- return (index.h(index.Host, { key: 'ac71c838ad139db1925a16e5b88152f685577682', class: { 'has-error': hasError, 'disabled': this.disabled } }, index.h("fluent-field", { key: 'feefd9316ce2f601d2a7bc8c1e69ca665be98ac3', class: { 'no-message': !message && !this.includeErrorPadding } }, index.h("udp-popover", { key: 'eedbdb5fc16759b9b8649f3c49da0fb01e51112b', slot: "input", open: this.isPopoverOpen, position: "bottom-start", toggleOnTriggerClick: false, onPopoverClose: () => {
4442
+ return (index.h(index.Host, { key: '9a0b36661cc0bc79733f5e5166b0237c74b8055a', class: { 'has-error': hasError, 'disabled': this.disabled } }, index.h("fluent-field", { key: 'fb3070fa56b39354181e4e1df3125a22673e90e4', class: { 'no-message': !message && !this.includeErrorPadding } }, index.h("udp-popover", { key: '671bbd0c71a947b916eb6b4d2c90f632344e6284', slot: "input", open: this.isPopoverOpen, position: "bottom-start", toggleOnTriggerClick: false, onPopoverClose: () => {
4427
4443
  this.isPopoverOpen = false;
4428
4444
  // Only return focus to input if Escape was pressed (not on click-away)
4429
4445
  if (this.restoreFocusOnClose) {
4430
4446
  this.restoreFocusOnClose = false;
4431
4447
  requestAnimationFrame(() => this.focusInput());
4432
4448
  }
4433
- }, trapFocus: false, closeOnBlur: false }, index.h("fluent-text-input", { key: 'dc575d36fd8139dacf8fc6edef3553295ab50696', slot: "trigger", ref: el => (this.inputRef = el), class: { 'no-label': !this.label }, name: this.name, value: this.displayValue, type: "text", required: this.required, disabled: this.disabled, readonly: this.readonly, autofocus: this.autofocus, autocomplete: this.autocomplete, appearance: this.appearance, controlSize: this.controlSize, onInput: this.handleInput, onKeyDown: this.handleKeyDown, onBlur: this.handleBlur, onFocus: () => this.inputFocus.emit(), onClick: this.handleInputClick, onInvalid: (e) => e.preventDefault() }, index.h("fluent-label", { key: '24fdc128498e713cb71d1b0647c707e70a17d40e', required: this.required, disabled: this.disabled, onMouseDown: this.handleLabelMouseDown }, this.label, this.popupHint && (index.h("udp-tooltip", { key: '2aa80b606bcba533d03cedaabb22472eaab7cece', content: this.popupHint, positioning: "above" }, index.h("udp-fluent-icon", { key: 'd7b49e842930ed6ae31638e9475571b2a9b0b044', name: "info", size: "xs", class: "popup-hint-icon" })))), index.h("div", { key: 'ce0830f9f1fe61b23f4f89363b95f97331c2f2cf', slot: "end" }, index.h("udp-fluent-icon-button", { key: 'e412d65925057b3a4f7ddf2876cdde9ecd799165', appearance: "transparent", iconName: "calendar", onMouseDown: this.handleIconMouseDown, onClick: this.handleIconClick, disabled: this.disabled || this.readonly, tabindex: -1 }))), index.h("div", { key: 'aed253ee74b5e0f9d116b43470cc453e05649858', slot: "content" }, index.h("udp-date-range-selector", { key: '245970b9bc37881030d37f1919f942d255b2bd35', ref: el => (this.calendarRef = el), monthsToDisplay: 1, value: this.internalValue, onChange: this.handleDateSelect, minDate: this.minDate, maxDate: this.maxDate, isDateDisallowed: this.isDateDisallowed, getDayParts: this.getDayParts, variant: this.dateSelectionType, size: "sm" }), index.h("div", { key: 'a6c1873893025688082cf07430179b9036e937eb', class: "footer-buttons" }, index.h("udp-fluent-button", { key: '3850b26b07974bfb8bdece541d33668817a499b5', appearance: "transparent", size: "small", onClick: this.handleToday }, "Today"), index.h("udp-fluent-button", { key: 'd981881855642d59afd0be88db9ac69c8465bb5e', appearance: "transparent", size: "small", onClick: this.handleClear }, "Clear")))), index.h("udp-text", { key: '0cbae8c3c2784d833bd0245799116a1e7917ee90', slot: "message", variant: "caption1", class: {
4449
+ }, trapFocus: false, closeOnBlur: false }, index.h("fluent-text-input", { key: '2ed5e9fb7e708f42ad4ee35fd51e12fad200b76e', slot: "trigger", ref: el => (this.inputRef = el), class: { 'no-label': !this.label }, name: this.name, value: this.displayValue, type: "text", required: this.required, disabled: this.disabled, readonly: this.readonly, autofocus: this.autofocus, autocomplete: this.autocomplete, appearance: this.appearance, controlSize: this.controlSize, onInput: this.handleInput, onKeyDown: this.handleKeyDown, onBlur: this.handleBlur, onFocus: () => this.inputFocus.emit(), onClick: this.handleInputClick, onInvalid: (e) => e.preventDefault() }, index.h("fluent-label", { key: '1b52489eca9d175bb163af05831bc8237b6a3ebb', required: this.required, disabled: this.disabled, onMouseDown: this.handleLabelMouseDown }, this.label, this.popupHint && (index.h("udp-tooltip", { key: 'f09510db0e4ceb3a36d6d136627c3284df4aad97', content: this.popupHint, positioning: "above" }, index.h("udp-fluent-icon", { key: '0521edcfb7bfd0d4423977bf5fa84459e73a6a3c', name: "info", size: "xs", class: "popup-hint-icon" })))), index.h("div", { key: '4847d6b093aec40d1997e0a901b30450d1c096de', slot: "end" }, index.h("udp-fluent-icon-button", { key: '0bad521605aa667ecbe4bc515c59c0a3356bc73a', appearance: "transparent", iconName: "calendar", onMouseDown: this.handleIconMouseDown, onClick: this.handleIconClick, disabled: this.disabled || this.readonly, tabindex: -1 }))), index.h("div", { key: 'd4d7bcf356f63a6e48e2e7a0e729fc1f828fee42', slot: "content" }, index.h("udp-date-range-selector", { key: '4eeaf2c5b00ba70e28f7a5ea0f9df78ce8141f62', ref: el => (this.calendarRef = el), monthsToDisplay: 1, value: this.internalValue, onChange: this.handleDateSelect, minDate: this.minDate, maxDate: this.maxDate, isDateDisallowed: this.isDateDisallowed, getDayParts: this.getDayParts, variant: this.dateSelectionType, size: "sm" }), index.h("div", { key: 'e4f15cc0f854b2d3a389202510bb18202a7f236f', class: "footer-buttons" }, index.h("udp-fluent-button", { key: '6c33fee28a778824bd25f9b6785226a21dee0f18', appearance: "transparent", size: "small", onClick: this.handleToday }, "Today"), index.h("udp-fluent-button", { key: '5a1076da7d313e7798d5a95ad38ce77171b9d207', appearance: "transparent", size: "small", onClick: this.handleClear }, "Clear")))), index.h("udp-text", { key: '2291ebb040091ef54a05999d91597967fc6bbbdb', slot: "message", variant: "caption1", class: {
4434
4450
  message: true,
4435
4451
  error: hasError,
4436
4452
  includeErrorPadding: this.includeErrorPadding,
@@ -4441,6 +4457,12 @@ const UdpDateInput = class {
4441
4457
  static get watchers() { return {
4442
4458
  "value": [{
4443
4459
  "onValueChange": 0
4460
+ }],
4461
+ "format": [{
4462
+ "onFormatChange": 0
4463
+ }],
4464
+ "dateFormat": [{
4465
+ "onFormatChange": 0
4444
4466
  }]
4445
4467
  }; }
4446
4468
  };
@@ -4949,7 +4971,14 @@ const UdpDateTimeInput = class {
4949
4971
  this.controlSize = 'medium';
4950
4972
  /** When true, the date and time inputs stack vertically instead of sitting side-by-side. */
4951
4973
  this.stacked = false;
4952
- /** Date display format. */
4974
+ /**
4975
+ * Date display format.
4976
+ *
4977
+ * @deprecated Use `dateFormat` instead. `format` collides with the reserved
4978
+ * `format` prop of form libraries (e.g. react-final-form's `<Field>`), which
4979
+ * treats it as a value-formatter function. Retained as an alias; `dateFormat`
4980
+ * takes precedence when both are set.
4981
+ */
4953
4982
  this.format = 'MM/DD/YYYY';
4954
4983
  /** Whether to reserve space for error/helper text to prevent layout shift. */
4955
4984
  this.includeErrorPadding = true;
@@ -5015,10 +5044,11 @@ const UdpDateTimeInput = class {
5015
5044
  this.valueChanged.emit(newValue);
5016
5045
  }
5017
5046
  render() {
5047
+ var _a;
5018
5048
  // If a main label is provided (for date) but no time label, default time label to a non-breaking space
5019
5049
  // to maintain vertical alignment (ensuring the time input isn't pushed up).
5020
5050
  const effectiveTimeLabel = this.timeLabel === undefined && this.label ? '\u00A0' : this.timeLabel;
5021
- return (index.h(index.Host, { key: '2f593ed0b4de495cab7ee284c13291e998a98281' }, index.h("div", { key: 'd15f5dfb61ffa25cca1aa12a1b7cf3179b9af516', class: "date-part" }, index.h("udp-date-input", { key: 'ce201e5f203e698041451fb5ca1ec05ea373fb33', name: `${this.name}-date`, value: this.datePart, required: this.required, disabled: this.disabled, autofocus: this.autofocus, appearance: this.appearance, controlSize: this.controlSize, format: this.format, minDate: this.minDate, maxDate: this.maxDate, isDateDisallowed: this.isDateDisallowed, getDayParts: this.getDayParts, error: this.error, includeErrorPadding: this.includeErrorPadding, onValueChanged: this.handleDateChange, label: this.label, popupHint: this.popupHint })), index.h("div", { key: '27bdca75aea7869283d63477a59b9218ef9bf5ba', class: "time-part" }, index.h("udp-time-input", { key: 'f15b29ec0c556777910830408ad96d8ca48e4acb', name: `${this.name}-time`, value: this.timePart, required: false, disabled: this.disabled, appearance: this.appearance, controlSize: this.controlSize, label: effectiveTimeLabel, minuteStep: this.minuteStep, use24Hour: this.use24Hour, onValueChanged: this.handleTimeChange, includeErrorPadding: this.includeErrorPadding, error: this.error ? ' ' : undefined }))));
5051
+ return (index.h(index.Host, { key: 'ba83526f5089ef1e21ef458742f7aed102f6fe9d' }, index.h("div", { key: 'f92eb98cd36445ac370a1e1da7ac40a2700d8c81', class: "date-part" }, index.h("udp-date-input", { key: 'bd17f312dc9ac771d568885069710c1f00d61218', name: `${this.name}-date`, value: this.datePart, required: this.required, disabled: this.disabled, autofocus: this.autofocus, appearance: this.appearance, controlSize: this.controlSize, dateFormat: (_a = this.dateFormat) !== null && _a !== void 0 ? _a : this.format, minDate: this.minDate, maxDate: this.maxDate, isDateDisallowed: this.isDateDisallowed, getDayParts: this.getDayParts, error: this.error, includeErrorPadding: this.includeErrorPadding, onValueChanged: this.handleDateChange, label: this.label, popupHint: this.popupHint })), index.h("div", { key: '00f0dd5f7187a4669cdeea3054de5c29a36a7344', class: "time-part" }, index.h("udp-time-input", { key: 'e2d1918ac10b67620e6f6724fffd5ca8e80123e2', name: `${this.name}-time`, value: this.timePart, required: false, disabled: this.disabled, appearance: this.appearance, controlSize: this.controlSize, label: effectiveTimeLabel, minuteStep: this.minuteStep, use24Hour: this.use24Hour, onValueChanged: this.handleTimeChange, includeErrorPadding: this.includeErrorPadding, error: this.error ? ' ' : undefined }))));
5022
5052
  }
5023
5053
  static get watchers() { return {
5024
5054
  "value": [{