@redsift/design-system 11.6.0-muiv5-alpha.5 → 11.6.0-muiv5-alpha.7
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/_internal/Alert2.js +182 -39
- package/_internal/AppBar.js +240 -29
- package/_internal/AppContainer.js +132 -86
- package/_internal/AppContent.js +84 -17
- package/_internal/Badge2.js +137 -4
- package/_internal/BreadcrumbItem.js +85 -3
- package/_internal/Breadcrumbs2.js +86 -21
- package/_internal/Button2.js +81 -20
- package/_internal/ButtonGroup.js +165 -25
- package/_internal/ButtonLink.js +74 -18
- package/_internal/Card2.js +151 -29
- package/_internal/CardActions.js +38 -3
- package/_internal/CardBody.js +36 -3
- package/_internal/CardHeader.js +77 -3
- package/_internal/Checkbox2.js +234 -58
- package/_internal/CheckboxGroup.js +182 -4
- package/_internal/ConditionalWrapper.js +11 -12
- package/_internal/DetailedCard.js +6912 -48
- package/_internal/DetailedCardCollapsibleSectionItems.js +58 -3
- package/_internal/DetailedCardHeader.js +61 -3
- package/_internal/DetailedCardSection.js +166 -3
- package/_internal/DetailedCardSectionItem.js +88 -3
- package/_internal/Flexbox2.js +85 -22
- package/_internal/Grid2.js +87 -24
- package/_internal/GridItem.js +34 -3
- package/_internal/Heading2.js +107 -3
- package/_internal/Icon2.js +206 -5
- package/_internal/IconButton.js +71 -3
- package/_internal/IconButtonLink.js +65 -18
- package/_internal/Item2.js +390 -73
- package/_internal/Link2.js +56 -15
- package/_internal/LinkButton.js +56 -13
- package/_internal/Number2.js +103 -61
- package/_internal/NumberField.js +3959 -65
- package/_internal/Pill2.js +400 -4
- package/_internal/ProgressBar.js +61 -18
- package/_internal/Radio2.js +227 -56
- package/_internal/RadioGroup.js +170 -4
- package/_internal/Shield2.js +220 -4
- package/_internal/SideNavigationMenu.js +586 -4
- package/_internal/SideNavigationMenuItem.js +299 -4
- package/_internal/Skeleton2.js +36 -9
- package/_internal/SkeletonCircle.js +52 -3
- package/_internal/SkeletonText.js +71 -3
- package/_internal/Spinner2.js +319 -29
- package/_internal/Switch2.js +310 -56
- package/_internal/SwitchGroup.js +182 -4
- package/_internal/Text2.js +45 -3
- package/_internal/TextArea.js +430 -20
- package/_internal/TextField.js +463 -19
- package/_internal/alert.js +2 -5
- package/_internal/app-bar.js +2 -8
- package/_internal/app-container.js +3 -9
- package/_internal/app-content.js +2 -5
- package/_internal/app-side-panel.js +3 -11
- package/_internal/badge.js +2 -6
- package/_internal/breadcrumb-item.js +1 -4
- package/_internal/breadcrumbs.js +2 -6
- package/_internal/button-group.js +2 -5
- package/_internal/button-link.js +2 -8
- package/_internal/button.js +3 -8
- package/_internal/card-actions.js +1 -4
- package/_internal/card-body.js +1 -4
- package/_internal/card-header.js +1 -8
- package/_internal/card.js +2 -11
- package/_internal/checkbox-group.js +2 -6
- package/_internal/checkbox.js +2 -6
- package/_internal/colors.js +87 -91
- package/_internal/conditional-wrapper.js +2 -2
- package/_internal/detailed-card-collapsible-section-items.js +1 -3
- package/_internal/detailed-card-header.js +1 -7
- package/_internal/detailed-card-section-item.js +1 -10
- package/_internal/detailed-card-section.js +1 -6
- package/_internal/detailed-card.js +2 -16
- package/_internal/flexbox.js +2 -5
- package/_internal/focus-within-group.js +3 -3
- package/_internal/fonts.js +4 -6
- package/_internal/gradient-border.js +35 -16
- package/_internal/grid-item.js +1 -4
- package/_internal/grid.js +2 -6
- package/_internal/heading.js +2 -6
- package/_internal/icon-button-link.js +2 -8
- package/_internal/icon-button.js +2 -6
- package/_internal/icon.js +2 -6
- package/_internal/item.js +2 -8
- package/_internal/link-button.js +2 -8
- package/_internal/link.js +3 -8
- package/_internal/listbox.js +3 -6
- package/_internal/number-field.js +2 -9
- package/_internal/number.js +2 -7
- package/_internal/pill.js +2 -6
- package/_internal/progress-bar.js +2 -5
- package/_internal/radio-group.js +2 -6
- package/_internal/radio.js +2 -6
- package/_internal/shared.js +2 -5
- package/_internal/shield.js +2 -6
- package/_internal/side-navigation-menu-bar.js +3 -9
- package/_internal/side-navigation-menu-item.js +2 -8
- package/_internal/side-navigation-menu.js +2 -8
- package/_internal/skeleton-circle.js +1 -6
- package/_internal/skeleton-text.js +2 -6
- package/_internal/skeleton.js +1 -7
- package/_internal/spinner.js +2 -5
- package/_internal/styles.js +235 -17
- package/_internal/styles2.js +44 -280
- package/_internal/switch-group.js +2 -6
- package/_internal/switch.js +2 -6
- package/_internal/text-area.js +2 -9
- package/_internal/text-field.js +2 -10
- package/_internal/text.js +2 -6
- package/_internal/theme.js +1 -3
- package/_internal/types.js +7 -31
- package/_internal/types2.js +18 -29
- package/_internal/types3.js +15 -18
- package/_internal/useAppSidePanel.js +331 -6
- package/_internal/useFocusOnList.js +502 -44
- package/_internal/useListboxItem.js +120 -23
- package/_internal/useSideNavigationMenuBar.js +371 -7
- package/_internal/useTheme.js +10 -8
- package/index.d.ts +4667 -0
- package/index.js +523 -1674
- package/package.json +2 -2
- package/_internal/SideNavigationMenuBar.js +0 -9
- package/_internal/helpers.js +0 -23
- package/_internal/types10.js +0 -20
- package/_internal/types11.js +0 -27
- package/_internal/types12.js +0 -35
- package/_internal/types13.js +0 -143
- package/_internal/types14.js +0 -11
- package/_internal/types15.js +0 -62
- package/_internal/types16.js +0 -56
- package/_internal/types17.js +0 -57
- package/_internal/types18.js +0 -40
- package/_internal/types19.js +0 -101
- package/_internal/types20.js +0 -47
- package/_internal/types21.js +0 -68
- package/_internal/types22.js +0 -52
- package/_internal/types23.js +0 -174
- package/_internal/types24.js +0 -18
- package/_internal/types25.js +0 -12
- package/_internal/types26.js +0 -36
- package/_internal/types27.js +0 -72
- package/_internal/types28.js +0 -73
- package/_internal/types29.js +0 -99
- package/_internal/types4.js +0 -67
- package/_internal/types5.js +0 -11
- package/_internal/types6.js +0 -11
- package/_internal/types7.js +0 -28
- package/_internal/types8.js +0 -72
- package/_internal/types9.js +0 -16
|
@@ -1,29 +1,94 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React__default, { forwardRef } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { w as warnIfNoAccessibleLabelFound } from './warnIfNoAccessibleLabelFound.js';
|
|
5
|
+
import styled, { css } from 'styled-components';
|
|
6
|
+
import { i as baseStyling } from './styles4.js';
|
|
7
|
+
import { f as filterComponents } from './filterComponents.js';
|
|
8
|
+
import { B as BreadcrumbItem } from './BreadcrumbItem.js';
|
|
9
|
+
import { u as useTheme, a as ThemeProvider } from './useTheme.js';
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
|
-
* Component
|
|
12
|
+
* Component style.
|
|
9
13
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
const StyledBreadcrumbs = styled.nav`
|
|
15
|
+
${baseStyling}
|
|
16
|
+
|
|
17
|
+
ol {
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
list-style: none;
|
|
20
|
+
padding: unset;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.redsift-breadcrumbs__separator {
|
|
24
|
+
font-family: var(--redsift-typography-body-font-family);
|
|
25
|
+
font-size: var(--redsift-typography-body-font-size);
|
|
26
|
+
font-weight: var(--redsift-typography-body-font-weight);
|
|
27
|
+
line-height: var(--redsift-typography-body-line-height);
|
|
28
|
+
margin: 0px 4px;
|
|
29
|
+
|
|
30
|
+
${_ref => {
|
|
31
|
+
let {
|
|
32
|
+
$isDisabled,
|
|
33
|
+
$theme
|
|
34
|
+
} = _ref;
|
|
35
|
+
return $isDisabled ? css`
|
|
36
|
+
color: var(--redsift-color-neutral-mid-grey);
|
|
37
|
+
` : css`
|
|
38
|
+
color: var(--redsift-color-${$theme}-components-text-primary);
|
|
39
|
+
`;
|
|
40
|
+
}}
|
|
41
|
+
}
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
const _excluded = ["children", "className", "isDisabled", "theme"];
|
|
45
|
+
const COMPONENT_NAME = 'Breadcrumbs';
|
|
46
|
+
const CLASSNAME = 'redsift-breadcrumbs';
|
|
20
47
|
|
|
21
48
|
/**
|
|
22
49
|
* The Breadcrumbs components is a list of links to the parent pages of the current page in hierarchical order.
|
|
23
50
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
51
|
+
const BaseBreadcrumbs = /*#__PURE__*/forwardRef((props, ref) => {
|
|
52
|
+
const {
|
|
53
|
+
children,
|
|
54
|
+
className,
|
|
55
|
+
isDisabled,
|
|
56
|
+
theme: propsTheme
|
|
57
|
+
} = props,
|
|
58
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
59
|
+
warnIfNoAccessibleLabelFound(props, undefined, 'Breadcrumbs');
|
|
60
|
+
const theme = useTheme(propsTheme);
|
|
61
|
+
const childArray = filterComponents([Breadcrumbs.Item])(children);
|
|
62
|
+
const breadcrumbItems = childArray.map((child, index) => {
|
|
63
|
+
var _child$key;
|
|
64
|
+
const isCurrent = index === childArray.length - 1;
|
|
65
|
+
return /*#__PURE__*/React__default.createElement("li", {
|
|
66
|
+
key: index
|
|
67
|
+
}, /*#__PURE__*/React__default.createElement(Breadcrumbs.Item, _extends({
|
|
68
|
+
isDisabled: child.props.isDisabled || isDisabled || undefined
|
|
69
|
+
}, child.props, {
|
|
70
|
+
key: (_child$key = child.key) !== null && _child$key !== void 0 ? _child$key : index,
|
|
71
|
+
isCurrent: isCurrent
|
|
72
|
+
})), isCurrent === false ? /*#__PURE__*/React__default.createElement("span", {
|
|
73
|
+
className: `${BaseBreadcrumbs.className}__separator`
|
|
74
|
+
}, '/') : null);
|
|
75
|
+
});
|
|
76
|
+
return /*#__PURE__*/React__default.createElement(ThemeProvider, {
|
|
77
|
+
value: {
|
|
78
|
+
theme
|
|
79
|
+
}
|
|
80
|
+
}, /*#__PURE__*/React__default.createElement(StyledBreadcrumbs, _extends({}, forwardedProps, {
|
|
81
|
+
$isDisabled: isDisabled,
|
|
82
|
+
$theme: theme,
|
|
83
|
+
className: classNames(BaseBreadcrumbs.className, className),
|
|
84
|
+
ref: ref
|
|
85
|
+
}), /*#__PURE__*/React__default.createElement("ol", null, breadcrumbItems)));
|
|
86
|
+
});
|
|
87
|
+
BaseBreadcrumbs.className = CLASSNAME;
|
|
88
|
+
BaseBreadcrumbs.displayName = COMPONENT_NAME;
|
|
89
|
+
const Breadcrumbs = Object.assign(BaseBreadcrumbs, {
|
|
90
|
+
Item: BreadcrumbItem
|
|
91
|
+
});
|
|
28
92
|
|
|
29
|
-
export {
|
|
93
|
+
export { BaseBreadcrumbs as B, Breadcrumbs as a };
|
|
94
|
+
//# sourceMappingURL=Breadcrumbs2.js.map
|
package/_internal/Button2.js
CHANGED
|
@@ -1,22 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React__default, { forwardRef, useRef } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { B as ButtonVariant, S as StyledButton } from './styles.js';
|
|
5
|
+
import { StyledGradientBorder } from './gradient-border.js';
|
|
6
|
+
import { B as ButtonsColorPalette } from './colors.js';
|
|
7
|
+
import { C as ConditionalWrapper } from './ConditionalWrapper.js';
|
|
8
|
+
import { a as Icon } from './Icon2.js';
|
|
9
|
+
import { S as Spinner } from './Spinner2.js';
|
|
10
|
+
import { u as useTheme } from './useTheme.js';
|
|
5
11
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
declare const StyledButton: styled_components.StyledComponent<"button", any, ButtonProps & {
|
|
10
|
-
$color: string | undefined;
|
|
11
|
-
$fullWidth?: boolean | undefined;
|
|
12
|
-
$isActive: boolean | undefined;
|
|
13
|
-
$isDisabled: boolean | undefined;
|
|
14
|
-
$isGradient: boolean;
|
|
15
|
-
$isHovered: boolean | undefined;
|
|
16
|
-
$isLoading: boolean | undefined;
|
|
17
|
-
$theme: Theme | undefined;
|
|
18
|
-
$variant: ButtonVariant | undefined;
|
|
19
|
-
}, never>;
|
|
12
|
+
const _excluded = ["children", "className", "color", "disabled", "fullWidth", "isActive", "isDisabled", "isHovered", "isLoading", "leftIcon", "leftIconProps", "rightIcon", "rightIconProps", "theme", "variant"];
|
|
13
|
+
const COMPONENT_NAME = 'Button';
|
|
14
|
+
const CLASSNAME = 'redsift-button';
|
|
20
15
|
|
|
21
16
|
/**
|
|
22
17
|
* The Button is a semantic button that looks like a button.
|
|
@@ -25,6 +20,72 @@ declare const StyledButton: styled_components.StyledComponent<"button", any, But
|
|
|
25
20
|
* For a semantic link that looks like a link, please use the Link component.
|
|
26
21
|
* For a semantic button that looks like a link, please use the LinkButton component.
|
|
27
22
|
*/
|
|
28
|
-
|
|
23
|
+
const Button = /*#__PURE__*/forwardRef((props, ref) => {
|
|
24
|
+
const _ref = useRef();
|
|
25
|
+
const buttonRef = ref || _ref;
|
|
26
|
+
const {
|
|
27
|
+
children,
|
|
28
|
+
className,
|
|
29
|
+
color: propsColor,
|
|
30
|
+
disabled,
|
|
31
|
+
fullWidth,
|
|
32
|
+
isActive,
|
|
33
|
+
isDisabled: propsIsDisabled,
|
|
34
|
+
isHovered,
|
|
35
|
+
isLoading,
|
|
36
|
+
leftIcon,
|
|
37
|
+
leftIconProps,
|
|
38
|
+
rightIcon,
|
|
39
|
+
rightIconProps,
|
|
40
|
+
theme: propsTheme,
|
|
41
|
+
variant: propsVariant
|
|
42
|
+
} = props,
|
|
43
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
44
|
+
const isDisabled = isLoading || propsIsDisabled || disabled;
|
|
45
|
+
const theme = useTheme(propsTheme);
|
|
46
|
+
const color = Object.values(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';
|
|
47
|
+
const variant = Object.values(ButtonVariant).includes(propsVariant) ? propsVariant : 'primary';
|
|
48
|
+
const isGradient = color === ButtonsColorPalette.radar;
|
|
49
|
+
return /*#__PURE__*/React__default.createElement(ConditionalWrapper, {
|
|
50
|
+
condition: isGradient && variant === ButtonVariant.secondary,
|
|
51
|
+
wrapper: children => /*#__PURE__*/React__default.createElement(StyledGradientBorder, {
|
|
52
|
+
$color: color,
|
|
53
|
+
$isActive: isActive,
|
|
54
|
+
$isDisabled: isDisabled,
|
|
55
|
+
$isHovered: isHovered,
|
|
56
|
+
$theme: theme
|
|
57
|
+
}, children)
|
|
58
|
+
}, /*#__PURE__*/React__default.createElement(StyledButton, _extends({
|
|
59
|
+
type: "button"
|
|
60
|
+
}, forwardedProps, {
|
|
61
|
+
$color: color,
|
|
62
|
+
$fullWidth: fullWidth,
|
|
63
|
+
$isActive: isActive,
|
|
64
|
+
$isDisabled: isDisabled,
|
|
65
|
+
$isGradient: isGradient,
|
|
66
|
+
$isHovered: isHovered,
|
|
67
|
+
$isLoading: isLoading,
|
|
68
|
+
$theme: theme,
|
|
69
|
+
$variant: variant,
|
|
70
|
+
"aria-disabled": isDisabled,
|
|
71
|
+
className: classNames(Button.className, className),
|
|
72
|
+
disabled: isDisabled,
|
|
73
|
+
ref: buttonRef
|
|
74
|
+
}), leftIcon ? /*#__PURE__*/React__default.createElement(Icon, _extends({
|
|
75
|
+
icon: leftIcon,
|
|
76
|
+
"aria-hidden": "true",
|
|
77
|
+
className: "left"
|
|
78
|
+
}, leftIconProps)) : null, isLoading ? /*#__PURE__*/React__default.createElement(Spinner, {
|
|
79
|
+
size: "small",
|
|
80
|
+
color: variant === ButtonVariant.primary ? 'grey-l1' : 'grey-l2'
|
|
81
|
+
}) : null, /*#__PURE__*/React__default.createElement("span", null, children), rightIcon ? /*#__PURE__*/React__default.createElement(Icon, _extends({
|
|
82
|
+
icon: rightIcon,
|
|
83
|
+
"aria-hidden": "true",
|
|
84
|
+
className: "right"
|
|
85
|
+
}, rightIconProps)) : null));
|
|
86
|
+
});
|
|
87
|
+
Button.className = CLASSNAME;
|
|
88
|
+
Button.displayName = COMPONENT_NAME;
|
|
29
89
|
|
|
30
|
-
export { Button as B
|
|
90
|
+
export { Button as B };
|
|
91
|
+
//# sourceMappingURL=Button2.js.map
|
package/_internal/ButtonGroup.js
CHANGED
|
@@ -1,41 +1,181 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React__default, { forwardRef } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import styled, { css } from 'styled-components';
|
|
5
|
+
import { i as baseStyling, g as baseFlexbox } from './styles4.js';
|
|
6
|
+
import { i as isComponent } from './isComponent.js';
|
|
7
|
+
import { u as useTheme } from './useTheme.js';
|
|
8
|
+
import { B as ButtonsColorPalette } from './colors.js';
|
|
9
|
+
import { f as filterComponents } from './filterComponents.js';
|
|
5
10
|
|
|
6
11
|
/**
|
|
7
12
|
* Component variant.
|
|
8
13
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
const ButtonGroupVariant = {
|
|
15
|
+
primary: 'primary',
|
|
16
|
+
secondary: 'secondary',
|
|
17
|
+
unstyled: 'unstyled'
|
|
13
18
|
};
|
|
14
|
-
|
|
19
|
+
|
|
15
20
|
/**
|
|
16
21
|
* Component color.
|
|
17
22
|
*/
|
|
18
|
-
|
|
23
|
+
|
|
19
24
|
/**
|
|
20
25
|
* Component props.
|
|
21
26
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Component style.
|
|
30
|
+
*/
|
|
31
|
+
const StyledButtonGroup = styled.div`
|
|
32
|
+
display: ${_ref => {
|
|
33
|
+
let {
|
|
34
|
+
inline
|
|
35
|
+
} = _ref;
|
|
36
|
+
return inline ? 'inline-flex' : 'flex';
|
|
37
|
+
}};
|
|
38
|
+
|
|
39
|
+
${baseStyling}
|
|
40
|
+
${baseFlexbox}
|
|
41
|
+
|
|
42
|
+
${_ref2 => {
|
|
43
|
+
let {
|
|
44
|
+
$color,
|
|
45
|
+
$variant,
|
|
46
|
+
$theme
|
|
47
|
+
} = _ref2;
|
|
48
|
+
return css`
|
|
49
|
+
${$variant === ButtonGroupVariant.secondary ? css`
|
|
50
|
+
.first-button {
|
|
51
|
+
border-top-right-radius: 0;
|
|
52
|
+
border-bottom-right-radius: 0;
|
|
53
|
+
border-right-color: transparent;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.middle-button {
|
|
57
|
+
border-top-left-radius: 0;
|
|
58
|
+
border-bottom-left-radius: 0;
|
|
59
|
+
margin-left: -1px;
|
|
60
|
+
border-top-right-radius: 0;
|
|
61
|
+
border-bottom-right-radius: 0;
|
|
62
|
+
border-right-color: transparent;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.last-button {
|
|
66
|
+
border-top-left-radius: 0;
|
|
67
|
+
border-bottom-left-radius: 0;
|
|
68
|
+
margin-left: -1px;
|
|
69
|
+
}
|
|
70
|
+
` : $variant === ButtonGroupVariant.unstyled ? css`
|
|
71
|
+
.first-button {
|
|
72
|
+
border-top-right-radius: 0;
|
|
73
|
+
border-bottom-right-radius: 0;
|
|
74
|
+
border-right: 1px solid rgba(0, 0, 0, 0.23);
|
|
75
|
+
border-color: ${`var(
|
|
76
|
+
--redsift-color-${$theme}-components-buttons-${$variant}-button-${$color}-text-default
|
|
77
|
+
)`};
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.middle-button {
|
|
81
|
+
border-top-left-radius: 0;
|
|
82
|
+
border-bottom-left-radius: 0;
|
|
83
|
+
border-top-right-radius: 0;
|
|
84
|
+
border-bottom-right-radius: 0;
|
|
85
|
+
border-right: 1px solid rgba(0, 0, 0, 0.23);
|
|
86
|
+
border-color: ${`var(
|
|
87
|
+
--redsift-color-${$theme}-components-buttons-${$variant}-button-${$color}-text-default
|
|
88
|
+
)`};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.last-button {
|
|
92
|
+
border-top-left-radius: 0;
|
|
93
|
+
border-bottom-left-radius: 0;
|
|
94
|
+
}
|
|
95
|
+
` : css`
|
|
96
|
+
.first-button {
|
|
97
|
+
border-top-right-radius: 0;
|
|
98
|
+
border-bottom-right-radius: 0;
|
|
99
|
+
border-right: 1px solid #bdbdbd;
|
|
100
|
+
border-color: ${`var(
|
|
101
|
+
--redsift-color-${$theme}-components-buttons-${$variant}-button-${$color}-background-hover
|
|
102
|
+
)`};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.middle-button {
|
|
106
|
+
border-top-left-radius: 0;
|
|
107
|
+
border-bottom-left-radius: 0;
|
|
108
|
+
border-top-right-radius: 0;
|
|
109
|
+
border-bottom-right-radius: 0;
|
|
110
|
+
border-right: 1px solid #bdbdbd;
|
|
111
|
+
border-color: ${`var(
|
|
112
|
+
--redsift-color-${$theme}-components-buttons-${$variant}-button-${$color}-background-hover
|
|
113
|
+
)`};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.last-button {
|
|
117
|
+
border-top-left-radius: 0;
|
|
118
|
+
border-bottom-left-radius: 0;
|
|
119
|
+
}
|
|
120
|
+
`}
|
|
121
|
+
`;
|
|
122
|
+
}};
|
|
123
|
+
`;
|
|
124
|
+
|
|
125
|
+
const _excluded = ["children", "className", "color", "theme", "variant"];
|
|
126
|
+
const COMPONENT_NAME = 'ButtonGroup';
|
|
127
|
+
const CLASSNAME = 'redsift-button-group';
|
|
35
128
|
|
|
36
129
|
/**
|
|
37
130
|
* The ButtonGroup component.
|
|
38
131
|
*/
|
|
39
|
-
|
|
132
|
+
const ButtonGroup = /*#__PURE__*/forwardRef((props, ref) => {
|
|
133
|
+
const {
|
|
134
|
+
children,
|
|
135
|
+
className,
|
|
136
|
+
color: propsColor,
|
|
137
|
+
theme: propsTheme,
|
|
138
|
+
variant: propsVariant
|
|
139
|
+
} = props,
|
|
140
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
141
|
+
const theme = useTheme(propsTheme);
|
|
142
|
+
const color = Object.values(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';
|
|
143
|
+
const variant = Object.values(ButtonGroupVariant).includes(propsVariant) ? propsVariant : 'primary';
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Create an array containing only valid children being either Button, IconButton, ButtonLink, MenuButton or Select.
|
|
147
|
+
*/
|
|
148
|
+
const childArray = filterComponents(['Button', 'IconButton', 'ButtonLink', 'MenuButton', 'Select', 'Dialog', 'Popover', 'Tooltip'])(children);
|
|
149
|
+
const buttons = childArray.map((child, index) => {
|
|
150
|
+
var _key;
|
|
151
|
+
if (isComponent('MenuButton')(child) || isComponent('Select')(child) || isComponent('Dialog')(child) || isComponent('Popover')(child) || isComponent('Tooltip')(child)) {
|
|
152
|
+
var _child$key;
|
|
153
|
+
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
154
|
+
color,
|
|
155
|
+
theme,
|
|
156
|
+
variant,
|
|
157
|
+
key: (_child$key = child.key) !== null && _child$key !== void 0 ? _child$key : index,
|
|
158
|
+
triggerClassName: index === 0 ? 'first-button' : index === childArray.length - 1 ? 'last-button' : 'middle-button'
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
return /*#__PURE__*/React__default.cloneElement(child, {
|
|
162
|
+
color,
|
|
163
|
+
theme,
|
|
164
|
+
variant,
|
|
165
|
+
key: (_key = child.key) !== null && _key !== void 0 ? _key : index,
|
|
166
|
+
className: index === 0 ? 'first-button' : index === childArray.length - 1 ? 'last-button' : 'middle-button'
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
return /*#__PURE__*/React__default.createElement(StyledButtonGroup, _extends({}, forwardedProps, {
|
|
170
|
+
className: classNames(ButtonGroup.className, className),
|
|
171
|
+
ref: ref,
|
|
172
|
+
$color: color,
|
|
173
|
+
$variant: variant,
|
|
174
|
+
$theme: theme
|
|
175
|
+
}), buttons);
|
|
176
|
+
});
|
|
177
|
+
ButtonGroup.className = CLASSNAME;
|
|
178
|
+
ButtonGroup.displayName = COMPONENT_NAME;
|
|
40
179
|
|
|
41
|
-
export { ButtonGroupVariant as B,
|
|
180
|
+
export { ButtonGroupVariant as B, ButtonGroup as a };
|
|
181
|
+
//# sourceMappingURL=ButtonGroup.js.map
|
package/_internal/ButtonLink.js
CHANGED
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
import { b as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
1
|
+
import { b as _objectWithoutProperties, c as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
+
import React__default, { forwardRef } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { StyledGradientBorder } from './gradient-border.js';
|
|
5
|
+
import { B as ButtonVariant, S as StyledButton } from './styles.js';
|
|
6
|
+
import { u as useTheme } from './useTheme.js';
|
|
7
|
+
import { B as ButtonsColorPalette } from './colors.js';
|
|
8
|
+
import { C as ConditionalWrapper } from './ConditionalWrapper.js';
|
|
9
|
+
import { a as Icon } from './Icon2.js';
|
|
4
10
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
interface ButtonLinkProps extends Omit<LinkProps, 'color'>, Pick<ButtonProps, 'color' | 'isActive' | 'isDisabled' | 'isHovered' | 'leftIcon' | 'leftIconProps' | 'rightIconProps' | 'rightIcon' | 'variant' | 'theme'> {
|
|
9
|
-
}
|
|
10
|
-
type StyledButtonLinkProps = ButtonLinkProps & {
|
|
11
|
-
$isActive: ButtonLinkProps['isActive'];
|
|
12
|
-
$isDisabled: ButtonLinkProps['isDisabled'];
|
|
13
|
-
$isHovered: ButtonLinkProps['isHovered'];
|
|
14
|
-
$variant: ButtonLinkProps['variant'];
|
|
15
|
-
$theme: ButtonLinkProps['theme'];
|
|
16
|
-
$color: ButtonLinkProps['color'];
|
|
17
|
-
};
|
|
11
|
+
const _excluded = ["as", "children", "className", "color", "href", "isActive", "isDisabled", "isHovered", "leftIcon", "leftIconProps", "rightIcon", "rightIconProps", "target", "theme", "variant"];
|
|
12
|
+
const COMPONENT_NAME = 'ButtonLink';
|
|
13
|
+
const CLASSNAME = 'redsift-button-link';
|
|
18
14
|
|
|
19
15
|
/**
|
|
20
16
|
* The ButtonLink is a semantic link that looks like a button.
|
|
@@ -23,6 +19,66 @@ type StyledButtonLinkProps = ButtonLinkProps & {
|
|
|
23
19
|
* For a semantic link that looks like a link, please use the Link component.
|
|
24
20
|
* For a semantic button that looks like a link, please use the LinkButton component.
|
|
25
21
|
*/
|
|
26
|
-
|
|
22
|
+
const ButtonLink = /*#__PURE__*/forwardRef((props, ref) => {
|
|
23
|
+
const {
|
|
24
|
+
as,
|
|
25
|
+
children,
|
|
26
|
+
className,
|
|
27
|
+
color: propsColor,
|
|
28
|
+
href,
|
|
29
|
+
isActive,
|
|
30
|
+
isDisabled,
|
|
31
|
+
isHovered,
|
|
32
|
+
leftIcon,
|
|
33
|
+
leftIconProps,
|
|
34
|
+
rightIcon,
|
|
35
|
+
rightIconProps,
|
|
36
|
+
target,
|
|
37
|
+
theme: propsTheme,
|
|
38
|
+
variant: propsVariant
|
|
39
|
+
} = props,
|
|
40
|
+
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
41
|
+
const theme = useTheme(propsTheme);
|
|
42
|
+
const color = Object.values(ButtonsColorPalette).includes(propsColor) ? propsColor : 'primary';
|
|
43
|
+
const variant = Object.values(ButtonVariant).includes(propsVariant) ? propsVariant : 'primary';
|
|
44
|
+
const isGradient = color === ButtonsColorPalette.radar;
|
|
45
|
+
return /*#__PURE__*/React__default.createElement(ConditionalWrapper, {
|
|
46
|
+
condition: isGradient && variant === ButtonVariant.secondary,
|
|
47
|
+
wrapper: children => /*#__PURE__*/React__default.createElement(StyledGradientBorder, {
|
|
48
|
+
$color: color,
|
|
49
|
+
$isActive: isActive,
|
|
50
|
+
$isDisabled: isDisabled,
|
|
51
|
+
$isHovered: isHovered,
|
|
52
|
+
$theme: theme
|
|
53
|
+
}, children)
|
|
54
|
+
}, /*#__PURE__*/React__default.createElement(StyledButton, _extends({
|
|
55
|
+
as: as || 'a',
|
|
56
|
+
role: "link",
|
|
57
|
+
tabIndex: !isDisabled ? 0 : undefined
|
|
58
|
+
}, forwardedProps, {
|
|
59
|
+
$color: color,
|
|
60
|
+
$isActive: isActive,
|
|
61
|
+
$isDisabled: isDisabled,
|
|
62
|
+
$isHovered: isHovered,
|
|
63
|
+
$isGradient: isGradient,
|
|
64
|
+
$theme: theme,
|
|
65
|
+
$variant: variant,
|
|
66
|
+
className: classNames(ButtonLink.className, className),
|
|
67
|
+
href: !isDisabled ? href : undefined,
|
|
68
|
+
ref: ref,
|
|
69
|
+
target: target
|
|
70
|
+
}), leftIcon ? /*#__PURE__*/React__default.createElement(Icon, _extends({
|
|
71
|
+
icon: leftIcon,
|
|
72
|
+
"aria-hidden": "true",
|
|
73
|
+
className: "left"
|
|
74
|
+
}, leftIconProps)) : null, /*#__PURE__*/React__default.createElement("span", null, children), rightIcon ? /*#__PURE__*/React__default.createElement(Icon, _extends({
|
|
75
|
+
icon: rightIcon,
|
|
76
|
+
"aria-hidden": "true",
|
|
77
|
+
className: "right"
|
|
78
|
+
}, rightIconProps)) : null));
|
|
79
|
+
});
|
|
80
|
+
ButtonLink.className = CLASSNAME;
|
|
81
|
+
ButtonLink.displayName = COMPONENT_NAME;
|
|
27
82
|
|
|
28
|
-
export {
|
|
83
|
+
export { ButtonLink as B };
|
|
84
|
+
//# sourceMappingURL=ButtonLink.js.map
|