@nectary/components 0.38.0 → 0.40.0

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.
Files changed (148) hide show
  1. package/accordion/index.js +47 -84
  2. package/accordion/types.d.ts +1 -0
  3. package/accordion-item/index.js +26 -53
  4. package/action-menu/index.d.ts +0 -1
  5. package/action-menu/index.js +179 -223
  6. package/action-menu/types.d.ts +8 -18
  7. package/action-menu-option/index.d.ts +1 -0
  8. package/action-menu-option/index.js +51 -62
  9. package/action-menu-option/types.d.ts +9 -0
  10. package/action-menu-option/utils.d.ts +2 -0
  11. package/action-menu-option/utils.js +3 -0
  12. package/alert/index.js +6 -20
  13. package/avatar/index.js +12 -31
  14. package/avatar-badge/index.js +8 -22
  15. package/avatar-status/index.js +1 -1
  16. package/button/index.js +42 -92
  17. package/card/index.d.ts +2 -0
  18. package/card/index.js +24 -87
  19. package/chat-avatar/index.js +8 -22
  20. package/chat-block/index.js +29 -69
  21. package/chat-bubble/index.js +6 -20
  22. package/checkbox/index.js +55 -107
  23. package/chip/index.d.ts +13 -0
  24. package/chip/index.js +137 -0
  25. package/chip/types.d.ts +38 -0
  26. package/color-menu/index.d.ts +13 -0
  27. package/color-menu/index.js +464 -0
  28. package/color-menu/types.d.ts +37 -0
  29. package/color-swatch/index.d.ts +13 -0
  30. package/color-swatch/index.js +59 -0
  31. package/color-swatch/types.d.ts +12 -0
  32. package/colors.json +57 -49
  33. package/date-picker/index.js +196 -287
  34. package/date-picker/types.d.ts +25 -1
  35. package/dialog/index.d.ts +1 -0
  36. package/dialog/index.js +72 -143
  37. package/dropdown-checkbox-option/index.js +6 -20
  38. package/dropdown-radio-option/index.js +6 -20
  39. package/field/index.js +25 -63
  40. package/file-drop/index.js +123 -200
  41. package/file-picker/index.d.ts +0 -1
  42. package/file-picker/index.js +55 -108
  43. package/file-status/index.js +15 -39
  44. package/help-tooltip/index.js +1 -1
  45. package/horizontal-stepper/index.js +33 -59
  46. package/horizontal-stepper-item/index.js +13 -37
  47. package/icon-button/index.js +39 -84
  48. package/icons-channel/notify/index.d.ts +11 -0
  49. package/icons-channel/notify/index.js +4 -0
  50. package/illustrations/create-illustration-class.js +1 -1
  51. package/inline-alert/index.js +30 -82
  52. package/input/index.js +113 -222
  53. package/link/index.js +46 -96
  54. package/list-item/index.js +1 -1
  55. package/package.json +12 -14
  56. package/pagination/index.js +109 -163
  57. package/pagination/types.d.ts +1 -0
  58. package/popover/index.js +224 -294
  59. package/progress/index.js +9 -28
  60. package/radio/index.js +103 -169
  61. package/radio/types.d.ts +1 -0
  62. package/radio-option/index.js +24 -48
  63. package/segment/index.js +50 -131
  64. package/segment-collapse/index.js +24 -49
  65. package/segment-collapse/types.d.ts +1 -0
  66. package/segmented-control/index.js +36 -73
  67. package/segmented-control/types.d.ts +1 -0
  68. package/segmented-control-option/index.js +41 -87
  69. package/segmented-icon-control/index.js +47 -84
  70. package/segmented-icon-control/types.d.ts +1 -0
  71. package/segmented-icon-control-option/index.js +38 -79
  72. package/select-button/index.d.ts +13 -0
  73. package/select-button/index.js +153 -0
  74. package/select-button/types.d.ts +43 -0
  75. package/select-menu/index.d.ts +11 -0
  76. package/select-menu/index.js +346 -0
  77. package/select-menu/types.d.ts +29 -0
  78. package/{dropdown-text-option → select-menu-option}/index.d.ts +5 -7
  79. package/select-menu-option/index.js +76 -0
  80. package/{select-option → select-menu-option}/types.d.ts +8 -9
  81. package/stop-events/index.js +7 -20
  82. package/table-head-cell/index.js +7 -21
  83. package/tabs/index.js +103 -165
  84. package/tabs/types.d.ts +1 -0
  85. package/tabs-option/index.js +20 -44
  86. package/tag/index.d.ts +1 -1
  87. package/tag/index.js +42 -36
  88. package/tag/types.d.ts +13 -7
  89. package/textarea/index.js +92 -167
  90. package/theme.css +80 -49
  91. package/tile-control/index.js +55 -96
  92. package/tile-control-option/index.js +40 -86
  93. package/time-picker/index.js +224 -368
  94. package/time-picker/types.d.ts +5 -1
  95. package/title/index.js +6 -20
  96. package/toast/index.d.ts +17 -0
  97. package/toast/index.js +115 -0
  98. package/toast/types.d.ts +28 -0
  99. package/toast/utils.d.ts +5 -0
  100. package/toast/utils.js +6 -0
  101. package/toast-manager/index.d.ts +17 -0
  102. package/toast-manager/index.js +195 -0
  103. package/toast-manager/types.d.ts +7 -0
  104. package/toggle/index.js +55 -108
  105. package/toggle/types.d.ts +1 -0
  106. package/types.d.ts +7 -0
  107. package/utils/colors.d.ts +10 -0
  108. package/utils/colors.js +121 -0
  109. package/{utils.d.ts → utils/index.d.ts} +18 -9
  110. package/{utils.js → utils/index.js} +118 -39
  111. package/vertical-stepper/index.js +29 -50
  112. package/vertical-stepper-item/index.js +13 -37
  113. package/card-button/index.d.ts +0 -11
  114. package/card-button/index.js +0 -77
  115. package/card-button/types.d.ts +0 -12
  116. package/card-link/index.d.ts +0 -12
  117. package/card-link/index.js +0 -115
  118. package/card-link/types.d.ts +0 -14
  119. package/dropdown/index.d.ts +0 -12
  120. package/dropdown/index.js +0 -415
  121. package/dropdown/types.d.ts +0 -30
  122. package/dropdown-text-option/index.js +0 -104
  123. package/dropdown-text-option/types.d.ts +0 -16
  124. package/search/index.d.ts +0 -14
  125. package/search/index.js +0 -523
  126. package/search/types.d.ts +0 -25
  127. package/search-option/index.d.ts +0 -11
  128. package/search-option/index.js +0 -55
  129. package/search-option/types.d.ts +0 -9
  130. package/select/index.d.ts +0 -13
  131. package/select/index.js +0 -316
  132. package/select/types.d.ts +0 -53
  133. package/select-option/index.d.ts +0 -11
  134. package/select-option/index.js +0 -8
  135. package/tag/utils.d.ts +0 -2
  136. package/tag/utils.js +0 -1
  137. package/tag-close/index.d.ts +0 -12
  138. package/tag-close/index.js +0 -38
  139. package/tag-close/types.d.ts +0 -3
  140. package/tag-close/types.js +0 -1
  141. /package/{card-button → chip}/types.js +0 -0
  142. /package/{card-link → color-menu}/types.js +0 -0
  143. /package/{dropdown-text-option → color-swatch}/types.js +0 -0
  144. /package/{dropdown → select-button}/types.js +0 -0
  145. /package/{search → select-menu}/types.js +0 -0
  146. /package/{search-option → select-menu-option}/types.js +0 -0
  147. /package/{select → toast}/types.js +0 -0
  148. /package/{select-option → toast-manager}/types.js +0 -0
