@longline/aqua-ui 1.0.339 → 1.0.340

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 (251) hide show
  1. package/containers/Anchor/Anchor.d.ts +5 -0
  2. package/containers/Anchor/Anchor.js +20 -8
  3. package/containers/Dock/Dock.d.ts +5 -0
  4. package/containers/Dock/Dock.js +1 -1
  5. package/containers/Dock/Dockable.d.ts +5 -0
  6. package/containers/Dock/Dockable.js +20 -12
  7. package/containers/DragBar/DragBar.d.ts +5 -0
  8. package/containers/DragBar/DragBar.js +16 -5
  9. package/containers/Form/Field.d.ts +0 -3
  10. package/containers/Form/Field.js +3 -6
  11. package/containers/Form/Form.js +5 -36
  12. package/containers/Form/Validation.d.ts +1 -1
  13. package/containers/Form/Validation.js +6 -6
  14. package/containers/Form/context/FormContext.d.ts +1 -2
  15. package/containers/Form/context/useForm.d.ts +1 -1
  16. package/containers/Form/elements/BoxWrapper.js +2 -0
  17. package/containers/GlassPane/GlassPane.d.ts +7 -2
  18. package/containers/GlassPane/GlassPane.js +3 -3
  19. package/containers/InfoBox/InfoBox.d.ts +5 -0
  20. package/containers/InfoBox/InfoBox.js +1 -1
  21. package/containers/List/List.d.ts +5 -0
  22. package/containers/List/List.js +1 -1
  23. package/containers/List/ListCell.d.ts +5 -0
  24. package/containers/List/ListCell.js +1 -1
  25. package/containers/List/ListRow.d.ts +7 -2
  26. package/containers/List/ListRow.js +1 -1
  27. package/containers/Message/Error.d.ts +2 -0
  28. package/containers/Message/Error.js +1 -1
  29. package/containers/Message/Message.d.ts +5 -0
  30. package/containers/Message/Message.js +1 -1
  31. package/containers/Message/NoData.d.ts +2 -0
  32. package/containers/Message/NoData.js +1 -1
  33. package/containers/Message/NoFilteredData.d.ts +2 -0
  34. package/containers/Message/NoFilteredData.js +1 -1
  35. package/containers/Openable/Openable.d.ts +5 -0
  36. package/containers/Openable/Openable.js +8 -8
  37. package/containers/PublicRoute/PublicRoute.d.ts +9 -1
  38. package/containers/PublicRoute/PublicRoute.js +3 -7
  39. package/containers/Tabs/Pane.d.ts +5 -0
  40. package/containers/Tabs/Pane.js +3 -3
  41. package/containers/Tabs/Tabs.d.ts +5 -0
  42. package/containers/Tabs/Tabs.js +3 -3
  43. package/controls/Chip/Chip.d.ts +15 -3
  44. package/controls/Chip/Chip.js +7 -6
  45. package/controls/CircularProgress/CircularProgress.d.ts +11 -0
  46. package/controls/CircularProgress/CircularProgress.js +19 -11
  47. package/controls/Dropzone/Dropzone.d.ts +11 -1
  48. package/controls/Dropzone/Dropzone.js +18 -7
  49. package/controls/Fab/Fab.d.ts +14 -6
  50. package/controls/Fab/Fab.js +7 -20
  51. package/controls/Ghost/Ghost.js +3 -3
  52. package/controls/Gradient/Gradient.d.ts +5 -0
  53. package/controls/Gradient/Gradient.js +7 -4
  54. package/controls/Histogram/Histogram.d.ts +8 -2
  55. package/controls/Histogram/Histogram.js +9 -9
  56. package/controls/Histogram/HistogramBar.d.ts +2 -2
  57. package/controls/Icon/Icon.d.ts +10 -4
  58. package/controls/Icon/Icon.js +23 -6
  59. package/controls/Key/Key.d.ts +5 -0
  60. package/controls/Key/Key.js +2 -5
  61. package/controls/LinearChart/LinearChart.d.ts +9 -0
  62. package/controls/LinearChart/LinearChart.js +11 -6
  63. package/controls/ListButton/ListButton.d.ts +46 -3
  64. package/controls/ListButton/ListButton.js +70 -9
  65. package/controls/ListView/ColumnsManager/ColumnDraggable.js +11 -5
  66. package/controls/ListView/ColumnsManager/SourceColumns.js +1 -1
  67. package/controls/ListView/IListViewProps.d.ts +9 -2
  68. package/controls/ListView/ListView.js +13 -12
  69. package/controls/ListView/defaults.d.ts +3 -0
  70. package/controls/ListView/defaults.js +6 -0
  71. package/controls/ListView/elements/Body.d.ts +1 -1
  72. package/controls/ListView/elements/Body.js +23 -12
  73. package/controls/ListView/elements/Ghost.js +3 -2
  74. package/controls/ListView/elements/Header.js +3 -2
  75. package/controls/ListView/elements/HeaderCell.js +3 -3
  76. package/controls/ListView/elements/Table.js +16 -10
  77. package/controls/Mouse/Mouse.d.ts +6 -4
  78. package/controls/Mouse/Mouse.js +15 -8
  79. package/controls/PrimaryButton/PrimaryButton.d.ts +9 -3
  80. package/controls/PrimaryButton/PrimaryButton.js +5 -5
  81. package/controls/Progress/Progress.d.ts +9 -0
  82. package/controls/Progress/Progress.js +12 -8
  83. package/controls/SecondaryButton/SecondaryButton.d.ts +8 -3
  84. package/controls/SecondaryButton/SecondaryButton.js +1 -1
  85. package/controls/SpeechRecognizer/EditorRegistry.js +1 -2
  86. package/controls/SpeechRecognizer/SpeechRecognizer.d.ts +9 -1
  87. package/controls/SpeechRecognizer/SpeechRecognizer.js +16 -9
  88. package/controls/TabBar/TabBar.d.ts +5 -0
  89. package/controls/TabBar/TabBar.js +14 -6
  90. package/controls/TabBar/Underliner.js +1 -1
  91. package/controls/TertiaryButton/TertiaryButton.d.ts +9 -3
  92. package/controls/TertiaryButton/TertiaryButton.js +5 -3
  93. package/controls/ToggleButton/ToggleButton.d.ts +8 -2
  94. package/controls/ToggleButton/ToggleButton.js +1 -1
  95. package/controls/View/View.d.ts +5 -0
  96. package/controls/View/View.js +1 -1
  97. package/formatters/CountryFormatter/CountryFormatter.d.ts +3 -2
  98. package/formatters/CountryFormatter/CountryUtil.d.ts +3 -3
  99. package/formatters/DateTimeFormatter/DateTimeFormatter.d.ts +11 -10
  100. package/formatters/DateTimeFormatter/elements/Custom.d.ts +1 -1
  101. package/formatters/DateTimeFormatter/elements/DistanceDate.d.ts +1 -1
  102. package/formatters/DateTimeFormatter/elements/LongDate.d.ts +1 -1
  103. package/formatters/DateTimeFormatter/elements/LongDateTime.d.ts +1 -1
  104. package/formatters/DateTimeFormatter/elements/LongTime.d.ts +1 -1
  105. package/formatters/DateTimeFormatter/elements/Month.d.ts +1 -1
  106. package/formatters/DateTimeFormatter/elements/ShortDate.d.ts +1 -1
  107. package/formatters/DateTimeFormatter/elements/ShortDateTime.d.ts +1 -1
  108. package/formatters/DateTimeFormatter/elements/ShortTime.d.ts +1 -1
  109. package/formatters/DivisionFormatter/DivisionFormatter.d.ts +2 -2
  110. package/formatters/DivisionFormatter/DivisionFormatter.js +1 -1
  111. package/formatters/DivisionFormatter/DivisionUtil.d.ts +1 -1
  112. package/formatters/DivisionFormatter/DivisionUtil.js +5 -3
  113. package/formatters/FilesizeFormatter/FilesizeFormatter.d.ts +3 -3
  114. package/formatters/GIS/CoordinateFormatter.d.ts +2 -2
  115. package/formatters/GIS/LatitudeFormatter.d.ts +2 -2
  116. package/formatters/GIS/LongitudeFormatter.d.ts +2 -2
  117. package/formatters/HumanFormatter/HumanFormatter.d.ts +3 -3
  118. package/formatters/NumberFormatter/NumberFormatter.d.ts +3 -3
  119. package/formatters/PhoneFormatter/PhoneFormatter.d.ts +3 -3
  120. package/formatters/StringFormatter/StringFormatter.d.ts +3 -3
  121. package/formatters/StringFormatter/StringFormatter.js +1 -4
  122. package/helper/DMS.d.ts +1 -1
  123. package/helper/DMS.js +2 -2
  124. package/hooks/useOutsideClose/useOutsideClose.js +20 -11
  125. package/hooks/useSpeechAIRecorder/useSpeechAIRecorder.js +10 -7
  126. package/index.js +1 -0
  127. package/inputs/DateInput/Body.d.ts +2 -2
  128. package/inputs/DateInput/Body.js +11 -7
  129. package/inputs/DateInput/Calendar.d.ts +1 -1
  130. package/inputs/DateInput/Calendar.js +3 -5
  131. package/inputs/DateInput/DateInput.d.ts +11 -3
  132. package/inputs/DateInput/DateInput.js +11 -3
  133. package/inputs/DateInput/Day.d.ts +1 -1
  134. package/inputs/DateInput/InfiniteList.js +6 -3
  135. package/inputs/DateInput/Navbar.js +3 -2
  136. package/inputs/DateInput/NumericInput.js +3 -0
  137. package/inputs/DateInput/Selector.d.ts +1 -1
  138. package/inputs/DateInput/Selector.js +9 -6
  139. package/inputs/Dropdown/Body.d.ts +2 -2
  140. package/inputs/Dropdown/Column.d.ts +1 -1
  141. package/inputs/Dropdown/Dropdown.d.ts +5 -0
  142. package/inputs/Dropdown/Dropdown.js +36 -63
  143. package/inputs/Dropdown/Pill.js +1 -1
  144. package/inputs/Dropdown/Selection.js +1 -1
  145. package/inputs/Editor/Editor.d.ts +5 -0
  146. package/inputs/Editor/Editor.js +16 -6
  147. package/inputs/Editor/buttons/SpeechAIButton.js +2 -0
  148. package/inputs/Editor/buttons/TextAIButton.d.ts +0 -13
  149. package/inputs/Editor/buttons/TextAIButton.js +30 -14
  150. package/inputs/Editor/buttons/TextAIMenu.js +1 -1
  151. package/inputs/Editor/menu/MenuBar.d.ts +1 -1
  152. package/inputs/Editor/menu/MenuBar.js +1 -1
  153. package/inputs/Editor/menu/MenuButton.js +1 -1
  154. package/inputs/Input/Clear.js +1 -1
  155. package/inputs/Input/Input.d.ts +5 -0
  156. package/inputs/Input/Input.js +8 -6
  157. package/inputs/Input/InputWrapper.d.ts +2 -0
  158. package/inputs/Input/InputWrapper.js +1 -1
  159. package/inputs/Input/Reveal.js +1 -1
  160. package/inputs/MonthRange/Body.d.ts +1 -1
  161. package/inputs/MonthRange/Calendar.d.ts +2 -2
  162. package/inputs/MonthRange/Calendar.js +6 -9
  163. package/inputs/MonthRange/MonthRange.d.ts +7 -1
  164. package/inputs/MonthRange/MonthRange.js +14 -6
  165. package/inputs/MonthRange/Selector.d.ts +1 -1
  166. package/inputs/MonthRange/Selector.js +12 -11
  167. package/inputs/PhoneInput/PhoneInput.d.ts +5 -0
  168. package/inputs/PhoneInput/PhoneInput.js +2 -2
  169. package/inputs/Selector/Selector.d.ts +5 -0
  170. package/inputs/Selector/Selector.js +4 -1
  171. package/inputs/Slider/Slider.d.ts +75 -22
  172. package/inputs/Slider/Slider.js +104 -22
  173. package/inputs/Textarea/Textarea.d.ts +5 -5
  174. package/inputs/Textarea/Textarea.js +3 -2
  175. package/map/Map/Map.d.ts +2 -2
  176. package/map/Map/Map.js +20 -14
  177. package/map/PositionsManager/PositionBox.js +7 -3
  178. package/map/PositionsManager/PositionsManager.js +33 -13
  179. package/map/controls/CompassButton/CompassButton.js +1 -1
  180. package/map/controls/FullscreenButton/FullscreenButton.js +1 -1
  181. package/map/controls/Geocoder/Geocoder.js +28 -14
  182. package/map/controls/Geocoder/GeocoderApi.js +2 -0
  183. package/map/controls/Geocoder/GeocoderSelector.js +1 -1
  184. package/map/controls/Graticule/Graticule.js +1 -5
  185. package/map/controls/MapLoader/MapLoader.js +1 -1
  186. package/map/controls/ScaleControl/ScaleControl.js +1 -1
  187. package/map/controls/ZoomInButton/ZoomInButton.js +1 -1
  188. package/map/controls/ZoomOutButton/ZoomOutButton.d.ts +1 -1
  189. package/map/controls/ZoomOutButton/ZoomOutButton.js +2 -2
  190. package/map/controls/base/MapButton/MapButton.d.ts +8 -2
  191. package/map/controls/base/MapButton/MapButton.js +11 -2
  192. package/map/controls/base/MapControl/MapControl.d.ts +5 -0
  193. package/map/controls/base/MapControl/MapControl.js +10 -7
  194. package/map/layers/ClusterLayer/ClusterLayer.d.ts +1 -1
  195. package/map/layers/ClusterLayer/ClusterLayer.js +7 -3
  196. package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer.js +8 -4
  197. package/map/layers/IdwBlendLayer/IdwBlendLayer.js +9 -4
  198. package/map/layers/IdwLayer/IdwLayer.d.ts +2 -1
  199. package/map/layers/IdwLayer/IdwLayer.js +271 -215
  200. package/map/layers/InterpolationLayer/ContoursFragmentShader.d.ts +1 -1
  201. package/map/layers/InterpolationLayer/ContoursFragmentShader.js +1 -1
  202. package/map/layers/InterpolationLayer/InterpolationLayer.d.ts +4 -3
  203. package/map/layers/InterpolationLayer/InterpolationLayer.js +362 -275
  204. package/map/layers/ParticlesLayer/ParticlesLayer.d.ts +8 -7
  205. package/map/layers/ParticlesLayer/ParticlesLayer.js +528 -404
  206. package/map/markers/ClusterMarker/ClusterMarker.d.ts +6 -1
  207. package/map/markers/ClusterMarker/ClusterMarker.js +15 -6
  208. package/map/markers/RiskMarker/RiskMarker.d.ts +5 -1
  209. package/map/markers/RiskMarker/RiskMarker.js +4 -4
  210. package/modules/CountryDropdown/CountryDropdown.js +10 -1
  211. package/modules/Filter/Filter.d.ts +5 -0
  212. package/modules/Filter/Filter.js +10 -6
  213. package/modules/Globe/Globe.d.ts +5 -0
  214. package/modules/Globe/Globe.js +4 -4
  215. package/modules/MainMenu/Item.d.ts +9 -2
  216. package/modules/MainMenu/Item.js +8 -5
  217. package/modules/MainMenu/MainMenu.d.ts +5 -0
  218. package/modules/MainMenu/MainMenu.js +1 -1
  219. package/modules/ParticleGlobe/GL.d.ts +1 -1
  220. package/modules/ParticleGlobe/ParticleGlobe.d.ts +5 -0
  221. package/modules/ParticleGlobe/ParticleGlobe.js +69 -40
  222. package/modules/Public/Public.d.ts +5 -0
  223. package/modules/Public/Public.js +3 -3
  224. package/package.json +1 -1
  225. package/services/Auth/Auth.js +13 -7
  226. package/services/Auth/AuthContext.js +9 -1
  227. package/services/Dialog/Dialog.d.ts +7 -2
  228. package/services/Dialog/Dialog.js +7 -6
  229. package/services/Dialog/DialogWindow.d.ts +3 -1
  230. package/services/Dialog/DialogWindow.js +1 -1
  231. package/services/Dialog/XhrDialog.d.ts +1 -1
  232. package/services/Toast/Toast.js +5 -3
  233. package/services/Toast/ToastContainer.js +3 -1
  234. package/services/Toast/ToastContext.d.ts +1 -1
  235. package/services/Toast/ToastProvider.js +2 -0
  236. package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer copy.d.ts +0 -35
  237. package/map/layers/HtmlMarkerLayer/HtmlMarkerLayer copy.js +0 -176
  238. package/modules/Root/Content.d.ts +0 -16
  239. package/modules/Root/Content.js +0 -25
  240. package/modules/Root/Overlay.d.ts +0 -23
  241. package/modules/Root/Overlay.js +0 -33
  242. package/modules/Root/Root.d.ts +0 -10
  243. package/modules/Root/Root.js +0 -46
  244. package/modules/Root/Shader.d.ts +0 -15
  245. package/modules/Root/Shader.js +0 -24
  246. package/modules/Root/Sidebar.d.ts +0 -13
  247. package/modules/Root/Sidebar.js +0 -24
  248. package/modules/Root/index.d.ts +0 -1
  249. package/modules/Root/index.js +0 -1
  250. package/modules/Root/stories/SampleContent.d.ts +0 -7
  251. package/modules/Root/stories/SampleContent.js +0 -44
