@itwin/itwinui-react 1.41.0 → 1.43.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/cjs/core/Backdrop/Backdrop.d.ts +10 -0
  3. package/cjs/core/Backdrop/Backdrop.js +41 -0
  4. package/cjs/core/Backdrop/index.d.ts +2 -0
  5. package/cjs/core/Backdrop/index.js +9 -0
  6. package/cjs/core/Breadcrumbs/Breadcrumbs.js +18 -18
  7. package/cjs/core/ButtonGroup/ButtonGroup.js +11 -4
  8. package/cjs/core/ComboBox/ComboBox.js +15 -14
  9. package/cjs/core/Dialog/Dialog.d.ts +41 -0
  10. package/cjs/core/Dialog/Dialog.js +59 -0
  11. package/cjs/core/Dialog/DialogBackdrop.d.ts +12 -0
  12. package/cjs/core/Dialog/DialogBackdrop.js +61 -0
  13. package/cjs/core/Dialog/DialogButtonBar.d.ts +18 -0
  14. package/cjs/core/Dialog/DialogButtonBar.js +50 -0
  15. package/cjs/core/Dialog/DialogContent.d.ts +17 -0
  16. package/cjs/core/Dialog/DialogContent.js +49 -0
  17. package/cjs/core/Dialog/DialogContext.d.ts +39 -0
  18. package/cjs/core/Dialog/DialogContext.js +16 -0
  19. package/cjs/core/Dialog/DialogMain.d.ts +36 -0
  20. package/cjs/core/Dialog/DialogMain.js +120 -0
  21. package/cjs/core/Dialog/DialogTitleBar.d.ts +34 -0
  22. package/cjs/core/Dialog/DialogTitleBar.js +69 -0
  23. package/cjs/core/Dialog/DialogTitleBarTitle.d.ts +15 -0
  24. package/cjs/core/Dialog/DialogTitleBarTitle.js +47 -0
  25. package/cjs/core/Dialog/index.d.ts +8 -0
  26. package/cjs/core/Dialog/index.js +10 -0
  27. package/cjs/core/Footer/Footer.d.ts +16 -2
  28. package/cjs/core/Footer/Footer.js +57 -45
  29. package/cjs/core/Footer/FooterItem.d.ts +8 -0
  30. package/cjs/core/Footer/FooterItem.js +46 -0
  31. package/cjs/core/Footer/FooterList.d.ts +8 -0
  32. package/cjs/core/Footer/FooterList.js +46 -0
  33. package/cjs/core/Footer/FooterSeparator.d.ts +8 -0
  34. package/cjs/core/Footer/FooterSeparator.js +46 -0
  35. package/cjs/core/Footer/index.d.ts +1 -1
  36. package/cjs/core/Footer/index.js +2 -1
  37. package/cjs/core/Modal/Modal.d.ts +4 -14
  38. package/cjs/core/Modal/Modal.js +9 -74
  39. package/cjs/core/Modal/ModalButtonBar.d.ts +1 -2
  40. package/cjs/core/Modal/ModalButtonBar.js +2 -39
  41. package/cjs/core/Modal/ModalContent.d.ts +1 -2
  42. package/cjs/core/Modal/ModalContent.js +2 -39
  43. package/cjs/core/Slider/Slider.d.ts +10 -0
  44. package/cjs/core/Slider/Slider.js +20 -14
  45. package/cjs/core/Slider/Thumb.d.ts +2 -1
  46. package/cjs/core/Slider/Thumb.js +5 -3
  47. package/cjs/core/Slider/Track.d.ts +2 -1
  48. package/cjs/core/Slider/Track.js +23 -4
  49. package/cjs/core/Table/Table.d.ts +24 -0
  50. package/cjs/core/Table/Table.js +12 -4
  51. package/cjs/core/Table/TableRowMemoized.d.ts +2 -0
  52. package/cjs/core/Table/TableRowMemoized.js +2 -2
  53. package/cjs/core/Table/columns/actionColumn.d.ts +8 -3
  54. package/cjs/core/Table/columns/actionColumn.js +33 -2
  55. package/cjs/core/Table/hooks/index.d.ts +1 -0
  56. package/cjs/core/Table/hooks/index.js +3 -1
  57. package/cjs/core/Table/hooks/useScrollToRow.d.ts +11 -0
  58. package/cjs/core/Table/hooks/useScrollToRow.js +49 -0
  59. package/cjs/core/Tree/Tree.d.ts +9 -0
  60. package/cjs/core/Tree/Tree.js +67 -19
  61. package/cjs/core/Tree/TreeContext.d.ts +4 -0
  62. package/cjs/core/Tree/TreeNode.js +8 -9
  63. package/cjs/core/Typography/Small/Small.js +1 -1
  64. package/cjs/core/index.d.ts +3 -1
  65. package/cjs/core/index.js +6 -3
  66. package/cjs/core/utils/components/FocusTrap.js +1 -1
  67. package/cjs/core/utils/components/MiddleTextTruncation.js +1 -1
  68. package/cjs/core/utils/hooks/index.d.ts +1 -0
  69. package/cjs/core/utils/hooks/index.js +1 -0
  70. package/cjs/core/utils/hooks/useLatestRef.d.ts +9 -0
  71. package/cjs/core/utils/hooks/useLatestRef.js +26 -0
  72. package/esm/core/Backdrop/Backdrop.d.ts +10 -0
  73. package/esm/core/Backdrop/Backdrop.js +35 -0
  74. package/esm/core/Backdrop/index.d.ts +2 -0
  75. package/esm/core/Backdrop/index.js +5 -0
  76. package/esm/core/Breadcrumbs/Breadcrumbs.js +18 -18
  77. package/esm/core/ButtonGroup/ButtonGroup.js +11 -4
  78. package/esm/core/ComboBox/ComboBox.js +16 -15
  79. package/esm/core/Dialog/Dialog.d.ts +41 -0
  80. package/esm/core/Dialog/Dialog.js +53 -0
  81. package/esm/core/Dialog/DialogBackdrop.d.ts +12 -0
  82. package/esm/core/Dialog/DialogBackdrop.js +55 -0
  83. package/esm/core/Dialog/DialogButtonBar.d.ts +18 -0
  84. package/esm/core/Dialog/DialogButtonBar.js +44 -0
  85. package/esm/core/Dialog/DialogContent.d.ts +17 -0
  86. package/esm/core/Dialog/DialogContent.js +43 -0
  87. package/esm/core/Dialog/DialogContext.d.ts +39 -0
  88. package/esm/core/Dialog/DialogContext.js +9 -0
  89. package/esm/core/Dialog/DialogMain.d.ts +36 -0
  90. package/esm/core/Dialog/DialogMain.js +114 -0
  91. package/esm/core/Dialog/DialogTitleBar.d.ts +34 -0
  92. package/esm/core/Dialog/DialogTitleBar.js +63 -0
  93. package/esm/core/Dialog/DialogTitleBarTitle.d.ts +15 -0
  94. package/esm/core/Dialog/DialogTitleBarTitle.js +41 -0
  95. package/esm/core/Dialog/index.d.ts +8 -0
  96. package/esm/core/Dialog/index.js +6 -0
  97. package/esm/core/Footer/Footer.d.ts +16 -2
  98. package/esm/core/Footer/Footer.js +56 -43
  99. package/esm/core/Footer/FooterItem.d.ts +8 -0
  100. package/esm/core/Footer/FooterItem.js +39 -0
  101. package/esm/core/Footer/FooterList.d.ts +8 -0
  102. package/esm/core/Footer/FooterList.js +39 -0
  103. package/esm/core/Footer/FooterSeparator.d.ts +8 -0
  104. package/esm/core/Footer/FooterSeparator.js +39 -0
  105. package/esm/core/Footer/index.d.ts +1 -1
  106. package/esm/core/Footer/index.js +1 -1
  107. package/esm/core/Modal/Modal.d.ts +4 -14
  108. package/esm/core/Modal/Modal.js +10 -75
  109. package/esm/core/Modal/ModalButtonBar.d.ts +1 -2
  110. package/esm/core/Modal/ModalButtonBar.js +2 -35
  111. package/esm/core/Modal/ModalContent.d.ts +1 -2
  112. package/esm/core/Modal/ModalContent.js +2 -35
  113. package/esm/core/Slider/Slider.d.ts +10 -0
  114. package/esm/core/Slider/Slider.js +20 -14
  115. package/esm/core/Slider/Thumb.d.ts +2 -1
  116. package/esm/core/Slider/Thumb.js +5 -3
  117. package/esm/core/Slider/Track.d.ts +2 -1
  118. package/esm/core/Slider/Track.js +23 -4
  119. package/esm/core/Table/Table.d.ts +24 -0
  120. package/esm/core/Table/Table.js +13 -5
  121. package/esm/core/Table/TableRowMemoized.d.ts +2 -0
  122. package/esm/core/Table/TableRowMemoized.js +2 -2
  123. package/esm/core/Table/columns/actionColumn.d.ts +8 -3
  124. package/esm/core/Table/columns/actionColumn.js +33 -2
  125. package/esm/core/Table/hooks/index.d.ts +1 -0
  126. package/esm/core/Table/hooks/index.js +1 -0
  127. package/esm/core/Table/hooks/useScrollToRow.d.ts +11 -0
  128. package/esm/core/Table/hooks/useScrollToRow.js +42 -0
  129. package/esm/core/Tree/Tree.d.ts +9 -0
  130. package/esm/core/Tree/Tree.js +68 -20
  131. package/esm/core/Tree/TreeContext.d.ts +4 -0
  132. package/esm/core/Tree/TreeNode.js +8 -9
  133. package/esm/core/Typography/Small/Small.js +1 -1
  134. package/esm/core/index.d.ts +3 -1
  135. package/esm/core/index.js +2 -1
  136. package/esm/core/utils/components/FocusTrap.js +1 -1
  137. package/esm/core/utils/components/MiddleTextTruncation.js +1 -1
  138. package/esm/core/utils/hooks/index.d.ts +1 -0
  139. package/esm/core/utils/hooks/index.js +1 -0
  140. package/esm/core/utils/hooks/useLatestRef.d.ts +9 -0
  141. package/esm/core/utils/hooks/useLatestRef.js +19 -0
  142. package/package.json +6 -5
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __rest = (this && this.__rest) || function (s, e) {
14
+ var t = {};
15
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
+ t[p] = s[p];
17
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
+ t[p[i]] = s[p[i]];
21
+ }
22
+ return t;
23
+ };
24
+ var __importDefault = (this && this.__importDefault) || function (mod) {
25
+ return (mod && mod.__esModule) ? mod : { "default": mod };
26
+ };
27
+ Object.defineProperty(exports, "__esModule", { value: true });
28
+ exports.FooterSeparator = void 0;
29
+ /*---------------------------------------------------------------------------------------------
30
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
31
+ * See LICENSE.md in the project root for license terms and full copyright notice.
32
+ *--------------------------------------------------------------------------------------------*/
33
+ var react_1 = __importDefault(require("react"));
34
+ var utils_1 = require("../utils");
35
+ var classnames_1 = __importDefault(require("classnames"));
36
+ require("@itwin/itwinui-css/css/footer.css");
37
+ /**
38
+ * Footer separator. Recommended to use inside `Footer.List`.
39
+ */
40
+ var FooterSeparator = function (props) {
41
+ var className = props.className, rest = __rest(props, ["className"]);
42
+ (0, utils_1.useTheme)();
43
+ return (react_1.default.createElement("li", __assign({ className: (0, classnames_1.default)('iui-legal-footer-separator', className), "aria-hidden": true }, rest)));
44
+ };
45
+ exports.FooterSeparator = FooterSeparator;
46
+ exports.default = exports.FooterSeparator;
@@ -1,4 +1,4 @@
1
- export { Footer } from './Footer';
1
+ export { Footer, defaultFooterElements } from './Footer';
2
2
  export type { FooterElement, FooterProps, TitleTranslations } from './Footer';