@@ -1,16 +1,3 @@
1
- import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet';
2
- import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet';
3
-
4
- var _$pickerHours, _$pickerMinutes, _$pickerTouch, _$needleHour, _$needleMinute, _$headerHours, _$headerHoursText, _$headerMinutes, _$headerMinutesText, _$ampm, _$submitButton, _hour, _minute, _getClickDegree, _onPickerClick, _render, _selectHour, _selectMinute, _onAmPmChange, _onSubmitButtonClick, _onHoursKeydown, _onMinutesKeydown, _onChangeReactHandler;
5
-
6
- function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
7
-
8
- function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
9
-
10
- function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
11
-
12
- function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
13
-
14
1
  import '../icon-button';
15
2
  import '../icons/done';
16
3
  import '../icons/arrow-drop-up';
@@ -18,7 +5,7 @@ import '../icons/arrow-drop-down';
18
5
  import '../segmented-control';
19
6
  import '../segmented-control-option';
20
7
  import { defineCustomElement, getAttribute, getBooleanAttribute, getReactEventHandler, getRect, isAttrTrue, NectaryElement, setClass, updateAttribute, updateBooleanAttribute } from '../utils';
21
- const templateHTML = '<style>:host{display:block;outline:0}#wrapper{display:flex;flex-direction:column;width:248px;padding:16px;box-sizing:border-box;gap:16px}#header{position:relative;width:100%;height:48px;font:var(--sinch-font-title-xl);line-height:48px}#footer{display:flex;justify-content:center;width:100%;height:32px}#picker{position:relative;width:216px;height:216px;border-radius:50%;box-sizing:border-box;border:1px solid var(--sinch-color-stormy-500)}#picker-hours,#picker-minutes{position:absolute;left:0;top:0;width:100%;height:100%;border-radius:50%;pointer-events:none;user-select:none}.digit-hour-12,.digit-hour-24,.digit-minute{position:absolute;width:28px;height:28px;font:var(--sinch-font-text-s);line-height:28px;text-align:center;color:var(--sinch-color-text-default);top:calc(50% - 14px);left:calc(50% - 14px);z-index:1;cursor:pointer}.digit-hour-24{font:var(--sinch-font-text-xs);line-height:28px;color:var(--sinch-color-text-muted)}.digit-minute{font:var(--sinch-font-text-xs);line-height:28px;color:var(--sinch-color-text-muted)}.digit-hour-12:hover,.digit-hour-24:hover,.digit-minute:hover{color:var(--sinch-color-tropical-500)}.digit-hour-12.selected,.digit-hour-24.selected,.digit-minute.selected{color:var(--sinch-color-tropical-500)}.digit-hour-12.selected{font-size:16px}.digit-hour-24.selected{font-size:16px}.digit-minute.selected{font-size:16px}#picker-touch{position:absolute;left:0;top:0;width:100%;height:100%;cursor:pointer;border-radius:50%}#needle-hour,#needle-minute,#picker-touch::after{background-color:var(--sinch-color-stormy-500)}#needle-hour,#needle-minute{position:absolute;transform-origin:bottom center;transform:rotate(0);bottom:50%;height:50px;transition-duration:.25s;transition-timing-function:ease-in-out;transition-property:transform height;z-index:2}@media (prefers-reduced-motion){#needle-hour,#needle-minute{transition:none}}#needle-hour{width:4px;left:calc(50% - 2px);border-radius:2px}#needle-minute{width:2px;left:calc(50% - 1px);border-radius:1px}#needle-minute:not(.selected)::after{content:"";position:absolute;transform:translateX(-50%);left:0;top:-16px;width:4px;height:4px;border-radius:50%;background-color:var(--sinch-color-tropical-500)}#picker-touch::after{content:"";position:absolute;top:50%;left:50%;width:12px;height:12px;border-radius:50%;transform:translate(-50%,-50%)}#header-hours,#header-minutes{position:absolute;padding:0 4px;width:50px;outline:0;--sinch-icon-size:24px}#header-hours{right:calc(50% + 8px);text-align:right}#header-minutes{left:calc(50% + 8px)}#header-hours::before,#header-minutes::before{content:"";display:none;position:absolute;border-radius:12px;left:50%;top:50%;width:100%;height:100%;transform:translate(-50%,-50%);padding:1px;border:1px solid var(--sinch-color-aqua-400)}#header-hours-down,#header-hours-up,#header-minutes-down,#header-minutes-up{display:none;position:absolute;left:50%;transform:translateX(-50%)}#header-hours-up,#header-minutes-up{top:-18px}#header-hours-down,#header-minutes-down{bottom:-18px}#header-hours:focus #header-hours-down,#header-hours:focus #header-hours-up,#header-hours:focus::before{display:block}#header-minutes:focus #header-minutes-down,#header-minutes:focus #header-minutes-up,#header-minutes:focus::before{display:block}#header-colon{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}#submit{position:absolute;right:0;top:50%;transform:translateY(-50%)}:host([ampm]) .digit-hour-24{display:none}:host(:not([ampm])) #footer{display:none}</style><div id="wrapper"><div id="header"><div id="header-hours" tabindex="0" role="meter" aria-valuemin="0" aria-valuemax="23" aria-valuenow="0" aria-valuetext="0"><span>00</span><sinch-icon-arrow-drop-up id="header-hours-up"></sinch-icon-arrow-drop-up><sinch-icon-arrow-drop-down id="header-hours-down"></sinch-icon-arrow-drop-down></div><div id="header-colon">&colon;</div><div id="header-minutes" tabindex="0" role="meter" aria-valuemin="0" aria-valuemax="59" aria-valuenow="0" aria-valuetext="0"><span>00</span><sinch-icon-arrow-drop-up id="header-minutes-up"></sinch-icon-arrow-drop-up><sinch-icon-arrow-drop-down id="header-minutes-down"></sinch-icon-arrow-drop-down></div><sinch-icon-button id="submit" small aria-label="Submit"><sinch-icon-done slot="icon"></sinch-icon-done></sinch-icon-button></div><div id="picker" aria-hidden="true"><div id="picker-hours"></div><div id="picker-minutes"></div><div id="picker-touch"><div id="needle-hour"></div><div id="needle-minute"></div></div></div><div id="footer"><sinch-segmented-control id="ampm"><sinch-segmented-control-option value="am" text="AM" aria-label="AM"></sinch-segmented-control-option><sinch-segmented-control-option value="pm" text="PM" aria-label="PM"></sinch-segmented-control-option></sinch-segmented-control></div></div>';
8
+ const templateHTML = '<style>:host{display:block;outline:0}#wrapper{display:flex;flex-direction:column;width:248px;padding:16px;box-sizing:border-box;gap:16px}#header{position:relative;width:100%;height:48px;font:var(--sinch-font-title-xl);line-height:48px}#footer{display:flex;justify-content:center;width:100%;height:32px}#picker{position:relative;width:216px;height:216px;border-radius:50%;box-sizing:border-box;border:1px solid var(--sinch-color-stormy-500)}#picker-hours,#picker-minutes{position:absolute;left:0;top:0;width:100%;height:100%;border-radius:50%;pointer-events:none;user-select:none}.digit-hour-12,.digit-hour-24,.digit-minute{position:absolute;width:28px;height:28px;font:var(--sinch-font-text-s);line-height:28px;text-align:center;color:var(--sinch-color-text-default);top:calc(50% - 14px);left:calc(50% - 14px);z-index:1;cursor:pointer}.digit-hour-24{font:var(--sinch-font-text-xs);line-height:28px;color:var(--sinch-color-text-muted)}.digit-minute{font:var(--sinch-font-text-xs);line-height:28px;color:var(--sinch-color-text-muted)}.digit-hour-12:hover,.digit-hour-24:hover,.digit-minute:hover{color:var(--sinch-color-tropical-500)}.digit-hour-12.selected,.digit-hour-24.selected,.digit-minute.selected{color:var(--sinch-color-tropical-500)}.digit-hour-12.selected{font-size:16px}.digit-hour-24.selected{font-size:16px}.digit-minute.selected{font-size:16px}#picker-touch{position:absolute;left:0;top:0;width:100%;height:100%;cursor:pointer;border-radius:50%}#needle-hour,#needle-minute,#picker-touch::after{background-color:var(--sinch-color-stormy-500)}#needle-hour,#needle-minute{position:absolute;transform-origin:bottom center;transform:rotate(0);bottom:50%;height:50px;transition-duration:.25s;transition-timing-function:ease-in-out;transition-property:transform height;z-index:2}@media (prefers-reduced-motion){#needle-hour,#needle-minute{transition:none}}#needle-hour{width:4px;left:calc(50% - 2px);border-radius:2px}#needle-minute{width:2px;left:calc(50% - 1px);border-radius:1px}#needle-minute:not(.selected)::after{content:"";position:absolute;transform:translateX(-50%);left:0;top:-16px;width:4px;height:4px;border-radius:50%;background-color:var(--sinch-color-tropical-500)}#picker-touch::after{content:"";position:absolute;top:50%;left:50%;width:12px;height:12px;border-radius:50%;transform:translate(-50%,-50%)}#header-hours,#header-minutes{position:absolute;padding:0 4px;width:50px;outline:0;--sinch-size-icon:24px}#header-hours{right:calc(50% + 8px);text-align:right}#header-minutes{left:calc(50% + 8px)}#header-hours::before,#header-minutes::before{content:"";display:none;position:absolute;border-radius:12px;left:50%;top:50%;width:100%;height:100%;transform:translate(-50%,-50%);padding:1px;border:1px solid var(--sinch-color-aqua-400)}#header-hours-down,#header-hours-up,#header-minutes-down,#header-minutes-up{display:none;position:absolute;left:50%;transform:translateX(-50%)}#header-hours-up,#header-minutes-up{top:-18px}#header-hours-down,#header-minutes-down{bottom:-18px}#header-hours:focus #header-hours-down,#header-hours:focus #header-hours-up,#header-hours:focus::before{display:block}#header-minutes:focus #header-minutes-down,#header-minutes:focus #header-minutes-up,#header-minutes:focus::before{display:block}#header-colon{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%)}#submit{position:absolute;right:0;top:50%;transform:translateY(-50%)}:host([ampm]) .digit-hour-24{display:none}:host(:not([ampm])) #footer{display:none}</style><div id="wrapper"><div id="header"><div id="header-hours" tabindex="0" role="meter" aria-valuemin="0" aria-valuemax="23" aria-valuenow="0" aria-valuetext="0"><span>00</span><sinch-icon-arrow-drop-up id="header-hours-up"></sinch-icon-arrow-drop-up><sinch-icon-arrow-drop-down id="header-hours-down"></sinch-icon-arrow-drop-down></div><div id="header-colon">&colon;</div><div id="header-minutes" tabindex="0" role="meter" aria-valuemin="0" aria-valuemax="59" aria-valuenow="0" aria-valuetext="0"><span>00</span><sinch-icon-arrow-drop-up id="header-minutes-up"></sinch-icon-arrow-drop-up><sinch-icon-arrow-drop-down id="header-minutes-down"></sinch-icon-arrow-drop-down></div><sinch-icon-button id="submit" small aria-label="Submit"><sinch-icon-done slot="icon"></sinch-icon-done></sinch-icon-button></div><div id="picker" aria-hidden="true"><div id="picker-hours"></div><div id="picker-minutes"></div><div id="picker-touch"><div id="needle-hour"></div><div id="needle-minute"></div></div></div><div id="footer"><sinch-segmented-control id="ampm"><sinch-segmented-control-option value="am" text="AM" aria-label="AM"></sinch-segmented-control-option><sinch-segmented-control-option value="pm" text="PM" aria-label="PM"></sinch-segmented-control-option></sinch-segmented-control></div></div>';
22
9
  import { getNeedleRotationDeg, getShortestCssDeg, hourToIndex, parseTime, stringifyHour, stringifyHourFace, stringifyMinute, stringifyTime } from './utils';
