@@ -40,15 +40,17 @@ import {
40
40
import { formatTimeString , isValidTime , localizeTimeString } from "../../utils/time" ;
41
41
import { Scale } from "../interfaces" ;
42
42
import { TimePickerMessages } from "../time-picker/assets/time-picker/t9n" ;
43
+ import { connectMessages , disconnectMessages , setUpMessages , T9nComponent } from "../../utils/t9n" ;
44
+ import { InputTimePickerMessages } from "./assets/input-time-picker/t9n" ;
43
45
import { CSS } from "./resources" ;
44
- import { toAriaBoolean } from "../../utils/dom" ;
45
46
46
47
@Component ( {
47
48
tag : "calcite-input-time-picker" ,
48
49
styleUrl : "input-time-picker.scss" ,
49
50
shadow : {
50
51
delegatesFocus : true
51
- }
52
+ } ,
53
+ assetsDirs : [ "assets" ]
52
54
} )
53
55
export class InputTimePicker
54
56
implements
@@ -57,7 +59,8 @@ export class InputTimePicker
57
59
InteractiveComponent ,
58
60
FloatingUIComponent ,
59
61
LocalizedComponent ,
60
- LoadableComponent
62
+ LoadableComponent ,
63
+ T9nComponent
61
64
{
62
65
//--------------------------------------------------------------------------
63
66
//
@@ -118,7 +121,21 @@ export class InputTimePicker
118
121
/**
119
122
* Use this property to override individual strings used by the component.
120
123
*/
121
- @Prop ( ) messagesOverrides : Partial < TimePickerMessages > ;
124
+ // eslint-disable-next-line @stencil-community/strict-mutable -- updated by t9n module
125
+ @Prop ( { mutable : true } ) messageOverrides : Partial < InputTimePickerMessages & TimePickerMessages > ;
126
+
127
+ /**
128
+ * Made into a prop for testing purposes only
129
+ *
130
+ * @internal
131
+ */
132
+ // eslint-disable-next-line @stencil-community/strict-mutable -- updated by t9n module
133
+ @Prop ( { mutable : true } ) messages : InputTimePickerMessages ;
134
+
135
+ @Watch ( "messageOverrides" )
136
+ onMessagesChange ( ) : void {
137
+ /* wired up by t9n util */
138
+ }
122
139
123
140
/** Specifies the name of the component on form submission. */
124
141
@Prop ( ) name : string ;
@@ -200,6 +217,8 @@ export class InputTimePicker
200
217
//
201
218
//--------------------------------------------------------------------------
202
219
220
+ @State ( ) defaultMessages : InputTimePickerMessages ;
221
+
203
222
@State ( ) effectiveLocale = "" ;
204
223
205
224
@Watch ( "effectiveLocale" )
@@ -480,10 +499,12 @@ export class InputTimePicker
480
499
481
500
connectLabel ( this ) ;
482
501
connectForm ( this ) ;
502
+ connectMessages ( this ) ;
483
503
}
484
504
485
- componentWillLoad ( ) : void {
505
+ async componentWillLoad ( ) : Promise < void > {
486
506
setUpLoadableComponent ( this ) ;
507
+ await setUpMessages ( this ) ;
487
508
}
488
509
489
510
componentDidLoad ( ) {
@@ -495,6 +516,7 @@ export class InputTimePicker
495
516
disconnectLabel ( this ) ;
496
517
disconnectForm ( this ) ;
497
518
disconnectLocalized ( this ) ;
519
+ disconnectMessages ( this ) ;
498
520
}
499
521
500
522
componentDidRender ( ) : void {
@@ -508,57 +530,45 @@ export class InputTimePicker
508
530
// --------------------------------------------------------------------------
509
531
510
532
render ( ) : VNode {
511
- const { dialogId } = this ;
533
+ const { disabled , messages , readOnly , dialogId } = this ;
512
534
return (
513
535
< Host onBlur = { this . deactivate } onKeyDown = { this . keyDownHandler } >
514
- < div
515
- aria-controls = { dialogId }
516
- aria-haspopup = "dialog"
517
- aria-label = { this . name }
518
- aria-owns = { dialogId }
519
- id = { this . referenceElementId }
520
- role = "combobox"
521
- >
522
- < div class = "input-wrapper" onClick = { this . onInputWrapperClick } >
523
- < calcite-input
524
- aria-autocomplete = "none"
525
- aria-controls = { this . dialogId }
526
- aria-expanded = { toAriaBoolean ( this . open ) }
527
- aria-haspopup = "dialog"
528
- disabled = { this . disabled }
529
- icon = "clock"
530
- label = { getLabelText ( this ) }
531
- onCalciteInputInput = { this . calciteInputInputHandler }
532
- onCalciteInternalInputBlur = { this . calciteInternalInputBlurHandler }
533
- onCalciteInternalInputFocus = { this . calciteInternalInputFocusHandler }
534
- onFocus = { this . inputFocus }
535
- readOnly = { this . readOnly }
536
- role = "combobox"
537
- scale = { this . scale }
538
- step = { this . step }
539
- // eslint-disable-next-line react/jsx-sort-props
540
- ref = { this . setCalciteInputEl }
541
- />
542
- { this . renderToggleIcon ( this . open ) }
543
- </ div >
536
+ < div class = "input-wrapper" onClick = { this . onInputWrapperClick } >
537
+ < calcite-input
538
+ aria-autocomplete = "none"
539
+ aria-haspopup = "dialog"
540
+ disabled = { disabled }
541
+ icon = "clock"
542
+ id = { this . referenceElementId }
543
+ label = { getLabelText ( this ) }
544
+ onCalciteInputInput = { this . calciteInputInputHandler }
545
+ onCalciteInternalInputBlur = { this . calciteInternalInputBlurHandler }
546
+ onCalciteInternalInputFocus = { this . calciteInternalInputFocusHandler }
547
+ onFocus = { this . inputFocus }
548
+ readOnly = { readOnly }
549
+ role = "combobox"
550
+ scale = { this . scale }
551
+ step = { this . step }
552
+ // eslint-disable-next-line react/jsx-sort-props
553
+ ref = { this . setCalciteInputEl }
554
+ />
555
+ { this . renderToggleIcon ( this . open ) }
544
556
</ div >
545
557
< calcite-popover
546
- aria-live = "polite"
547
558
focusTrapDisabled = { true }
548
559
id = { dialogId }
549
- label = "Time Picker"
560
+ label = { messages . chooseTime }
550
561
open = { this . open }
551
562
overlayPositioning = { this . overlayPositioning }
552
563
placement = { this . placement }
553
564
referenceElement = { this . referenceElementId }
554
- role = "dialog"
555
565
triggerDisabled = { true }
556
566
// eslint-disable-next-line react/jsx-sort-props
557
567
ref = { this . setCalcitePopoverEl }
558
568
>
559
569
< calcite-time-picker
560
570
lang = { this . effectiveLocale }
561
- messageOverrides = { this . messagesOverrides }
571
+ messageOverrides = { this . messageOverrides }
562
572
numberingSystem = { this . numberingSystem }
563
573
onCalciteInternalTimePickerChange = { this . timePickerChangeHandler }
564
574
scale = { this . scale }
0 commit comments