3
3
  declare const _default: "./Footer";
4
4
  export default _default;
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Footer = void 0;
3
+ exports.defaultFooterElements = exports.Footer = void 0;
4
4
  /*---------------------------------------------------------------------------------------------
5
5
  * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
6
6
  * See LICENSE.md in the project root for license terms and full copyright notice.
7
7
  *--------------------------------------------------------------------------------------------*/
8
8
  var Footer_1 = require("./Footer");
9
9
  Object.defineProperty(exports, "Footer", { enumerable: true, get: function () { return Footer_1.Footer; } });
10
+ Object.defineProperty(exports, "defaultFooterElements", { enumerable: true, get: function () { return Footer_1.defaultFooterElements; } });
10
11
  exports.default = './Footer';
@@ -1,13 +1,8 @@
1
1
  import React from 'react';
2
2
  import { CommonProps } from '../utils';
3
3
  import '@itwin/itwinui-css/css/dialog.css';
4
- import '@itwin/itwinui-css/css/backdrop.css';
4
+ import { DialogMainProps } from '../Dialog';
5
5
  export declare type ModalProps = {
6
- /**
7
- * Flag whether modal should be shown.
8
- * @default false
9
- */
10
- isOpen?: boolean;
11
6
  /**
12
7
  * Modal title.
13
8
  */
@@ -46,16 +41,11 @@ export declare type ModalProps = {
46
41
  * @default document
47
42
  */
48
43
  ownerDocument?: Document;
49
- /**
50
- * Type of the modal.
51
- * @default 'default'
52
- */
53
- styleType?: 'default' | 'fullPage';
54
44
  /**
55
45
  * Content of the modal.
56
46
  */
57
47
  children: React.ReactNode;
58
- } & Omit<CommonProps, 'title'>;
48
+ } & Pick<DialogMainProps, 'isOpen' | 'styleType'> & Omit<CommonProps, 'title'>;
59
49
  /**
60
50
  * Modal component which can wrap any content.
61
51
  * @example
@@ -64,9 +54,9 @@ export declare type ModalProps = {
64
54
  * title='My modal'
65
55
  * onClose={onClose}
66
56
  * >
67
- * <div>
57
+ * <ModalContent>
68
58
  * Here is my modal content
69
- * </div>
59
+ * </ModalContent>
70
60
  * <ModalButtonBar>
71
61
  * <Button styleType='high-visibility'>
72
62
  * Primary button
@@ -32,13 +32,9 @@ exports.Modal = void 0;
32
32
  *--------------------------------------------------------------------------------------------*/