23
10
  const template = document.createElement('template');
24
11
  template.innerHTML = templateHTML;
@@ -32,254 +19,38 @@ const HOUR_24_RADIUS = HOUR_12_RADIUS - HOUR_24_DIGIT_SIZE;
32
19
  const NEEDLE_HOUR_12_LENGTH = HOUR_12_RADIUS;
33
20
  const NEEDLE_HOUR_24_LENGTH = HOUR_24_RADIUS;
34
21
  const NEEDLE_MINUTE_LENGTH = MINUTE_RADIUS;
35
- defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$pickerMinutes = new WeakMap(), _$pickerTouch = new WeakMap(), _$needleHour = new WeakMap(), _$needleMinute = new WeakMap(), _$headerHours = new WeakMap(), _$headerHoursText = new WeakMap(), _$headerMinutes = new WeakMap(), _$headerMinutesText = new WeakMap(), _$ampm = new WeakMap(), _$submitButton = new WeakMap(), _hour = new WeakMap(), _minute = new WeakMap(), _getClickDegree = new WeakSet(), _onPickerClick = new WeakMap(), _render = new WeakSet(), _selectHour = new WeakSet(), _selectMinute = new WeakSet(), _onAmPmChange = new WeakMap(), _onSubmitButtonClick = new WeakMap(), _onHoursKeydown = new WeakMap(), _onMinutesKeydown = new WeakMap(), _onChangeReactHandler = new WeakMap(), class extends NectaryElement {
22
+ defineCustomElement('sinch-time-picker', class extends NectaryElement {
23
+ #$pickerHours;
24
+ #$pickerMinutes;
25
+ #$pickerTouch;
26
+ #$needleHour;
27
+ #$needleMinute;
28
+ #$headerHours;
29
+ #$headerHoursText;
30
+ #$headerMinutes;
31
+ #$headerMinutesText;
32
+ #$ampm;
33
+ #$submitButton;
34
+ #hour = 0;
35
+ #minute = 0;
36
+
36
37
  constructor() {
37
38
  super();
38
-
39
- _classPrivateMethodInitSpec(this, _selectMinute);
40
-
41
- _classPrivateMethodInitSpec(this, _selectHour);
42
-
43
- _classPrivateMethodInitSpec(this, _render);
44
-
45
- _classPrivateMethodInitSpec(this, _getClickDegree);
46
-
47
- _classPrivateFieldInitSpec(this, _$pickerHours, {
48
- writable: true,
49
- value: void 0
50
- });
51
-
52
- _classPrivateFieldInitSpec(this, _$pickerMinutes, {
53
- writable: true,
54
- value: void 0
55
- });
56
-
57
- _classPrivateFieldInitSpec(this, _$pickerTouch, {
58
- writable: true,
59
- value: void 0
60
- });
61
-
62
- _classPrivateFieldInitSpec(this, _$needleHour, {
63
- writable: true,
64
- value: void 0
65
- });
66
-
67
- _classPrivateFieldInitSpec(this, _$needleMinute, {
68
- writable: true,
69
- value: void 0
70
- });
71
-
72
- _classPrivateFieldInitSpec(this, _$headerHours, {
73
- writable: true,
74
- value: void 0
75
- });
76
-
77
- _classPrivateFieldInitSpec(this, _$headerHoursText, {
78
- writable: true,
79
- value: void 0
80
- });
81
-
82
- _classPrivateFieldInitSpec(this, _$headerMinutes, {
83
- writable: true,
84
- value: void 0
85
- });
86
-
87
- _classPrivateFieldInitSpec(this, _$headerMinutesText, {
88
- writable: true,
89
- value: void 0
90
- });
91
-
92
- _classPrivateFieldInitSpec(this, _$ampm, {
93
- writable: true,
94
- value: void 0
95
- });
96
-
97
- _classPrivateFieldInitSpec(this, _$submitButton, {
98
- writable: true,
99
- value: void 0
100
- });
101
-
102
- _classPrivateFieldInitSpec(this, _hour, {
103
- writable: true,
104
- value: 0
105
- });
106
-
107
- _classPrivateFieldInitSpec(this, _minute, {
108
- writable: true,
109
- value: 0
110
- });
111
-
112
- _classPrivateFieldInitSpec(this, _onPickerClick, {
113
- writable: true,
114
- value: e => {
115
- const [cssDeg, rowIndex] = _classPrivateMethodGet(this, _getClickDegree, _getClickDegree2).call(this, e.x, e.y);
116
-
117
- const isHourRowClick = rowIndex > 0;
118
- const isHour24RowClick = rowIndex > 1;
119
-
120
- if (isHourRowClick) {
121
- const digitIndex = Math.round(cssDeg / 30) % 12;
122
- const is24 = getBooleanAttribute(this, 'ampm') === false;
123
-
124
- if (is24) {
125
- if (isHour24RowClick) {
126
- _classPrivateFieldSet(this, _hour, digitIndex === 0 ? 0 : digitIndex + 12);
127
- } else {
128
- _classPrivateFieldSet(this, _hour, digitIndex === 0 ? 12 : digitIndex);
129
- }
130
- } else {
131
- _classPrivateFieldSet(this, _hour, digitIndex + (_classPrivateFieldGet(this, _$ampm).value === 'pm' ? 12 : 0));
132
- }
133
-
134
- _classPrivateFieldGet(this, _$headerHours).focus();
135
- } else {
136
- _classPrivateFieldSet(this, _minute, Math.round(cssDeg / 6) % 60);
137
-
138
- _classPrivateFieldGet(this, _$headerMinutes).focus();
139
- }
140
-
141
- _classPrivateMethodGet(this, _render, _render2).call(this);
142
- }
143
- });
144
-
145
- _classPrivateFieldInitSpec(this, _onAmPmChange, {
146
- writable: true,
147
- value: e => {
148
- e.stopPropagation();
149
- const value = e.detail;
150
-
151
- switch (value) {
152
- case 'am':
153
- {
154
- if (_classPrivateFieldGet(this, _hour) >= 12) {
155
- _classPrivateFieldSet(this, _hour, _classPrivateFieldGet(this, _hour) - 12);
156
-
157
- _classPrivateMethodGet(this, _render, _render2).call(this);
158
- }
159
-
160
- break;
161
- }
162
-
163
- case 'pm':
164
- {
165
- if (_classPrivateFieldGet(this, _hour) < 12) {
166
- _classPrivateFieldSet(this, _hour, _classPrivateFieldGet(this, _hour) + 12);
167
-
168
- _classPrivateMethodGet(this, _render, _render2).call(this);
169
- }
170
-
171
- break;
172
- }
173
- }
174
- }
175
- });
176
-
177
- _classPrivateFieldInitSpec(this, _onSubmitButtonClick, {
178
- writable: true,
179
- value: () => {
180
- const value = stringifyTime(_classPrivateFieldGet(this, _hour), _classPrivateFieldGet(this, _minute));
181
- this.dispatchEvent(new CustomEvent('change', {
182
- bubbles: true,
183
- detail: value
184
- }));
185
- this.dispatchEvent(new CustomEvent('-change', {
186
- detail: value
187
- }));
188
- }
189
- });
190
-
191
- _classPrivateFieldInitSpec(this, _onHoursKeydown, {
192
- writable: true,
193
- value: e => {
194
- switch (e.key) {
195
- case 'ArrowUp':
196
- {
197
- e.preventDefault();
198
-
199
- _classPrivateFieldSet(this, _hour, (_classPrivateFieldGet(this, _hour) + 1) % 24);
200
-
201
- _classPrivateMethodGet(this, _render, _render2).call(this);
202
-
203
- break;
204
- }
205
-
206
- case 'ArrowDown':
207
- {
208
- e.preventDefault();
209
-
210
- _classPrivateFieldSet(this, _hour, (_classPrivateFieldGet(this, _hour) + 23) % 24);
211
-
212
- _classPrivateMethodGet(this, _render, _render2).call(this);
213
-
214
- break;
215
- }
216
- }
217
- }
218
- });
219
-
220
- _classPrivateFieldInitSpec(this, _onMinutesKeydown, {
221
- writable: true,
222
- value: e => {
223
- switch (e.key) {
224
- case 'ArrowUp':
225
- {
226
- e.preventDefault();
227
-
228
- _classPrivateFieldSet(this, _minute, (_classPrivateFieldGet(this, _minute) + 1) % 60);
229
-
230
- _classPrivateMethodGet(this, _render, _render2).call(this);
231
-
232
- break;
233
- }
234
-
235
- case 'ArrowDown':
236
- {
237
- e.preventDefault();
238
-
239
- _classPrivateFieldSet(this, _minute, (_classPrivateFieldGet(this, _minute) + 59) % 60);
240
-
241
- _classPrivateMethodGet(this, _render, _render2).call(this);
242
-
243
- break;
244
- }
245
- }
246
- }
247
- });
248
-
249
- _classPrivateFieldInitSpec(this, _onChangeReactHandler, {
250
- writable: true,
251
- value: e => {
252
- getReactEventHandler(this, 'on-change')?.(e);
253
- }
254
- });
255
-
256
39
  const shadowRoot = this.attachShadow();
257
40
  shadowRoot.appendChild(template.content.cloneNode(true));
258
-
259
- _classPrivateFieldSet(this, _$pickerHours, shadowRoot.querySelector('#picker-hours'));
260
-
261
- _classPrivateFieldSet(this, _$pickerMinutes, shadowRoot.querySelector('#picker-minutes'));
262
-
263
- _classPrivateFieldSet(this, _$pickerTouch, shadowRoot.querySelector('#picker'));
264
-
265
- _classPrivateFieldSet(this, _$needleHour, shadowRoot.querySelector('#needle-hour'));
266
-
267
- _classPrivateFieldSet(this, _$needleMinute, shadowRoot.querySelector('#needle-minute'));
268
-
269
- _classPrivateFieldSet(this, _$headerHours, shadowRoot.querySelector('#header-hours'));
270
-
271
- _classPrivateFieldSet(this, _$headerMinutes, shadowRoot.querySelector('#header-minutes'));
272
-
273
- _classPrivateFieldSet(this, _$headerHoursText, shadowRoot.querySelector('#header-hours > span'));
274
-
275
- _classPrivateFieldSet(this, _$headerMinutesText, shadowRoot.querySelector('#header-minutes > span'));
276
-
277
- _classPrivateFieldSet(this, _$ampm, shadowRoot.querySelector('#ampm'));
278
-
279
- _classPrivateFieldSet(this, _$submitButton, shadowRoot.querySelector('#submit'));
280
-
281
- _classPrivateFieldGet(this, _$needleMinute).style.height = `${NEEDLE_MINUTE_LENGTH}px`;
282
- _classPrivateFieldGet(this, _$needleHour).style.height = `${NEEDLE_HOUR_12_LENGTH}px`;
41
+ this.#$pickerHours = shadowRoot.querySelector('#picker-hours');
42
+ this.#$pickerMinutes = shadowRoot.querySelector('#picker-minutes');
43
+ this.#$pickerTouch = shadowRoot.querySelector('#picker');
44
+ this.#$needleHour = shadowRoot.querySelector('#needle-hour');
45
+ this.#$needleMinute = shadowRoot.querySelector('#needle-minute');
46
+ this.#$headerHours = shadowRoot.querySelector('#header-hours');
47
+ this.#$headerMinutes = shadowRoot.querySelector('#header-minutes');
48
+ this.#$headerHoursText = shadowRoot.querySelector('#header-hours > span');
49
+ this.#$headerMinutesText = shadowRoot.querySelector('#header-minutes > span');
50
+ this.#$ampm = shadowRoot.querySelector('#ampm');
51
+ this.#$submitButton = shadowRoot.querySelector('#submit');
52
+ this.#$needleMinute.style.height = `${NEEDLE_MINUTE_LENGTH}px`;
53
+ this.#$needleHour.style.height = `${NEEDLE_HOUR_12_LENGTH}px`;
283
54
  const MINUTE_DIGIT_RADIUS = MINUTE_RADIUS + MINUTE_DIGIT_SIZE / 2;
284
55
  const HOUR_12_DIGIT_RADIUS = HOUR_12_RADIUS + HOUR_12_DIGIT_SIZE / 2;
285
56
  const HOUR_24_DIGIT_RADIUS = HOUR_24_RADIUS + HOUR_24_DIGIT_SIZE / 2;
@@ -297,8 +68,7 @@ defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$picke
297
68
  hours12Frag.appendChild(el);
298
69
  }
299
70
 
300
- _classPrivateFieldGet(this, _$pickerHours).appendChild(hours12Frag);
301
-
71
+ this.#$pickerHours.appendChild(hours12Frag);
302
72
  const hours24Frag = document.createDocumentFragment();
303
73
 
304
74
  for (let i = 12; i < 24; i++) {
@@ -313,8 +83,7 @@ defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$picke
313
83
  hours24Frag.appendChild(el);
314
84
  }
315
85
 
316
- _classPrivateFieldGet(this, _$pickerHours).appendChild(hours24Frag);
317
-
86
+ this.#$pickerHours.appendChild(hours24Frag);
318
87
  const minutesFrag = document.createDocumentFragment();
319
88
 
320
89
  for (let i = 0; i < 60; i += 5) {
@@ -328,35 +97,25 @@ defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$picke
328
97
  minutesFrag.appendChild(el);
329
98
  }
330
99
 
331
- _classPrivateFieldGet(this, _$pickerMinutes).appendChild(minutesFrag);
100
+ this.#$pickerMinutes.appendChild(minutesFrag);
332
101
  }
333
102
 
334
103
  connectedCallback() {
335
- _classPrivateFieldGet(this, _$pickerTouch).addEventListener('click', _classPrivateFieldGet(this, _onPickerClick));
336
-
337
- _classPrivateFieldGet(this, _$ampm).addEventListener('change', _classPrivateFieldGet(this, _onAmPmChange));
338
-
339
- _classPrivateFieldGet(this, _$submitButton).addEventListener('click', _classPrivateFieldGet(this, _onSubmitButtonClick));
340
-
341
- _classPrivateFieldGet(this, _$headerHours).addEventListener('keydown', _classPrivateFieldGet(this, _onHoursKeydown));
342
-
343
- _classPrivateFieldGet(this, _$headerMinutes).addEventListener('keydown', _classPrivateFieldGet(this, _onMinutesKeydown));
344
-
345
- this.addEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
104
+ this.#$pickerTouch.addEventListener('click', this.#onPickerClick);
105
+ this.#$ampm.addEventListener('change', this.#onAmPmChange);
106
+ this.#$submitButton.addEventListener('click', this.#onSubmitButtonClick);
107
+ this.#$headerHours.addEventListener('keydown', this.#onHoursKeydown);
108
+ this.#$headerMinutes.addEventListener('keydown', this.#onMinutesKeydown);
109
+ this.addEventListener('-change', this.#onChangeReactHandler);
346
110
  }
347
111
 
348
112
  disconnectedCallback() {
349
- _classPrivateFieldGet(this, _$pickerTouch).removeEventListener('click', _classPrivateFieldGet(this, _onPickerClick));
350
-
351
- _classPrivateFieldGet(this, _$ampm).removeEventListener('change', _classPrivateFieldGet(this, _onAmPmChange));
352
-
353
- _classPrivateFieldGet(this, _$submitButton).removeEventListener('click', _classPrivateFieldGet(this, _onSubmitButtonClick));
354
-
355
- _classPrivateFieldGet(this, _$headerHours).removeEventListener('keydown', _classPrivateFieldGet(this, _onHoursKeydown));
356
-
357
- _classPrivateFieldGet(this, _$headerMinutes).removeEventListener('keydown', _classPrivateFieldGet(this, _onMinutesKeydown));
358
-
359
- this.removeEventListener('-change', _classPrivateFieldGet(this, _onChangeReactHandler));
113
+ this.#$pickerTouch.removeEventListener('click', this.#onPickerClick);
114
+ this.#$ampm.removeEventListener('change', this.#onAmPmChange);
115
+ this.#$submitButton.removeEventListener('click', this.#onSubmitButtonClick);
116
+ this.#$headerHours.removeEventListener('keydown', this.#onHoursKeydown);
117
+ this.#$headerMinutes.removeEventListener('keydown', this.#onMinutesKeydown);
118
+ this.removeEventListener('-change', this.#onChangeReactHandler);
360
119
  }
361
120
 
362
121
  static get observedAttributes() {
@@ -379,13 +138,9 @@ defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$picke
379
138
  hours,
380
139
  minutes
381
140
  } = parseTime(newVal);
382
-
383
- _classPrivateFieldSet(this, _hour, hours);
384
-
385
- _classPrivateFieldSet(this, _minute, minutes);
386
-
387
- _classPrivateMethodGet(this, _render, _render2).call(this);
388
-
141
+ this.#hour = hours;
142
+ this.#minute = minutes;
143
+ this.#render();
389
144
  break;
390
145
  }
391
146
 
@@ -393,15 +148,13 @@ defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$picke
393
148
  {
394
149
  const isAmpm = isAttrTrue(newVal);
395
150
  updateBooleanAttribute(this, 'ampm', isAmpm);
396
-
397
- _classPrivateMethodGet(this, _render, _render2).call(this);
398
-
151
+ this.#render();
399
152
  break;
400
153
  }
401
154
 
402
155
  case 'submit-aria-label':
403
156
  {
404
- _classPrivateFieldGet(this, _$submitButton).ariaLabel = newVal;
157
+ updateAttribute(this.#$submitButton, 'aria-label', newVal);
405
158
  break;
406
159
  }
407
160
  }
@@ -427,8 +180,16 @@ defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$picke
427
180
  return getBooleanAttribute(this, 'ampm');
428
181
  }
429
182
 
183
+ set submitAriaLabel(value) {
184
+ updateAttribute(this, 'submit-aria-label', value);
185
+ }
186
+
187
+ get submitAriaLabel() {
188
+ return getAttribute(this, 'submit-aria-label', '');
189
+ }
190
+
430
191
  get submitButtonRect() {
431
- return getRect(_classPrivateFieldGet(this, _$submitButton));
192
+ return getRect(this.#$submitButton);
432
193
  }
433
194
 
434
195
  get amButtonRect() {
@@ -436,8 +197,7 @@ defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$picke
436
197
  return null;
437
198
  }
438
199
 
439
- const $am = _classPrivateFieldGet(this, _$ampm).querySelector('[value="am"]');
440
-
200
+ const $am = this.#$ampm.querySelector('[value="am"]');
441
201
  return $am != null ? getRect($am) : null;
442
202
  }
443
203
 
@@ -446,102 +206,198 @@ defineCustomElement('sinch-time-picker', (_$pickerHours = new WeakMap(), _$picke
446
206
  return null;
447
207
  }
448
208
 
449
- const $pm = _classPrivateFieldGet(this, _$ampm).querySelector('[value="pm"]');
450
-
209
+ const $pm = this.#$ampm.querySelector('[value="pm"]');
451
210
  return $pm != null ? getRect($pm) : null;
452
211
  }
453
212
 
454
213
  hourDigitRect(hour) {
455
- const $digit = _classPrivateFieldGet(this, _$pickerHours).children[hourToIndex(hour, !this.ampm)];
456
-
214
+ const $digit = this.#$pickerHours.children[hourToIndex(hour, !this.ampm)];
457
215
  return $digit != null ? getRect($digit) : null;
458
216
  }
459
217
 
460
218
  minuteDigitRect(minute) {
461
- const $digit = _classPrivateFieldGet(this, _$pickerMinutes).children[Math.round(minute / 5)];
462
-
219
+ const $digit = this.#$pickerMinutes.children[Math.round(minute / 5)];
463
220
  return $digit != null ? getRect($digit) : null;
464
221
  }
465
222
 
466
- }));
467
-
468
- function _getClickDegree2(x, y) {
469
- const touchRect = _classPrivateFieldGet(this, _$pickerTouch).getBoundingClientRect();
470
-
471
- const cx = touchRect.width / 2;
472
- const cy = touchRect.height / 2;
473
- const px = x - touchRect.x;
474
- const py = touchRect.height - y + touchRect.y;
475
- const dx = px - cx;
476
- const dy = py - cy;
477
- const len = Math.sqrt(dx * dx + dy * dy);
478
- const cosRad = dx / len;
479
- const rad = Math.acos(cosRad * (dy < 0 ? -1 : 1));
480
- const deg = rad * (180 / Math.PI);
481
- let cssDeg = (deg - 90 - 360) % 360 * -1;
482
-
483
- if (dy < 0) {
484
- cssDeg += 180;
223
+ #getClickDegree(x, y) {
224
+ const touchRect = this.#$pickerTouch.getBoundingClientRect();
225
+ const cx = touchRect.width / 2;
226
+ const cy = touchRect.height / 2;
227
+ const px = x - touchRect.x;
228
+ const py = touchRect.height - y + touchRect.y;
229
+ const dx = px - cx;
230
+ const dy = py - cy;
231
+ const len = Math.sqrt(dx * dx + dy * dy);
232
+ const cosRad = dx / len;
233
+ const rad = Math.acos(cosRad * (dy < 0 ? -1 : 1));
234
+ const deg = rad * (180 / Math.PI);
235
+ let cssDeg = (deg - 90 - 360) % 360 * -1;
236
+
237
+ if (dy < 0) {
238
+ cssDeg += 180;
239
+ }
240
+
241
+ const rowIndex = len > MINUTE_RADIUS ? 0 : len > HOUR_12_RADIUS ? 1 : 2;
242
+ return [cssDeg, rowIndex];
485
243
  }
486
244
 
487
- const rowIndex = len > MINUTE_RADIUS ? 0 : len > HOUR_12_RADIUS ? 1 : 2;
488
- return [cssDeg, rowIndex];
489
- }
245
+ #onPickerClick = e => {
246
+ const [cssDeg, rowIndex] = this.#getClickDegree(e.x, e.y);
247
+ const isHourRowClick = rowIndex > 0;
248
+ const isHour24RowClick = rowIndex > 1;
490
249
 