@@ -23,10 +23,10 @@ var CalendarBase = function (props) {
23
23
  return (React.createElement("div", { className: props.className },
24
24
  React.createElement(YearSelector, { year: props.year, onChange: props.onChangeYear }),
25
25
  React.createElement(Months, null, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11].map(function (month) {
26
- var $start = props.start && props.start.getFullYear() == props.year && props.start.getMonth() == month;
27
- var $end = props.end && props.end.getFullYear() == props.year && props.end.getMonth() == month;
28
- var $between = props.start && props.start.getFullYear() * 12 + props.start.getMonth() < props.year * 12 + month &&
29
- props.end && props.end.getFullYear() * 12 + props.end.getMonth() > props.year * 12 + month;
26
+ var $start = !!(props.start && props.start.getFullYear() == props.year && props.start.getMonth() == month);
27
+ var $end = !!(props.end && props.end.getFullYear() == props.year && props.end.getMonth() == month);
28
+ var $between = !!(props.start && props.start.getFullYear() * 12 + props.start.getMonth() < props.year * 12 + month &&
29
+ props.end && props.end.getFullYear() * 12 + props.end.getMonth() > props.year * 12 + month);
30
30
  var $length = (props.start && props.end) ?
31
31
  (props.end.getFullYear() * 12 + props.end.getMonth()) - (props.start.getFullYear() * 12 + props.start.getMonth())
32
32
  : 0;
@@ -35,11 +35,8 @@ var CalendarBase = function (props) {
35
35
  };
36
36
  var CalendarStyled = styled(CalendarBase)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n padding: 12px 16px 12px 16px;\n user-select: none;\n"], ["\n padding: 12px 16px 12px 16px;\n user-select: none;\n"])));
37
37
  var Months = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n display: grid;\n grid-template-columns: repeat(4, 40px);\n grid-template-rows: repeat(3, 40px);\n row-gap: 4px;\n"], ["\n display: grid;\n grid-template-columns: repeat(4, 40px);\n grid-template-rows: repeat(3, 40px);\n row-gap: 4px;\n"])));
38
- var Month = styled.div.attrs(function (p) {
39
- return {
40
- r: "50%" // Border radius one-time definition
41
- };
42
- })(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n position: relative;\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: ", ";\n\n // Set backgrounds and border radii.\n // Note: $between is neither start nor end, but between them.\n ", "\n ", " \n ", "\n ", "\n\n // Hover effect only on unselected months.\n ", "\n"], ["\n position: relative;\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: ", ";\n\n // Set backgrounds and border radii.\n // Note: $between is neither start nor end, but between them.\n ", "\n ", " \n ", "\n ", "\n\n // Hover effect only on unselected months.\n ", "\n"])), function (p) { return p.r; }, function (p) { return (p.$between || p.$start || p.$end) && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n "], ["\n background-color: ", ";\n color: ", ";\n "])), function (p) { return p.theme.colors.neutral[30]; }, function (p) { return p.theme.colors.neutral[100]; }); }, function (p) { return p.$between && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border-radius: 0px;\n "], ["\n border-radius: 0px;\n "]))); }, function (p) { return p.$start && css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n "], ["\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n "])), p.r, p.r, p.$length ? 0 : p.r, p.$length ? 0 : p.r); }, function (p) { return p.$end && css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", "; \n "], ["\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", "; \n "])), p.r, p.r, p.$length ? 0 : p.r, p.$length ? 0 : p.r); }, function (p) { return (!p.$between && !p.$start && !p.$end) && css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n &:hover {\n background-color: rgb(from ", " r g b / 30%);\n }\n "], ["\n &:hover {\n background-color: rgb(from ", " r g b / 30%);\n }\n "])), function (p) { return p.theme.colors.primary[1]; }); });
38
+ var RADIUS = "50%";
39
+ var Month = styled.div(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n position: relative;\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: ", ";\n\n // Set backgrounds and border radii.\n // Note: $between is neither start nor end, but between them.\n ", "\n ", " \n ", "\n ", "\n\n // Hover effect only on unselected months.\n ", "\n"], ["\n position: relative;\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: ", ";\n\n // Set backgrounds and border radii.\n // Note: $between is neither start nor end, but between them.\n ", "\n ", " \n ", "\n ", "\n\n // Hover effect only on unselected months.\n ", "\n"])), RADIUS, function (p) { return (p.$between || p.$start || p.$end) && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n "], ["\n background-color: ", ";\n color: ", ";\n "])), function (p) { return p.theme.colors.neutral[30]; }, function (p) { return p.theme.colors.neutral[100]; }); }, function (p) { return p.$between && css(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n border-radius: 0px;\n "], ["\n border-radius: 0px;\n "]))); }, function (p) { return p.$start && css(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n "], ["\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n "])), RADIUS, RADIUS, p.$length ? 0 : RADIUS, p.$length ? 0 : RADIUS); }, function (p) { return p.$end && css(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n "], ["\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n "])), RADIUS, RADIUS, p.$length ? 0 : RADIUS, p.$length ? 0 : RADIUS); }, function (p) { return (!p.$between && !p.$start && !p.$end) && css(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n &:hover {\n background-color: rgb(from ", " r g b / 30%);\n }\n "], ["\n &:hover {\n background-color: rgb(from ", " r g b / 30%);\n }\n "])), function (p) { return p.theme.colors.primary[1]; }); });
43
40
  var Calendar = function (props) { return React.createElement(CalendarStyled, __assign({}, props)); };
44
41
  export { Calendar };
45
42
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7, templateObject_8;
@@ -61,9 +61,15 @@ interface IMonthRangeProps extends ITestable {
61
61
  */
62
62
  onChange?: (value: [Date, Date] | null) => void;
63
63
  /**
64
- * Listeners are notified when the `MonthRange` receives focus.
64
+ * Listeners are notified when the `MonthRange` receives focus (from outside
65
+ * the component; internal focus moves do not re-fire it).
65
66
  */
66
67
  onFocus?: () => void;
68
+ /**
69
+ * Optional inline styles applied to the outer element, for one-off overrides
70
+ * of the default styling.
71
+ */
72
+ style?: React.CSSProperties;
67
73
  }
68
74
  /**
69
75
  * A `MonthRange` allows a selection of a time period, measured in months.
@@ -32,10 +32,11 @@ import { Selector } from './Selector';
32
32
  import { Body } from './Body';
33
33
  import { useOutsideClose } from '../../hooks/useOutsideClose';
34
34
  var MonthRangeBase = function (props) {
35
+ var _a;
35
36
  var wrapperRef = React.useRef(null);
36
37
  var bodyRef = React.useRef(null);
37
- var _a = React.useState(props.value), value = _a[0], setValue = _a[1];
38
- var _b = React.useState(false), open = _b[0], setOpen = _b[1];
38
+ var _b = React.useState((_a = props.value) !== null && _a !== void 0 ? _a : null), value = _b[0], setValue = _b[1];
39
+ var _c = React.useState(false), open = _c[0], setOpen = _c[1];
39
40
  useOutsideClose({
40
41
  open: open,
41
42
  refs: [wrapperRef, bodyRef],
@@ -69,7 +70,14 @@ var MonthRangeBase = function (props) {
69
70
  if (e.key == 'Escape' && open)
70
71
  setOpen(false);
71
72
  };
72
- var _c = usePopper(wrapperRef.current, bodyRef.current, {
73
+ var handleFocus = function (e) {
74
+ if (!props.onFocus)
75
+ return;
76
+ // Only notify when focus enters from outside the component.
77
+ if (!e.currentTarget.contains(e.relatedTarget))
78
+ props.onFocus();
79
+ };
80
+ var _d = usePopper(wrapperRef.current, bodyRef.current, {
73
81
  placement: props.direction == 'down' ? 'bottom-start' : 'top-start',
74
82
  modifiers: [
75
83
  {
@@ -79,9 +87,9 @@ var MonthRangeBase = function (props) {
79
87
  },
80
88
  }
81
89
  ]
82
- }), styles = _c.styles, attributes = _c.attributes, update = _c.update;
83
- return (React.createElement("div", { "data-testid": props['data-testid'] || "MonthRange", tabIndex: -1, className: props.className, onKeyDown: handleKeyDown, ref: wrapperRef },
84
- React.createElement(Selector, { value: value, disabled: props.disabled, ghost: props.ghost, transparent: props.transparent, error: props.error, clearable: props.clearable, placeholder: props.placeholder, count: props.count, onClear: (!props.disabled && props.clearable && value != null) ? function () { return handleSelect(null); } : null, onCalendar: handleToggle }),
90
+ }), styles = _d.styles, attributes = _d.attributes, update = _d.update;
91
+ return (React.createElement("div", { "data-testid": props['data-testid'] || "MonthRange", tabIndex: -1, className: props.className, style: props.style, onKeyDown: handleKeyDown, onFocus: handleFocus, ref: wrapperRef },
92
+ React.createElement(Selector, { value: value, disabled: props.disabled, ghost: props.ghost, transparent: props.transparent, error: props.error, clearable: props.clearable, placeholder: props.placeholder, count: props.count, onClear: (!props.disabled && props.clearable && value != null) ? function () { return handleSelect(null); } : undefined, onCalendar: handleToggle }),
85
93
  createPortal(React.createElement(Body, { ref: bodyRef, value: value, open: open, transparent: props.transparent, onSelect: handleSelect, styles: styles, attributes: attributes }), document.body)));
86
94
  };
87
95
  var MonthRangeStyled = styled(MonthRangeBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n // MonthRange has a minimum width.\n width: 250px;\n // A fluid MonthRange occupies full horizontal width.\n ", " \n"], ["\n position: relative;\n // MonthRange has a minimum width.\n width: 250px;\n // A fluid MonthRange occupies full horizontal width.\n ", " \n"
@@ -5,7 +5,7 @@ interface IProps {
5
5
  /**
6
6
  * Current input value.
7
7
  */
8
- value: [Date, Date];
8
+ value: [Date, Date] | null;
9
9
  /**
10
10
  * Marks input as disabled. Disabled inputs cannot be interacted with.
11
11
  * @default false
@@ -20,40 +20,41 @@ var Selector = function (props) {
20
20
  return (d2.getFullYear() * 12 + d2.getMonth()) - (d1.getFullYear() * 12 + d1.getMonth()) + 1;
21
21
  };
22
22
  var renderDates = function () {
23
+ var value = props.value;
23
24
  // No selection?
24
- if (!hasValue())
25
+ if (value == null || !Array.isArray(value) || value.length != 2 || value[0] == null || value[1] == null)
25
26
  return React.createElement(React.Fragment, null,
26
27
  props.placeholder,
27
28
  "\u00A0");
28
29
  // Same year?
29
- if (props.value[0].getFullYear() == props.value[1].getFullYear()) {
30
+ if (value[0].getFullYear() == value[1].getFullYear()) {
30
31
  // Same month?
31
- if (props.value[0].getMonth() == props.value[1].getMonth()) {
32
+ if (value[0].getMonth() == value[1].getMonth()) {
32
33
  return React.createElement(React.Fragment, null,
33
- React.createElement(DateTimeFormatter, { type: "month", value: props.value[0] }));
34
+ React.createElement(DateTimeFormatter, { type: "month", value: value[0] }));
34
35
  }
35
36
  else {
36
37
  return React.createElement(React.Fragment, null,
37
- React.createElement(DateTimeFormatter, { type: "month", value: props.value[0] }),
38
+ React.createElement(DateTimeFormatter, { type: "month", value: value[0] }),
38
39
  " - ",
39
- React.createElement(DateTimeFormatter, { type: "month", value: props.value[1] }),
40
+ React.createElement(DateTimeFormatter, { type: "month", value: value[1] }),
40
41
  props.count && React.createElement("span", null,
41
42
  " (",
42
- monthsDiff(props.value[0], props.value[1]),
43
+ monthsDiff(value[0], value[1]),
43
44
  "m)"));
44
45
  }
45
46
  }
46
47
  // Different years:
47
48
  return React.createElement(React.Fragment, null,
48
- React.createElement(DateTimeFormatter, { type: "month", value: props.value[0] }),
49
+ React.createElement(DateTimeFormatter, { type: "month", value: value[0] }),
49
50
  " - ",
50
- React.createElement(DateTimeFormatter, { type: "month", value: props.value[1] }),
51
+ React.createElement(DateTimeFormatter, { type: "month", value: value[1] }),
51
52
  props.count && React.createElement("span", null,
52
53
  " (",
53
- monthsDiff(props.value[0], props.value[1]),
54
+ monthsDiff(value[0], value[1]),
54
55
  "m)"));
55
56
  };
56
- return (React.createElement(InputWrapper, { fluid: true, error: props.error, disabled: props.disabled, ghost: props.ghost, transparent: props.transparent, onClear: (props.clearable && hasValue()) ? props.onClear : null, onClick: props.onCalendar, icon: { url: SVG.Icons.Calendar, color: theme.colors.primary[3] }, iconPosition: 'right' },
57
+ return (React.createElement(InputWrapper, { fluid: true, error: props.error, disabled: props.disabled, ghost: props.ghost, transparent: props.transparent, onClear: (props.clearable && hasValue()) ? props.onClear : undefined, onClick: props.onCalendar, icon: { url: SVG.Icons.Calendar, color: theme.colors.primary[3] }, iconPosition: 'right' },
57
58
  React.createElement(Selection, { "$placeholder": !hasValue() }, renderDates())));
58
59
  };
59
60
  var Selection = styled.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n width: 100%;\n outline: none;\n overflow-x: hidden;\n overflow-y: hidden;\n white-space: nowrap;\n ", " \n"], ["\n width: 100%;\n outline: none;\n overflow-x: hidden;\n overflow-y: hidden;\n white-space: nowrap;\n ", " \n"])), function (p) { return p.$placeholder && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n color: rgb(from ", " r g b / 50%);\n "], ["\n color: rgb(from ", " r g b / 50%);\n "])), function (p) { return p.theme.colors.primary[3]; }); });
@@ -65,6 +65,11 @@ interface IPhoneInputProps extends ITestable {
65
65
  * @default en
66
66
  */
67
67
  locale?: string;
68
+ /**
69
+ * Optional inline styles applied to the outer element, for one-off overrides
70
+ * of the default styling.
71
+ */
72
+ style?: React.CSSProperties;
68
73
  }
69
74
  /**
70
75
  * A phone-number input: a searchable country dropdown that supplies the
@@ -40,7 +40,7 @@ var strip = function (s) { return s.normalize('NFD').replace(/[̀-ͯ]/g, '').toL
40
40
  * ```
41
41
  */
42
42
  var PhoneInput = function (props) {
43
- var value = props.value, onChange = props.onChange, _a = props.defaultCountry, defaultCountry = _a === void 0 ? 'US' : _a, clearable = props.clearable, locale = props.locale, placeholder = props.placeholder, disabled = props.disabled, error = props.error, fluid = props.fluid, transparent = props.transparent, ghost = props.ghost, className = props.className, name = props.name;
43
+ var value = props.value, onChange = props.onChange, _a = props.defaultCountry, defaultCountry = _a === void 0 ? 'US' : _a, clearable = props.clearable, locale = props.locale, placeholder = props.placeholder, disabled = props.disabled, error = props.error, fluid = props.fluid, transparent = props.transparent, ghost = props.ghost, className = props.className, name = props.name, style = props.style;
44
44
  var _b = React.useState(function () { var _a; return (_a = parseE164(value).iso) !== null && _a !== void 0 ? _a : defaultCountry; }), iso = _b[0], setIso = _b[1];
45
45
  var _c = React.useState(function () { return parseE164(value).national; }), national = _c[0], setNational = _c[1];
46
46
  var _d = React.useState(''), query = _d[0], setQuery = _d[1];
@@ -86,7 +86,7 @@ var PhoneInput = function (props) {
86
86
  // Stop clicks bubbling to the Form.Field box wrapper. That wrapper routes
87
87
  // any click to the first child with tabIndex=0 (the Dropdown), which would
88
88
  // otherwise hijack clicks on the number field and force the dropdown open.
89
- React.createElement(Wrapper, { "$fluid": fluid, className: className, "data-testid": props['data-testid'], onClick: function (e) { return e.stopPropagation(); } },
89
+ React.createElement(Wrapper, { "$fluid": fluid, className: className, style: style, "data-testid": props['data-testid'] || "PhoneInput", onClick: function (e) { return e.stopPropagation(); } },
90
90
  React.createElement(Prefix, null,
91
91
  React.createElement(Dropdown, { data: data, value: iso, onChange: handleCountry, onSearch: setQuery, disabled: disabled, error: error, ghost: ghost, transparent: transparent, fluid: true, maxItems: 8, label: function (c) { return (React.createElement(Selected, null,
92
92
  React.createElement(SelectedCountry, null,
@@ -26,6 +26,11 @@ interface IProps extends ISelectorProps, ITestable {
26
26
  * If set, checkbox has a dark label.
27
27
  */
28
28
  dark?: boolean;
29
+ /**
30
+ * Optional inline styles applied to the outer element, for one-off overrides
31
+ * of the default styling.
32
+ */
33
+ style?: React.CSSProperties;
29
34
  }
30
35
  /**
31
36
  * A Selector can be used to create either a HTML checkbox or a HTML radio button.
@@ -30,9 +30,12 @@ import { Checkbox } from './widgets/Checkbox';
30
30
  import { Toggle } from './widgets/Toggle';
31
31
  import { Circle } from './widgets/Circle';
32
32
  var SelectorBase = function (props) {
33
+ // Holds a boolean for checkboxes, or the selected value for radios.
33
34
  var _a = React.useState(props.checked), checked = _a[0], setChecked = _a[1];
34
35
  var inputRef = React.useRef(null);
35
36
  React.useEffect(function () {
37
+ if (!inputRef.current)
38
+ return;
36
39
  if (props.indeterminate === true)
37
40
  inputRef.current.indeterminate = true;
38
41
  if (props.indeterminate === false)
@@ -61,7 +64,7 @@ var SelectorBase = function (props) {
61
64
  default: return React.createElement(Checkbox, __assign({}, otherProps));
62
65
  }
63
66
  };
64
- return (React.createElement("label", { "data-testid": props['data-testid'] || "Selector", className: props.className },
67
+ return (React.createElement("label", { "data-testid": props['data-testid'] || "Selector", className: props.className, style: props.style },
65
68
  React.createElement("input", { ref: inputRef, name: props.name, type: props.radio ? "radio" : "checkbox", value: props.value === null ? undefined : props.value, checked: checked === null ? false : checked, disabled: props.disabled, onChange: handleChange }),
66
69
  getWidget(),
67
70
  React.createElement("span", null, props.label)));
@@ -4,80 +4,133 @@ interface ISliderProps extends ITestable {
4
4
  /** @ignore */
5
5
  className?: string;
6
6
  /**
7
- * Current value.
7
+ * Current (controlled) value. Values outside `min`..`max` are clamped, and
8
+ * snapped to the nearest tick when `snapToTicks` is set. Changing this prop
9
+ * repositions the knob.
10
+ * @default min
8
11
  */
9
12
  value?: number;
10
13
  /**
11
- * If set, `Slider` will fill all horizontal space available to it.
14
+ * If set, `Slider` fills all horizontal space available to it. Otherwise the
15
+ * control has a fixed minimum width of 200px.
12
16
  * @default false
13
17
  */
14
18
  fluid?: boolean;
15
19
  /**
16
- * Minimum value.
20
+ * Minimum value, mapped to the left end of the track.
17
21
  * @default 0
18
22
  */
19
23
  min?: number;
20
24
  /**
21
- * Maximum value.
25
+ * Maximum value, mapped to the right end of the track.
22
26
  * @default 100
23
27
  */
24
28
  max?: number;
25
29
  /**
26
- * If set, `onChange` is called continuously while the slide is being moved.
27
- * If not, `onChange` is called only when the slider is released.
30
+ * If set, `onChange` fires continuously while the knob is being dragged.
31
+ * If not, `onChange` fires only once, when the knob is released.
32
+ * Keyboard changes always notify regardless of this setting.
28
33
  * @default false
29
34
  */
30
35
  immediate?: boolean;
31
36
  /**
32
- * Sets the value change when an arrow key is pressed. If omitted,
33
- * `delta` will be 10% of the value range.
37
+ * Amount the value changes for a single arrow-key press. `PageUp`/`PageDown`
38
+ * move by three times this amount. If omitted, `delta` defaults to 10% of
39
+ * the value range (`max - min`). Ignored when `snapToTicks` is set, in which
40
+ * case each key press moves one tick.
34
41
  */
35
42
  delta?: number;
36
43
  /**
37
- * Should ticks be displayed? If so, how many?
44
+ * Number of evenly spaced ticks to render along the track. Ticks are also
45
+ * used as snap points when `snapToTicks` is set. `0` or `1` disables ticks.
38
46
  * @default 0
39
47
  */
40
48
  ticks?: number;
41
49
  /**
42
- * If set, ticks are hidden.
50
+ * If set, ticks are not rendered even when `ticks` is greater than zero.
51
+ * Snapping (`snapToTicks`) still uses the tick positions.
52
+ * @default false
43
53
  */
44
54
  hideTicks?: boolean;
45
55
  /**
46
- * Should the control snap to ticks (if present)?
56
+ * If set, the value snaps to the nearest tick while dragging and on keyboard
57
+ * input. Has no effect unless `ticks` is greater than 1.
47
58
  * @default false
48
59
  */
49
60
  snapToTicks?: boolean;
50
61
  /**
51
- * A disabled `Slider` cannot be interacted with.
62
+ * A disabled `Slider` is greyed out and cannot be interacted with.
63
+ * @default false
52
64
  */
53
65
  disabled?: boolean;
54
66
  /**
55
- * Adds left and right padding.
67
+ * Adds horizontal (left and right) padding so the knob and value tooltip are
68
+ * not clipped at the extremes of the track.
69
+ * @default false
56
70
  */
57
71
  padded?: boolean;
58
72
  /**
59
- * A `Slider` can be in an `error` state.
73
+ * Shows the `Slider` in an error state (track, fill and knob turn red).
74
+ * @default false
60
75
  */
61
76
  error?: boolean;
62
77
  /**
63
- * Custom text color
78
+ * Custom color for the value label shown in the knob's teardrop. Defaults to
79
+ * the theme's primary color.
64
80
  */
65
81
  color?: string;
66
82
  /**
67
- * An optional formatter that takes the current slider value (a number)
68
- * and returns a string. This can be used to divide values by 100,
69
- * for example.
83
+ * Optional formatter that takes the current value (a number) and returns the
84
+ * string shown in the knob's teardrop tooltip and exposed as the ARIA value
85
+ * text. Useful to add units or rescale — e.g. dividing by 100 to show a
86
+ * fraction, or appending `"%"` or `"px"`.
70
87
  */
71
88
  formatter?: (value: number) => string;
72
89
  /**
73
- * Event is triggered when slider's value changes.
90
+ * Called with the new value when it changes. Fires on release by default, or
91
+ * continuously during a drag when `immediate` is set; keyboard changes always
92
+ * notify.
74
93
  */
75
94
  onChange?: (value: number) => void;
95
+ /**
96
+ * Optional inline styles applied to the outer element, for one-off overrides
97
+ * of the default styling.
98
+ */
99
+ style?: React.CSSProperties;
76
100
  }
77
101
  /**
78
- * Sliders allow users to view and select a value (or range) along a track.
79
- * They're ideal for adjusting settings such as volume and brightness, or for
80
- * applying image filters.
102
+ * A `Slider` lets users view and pick a single numeric value along a horizontal
103
+ * track by dragging the knob or using the keyboard. It's ideal for adjusting
104
+ * settings such as volume or brightness, or for applying image filters.
105
+ *
106
+ * The value is bounded by `min`/`max` (default `0`..`100`) and can optionally
107
+ * snap to evenly spaced `ticks`. A `formatter` controls how the value is
108
+ * rendered in the knob's tooltip. By default `onChange` fires once, on release;
109
+ * set `immediate` to be notified continuously while dragging.
110
+ *
111
+ * The control is keyboard-accessible: arrow keys move by `delta`,
112
+ * `PageUp`/`PageDown` move by three times `delta`, and `Home`/`End` jump to the
113
+ * minimum/maximum. It exposes the `role="slider"` ARIA contract, keeping
114
+ * `aria-valuenow`/`aria-valuetext` in sync as the value changes.
115
+ *
116
+ * ## Usage
117
+ *
118
+ * ```tsx
119
+ * // Basic, controlled
120
+ * <Slider value={volume} onChange={setVolume}/>
121
+ *
122
+ * // Custom range, notified while dragging
123
+ * <Slider min={0} max={10} value={rating} immediate onChange={setRating}/>
124
+ *
125
+ * // Ticks with snapping and a formatted tooltip
126
+ * <Slider
127
+ * ticks={5}
128
+ * snapToTicks
129
+ * value={amount}
130
+ * formatter={v => `${v}%`}
131
+ * onChange={setAmount}
132
+ * />
133
+ * ```
81
134
  */
82
135
  declare const Slider: {
83
136
  ({ min, max, fluid, ...props }: ISliderProps): React.JSX.Element;
@@ -26,11 +26,20 @@ var __rest = (this && this.__rest) || function (s, e) {
26
26
  };
27
27
  import * as React from 'react';
28
28
  import styled, { css, keyframes } from 'styled-components';
29
+ // Default value range, shared by the base and the export wrapper.
30
+ var DEFAULT_MIN = 0;
31
+ var DEFAULT_MAX = 100;
29
32
  var SliderBase = function (props) {
33
+ var _a, _b, _c, _d;
34
+ // Defaults supplied by the export wrapper below.
35
+ var min = (_a = props.min) !== null && _a !== void 0 ? _a : DEFAULT_MIN;
36
+ var max = (_b = props.max) !== null && _b !== void 0 ? _b : DEFAULT_MAX;
30
37
  // Current value. This is not the same as props.value: it is the value
31
38
  // while the knob is being dragged. Upon release, this value is called back
32
39
  // with onChange. Or continuously, if `immediate` is set.
33
- var value = React.useRef(props.value);
40
+ var value = React.useRef((_c = props.value) !== null && _c !== void 0 ? _c : min);
41
+ // Reference: outer (focusable) element, used to keep ARIA value in sync.
42
+ var wrapperRef = React.useRef(null);
34
43
  // Reference: track body
35
44
  var trackRef = React.useRef(null);
36
45
  // Reference: track fill.
@@ -54,20 +63,29 @@ var SliderBase = function (props) {
54
63
  if (!props.ticks || props.ticks <= 1)
55
64
  return value;
56
65
  // If ticks are present, then clamp x-position to ticks:
57
- var section = (props.max - props.min) / (props.ticks - 1);
58
- return Math.round((value - props.min) / section) * section + props.min;
66
+ var section = (max - min) / (props.ticks - 1);
67
+ return Math.round((value - min) / section) * section + min;
59
68
  };
60
69
  //
61
70
  // Change current value. If notify is set, also call onChange.
62
71
  //
63
72
  var setValue = function (v, notify) {
64
- value.current = Math.round(snapToTicks(clamp(v, props.min, props.max)));
73
+ value.current = Math.round(snapToTicks(clamp(v, min, max)));
65
74
  // Calculate position in 0..1 range:
66
- var pos = (value.current - props.min) / (props.max - props.min);
75
+ var pos = (value.current - min) / (max - min);
67
76
  // Set knob position as a percentage:
68
- knobRef.current.style.left = "".concat(pos * 100, "%");
69
- trackFillRef.current.style.width = "".concat(pos * 100, "%");
70
- tearValueRef.current.textContent = props.formatter ? props.formatter(value.current) : value.current.toString();
77
+ if (knobRef.current)
78
+ knobRef.current.style.left = "".concat(pos * 100, "%");
79
+ if (trackFillRef.current)
80
+ trackFillRef.current.style.width = "".concat(pos * 100, "%");
81
+ if (tearValueRef.current)
82
+ tearValueRef.current.textContent = props.formatter ? props.formatter(value.current) : value.current.toString();
83
+ // Keep the ARIA value in sync (the control updates imperatively while dragging).
84
+ if (wrapperRef.current) {
85
+ wrapperRef.current.setAttribute('aria-valuenow', String(value.current));
86
+ if (props.formatter)
87
+ wrapperRef.current.setAttribute('aria-valuetext', props.formatter(value.current));
88
+ }
71
89
  if (notify && props.onChange)
72
90
  props.onChange(value.current);
73
91
  };
@@ -75,17 +93,18 @@ var SliderBase = function (props) {
75
93
  var getDelta = function () {
76
94
  // If ticks are present and snapToTicks is on, then snap to ticks:
77
95
  if (props.snapToTicks && props.ticks && props.ticks > 1) {
78
- return (props.max - props.min) / (props.ticks - 1);
96
+ return (max - min) / (props.ticks - 1);
79
97
  }
80
98
  // If a custom delta was specified, use it:
81
99
  if (props.delta)
82
100
  return props.delta;
83
101
  // If no custom delta was specified, then use 10% of value range:
84
- return (props.max - props.min) / 10;
102
+ return (max - min) / 10;
85
103
  };
86
104
  // When the value or the range changes, reposition the knob.
87
105
  React.useEffect(function () {
88
- setValue(props.value);
106
+ var _a;
107
+ setValue((_a = props.value) !== null && _a !== void 0 ? _a : min);
89
108
  }, [props.value, props.min, props.max, props.ticks, props.snapToTicks]);
90
109
  // Mouseup and mousemove and document-wide events. They are only relevant
91
110
  // when dragging is on.
@@ -98,11 +117,13 @@ var SliderBase = function (props) {
98
117
  };
99
118
  });
100
119
  var handleMouseEvent = function (clientX) {
120
+ if (!trackRef.current)
121
+ return;
101
122
  var rect = trackRef.current.getBoundingClientRect();
102
123
  // Calculate x-position in range 0..1:
103
124
  var x = clamp((clientX - rect.left) / trackRef.current.offsetWidth, 0, 1);
104
125
  // Derive value from x-position:
105
- var v = Math.round((props.max - props.min) * x + props.min);
126
+ var v = Math.round((max - min) * x + min);
106
127
  // Set new value. If props.immediate, then call onChange immediately.
107
128
  setValue(v, props.immediate);
108
129
  };
@@ -126,6 +147,9 @@ var SliderBase = function (props) {
126
147
  }
127
148
  };
128
149
  var handleKeyDown = function (e) {
150
+ // Prevent the page from scrolling on keys the slider consumes.
151
+ if (['ArrowLeft', 'ArrowRight', 'Home', 'End', 'PageUp', 'PageDown'].includes(e.key))
152
+ e.preventDefault();
129
153
  switch (e.key) {
130
154
  case 'ArrowLeft':
131
155
  setValue(value.current - getDelta(), true);
@@ -135,11 +159,11 @@ var SliderBase = function (props) {
135
159
  break;
136
160
  // Home moves to minimum:
137
161
  case "Home":
138
- setValue(props.min, true);
162
+ setValue(min, true);
139
163
  break;
140
164
  // End moves to maximum.
141
165
  case "End":
142
- setValue(props.max, true);
166
+ setValue(max, true);
143
167
  break;
144
168
  // PageUp/PageDown take 3x size steps:
145
169
  case "PageUp":
@@ -154,7 +178,7 @@ var SliderBase = function (props) {
154
178
  // Create a number of ticks and return them.
155
179
  return Array(props.ticks).fill(0).map(function (t, idx) { return React.createElement(Tick, { key: idx }); });
156
180
  };
157
- return (React.createElement("div", { "data-testid": props['data-testid'] || "Slider", className: props.className, onMouseDown: handleMouseDown, onKeyDown: handleKeyDown, tabIndex: 0 },
181
+ return (React.createElement("div", { "data-testid": props['data-testid'] || "Slider", className: props.className, style: props.style, onMouseDown: handleMouseDown, onKeyDown: handleKeyDown, tabIndex: 0, ref: wrapperRef, role: "slider", "aria-orientation": "horizontal", "aria-valuemin": min, "aria-valuemax": max, "aria-valuenow": (_d = props.value) !== null && _d !== void 0 ? _d : min, "aria-disabled": props.disabled },
158
182
  React.createElement(Track, { ref: trackRef },
159
183
  React.createElement(TrackFill, { "$disabled": props.disabled, "$error": props.error, ref: trackFillRef }),
160
184
  props.ticks && props.hideTicks != true && renderTicks(),
@@ -179,18 +203,76 @@ var TrackFill = styled.div(templateObject_16 || (templateObject_16 = __makeTempl
179
203
  var Track = styled.div(templateObject_17 || (templateObject_17 = __makeTemplateObject(["\n position: relative;\n height: 4px;\n border-radius: 2px;\n box-sizing: border-box;\n background-color: ", ";\n\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n padding-top: 1px;\n padding-left: 2px;\n padding-right: 2px;\n"], ["\n position: relative;\n height: 4px;\n border-radius: 2px;\n box-sizing: border-box;\n background-color: ", ";\n\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n padding-top: 1px;\n padding-left: 2px;\n padding-right: 2px;\n"])), function (p) { return p.theme.colors.primary[5]; });
180
204
  var SliderStyled = styled(SliderBase)(templateObject_21 || (templateObject_21 = __makeTemplateObject(["\n position: relative;\n min-width: ", ";\n box-sizing: border-box;\n // Padding above and below to capture mouse-down\n padding-top: 52px;\n padding-bottom: 14px;\n ", "\n cursor: ", ";\n user-select: none;\n outline: none;\n ", "\n\n ", "\n"], ["\n position: relative;\n min-width: ", ";\n box-sizing: border-box;\n // Padding above and below to capture mouse-down\n padding-top: 52px;\n padding-bottom: 14px;\n ", "\n cursor: ", ";\n user-select: none;\n outline: none;\n ", "\n\n ", "\n"
181
205
  /**
182
- * Sliders allow users to view and select a value (or range) along a track.
183
- * They're ideal for adjusting settings such as volume and brightness, or for
184
- * applying image filters.
206
+ * A `Slider` lets users view and pick a single numeric value along a horizontal
207
+ * track by dragging the knob or using the keyboard. It's ideal for adjusting
208
+ * settings such as volume or brightness, or for applying image filters.
209
+ *
210
+ * The value is bounded by `min`/`max` (default `0`..`100`) and can optionally
211
+ * snap to evenly spaced `ticks`. A `formatter` controls how the value is
212
+ * rendered in the knob's tooltip. By default `onChange` fires once, on release;
213
+ * set `immediate` to be notified continuously while dragging.
214
+ *
215
+ * The control is keyboard-accessible: arrow keys move by `delta`,
216
+ * `PageUp`/`PageDown` move by three times `delta`, and `Home`/`End` jump to the
217
+ * minimum/maximum. It exposes the `role="slider"` ARIA contract, keeping
218
+ * `aria-valuenow`/`aria-valuetext` in sync as the value changes.
219
+ *
220
+ * ## Usage
221
+ *
222
+ * ```tsx
223
+ * // Basic, controlled
224
+ * <Slider value={volume} onChange={setVolume}/>
225
+ *
226
+ * // Custom range, notified while dragging
227
+ * <Slider min={0} max={10} value={rating} immediate onChange={setRating}/>
228
+ *
229
+ * // Ticks with snapping and a formatted tooltip
230
+ * <Slider
231
+ * ticks={5}
232
+ * snapToTicks
233
+ * value={amount}
234
+ * formatter={v => `${v}%`}
235
+ * onChange={setAmount}
236
+ * />
237
+ * ```
185
238
  */
186
239
  ])), function (p) { return p.fluid == true ? '100%' : '200px'; }, function (p) { return p.padded && css(templateObject_18 || (templateObject_18 = __makeTemplateObject(["\n padding-left: 20px;\n padding-right: 20px;\n "], ["\n padding-left: 20px;\n padding-right: 20px;\n "]))); }, function (p) { return p.disabled ? 'auto' : 'pointer'; }, function (p) { return p.disabled && css(templateObject_19 || (templateObject_19 = __makeTemplateObject(["\n pointer-events: none;\n "], ["\n pointer-events: none;\n "]))); }, function (p) { return !p.disabled && css(templateObject_20 || (templateObject_20 = __makeTemplateObject(["\n // Focus ring:\n &:focus ", ":before {\n animation: ", " 2s linear infinite;\n }\n\n &:hover ", ":before {\n animation: none;\n opacity: 0.7;\n } \n\n // Active focus ring:\n &:active ", ":before {\n animation: none;\n opacity: 1;\n }\n "], ["\n // Focus ring:\n &:focus ", ":before {\n animation: ", " 2s linear infinite;\n }\n\n &:hover ", ":before {\n animation: none;\n opacity: 0.7;\n } \n\n // Active focus ring:\n &:active ", ":before {\n animation: none;\n opacity: 1;\n }\n "])), Knob, Pulse, Knob, Knob); });
187
240
  /**
188
- * Sliders allow users to view and select a value (or range) along a track.
189
- * They're ideal for adjusting settings such as volume and brightness, or for
190
- * applying image filters.
241
+ * A `Slider` lets users view and pick a single numeric value along a horizontal
242
+ * track by dragging the knob or using the keyboard. It's ideal for adjusting
243
+ * settings such as volume or brightness, or for applying image filters.
244
+ *
245
+ * The value is bounded by `min`/`max` (default `0`..`100`) and can optionally
246
+ * snap to evenly spaced `ticks`. A `formatter` controls how the value is
247
+ * rendered in the knob's tooltip. By default `onChange` fires once, on release;
248
+ * set `immediate` to be notified continuously while dragging.
249
+ *
250
+ * The control is keyboard-accessible: arrow keys move by `delta`,
251
+ * `PageUp`/`PageDown` move by three times `delta`, and `Home`/`End` jump to the
252
+ * minimum/maximum. It exposes the `role="slider"` ARIA contract, keeping
253
+ * `aria-valuenow`/`aria-valuetext` in sync as the value changes.
254
+ *
255
+ * ## Usage
256
+ *
257
+ * ```tsx
258
+ * // Basic, controlled
259
+ * <Slider value={volume} onChange={setVolume}/>
260
+ *
261
+ * // Custom range, notified while dragging
262
+ * <Slider min={0} max={10} value={rating} immediate onChange={setRating}/>
263
+ *
264
+ * // Ticks with snapping and a formatted tooltip
265
+ * <Slider
266
+ * ticks={5}
267
+ * snapToTicks
268
+ * value={amount}
269
+ * formatter={v => `${v}%`}
270
+ * onChange={setAmount}
271
+ * />
272
+ * ```
191
273
  */
192
274
  var Slider = function (_a) {
193
- var _b = _a.min, min = _b === void 0 ? 0 : _b, _c = _a.max, max = _c === void 0 ? 100 : _c, _d = _a.fluid, fluid = _d === void 0 ? false : _d, props = __rest(_a, ["min", "max", "fluid"]);
275
+ var _b = _a.min, min = _b === void 0 ? DEFAULT_MIN : _b, _c = _a.max, max = _c === void 0 ? DEFAULT_MAX : _c, _d = _a.fluid, fluid = _d === void 0 ? false : _d, props = __rest(_a, ["min", "max", "fluid"]);
194
276
  return React.createElement(SliderStyled, __assign({ min: min, max: max, fluid: fluid }, props));
195
277
  };
196
278
  Slider.displayName = 'Slider';
@@ -1,10 +1,5 @@
1
1
  import * as React from 'react';
2
2
  import { ITestable } from '../../Types';
3
- /**
4
- * Textarea validates itself using the HTML validation API whenever its
5
- * content changes. Listeners can use onValidate to obtain the resulting
6
- * ValidityState.
7
- */
8
3
  interface ITextareaProps extends ITestable {
9
4
  /** @ignore */
10
5
  className?: string;
@@ -70,6 +65,11 @@ interface ITextareaProps extends ITestable {
70
65
  * Listeners are notified whenever the user interacts with the Textarea.
71
66
  */
72
67
  onChange?: (value: any) => void;
68
+ /**
69
+ * Optional inline styles applied to the outer element, for one-off overrides
70
+ * of the default styling.
71
+ */
72
+ style?: React.CSSProperties;
73
73
  }
74
74
  /**
75
75
  * `Textarea` encapsulated and styles the `<textarea>` element. Like `Input`,