33
33
  var react_1 = __importDefault(require("react"));
34
34
  var react_dom_1 = __importDefault(require("react-dom"));
35
- var classnames_1 = __importDefault(require("classnames"));
36
- var Close_1 = __importDefault(require("@itwin/itwinui-icons-react/cjs/icons/Close"));
37
35
  var utils_1 = require("../utils");
38
36
  require("@itwin/itwinui-css/css/dialog.css");
39
- require("@itwin/itwinui-css/css/backdrop.css");
40
- var IconButton_1 = require("../Buttons/IconButton");
41
- var react_transition_group_1 = require("react-transition-group");
37
+ var Dialog_1 = require("../Dialog");
42
38
  /**
43
39
  * Modal component which can wrap any content.
44
40
  * @example
@@ -47,9 +43,9 @@ var react_transition_group_1 = require("react-transition-group");
47
43
  * title='My modal'
48
44
  * onClose={onClose}
49
45
  * >
50
- * <div>
46
+ * <ModalContent>
51
47
  * Here is my modal content
52
- * </div>
48
+ * </ModalContent>
53
49
  * <ModalButtonBar>
54
50
  * <Button styleType='high-visibility'>
55
51
  * Primary button
@@ -61,75 +57,14 @@ var react_transition_group_1 = require("react-transition-group");
61
57
  * </Modal>
62
58
  */