491
- function _render2() {
492
- const is24 = getBooleanAttribute(this, 'ampm') === false;
250
+ if (isHourRowClick) {
251
+ const digitIndex = Math.round(cssDeg / 30) % 12;
252
+ const is24 = getBooleanAttribute(this, 'ampm') === false;
493
253
 
494
- _classPrivateMethodGet(this, _selectHour, _selectHour2).call(this, is24);
254
+ if (is24) {
255
+ if (isHour24RowClick) {
256
+ this.#hour = digitIndex === 0 ? 0 : digitIndex + 12;
257
+ } else {
258
+ this.#hour = digitIndex === 0 ? 12 : digitIndex;
259
+ }
260
+ } else {
261
+ this.#hour = digitIndex + (this.#$ampm.value === 'pm' ? 12 : 0);
262
+ }
263
+
264
+ this.#$headerHours.focus();
265
+ } else {
266
+ this.#minute = Math.round(cssDeg / 6) % 60;
267
+ this.#$headerMinutes.focus();
268
+ }
269
+
270
+ this.#render();
271
+ };
272
+
273
+ #render() {
274
+ const is24 = getBooleanAttribute(this, 'ampm') === false;
275
+ this.#selectHour(is24);
276
+ this.#selectMinute();
277
+ this.#$headerHoursText.textContent = stringifyHour(this.#hour, is24);
278
+ this.#$headerMinutesText.textContent = stringifyMinute(this.#minute);
279
+ updateAttribute(this.#$headerHours, 'aria-valuenow', this.#hour);
280
+ updateAttribute(this.#$headerHours, 'aria-valuetext', this.#hour);
281
+ updateAttribute(this.#$headerMinutes, 'aria-valuenow', this.#minute);
282
+ updateAttribute(this.#$headerMinutes, 'aria-valuetext', this.#minute);
283
+ }
495
284
 
496
- _classPrivateMethodGet(this, _selectMinute, _selectMinute2).call(this);
285
+ #selectHour(is24) {
286
+ const $hours = this.#$pickerHours.children;
287
+ const hourDigitIndex = this.#hour % 12;
288
+ const selectedIndex = hourToIndex(this.#hour, is24);
289
+ const currentCssDeg = getNeedleRotationDeg(this.#$needleHour);
290
+ const hourCssDeg = getShortestCssDeg(currentCssDeg, hourDigitIndex * 30);
497
291
 
498
- _classPrivateFieldGet(this, _$headerHoursText).textContent = stringifyHour(_classPrivateFieldGet(this, _hour), is24);
499
- _classPrivateFieldGet(this, _$headerMinutesText).textContent = stringifyMinute(_classPrivateFieldGet(this, _minute));
500
- updateAttribute(_classPrivateFieldGet(this, _$headerHours), 'aria-valuenow', _classPrivateFieldGet(this, _hour));
501
- updateAttribute(_classPrivateFieldGet(this, _$headerHours), 'aria-valuetext', _classPrivateFieldGet(this, _hour));
502
- updateAttribute(_classPrivateFieldGet(this, _$headerMinutes), 'aria-valuenow', _classPrivateFieldGet(this, _minute));
503
- updateAttribute(_classPrivateFieldGet(this, _$headerMinutes), 'aria-valuetext', _classPrivateFieldGet(this, _minute));
504
- }
292
+ for (let i = 0; i < $hours.length; i++) {
293
+ setClass($hours[i], 'selected', i === selectedIndex);
294
+ }
505
295
 
506
- function _selectHour2(is24) {
507
- const $hours = _classPrivateFieldGet(this, _$pickerHours).children;
296
+ this.#$needleHour.style.transform = `rotate(${hourCssDeg}deg)`;
508
297
 
509
- const hourDigitIndex = _classPrivateFieldGet(this, _hour) % 12;
510
- const selectedIndex = hourToIndex(_classPrivateFieldGet(this, _hour), is24);
511
- const currentCssDeg = getNeedleRotationDeg(_classPrivateFieldGet(this, _$needleHour));
512
- const hourCssDeg = getShortestCssDeg(currentCssDeg, hourDigitIndex * 30);
298
+ if (is24) {
299
+ if (this.#hour > 0 && this.#hour <= 12) {
300
+ this.#$needleHour.style.height = `${NEEDLE_HOUR_12_LENGTH}px`;
301
+ } else {
302
+ this.#$needleHour.style.height = `${NEEDLE_HOUR_24_LENGTH}px`;
303
+ }
304
+ } else {
305
+ this.#$needleHour.style.height = `${NEEDLE_HOUR_12_LENGTH}px`;
306
+ }
513
307
 
514
- for (let i = 0; i < $hours.length; i++) {
515
- setClass($hours[i], 'selected', i === selectedIndex);
308
+ this.#$ampm.setAttribute('value', this.#hour >= 0 && this.#hour < 12 ? 'am' : 'pm');
516
309
  }
517
310
 
518
- _classPrivateFieldGet(this, _$needleHour).style.transform = `rotate(${hourCssDeg}deg)`;
311
+ #selectMinute() {
312
+ const $minutes = this.#$pickerMinutes.children;
313
+ const isNeedleSelected = this.#minute % 5 === 0;
314
+ const selectedIndex = this.#minute / 5;
315
+ const currentCssDeg = getNeedleRotationDeg(this.#$needleMinute);
316
+ const minuteCssDeg = getShortestCssDeg(currentCssDeg, this.#minute * 6);
519
317
 
520
- if (is24) {
521
- if (_classPrivateFieldGet(this, _hour) > 0 && _classPrivateFieldGet(this, _hour) <= 12) {
522
- _classPrivateFieldGet(this, _$needleHour).style.height = `${NEEDLE_HOUR_12_LENGTH}px`;
523
- } else {
524
- _classPrivateFieldGet(this, _$needleHour).style.height = `${NEEDLE_HOUR_24_LENGTH}px`;
318
+ for (let i = 0; i < $minutes.length; i++) {
319
+ setClass($minutes[i], 'selected', selectedIndex === i);
525
320
  }
526
- } else {
527
- _classPrivateFieldGet(this, _$needleHour).style.height = `${NEEDLE_HOUR_12_LENGTH}px`;
321
+
322
+ setClass(this.#$needleMinute, 'selected', isNeedleSelected);
323
+ this.#$needleMinute.style.transform = `rotate(${minuteCssDeg}deg)`;
528
324
  }
529
325
 
530
- _classPrivateFieldGet(this, _$ampm).setAttribute('value', _classPrivateFieldGet(this, _hour) >= 0 && _classPrivateFieldGet(this, _hour) < 12 ? 'am' : 'pm');
531
- }
326
+ #onAmPmChange = e => {
327
+ e.stopPropagation();
328
+ const value = e.detail;
329
+
330
+ switch (value) {
331
+ case 'am':
332
+ {
333
+ if (this.#hour >= 12) {
334
+ this.#hour -= 12;
335
+ this.#render();
336
+ }
532
337
 
533
- function _selectMinute2() {
534
- const $minutes = _classPrivateFieldGet(this, _$pickerMinutes).children;
338
+ break;
339
+ }
535
340
 
536
- const isNeedleSelected = _classPrivateFieldGet(this, _minute) % 5 === 0;
537
- const selectedIndex = _classPrivateFieldGet(this, _minute) / 5;
538
- const currentCssDeg = getNeedleRotationDeg(_classPrivateFieldGet(this, _$needleMinute));
539
- const minuteCssDeg = getShortestCssDeg(currentCssDeg, _classPrivateFieldGet(this, _minute) * 6);
341
+ case 'pm':
342
+ {
343
+ if (this.#hour < 12) {
344
+ this.#hour += 12;
345
+ this.#render();
346
+ }
540
347
 
541
- for (let i = 0; i < $minutes.length; i++) {
542
- setClass($minutes[i], 'selected', selectedIndex === i);
543
- }
348
+ break;
349
+ }
350
+ }
351
+ };
352
+ #onSubmitButtonClick = () => {
353
+ const value = stringifyTime(this.#hour, this.#minute);
354
+ this.dispatchEvent(new CustomEvent('change', {
355
+ bubbles: true,
356
+ detail: value
357
+ }));
358
+ this.dispatchEvent(new CustomEvent('-change', {
359
+ detail: value
360
+ }));
361
+ };
362
+ #onHoursKeydown = e => {
363
+ switch (e.key) {
364
+ case 'ArrowUp':
365
+ {
366
+ e.preventDefault();
367
+ this.#hour = (this.#hour + 1) % 24;
368
+ this.#render();
369
+ break;
370
+ }
371
+
372
+ case 'ArrowDown':
373
+ {
374
+ e.preventDefault();
375
+ this.#hour = (this.#hour + 23) % 24;
376
+ this.#render();
377
+ break;
378
+ }
379
+ }
380
+ };
381
+ #onMinutesKeydown = e => {
382
+ switch (e.key) {
383
+ case 'ArrowUp':
384
+ {
385
+ e.preventDefault();
386
+ this.#minute = (this.#minute + 1) % 60;
387
+ this.#render();
388
+ break;
389
+ }
544
390
 
545
- setClass(_classPrivateFieldGet(this, _$needleMinute), 'selected', isNeedleSelected);
546
- _classPrivateFieldGet(this, _$needleMinute).style.transform = `rotate(${minuteCssDeg}deg)`;
547
- }
391
+ case 'ArrowDown':
392
+ {
393
+ e.preventDefault();
394
+ this.#minute = (this.#minute + 59) % 60;
395
+ this.#render();
396
+ break;
397
+ }
398
+ }
399
+ };
400
+ #onChangeReactHandler = e => {
401
+ getReactEventHandler(this, 'on-change')?.(e);
402
+ };
403
+ });