@aurodesignsystem/auro-formkit 5.1.0-rc-1115.1 → 5.1.0-rc-1134.1

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.
@@ -28023,6 +28023,7 @@ class AuroDatePicker extends AuroElement$1 {
28023
28023
 
28024
28024
  this.touched = false;
28025
28025
  this.disabled = false;
28026
+ this.dvInputOnly = false;
28026
28027
  this.required = false;
28027
28028
  this.onDark = false;
28028
28029
  this.range = false;
@@ -28065,6 +28066,26 @@ class AuroDatePicker extends AuroElement$1 {
28065
28066
  */
28066
28067
  this.dateSlotContent = [];
28067
28068
 
28069
+ /**
28070
+ * @private
28071
+ */
28072
+ this.hasDisplayValueContent = true;
28073
+
28074
+ /**
28075
+ * @private
28076
+ */
28077
+ this.hasFocus = false;
28078
+
28079
+ /**
28080
+ * @private
28081
+ */
28082
+ this.hasValue = false;
28083
+
28084
+ /**
28085
+ * @private
28086
+ */
28087
+ this.hasAllValues = false;
28088
+
28068
28089
  /**
28069
28090
  * @private
28070
28091
  */
@@ -28183,6 +28204,14 @@ class AuroDatePicker extends AuroElement$1 {
28183
28204
  reflect: true
28184
28205
  },
28185
28206
 
28207
+ /**
28208
+ * If defined, the display value slot content will only mask the HTML5 input element. The input's label will not be masked.
28209
+ */
28210
+ dvInputOnly: {
28211
+ type: Boolean,
28212
+ reflect: true
28213
+ },
28214
+
28186
28215
  /**
28187
28216
  * When defined, sets persistent validity to `customError` and sets the validation message to the attribute value.
28188
28217
  */
@@ -28204,6 +28233,14 @@ class AuroDatePicker extends AuroElement$1 {
28204
28233
  reflect: false,
28205
28234
  },
28206
28235
 
28236
+ /**
28237
+ * @private
28238
+ */
28239
+ hasAllValues: {
28240
+ type: Boolean,
28241
+ reflect: false
28242
+ },
28243
+
28207
28244
  /**
28208
28245
  * Specifies the date format. The default is `mm/dd/yyyy`.
28209
28246
  */
@@ -28493,6 +28530,88 @@ class AuroDatePicker extends AuroElement$1 {
28493
28530
  return [];
28494
28531
  }
28495
28532
 
28533
+ /**
28534
+ * Whether the label is being hidden currently based on state.
28535
+ * @returns {boolean} - Returns true if the label is hidden.
28536
+ * @private
28537
+ */
28538
+ get labelHidden() {
28539
+ return this.hasDisplayValueContent && this.dvInputOnly && !this.hasFocus && this.hasAllValues;
28540
+ }
28541
+
28542
+ /**
28543
+ * Whether the displayValue container is being hidden currently based on state.
28544
+ * @returns {boolean} - Returns true if the label is hidden.
28545
+ * @private
28546
+ */
28547
+ get dvHidden() {
28548
+ return !this.hasDisplayValueContent || this.hasFocus || !this.hasAllValues;
28549
+ }
28550
+
28551
+ /**
28552
+ * Returns the input font class based on layout and visibility state.
28553
+ * @private
28554
+ * @returns {string} - The font class for the input.
28555
+ */
28556
+ get displayValueFontClass() {
28557
+ if (this.layout.startsWith('emphasized')) {
28558
+ let typeSize = 'accent-xl';
28559
+
28560
+ if (this.hasDisplayValueContent) {
28561
+ if (!this.hasValue) {
28562
+ typeSize = 'body-sm';
28563
+ }
28564
+ } else if (this.noFocusOrValue) {
28565
+ typeSize = 'body-sm';
28566
+ }
28567
+
28568
+ return typeSize;
28569
+ }
28570
+
28571
+ if (this.layout === 'snowflake') {
28572
+ // same for both hidden and visible
28573
+ return 'body-lg';
28574
+ }
28575
+
28576
+ // edge case for enabling visual overrides in datepicker
28577
+ if (this.layout === 'classic' && this.shape === 'snowflake') {
28578
+ return 'body-lg';
28579
+ }
28580
+
28581
+ // classic layout (default) - same for both hidden and visible
28582
+ return 'body-default';
28583
+ }
28584
+
28585
+ get commonDisplayValueWrapperClasses() {
28586
+ return {
28587
+ 'displayValueWrapper': true,
28588
+ 'util_displayHiddenVisually': this.dvHidden,
28589
+ [this.displayValueFontClass]: true,
28590
+ };
28591
+ }
28592
+
28593
+ /**
28594
+ * Function to determine if there is any displayValue content to render.
28595
+ * @private
28596
+ * @returns {void}
28597
+ */
28598
+ checkDisplayValueSlotChange() {
28599
+ let nodes = this.shadowRoot.querySelector('slot[name="displayValue"]').assignedNodes();
28600
+
28601
+ // Handle when DisplayValue is multi-level slot content (e.g. combobox passing displayValue to input)
28602
+ if (nodes && nodes[0] && nodes[0].tagName === 'SLOT') {
28603
+ nodes = nodes[0].assignedNodes();
28604
+ }
28605
+
28606
+ let hasContent = false;
28607
+
28608
+ if (nodes.length > 0) {
28609
+ hasContent = true;
28610
+ }
28611
+
28612
+ this.hasDisplayValueContent = hasContent;
28613
+ }
28614
+
28496
28615
  /**
28497
28616
  * Force the calendar view to the focus date when it changes.
28498
28617
  * @private
@@ -28923,11 +29042,13 @@ class AuroDatePicker extends AuroElement$1 {
28923
29042
  setHasValue() {
28924
29043
  if (!this.range) {
28925
29044
  this.hasValue = this.value && this.value.length > 0;
29045
+ this.hasAllValues = this.hasValue;
28926
29046
  return;
28927
29047
  }
28928
29048
 
28929
29049
  // eslint-disable-next-line no-extra-parens
28930
29050
  this.hasValue = (this.value && this.value.length > 0) || (this.valueEnd && this.valueEnd.length > 0);
29051
+ this.hasAllValues = (this.value && this.value.length > 0) && (this.valueEnd && this.valueEnd.length > 0); // eslint-disable-line no-extra-parens
28931
29052
  }
28932
29053
 
28933
29054
  get hasError() {
@@ -29233,21 +29354,23 @@ class AuroDatePicker extends AuroElement$1 {
29233
29354
  */
29234
29355
  renderSnowflakeLayout() {
29235
29356
  const accentsClassMap = {
29236
- error: this.hasError
29357
+ 'error': this.hasError
29237
29358
  };
29238
29359
 
29239
29360
  const inputSectionClassMap = {
29240
- inputSection: true,
29361
+ 'inputSection': true,
29241
29362
 
29242
- hasValue: this.hasValue,
29243
- hasFocus: this.hasFocus,
29363
+ 'hasValue': this.hasValue,
29364
+ 'hasFocus': this.hasFocus,
29365
+ 'util_displayHiddenVisually': !this.dvHidden
29244
29366
  };
29245
29367
 
29246
29368
  const labelClassMap = {
29247
- mainLabel: true,
29369
+ 'mainLabel': true,
29248
29370
 
29249
- hasValue: this.hasValue,
29250
- hasFocus: this.hasFocus,
29371
+ 'hasValue': this.hasValue,
29372
+ 'hasFocus': this.hasFocus,
29373
+ 'util_displayHiddenVisually': this.labelHidden,
29251
29374
  [this.hasFocus || this.hasValue ? 'body-xs' : 'body-lg']: true,
29252
29375
  };
29253
29376
 
@@ -29265,6 +29388,13 @@ class AuroDatePicker extends AuroElement$1 {
29265
29388
  <div class="${e$3(inputSectionClassMap)}" part="inputSection">
29266
29389
  ${this.renderHtmlInputs()}
29267
29390
  </div>
29391
+ <div class="${e$3(this.commonDisplayValueWrapperClasses)}">
29392
+ <slot name="displayValue" @slotchange=${this.checkDisplayValueSlotChange}>
29393
+ <span>
29394
+ ${this.formatShortDate(this.value)}${this.range ? u$3`–${this.formatShortDate(this.valueEnd)}` : undefined}
29395
+ </span>
29396
+ </slot>
29397
+ </div>
29268
29398
  </div>
29269
29399
  <div class="accents right ${e$3(accentsClassMap)}">
29270
29400
  ${this.hasError
@@ -64,6 +64,13 @@ export class AuroDatePicker extends AuroElement {
64
64
  type: BooleanConstructor;
65
65
  reflect: boolean;
66
66
  };
67
+ /**
68
+ * If defined, the display value slot content will only mask the HTML5 input element. The input's label will not be masked.
69
+ */
70
+ dvInputOnly: {
71
+ type: BooleanConstructor;
72
+ reflect: boolean;
73
+ };
67
74
  /**
68
75
  * When defined, sets persistent validity to `customError` and sets the validation message to the attribute value.
69
76
  */
@@ -82,6 +89,13 @@ export class AuroDatePicker extends AuroElement {
82
89
  type: BooleanConstructor;
83
90
  reflect: boolean;
84
91
  };
92
+ /**
93
+ * @private
94
+ */
95
+ hasAllValues: {
96
+ type: BooleanConstructor;
97
+ reflect: boolean;
98
+ };
85
99
  /**
86
100
  * Specifies the date format. The default is `mm/dd/yyyy`.
87
101
  */
@@ -308,6 +322,7 @@ export class AuroDatePicker extends AuroElement {
308
322
  formattedStartDate: boolean;
309
323
  touched: boolean;
310
324
  disabled: boolean;
325
+ dvInputOnly: boolean;
311
326
  required: boolean;
312
327
  onDark: boolean;
313
328
  range: boolean;
@@ -332,6 +347,22 @@ export class AuroDatePicker extends AuroElement {
332
347
  * @private
333
348
  */
334
349
  private dateSlotContent;
350
+ /**
351
+ * @private
352
+ */
353
+ private hasDisplayValueContent;
354
+ /**
355
+ * @private
356
+ */
357
+ private hasFocus;
358
+ /**
359
+ * @private
360
+ */
361
+ private hasValue;
362
+ /**
363
+ * @private
364
+ */
365
+ private hasAllValues;
335
366
  /**
336
367
  * @private
337
368
  */
@@ -379,6 +410,35 @@ export class AuroDatePicker extends AuroElement {
379
410
  * @returns {string[]}
380
411
  */
381
412
  get values(): string[];
413
+ /**
414
+ * Whether the label is being hidden currently based on state.
415
+ * @returns {boolean} - Returns true if the label is hidden.
416
+ * @private
417
+ */
418
+ private get labelHidden();
419
+ /**
420
+ * Whether the displayValue container is being hidden currently based on state.
421
+ * @returns {boolean} - Returns true if the label is hidden.
422
+ * @private
423
+ */
424
+ private get dvHidden();
425
+ /**
426
+ * Returns the input font class based on layout and visibility state.
427
+ * @private
428
+ * @returns {string} - The font class for the input.
429
+ */
430
+ private get displayValueFontClass();
431
+ get commonDisplayValueWrapperClasses(): {
432
+ [x: string]: boolean;
433
+ displayValueWrapper: boolean;
434
+ util_displayHiddenVisually: boolean;
435
+ };
436
+ /**
437
+ * Function to determine if there is any displayValue content to render.
438
+ * @private
439
+ * @returns {void}
440
+ */
441
+ private checkDisplayValueSlotChange;
382
442
  /**
383
443
  * Force the calendar view to the focus date when it changes.
384
444
  * @private
@@ -397,7 +457,6 @@ export class AuroDatePicker extends AuroElement {
397
457
  * @returns {void}
398
458
  */
399
459
  focus(focusInput?: string): void;
400
- hasFocus: boolean;
401
460
  /**
402
461
  * Converts valid time number to format used by wc-date-range API.
403
462
  * @private
@@ -533,7 +592,6 @@ export class AuroDatePicker extends AuroElement {
533
592
  * @private
534
593
  */
535
594
  private setHasValue;
536
- hasValue: boolean;
537
595
  get hasError(): boolean;
538
596
  updated(changedProperties: any): void;
539
597
  monthFirst: boolean;
@@ -27948,6 +27948,7 @@ class AuroDatePicker extends AuroElement$1 {
27948
27948
 
27949
27949
  this.touched = false;
27950
27950
  this.disabled = false;
27951
+ this.dvInputOnly = false;
27951
27952
  this.required = false;
27952
27953
  this.onDark = false;
27953
27954
  this.range = false;
@@ -27990,6 +27991,26 @@ class AuroDatePicker extends AuroElement$1 {
27990
27991
  */
27991
27992
  this.dateSlotContent = [];
27992
27993
 
27994
+ /**
27995
+ * @private
27996
+ */
27997
+ this.hasDisplayValueContent = true;
27998
+
27999
+ /**
28000
+ * @private
28001
+ */
28002
+ this.hasFocus = false;
28003
+
28004
+ /**
28005
+ * @private
28006
+ */
28007
+ this.hasValue = false;
28008
+
28009
+ /**
28010
+ * @private
28011
+ */
28012
+ this.hasAllValues = false;
28013
+
27993
28014
  /**
27994
28015
  * @private
27995
28016
  */
@@ -28108,6 +28129,14 @@ class AuroDatePicker extends AuroElement$1 {
28108
28129
  reflect: true
28109
28130
  },
28110
28131
 
28132
+ /**
28133
+ * If defined, the display value slot content will only mask the HTML5 input element. The input's label will not be masked.
28134
+ */
28135
+ dvInputOnly: {
28136
+ type: Boolean,
28137
+ reflect: true
28138
+ },
28139
+
28111
28140
  /**
28112
28141
  * When defined, sets persistent validity to `customError` and sets the validation message to the attribute value.
28113
28142
  */
@@ -28129,6 +28158,14 @@ class AuroDatePicker extends AuroElement$1 {
28129
28158
  reflect: false,
28130
28159
  },
28131
28160
 
28161
+ /**
28162
+ * @private
28163
+ */
28164
+ hasAllValues: {
28165
+ type: Boolean,
28166
+ reflect: false
28167
+ },
28168
+
28132
28169
  /**
28133
28170
  * Specifies the date format. The default is `mm/dd/yyyy`.
28134
28171
  */
@@ -28418,6 +28455,88 @@ class AuroDatePicker extends AuroElement$1 {
28418
28455
  return [];
28419
28456
  }
28420
28457
 
28458
+ /**
28459
+ * Whether the label is being hidden currently based on state.
28460
+ * @returns {boolean} - Returns true if the label is hidden.
28461
+ * @private
28462
+ */
28463
+ get labelHidden() {
28464
+ return this.hasDisplayValueContent && this.dvInputOnly && !this.hasFocus && this.hasAllValues;
28465
+ }
28466
+
28467
+ /**
28468
+ * Whether the displayValue container is being hidden currently based on state.
28469
+ * @returns {boolean} - Returns true if the label is hidden.
28470
+ * @private
28471
+ */
28472
+ get dvHidden() {
28473
+ return !this.hasDisplayValueContent || this.hasFocus || !this.hasAllValues;
28474
+ }
28475
+
28476
+ /**
28477
+ * Returns the input font class based on layout and visibility state.
28478
+ * @private
28479
+ * @returns {string} - The font class for the input.
28480
+ */
28481
+ get displayValueFontClass() {
28482
+ if (this.layout.startsWith('emphasized')) {
28483
+ let typeSize = 'accent-xl';
28484
+
28485
+ if (this.hasDisplayValueContent) {
28486
+ if (!this.hasValue) {
28487
+ typeSize = 'body-sm';
28488
+ }
28489
+ } else if (this.noFocusOrValue) {
28490
+ typeSize = 'body-sm';
28491
+ }
28492
+
28493
+ return typeSize;
28494
+ }
28495
+
28496
+ if (this.layout === 'snowflake') {
28497
+ // same for both hidden and visible
28498
+ return 'body-lg';
28499
+ }
28500
+
28501
+ // edge case for enabling visual overrides in datepicker
28502
+ if (this.layout === 'classic' && this.shape === 'snowflake') {
28503
+ return 'body-lg';
28504
+ }
28505
+
28506
+ // classic layout (default) - same for both hidden and visible
28507
+ return 'body-default';
28508
+ }
28509
+
28510
+ get commonDisplayValueWrapperClasses() {
28511
+ return {
28512
+ 'displayValueWrapper': true,
28513
+ 'util_displayHiddenVisually': this.dvHidden,
28514
+ [this.displayValueFontClass]: true,
28515
+ };
28516
+ }
28517
+
28518
+ /**
28519
+ * Function to determine if there is any displayValue content to render.
28520
+ * @private
28521
+ * @returns {void}
28522
+ */
28523
+ checkDisplayValueSlotChange() {
28524
+ let nodes = this.shadowRoot.querySelector('slot[name="displayValue"]').assignedNodes();
28525
+
28526
+ // Handle when DisplayValue is multi-level slot content (e.g. combobox passing displayValue to input)
28527
+ if (nodes && nodes[0] && nodes[0].tagName === 'SLOT') {
28528
+ nodes = nodes[0].assignedNodes();
28529
+ }
28530
+
28531
+ let hasContent = false;
28532
+
28533
+ if (nodes.length > 0) {
28534
+ hasContent = true;
28535
+ }
28536
+
28537
+ this.hasDisplayValueContent = hasContent;
28538
+ }
28539
+
28421
28540
  /**
28422
28541
  * Force the calendar view to the focus date when it changes.
28423
28542
  * @private
@@ -28848,11 +28967,13 @@ class AuroDatePicker extends AuroElement$1 {
28848
28967
  setHasValue() {
28849
28968
  if (!this.range) {
28850
28969
  this.hasValue = this.value && this.value.length > 0;
28970
+ this.hasAllValues = this.hasValue;
28851
28971
  return;
28852
28972
  }
28853
28973
 
28854
28974
  // eslint-disable-next-line no-extra-parens
28855
28975
  this.hasValue = (this.value && this.value.length > 0) || (this.valueEnd && this.valueEnd.length > 0);
28976
+ this.hasAllValues = (this.value && this.value.length > 0) && (this.valueEnd && this.valueEnd.length > 0); // eslint-disable-line no-extra-parens
28856
28977
  }
28857
28978
 
28858
28979
  get hasError() {
@@ -29158,21 +29279,23 @@ class AuroDatePicker extends AuroElement$1 {
29158
29279
  */
29159
29280
  renderSnowflakeLayout() {
29160
29281
  const accentsClassMap = {
29161
- error: this.hasError
29282
+ 'error': this.hasError
29162
29283
  };
29163
29284
 
29164
29285
  const inputSectionClassMap = {
29165
- inputSection: true,
29286
+ 'inputSection': true,
29166
29287
 
29167
- hasValue: this.hasValue,
29168
- hasFocus: this.hasFocus,
29288
+ 'hasValue': this.hasValue,
29289
+ 'hasFocus': this.hasFocus,
29290
+ 'util_displayHiddenVisually': !this.dvHidden
29169
29291
  };
29170
29292
 
29171
29293
  const labelClassMap = {
29172
- mainLabel: true,
29294
+ 'mainLabel': true,
29173
29295
 
29174
- hasValue: this.hasValue,
29175
- hasFocus: this.hasFocus,
29296
+ 'hasValue': this.hasValue,
29297
+ 'hasFocus': this.hasFocus,
29298
+ 'util_displayHiddenVisually': this.labelHidden,
29176
29299
  [this.hasFocus || this.hasValue ? 'body-xs' : 'body-lg']: true,
29177
29300
  };
29178
29301
 
@@ -29190,6 +29313,13 @@ class AuroDatePicker extends AuroElement$1 {
29190
29313
  <div class="${classMap(inputSectionClassMap)}" part="inputSection">
29191
29314
  ${this.renderHtmlInputs()}
29192
29315
  </div>
29316
+ <div class="${classMap(this.commonDisplayValueWrapperClasses)}">
29317
+ <slot name="displayValue" @slotchange=${this.checkDisplayValueSlotChange}>
29318
+ <span>
29319
+ ${this.formatShortDate(this.value)}${this.range ? html$1`–${this.formatShortDate(this.valueEnd)}` : undefined}
29320
+ </span>
29321
+ </slot>
29322
+ </div>
29193
29323
  </div>
29194
29324
  <div class="accents right ${classMap(accentsClassMap)}">
29195
29325
  ${this.hasError