63
59
  var Modal = function (props) {
64
- var _a = props.isOpen, isOpen = _a === void 0 ? false : _a, _b = props.isDismissible, isDismissible = _b === void 0 ? true : _b, _c = props.closeOnEsc, closeOnEsc = _c === void 0 ? true : _c, _d = props.closeOnExternalClick, closeOnExternalClick = _d === void 0 ? true : _d, onClose = props.onClose, title = props.title, onKeyDown = props.onKeyDown, id = props.id, className = props.className, style = props.style, children = props.children, _e = props.styleType, styleType = _e === void 0 ? 'default' : _e, _f = props.modalRootId, modalRootId = _f === void 0 ? 'iui-react-portal-container' : _f, _g = props.ownerDocument, ownerDocument = _g === void 0 ? (0, utils_1.getDocument)() : _g, rest = __rest(props, ["isOpen", "isDismissible", "closeOnEsc", "closeOnExternalClick", "onClose", "title", "onKeyDown", "id", "className", "style", "children", "styleType", "modalRootId", "ownerDocument"]);
60
+ var _a = props.isOpen, isOpen = _a === void 0 ? false : _a, _b = props.isDismissible, isDismissible = _b === void 0 ? true : _b, _c = props.closeOnEsc, closeOnEsc = _c === void 0 ? true : _c, _d = props.closeOnExternalClick, closeOnExternalClick = _d === void 0 ? true : _d, onClose = props.onClose, title = props.title, children = props.children, _e = props.modalRootId, modalRootId = _e === void 0 ? 'iui-react-portal-container' : _e, _f = props.ownerDocument, ownerDocument = _f === void 0 ? (0, utils_1.getDocument)() : _f, rest = __rest(props, ["isOpen", "isDismissible", "closeOnEsc", "closeOnExternalClick", "onClose", "title", "children", "modalRootId", "ownerDocument"]);
65
61
  (0, utils_1.useTheme)();
66
62
  var container = (0, utils_1.getContainer)(modalRootId, ownerDocument);
67
- var overlayRef = react_1.default.useRef(null);
68
- var originalBodyOverflow = react_1.default.useRef('');
69
- var previousFocusedElement = react_1.default.useRef();
70
- // Give focus to overlay for key handling to work.
71
- react_1.default.useLayoutEffect(function () {
72
- var _a, _b;
73
- if (isOpen) {
74
- previousFocusedElement.current = document.activeElement;
75
- (_a = overlayRef.current) === null || _a === void 0 ? void 0 : _a.focus();
76
- }
77
- else {
78
- (_b = previousFocusedElement.current) === null || _b === void 0 ? void 0 : _b.focus();
79
- }
80
- var modalOverlayRef = overlayRef.current;
81
- return function () {
82
- var _a;
83
- (modalOverlayRef === null || modalOverlayRef === void 0 ? void 0 : modalOverlayRef.contains(document.activeElement)) &&
84
- ((_a = previousFocusedElement.current) === null || _a === void 0 ? void 0 : _a.focus());
85
- };
86
- }, [isOpen]);
87
- react_1.default.useEffect(function () {
88
- if (!ownerDocument) {
89
- return;
90
- }
91
- if (isOpen) {
92
- originalBodyOverflow.current = ownerDocument.body.style.overflow;
93
- ownerDocument.body.style.overflow = 'hidden';
94
- }
95
- else {
96
- ownerDocument.body.style.overflow = originalBodyOverflow.current;
97
- }
98
- return function () {
99
- ownerDocument.body.style.overflow = originalBodyOverflow.current;
100
- };
101
- }, [isOpen, ownerDocument]);
102
- var handleKeyDown = function (event) {
103
- // Prevents React from resetting its properties
104
- event.persist();
105
- if (isDismissible && closeOnEsc && event.key === 'Escape' && onClose) {
106
- onClose(event);
107
- }
108
- if (onKeyDown) {
109
- onKeyDown(event);
110
- }
111
- };
112
- var handleMouseDown = function (event) {
113
- // Prevents React from resetting its properties
114
- event.persist();
115
- if (event.target !== overlayRef.current) {
116
- return;
117
- }
118
- if (isDismissible && closeOnExternalClick && onClose) {
119
- onClose(event);
120
- }
121
- };
122
- return !!container ? (react_dom_1.default.createPortal(react_1.default.createElement(react_1.default.Fragment, null,
123
- react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-backdrop', { 'iui-backdrop-visible': isOpen }), tabIndex: -1, onKeyDown: handleKeyDown, ref: overlayRef, onMouseDown: handleMouseDown }),
124
- react_1.default.createElement(utils_1.FocusTrap, null,
125
- react_1.default.createElement("div", null,
126
- react_1.default.createElement(react_transition_group_1.CSSTransition, { in: isOpen, classNames: 'iui-dialog-animation', timeout: { exit: 600 }, unmountOnExit: true },
127
- react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-dialog', { 'iui-dialog-default': styleType === 'default' }, { 'iui-dialog-full-page': styleType === 'fullPage' }, { 'iui-dialog-visible': isOpen }, className), id: id, style: style, role: 'dialog', "aria-modal": 'true' }, rest),
128
- react_1.default.createElement("div", { className: 'iui-dialog-title-bar' },
129
- react_1.default.createElement("div", { className: 'iui-dialog-title' }, title),
130
- isDismissible && (react_1.default.createElement(IconButton_1.IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close' },
131
- react_1.default.createElement(Close_1.default, null)))),
132
- children))))), container)) : (react_1.default.createElement(react_1.default.Fragment, null));
63
+ return !!container ? (react_dom_1.default.createPortal(react_1.default.createElement(Dialog_1.Dialog, { isOpen: isOpen, closeOnEsc: closeOnEsc, closeOnExternalClick: closeOnExternalClick, isDismissible: isDismissible, onClose: onClose, preventDocumentScroll: true, trapFocus: true },
64
+ react_1.default.createElement(Dialog_1.Dialog.Backdrop, null),
65
+ react_1.default.createElement(Dialog_1.Dialog.Main, __assign({ "aria-modal": true }, rest),
66
+ react_1.default.createElement(Dialog_1.Dialog.TitleBar, { titleText: title }),
67
+ children)), container)) : (react_1.default.createElement(react_1.default.Fragment, null));
133
68
  };
134
69
  exports.Modal = Modal;
