@itwin/itwinui-react 2.6.1 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +73 -2
- package/cjs/core/Badge/Badge.d.ts +1 -1
- package/cjs/core/Badge/Badge.js +14 -15
- package/cjs/core/Carousel/Carousel.js +3 -2
- package/cjs/core/DatePicker/DatePicker.d.ts +5 -0
- package/cjs/core/DatePicker/DatePicker.js +26 -7
- package/cjs/core/Dialog/DialogMain.js +18 -23
- package/cjs/core/Slider/Thumb.js +2 -4
- package/cjs/core/Surface/Surface.d.ts +24 -2
- package/cjs/core/Surface/Surface.js +38 -2
- package/cjs/core/Surface/index.d.ts +1 -1
- package/cjs/core/Tabs/Tabs.js +3 -1
- package/cjs/core/Tile/Tile.d.ts +24 -2
- package/cjs/core/Tile/Tile.js +83 -50
- package/cjs/core/ToggleSwitch/ToggleSwitch.d.ts +11 -31
- package/cjs/core/ToggleSwitch/ToggleSwitch.js +8 -1
- package/cjs/core/index.d.ts +3 -3
- package/cjs/core/index.js +5 -1
- package/cjs/core/utils/components/Divider.d.ts +14 -0
- package/cjs/core/utils/components/Divider.js +23 -0
- package/cjs/core/utils/components/LinkAction.d.ts +30 -0
- package/cjs/core/utils/components/LinkAction.js +44 -0
- package/cjs/core/utils/components/Resizer.js +9 -9
- package/cjs/core/utils/components/VisuallyHidden.d.ts +20 -6
- package/cjs/core/utils/components/VisuallyHidden.js +10 -3
- package/cjs/core/utils/components/index.d.ts +2 -0
- package/cjs/core/utils/components/index.js +2 -0
- package/cjs/core/utils/functions/index.d.ts +1 -0
- package/cjs/core/utils/functions/index.js +1 -0
- package/cjs/core/utils/functions/supports.d.ts +4 -0
- package/cjs/core/utils/functions/supports.js +13 -0
- package/cjs/core/utils/hooks/index.d.ts +1 -0
- package/cjs/core/utils/hooks/index.js +1 -0
- package/cjs/core/utils/hooks/useDragAndDrop.js +4 -3
- package/cjs/core/utils/hooks/useIsClient.d.ts +1 -0
- package/cjs/core/utils/hooks/useIsClient.js +19 -0
- package/cjs/core/utils/hooks/useTheme.js +44 -0
- package/esm/core/Badge/Badge.d.ts +1 -1
- package/esm/core/Badge/Badge.js +14 -15
- package/esm/core/Carousel/Carousel.js +3 -2
- package/esm/core/DatePicker/DatePicker.d.ts +5 -0
- package/esm/core/DatePicker/DatePicker.js +26 -7
- package/esm/core/Dialog/DialogMain.js +19 -24
- package/esm/core/Slider/Thumb.js +2 -4
- package/esm/core/Surface/Surface.d.ts +24 -2
- package/esm/core/Surface/Surface.js +39 -3
- package/esm/core/Surface/index.d.ts +1 -1
- package/esm/core/Tabs/Tabs.js +4 -2
- package/esm/core/Tile/Tile.d.ts +24 -2
- package/esm/core/Tile/Tile.js +82 -49
- package/esm/core/ToggleSwitch/ToggleSwitch.d.ts +11 -31
- package/esm/core/ToggleSwitch/ToggleSwitch.js +8 -1
- package/esm/core/index.d.ts +3 -3
- package/esm/core/index.js +1 -1
- package/esm/core/utils/components/Divider.d.ts +14 -0
- package/esm/core/utils/components/Divider.js +17 -0
- package/esm/core/utils/components/LinkAction.d.ts +30 -0
- package/esm/core/utils/components/LinkAction.js +38 -0
- package/esm/core/utils/components/Resizer.js +9 -9
- package/esm/core/utils/components/VisuallyHidden.d.ts +20 -6
- package/esm/core/utils/components/VisuallyHidden.js +10 -3
- package/esm/core/utils/components/index.d.ts +2 -0
- package/esm/core/utils/components/index.js +2 -0
- package/esm/core/utils/functions/index.d.ts +1 -0
- package/esm/core/utils/functions/index.js +1 -0
- package/esm/core/utils/functions/supports.d.ts +4 -0
- package/esm/core/utils/functions/supports.js +9 -0
- package/esm/core/utils/hooks/index.d.ts +1 -0
- package/esm/core/utils/hooks/index.js +1 -0
- package/esm/core/utils/hooks/useDragAndDrop.js +4 -3
- package/esm/core/utils/hooks/useIsClient.d.ts +1 -0
- package/esm/core/utils/hooks/useIsClient.js +12 -0
- package/esm/core/utils/hooks/useTheme.js +21 -0
- package/package.json +2 -2
package/cjs/core/Tile/Tile.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Tile = void 0;
|
|
6
|
+
exports.Tile = exports.TileAction = void 0;
|
|
7
7
|
/*---------------------------------------------------------------------------------------------
|
|
8
8
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
9
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -15,6 +15,25 @@ require("@itwin/itwinui-css/css/tile.css");
|
|
|
15
15
|
const DropdownMenu_1 = require("../DropdownMenu");
|
|
16
16
|
const Buttons_1 = require("../Buttons");
|
|
17
17
|
const ProgressIndicators_1 = require("../ProgressIndicators");
|
|
18
|
+
const TileContext = react_1.default.createContext(undefined);
|
|
19
|
+
/**
|
|
20
|
+
* Polymorphic Tile action component. Recommended to be used in a "name" of `Tile`.
|
|
21
|
+
* Renders `a` element by default.
|
|
22
|
+
* @example
|
|
23
|
+
* <Tile
|
|
24
|
+
* name={<Tile.Action href='/new-page'>Tile name<Tile.Action/>}
|
|
25
|
+
* />
|
|
26
|
+
*/
|
|
27
|
+
const TileAction = (props) => {
|
|
28
|
+
const tileContext = (0, utils_1.useSafeContext)(TileContext);
|
|
29
|
+
react_1.default.useEffect(() => {
|
|
30
|
+
if (!(0, utils_1.supportsHas)()) {
|
|
31
|
+
tileContext.setActionable(true);
|
|
32
|
+
}
|
|
33
|
+
}, [tileContext]);
|
|
34
|
+
return react_1.default.createElement(utils_1.LinkAction, { ...props });
|
|
35
|
+
};
|
|
36
|
+
exports.TileAction = TileAction;
|
|
18
37
|
/**
|
|
19
38
|
* Tile component that displays content and actions in a card-like format.
|
|
20
39
|
* @example
|
|
@@ -32,59 +51,73 @@ const ProgressIndicators_1 = require("../ProgressIndicators");
|
|
|
32
51
|
* isNew={false}
|
|
33
52
|
* />
|
|
34
53
|
*/
|
|
35
|
-
|
|
36
|
-
const { className, name, description, metadata, thumbnail, buttons, leftIcon, rightIcon, badge, isNew, isSelected, moreOptions, variant = 'default', children, isActionable, status, isLoading = false, isDisabled = false, ...rest } = props;
|
|
54
|
+
exports.Tile = Object.assign((props) => {
|
|
55
|
+
const { className, name, description, metadata, thumbnail, buttons, leftIcon, rightIcon, badge, isNew, isSelected, moreOptions, variant = 'default', children, isActionable: isActionableProp, status, isLoading = false, isDisabled = false, onClick, ...rest } = props;
|
|
37
56
|
(0, utils_1.useTheme)();
|
|
38
57
|
const [isMenuVisible, setIsMenuVisible] = react_1.default.useState(false);
|
|
39
58
|
const showMenu = react_1.default.useCallback(() => setIsMenuVisible(true), []);
|
|
40
59
|
const hideMenu = react_1.default.useCallback(() => setIsMenuVisible(false), []);
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
'
|
|
59
|
-
}),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}
|
|
87
|
-
|
|
60
|
+
const [localActionable, setLocalActionable] = react_1.default.useState(isActionableProp);
|
|
61
|
+
const isActionable = isActionableProp !== null && isActionableProp !== void 0 ? isActionableProp : localActionable;
|
|
62
|
+
const tileName = (react_1.default.createElement("div", { className: 'iui-tile-name' },
|
|
63
|
+
react_1.default.createElement(TitleIcon, { isLoading: isLoading, isSelected: isSelected, isNew: isNew, status: status }),
|
|
64
|
+
react_1.default.createElement("span", { className: 'iui-tile-name-label' }, isActionable && onClick ? (react_1.default.createElement(utils_1.LinkAction, { as: 'button', onClick: !isDisabled ? onClick : undefined, "aria-disabled": isDisabled }, name)) : (name))));
|
|
65
|
+
return (react_1.default.createElement(TileContext.Provider, { value: { setActionable: setLocalActionable } },
|
|
66
|
+
react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-tile', {
|
|
67
|
+
'iui-folder': variant === 'folder',
|
|
68
|
+
'iui-new': isNew,
|
|
69
|
+
'iui-selected': isSelected,
|
|
70
|
+
'iui-actionable': isActionable,
|
|
71
|
+
[`iui-${status}`]: !!status,
|
|
72
|
+
'iui-loading': isLoading,
|
|
73
|
+
}, className), "aria-disabled": isDisabled, ...rest },
|
|
74
|
+
variant !== 'folder' ? tileName : null,
|
|
75
|
+
thumbnail && (react_1.default.createElement("div", { className: 'iui-tile-thumbnail' },
|
|
76
|
+
typeof thumbnail === 'string' ? (react_1.default.createElement("div", { className: 'iui-tile-thumbnail-picture', style: { backgroundImage: `url(${thumbnail})` } })) : thumbnail && thumbnail.type === 'img' ? (react_1.default.cloneElement(thumbnail, {
|
|
77
|
+
className: 'iui-tile-thumbnail-picture',
|
|
78
|
+
})) : react_1.default.isValidElement(thumbnail) ? (react_1.default.cloneElement(thumbnail, {
|
|
79
|
+
className: (0, classnames_1.default)('iui-thumbnail-icon', thumbnail.props.className),
|
|
80
|
+
})) : (thumbnail),
|
|
81
|
+
leftIcon &&
|
|
82
|
+
react_1.default.cloneElement(leftIcon, {
|
|
83
|
+
className: 'iui-tile-thumbnail-type-indicator',
|
|
84
|
+
'data-iui-size': 'small',
|
|
85
|
+
}),
|
|
86
|
+
rightIcon &&
|
|
87
|
+
react_1.default.cloneElement(rightIcon, {
|
|
88
|
+
className: 'iui-tile-thumbnail-quick-action',
|
|
89
|
+
'data-iui-size': 'small',
|
|
90
|
+
}),
|
|
91
|
+
badge && (react_1.default.createElement("div", { className: 'iui-tile-thumbnail-badge-container' }, badge)))),
|
|
92
|
+
react_1.default.createElement("div", { className: 'iui-tile-content' },
|
|
93
|
+
variant === 'folder' ? tileName : null,
|
|
94
|
+
description != undefined && (react_1.default.createElement("div", { className: 'iui-tile-description' }, description)),
|
|
95
|
+
metadata != undefined && (react_1.default.createElement("div", { className: 'iui-tile-metadata' }, metadata)),
|
|
96
|
+
moreOptions && (react_1.default.createElement(DropdownMenu_1.DropdownMenu, { onShow: showMenu, onHide: hideMenu, menuItems: (close) => moreOptions.map((option) => react_1.default.cloneElement(option, {
|
|
97
|
+
onClick: (value) => {
|
|
98
|
+
var _a, _b;
|
|
99
|
+
close();
|
|
100
|
+
(_b = (_a = option.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, value);
|
|
101
|
+
},
|
|
102
|
+
})) },
|
|
103
|
+
react_1.default.createElement("div", { className: (0, classnames_1.default)('iui-tile-more-options', {
|
|
104
|
+
'iui-visible': isMenuVisible,
|
|
105
|
+
}) },
|
|
106
|
+
react_1.default.createElement(Buttons_1.IconButton, { styleType: 'borderless', size: 'small', "aria-label": 'More options' },
|
|
107
|
+
react_1.default.createElement(utils_1.SvgMore, null))))),
|
|
108
|
+
children),
|
|
109
|
+
buttons && react_1.default.createElement("div", { className: 'iui-tile-buttons' }, buttons))));
|
|
110
|
+
}, {
|
|
111
|
+
/**
|
|
112
|
+
* Polymorphic Tile action component. Recommended to be used in a "name" of `Tile`.
|
|
113
|
+
* Renders `a` element by default.
|
|
114
|
+
* @example
|
|
115
|
+
* <Tile
|
|
116
|
+
* name={<Tile.Action href='/new-page'>Tile name<Tile.Action/>}
|
|
117
|
+
* />
|
|
118
|
+
*/
|
|
119
|
+
Action: exports.TileAction,
|
|
120
|
+
});
|
|
88
121
|
const TitleIcon = ({ isLoading = false, isSelected = false, isNew = false, status, }) => {
|
|
89
122
|
const StatusIcon = !!status && utils_1.StatusIconMap[status];
|
|
90
123
|
if (isLoading) {
|
|
@@ -15,16 +15,20 @@ export declare type ToggleSwitchProps = {
|
|
|
15
15
|
* @default false
|
|
16
16
|
*/
|
|
17
17
|
setFocus?: boolean;
|
|
18
|
-
|
|
19
|
-
* Icon inside the toggle switch. Shown only when toggle is checked.
|
|
20
|
-
*/
|
|
21
|
-
icon?: JSX.Element;
|
|
18
|
+
} & ({
|
|
22
19
|
/**
|
|
23
20
|
* Size of the toggle switch.
|
|
24
21
|
* @default 'default'
|
|
25
22
|
*/
|
|
26
|
-
size?: 'default'
|
|
27
|
-
|
|
23
|
+
size?: 'default';
|
|
24
|
+
/**
|
|
25
|
+
* Icon inside the toggle switch. Shown only when toggle is checked and size is not small.
|
|
26
|
+
*/
|
|
27
|
+
icon?: JSX.Element;
|
|
28
|
+
} | {
|
|
29
|
+
size: 'small';
|
|
30
|
+
icon?: never;
|
|
31
|
+
}) & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'type' | 'size'>;
|
|
28
32
|
/**
|
|
29
33
|
* A switch for turning on and off.
|
|
30
34
|
* @example
|
|
@@ -43,29 +47,5 @@ export declare type ToggleSwitchProps = {
|
|
|
43
47
|
* <caption>Toggle with icon</caption>
|
|
44
48
|
* <ToggleSwitch label='With icon toggle' icon={<svg viewBox='0 0 16 16'><path d='M1 1v14h14V1H1zm13 1.7v10.6L8.7 8 14 2.7zM8 7.3L2.7 2h10.6L8 7.3zm-.7.7L2 13.3V2.7L7.3 8zm.7.7l5.3 5.3H2.7L8 8.7z' /></svg>} />
|
|
45
49
|
*/
|
|
46
|
-
export declare const ToggleSwitch: React.ForwardRefExoticComponent<
|
|
47
|
-
/**
|
|
48
|
-
* Label for the toggle switch.
|
|
49
|
-
*/
|
|
50
|
-
label?: React.ReactNode;
|
|
51
|
-
/**
|
|
52
|
-
* Position of the label.
|
|
53
|
-
* @default 'right'
|
|
54
|
-
*/
|
|
55
|
-
labelPosition?: "right" | "left" | undefined;
|
|
56
|
-
/**
|
|
57
|
-
* Set focus on toggle.
|
|
58
|
-
* @default false
|
|
59
|
-
*/
|
|
60
|
-
setFocus?: boolean | undefined;
|
|
61
|
-
/**
|
|
62
|
-
* Icon inside the toggle switch. Shown only when toggle is checked.
|
|
63
|
-
*/
|
|
64
|
-
icon?: JSX.Element | undefined;
|
|
65
|
-
/**
|
|
66
|
-
* Size of the toggle switch.
|
|
67
|
-
* @default 'default'
|
|
68
|
-
*/
|
|
69
|
-
size?: "small" | "default" | undefined;
|
|
70
|
-
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "size"> & React.RefAttributes<HTMLInputElement>>;
|
|
50
|
+
export declare const ToggleSwitch: React.ForwardRefExoticComponent<ToggleSwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
71
51
|
export default ToggleSwitch;
|
|
@@ -31,7 +31,13 @@ require("@itwin/itwinui-css/css/toggle-switch.css");
|
|
|
31
31
|
* <ToggleSwitch label='With icon toggle' icon={<svg viewBox='0 0 16 16'><path d='M1 1v14h14V1H1zm13 1.7v10.6L8.7 8 14 2.7zM8 7.3L2.7 2h10.6L8 7.3zm-.7.7L2 13.3V2.7L7.3 8zm.7.7l5.3 5.3H2.7L8 8.7z' /></svg>} />
|
|
32
32
|
*/
|
|
33
33
|
exports.ToggleSwitch = react_1.default.forwardRef((props, ref) => {
|
|
34
|
-
|
|
34
|
+
let icon;
|
|
35
|
+
if (props.size !== 'small') {
|
|
36
|
+
icon = props.icon;
|
|
37
|
+
props = { ...props };
|
|
38
|
+
delete props.icon;
|
|
39
|
+
}
|
|
40
|
+
const { disabled = false, labelPosition = 'right', label, setFocus = false, className, style, size = 'default', ...rest } = props;
|
|
35
41
|
(0, utils_1.useTheme)();
|
|
36
42
|
const inputElementRef = react_1.default.useRef(null);
|
|
37
43
|
const refs = (0, utils_1.useMergedRefs)(inputElementRef, ref);
|
|
@@ -48,6 +54,7 @@ exports.ToggleSwitch = react_1.default.forwardRef((props, ref) => {
|
|
|
48
54
|
}, className), "data-iui-size": size, style: style },
|
|
49
55
|
react_1.default.createElement("input", { className: 'iui-toggle-switch', type: 'checkbox', role: 'switch', disabled: disabled, ref: refs, ...rest }),
|
|
50
56
|
icon &&
|
|
57
|
+
size !== 'small' &&
|
|
51
58
|
react_1.default.cloneElement(icon, {
|
|
52
59
|
className: (0, classnames_1.default)('iui-toggle-switch-icon', icon.props.className),
|
|
53
60
|
'aria-hidden': true,
|
package/cjs/core/index.d.ts
CHANGED
|
@@ -79,7 +79,7 @@ export type { SliderProps } from './Slider';
|
|
|
79
79
|
export { StatusMessage } from './StatusMessage';
|
|
80
80
|
export type { StatusMessageProps } from './StatusMessage';
|
|
81
81
|
export { Surface } from './Surface';
|
|
82
|
-
export type { SurfaceProps } from './Surface';
|
|
82
|
+
export type { SurfaceProps, SurfaceHeaderProps, SurfaceBodyProps, } from './Surface';
|
|
83
83
|
export { Table, tableFilters, BaseFilter, FilterButtonBar, DefaultCell, EditableCell, TablePaginator, ActionColumn, ExpanderColumn, SelectionColumn, } from './Table';
|
|
84
84
|
export type { TableProps, TableFilterProps, TableFilterValue, DateRangeFilterOptions, FilterButtonBarProps, DefaultCellProps, EditableCellProps, TablePaginatorProps, TablePaginatorRendererProps, } from './Table';
|
|
85
85
|
export { Tag, TagContainer } from './Tag';
|
|
@@ -104,5 +104,5 @@ export { Anchor, Body, Headline, Leading, Small, Subheading, Title, Blockquote,
|
|
|
104
104
|
export type { AnchorProps, BodyProps, HeadlineProps, LeadingProps, SmallProps, SubheadingProps, TitleProps, BlockquoteProps, CodeProps, KbdProps, TextProps, } from './Typography';
|
|
105
105
|
export { Wizard, Stepper, WorkflowDiagram } from './Stepper';
|
|
106
106
|
export type { WizardProps, StepProperties, WizardType, WizardLocalization, StepperProps, StepperLocalization, WorkflowDiagramProps, } from './Stepper';
|
|
107
|
-
export { getUserColor, useTheme, ColorValue, MiddleTextTruncation, Icon, Flex, } from './utils';
|
|
108
|
-
export type { ThemeType, MiddleTextTruncationProps, IconProps, FlexProps, FlexItemProps, FlexSpacerProps, } from './utils';
|
|
107
|
+
export { getUserColor, useTheme, ColorValue, MiddleTextTruncation, LinkBox, LinkAction, Icon, Flex, VisuallyHidden, Divider, } from './utils';
|
|
108
|
+
export type { ThemeType, MiddleTextTruncationProps, IconProps, FlexProps, FlexItemProps, FlexSpacerProps, DividerProps, LinkBoxProps, LinkActionProps, VisuallyHiddenProps, } from './utils';
|
package/cjs/core/index.js
CHANGED
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Input = exports.InformationPanelContent = exports.InformationPanelBody = exports.InformationPanelHeader = exports.InformationPanelWrapper = exports.InformationPanel = exports.HorizontalTabs = exports.Tab = exports.Tabs = exports.VerticalTabs = exports.HeaderLogo = exports.HeaderButton = exports.HeaderBreadcrumbs = exports.Header = exports.defaultFooterElements = exports.Footer = exports.FileEmptyCard = exports.FileUploadCard = exports.FileUploadTemplate = exports.FileUpload = exports.Fieldset = exports.ExpandableBlock = exports.NonIdealState = exports.ErrorPage = exports.DropdownMenu = exports.Dialog = exports.generateLocalizedStrings = exports.DatePicker = exports.ComboBox = exports.ColorPalette = exports.ColorInputPanel = exports.ColorBuilder = exports.ColorSwatch = exports.ColorPicker = exports.Checkbox = exports.Carousel = exports.ButtonGroup = exports.SplitButton = exports.IdeasButton = exports.IconButton = exports.DropdownButton = exports.Button = exports.Breadcrumbs = exports.Badge = exports.Backdrop = exports.UserIconGroup = exports.AvatarGroup = exports.UserIcon = exports.Avatar = exports.Alert = void 0;
|
|
7
7
|
exports.TreeNodeExpander = exports.TreeNode = exports.Tree = exports.Tooltip = exports.ToggleSwitch = exports.ThemeProvider = exports.toaster = exports.TimePicker = exports.Tile = exports.Textarea = exports.TagContainer = exports.Tag = exports.SelectionColumn = exports.ExpanderColumn = exports.ActionColumn = exports.TablePaginator = exports.EditableCell = exports.DefaultCell = exports.FilterButtonBar = exports.BaseFilter = exports.tableFilters = exports.Table = exports.Surface = exports.StatusMessage = exports.Slider = exports.SkipToContentLink = exports.SidenavSubmenuHeader = exports.SidenavSubmenu = exports.SidenavButton = exports.SideNavigation = exports.Select = exports.RadioTileGroup = exports.RadioTile = exports.Radio = exports.ProgressRadial = exports.ProgressLinear = exports.NotificationMarker = exports.ModalContent = exports.ModalButtonBar = exports.Modal = exports.MenuItemSkeleton = exports.MenuExtraContent = exports.MenuDivider = exports.MenuItem = exports.Menu = exports.LabeledTextarea = exports.LabeledSelect = exports.InputGroup = exports.LabeledInput = exports.Label = void 0;
|
|
8
|
-
exports.Flex = exports.Icon = exports.MiddleTextTruncation = exports.ColorValue = exports.useTheme = exports.getUserColor = exports.WorkflowDiagram = exports.Stepper = exports.Wizard = exports.Text = exports.KbdKeys = exports.Kbd = exports.Code = exports.Blockquote = exports.Title = exports.Subheading = exports.Small = exports.Leading = exports.Headline = exports.Body = exports.Anchor = void 0;
|
|
8
|
+
exports.Divider = exports.VisuallyHidden = exports.Flex = exports.Icon = exports.LinkAction = exports.LinkBox = exports.MiddleTextTruncation = exports.ColorValue = exports.useTheme = exports.getUserColor = exports.WorkflowDiagram = exports.Stepper = exports.Wizard = exports.Text = exports.KbdKeys = exports.Kbd = exports.Code = exports.Blockquote = exports.Title = exports.Subheading = exports.Small = exports.Leading = exports.Headline = exports.Body = exports.Anchor = void 0;
|
|
9
9
|
/*---------------------------------------------------------------------------------------------
|
|
10
10
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
11
11
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -183,5 +183,9 @@ Object.defineProperty(exports, "getUserColor", { enumerable: true, get: function
|
|
|
183
183
|
Object.defineProperty(exports, "useTheme", { enumerable: true, get: function () { return utils_1.useTheme; } });
|
|
184
184
|
Object.defineProperty(exports, "ColorValue", { enumerable: true, get: function () { return utils_1.ColorValue; } });
|
|
185
185
|
Object.defineProperty(exports, "MiddleTextTruncation", { enumerable: true, get: function () { return utils_1.MiddleTextTruncation; } });
|
|
186
|
+
Object.defineProperty(exports, "LinkBox", { enumerable: true, get: function () { return utils_1.LinkBox; } });
|
|
187
|
+
Object.defineProperty(exports, "LinkAction", { enumerable: true, get: function () { return utils_1.LinkAction; } });
|
|
186
188
|
Object.defineProperty(exports, "Icon", { enumerable: true, get: function () { return utils_1.Icon; } });
|
|
187
189
|
Object.defineProperty(exports, "Flex", { enumerable: true, get: function () { return utils_1.Flex; } });
|
|
190
|
+
Object.defineProperty(exports, "VisuallyHidden", { enumerable: true, get: function () { return utils_1.VisuallyHidden; } });
|
|
191
|
+
Object.defineProperty(exports, "Divider", { enumerable: true, get: function () { return utils_1.Divider; } });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '@itwin/itwinui-css/css/utils.css';
|
|
3
|
+
export declare type DividerProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Sets the orientation of the divider
|
|
6
|
+
* @default 'horizontal'
|
|
7
|
+
*/
|
|
8
|
+
orientation?: 'horizontal' | 'vertical';
|
|
9
|
+
} & React.ComponentPropsWithRef<'hr'>;
|
|
10
|
+
/**
|
|
11
|
+
* Shows a divider
|
|
12
|
+
*/
|
|
13
|
+
export declare const Divider: React.ForwardRefExoticComponent<Pick<DividerProps, "key" | "orientation" | keyof React.HTMLAttributes<HTMLHRElement>> & React.RefAttributes<HTMLHRElement>>;
|
|
14
|
+
export default Divider;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Divider = void 0;
|
|
7
|
+
/*---------------------------------------------------------------------------------------------
|
|
8
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
|
+
*--------------------------------------------------------------------------------------------*/
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
13
|
+
const hooks_1 = require("../hooks");
|
|
14
|
+
require("@itwin/itwinui-css/css/utils.css");
|
|
15
|
+
/**
|
|
16
|
+
* Shows a divider
|
|
17
|
+
*/
|
|
18
|
+
exports.Divider = react_1.default.forwardRef((props, ref) => {
|
|
19
|
+
const { className, orientation = 'horizontal', ...rest } = props;
|
|
20
|
+
(0, hooks_1.useTheme)();
|
|
21
|
+
return (react_1.default.createElement("hr", { className: (0, classnames_1.default)('iui-divider', className), "aria-orientation": orientation === 'vertical' ? 'vertical' : undefined, ref: ref, ...rest }));
|
|
22
|
+
});
|
|
23
|
+
exports.default = exports.Divider;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { PolymorphicComponentProps, PolymorphicForwardRefComponent } from '../props';
|
|
2
|
+
import '@itwin/itwinui-css/css/utils.css';
|
|
3
|
+
declare type LinkActionOwnProps = {};
|
|
4
|
+
declare type LinkBoxOwnProps = {};
|
|
5
|
+
export declare type LinkActionProps = PolymorphicComponentProps<'a', LinkActionOwnProps>;
|
|
6
|
+
export declare type LinkBoxProps = PolymorphicComponentProps<'div', LinkBoxOwnProps>;
|
|
7
|
+
/**
|
|
8
|
+
* Polymorphic link action component.
|
|
9
|
+
* It is rendered as `a` by default.
|
|
10
|
+
* @example
|
|
11
|
+
* <LinkBox>
|
|
12
|
+
* <Surface>
|
|
13
|
+
* <LinkAction href='/new-page'>Whole card is clickable</LinkAction>
|
|
14
|
+
* </Surface>
|
|
15
|
+
* </LinkBox>
|
|
16
|
+
*/
|
|
17
|
+
export declare const LinkAction: PolymorphicForwardRefComponent<"a", LinkActionOwnProps>;
|
|
18
|
+
/**
|
|
19
|
+
* Polymorphic link box component.
|
|
20
|
+
* Used to wrap around your component to use LinkAction.
|
|
21
|
+
* Rendered as `div` by default
|
|
22
|
+
* @example
|
|
23
|
+
* <LinkBox>
|
|
24
|
+
* <Surface>
|
|
25
|
+
* <LinkAction href='/new-page'>Whole card is clickable</LinkAction>
|
|
26
|
+
* </Surface>
|
|
27
|
+
* </LinkBox>
|
|
28
|
+
*/
|
|
29
|
+
export declare const LinkBox: PolymorphicForwardRefComponent<"div", LinkBoxOwnProps>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LinkBox = exports.LinkAction = void 0;
|
|
7
|
+
/*---------------------------------------------------------------------------------------------
|
|
8
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
|
+
*--------------------------------------------------------------------------------------------*/
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
13
|
+
require("@itwin/itwinui-css/css/utils.css");
|
|
14
|
+
/**
|
|
15
|
+
* Polymorphic link action component.
|
|
16
|
+
* It is rendered as `a` by default.
|
|
17
|
+
* @example
|
|
18
|
+
* <LinkBox>
|
|
19
|
+
* <Surface>
|
|
20
|
+
* <LinkAction href='/new-page'>Whole card is clickable</LinkAction>
|
|
21
|
+
* </Surface>
|
|
22
|
+
* </LinkBox>
|
|
23
|
+
*/
|
|
24
|
+
exports.LinkAction = react_1.default.forwardRef((props, ref) => {
|
|
25
|
+
const { as: Element = 'a', className, ...rest } = props;
|
|
26
|
+
return (react_1.default.createElement(Element, { ref: ref, className: (0, classnames_1.default)('iui-link-action', className), ...rest }));
|
|
27
|
+
});
|
|
28
|
+
exports.LinkAction.displayName = 'LinkAction';
|
|
29
|
+
/**
|
|
30
|
+
* Polymorphic link box component.
|
|
31
|
+
* Used to wrap around your component to use LinkAction.
|
|
32
|
+
* Rendered as `div` by default
|
|
33
|
+
* @example
|
|
34
|
+
* <LinkBox>
|
|
35
|
+
* <Surface>
|
|
36
|
+
* <LinkAction href='/new-page'>Whole card is clickable</LinkAction>
|
|
37
|
+
* </Surface>
|
|
38
|
+
* </LinkBox>
|
|
39
|
+
*/
|
|
40
|
+
exports.LinkBox = react_1.default.forwardRef((props, ref) => {
|
|
41
|
+
const { as: Element = 'div', className, ...rest } = props;
|
|
42
|
+
return (react_1.default.createElement(Element, { ref: ref, className: (0, classnames_1.default)('iui-link-box', className), ...rest }));
|
|
43
|
+
});
|
|
44
|
+
exports.LinkBox.displayName = 'LinkBox';
|
|
@@ -40,8 +40,9 @@ const Resizer = (props) => {
|
|
|
40
40
|
const minWidth = parseFloat(getComputedStyle(elementRef.current).minWidth);
|
|
41
41
|
const minHeight = parseFloat(getComputedStyle(elementRef.current).minHeight);
|
|
42
42
|
const resizer = event.currentTarget.dataset.iuiResizer;
|
|
43
|
-
const
|
|
44
|
-
|
|
43
|
+
const ownerDocument = elementRef.current.ownerDocument || document;
|
|
44
|
+
const originalUserSelect = ownerDocument.body.style.userSelect;
|
|
45
|
+
ownerDocument.body.style.userSelect = 'none';
|
|
45
46
|
const onResizePointerMove = (event) => {
|
|
46
47
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
47
48
|
if (!elementRef.current) {
|
|
@@ -52,8 +53,8 @@ const Resizer = (props) => {
|
|
|
52
53
|
onResizeStart === null || onResizeStart === void 0 ? void 0 : onResizeStart();
|
|
53
54
|
}
|
|
54
55
|
const containerRect = (_a = containerRef === null || containerRef === void 0 ? void 0 : containerRef.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
|
|
55
|
-
const clientX = (0, functions_1.getBoundedValue)(event.clientX, (_b = containerRect === null || containerRect === void 0 ? void 0 : containerRect.left) !== null && _b !== void 0 ? _b : 0, (_d = (_c = containerRect === null || containerRect === void 0 ? void 0 : containerRect.right) !== null && _c !== void 0 ? _c :
|
|
56
|
-
const clientY = (0, functions_1.getBoundedValue)(event.clientY, (_e = containerRect === null || containerRect === void 0 ? void 0 : containerRect.top) !== null && _e !== void 0 ? _e : 0, (_g = (_f = containerRect === null || containerRect === void 0 ? void 0 : containerRect.bottom) !== null && _f !== void 0 ? _f :
|
|
56
|
+
const clientX = (0, functions_1.getBoundedValue)(event.clientX, (_b = containerRect === null || containerRect === void 0 ? void 0 : containerRect.left) !== null && _b !== void 0 ? _b : 0, (_d = (_c = containerRect === null || containerRect === void 0 ? void 0 : containerRect.right) !== null && _c !== void 0 ? _c : ownerDocument.documentElement.clientWidth) !== null && _d !== void 0 ? _d : 0);
|
|
57
|
+
const clientY = (0, functions_1.getBoundedValue)(event.clientY, (_e = containerRect === null || containerRect === void 0 ? void 0 : containerRect.top) !== null && _e !== void 0 ? _e : 0, (_g = (_f = containerRect === null || containerRect === void 0 ? void 0 : containerRect.bottom) !== null && _f !== void 0 ? _f : ownerDocument.documentElement.clientHeight) !== null && _g !== void 0 ? _g : 0);
|
|
57
58
|
const diffX = initialPointerX - clientX;
|
|
58
59
|
const diffY = initialPointerY - clientY;
|
|
59
60
|
switch (resizer) {
|
|
@@ -128,12 +129,11 @@ const Resizer = (props) => {
|
|
|
128
129
|
break;
|
|
129
130
|
}
|
|
130
131
|
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
ownerDocument.addEventListener('pointermove', onResizePointerMove);
|
|
133
|
+
ownerDocument.addEventListener('pointerup', () => {
|
|
134
|
+
ownerDocument.removeEventListener('pointermove', onResizePointerMove);
|
|
134
135
|
if (elementRef.current) {
|
|
135
|
-
|
|
136
|
-
originalUserSelect;
|
|
136
|
+
ownerDocument.body.style.userSelect = originalUserSelect;
|
|
137
137
|
isResizing.current = false;
|
|
138
138
|
onResizeEnd === null || onResizeEnd === void 0 ? void 0 : onResizeEnd({
|
|
139
139
|
width,
|
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import '@itwin/itwinui-css/css/utils.css';
|
|
3
|
-
|
|
2
|
+
import type { PolymorphicComponentProps, PolymorphicForwardRefComponent } from '../props';
|
|
3
|
+
declare type VisuallyHiddenOwnProps = {
|
|
4
|
+
/**
|
|
5
|
+
* When VisuallyHidden is used with an interactive element (e.g. button),
|
|
6
|
+
* that element will "unhide" (become visible again) when focused.
|
|
7
|
+
*
|
|
8
|
+
* @default true
|
|
9
|
+
*/
|
|
10
|
+
unhideOnFocus?: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare type VisuallyHiddenProps = PolymorphicComponentProps<'span', VisuallyHiddenOwnProps>;
|
|
4
13
|
/**
|
|
5
|
-
* Hides content visually but
|
|
14
|
+
* Hides content visually but keeps it still accessible to screen readers
|
|
15
|
+
* and other assistive technologies.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <div aria-hidden='true'>★★★☆☆</div>
|
|
19
|
+
* <VisuallyHidden>3 stars out of 5</VisuallyHidden>
|
|
20
|
+
*
|
|
21
|
+
* @see https://www.scottohara.me/blog/2017/04/14/inclusively-hidden.html
|
|
6
22
|
*/
|
|
7
|
-
export declare const VisuallyHidden:
|
|
8
|
-
ref?: ((instance: HTMLDivElement | null) => void) | React.RefObject<HTMLDivElement> | null | undefined;
|
|
9
|
-
}, "key" | keyof React.HTMLAttributes<HTMLDivElement>> & React.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
export declare const VisuallyHidden: PolymorphicForwardRefComponent<"span", VisuallyHiddenOwnProps>;
|
|
10
24
|
export default VisuallyHidden;
|
|
@@ -13,11 +13,18 @@ const classnames_1 = __importDefault(require("classnames"));
|
|
|
13
13
|
const hooks_1 = require("../hooks");
|
|
14
14
|
require("@itwin/itwinui-css/css/utils.css");
|
|
15
15
|
/**
|
|
16
|
-
* Hides content visually but
|
|
16
|
+
* Hides content visually but keeps it still accessible to screen readers
|
|
17
|
+
* and other assistive technologies.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* <div aria-hidden='true'>★★★☆☆</div>
|
|
21
|
+
* <VisuallyHidden>3 stars out of 5</VisuallyHidden>
|
|
22
|
+
*
|
|
23
|
+
* @see https://www.scottohara.me/blog/2017/04/14/inclusively-hidden.html
|
|
17
24
|
*/
|
|
18
25
|
exports.VisuallyHidden = react_1.default.forwardRef((props, ref) => {
|
|
19
|
-
const { className, ...rest } = props;
|
|
26
|
+
const { as: Element = 'span', className, unhideOnFocus = true, ...rest } = props;
|
|
20
27
|
(0, hooks_1.useTheme)();
|
|
21
|
-
return (react_1.default.createElement(
|
|
28
|
+
return (react_1.default.createElement(Element, { className: (0, classnames_1.default)('iui-visually-hidden', className), "data-iui-unhide-on-focus": unhideOnFocus ? true : undefined, ref: ref, ...rest }));
|
|
22
29
|
});
|
|
23
30
|
exports.default = exports.VisuallyHidden;
|
|
@@ -28,3 +28,5 @@ __exportStar(require("./VirtualScroll"), exports);
|
|
|
28
28
|
__exportStar(require("./VisuallyHidden"), exports);
|
|
29
29
|
__exportStar(require("./Icon"), exports);
|
|
30
30
|
__exportStar(require("./Flex"), exports);
|
|
31
|
+
__exportStar(require("./Divider"), exports);
|
|
32
|
+
__exportStar(require("./LinkAction"), exports);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.supportsHas = void 0;
|
|
8
|
+
const dom_1 = require("./dom");
|
|
9
|
+
/**
|
|
10
|
+
* Returns true if the :has selector is supported in the browser
|
|
11
|
+
*/
|
|
12
|
+
const supportsHas = () => { var _a, _b, _c; return (_c = (_b = (_a = (0, dom_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.CSS) === null || _b === void 0 ? void 0 : _b.supports) === null || _c === void 0 ? void 0 : _c.call(_b, 'selector(:has(+ *))'); };
|
|
13
|
+
exports.supportsHas = supportsHas;
|
|
@@ -30,4 +30,5 @@ __exportStar(require("./useSafeContext"), exports);
|
|
|
30
30
|
__exportStar(require("./useLatestRef"), exports);
|
|
31
31
|
__exportStar(require("./useIsomorphicLayoutEffect"), exports);
|
|
32
32
|
__exportStar(require("./useIsThemeAlreadySet"), exports);
|
|
33
|
+
__exportStar(require("./useIsClient"), exports);
|
|
33
34
|
__exportStar(require("./useId"), exports);
|
|
@@ -94,10 +94,11 @@ const useDragAndDrop = (elementRef, containerRef, enabled = true) => {
|
|
|
94
94
|
originalUserSelect.current = elementRef.current.style.userSelect;
|
|
95
95
|
// Prevents from selecting inner content when dragging.
|
|
96
96
|
elementRef.current.style.userSelect = 'none';
|
|
97
|
-
elementRef.current.ownerDocument
|
|
98
|
-
|
|
97
|
+
const ownerDocument = elementRef.current.ownerDocument || document;
|
|
98
|
+
ownerDocument.addEventListener('pointermove', onPointerMove.current);
|
|
99
|
+
ownerDocument.addEventListener('pointerup', () => {
|
|
99
100
|
setTransform(`translate(${translateX.current}px, ${translateY.current}px)`);
|
|
100
|
-
|
|
101
|
+
ownerDocument.removeEventListener('pointermove', onPointerMove.current);
|
|
101
102
|
if (elementRef.current) {
|
|
102
103
|
elementRef.current.style.userSelect = originalUserSelect.current;
|
|
103
104
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useIsClient: () => boolean;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.useIsClient = void 0;
|
|
7
|
+
/*---------------------------------------------------------------------------------------------
|
|
8
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
9
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
10
|
+
*--------------------------------------------------------------------------------------------*/
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const useIsClient = () => {
|
|
13
|
+
const [isClient, setIsClient] = react_1.default.useState(false);
|
|
14
|
+
react_1.default.useEffect(() => {
|
|
15
|
+
setIsClient(true);
|
|
16
|
+
}, []);
|
|
17
|
+
return isClient;
|
|
18
|
+
};
|
|
19
|
+
exports.useIsClient = useIsClient;
|