@laerdal/life-react-components 6.0.0-dev.26.full → 6.0.0-dev.27
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/README.md +1 -1
- package/dist/Button/DualFunctionButton.cjs +4 -4
- package/dist/Button/DualFunctionButton.cjs.map +1 -1
- package/dist/Button/DualFunctionButton.d.ts +2 -2
- package/dist/Button/DualFunctionButton.js +4 -4
- package/dist/Button/DualFunctionButton.js.map +1 -1
- package/dist/Button/{Button.cjs → TextButton.cjs} +179 -92
- package/dist/Button/TextButton.cjs.map +1 -0
- package/dist/Button/TextButton.d.ts +70 -0
- package/dist/Button/{Button.js → TextButton.js} +178 -91
- package/dist/Button/TextButton.js.map +1 -0
- package/dist/Button/__tests__/Button.test.tsx +8 -8
- package/dist/Button/__tests__/TextButton.test.tsx +45 -0
- package/dist/Button/index.cjs +11 -11
- package/dist/Button/index.cjs.map +1 -1
- package/dist/Button/index.d.ts +2 -2
- package/dist/Button/index.js +2 -2
- package/dist/Button/index.js.map +1 -1
- package/dist/Card/VerticalCard/{Card.cjs → VerticalCard.cjs} +20 -20
- package/dist/Card/VerticalCard/VerticalCard.cjs.map +1 -0
- package/dist/Card/VerticalCard/VerticalCard.d.ts +25 -0
- package/dist/Card/VerticalCard/{Card.js → VerticalCard.js} +19 -19
- package/dist/Card/VerticalCard/VerticalCard.js.map +1 -0
- package/dist/Card/VerticalCard/{CardBottomSection.cjs → VerticalCardBottomSection.cjs} +21 -21
- package/dist/Card/VerticalCard/VerticalCardBottomSection.cjs.map +1 -0
- package/dist/Card/VerticalCard/VerticalCardBottomSection.d.ts +53 -0
- package/dist/Card/VerticalCard/{CardBottomSection.js → VerticalCardBottomSection.js} +21 -21
- package/dist/Card/VerticalCard/VerticalCardBottomSection.js.map +1 -0
- package/dist/Card/VerticalCard/{CardMiddleSection.cjs → VerticalCardMiddleSection.cjs} +16 -16
- package/dist/Card/VerticalCard/VerticalCardMiddleSection.cjs.map +1 -0
- package/dist/Card/VerticalCard/VerticalCardMiddleSection.d.ts +42 -0
- package/dist/Card/VerticalCard/{CardMiddleSection.js → VerticalCardMiddleSection.js} +15 -15
- package/dist/Card/VerticalCard/VerticalCardMiddleSection.js.map +1 -0
- package/dist/Card/VerticalCard/{CardTopSection.cjs → VerticalCardTopSection.cjs} +15 -15
- package/dist/Card/VerticalCard/VerticalCardTopSection.cjs.map +1 -0
- package/dist/Card/VerticalCard/{CardTopSection.d.ts → VerticalCardTopSection.d.ts} +8 -8
- package/dist/Card/VerticalCard/{CardTopSection.js → VerticalCardTopSection.js} +14 -14
- package/dist/Card/VerticalCard/VerticalCardTopSection.js.map +1 -0
- package/dist/Card/{HorizontalCard → VerticalCard}/__tests__/VerticalCard.test.tsx +15 -15
- package/dist/Card/VerticalCard/index.cjs +25 -25
- package/dist/Card/VerticalCard/index.cjs.map +1 -1
- package/dist/Card/VerticalCard/index.d.ts +7 -7
- package/dist/Card/VerticalCard/index.js +7 -7
- package/dist/Card/VerticalCard/index.js.map +1 -1
- package/dist/Dropdown/DropdownContent.cjs +2 -2
- package/dist/Dropdown/DropdownContent.cjs.map +1 -1
- package/dist/Dropdown/DropdownContent.js +2 -2
- package/dist/Dropdown/DropdownContent.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/RightSideNav.cjs +2 -2
- package/dist/GlobalNavigationBar/desktop/RightSideNav.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/RightSideNav.js +3 -3
- package/dist/GlobalNavigationBar/desktop/RightSideNav.js.map +1 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs +1 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.cjs.map +1 -1
- package/dist/GlobalNavigationBar/desktop/UserMenu.js +2 -2
- package/dist/GlobalNavigationBar/desktop/UserMenu.js.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileActionContainer.cjs +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileActionContainer.cjs.map +1 -1
- package/dist/GlobalNavigationBar/mobile/MobileActionContainer.js +2 -2
- package/dist/GlobalNavigationBar/mobile/MobileActionContainer.js.map +1 -1
- package/dist/GlobalNavigationBar/types.cjs.map +1 -1
- package/dist/GlobalNavigationBar/types.d.ts +2 -2
- package/dist/GlobalNavigationBar/types.js.map +1 -1
- package/dist/Modals/ModalContent.cjs +2 -2
- package/dist/Modals/ModalContent.cjs.map +1 -1
- package/dist/Modals/ModalContent.js +3 -3
- package/dist/Modals/ModalContent.js.map +1 -1
- package/dist/Modals/ModalDialog.cjs +2 -2
- package/dist/Modals/ModalDialog.cjs.map +1 -1
- package/dist/Modals/ModalDialog.js +3 -3
- package/dist/Modals/ModalDialog.js.map +1 -1
- package/dist/Modals/ModalTypes.cjs.map +1 -1
- package/dist/Modals/ModalTypes.d.ts +3 -3
- package/dist/Modals/ModalTypes.js.map +1 -1
- package/dist/Popover/Popover.cjs +1 -1
- package/dist/Popover/Popover.cjs.map +1 -1
- package/dist/Popover/Popover.js +2 -2
- package/dist/Popover/Popover.js.map +1 -1
- package/dist/SideMenu/SideMenuFooter.cjs +1 -1
- package/dist/SideMenu/SideMenuFooter.cjs.map +1 -1
- package/dist/SideMenu/SideMenuFooter.js +2 -2
- package/dist/SideMenu/SideMenuFooter.js.map +1 -1
- package/dist/SideMenu/types.cjs.map +1 -1
- package/dist/SideMenu/types.d.ts +2 -2
- package/dist/SideMenu/types.js.map +1 -1
- package/dist/Table/TableBody.cjs +1 -1
- package/dist/Table/TableBody.cjs.map +1 -1
- package/dist/Table/TableBody.js +2 -2
- package/dist/Table/TableBody.js.map +1 -1
- package/dist/Table/TableTypes.cjs.map +1 -1
- package/dist/Table/TableTypes.d.ts +2 -2
- package/dist/Table/TableTypes.js.map +1 -1
- package/dist/Tile/TileCommonItems.cjs +1 -1
- package/dist/Tile/TileCommonItems.cjs.map +1 -1
- package/dist/Tile/TileCommonItems.js +2 -2
- package/dist/Tile/TileCommonItems.js.map +1 -1
- package/dist/Tile/TileTypes.cjs.map +1 -1
- package/dist/Tile/TileTypes.d.ts +2 -2
- package/dist/Tile/TileTypes.js.map +1 -1
- package/dist/Toasters/Toast.cjs +1 -2
- package/dist/Toasters/Toast.cjs.map +1 -1
- package/dist/Toasters/Toast.js +2 -3
- package/dist/Toasters/Toast.js.map +1 -1
- package/package.json +148 -152
- package/dist/Button/Button.cjs.map +0 -1
- package/dist/Button/Button.d.ts +0 -70
- package/dist/Button/Button.js.map +0 -1
- package/dist/Card/VerticalCard/Card.cjs.map +0 -1
- package/dist/Card/VerticalCard/Card.d.ts +0 -25
- package/dist/Card/VerticalCard/Card.js.map +0 -1
- package/dist/Card/VerticalCard/CardBottomSection.cjs.map +0 -1
- package/dist/Card/VerticalCard/CardBottomSection.d.ts +0 -53
- package/dist/Card/VerticalCard/CardBottomSection.js.map +0 -1
- package/dist/Card/VerticalCard/CardMiddleSection.cjs.map +0 -1
- package/dist/Card/VerticalCard/CardMiddleSection.d.ts +0 -42
- package/dist/Card/VerticalCard/CardMiddleSection.js.map +0 -1
- package/dist/Card/VerticalCard/CardTopSection.cjs.map +0 -1
- package/dist/Card/VerticalCard/CardTopSection.js.map +0 -1
- package/dist/Card/__tests__/Card.test.tsx +0 -146
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Size } from '../types';
|
|
3
|
+
export declare const TextButtonContentContainer: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, never>> & string;
|
|
4
|
+
export declare const TextButtonPrimaryStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "$size" | "$width" | "$flatEdge" | "$invertFocus" | "$iconOnly"> & {
|
|
5
|
+
$iconOnly: boolean;
|
|
6
|
+
$size: Size;
|
|
7
|
+
$flatEdge: string | undefined;
|
|
8
|
+
$width: string;
|
|
9
|
+
$invertFocus: boolean | undefined;
|
|
10
|
+
}, never>> & string;
|
|
11
|
+
export declare const TextButtonSecondaryStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "$size" | "$width" | "$flatEdge" | "$invertFocus" | "$iconOnly"> & {
|
|
12
|
+
$iconOnly: boolean;
|
|
13
|
+
$size: Size;
|
|
14
|
+
$flatEdge: string | undefined;
|
|
15
|
+
$width: string;
|
|
16
|
+
$invertFocus: boolean | undefined;
|
|
17
|
+
}, never>, never>> & string;
|
|
18
|
+
export declare const TextButtonTertiaryStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "$size" | "$width" | "$flatEdge" | "$invertFocus" | "$iconOnly"> & {
|
|
19
|
+
$iconOnly: boolean;
|
|
20
|
+
$size: Size;
|
|
21
|
+
$flatEdge: string | undefined;
|
|
22
|
+
$width: string;
|
|
23
|
+
$invertFocus: boolean | undefined;
|
|
24
|
+
}, never>, never>> & string;
|
|
25
|
+
export declare const TextButtonPositiveStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "$size" | "$width" | "$flatEdge" | "$invertFocus" | "$iconOnly"> & {
|
|
26
|
+
$iconOnly: boolean;
|
|
27
|
+
$size: Size;
|
|
28
|
+
$flatEdge: string | undefined;
|
|
29
|
+
$width: string;
|
|
30
|
+
$invertFocus: boolean | undefined;
|
|
31
|
+
}, never>, never>> & string;
|
|
32
|
+
export declare const TextButtonDestructiveStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "$size" | "$width" | "$flatEdge" | "$invertFocus" | "$iconOnly"> & {
|
|
33
|
+
$iconOnly: boolean;
|
|
34
|
+
$size: Size;
|
|
35
|
+
$flatEdge: string | undefined;
|
|
36
|
+
$width: string;
|
|
37
|
+
$invertFocus: boolean | undefined;
|
|
38
|
+
}, never>, never>> & string;
|
|
39
|
+
export declare const TextButtonSecondaryDestructiveStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<import("styled-components").FastOmit<import("styled-components").FastOmit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "$size" | "$width" | "$flatEdge" | "$invertFocus" | "$iconOnly"> & {
|
|
40
|
+
$iconOnly: boolean;
|
|
41
|
+
$size: Size;
|
|
42
|
+
$flatEdge: string | undefined;
|
|
43
|
+
$width: string;
|
|
44
|
+
$invertFocus: boolean | undefined;
|
|
45
|
+
}, never>, never>> & string;
|
|
46
|
+
export interface TextButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
47
|
+
/** Look and feel variant of the component. Defaults to 'primary'. */
|
|
48
|
+
variant?: 'primary' | 'secondary' | 'tertiary' | 'positive' | 'destructive' | 'secondaryDestructive';
|
|
49
|
+
/** Can be used in order to remove rounded corners on right or left edge of the button. Used by 'DualFunctionButton'. Defaults to 'undefined' */
|
|
50
|
+
flatEdge?: 'right' | 'left' | 'none' | undefined;
|
|
51
|
+
/** Size of the component. Small, Medium or Large. Defaults to 'medium' */
|
|
52
|
+
size?: Size.Small | Size.Medium | Size.Large;
|
|
53
|
+
/** Allows using inverted colors for outlining focus rect. Shown when component focused by keyboard. */
|
|
54
|
+
invertFocus?: boolean;
|
|
55
|
+
/** Can be used to set custom value for width style. Value is set for 'ButtonContent' container. */
|
|
56
|
+
width?: 'auto' | string;
|
|
57
|
+
/** If set, then 'opacity' of children container will be set to 0, and loading indicator will be shown. */
|
|
58
|
+
loading?: boolean;
|
|
59
|
+
/** TestId. Will be set to the top level button component. */
|
|
60
|
+
testId?: string;
|
|
61
|
+
/** Icon that will be shown on the left of the children. */
|
|
62
|
+
icon?: React.ReactNode;
|
|
63
|
+
/** Icon position in the button. Defaults to 'left' */
|
|
64
|
+
iconPosition?: 'left' | 'right';
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* TextButton component
|
|
68
|
+
*/
|
|
69
|
+
declare const TextButton: React.ForwardRefExoticComponent<TextButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
70
|
+
export default TextButton;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _pt from "prop-types";
|
|
4
|
-
const _excluded = ["children", "variant", "type", "size", "
|
|
4
|
+
const _excluded = ["children", "variant", "type", "size", "invertFocus", "width", "testId", "disabled", "flatEdge", "icon", "iconPosition"],
|
|
5
5
|
_excluded2 = ["loading"];
|
|
6
6
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
7
7
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -24,11 +24,11 @@ const getBorderRadius = (flatEdge, radius) => {
|
|
|
24
24
|
return `${radius}px`;
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
export const
|
|
27
|
+
export const TextButtonContentContainer = styled.div`
|
|
28
28
|
min-width: 64px;
|
|
29
29
|
`;
|
|
30
|
-
const
|
|
31
|
-
export const
|
|
30
|
+
const TextButtonBaseStyled = styled.button``;
|
|
31
|
+
export const TextButtonPrimaryStyled = styled(TextButtonBaseStyled)`
|
|
32
32
|
border: none;
|
|
33
33
|
background-color: transparent;
|
|
34
34
|
cursor: pointer;
|
|
@@ -39,22 +39,22 @@ export const ButtonPrimaryStyled = styled(ButtonBaseStyled)`
|
|
|
39
39
|
&.loading-state {
|
|
40
40
|
cursor: wait;
|
|
41
41
|
}
|
|
42
|
-
${
|
|
43
|
-
${props => props.$size === Size.Large ? ComponentLStyling(ComponentTextStyle.Bold,
|
|
42
|
+
${TextButtonContentContainer} {
|
|
43
|
+
${props => props.$size === Size.Large ? ComponentLStyling(ComponentTextStyle.Bold, COLORS.generateToken({
|
|
44
44
|
componentType: 'text',
|
|
45
45
|
isOnFill: true,
|
|
46
46
|
defaultVariant: 'primary'
|
|
47
|
-
}, props.theme)) : props.$size === Size.Small ? ComponentSStyling(ComponentTextStyle.Bold,
|
|
47
|
+
}, props.theme)) : props.$size === Size.Small ? ComponentSStyling(ComponentTextStyle.Bold, COLORS.generateToken({
|
|
48
48
|
componentType: 'text',
|
|
49
49
|
isOnFill: true,
|
|
50
50
|
defaultVariant: 'primary'
|
|
51
|
-
}, props.theme)) : ComponentMStyling(ComponentTextStyle.Bold,
|
|
51
|
+
}, props.theme)) : ComponentMStyling(ComponentTextStyle.Bold, COLORS.generateToken({
|
|
52
52
|
componentType: 'text',
|
|
53
53
|
isOnFill: true,
|
|
54
54
|
defaultVariant: 'primary'
|
|
55
55
|
}, props.theme))};
|
|
56
56
|
|
|
57
|
-
background-color: ${props =>
|
|
57
|
+
background-color: ${props => COLORS.generateToken({
|
|
58
58
|
componentType: 'bg-fill',
|
|
59
59
|
defaultVariant: 'primary'
|
|
60
60
|
}, props.theme)};
|
|
@@ -100,7 +100,7 @@ export const ButtonPrimaryStyled = styled(ButtonBaseStyled)`
|
|
|
100
100
|
height: ${props => props.$size === Size.Large ? '28px' : props.$size === Size.Small ? '20px' : '24px'};
|
|
101
101
|
width: ${props => props.$size === Size.Large ? '28px' : props.$size === Size.Small ? '20px' : '24px'};
|
|
102
102
|
path {
|
|
103
|
-
fill: ${props =>
|
|
103
|
+
fill: ${props => COLORS.generateToken({
|
|
104
104
|
componentType: 'icon',
|
|
105
105
|
isOnFill: true,
|
|
106
106
|
defaultVariant: 'primary'
|
|
@@ -109,27 +109,27 @@ export const ButtonPrimaryStyled = styled(ButtonBaseStyled)`
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
&:hover > ${
|
|
113
|
-
&.hover-state > ${
|
|
114
|
-
background-color: ${props =>
|
|
112
|
+
&:hover > ${TextButtonContentContainer},
|
|
113
|
+
&.hover-state > ${TextButtonContentContainer} {
|
|
114
|
+
background-color: ${props => COLORS.generateToken({
|
|
115
115
|
componentType: 'bg-fill',
|
|
116
116
|
state: 'hover',
|
|
117
117
|
defaultVariant: 'primary'
|
|
118
118
|
}, props.theme)};
|
|
119
|
-
color: ${props =>
|
|
119
|
+
color: ${props => COLORS.generateToken({
|
|
120
120
|
componentType: 'text',
|
|
121
121
|
isOnFill: true,
|
|
122
122
|
defaultVariant: 'primary'
|
|
123
123
|
}, props.theme)};
|
|
124
124
|
}
|
|
125
|
-
&:active > ${
|
|
126
|
-
&.active-state > ${
|
|
127
|
-
background-color: ${props =>
|
|
125
|
+
&:active > ${TextButtonContentContainer},
|
|
126
|
+
&.active-state > ${TextButtonContentContainer} {
|
|
127
|
+
background-color: ${props => COLORS.generateToken({
|
|
128
128
|
componentType: 'bg-fill',
|
|
129
129
|
state: 'active',
|
|
130
130
|
defaultVariant: 'primary'
|
|
131
131
|
}, props.theme)};
|
|
132
|
-
color: ${props =>
|
|
132
|
+
color: ${props => COLORS.generateToken({
|
|
133
133
|
componentType: 'text',
|
|
134
134
|
isOnFill: true,
|
|
135
135
|
defaultVariant: 'primary'
|
|
@@ -138,40 +138,40 @@ export const ButtonPrimaryStyled = styled(ButtonBaseStyled)`
|
|
|
138
138
|
|
|
139
139
|
&:focus,
|
|
140
140
|
&.focus-state {
|
|
141
|
-
${props => props.$invertFocus || props.$invertFocus === undefined
|
|
141
|
+
${props => props.$invertFocus || props.$invertFocus === undefined ? invertedFocusStyles : focusStyles}
|
|
142
142
|
}
|
|
143
143
|
&:disabled,
|
|
144
144
|
&.disabled-state {
|
|
145
145
|
cursor: not-allowed;
|
|
146
146
|
}
|
|
147
|
-
&:disabled > ${
|
|
148
|
-
&.disabled-state > ${
|
|
147
|
+
&:disabled > ${TextButtonContentContainer},
|
|
148
|
+
&.disabled-state > ${TextButtonContentContainer} {
|
|
149
149
|
pointer-events: none;
|
|
150
|
-
background-color: ${props =>
|
|
150
|
+
background-color: ${props => COLORS.generateToken({
|
|
151
151
|
componentType: 'bg-fill',
|
|
152
152
|
state: 'disabled'
|
|
153
153
|
}, props.theme)};
|
|
154
|
-
color: ${props =>
|
|
154
|
+
color: ${props => COLORS.generateToken({
|
|
155
155
|
componentType: 'text',
|
|
156
156
|
isOnFill: true,
|
|
157
157
|
state: 'disabled'
|
|
158
158
|
}, props.theme)};
|
|
159
159
|
}
|
|
160
160
|
`;
|
|
161
|
-
export const
|
|
162
|
-
${
|
|
163
|
-
color: ${props =>
|
|
161
|
+
export const TextButtonSecondaryStyled = styled(TextButtonPrimaryStyled)`
|
|
162
|
+
${TextButtonContentContainer} {
|
|
163
|
+
color: ${props => COLORS.generateToken({
|
|
164
164
|
componentType: 'text',
|
|
165
165
|
defaultVariant: 'primary'
|
|
166
166
|
}, props.theme)};
|
|
167
167
|
background-color: transparent;
|
|
168
168
|
div svg path {
|
|
169
|
-
fill: ${props =>
|
|
169
|
+
fill: ${props => COLORS.generateToken({
|
|
170
170
|
componentType: 'icon',
|
|
171
171
|
defaultVariant: 'primary'
|
|
172
172
|
}, props.theme)};
|
|
173
173
|
}
|
|
174
|
-
box-shadow: inset 0 0 0 2px ${props =>
|
|
174
|
+
box-shadow: inset 0 0 0 2px ${props => COLORS.generateToken({
|
|
175
175
|
componentType: 'border',
|
|
176
176
|
defaultVariant: 'primary'
|
|
177
177
|
}, props.theme)};
|
|
@@ -179,14 +179,14 @@ export const ButtonSecondaryStyled = styled(ButtonPrimaryStyled)`
|
|
|
179
179
|
padding: ${props => props.$size === Size.Large ? '12px 16px' : props.$size === Size.Small ? '4px 8px' : '6px 12px'};
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
&:hover > ${
|
|
183
|
-
&.hover-state > ${
|
|
184
|
-
color: ${props =>
|
|
182
|
+
&:hover > ${TextButtonContentContainer},
|
|
183
|
+
&.hover-state > ${TextButtonContentContainer} {
|
|
184
|
+
color: ${props => COLORS.generateToken({
|
|
185
185
|
componentType: 'text',
|
|
186
186
|
state: 'hover',
|
|
187
187
|
defaultVariant: 'primary'
|
|
188
188
|
}, props.theme)};
|
|
189
|
-
box-shadow: inset 0 0 0 2px ${props =>
|
|
189
|
+
box-shadow: inset 0 0 0 2px ${props => COLORS.generateToken({
|
|
190
190
|
componentType: 'border',
|
|
191
191
|
state: 'hover',
|
|
192
192
|
defaultVariant: 'primary'
|
|
@@ -196,7 +196,7 @@ export const ButtonSecondaryStyled = styled(ButtonPrimaryStyled)`
|
|
|
196
196
|
div {
|
|
197
197
|
svg {
|
|
198
198
|
path {
|
|
199
|
-
fill: ${props =>
|
|
199
|
+
fill: ${props => COLORS.generateToken({
|
|
200
200
|
componentType: 'text',
|
|
201
201
|
state: 'hover',
|
|
202
202
|
defaultVariant: 'primary'
|
|
@@ -205,14 +205,14 @@ export const ButtonSecondaryStyled = styled(ButtonPrimaryStyled)`
|
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
|
-
&:active > ${
|
|
209
|
-
&.active-state > ${
|
|
210
|
-
color: ${props =>
|
|
208
|
+
&:active > ${TextButtonContentContainer},
|
|
209
|
+
&.active-state > ${TextButtonContentContainer} {
|
|
210
|
+
color: ${props => COLORS.generateToken({
|
|
211
211
|
componentType: 'text',
|
|
212
212
|
state: 'active',
|
|
213
213
|
defaultVariant: 'primary'
|
|
214
214
|
}, props.theme)};
|
|
215
|
-
box-shadow: inset 0 0 0 2px ${props =>
|
|
215
|
+
box-shadow: inset 0 0 0 2px ${props => COLORS.generateToken({
|
|
216
216
|
componentType: 'border',
|
|
217
217
|
state: 'active',
|
|
218
218
|
defaultVariant: 'primary'
|
|
@@ -222,7 +222,7 @@ export const ButtonSecondaryStyled = styled(ButtonPrimaryStyled)`
|
|
|
222
222
|
div {
|
|
223
223
|
svg {
|
|
224
224
|
path {
|
|
225
|
-
fill: ${props =>
|
|
225
|
+
fill: ${props => COLORS.generateToken({
|
|
226
226
|
componentType: 'text',
|
|
227
227
|
state: 'hover',
|
|
228
228
|
defaultVariant: 'primary'
|
|
@@ -232,29 +232,29 @@ export const ButtonSecondaryStyled = styled(ButtonPrimaryStyled)`
|
|
|
232
232
|
}
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
&:disabled > ${
|
|
236
|
-
&.disabled-state > ${
|
|
235
|
+
&:disabled > ${TextButtonContentContainer},
|
|
236
|
+
&.disabled-state > ${TextButtonContentContainer} {
|
|
237
237
|
background-color: transparent;
|
|
238
|
-
color: ${props =>
|
|
238
|
+
color: ${props => COLORS.generateToken({
|
|
239
239
|
componentType: 'text',
|
|
240
240
|
state: 'disabled'
|
|
241
241
|
}, props.theme)};
|
|
242
|
-
box-shadow: inset 0 0 0 2px ${props =>
|
|
242
|
+
box-shadow: inset 0 0 0 2px ${props => COLORS.generateToken({
|
|
243
243
|
componentType: 'border',
|
|
244
244
|
state: 'disabled'
|
|
245
245
|
}, props.theme)};
|
|
246
246
|
}
|
|
247
247
|
`;
|
|
248
|
-
export const
|
|
249
|
-
${
|
|
250
|
-
color: ${props =>
|
|
248
|
+
export const TextButtonTertiaryStyled = styled(TextButtonPrimaryStyled)`
|
|
249
|
+
${TextButtonContentContainer} {
|
|
250
|
+
color: ${props => COLORS.generateToken({
|
|
251
251
|
componentType: 'text',
|
|
252
252
|
defaultVariant: 'primary'
|
|
253
253
|
}, props.theme)};
|
|
254
254
|
background-color: transparent;
|
|
255
255
|
|
|
256
256
|
div svg path {
|
|
257
|
-
fill: ${props =>
|
|
257
|
+
fill: ${props => COLORS.generateToken({
|
|
258
258
|
componentType: 'text',
|
|
259
259
|
defaultVariant: 'primary'
|
|
260
260
|
}, props.theme)};
|
|
@@ -263,13 +263,13 @@ ${ButtonContentContainer} {
|
|
|
263
263
|
padding: ${props => props.$size === Size.Large ? '12px 16px' : props.$size === Size.Small ? '4px 8px' : '6px 12px'};
|
|
264
264
|
}
|
|
265
265
|
|
|
266
|
-
&:hover > ${
|
|
267
|
-
&.hover-state > ${
|
|
268
|
-
background-color: ${props =>
|
|
266
|
+
&:hover > ${TextButtonContentContainer},
|
|
267
|
+
&.hover-state > ${TextButtonContentContainer} {
|
|
268
|
+
background-color: ${props => COLORS.generateToken({
|
|
269
269
|
componentType: 'bg-surface',
|
|
270
270
|
state: 'hover'
|
|
271
271
|
}, props.theme)};
|
|
272
|
-
color: ${props =>
|
|
272
|
+
color: ${props => COLORS.generateToken({
|
|
273
273
|
componentType: 'text',
|
|
274
274
|
defaultVariant: 'primary'
|
|
275
275
|
}, props.theme)};
|
|
@@ -277,7 +277,7 @@ ${ButtonContentContainer} {
|
|
|
277
277
|
div {
|
|
278
278
|
svg {
|
|
279
279
|
path {
|
|
280
|
-
fill: ${props =>
|
|
280
|
+
fill: ${props => COLORS.generateToken({
|
|
281
281
|
componentType: 'text',
|
|
282
282
|
defaultVariant: 'primary'
|
|
283
283
|
}, props.theme)};
|
|
@@ -285,13 +285,13 @@ ${ButtonContentContainer} {
|
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
287
|
}
|
|
288
|
-
&:active > ${
|
|
289
|
-
&.active-state > ${
|
|
290
|
-
background-color: ${props =>
|
|
288
|
+
&:active > ${TextButtonContentContainer},
|
|
289
|
+
&.active-state > ${TextButtonContentContainer} {
|
|
290
|
+
background-color: ${props => COLORS.generateToken({
|
|
291
291
|
componentType: 'bg-surface',
|
|
292
292
|
state: 'active'
|
|
293
293
|
}, props.theme)};
|
|
294
|
-
color: ${props =>
|
|
294
|
+
color: ${props => COLORS.generateToken({
|
|
295
295
|
componentType: 'text',
|
|
296
296
|
defaultVariant: 'primary'
|
|
297
297
|
}, props.theme)};
|
|
@@ -299,7 +299,7 @@ ${ButtonContentContainer} {
|
|
|
299
299
|
div {
|
|
300
300
|
svg {
|
|
301
301
|
path {
|
|
302
|
-
fill: ${props =>
|
|
302
|
+
fill: ${props => COLORS.generateToken({
|
|
303
303
|
componentType: 'text',
|
|
304
304
|
defaultVariant: 'primary'
|
|
305
305
|
}, props.theme)};
|
|
@@ -308,8 +308,8 @@ ${ButtonContentContainer} {
|
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
&:disabled > ${
|
|
312
|
-
&.disabled-state > ${
|
|
311
|
+
&:disabled > ${TextButtonContentContainer},
|
|
312
|
+
&.disabled-state > ${TextButtonContentContainer} {
|
|
313
313
|
background-color: transparent !important;
|
|
314
314
|
color: ${props => COLORS.generateToken({
|
|
315
315
|
componentType: 'text',
|
|
@@ -319,44 +319,44 @@ ${ButtonContentContainer} {
|
|
|
319
319
|
border-color: transparent !important;
|
|
320
320
|
}
|
|
321
321
|
`;
|
|
322
|
-
export const
|
|
323
|
-
${
|
|
322
|
+
export const TextButtonPositiveStyled = styled(TextButtonPrimaryStyled)`
|
|
323
|
+
${TextButtonContentContainer} {
|
|
324
324
|
color: white;
|
|
325
325
|
background-color: ${props => COLORS.getColor('positive_500', props.theme)};
|
|
326
326
|
}
|
|
327
|
-
&:hover > ${
|
|
328
|
-
&.hover-state > ${
|
|
327
|
+
&:hover > ${TextButtonContentContainer},
|
|
328
|
+
&.hover-state > ${TextButtonContentContainer} {
|
|
329
329
|
background-color: ${props => COLORS.getColor('positive_700', props.theme)};
|
|
330
330
|
}
|
|
331
|
-
&:active > ${
|
|
332
|
-
&.active-state > ${
|
|
331
|
+
&:active > ${TextButtonContentContainer},
|
|
332
|
+
&.active-state > ${TextButtonContentContainer} {
|
|
333
333
|
background-color: ${props => COLORS.getColor('positive_800', props.theme)};
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
-
&:disabled > ${
|
|
337
|
-
&.disabled-state > ${
|
|
336
|
+
&:disabled > ${TextButtonContentContainer},
|
|
337
|
+
&.disabled-state > ${TextButtonContentContainer} {
|
|
338
338
|
background-color: ${props => COLORS.getColor('neutral_100', props.theme)};
|
|
339
339
|
color: ${props => COLORS.getColor('neutral_300', props.theme)};
|
|
340
340
|
}
|
|
341
341
|
`;
|
|
342
|
-
export const
|
|
343
|
-
|
|
342
|
+
export const TextButtonDestructiveStyled = styled(TextButtonPrimaryStyled)`
|
|
343
|
+
${TextButtonContentContainer} {
|
|
344
344
|
color: white;
|
|
345
345
|
background-color: ${props => COLORS.generateToken({
|
|
346
346
|
componentType: 'bg-fill',
|
|
347
347
|
defaultVariant: 'critical'
|
|
348
348
|
}, props.theme)};
|
|
349
349
|
}
|
|
350
|
-
&:hover > ${
|
|
351
|
-
&.hover-state > ${
|
|
350
|
+
&:hover > ${TextButtonContentContainer},
|
|
351
|
+
&.hover-state > ${TextButtonContentContainer} {
|
|
352
352
|
background-color: ${props => COLORS.generateToken({
|
|
353
353
|
componentType: 'bg-fill',
|
|
354
354
|
state: 'hover',
|
|
355
355
|
defaultVariant: 'critical'
|
|
356
356
|
}, props.theme)};
|
|
357
357
|
}
|
|
358
|
-
&:active > ${
|
|
359
|
-
&.active-state > ${
|
|
358
|
+
&:active > ${TextButtonContentContainer},
|
|
359
|
+
&.active-state > ${TextButtonContentContainer} {
|
|
360
360
|
background-color: ${props => COLORS.generateToken({
|
|
361
361
|
componentType: 'bg-fill',
|
|
362
362
|
state: 'active',
|
|
@@ -364,8 +364,8 @@ export const ButtonCriticalStyled = styled(ButtonPrimaryStyled)`
|
|
|
364
364
|
}, props.theme)};
|
|
365
365
|
}
|
|
366
366
|
|
|
367
|
-
&:disabled > ${
|
|
368
|
-
&.disabled-state > ${
|
|
367
|
+
&:disabled > ${TextButtonContentContainer},
|
|
368
|
+
&.disabled-state > ${TextButtonContentContainer} {
|
|
369
369
|
background-color: ${props => COLORS.generateToken({
|
|
370
370
|
componentType: 'bg-fill',
|
|
371
371
|
state: 'disabled'
|
|
@@ -377,16 +377,102 @@ export const ButtonCriticalStyled = styled(ButtonPrimaryStyled)`
|
|
|
377
377
|
}, props.theme)};
|
|
378
378
|
}
|
|
379
379
|
`;
|
|
380
|
+
export const TextButtonSecondaryDestructiveStyled = styled(TextButtonPrimaryStyled)`
|
|
381
|
+
${TextButtonContentContainer} {
|
|
382
|
+
color: ${props => COLORS.generateToken({
|
|
383
|
+
componentType: 'text',
|
|
384
|
+
defaultVariant: 'critical'
|
|
385
|
+
}, props.theme)};
|
|
386
|
+
background-color: transparent;
|
|
387
|
+
div svg path {
|
|
388
|
+
fill: ${props => COLORS.generateToken({
|
|
389
|
+
componentType: 'icon',
|
|
390
|
+
defaultVariant: 'critical'
|
|
391
|
+
}, props.theme)};
|
|
392
|
+
}
|
|
393
|
+
box-shadow: inset 0 0 0 2px ${props => COLORS.generateToken({
|
|
394
|
+
componentType: 'border',
|
|
395
|
+
defaultVariant: 'critical'
|
|
396
|
+
}, props.theme)};
|
|
397
|
+
|
|
398
|
+
padding: ${props => props.$size === Size.Large ? '12px 16px' : props.$size === Size.Small ? '4px 8px' : '6px 12px'};
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
&:hover > ${TextButtonContentContainer},
|
|
402
|
+
&.hover-state > ${TextButtonContentContainer} {
|
|
403
|
+
color: ${props => COLORS.generateToken({
|
|
404
|
+
componentType: 'text',
|
|
405
|
+
state: 'hover',
|
|
406
|
+
defaultVariant: 'critical'
|
|
407
|
+
}, props.theme)};
|
|
408
|
+
box-shadow: inset 0 0 0 2px ${props => COLORS.generateToken({
|
|
409
|
+
componentType: 'border',
|
|
410
|
+
state: 'hover',
|
|
411
|
+
defaultVariant: 'critical'
|
|
412
|
+
}, props.theme)};
|
|
413
|
+
|
|
414
|
+
background-color: transparent;
|
|
415
|
+
div {
|
|
416
|
+
svg {
|
|
417
|
+
path {
|
|
418
|
+
fill: ${props => COLORS.generateToken({
|
|
419
|
+
componentType: 'text',
|
|
420
|
+
state: 'hover',
|
|
421
|
+
defaultVariant: 'critical'
|
|
422
|
+
}, props.theme)};
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
&:active > ${TextButtonContentContainer},
|
|
428
|
+
&.active-state > ${TextButtonContentContainer} {
|
|
429
|
+
color: ${props => COLORS.generateToken({
|
|
430
|
+
componentType: 'text',
|
|
431
|
+
state: 'active',
|
|
432
|
+
defaultVariant: 'critical'
|
|
433
|
+
}, props.theme)};
|
|
434
|
+
box-shadow: inset 0 0 0 2px ${props => COLORS.generateToken({
|
|
435
|
+
componentType: 'border',
|
|
436
|
+
state: 'active',
|
|
437
|
+
defaultVariant: 'critical'
|
|
438
|
+
}, props.theme)};
|
|
439
|
+
|
|
440
|
+
background-color: transparent;
|
|
441
|
+
div {
|
|
442
|
+
svg {
|
|
443
|
+
path {
|
|
444
|
+
fill: ${props => COLORS.generateToken({
|
|
445
|
+
componentType: 'text',
|
|
446
|
+
state: 'hover',
|
|
447
|
+
defaultVariant: 'critical'
|
|
448
|
+
}, props.theme)};
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
&:disabled > ${TextButtonContentContainer},
|
|
455
|
+
&.disabled-state > ${TextButtonContentContainer} {
|
|
456
|
+
background-color: transparent;
|
|
457
|
+
color: ${props => COLORS.generateToken({
|
|
458
|
+
componentType: 'text',
|
|
459
|
+
state: 'disabled'
|
|
460
|
+
}, props.theme)};
|
|
461
|
+
box-shadow: inset 0 0 0 2px ${props => COLORS.generateToken({
|
|
462
|
+
componentType: 'border',
|
|
463
|
+
state: 'disabled'
|
|
464
|
+
}, props.theme)};
|
|
465
|
+
}
|
|
466
|
+
`;
|
|
380
467
|
/**
|
|
381
|
-
*
|
|
468
|
+
* TextButton component
|
|
382
469
|
*/
|
|
383
|
-
const
|
|
470
|
+
const TextButton = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
384
471
|
let {
|
|
385
472
|
children = '',
|
|
386
473
|
variant = 'primary',
|
|
387
474
|
type = 'button',
|
|
388
475
|
size = Size.Medium,
|
|
389
|
-
colorTheme,
|
|
390
476
|
invertFocus,
|
|
391
477
|
width = 'auto',
|
|
392
478
|
testId,
|
|
@@ -414,24 +500,26 @@ const Button = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
414
500
|
children: children
|
|
415
501
|
}), icon && iconPosition == 'right' && renderIcon(), loading && /*#__PURE__*/_jsx(LoadingIndicator, {})]
|
|
416
502
|
});
|
|
417
|
-
let
|
|
503
|
+
let TextButtonStyled = TextButtonPrimaryStyled;
|
|
418
504
|
switch (variant) {
|
|
419
505
|
case 'secondary':
|
|
420
|
-
|
|
506
|
+
TextButtonStyled = TextButtonSecondaryStyled;
|
|
421
507
|
break;
|
|
422
508
|
case 'tertiary':
|
|
423
|
-
|
|
509
|
+
TextButtonStyled = TextButtonTertiaryStyled;
|
|
424
510
|
break;
|
|
425
511
|
case 'positive':
|
|
426
|
-
|
|
512
|
+
TextButtonStyled = TextButtonPositiveStyled;
|
|
513
|
+
break;
|
|
514
|
+
case 'destructive':
|
|
515
|
+
TextButtonStyled = TextButtonDestructiveStyled;
|
|
427
516
|
break;
|
|
428
|
-
case '
|
|
429
|
-
|
|
517
|
+
case 'secondaryDestructive':
|
|
518
|
+
TextButtonStyled = TextButtonSecondaryDestructiveStyled;
|
|
430
519
|
break;
|
|
431
520
|
}
|
|
432
|
-
return /*#__PURE__*/_jsx(
|
|
521
|
+
return /*#__PURE__*/_jsx(TextButtonStyled, _objectSpread(_objectSpread({}, renderProps), {}, {
|
|
433
522
|
$size: size,
|
|
434
|
-
$colorTheme: colorTheme,
|
|
435
523
|
$invertFocus: invertFocus,
|
|
436
524
|
ref: ref,
|
|
437
525
|
disabled: disabled,
|
|
@@ -442,14 +530,13 @@ const Button = /*#__PURE__*/React.forwardRef((_ref, ref) => {
|
|
|
442
530
|
"data-testid": testId,
|
|
443
531
|
className: props.loading ? 'loading-state ' + props.className : ' ' + props.className,
|
|
444
532
|
onMouseDown: defaultOnMouseDownHandler,
|
|
445
|
-
children: /*#__PURE__*/_jsx(
|
|
533
|
+
children: /*#__PURE__*/_jsx(TextButtonContentContainer, {
|
|
446
534
|
children: renderContent()
|
|
447
535
|
})
|
|
448
536
|
}));
|
|
449
537
|
});
|
|
450
|
-
|
|
451
|
-
variant: _pt.oneOf(['primary', 'secondary', 'tertiary', 'positive', '
|
|
452
|
-
colorTheme: _pt.oneOf(['teal', 'dark']),
|
|
538
|
+
TextButton.propTypes = {
|
|
539
|
+
variant: _pt.oneOf(['primary', 'secondary', 'tertiary', 'positive', 'destructive', 'secondaryDestructive']),
|
|
453
540
|
invertFocus: _pt.bool,
|
|
454
541
|
width: _pt.oneOfType([_pt.oneOf(['auto']), _pt.string]),
|
|
455
542
|
loading: _pt.bool,
|
|
@@ -457,5 +544,5 @@ Button.propTypes = {
|
|
|
457
544
|
icon: _pt.node,
|
|
458
545
|
iconPosition: _pt.oneOf(['left', 'right'])
|
|
459
546
|
};
|
|
460
|
-
export default
|
|
461
|
-
//# sourceMappingURL=
|
|
547
|
+
export default TextButton;
|
|
548
|
+
//# sourceMappingURL=TextButton.js.map
|