135
70
  exports.default = exports.Modal;
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { CommonProps } from '../utils';
3
- import '@itwin/itwinui-css/css/dialog.css';
4
3
  export declare type ModalButtonBarProps = {
5
4
  /**
6
5
  * Buttons in the modal bar.
@@ -10,5 +9,5 @@ export declare type ModalButtonBarProps = {
10
9
  /**
11
10
  * Container for Buttons in modal.
12
11
  */
13
- export declare const ModalButtonBar: (props: ModalButtonBarProps) => JSX.Element;
12
+ export declare const ModalButtonBar: React.ForwardRefExoticComponent<Pick<import("../Dialog/DialogButtonBar").DialogButtonBarProps, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
14
13
  export default ModalButtonBar;
@@ -1,46 +1,9 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
- var __importDefault = (this && this.__importDefault) || function (mod) {
25
- return (mod && mod.__esModule) ? mod : { "default": mod };
26
- };
27
2
  Object.defineProperty(exports, "__esModule", { value: true });
28
3
  exports.ModalButtonBar = void 0;
29
- /*---------------------------------------------------------------------------------------------
30
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
31
- * See LICENSE.md in the project root for license terms and full copyright notice.
32
- *--------------------------------------------------------------------------------------------*/
33
- var react_1 = __importDefault(require("react"));
34
- var classnames_1 = __importDefault(require("classnames"));
35
- var utils_1 = require("../utils");
36
- require("@itwin/itwinui-css/css/dialog.css");
4
+ var DialogButtonBar_1 = require("../Dialog/DialogButtonBar");
37
5
  /**
38
6
  * Container for Buttons in modal.
39
7
  */
40
- var ModalButtonBar = function (props) {
41
- var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
42
- (0, utils_1.useTheme)();
43
- return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-dialog-button-bar', className) }, rest), children));
44
- };
45
- exports.ModalButtonBar = ModalButtonBar;
8
+ exports.ModalButtonBar = DialogButtonBar_1.DialogButtonBar;
46
9
  exports.default = exports.ModalButtonBar;
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
2
  import { CommonProps } from '../utils';
3
- import '@itwin/itwinui-css/css/dialog.css';
4
3
  export declare type ModalContentProps = {
5
4
  /**
6
5
  * Main content in the `Modal`.
@@ -10,5 +9,5 @@ export declare type ModalContentProps = {
10
9
  /**
11
10
  * Container for content in `Modal`.
12
11
  */
13
- export declare const ModalContent: (props: ModalContentProps) => JSX.Element;
12
+ export declare const ModalContent: React.ForwardRefExoticComponent<Pick<import("../Dialog/DialogContent").DialogContentProps, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
14
13
  export default ModalContent;
@@ -1,46 +1,9 @@
1
1
  "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
- var __importDefault = (this && this.__importDefault) || function (mod) {
25
- return (mod && mod.__esModule) ? mod : { "default": mod };
26
- };
27
2
  Object.defineProperty(exports, "__esModule", { value: true });
28
3
  exports.ModalContent = void 0;
29
- /*---------------------------------------------------------------------------------------------
30
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
31
- * See LICENSE.md in the project root for license terms and full copyright notice.
32
- *--------------------------------------------------------------------------------------------*/
33
- var react_1 = __importDefault(require("react"));
34
- var classnames_1 = __importDefault(require("classnames"));
35
- var utils_1 = require("../utils");
36
- require("@itwin/itwinui-css/css/dialog.css");
4
+ var DialogContent_1 = require("../Dialog/DialogContent");
37
5
  /**
38
6
  * Container for content in `Modal`.
39
7
  */
40
- var ModalContent = function (props) {
41
- var children = props.children, className = props.className, rest = __rest(props, ["children", "className"]);
42
- (0, utils_1.useTheme)();
43
- return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('iui-dialog-content', className) }, rest), children));
44
- };
45
- exports.ModalContent = ModalContent;
8
+ exports.ModalContent = DialogContent_1.DialogContent;
46
9
  exports.default = exports.ModalContent;
@@ -96,6 +96,11 @@ export declare type SliderProps = {
96
96
  * high-volume of updates will occur when dragging.
97
97
  */
98
98
  onUpdate?: (values: ReadonlyArray<number>) => void;
99
+ /**
100
+ * The orientation of slider
101
+ * @default 'horizontal'
102
+ */
103
+ orientation?: 'horizontal' | 'vertical';
99
104
  } & Omit<CommonProps, 'title'>;
100
105
  /**
101
106
  * Slider component that display Thumbs for each value specified along a Rail.
@@ -195,5 +200,10 @@ export declare const Slider: React.ForwardRefExoticComponent<{
195
200
  * high-volume of updates will occur when dragging.
196
201
  */
197
202
  onUpdate?: ((values: ReadonlyArray<number>) => void) | undefined;
203
+ /**
204
+ * The orientation of slider
205
+ * @default 'horizontal'
206
+ */
207
+ orientation?: "horizontal" | "vertical" | undefined;
198
208
  } & Omit<CommonProps, "title"> & React.RefAttributes<HTMLDivElement>>;
199
209
  export default Slider;
@@ -45,9 +45,13 @@ var utils_1 = require("../utils");
45
45
  require("@itwin/itwinui-css/css/slider.css");
46
46
  var Track_1 = require("./Track");
47
47
  var Thumb_1 = require("./Thumb");
