@itwin/itwinui-react 1.28.0 → 1.29.3
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 +27 -0
- package/cjs/core/Breadcrumbs/Breadcrumbs.js +1 -1
- package/cjs/core/Buttons/Button/Button.d.ts +6 -26
- package/cjs/core/Buttons/Button/Button.js +2 -2
- package/cjs/core/Buttons/DropdownButton/DropdownButton.d.ts +1 -1
- package/cjs/core/Buttons/IconButton/IconButton.d.ts +3 -8
- package/cjs/core/Buttons/IconButton/IconButton.js +2 -2
- package/cjs/core/Buttons/SplitButton/SplitButton.d.ts +9 -7
- package/cjs/core/Buttons/SplitButton/SplitButton.js +7 -4
- package/cjs/core/Checkbox/Checkbox.js +2 -2
- package/cjs/core/ColorPicker/ColorInputPanel.js +2 -2
- package/cjs/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/cjs/core/DatePicker/DatePicker.js +14 -15
- package/cjs/core/Header/HeaderButton.d.ts +6 -4
- package/cjs/core/Header/HeaderButton.js +3 -4
- package/cjs/core/LabeledInput/LabeledInput.d.ts +1 -1
- package/cjs/core/Modal/Modal.js +4 -1
- package/cjs/core/Radio/Radio.js +1 -1
- package/cjs/core/SideNavigation/SidenavButton.d.ts +3 -13
- package/cjs/core/Table/TablePaginator.js +11 -5
- package/cjs/core/Typography/Anchor/Anchor.d.ts +3 -0
- package/cjs/core/Typography/Anchor/Anchor.js +41 -0
- package/cjs/core/Typography/Anchor/index.d.ts +3 -0
- package/cjs/core/Typography/Anchor/index.js +10 -0
- package/cjs/core/Typography/Text/Text.d.ts +6 -10
- package/cjs/core/Typography/Text/Text.js +3 -4
- package/cjs/core/Typography/index.d.ts +1 -0
- package/cjs/core/Typography/index.js +3 -1
- package/cjs/core/index.d.ts +1 -1
- package/cjs/core/index.js +2 -1
- package/cjs/core/utils/hooks/useTheme.js +20 -3
- package/cjs/core/utils/props.d.ts +29 -1
- package/esm/core/Breadcrumbs/Breadcrumbs.js +1 -1
- package/esm/core/Buttons/Button/Button.d.ts +6 -26
- package/esm/core/Buttons/Button/Button.js +3 -3
- package/esm/core/Buttons/DropdownButton/DropdownButton.d.ts +1 -1
- package/esm/core/Buttons/IconButton/IconButton.d.ts +3 -8
- package/esm/core/Buttons/IconButton/IconButton.js +2 -2
- package/esm/core/Buttons/SplitButton/SplitButton.d.ts +9 -7
- package/esm/core/Buttons/SplitButton/SplitButton.js +7 -3
- package/esm/core/Checkbox/Checkbox.js +2 -2
- package/esm/core/ColorPicker/ColorInputPanel.js +2 -2
- package/esm/core/ColorPicker/ColorSwatch.d.ts +1 -1
- package/esm/core/DatePicker/DatePicker.js +14 -15
- package/esm/core/Header/HeaderButton.d.ts +6 -4
- package/esm/core/Header/HeaderButton.js +3 -3
- package/esm/core/LabeledInput/LabeledInput.d.ts +1 -1
- package/esm/core/Modal/Modal.js +4 -1
- package/esm/core/Radio/Radio.js +1 -1
- package/esm/core/SideNavigation/SidenavButton.d.ts +3 -13
- package/esm/core/Table/TablePaginator.js +11 -5
- package/esm/core/Typography/Anchor/Anchor.d.ts +3 -0
- package/esm/core/Typography/Anchor/Anchor.js +35 -0
- package/esm/core/Typography/Anchor/index.d.ts +3 -0
- package/esm/core/Typography/Anchor/index.js +6 -0
- package/esm/core/Typography/Text/Text.d.ts +6 -10
- package/esm/core/Typography/Text/Text.js +4 -4
- package/esm/core/Typography/index.d.ts +1 -0
- package/esm/core/Typography/index.js +1 -0
- package/esm/core/index.d.ts +1 -1
- package/esm/core/index.js +1 -1
- package/esm/core/utils/hooks/useTheme.js +20 -3
- package/esm/core/utils/props.d.ts +29 -1
- package/package.json +9 -5
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { PolymorphicComponentProps, PolymorphicForwardRefComponent } from '../../utils';
|
|
3
3
|
import '@itwin/itwinui-css/css/text.css';
|
|
4
|
-
declare type TextOwnProps
|
|
5
|
-
/**
|
|
6
|
-
* What element should the text be rendered as?
|
|
7
|
-
* @default 'div'
|
|
8
|
-
*/
|
|
9
|
-
as?: T;
|
|
4
|
+
declare type TextOwnProps = {
|
|
10
5
|
/**
|
|
11
6
|
* Which typography variant/size should be used for the styling?
|
|
12
7
|
*
|
|
@@ -30,8 +25,9 @@ declare type TextOwnProps<T extends React.ElementType | React.ComponentType = 'd
|
|
|
30
25
|
* @default false
|
|
31
26
|
*/
|
|
32
27
|
isSkeleton?: boolean;
|
|
33
|
-
}
|
|
34
|
-
export declare type TextProps<T extends React.ElementType
|
|
28
|
+
};
|
|
29
|
+
export declare type TextProps<T extends React.ElementType = 'div'> = PolymorphicComponentProps<T, TextOwnProps>;
|
|
30
|
+
declare type TextComponent = PolymorphicForwardRefComponent<'div', TextOwnProps>;
|
|
35
31
|
/**
|
|
36
32
|
* Polymorphic typography component to render any kind of text as any kind of element.
|
|
37
33
|
* @example
|
|
@@ -42,5 +38,5 @@ export declare type TextProps<T extends React.ElementType | React.ComponentType
|
|
|
42
38
|
* <Text isMuted>Some muted text.</Text>
|
|
43
39
|
* <Text isSkeleton>Skeleton text</Text>
|
|
44
40
|
*/
|
|
45
|
-
export declare const Text:
|
|
41
|
+
export declare const Text: TextComponent;
|
|
46
42
|
export default Text;
|
|
@@ -44,7 +44,7 @@ require("@itwin/itwinui-css/css/text.css");
|
|
|
44
44
|
* <Text isMuted>Some muted text.</Text>
|
|
45
45
|
* <Text isSkeleton>Skeleton text</Text>
|
|
46
46
|
*/
|
|
47
|
-
|
|
47
|
+
exports.Text = react_1.default.forwardRef(function (props, ref) {
|
|
48
48
|
var _a;
|
|
49
49
|
var _b = props.variant, variant = _b === void 0 ? 'body' : _b, _c = props.as, Element = _c === void 0 ? 'div' : _c, className = props.className, _d = props.isMuted, isMuted = _d === void 0 ? false : _d, _e = props.isSkeleton, isSkeleton = _e === void 0 ? false : _e, rest = __rest(props, ["variant", "as", "className", "isMuted", "isSkeleton"]);
|
|
50
50
|
(0, utils_1.useTheme)();
|
|
@@ -53,7 +53,6 @@ var Text = function (props) {
|
|
|
53
53
|
_a['iui-text-block'] = variant === 'body',
|
|
54
54
|
_a['iui-text-muted'] = isMuted,
|
|
55
55
|
_a['iui-skeleton'] = isSkeleton,
|
|
56
|
-
_a), className) }, rest)));
|
|
57
|
-
};
|
|
58
|
-
exports.Text = Text;
|
|
56
|
+
_a), className), ref: ref }, rest)));
|
|
57
|
+
});
|
|
59
58
|
exports.default = exports.Text;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Text = exports.KbdKeys = exports.Kbd = exports.Code = exports.Blockquote = exports.Small = exports.Body = exports.Leading = exports.Subheading = exports.Title = exports.Headline = void 0;
|
|
3
|
+
exports.Text = exports.KbdKeys = exports.Kbd = exports.Code = exports.Blockquote = exports.Small = exports.Body = exports.Leading = exports.Subheading = exports.Title = exports.Headline = exports.Anchor = 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
|
+
var Anchor_1 = require("./Anchor");
|
|
9
|
+
Object.defineProperty(exports, "Anchor", { enumerable: true, get: function () { return Anchor_1.Anchor; } });
|
|
8
10
|
var Headline_1 = require("./Headline");
|
|
9
11
|
Object.defineProperty(exports, "Headline", { enumerable: true, get: function () { return Headline_1.Headline; } });
|
|
10
12
|
var Title_1 = require("./Title");
|
package/cjs/core/index.d.ts
CHANGED
|
@@ -80,7 +80,7 @@ export { ToggleSwitch } from './ToggleSwitch';
|
|
|
80
80
|
export type { ToggleSwitchProps } from './ToggleSwitch';
|
|
81
81
|
export { Tooltip } from './Tooltip';
|
|
82
82
|
export type { TooltipProps } from './Tooltip';
|
|
83
|
-
export { Body, Headline, Leading, Small, Subheading, Title, Blockquote, Code, Kbd, KbdKeys, Text, } from './Typography';
|
|
83
|
+
export { Anchor, Body, Headline, Leading, Small, Subheading, Title, Blockquote, Code, Kbd, KbdKeys, Text, } from './Typography';
|
|
84
84
|
export type { BodyProps, HeadlineProps, LeadingProps, SmallProps, SubheadingProps, TitleProps, BlockquoteProps, CodeProps, KbdProps, TextProps, } from './Typography';
|
|
85
85
|
export { UserIcon } from './UserIcon';
|
|
86
86
|
export type { UserIconProps, StatusTitles, UserIconStatus } from './UserIcon';
|
package/cjs/core/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ModalButtonBar = exports.Modal = exports.MenuExtraContent = exports.MenuDivider = exports.MenuItem = exports.Menu = exports.LabeledTextarea = exports.LabeledSelect = exports.InputGroup = exports.LabeledInput = exports.Label = exports.Input = exports.InformationPanelContent = exports.InformationPanelBody = exports.InformationPanelHeader = exports.InformationPanelWrapper = exports.InformationPanel = exports.HorizontalTab = exports.HorizontalTabs = exports.Tab = exports.VerticalTabs = exports.HeaderLogo = exports.HeaderButton = exports.HeaderBreadcrumbs = exports.Header = exports.Footer = exports.FileUploadTemplate = exports.FileUpload = exports.Fieldset = exports.ExpandableBlock = exports.ErrorPage = exports.DropdownMenu = exports.generateLocalizedStrings = exports.DatePicker = exports.ComboBox = exports.ColorPalette = exports.ColorInputPanel = exports.ColorBuilder = exports.ColorSwatch = exports.ColorPicker = exports.Checkbox = exports.ButtonGroup = exports.SplitButton = exports.IdeasButton = exports.IconButton = exports.DropdownButton = exports.Button = exports.Breadcrumbs = exports.Badge = exports.Alert = void 0;
|
|
7
|
-
exports.MiddleTextTruncation = exports.ColorValue = exports.useTheme = exports.getUserColor = exports.Wizard = exports.UserIconGroup = exports.UserIcon = exports.Text = exports.KbdKeys = exports.Kbd = exports.Code = exports.Blockquote = exports.Title = exports.Subheading = exports.Small = exports.Leading = exports.Headline = exports.Body = exports.Tooltip = exports.ToggleSwitch = exports.ThemeProvider = exports.toaster = exports.TimePicker = exports.Tile = exports.Textarea = exports.TagContainer = exports.Tag = exports.TablePaginator = exports.EditableCell = exports.DefaultCell = exports.FilterButtonBar = exports.tableFilters = exports.Table = exports.Slider = exports.SidenavSubmenuHeader = exports.SidenavSubmenu = exports.SidenavButton = exports.SideNavigation = exports.Select = exports.RadioTileGroup = exports.RadioTile = exports.Radio = exports.ProgressRadial = exports.ProgressLinear = void 0;
|
|
7
|
+
exports.MiddleTextTruncation = exports.ColorValue = exports.useTheme = exports.getUserColor = exports.Wizard = exports.UserIconGroup = exports.UserIcon = exports.Text = exports.KbdKeys = exports.Kbd = exports.Code = exports.Blockquote = exports.Title = exports.Subheading = exports.Small = exports.Leading = exports.Headline = exports.Body = exports.Anchor = exports.Tooltip = exports.ToggleSwitch = exports.ThemeProvider = exports.toaster = exports.TimePicker = exports.Tile = exports.Textarea = exports.TagContainer = exports.Tag = exports.TablePaginator = exports.EditableCell = exports.DefaultCell = exports.FilterButtonBar = exports.tableFilters = exports.Table = exports.Slider = exports.SidenavSubmenuHeader = exports.SidenavSubmenu = exports.SidenavButton = exports.SideNavigation = exports.Select = exports.RadioTileGroup = exports.RadioTile = exports.Radio = exports.ProgressRadial = exports.ProgressLinear = void 0;
|
|
8
8
|
/*---------------------------------------------------------------------------------------------
|
|
9
9
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
10
10
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -127,6 +127,7 @@ Object.defineProperty(exports, "ToggleSwitch", { enumerable: true, get: function
|
|
|
127
127
|
var Tooltip_1 = require("./Tooltip");
|
|
128
128
|
Object.defineProperty(exports, "Tooltip", { enumerable: true, get: function () { return Tooltip_1.Tooltip; } });
|
|
129
129
|
var Typography_1 = require("./Typography");
|
|
130
|
+
Object.defineProperty(exports, "Anchor", { enumerable: true, get: function () { return Typography_1.Anchor; } });
|
|
130
131
|
Object.defineProperty(exports, "Body", { enumerable: true, get: function () { return Typography_1.Body; } });
|
|
131
132
|
Object.defineProperty(exports, "Headline", { enumerable: true, get: function () { return Typography_1.Headline; } });
|
|
132
133
|
Object.defineProperty(exports, "Leading", { enumerable: true, get: function () { return Typography_1.Leading; } });
|
|
@@ -26,20 +26,33 @@ var useTheme = function (theme, themeOptions) {
|
|
|
26
26
|
}
|
|
27
27
|
}, [ownerDocument]);
|
|
28
28
|
react_1.default.useLayoutEffect(function () {
|
|
29
|
-
var _a, _b;
|
|
29
|
+
var _a, _b, _c, _d, _e;
|
|
30
30
|
if (!ownerDocument) {
|
|
31
31
|
return;
|
|
32
32
|
}
|
|
33
|
+
var prefersDarkMediaQuery = (_b = (_a = (0, dom_1.getWindow)()) === null || _a === void 0 ? void 0 : _a.matchMedia) === null || _b === void 0 ? void 0 : _b.call(_a, '(prefers-color-scheme: dark)');
|
|
34
|
+
var addOSTheme = function (_a) {
|
|
35
|
+
var isDark = _a.matches;
|
|
36
|
+
if (isDark) {
|
|
37
|
+
addDarkTheme(ownerDocument);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
addLightTheme(ownerDocument);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
33
43
|
switch (theme) {
|
|
34
44
|
case 'light':
|
|
45
|
+
(_c = prefersDarkMediaQuery === null || prefersDarkMediaQuery === void 0 ? void 0 : prefersDarkMediaQuery.removeEventListener) === null || _c === void 0 ? void 0 : _c.call(prefersDarkMediaQuery, 'change', addOSTheme);
|
|
35
46
|
addLightTheme(ownerDocument);
|
|
36
47
|
break;
|
|
37
48
|
case 'dark':
|
|
49
|
+
(_d = prefersDarkMediaQuery === null || prefersDarkMediaQuery === void 0 ? void 0 : prefersDarkMediaQuery.removeEventListener) === null || _d === void 0 ? void 0 : _d.call(prefersDarkMediaQuery, 'change', addOSTheme);
|
|
38
50
|
addDarkTheme(ownerDocument);
|
|
39
51
|
break;
|
|
40
52
|
case 'os':
|
|
41
|
-
if (
|
|
42
|
-
|
|
53
|
+
if (prefersDarkMediaQuery != undefined) {
|
|
54
|
+
addOSTheme(prefersDarkMediaQuery);
|
|
55
|
+
(_e = prefersDarkMediaQuery.addEventListener) === null || _e === void 0 ? void 0 : _e.call(prefersDarkMediaQuery, 'change', addOSTheme);
|
|
43
56
|
}
|
|
44
57
|
else {
|
|
45
58
|
addLightTheme(ownerDocument);
|
|
@@ -50,6 +63,10 @@ var useTheme = function (theme, themeOptions) {
|
|
|
50
63
|
addLightTheme(ownerDocument);
|
|
51
64
|
}
|
|
52
65
|
}
|
|
66
|
+
return function () {
|
|
67
|
+
var _a;
|
|
68
|
+
(_a = prefersDarkMediaQuery === null || prefersDarkMediaQuery === void 0 ? void 0 : prefersDarkMediaQuery.removeEventListener) === null || _a === void 0 ? void 0 : _a.call(prefersDarkMediaQuery, 'change', addOSTheme);
|
|
69
|
+
};
|
|
53
70
|
}, [ownerDocument, theme]);
|
|
54
71
|
};
|
|
55
72
|
exports.useTheme = useTheme;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
2
|
export declare type ClassNameProps = {
|
|
3
3
|
/**
|
|
4
4
|
* Custom CSS class name.
|
|
@@ -21,3 +21,31 @@ export declare type CommonProps = {
|
|
|
21
21
|
*/
|
|
22
22
|
id?: string;
|
|
23
23
|
} & StylingProps;
|
|
24
|
+
/**
|
|
25
|
+
* Merges provided Props with the props of T.
|
|
26
|
+
*
|
|
27
|
+
* T can be any native HTML element or a custom component.
|
|
28
|
+
*/
|
|
29
|
+
export declare type PolymorphicComponentProps<T extends React.ElementType, Props = Record<string, unknown>> = Merge<React.ComponentPropsWithoutRef<T>, Props>;
|
|
30
|
+
/**
|
|
31
|
+
* Makes `as` prop available and merges original OwnProps and the inferred props from `as` element.
|
|
32
|
+
* Extends ForwardRefExoticComponent so ref gets the correct type.
|
|
33
|
+
*
|
|
34
|
+
* T should be the default element that is used for the `as` prop.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* type ButtonComponent = PolymorphicForwardRefComponent<'button', ButtonOwnProps>;
|
|
38
|
+
* ...
|
|
39
|
+
* const Button: ButtonComponent = React.forwardRef((props, ref) => {});
|
|
40
|
+
*/
|
|
41
|
+
export interface PolymorphicForwardRefComponent<T, OwnProps = Record<string, unknown>> extends React.ForwardRefExoticComponent<Merge<T extends React.ElementType ? React.ComponentPropsWithRef<T> : never, OwnProps & {
|
|
42
|
+
as?: T;
|
|
43
|
+
}>> {
|
|
44
|
+
<As = T>(props: As extends keyof JSX.IntrinsicElements ? Merge<JSX.IntrinsicElements[As], OwnProps & {
|
|
45
|
+
as: As;
|
|
46
|
+
}> : As extends React.ComponentType<infer P> ? Merge<P, OwnProps & {
|
|
47
|
+
as: As;
|
|
48
|
+
}> : never): React.ReactElement | null;
|
|
49
|
+
}
|
|
50
|
+
declare type Merge<P1, P2> = Omit<P1, keyof P2> & P2;
|
|
51
|
+
export {};
|
|
@@ -78,7 +78,7 @@ export var Breadcrumbs = React.forwardRef(function (props, ref) {
|
|
|
78
78
|
React.createElement(Separator, null))),
|
|
79
79
|
items.length - visibleCount > 0 && (React.createElement(React.Fragment, null,
|
|
80
80
|
React.createElement("li", { className: 'iui-breadcrumbs-item' },
|
|
81
|
-
React.createElement("span",
|
|
81
|
+
React.createElement("span", null, "\u2026")),
|
|
82
82
|
React.createElement(Separator, null))),
|
|
83
83
|
items
|
|
84
84
|
.slice(visibleCount > 1
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { PolymorphicComponentProps, PolymorphicForwardRefComponent } from '../../utils';
|
|
2
3
|
import '@itwin/itwinui-css/css/button.css';
|
|
3
|
-
|
|
4
|
+
declare type ButtonOwnProps = {
|
|
4
5
|
/**
|
|
5
6
|
* Modify size of the button.
|
|
6
7
|
*/
|
|
@@ -23,7 +24,9 @@ export declare type ButtonProps = {
|
|
|
23
24
|
* Content of the button.
|
|
24
25
|
*/
|
|
25
26
|
children?: React.ReactNode;
|
|
26
|
-
}
|
|
27
|
+
};
|
|
28
|
+
export declare type ButtonProps<T extends React.ElementType = 'button'> = PolymorphicComponentProps<T, ButtonOwnProps>;
|
|
29
|
+
declare type ButtonComponent = PolymorphicForwardRefComponent<'button', ButtonOwnProps>;
|
|
27
30
|
/**
|
|
28
31
|
* Generic button component
|
|
29
32
|
* @example
|
|
@@ -33,28 +36,5 @@ export declare type ButtonProps = {
|
|
|
33
36
|
* <Button size='small' styleType='cta'>This is a small call to action button</Button>
|
|
34
37
|
* <Button startIcon={<SvgAdd />}>New</Button>
|
|
35
38
|
*/
|
|
36
|
-
export declare const Button:
|
|
37
|
-
/**
|
|
38
|
-
* Modify size of the button.
|
|
39
|
-
*/
|
|
40
|
-
size?: "small" | "large" | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* Style of the button.
|
|
43
|
-
* Use 'borderless' to hide outline.
|
|
44
|
-
* @default 'default'
|
|
45
|
-
*/
|
|
46
|
-
styleType?: "default" | "cta" | "high-visibility" | "borderless" | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* Icon shown before the main button content.
|
|
49
|
-
*/
|
|
50
|
-
startIcon?: JSX.Element | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* Icon shown after the main button content.
|
|
53
|
-
*/
|
|
54
|
-
endIcon?: JSX.Element | undefined;
|
|
55
|
-
/**
|
|
56
|
-
* Content of the button.
|
|
57
|
-
*/
|
|
58
|
-
children?: React.ReactNode;
|
|
59
|
-
} & React.ButtonHTMLAttributes<HTMLButtonElement> & React.RefAttributes<HTMLButtonElement>>;
|
|
39
|
+
export declare const Button: ButtonComponent;
|
|
60
40
|
export default Button;
|
|
@@ -26,7 +26,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
26
26
|
*--------------------------------------------------------------------------------------------*/
|
|
27
27
|
import cx from 'classnames';
|
|
28
28
|
import React from 'react';
|
|
29
|
-
import { useTheme } from '../../utils';
|
|
29
|
+
import { useTheme, } from '../../utils';
|
|
30
30
|
import '@itwin/itwinui-css/css/button.css';
|
|
31
31
|
/**
|
|
32
32
|
* Generic button component
|
|
@@ -39,9 +39,9 @@ import '@itwin/itwinui-css/css/button.css';
|
|
|
39
39
|
*/
|
|
40
40
|
export var Button = React.forwardRef(function (props, ref) {
|
|
41
41
|
var _a;
|
|
42
|
-
var children = props.children, className = props.className, size = props.size, style = props.style, _b = props.styleType, styleType = _b === void 0 ? 'default' : _b, _c = props.type, type = _c === void 0 ? 'button' : _c, startIcon = props.startIcon, endIcon = props.endIcon, rest = __rest(props, ["children", "className", "size", "style", "styleType", "type", "startIcon", "endIcon"]);
|
|
42
|
+
var children = props.children, className = props.className, size = props.size, style = props.style, _b = props.styleType, styleType = _b === void 0 ? 'default' : _b, _c = props.type, type = _c === void 0 ? 'button' : _c, startIcon = props.startIcon, endIcon = props.endIcon, _d = props.as, Element = _d === void 0 ? 'button' : _d, rest = __rest(props, ["children", "className", "size", "style", "styleType", "type", "startIcon", "endIcon", "as"]);
|
|
43
43
|
useTheme();
|
|
44
|
-
return (React.createElement(
|
|
44
|
+
return (React.createElement(Element, __assign({ ref: ref, className: cx('iui-button', "iui-" + styleType, (_a = {},
|
|
45
45
|
_a["iui-" + size] = !!size,
|
|
46
46
|
_a), className), style: style, type: type }, rest),
|
|
47
47
|
startIcon &&
|
|
@@ -37,5 +37,5 @@ export declare const DropdownButton: React.ForwardRefExoticComponent<{
|
|
|
37
37
|
* @default 'default'
|
|
38
38
|
*/
|
|
39
39
|
styleType?: "default" | "borderless" | undefined;
|
|
40
|
-
} & Omit<ButtonProps
|
|
40
|
+
} & Omit<ButtonProps<"button">, "onClick" | "styleType" | "endIcon"> & React.RefAttributes<HTMLButtonElement>>;
|
|
41
41
|
export default DropdownButton;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
import { ButtonProps } from '../Button';
|
|
2
|
+
import { PolymorphicForwardRefComponent } from '../../utils';
|
|
3
3
|
import '@itwin/itwinui-css/css/button.css';
|
|
4
4
|
export declare type IconButtonProps = {
|
|
5
5
|
/**
|
|
@@ -8,17 +8,12 @@ export declare type IconButtonProps = {
|
|
|
8
8
|
*/
|
|
9
9
|
isActive?: boolean;
|
|
10
10
|
} & Omit<ButtonProps, 'startIcon' | 'endIcon'>;
|
|
11
|
+
declare type IconButtonComponent = PolymorphicForwardRefComponent<'button', IconButtonProps>;
|
|
11
12
|
/**
|
|
12
13
|
* Icon button
|
|
13
14
|
* @example
|
|
14
15
|
* <IconButton><SvgAdd /></IconButton>
|
|
15
16
|
* <IconButton styleType='borderless'><SvgAdd /></IconButton>
|
|
16
17
|
*/
|
|
17
|
-
export declare const IconButton:
|
|
18
|
-
/**
|
|
19
|
-
* Button gets active style.
|
|
20
|
-
* @default false
|
|
21
|
-
*/
|
|
22
|
-
isActive?: boolean | undefined;
|
|
23
|
-
} & Omit<ButtonProps, "startIcon" | "endIcon"> & React.RefAttributes<HTMLButtonElement>>;
|
|
18
|
+
export declare const IconButton: IconButtonComponent;
|
|
24
19
|
export default IconButton;
|
|
@@ -36,9 +36,9 @@ import '@itwin/itwinui-css/css/button.css';
|
|
|
36
36
|
*/
|
|
37
37
|
export var IconButton = React.forwardRef(function (props, ref) {
|
|
38
38
|
var _a;
|
|
39
|
-
var isActive = props.isActive, children = props.children, _b = props.styleType, styleType = _b === void 0 ? 'default' : _b, size = props.size, _c = props.type, type = _c === void 0 ? 'button' : _c, className = props.className, rest = __rest(props, ["isActive", "children", "styleType", "size", "type", "className"]);
|
|
39
|
+
var isActive = props.isActive, children = props.children, _b = props.styleType, styleType = _b === void 0 ? 'default' : _b, size = props.size, _c = props.type, type = _c === void 0 ? 'button' : _c, className = props.className, _d = props.as, Element = _d === void 0 ? 'button' : _d, rest = __rest(props, ["isActive", "children", "styleType", "size", "type", "className", "as"]);
|
|
40
40
|
useTheme();
|
|
41
|
-
return (React.createElement(
|
|
41
|
+
return (React.createElement(Element, __assign({ ref: ref, className: cx('iui-button', "iui-" + styleType, (_a = {},
|
|
42
42
|
_a["iui-" + size] = !!size,
|
|
43
43
|
_a['iui-active'] = isActive,
|
|
44
44
|
_a), className), type: type }, rest), React.cloneElement(children, {
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonProps } from '../Button';
|
|
3
3
|
import { Placement } from 'tippy.js';
|
|
4
|
+
import { PolymorphicForwardRefComponent } from '../../utils';
|
|
4
5
|
import '@itwin/itwinui-css/css/button.css';
|
|
5
|
-
export declare type SplitButtonProps = {
|
|
6
|
-
/**
|
|
7
|
-
* Callback fired on clicking the primary button.
|
|
8
|
-
*/
|
|
9
|
-
onClick: React.MouseEventHandler<HTMLButtonElement>;
|
|
6
|
+
export declare type SplitButtonProps = ButtonProps & {
|
|
10
7
|
/**
|
|
11
8
|
* Items in the dropdown menu.
|
|
12
9
|
* Pass a function that takes the `close` argument (to close the menu),
|
|
@@ -22,9 +19,14 @@ export declare type SplitButtonProps = {
|
|
|
22
19
|
* Content of primary button.
|
|
23
20
|
*/
|
|
24
21
|
children: React.ReactNode;
|
|
25
|
-
}
|
|
22
|
+
};
|
|
23
|
+
declare type SplitButtonComponent = PolymorphicForwardRefComponent<'button', SplitButtonProps>;
|
|
26
24
|
/**
|
|
27
25
|
* Split button component with a DropdownMenu.
|
|
26
|
+
*
|
|
27
|
+
* The delegated props and forwarded ref are passed onto the primary button.
|
|
28
|
+
* It also supports using the `as` prop to change which element is rendered.
|
|
29
|
+
*
|
|
28
30
|
* @example
|
|
29
31
|
* const menuItems = (close: () => void) => [
|
|
30
32
|
* <MenuItem key={1} onClick={onClick(1, close)}>Item #1</MenuItem>,
|
|
@@ -33,5 +35,5 @@ export declare type SplitButtonProps = {
|
|
|
33
35
|
* <SplitButton onClick={onClick} menuItems={menuItems}>Default</SplitButton>
|
|
34
36
|
* <SplitButton onClick={onClick} menuItems={menuItems} styleType='high-visibility'>High visibility</SplitButton>
|
|
35
37
|
*/
|
|
36
|
-
export declare const SplitButton:
|
|
38
|
+
export declare const SplitButton: SplitButtonComponent;
|
|
37
39
|
export default SplitButton;
|
|
@@ -35,6 +35,10 @@ import { useTheme } from '../../utils';
|
|
|
35
35
|
import '@itwin/itwinui-css/css/button.css';
|
|
36
36
|
/**
|
|
37
37
|
* Split button component with a DropdownMenu.
|
|
38
|
+
*
|
|
39
|
+
* The delegated props and forwarded ref are passed onto the primary button.
|
|
40
|
+
* It also supports using the `as` prop to change which element is rendered.
|
|
41
|
+
*
|
|
38
42
|
* @example
|
|
39
43
|
* const menuItems = (close: () => void) => [
|
|
40
44
|
* <MenuItem key={1} onClick={onClick(1, close)}>Item #1</MenuItem>,
|
|
@@ -43,7 +47,7 @@ import '@itwin/itwinui-css/css/button.css';
|
|
|
43
47
|
* <SplitButton onClick={onClick} menuItems={menuItems}>Default</SplitButton>
|
|
44
48
|
* <SplitButton onClick={onClick} menuItems={menuItems} styleType='high-visibility'>High visibility</SplitButton>
|
|
45
49
|
*/
|
|
46
|
-
export var SplitButton = function (props) {
|
|
50
|
+
export var SplitButton = React.forwardRef(function (props, forwardedRef) {
|
|
47
51
|
var onClick = props.onClick, menuItems = props.menuItems, className = props.className, _a = props.menuPlacement, menuPlacement = _a === void 0 ? 'bottom-end' : _a, _b = props.styleType, styleType = _b === void 0 ? 'default' : _b, size = props.size, children = props.children, style = props.style, title = props.title, rest = __rest(props, ["onClick", "menuItems", "className", "menuPlacement", "styleType", "size", "children", "style", "title"]);
|
|
48
52
|
useTheme();
|
|
49
53
|
var _c = React.useState(false), isMenuOpen = _c[0], setIsMenuOpen = _c[1];
|
|
@@ -58,9 +62,9 @@ export var SplitButton = function (props) {
|
|
|
58
62
|
'iui-disabled': props.disabled,
|
|
59
63
|
}), style: style, title: title, ref: ref },
|
|
60
64
|
React.createElement("div", null,
|
|
61
|
-
React.createElement(Button, __assign({ styleType: styleType, size: size, onClick: onClick }, rest), children)),
|
|
65
|
+
React.createElement(Button, __assign({ styleType: styleType, size: size, onClick: onClick, ref: forwardedRef }, rest), children)),
|
|
62
66
|
React.createElement("div", null,
|
|
63
67
|
React.createElement(DropdownMenu, { placement: menuPlacement, menuItems: menuItems, style: { minWidth: menuWidth }, onShow: React.useCallback(function () { return setIsMenuOpen(true); }, []), onHide: React.useCallback(function () { return setIsMenuOpen(false); }, []) },
|
|
64
68
|
React.createElement(IconButton, { styleType: styleType, size: size, disabled: props.disabled }, isMenuOpen ? React.createElement(SvgCaretUpSmall, null) : React.createElement(SvgCaretDownSmall, null))))));
|
|
65
|
-
};
|
|
69
|
+
});
|
|
66
70
|
export default SplitButton;
|
|
@@ -60,8 +60,8 @@ export var Checkbox = React.forwardRef(function (props, ref) {
|
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
var defaultCheckbox = (React.createElement("svg", { viewBox: '0 0 16 16', "aria-hidden": 'true', focusable: 'false' },
|
|
63
|
-
React.createElement("path", { className: 'iui-check', d: '
|
|
64
|
-
React.createElement("path", { className: 'iui-check-partial', d: '
|
|
63
|
+
React.createElement("path", { className: 'iui-check', d: 'm6.5 12.5-4.5-4.5 1.5-1.5 3 3 6-6 1.5 1.5z' }),
|
|
64
|
+
React.createElement("path", { className: 'iui-check-partial', d: 'm2.75 6.875h10.5v2.25h-10.5z' })));
|
|
65
65
|
var visibilityCheckbox = (React.createElement("svg", { viewBox: '0 0 16 16', "aria-hidden": 'true', focusable: 'false' },
|
|
66
66
|
React.createElement("path", { className: 'iui-check', d: 'm8 2.99051a8.81883 8.81883 0 0 0 -8 4.95062 8.74664 8.74664 0 0 0 8 5.06836 8.63266 8.63266 0 0 0 8-5.06836 8.83631 8.83631 0 0 0 -8-4.95062zm-1.31445 1.86981a1.47663 1.47663 0 1 1 -1.47663 1.47668 1.47665 1.47665 0 0 1 1.47663-1.47668zm1.31445 6.64917a7.17486 7.17486 0 0 1 -6.30475-3.55237 7.4952 7.4952 0 0 1 2.81475-2.6336 3.83956 3.83956 0 1 0 6.98126.00244 7.522 7.522 0 0 1 2.81774 2.63916 7.09785 7.09785 0 0 1 -6.309 3.54437z' }),
|
|
67
67
|
React.createElement("g", { className: 'iui-check-partial' },
|
|
@@ -30,6 +30,7 @@ import { IconButton } from '../Buttons';
|
|
|
30
30
|
import { Input } from '../Input';
|
|
31
31
|
import { ColorValue, InputContainer, useTheme } from '../utils';
|
|
32
32
|
import { useColorPickerContext } from './ColorPickerContext';
|
|
33
|
+
import SvgSwap from '@itwin/itwinui-icons-react/cjs/icons/Swap';
|
|
33
34
|
import '@itwin/itwinui-css/css/color-picker.css';
|
|
34
35
|
/**
|
|
35
36
|
* `ColorInputPanel` shows input fields to enter precise color values in the specified format.
|
|
@@ -296,8 +297,7 @@ export var ColorInputPanel = React.forwardRef(function (props, ref) {
|
|
|
296
297
|
: currentFormat.toUpperCase()),
|
|
297
298
|
React.createElement("div", { className: 'iui-color-input' },
|
|
298
299
|
allowedColorFormats.length > 1 && (React.createElement(IconButton, { styleType: 'borderless', onClick: swapColorFormat, size: 'small' },
|
|
299
|
-
React.createElement(
|
|
300
|
-
React.createElement("path", { d: 'm5 15-3.78125-3.5 3.78125-3.5v2h8v3h-8zm6-7 3.78125-3.5-3.78125-3.5v2h-8v3h8z' })))),
|
|
300
|
+
React.createElement(SvgSwap, null))),
|
|
301
301
|
React.createElement("div", { ref: inputsContainerRef, className: 'iui-color-input-fields' },
|
|
302
302
|
currentFormat === 'hex' && hexInputField,
|
|
303
303
|
currentFormat === 'rgb' && rgbInputs,
|
|
@@ -17,5 +17,5 @@ export declare type ColorSwatchProps = {
|
|
|
17
17
|
* <ColorSwatch color='#23450b' onClick={onClick}/>
|
|
18
18
|
* <ColorSwatch color={{ r: 255, g: 255, b: 0 }} onClick={onClick}/>
|
|
19
19
|
*/
|
|
20
|
-
export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "role" | "children" | "className" | "accessKey" | "draggable" | "hidden" | "lang" | "translate" | "prefix" | "contentEditable" | "inputMode" | "tabIndex" | "onFocus" | "color" | "
|
|
20
|
+
export declare const ColorSwatch: React.ForwardRefExoticComponent<Pick<ColorSwatchProps, "dir" | "slot" | "style" | "title" | "id" | "role" | "children" | "className" | "accessKey" | "draggable" | "hidden" | "lang" | "translate" | "prefix" | "contentEditable" | "inputMode" | "tabIndex" | "onFocus" | "color" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "contextMenu" | "placeholder" | "spellCheck" | "radioGroup" | "about" | "datatype" | "inlist" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "is" | "isActive"> & React.RefAttributes<HTMLDivElement>>;
|
|
21
21
|
export default ColorSwatch;
|
|
@@ -247,22 +247,21 @@ export var DatePicker = function (props) {
|
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
249
|
return (React.createElement("div", __assign({ className: cx('iui-date-picker', className), style: style }, rest),
|
|
250
|
-
React.createElement("div",
|
|
251
|
-
React.createElement("div", { className: 'iui-
|
|
252
|
-
React.createElement(
|
|
253
|
-
React.createElement(
|
|
254
|
-
|
|
255
|
-
React.createElement("span", {
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
React.createElement(
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
return (React.createElement("div", { key: "week-" + displayedMonthIndex + "-" + weekIndex, className: 'iui-week' }, weekDays.map(function (weekDay, dayIndex) {
|
|
250
|
+
React.createElement("div", null,
|
|
251
|
+
React.createElement("div", { className: 'iui-calendar-month-year' },
|
|
252
|
+
React.createElement(IconButton, { styleType: 'borderless', onClick: handleMoveToPreviousMonth, "aria-label": 'Previous month' },
|
|
253
|
+
React.createElement(SvgChevronLeft, null)),
|
|
254
|
+
React.createElement("span", { "aria-live": 'polite' },
|
|
255
|
+
React.createElement("span", { className: 'iui-calendar-month', title: monthNames[displayedMonthIndex] }, monthNames[displayedMonthIndex]),
|
|
256
|
+
"\u00A0",
|
|
257
|
+
displayedYear),
|
|
258
|
+
React.createElement(IconButton, { styleType: 'borderless', onClick: handleMoveToNextMonth, "aria-label": 'Next month' },
|
|
259
|
+
React.createElement(SvgChevronRight, null))),
|
|
260
|
+
React.createElement("div", { className: 'iui-calendar-weekdays' }, shortDays.map(function (day, index) { return (React.createElement("div", { key: day, title: longDays[index] }, day)); })),
|
|
261
|
+
React.createElement("div", { onKeyDown: handleCalendarKeyDown, role: 'listbox' }, weeks.map(function (weekDays, weekIndex) {
|
|
262
|
+
return (React.createElement("div", { key: "week-" + displayedMonthIndex + "-" + weekIndex, className: 'iui-calendar-week' }, weekDays.map(function (weekDay, dayIndex) {
|
|
264
263
|
var dateValue = weekDay.getDate();
|
|
265
|
-
return (React.createElement("div", { key: "day-" + displayedMonthIndex + "-" + dayIndex, className: cx('iui-
|
|
264
|
+
return (React.createElement("div", { key: "day-" + displayedMonthIndex + "-" + dayIndex, className: cx('iui-calendar-day', {
|
|
266
265
|
'iui-outside-month': weekDay.getMonth() !== displayedMonthIndex,
|
|
267
266
|
'iui-today': isSameDay(weekDay, new Date()),
|
|
268
267
|
'iui-selected': isSameDay(weekDay, selectedDay),
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ButtonProps, DropdownButtonProps } from '../Buttons';
|
|
3
|
+
import { PolymorphicForwardRefComponent } from '../utils';
|
|
3
4
|
import '@itwin/itwinui-css/css/header.css';
|
|
4
5
|
export declare type HeaderButtonProps = {
|
|
5
6
|
/**
|
|
6
|
-
*
|
|
7
|
+
* Main label of the header button.
|
|
7
8
|
*/
|
|
8
9
|
name: React.ReactNode;
|
|
9
10
|
/**
|
|
10
|
-
* Description shown below the
|
|
11
|
+
* Description shown below the main label, will be hidden in `Header` slim mode.
|
|
11
12
|
*/
|
|
12
13
|
description?: React.ReactNode;
|
|
13
14
|
/**
|
|
@@ -15,7 +16,8 @@ export declare type HeaderButtonProps = {
|
|
|
15
16
|
* @default false
|
|
16
17
|
*/
|
|
17
18
|
isActive?: boolean;
|
|
18
|
-
} &
|
|
19
|
+
} & Partial<Pick<DropdownButtonProps, 'menuItems'>> & Pick<ButtonProps, 'startIcon' | 'endIcon'>;
|
|
20
|
+
declare type HeaderButtonComponent = PolymorphicForwardRefComponent<'button', HeaderButtonProps>;
|
|
19
21
|
/**
|
|
20
22
|
* Header button that handles slim state of the `Header` it's in.
|
|
21
23
|
* When in slim mode, will only display the name and reduce icon size.
|
|
@@ -26,5 +28,5 @@ export declare type HeaderButtonProps = {
|
|
|
26
28
|
* <HeaderButton name='Project C' startIcon={<img style={{ objectFit: 'cover' }} src='project.png' />} />
|
|
27
29
|
* <HeaderButton name='Project D' isActive />
|
|
28
30
|
*/
|
|
29
|
-
export declare const HeaderButton:
|
|
31
|
+
export declare const HeaderButton: HeaderButtonComponent;
|
|
30
32
|
export default HeaderButton;
|
|
@@ -45,7 +45,7 @@ var isDropdownButton = function (props) {
|
|
|
45
45
|
* <HeaderButton name='Project C' startIcon={<img style={{ objectFit: 'cover' }} src='project.png' />} />
|
|
46
46
|
* <HeaderButton name='Project D' isActive />
|
|
47
47
|
*/
|
|
48
|
-
export var HeaderButton = function (props) {
|
|
48
|
+
export var HeaderButton = React.forwardRef(function (props, ref) {
|
|
49
49
|
var name = props.name, description = props.description, _a = props.isActive, isActive = _a === void 0 ? false : _a, className = props.className, startIcon = props.startIcon, menuItems = props.menuItems, rest = __rest(props, ["name", "description", "isActive", "className", "startIcon", "menuItems"]);
|
|
50
50
|
useTheme();
|
|
51
51
|
var buttonProps = __assign(__assign({ startIcon: React.isValidElement(startIcon)
|
|
@@ -58,7 +58,7 @@ export var HeaderButton = function (props) {
|
|
|
58
58
|
'iui-active': isActive,
|
|
59
59
|
}, className), 'aria-current': isActive ? 'location' : undefined, children: (React.createElement(React.Fragment, null,
|
|
60
60
|
React.createElement("div", null, name),
|
|
61
|
-
description && React.createElement("div", { className: 'iui-description' }, description))) }, (!!menuItems && { menuItems: menuItems })), rest);
|
|
61
|
+
description && React.createElement("div", { className: 'iui-description' }, description))), ref: ref }, (!!menuItems && { menuItems: menuItems })), rest);
|
|
62
62
|
if (isSplitButton(buttonProps)) {
|
|
63
63
|
return React.createElement(SplitButton, __assign({}, buttonProps));
|
|
64
64
|
}
|
|
@@ -66,5 +66,5 @@ export var HeaderButton = function (props) {
|
|
|
66
66
|
return React.createElement(DropdownButton, __assign({}, buttonProps));
|
|
67
67
|
}
|
|
68
68
|
return React.createElement(Button, __assign({}, buttonProps));
|
|
69
|
-
};
|
|
69
|
+
});
|
|
70
70
|
export default HeaderButton;
|
|
@@ -84,7 +84,7 @@ export declare const LabeledInput: React.ForwardRefExoticComponent<{
|
|
|
84
84
|
* - 'inline' - appears in the same line as input.
|
|
85
85
|
* @default 'default'
|
|
86
86
|
*/
|
|
87
|
-
displayStyle?: "
|
|
87
|
+
displayStyle?: "default" | "inline" | undefined;
|
|
88
88
|
/**
|
|
89
89
|
* Set display style of icon.
|
|
90
90
|
* Supported values:
|
package/esm/core/Modal/Modal.js
CHANGED
|
@@ -104,13 +104,16 @@ export var Modal = function (props) {
|
|
|
104
104
|
var handleMouseDown = function (event) {
|
|
105
105
|
// Prevents React from resetting its properties
|
|
106
106
|
event.persist();
|
|
107
|
+
if (event.target !== overlayRef.current) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
107
110
|
if (isDismissible && closeOnExternalClick && onClose) {
|
|
108
111
|
onClose(event);
|
|
109
112
|
}
|
|
110
113
|
};
|
|
111
114
|
return !!container ? (ReactDOM.createPortal(isOpen && (React.createElement(FocusTrap, null,
|
|
112
115
|
React.createElement("div", __assign({ className: cx('iui-modal', 'iui-modal-visible', className), tabIndex: -1, onKeyDown: handleKeyDown, ref: overlayRef, onMouseDown: handleMouseDown }, rest),
|
|
113
|
-
React.createElement("div", { className: 'iui-modal-dialog', id: id, style: style, role: 'dialog', "aria-modal": 'true'
|
|
116
|
+
React.createElement("div", { className: 'iui-modal-dialog', id: id, style: style, role: 'dialog', "aria-modal": 'true' },
|
|
114
117
|
React.createElement("div", { className: 'iui-title-bar' },
|
|
115
118
|
React.createElement("div", { className: 'iui-title' }, title),
|
|
116
119
|
isDismissible && (React.createElement(IconButton, { size: 'small', styleType: 'borderless', onClick: onClose, "aria-label": 'Close' },
|
package/esm/core/Radio/Radio.js
CHANGED
|
@@ -52,7 +52,7 @@ export var Radio = React.forwardRef(function (props, ref) {
|
|
|
52
52
|
React.createElement("input", __assign({ disabled: disabled, type: 'radio', ref: refs }, rest)),
|
|
53
53
|
React.createElement("span", { className: cx('iui-radio-dot', checkmarkClassName), style: checkmarkStyle },
|
|
54
54
|
React.createElement("svg", { viewBox: '0 0 16 16', "aria-hidden": 'true', focusable: 'false' },
|
|
55
|
-
React.createElement("circle", { cx: '8', cy: '8', r: '
|
|
55
|
+
React.createElement("circle", { cx: '8', cy: '8', r: '4' }))),
|
|
56
56
|
label && React.createElement("span", { className: 'iui-label' }, label)));
|
|
57
57
|
});
|
|
58
58
|
export default Radio;
|