@mailstep/design-system 0.0.6 → 0.0.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/dist/index.es.js +2047 -7435
- package/dist/index.umd.js +41 -938
- package/package.json +13 -14
- package/.eslintrc.cjs +0 -16
- package/dist/Elements/Button/stories/Button.stories.d.ts +0 -20
- package/dist/Elements/Icon/stories/Icon.stories.d.ts +0 -16
- package/src/ui/Elements/Button/Button.d.ts +0 -4
- package/src/ui/Elements/Button/Button.tsx +0 -42
- package/src/ui/Elements/Button/index.d.ts +0 -6
- package/src/ui/Elements/Button/index.ts +0 -5
- package/src/ui/Elements/Button/stories/Button.stories.ts +0 -84
- package/src/ui/Elements/Button/styles.ts +0 -289
- package/src/ui/Elements/Button/types.ts +0 -31
- package/src/ui/Elements/Icon/BadgeIcon.tsx +0 -45
- package/src/ui/Elements/Icon/Icon.tsx +0 -288
- package/src/ui/Elements/Icon/icons/FlagCZ.tsx +0 -10
- package/src/ui/Elements/Icon/icons/FlagUSA.tsx +0 -27
- package/src/ui/Elements/Icon/icons/index.ts +0 -2
- package/src/ui/Elements/Icon/index.d.ts +0 -9
- package/src/ui/Elements/Icon/index.ts +0 -6
- package/src/ui/Elements/Icon/stories/BadgeIcon.stories.tsx +0 -27
- package/src/ui/Elements/Icon/stories/Icon.stories.tsx +0 -60
- package/src/ui/Elements/Icon/types.ts +0 -26
- package/src/ui/Elements/Spinner/README.md +0 -9
- package/src/ui/Elements/Spinner/Spinner.tsx +0 -36
- package/src/ui/Elements/Spinner/index.d.ts +0 -5
- package/src/ui/Elements/Spinner/index.ts +0 -3
- package/src/ui/Elements/Spinner/stories/Spinner.stories.ts +0 -70
- package/src/ui/Elements/Spinner/styles.ts +0 -38
- package/src/ui/Elements/Spinner/types.ts +0 -8
- package/src/ui/Elements/Spinner/yarn.lock +0 -4
- package/src/ui/ThemeProvider/README.md +0 -0
- package/src/ui/ThemeProvider/ThemeProvider.d.ts +0 -3
- package/src/ui/ThemeProvider/ThemeProvider.tsx +0 -14
- package/src/ui/ThemeProvider/index.d.ts +0 -8
- package/src/ui/ThemeProvider/index.ts +0 -6
- package/src/ui/ThemeProvider/themes/default.ts +0 -144
- package/src/ui/ThemeProvider/themes/index.ts +0 -11
- package/src/ui/ThemeProvider/themes/light.ts +0 -10
- package/src/ui/ThemeProvider/themes/mailwise.ts +0 -215
- package/src/ui/ThemeProvider/types.ts +0 -54
- package/src/ui/ThemeProvider/yarn.lock +0 -4
- package/src/ui/index.ts +0 -2
- package/tsconfig.json +0 -26
- package/tsconfig.node.json +0 -10
- package/vite.config.ts +0 -31
package/package.json
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mailstep/design-system",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"license": "ISC",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"main": "./dist/index.umd.js",
|
|
11
|
+
"module": "./dist/index.es.js",
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"import": "./dist/index.es.js",
|
|
15
|
+
"require": "./dist/index.umd.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
7
18
|
"scripts": {
|
|
8
19
|
"dev": "storybook dev -p 6006",
|
|
9
20
|
"build": "tsc && vite build",
|
|
10
21
|
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
11
|
-
"build-storybook": "storybook build"
|
|
12
|
-
"files": [
|
|
13
|
-
"dist"
|
|
14
|
-
],
|
|
15
|
-
"main": "./dist/index.umd.js",
|
|
16
|
-
"module": "./dist/index.es.js",
|
|
17
|
-
"types": "./dist/index.d.ts",
|
|
18
|
-
"exports": {
|
|
19
|
-
".": {
|
|
20
|
-
"import": "./dist/index.es.js",
|
|
21
|
-
"require": "./dist/index.umd.js"
|
|
22
|
-
}
|
|
23
|
-
}
|
|
22
|
+
"build-storybook": "storybook build"
|
|
24
23
|
},
|
|
25
24
|
"peerDependencies": {
|
|
26
25
|
"@fortawesome/fontawesome-svg-core": "^6.3.0",
|
package/.eslintrc.cjs
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
root: true,
|
|
3
|
-
env: {
|
|
4
|
-
browser: true,
|
|
5
|
-
es2020: true
|
|
6
|
-
},
|
|
7
|
-
extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended', 'plugin:react-hooks/recommended', 'plugin:storybook/recommended'],
|
|
8
|
-
ignorePatterns: ['dist', '.eslintrc.cjs'],
|
|
9
|
-
parser: '@typescript-eslint/parser',
|
|
10
|
-
plugins: ['react-refresh'],
|
|
11
|
-
rules: {
|
|
12
|
-
'react-refresh/only-export-components': ['warn', {
|
|
13
|
-
allowConstantExport: true
|
|
14
|
-
}]
|
|
15
|
-
}
|
|
16
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { StoryObj } from '@storybook/react';
|
|
3
|
-
declare const meta: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: ({ isLoading, loadingText, icon, appearance, disabled, sizing, buttonRef, onClick, fullWidth, ...props }: import("../types").Props) => JSX.Element;
|
|
6
|
-
tags: string[];
|
|
7
|
-
argTypes: {};
|
|
8
|
-
};
|
|
9
|
-
export default meta;
|
|
10
|
-
type Story = StoryObj<typeof meta>;
|
|
11
|
-
export declare const Primary: Story;
|
|
12
|
-
export declare const PrimaryLight: Story;
|
|
13
|
-
export declare const Secondary: Story;
|
|
14
|
-
export declare const Success: Story;
|
|
15
|
-
export declare const Large: Story;
|
|
16
|
-
export declare const Small: Story;
|
|
17
|
-
export declare const DisabledPrimary: Story;
|
|
18
|
-
export declare const DisabledSecondary: Story;
|
|
19
|
-
export declare const Loading: Story;
|
|
20
|
-
export declare const WithIcon: Story;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import type { StoryObj } from '@storybook/react';
|
|
3
|
-
declare const meta: {
|
|
4
|
-
title: string;
|
|
5
|
-
component: ({ icon, fill, style, size, className, secondaryColor, fixedWidth, spinning, }: import("..").IconProps) => JSX.Element;
|
|
6
|
-
tags: string[];
|
|
7
|
-
argTypes: {};
|
|
8
|
-
};
|
|
9
|
-
export default meta;
|
|
10
|
-
type Story = StoryObj<typeof meta>;
|
|
11
|
-
export declare const Expedition: Story;
|
|
12
|
-
export declare const Spinning: Story;
|
|
13
|
-
export declare const SmallExpedition: Story;
|
|
14
|
-
export declare const BigExpedition: Story;
|
|
15
|
-
export declare const ExpeditionPink: Story;
|
|
16
|
-
export declare const ExpeditionPinkSolid: Story;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { StyledButton, LoadingIconWrapper, StyledIcon, StyledWrapper } from './styles'
|
|
2
|
-
import { Props } from './types'
|
|
3
|
-
import Spinner from '../Spinner'
|
|
4
|
-
|
|
5
|
-
const Button = ({
|
|
6
|
-
isLoading,
|
|
7
|
-
loadingText,
|
|
8
|
-
icon,
|
|
9
|
-
appearance = 'primary',
|
|
10
|
-
disabled = false,
|
|
11
|
-
sizing = 'normal',
|
|
12
|
-
buttonRef,
|
|
13
|
-
onClick,
|
|
14
|
-
fullWidth = false,
|
|
15
|
-
...props
|
|
16
|
-
}: Props): JSX.Element => (
|
|
17
|
-
<StyledButton
|
|
18
|
-
{...props}
|
|
19
|
-
onClick={!disabled && !isLoading ? onClick : undefined}
|
|
20
|
-
data-appearance={appearance}
|
|
21
|
-
data-sizing={sizing}
|
|
22
|
-
disabled={disabled}
|
|
23
|
-
ref={buttonRef}
|
|
24
|
-
fullWidth={fullWidth}
|
|
25
|
-
>
|
|
26
|
-
<StyledWrapper>
|
|
27
|
-
{icon && (typeof icon === 'string' ? <StyledIcon $addMargin={!!props.children} icon={icon} /> : icon)}
|
|
28
|
-
{isLoading ? (
|
|
29
|
-
<>
|
|
30
|
-
<LoadingIconWrapper $addMargin={!!loadingText || !!props.children}>
|
|
31
|
-
<Spinner variant="sm" />
|
|
32
|
-
</LoadingIconWrapper>
|
|
33
|
-
{loadingText || loadingText === '' ? loadingText : 'Loading'}
|
|
34
|
-
</>
|
|
35
|
-
) : (
|
|
36
|
-
props.children
|
|
37
|
-
)}
|
|
38
|
-
</StyledWrapper>
|
|
39
|
-
</StyledButton>
|
|
40
|
-
)
|
|
41
|
-
|
|
42
|
-
export default Button
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
-
import Button from '../'
|
|
3
|
-
|
|
4
|
-
const meta = {
|
|
5
|
-
title: 'Elements/Button',
|
|
6
|
-
component: Button,
|
|
7
|
-
tags: ['autodocs'],
|
|
8
|
-
argTypes: {},
|
|
9
|
-
} satisfies Meta<typeof Button>
|
|
10
|
-
|
|
11
|
-
export default meta
|
|
12
|
-
type Story = StoryObj<typeof meta>
|
|
13
|
-
|
|
14
|
-
export const Primary: Story = {
|
|
15
|
-
args: {
|
|
16
|
-
children: 'Primary',
|
|
17
|
-
},
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export const PrimaryLight: Story = {
|
|
21
|
-
args: {
|
|
22
|
-
children: 'Primary Light',
|
|
23
|
-
appearance: 'primaryLight',
|
|
24
|
-
},
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const Secondary: Story = {
|
|
28
|
-
args: {
|
|
29
|
-
children: 'Secondary',
|
|
30
|
-
appearance: 'secondary',
|
|
31
|
-
},
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export const Success: Story = {
|
|
35
|
-
args: {
|
|
36
|
-
children: 'Success',
|
|
37
|
-
appearance: 'success',
|
|
38
|
-
},
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export const Large: Story = {
|
|
42
|
-
args: {
|
|
43
|
-
children: 'Large',
|
|
44
|
-
sizing: 'large',
|
|
45
|
-
},
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
export const Small: Story = {
|
|
49
|
-
args: {
|
|
50
|
-
children: 'Small',
|
|
51
|
-
sizing: 'normal',
|
|
52
|
-
},
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export const DisabledPrimary: Story = {
|
|
56
|
-
args: {
|
|
57
|
-
children: 'Disabled',
|
|
58
|
-
disabled: true,
|
|
59
|
-
},
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export const DisabledSecondary: Story = {
|
|
63
|
-
args: {
|
|
64
|
-
children: 'Disabled',
|
|
65
|
-
disabled: true,
|
|
66
|
-
appearance: 'secondary',
|
|
67
|
-
},
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export const Loading: Story = {
|
|
71
|
-
args: {
|
|
72
|
-
appearance: 'secondary',
|
|
73
|
-
loadingText: 'Loading...',
|
|
74
|
-
isLoading: true,
|
|
75
|
-
},
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export const WithIcon: Story = {
|
|
79
|
-
args: {
|
|
80
|
-
label: 'Button',
|
|
81
|
-
children: 'Small',
|
|
82
|
-
icon: 'coffee',
|
|
83
|
-
},
|
|
84
|
-
}
|
|
@@ -1,289 +0,0 @@
|
|
|
1
|
-
import { th } from '@xstyled/styled-components'
|
|
2
|
-
import styled from '@xstyled/styled-components'
|
|
3
|
-
import Icon from '../Icon'
|
|
4
|
-
|
|
5
|
-
export const StyledWrapper = styled.span`
|
|
6
|
-
display: flex;
|
|
7
|
-
justify-content: center;
|
|
8
|
-
align-items: center;
|
|
9
|
-
`
|
|
10
|
-
|
|
11
|
-
export const LoadingIconWrapper = styled.div<{
|
|
12
|
-
$addMargin: boolean
|
|
13
|
-
}>`
|
|
14
|
-
& svg {
|
|
15
|
-
margin-right: ${({ $addMargin }: { $addMargin: boolean }): string => ($addMargin ? '0.5em' : '0')};
|
|
16
|
-
}
|
|
17
|
-
`
|
|
18
|
-
|
|
19
|
-
export const StyledIcon = styled(Icon)<{
|
|
20
|
-
$addMargin: boolean
|
|
21
|
-
}>`
|
|
22
|
-
& svg {
|
|
23
|
-
height: 1em;
|
|
24
|
-
margin-right: ${({ $addMargin }): string => ($addMargin ? '0.5em' : '0')};
|
|
25
|
-
}
|
|
26
|
-
`
|
|
27
|
-
|
|
28
|
-
export const StyledButton = styled.button<{
|
|
29
|
-
disabled: boolean
|
|
30
|
-
columnAlign?: boolean
|
|
31
|
-
children?: any
|
|
32
|
-
onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined
|
|
33
|
-
fullWidth: boolean
|
|
34
|
-
mt?: string | number
|
|
35
|
-
mr?: string | number
|
|
36
|
-
mb?: string | number
|
|
37
|
-
ml?: string | number
|
|
38
|
-
}>`
|
|
39
|
-
width: ${({ fullWidth }) => (fullWidth ? '100%' : 'initial')};
|
|
40
|
-
margin-top: ${({ mt }) => (mt ? mt : 0)};
|
|
41
|
-
margin-right: ${({ mr }) => (mr ? mr : 0)};
|
|
42
|
-
margin-bottom: ${({ mb }) => (mb ? mb : 0)};
|
|
43
|
-
margin-left: ${({ ml }) => (ml ? ml : 0)};
|
|
44
|
-
height: 2.5em;
|
|
45
|
-
border: slim;
|
|
46
|
-
text-align: center;
|
|
47
|
-
text-decoration: none;
|
|
48
|
-
display: ${({ columnAlign }) => (columnAlign ? 'flex' : 'inline-flex')};
|
|
49
|
-
flex-direction: ${({ columnAlign }) => (columnAlign ? 'column' : 'auto')};
|
|
50
|
-
align-items: ${({ columnAlign }) => (columnAlign ? 'center' : 'auto')};
|
|
51
|
-
font-family: ${th('fonts.primary')};
|
|
52
|
-
font-weight: semiBold;
|
|
53
|
-
border-radius: lg;
|
|
54
|
-
cursor: pointer;
|
|
55
|
-
transition-duration: 0.1s;
|
|
56
|
-
align-items: center;
|
|
57
|
-
justify-content: center;
|
|
58
|
-
transition: all 300ms ease-out;
|
|
59
|
-
pointer-events: ${({ disabled }) => (disabled ? 'none' : 'auto')};
|
|
60
|
-
opacity: ${({ disabled }) => (disabled ? '0.6' : '1')};
|
|
61
|
-
|
|
62
|
-
:disabled {
|
|
63
|
-
color: lightGray5;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
:focus {
|
|
67
|
-
outline: none;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
&[data-appearance='primary'] {
|
|
71
|
-
background-color: red1;
|
|
72
|
-
color: white;
|
|
73
|
-
border-color: red1;
|
|
74
|
-
|
|
75
|
-
@media (hover: hover) {
|
|
76
|
-
&:hover {
|
|
77
|
-
background-color: white;
|
|
78
|
-
color: red1;
|
|
79
|
-
border-color: red1;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
:active {
|
|
84
|
-
background-color: red1;
|
|
85
|
-
color: red1;
|
|
86
|
-
border: none;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
:disabled {
|
|
90
|
-
background-color: bgLightGray;
|
|
91
|
-
border-color: lightGray5;
|
|
92
|
-
color: gray3;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
&[data-appearance='primaryLight'] {
|
|
97
|
-
color: red1;
|
|
98
|
-
background-color: red20;
|
|
99
|
-
border-color: red20;
|
|
100
|
-
|
|
101
|
-
@media (hover: hover) {
|
|
102
|
-
&:hover {
|
|
103
|
-
background-color: red1;
|
|
104
|
-
color: white;
|
|
105
|
-
border-color: red1;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
:active {
|
|
110
|
-
background-color: red1;
|
|
111
|
-
color: white;
|
|
112
|
-
border-color: red1;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
:disabled {
|
|
116
|
-
background-color: bgLightGray;
|
|
117
|
-
border-color: lightGray5;
|
|
118
|
-
color: gray3;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
&[data-appearance='success'] {
|
|
123
|
-
background-color: successColor;
|
|
124
|
-
color: white;
|
|
125
|
-
border-color: successColor;
|
|
126
|
-
|
|
127
|
-
@media (hover: hover) {
|
|
128
|
-
&:hover {
|
|
129
|
-
background-color: white;
|
|
130
|
-
color: successColor;
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
:active {
|
|
135
|
-
background-color: white;
|
|
136
|
-
color: successColor;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
:disabled {
|
|
140
|
-
background-color: bgLightGray;
|
|
141
|
-
border-color: lightGray5;
|
|
142
|
-
color: gray3;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
&[data-appearance='secondary'] {
|
|
147
|
-
background-color: white;
|
|
148
|
-
color: red1;
|
|
149
|
-
border-color: red1;
|
|
150
|
-
|
|
151
|
-
@media (hover: hover) {
|
|
152
|
-
&:hover {
|
|
153
|
-
background-color: red1;
|
|
154
|
-
color: white;
|
|
155
|
-
border-color: red1;
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
:active {
|
|
160
|
-
background-color: red1;
|
|
161
|
-
color: red1;
|
|
162
|
-
border-color: red1;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
:disabled {
|
|
166
|
-
background-color: white;
|
|
167
|
-
border-color: lightGray7;
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
&[data-appearance='secondaryLg'] {
|
|
172
|
-
background-color: white;
|
|
173
|
-
color: typoPrimary;
|
|
174
|
-
border-color: blue2;
|
|
175
|
-
|
|
176
|
-
@media (hover: hover) {
|
|
177
|
-
&:hover {
|
|
178
|
-
background-color: blue2;
|
|
179
|
-
color: white;
|
|
180
|
-
border-color: blue2;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
:active {
|
|
185
|
-
background-color: gray;
|
|
186
|
-
color: white;
|
|
187
|
-
border: none;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
:disabled {
|
|
191
|
-
background-color: white;
|
|
192
|
-
border-color: bgLightGray1;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
&[data-appearance='primaryLg'] {
|
|
197
|
-
background-color: blue2;
|
|
198
|
-
color: white;
|
|
199
|
-
border-color: blue2;
|
|
200
|
-
|
|
201
|
-
@media (hover: hover) {
|
|
202
|
-
&:hover {
|
|
203
|
-
background-color: white;
|
|
204
|
-
color: typoPrimary;
|
|
205
|
-
border-color: blue2;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
:active {
|
|
210
|
-
background-color: gray;
|
|
211
|
-
color: white;
|
|
212
|
-
border: none;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
:disabled {
|
|
216
|
-
background-color: bgLightGray1;
|
|
217
|
-
border-color: bgLightGray1;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
&[data-appearance='minimal'] {
|
|
222
|
-
background-color: transparent;
|
|
223
|
-
border: none !important;
|
|
224
|
-
color: blue2;
|
|
225
|
-
|
|
226
|
-
:disabled {
|
|
227
|
-
color: blue2;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
&[data-appearance='minimalRed'] {
|
|
232
|
-
background-color: transparent;
|
|
233
|
-
border: none !important;
|
|
234
|
-
color: red1;
|
|
235
|
-
|
|
236
|
-
@media (hover: hover) {
|
|
237
|
-
&:hover {
|
|
238
|
-
color: red3;
|
|
239
|
-
svg {
|
|
240
|
-
fill: red3 !important;
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
:disabled,
|
|
246
|
-
:active {
|
|
247
|
-
color: red3;
|
|
248
|
-
svg {
|
|
249
|
-
fill: red3 !important;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
&[data-sizing='icon'] {
|
|
255
|
-
aspect-ratio: 4 / 3;
|
|
256
|
-
padding: 0.5em 0.875em;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
&[data-sizing='iconLg'] {
|
|
260
|
-
min-width: 42px;
|
|
261
|
-
min-height: 38px;
|
|
262
|
-
padding: 0.5em 0.875em;
|
|
263
|
-
svg {
|
|
264
|
-
height: 16px;
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
&[data-sizing='normal'] {
|
|
269
|
-
min-width: 7rem;
|
|
270
|
-
padding: 12px 18px;
|
|
271
|
-
min-height: 38px;
|
|
272
|
-
line-height: 14px;
|
|
273
|
-
font-size: 14px;
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
&[data-sizing='large'] {
|
|
277
|
-
min-width: 12rem;
|
|
278
|
-
padding: 0.75em 1.5em;
|
|
279
|
-
min-height: 34px;
|
|
280
|
-
font-size: 12px;
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
&[data-sizing='grid'] {
|
|
284
|
-
min-width: 5rem;
|
|
285
|
-
padding: 0.5em 1.25em;
|
|
286
|
-
font-size: 10px;
|
|
287
|
-
border-radius: 5px;
|
|
288
|
-
}
|
|
289
|
-
`
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export type SizingValue = 'icon' | 'iconLg' | 'normal' | 'large' | 'grid'
|
|
2
|
-
|
|
3
|
-
export type AppearanceValue =
|
|
4
|
-
| 'primary'
|
|
5
|
-
| 'primaryLight'
|
|
6
|
-
| 'secondary'
|
|
7
|
-
| 'primaryLg'
|
|
8
|
-
| 'secondaryLg'
|
|
9
|
-
| 'minimal'
|
|
10
|
-
| 'minimalRed'
|
|
11
|
-
| 'success'
|
|
12
|
-
|
|
13
|
-
export type Props = React.HTMLProps<HTMLButtonElement> & {
|
|
14
|
-
children?: React.ReactNode
|
|
15
|
-
disabled?: boolean
|
|
16
|
-
appearance?: AppearanceValue
|
|
17
|
-
buttonRef?: any
|
|
18
|
-
sizing?: SizingValue
|
|
19
|
-
isLoading?: boolean
|
|
20
|
-
name?: string
|
|
21
|
-
as?: string | React.ComponentType
|
|
22
|
-
loadingText?: string | JSX.Element
|
|
23
|
-
columnAlign?: boolean
|
|
24
|
-
icon?: string | JSX.Element
|
|
25
|
-
type?: 'button' | 'submit' | 'reset'
|
|
26
|
-
fullWidth?: boolean
|
|
27
|
-
mt?: string | number
|
|
28
|
-
mr?: string | number
|
|
29
|
-
mb?: string | number
|
|
30
|
-
ml?: string | number
|
|
31
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react'
|
|
2
|
-
import styled from '@xstyled/styled-components'
|
|
3
|
-
import Icon from './Icon'
|
|
4
|
-
import { IconProps } from './types'
|
|
5
|
-
|
|
6
|
-
type Props = {
|
|
7
|
-
badge: 'warning'
|
|
8
|
-
} & IconProps
|
|
9
|
-
|
|
10
|
-
const Badge = styled(Icon)`
|
|
11
|
-
display: inline-table;
|
|
12
|
-
vertical-align: middle;
|
|
13
|
-
position: absolute;
|
|
14
|
-
top: -10%;
|
|
15
|
-
right: -10%;
|
|
16
|
-
font-size: 60%;
|
|
17
|
-
`
|
|
18
|
-
|
|
19
|
-
const RelativeWrap = styled.div<{ width?: string | number }>`
|
|
20
|
-
position: relative;
|
|
21
|
-
`
|
|
22
|
-
|
|
23
|
-
// TODO expad to accet numerical badges
|
|
24
|
-
|
|
25
|
-
export const BadgeIcon = ({ badge, ...iconProps }: Props): JSX.Element => {
|
|
26
|
-
const badgeProps = useMemo(() => {
|
|
27
|
-
if (badge == 'warning') {
|
|
28
|
-
return {
|
|
29
|
-
icon: 'warningDual',
|
|
30
|
-
fill: 'black',
|
|
31
|
-
secondaryColor: 'yellow2',
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return {} as IconProps
|
|
35
|
-
}, [badge])
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<RelativeWrap>
|
|
39
|
-
<Badge {...badgeProps} />
|
|
40
|
-
<Icon {...iconProps} />
|
|
41
|
-
</RelativeWrap>
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export default BadgeIcon
|