48
- var getPercentageOfRectangle = function (rect, pointer) {
49
- var position = (0, utils_1.getBoundedValue)(pointer, rect.left, rect.right);
50
- return (position - rect.left) / rect.width;
48
+ var getPercentageOfRectangle = function (rect, pointerX, pointerY, orientation) {
49
+ if (orientation === 'horizontal') {
50
+ var position_1 = (0, utils_1.getBoundedValue)(pointerX, rect.left, rect.right);
51
+ return (position_1 - rect.left) / rect.width;
52
+ }
53
+ var position = (0, utils_1.getBoundedValue)(pointerY, rect.top, rect.bottom);
54
+ return (rect.bottom - position) / rect.height;
51
55
  };
52
56
  var getClosestValueIndex = function (values, pointerValue) {
53
57
  if (1 === values.length) {
@@ -94,20 +98,20 @@ var focusThumb = function (sliderContainer, activeIndex) {
94
98
  */
95
99
  exports.Slider = react_1.default.forwardRef(function (props, ref) {
96
100
  var _a, _b;
97
- var _c = props.min, min = _c === void 0 ? 0 : _c, _d = props.max, max = _d === void 0 ? 100 : _d, values = props.values, _e = props.step, step = _e === void 0 ? 1 : _e, _f = props.setFocus, setFocus = _f === void 0 ? false : _f, tooltipProps = props.tooltipProps, _g = props.disabled, disabled = _g === void 0 ? false : _g, tickLabels = props.tickLabels, minLabel = props.minLabel, maxLabel = props.maxLabel, _h = props.trackDisplayMode, trackDisplayMode = _h === void 0 ? 'auto' : _h, _j = props.thumbMode, thumbMode = _j === void 0 ? 'inhibit-crossing' : _j, onChange = props.onChange, onUpdate = props.onUpdate, thumbProps = props.thumbProps, className = props.className, railContainerProps = props.railContainerProps, rest = __rest(props, ["min", "max", "values", "step", "setFocus", "tooltipProps", "disabled", "tickLabels", "minLabel", "maxLabel", "trackDisplayMode", "thumbMode", "onChange", "onUpdate", "thumbProps", "className", "railContainerProps"]);
98
- var _k = react_1.default.useState(values), currentValues = _k[0], setCurrentValues = _k[1];
101
+ var _c = props.min, min = _c === void 0 ? 0 : _c, _d = props.max, max = _d === void 0 ? 100 : _d, values = props.values, _e = props.step, step = _e === void 0 ? 1 : _e, _f = props.setFocus, setFocus = _f === void 0 ? false : _f, tooltipProps = props.tooltipProps, _g = props.disabled, disabled = _g === void 0 ? false : _g, tickLabels = props.tickLabels, minLabel = props.minLabel, maxLabel = props.maxLabel, _h = props.trackDisplayMode, trackDisplayMode = _h === void 0 ? 'auto' : _h, _j = props.thumbMode, thumbMode = _j === void 0 ? 'inhibit-crossing' : _j, onChange = props.onChange, onUpdate = props.onUpdate, thumbProps = props.thumbProps, className = props.className, railContainerProps = props.railContainerProps, _k = props.orientation, orientation = _k === void 0 ? 'horizontal' : _k, rest = __rest(props, ["min", "max", "values", "step", "setFocus", "tooltipProps", "disabled", "tickLabels", "minLabel", "maxLabel", "trackDisplayMode", "thumbMode", "onChange", "onUpdate", "thumbProps", "className", "railContainerProps", "orientation"]);
102
+ var _l = react_1.default.useState(values), currentValues = _l[0], setCurrentValues = _l[1];
99
103
  react_1.default.useEffect(function () {
100
104
  setCurrentValues(values);
101
105
  }, [values]);
102
- var _l = react_1.default.useState(function () { return minLabel !== null && minLabel !== void 0 ? minLabel : min.toString(); }), minValueLabel = _l[0], setMinValueLabel = _l[1];
106
+ var _m = react_1.default.useState(function () { return minLabel !== null && minLabel !== void 0 ? minLabel : min.toString(); }), minValueLabel = _m[0], setMinValueLabel = _m[1];
103
107
  react_1.default.useEffect(function () {
104
108
  setMinValueLabel(minLabel !== null && minLabel !== void 0 ? minLabel : min.toString());
105
109
  }, [minLabel, min]);
106
- var _m = react_1.default.useState(function () { return maxLabel !== null && maxLabel !== void 0 ? maxLabel : max.toString(); }), maxValueLabel = _m[0], setMaxValueLabel = _m[1];
110
+ var _o = react_1.default.useState(function () { return maxLabel !== null && maxLabel !== void 0 ? maxLabel : max.toString(); }), maxValueLabel = _o[0], setMaxValueLabel = _o[1];
107
111
  react_1.default.useEffect(function () {
108
112
  setMaxValueLabel(maxLabel !== null && maxLabel !== void 0 ? maxLabel : max.toString());
109
113
  }, [maxLabel, max]);
110
- var _o = react_1.default.useState(function () { return getDefaultTrackDisplay(trackDisplayMode, currentValues); }), trackDisplay = _o[0], setTrackDisplay = _o[1];
114
+ var _p = react_1.default.useState(function () { return getDefaultTrackDisplay(trackDisplayMode, currentValues); }), trackDisplay = _p[0], setTrackDisplay = _p[1];
111
115
  react_1.default.useEffect(function () {
112
116
  setTrackDisplay(getDefaultTrackDisplay(trackDisplayMode, currentValues));
113
117
  }, [trackDisplayMode, currentValues]);
@@ -133,10 +137,10 @@ exports.Slider = react_1.default.forwardRef(function (props, ref) {
133
137
  }
134
138
  return [min, max];
135
139
  }, [max, min, step, thumbMode, currentValues]);
136
- var _p = react_1.default.useState(undefined), activeThumbIndex = _p[0], setActiveThumbIndex = _p[1];
140
+ var _q = react_1.default.useState(undefined), activeThumbIndex = _q[0], setActiveThumbIndex = _q[1];
137
141
  var updateThumbValue = react_1.default.useCallback(function (event, callbackType) {
138
142
  if (containerRef.current && undefined !== activeThumbIndex) {
139
- var percent = getPercentageOfRectangle(containerRef.current.getBoundingClientRect(), event.clientX);
143
+ var percent = getPercentageOfRectangle(containerRef.current.getBoundingClientRect(), event.clientX, event.clientY, orientation);
140
144
  var pointerValue = min + (max - min) * percent;
141
145
  pointerValue = roundValueToClosestStep(pointerValue, step, min);
142
146
  var _a = getAllowableThumbRange(activeThumbIndex), minVal = _a[0], maxVal = _a[1];
@@ -162,6 +166,7 @@ exports.Slider = react_1.default.forwardRef(function (props, ref) {
162
166
  currentValues,
163
167
  onUpdate,
164
168
  onChange,
169
+ orientation,
165
170
  ]);
166
171
  var handlePointerMove = react_1.default.useCallback(function (event) {
167
172
  if (activeThumbIndex === undefined) {
@@ -195,7 +200,7 @@ exports.Slider = react_1.default.forwardRef(function (props, ref) {
195
200
  }, [activeThumbIndex, updateThumbValue]);
196
201
  var handlePointerDownOnSlider = react_1.default.useCallback(function (event) {
197
202
  if (containerRef.current) {
198
- var percent = getPercentageOfRectangle(containerRef.current.getBoundingClientRect(), event.clientX);
203
+ var percent = getPercentageOfRectangle(containerRef.current.getBoundingClientRect(), event.clientX, event.clientY, orientation);
199
204
  var pointerValue = min + (max - min) * percent;
200
205
  pointerValue = roundValueToClosestStep(pointerValue, step, min);
201
206
  var closestValueIndex = getClosestValueIndex(currentValues, pointerValue);
@@ -221,6 +226,7 @@ exports.Slider = react_1.default.forwardRef(function (props, ref) {
221
226
  getAllowableThumbRange,
222
227
  onChange,
223
228
  onUpdate,
229
+ orientation,
224
230
  ]);
225
231
  (0, utils_1.useEventListener)('pointermove', handlePointerMove, (_a = containerRef.current) === null || _a === void 0 ? void 0 : _a.ownerDocument);
226
232
  (0, utils_1.useEventListener)('pointerup', handlePointerUp, (_b = containerRef.current) === null || _b === void 0 ? void 0 : _b.ownerDocument);
@@ -241,7 +247,7 @@ exports.Slider = react_1.default.forwardRef(function (props, ref) {
241
247
  ? outProps.content
242
248
  : formatNumberValue(val, step, getNumDecimalPlaces) });
243
249
  }, [getNumDecimalPlaces, step, tooltipProps]);
244
- return (react_1.default.createElement("div", __assign({ ref: ref, className: (0, classnames_1.default)('iui-slider-component-container', { 'iui-disabled': disabled }, className) }, rest),
250
+ return (react_1.default.createElement("div", __assign({ ref: ref, className: (0, classnames_1.default)('iui-slider-component-container', "iui-slider-".concat(orientation), { 'iui-disabled': disabled }, className) }, rest),
245
251
  minValueLabel && (react_1.default.createElement("span", { className: 'iui-slider-min' }, minValueLabel)),
246
252
  react_1.default.createElement("div", __assign({ ref: containerRef, className: (0, classnames_1.default)('iui-slider-container', {
247
253
  'iui-grabbing': undefined !== activeThumbIndex,
@@ -251,9 +257,9 @@ exports.Slider = react_1.default.forwardRef(function (props, ref) {
251
257
  var _a;
252
258
  var _b = getAllowableThumbRange(index), minVal = _b[0], maxVal = _b[1];
253
259
  var thisThumbProps = thumbProps === null || thumbProps === void 0 ? void 0 : thumbProps(index);
254
- return (react_1.default.createElement(Thumb_1.Thumb, { key: (_a = thisThumbProps === null || thisThumbProps === void 0 ? void 0 : thisThumbProps.id) !== null && _a !== void 0 ? _a : index, index: index, disabled: disabled, isActive: activeThumbIndex === index, onThumbActivated: onThumbActivated, onThumbValueChanged: onThumbValueChanged, minVal: minVal, maxVal: maxVal, value: thumbValue, tooltipProps: generateTooltipProps(index, thumbValue), thumbProps: thisThumbProps, step: step, sliderMin: min, sliderMax: max }));
260
+ return (react_1.default.createElement(Thumb_1.Thumb, { key: (_a = thisThumbProps === null || thisThumbProps === void 0 ? void 0 : thisThumbProps.id) !== null && _a !== void 0 ? _a : index, index: index, disabled: disabled, isActive: activeThumbIndex === index, onThumbActivated: onThumbActivated, onThumbValueChanged: onThumbValueChanged, minVal: minVal, maxVal: maxVal, value: thumbValue, tooltipProps: generateTooltipProps(index, thumbValue), thumbProps: thisThumbProps, step: step, sliderMin: min, sliderMax: max, orientation: orientation }));
255
261
  }),
256
- react_1.default.createElement(Track_1.Track, { trackDisplayMode: trackDisplay, sliderMin: min, sliderMax: max, values: currentValues }),
262
+ react_1.default.createElement(Track_1.Track, { trackDisplayMode: trackDisplay, sliderMin: min, sliderMax: max, values: currentValues, orientation: orientation }),
257
263
  tickMarkArea),
258
264
  maxValueLabel && (react_1.default.createElement("span", { className: 'iui-slider-max' }, maxValueLabel))));
259
265
  });
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import { TooltipProps } from '../Tooltip';
3
+ import { SliderProps } from './Slider';
3
4
  export declare type ThumbProps = {
4
5
  /**
5
6
  * Thumb value.
@@ -53,7 +54,7 @@ export declare type ThumbProps = {
53
54
  * Additional props for Thumb.
54
55
  */
55
56
  thumbProps?: React.HTMLAttributes<HTMLDivElement>;
56
- };
57
+ } & Pick<SliderProps, 'orientation'>;
57
58
  /**
58
59
  * Thumb is a local component used to show and modify the values maintained by the Slider.
59
60
  * Only one Thumb can be active at a time. A Thumb is made active when the user selects
@@ -39,7 +39,7 @@ var Tooltip_1 = require("../Tooltip");
39
39
  * it with pointer. Whenever a Thumb is active, focused, or hovered its tooltip is shown.
40
40
  */
41
41
  var Thumb = function (props) {
42
- var value = props.value, index = props.index, minVal = props.minVal, maxVal = props.maxVal, step = props.step, sliderMin = props.sliderMin, sliderMax = props.sliderMax, isActive = props.isActive, onThumbActivated = props.onThumbActivated, onThumbValueChanged = props.onThumbValueChanged, tooltipProps = props.tooltipProps, thumbProps = props.thumbProps, disabled = props.disabled;
42
+ var value = props.value, index = props.index, minVal = props.minVal, maxVal = props.maxVal, step = props.step, sliderMin = props.sliderMin, sliderMax = props.sliderMax, isActive = props.isActive, onThumbActivated = props.onThumbActivated, onThumbValueChanged = props.onThumbValueChanged, tooltipProps = props.tooltipProps, thumbProps = props.thumbProps, disabled = props.disabled, orientation = props.orientation;
43
43
  var thumbRef = react_1.default.useRef(null);
44
44
  var handleOnKeyDown = react_1.default.useCallback(function (event) {
45
45
  if (disabled || event.altKey) {
@@ -79,7 +79,7 @@ var Thumb = function (props) {
79
79
  }
80
80
  return value;
81
81
  }, [sliderMax, sliderMin, value]);
82
- var leftPercent = react_1.default.useMemo(function () {
82
+ var lowPercent = react_1.default.useMemo(function () {
83
83
  if (sliderMax === sliderMin) {
84
84
  return 0;
85
85
  }
@@ -87,6 +87,8 @@ var Thumb = function (props) {
87
87
  }, [adjustedValue, sliderMax, sliderMin]);
88
88
  var _c = thumbProps || {}, style = _c.style, className = _c.className, rest = __rest(_c, ["style", "className"]);
89
89
  return (react_1.default.createElement(Tooltip_1.Tooltip, __assign({ visible: isActive || hasFocus || isHovered, placement: 'top' }, tooltipProps),
90
- react_1.default.createElement("div", __assign({}, rest, { "data-index": index, ref: thumbRef, style: __assign(__assign({}, style), { left: "".concat(leftPercent, "%") }), className: (0, classnames_1.default)('iui-slider-thumb', { 'iui-active': isActive }, className), role: 'slider', tabIndex: disabled ? undefined : 0, "aria-valuemin": minVal, "aria-valuenow": value, "aria-valuemax": maxVal, "aria-disabled": disabled, onPointerDown: handlePointerDownOnThumb, onKeyDown: handleOnKeyDown, onFocus: function () { return setHasFocus(true); }, onBlur: function () { return setHasFocus(false); }, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }))));
90
+ react_1.default.createElement("div", __assign({}, rest, { "data-index": index, ref: thumbRef, style: __assign(__assign({}, style), (orientation === 'horizontal'
91
+ ? { left: "".concat(lowPercent, "%") }
92
+ : { bottom: "".concat(lowPercent, "%") })), className: (0, classnames_1.default)('iui-slider-thumb', { 'iui-active': isActive }, className), role: 'slider', tabIndex: disabled ? undefined : 0, "aria-valuemin": minVal, "aria-valuenow": value, "aria-valuemax": maxVal, "aria-disabled": disabled, onPointerDown: handlePointerDownOnThumb, onKeyDown: handleOnKeyDown, onFocus: function () { return setHasFocus(true); }, onBlur: function () { return setHasFocus(false); }, onMouseEnter: function () { return setIsHovered(true); }, onMouseLeave: function () { return setIsHovered(false); } }))));
91
93
  };
92
94
  exports.Thumb = Thumb;
@@ -1,10 +1,11 @@
1
1
  /// <reference types="react" />
2
- import { TrackDisplayMode } from './Slider';
2
+ import { SliderProps, TrackDisplayMode } from './Slider';
3
3
  export declare type TrackProps = {
4
4
  trackDisplayMode: TrackDisplayMode;
5
5
  sliderMin: number;
6
6
  sliderMax: number;
7
7
  values: number[];
8
+ orientation: SliderProps['orientation'];
8
9
  };
9
10
  /**
10
11
  * Track displays color segments above Rail. Which, if any, segments that are
@@ -1,4 +1,15 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
2
13
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
14
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
15
  if (ar || !(i in from)) {
@@ -50,7 +61,7 @@ function generateSegments(values, min, max) {
50
61
  * colorized is based on `trackDisplayMode`.
51
62
  */
52
63
  var Track = function (props) {
53
- var trackDisplayMode = props.trackDisplayMode, sliderMin = props.sliderMin, sliderMax = props.sliderMax, values = props.values;
64
+ var trackDisplayMode = props.trackDisplayMode, sliderMin = props.sliderMin, sliderMax = props.sliderMax, values = props.values, orientation = props.orientation;
54
65
  var _a = react_1.default.useState(function () {
55
66
  return generateSegments(values, sliderMin, sliderMax);
56
67
  }), segments = _a[0], setSegments = _a[1];
@@ -59,14 +70,22 @@ var Track = function (props) {
59
70
  }, [values, sliderMin, sliderMax]);
60
71
  return (react_1.default.createElement(react_1.default.Fragment, null, 'none' !== trackDisplayMode &&
61
72
  segments.map(function (segment, index) {
62
- var leftPercent = segment.left >= sliderMin && sliderMax !== sliderMin
73
+ var lowPercent = segment.left >= sliderMin && sliderMax !== sliderMin
63
74
  ? (100.0 * (segment.left - sliderMin)) / (sliderMax - sliderMin)
64
75
  : 0;
65
- var rightPercent = segment.right >= sliderMin && sliderMax !== sliderMin
76
+ var highPercent = segment.right >= sliderMin && sliderMax !== sliderMin
66
77
  ? 100.0 -
67
78
  (100.0 * (segment.right - sliderMin)) / (sliderMax - sliderMin)
68
79
  : 100;
69
- return (react_1.default.createElement(react_1.default.Fragment, { key: index }, shouldDisplaySegment(index, trackDisplayMode) ? (react_1.default.createElement("div", { className: 'iui-slider-track', style: { left: "".concat(leftPercent, "%"), right: "".concat(rightPercent, "%") } })) : null));
80
+ return (react_1.default.createElement(react_1.default.Fragment, { key: index }, shouldDisplaySegment(index, trackDisplayMode) ? (react_1.default.createElement("div", { className: 'iui-slider-track', style: __assign({}, (orientation === 'horizontal'
81
+ ? {
82
+ left: "".concat(lowPercent, "%"),
83
+ right: "".concat(highPercent, "%"),
84
+ }
85
+ : {
86
+ top: "".concat(highPercent, "%"),
87
+ bottom: "".concat(lowPercent, "%"),
88
+ })) })) : null));
70
89
  })));
71
90
  };
72
91
  exports.Track = Track;
@@ -182,6 +182,30 @@ export declare type TableProps<T extends Record<string, unknown> = Record<string
182
182
  * @default false
183
183
  */
184
184
  enableColumnReordering?: boolean;
185
+ /**
186
+ * Function that returns index of the row that you want to scroll to.
187
+ *
188
+ * When using with lazy-loading table, you need to take care that row is already loaded.
189
+ * It doesn't work with paginated tables.
190
+ * @beta
191
+ * @example
192
+ * <Table
193
+ * scrollToRow={React.useCallback(
194
+ * (rows, data) => rows.findIndex((row) => row.original === data[250]),
195
+ * []
196
+ * )}
197
+ * {...restProps}
198
+ * />
199
+ * @example
200
+ * <Table
201
+ * scrollToRow={React.useCallback(
202
+ * (rows, data) => rows.findIndex((row) => row.original.id === data[250].id),
203
+ * []
204
+ * )}
205
+ * {...restProps}
206
+ * />
207
+ */
208
+ scrollToRow?: (rows: Row<T>[], data: T[]) => number;
185
209
  } & Omit<CommonProps, 'title'>;
186
210
  /**
187
211
  * Table based on [react-table](https://react-table.tanstack.com/docs/api/overview).