@mailstep/design-system 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +16 -0
- package/.storybook/main.ts +17 -0
- package/.storybook/preview.ts +20 -0
- package/.storybook/withRouter.tsx +12 -0
- package/.storybook/withTheme.tsx +23 -0
- package/README.md +0 -0
- package/package.json +52 -0
- package/public/vite.svg +1 -0
- package/src/packages/ui/Elements/Button/Button.d.ts +4 -0
- package/src/packages/ui/Elements/Button/Button.tsx +42 -0
- package/src/packages/ui/Elements/Button/index.d.ts +6 -0
- package/src/packages/ui/Elements/Button/index.ts +5 -0
- package/src/packages/ui/Elements/Button/stories/Button.stories.ts +84 -0
- package/src/packages/ui/Elements/Button/styles.ts +289 -0
- package/src/packages/ui/Elements/Button/types.ts +31 -0
- package/src/packages/ui/Elements/Icon/BadgeIcon.tsx +45 -0
- package/src/packages/ui/Elements/Icon/Icon.tsx +288 -0
- package/src/packages/ui/Elements/Icon/icons/FlagCZ.tsx +10 -0
- package/src/packages/ui/Elements/Icon/icons/FlagUSA.tsx +27 -0
- package/src/packages/ui/Elements/Icon/icons/index.ts +2 -0
- package/src/packages/ui/Elements/Icon/index.d.ts +9 -0
- package/src/packages/ui/Elements/Icon/index.ts +6 -0
- package/src/packages/ui/Elements/Icon/stories/BadgeIcon.stories.tsx +27 -0
- package/src/packages/ui/Elements/Icon/stories/Icon.stories.tsx +60 -0
- package/src/packages/ui/Elements/Icon/types.ts +26 -0
- package/src/packages/ui/Elements/Spinner/README.md +9 -0
- package/src/packages/ui/Elements/Spinner/Spinner.tsx +36 -0
- package/src/packages/ui/Elements/Spinner/index.d.ts +5 -0
- package/src/packages/ui/Elements/Spinner/index.ts +3 -0
- package/src/packages/ui/Elements/Spinner/stories/Spinner.stories.ts +70 -0
- package/src/packages/ui/Elements/Spinner/styles.ts +38 -0
- package/src/packages/ui/Elements/Spinner/types.ts +8 -0
- package/src/packages/ui/Elements/Spinner/yarn.lock +4 -0
- package/src/packages/ui/ThemeProvider/README.md +0 -0
- package/src/packages/ui/ThemeProvider/ThemeProvider.d.ts +3 -0
- package/src/packages/ui/ThemeProvider/ThemeProvider.tsx +14 -0
- package/src/packages/ui/ThemeProvider/index.d.ts +8 -0
- package/src/packages/ui/ThemeProvider/index.ts +6 -0
- package/src/packages/ui/ThemeProvider/themes/default.ts +144 -0
- package/src/packages/ui/ThemeProvider/themes/index.ts +11 -0
- package/src/packages/ui/ThemeProvider/themes/light.ts +10 -0
- package/src/packages/ui/ThemeProvider/themes/mailwise.ts +215 -0
- package/src/packages/ui/ThemeProvider/types.ts +54 -0
- package/src/packages/ui/ThemeProvider/yarn.lock +4 -0
- package/src/stories/themes/default.ts +144 -0
- package/src/stories/themes/index.ts +11 -0
- package/src/stories/themes/light.ts +10 -0
- package/src/stories/themes/mailwise.ts +215 -0
- package/tsconfig.json +25 -0
- package/tsconfig.node.json +10 -0
- package/vite.config.ts +7 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import styled, { useTheme } from '@xstyled/styled-components'
|
|
3
|
+
import { th } from '@xstyled/styled-components'
|
|
4
|
+
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
|
|
5
|
+
import { IconDefinition } from '@fortawesome/fontawesome-common-types'
|
|
6
|
+
import { FlipProp, IconName, IconPrefix, library } from '@fortawesome/fontawesome-svg-core'
|
|
7
|
+
|
|
8
|
+
import { faCoffee as falCoffee } from '@fortawesome/pro-light-svg-icons/faCoffee'
|
|
9
|
+
import { faPaperclip } from '@fortawesome/pro-light-svg-icons/faPaperclip'
|
|
10
|
+
import { faStopwatch } from '@fortawesome/pro-light-svg-icons/faStopwatch'
|
|
11
|
+
import { faHandHoldingBox } from '@fortawesome/pro-light-svg-icons/faHandHoldingBox'
|
|
12
|
+
import { faArrowRightToBracket } from '@fortawesome/pro-regular-svg-icons/faArrowRightToBracket'
|
|
13
|
+
import { faBell } from '@fortawesome/pro-regular-svg-icons/faBell'
|
|
14
|
+
import { faCoffee as farCoffee } from '@fortawesome/pro-regular-svg-icons/faCoffee'
|
|
15
|
+
import { faCommentDots } from '@fortawesome/pro-regular-svg-icons/faCommentDots'
|
|
16
|
+
import { faCopy } from '@fortawesome/pro-regular-svg-icons/faCopy'
|
|
17
|
+
import { faClock } from '@fortawesome/pro-regular-svg-icons/faClock'
|
|
18
|
+
import { faChevronUp } from '@fortawesome/pro-regular-svg-icons/faChevronUp'
|
|
19
|
+
import { faChevronDown } from '@fortawesome/pro-regular-svg-icons/faChevronDown'
|
|
20
|
+
import { faChevronRight as farChevronRight } from '@fortawesome/pro-regular-svg-icons/faChevronRight'
|
|
21
|
+
import { faEllipsisVertical } from '@fortawesome/pro-regular-svg-icons/faEllipsisVertical'
|
|
22
|
+
import { faEnvelope as faEnvelopeLight } from '@fortawesome/pro-regular-svg-icons/faEnvelope'
|
|
23
|
+
import { faEyeSlash } from '@fortawesome/pro-regular-svg-icons/faEyeSlash'
|
|
24
|
+
import { faFile } from '@fortawesome/pro-regular-svg-icons/faFile'
|
|
25
|
+
import { faFileAlt } from '@fortawesome/pro-regular-svg-icons/faFileAlt'
|
|
26
|
+
import { faGear } from '@fortawesome/pro-regular-svg-icons/faGear'
|
|
27
|
+
import { faShareSquare } from '@fortawesome/pro-regular-svg-icons/faShareSquare'
|
|
28
|
+
import { faTriangleExclamation as farTriangleExclamation } from '@fortawesome/pro-regular-svg-icons/faTriangleExclamation'
|
|
29
|
+
import { faCircleArrowDown } from '@fortawesome/pro-regular-svg-icons/faCircleArrowDown'
|
|
30
|
+
import { faCircleArrowRight } from '@fortawesome/pro-regular-svg-icons/faCircleArrowRight'
|
|
31
|
+
import { faPenToSquare } from '@fortawesome/pro-regular-svg-icons/faPenToSquare'
|
|
32
|
+
import { faLock } from '@fortawesome/pro-regular-svg-icons/faLock'
|
|
33
|
+
import { faCalendar } from '@fortawesome/pro-regular-svg-icons/faCalendar'
|
|
34
|
+
import { faCalendarPlus } from '@fortawesome/pro-regular-svg-icons/faCalendarPlus'
|
|
35
|
+
import { faSquareMinus } from '@fortawesome/pro-regular-svg-icons/faSquareMinus'
|
|
36
|
+
import { faComments } from '@fortawesome/pro-regular-svg-icons/faComments'
|
|
37
|
+
import { faFaceMeh } from '@fortawesome/pro-regular-svg-icons/faFaceMeh'
|
|
38
|
+
import { faHand } from '@fortawesome/pro-regular-svg-icons/faHand'
|
|
39
|
+
import { faLink } from '@fortawesome/pro-regular-svg-icons/faLink'
|
|
40
|
+
import { faFileSearch } from '@fortawesome/pro-regular-svg-icons/faFileSearch'
|
|
41
|
+
import { faFileLines } from '@fortawesome/pro-regular-svg-icons/faFileLines'
|
|
42
|
+
import { faTrashCan } from '@fortawesome/pro-regular-svg-icons/faTrashCan'
|
|
43
|
+
import { faCircleQuestion } from '@fortawesome/pro-regular-svg-icons/faCircleQuestion'
|
|
44
|
+
import { faFilter } from '@fortawesome/pro-regular-svg-icons/faFilter'
|
|
45
|
+
import { faAnglesRight } from '@fortawesome/pro-solid-svg-icons/faAnglesRight'
|
|
46
|
+
import { faAngleRight } from '@fortawesome/pro-solid-svg-icons/faAngleRight'
|
|
47
|
+
import { faAngleLeft } from '@fortawesome/pro-solid-svg-icons/faAngleLeft'
|
|
48
|
+
import { faArrowLeft } from '@fortawesome/pro-solid-svg-icons/faArrowLeft'
|
|
49
|
+
import { faBan } from '@fortawesome/pro-solid-svg-icons/faBan'
|
|
50
|
+
import { faBoxOpen } from '@fortawesome/pro-solid-svg-icons/faBoxOpen'
|
|
51
|
+
import { faCartArrowDown } from '@fortawesome/pro-solid-svg-icons/faCartArrowDown'
|
|
52
|
+
import { faCoffee as fasCoffee } from '@fortawesome/pro-solid-svg-icons/faCoffee'
|
|
53
|
+
import { faFlag } from '@fortawesome/pro-solid-svg-icons/faFlag'
|
|
54
|
+
import { faExchange } from '@fortawesome/pro-solid-svg-icons/faExchange'
|
|
55
|
+
import { faEquals } from '@fortawesome/pro-solid-svg-icons/faEquals'
|
|
56
|
+
import { faGreaterThanEqual } from '@fortawesome/pro-solid-svg-icons/faGreaterThanEqual'
|
|
57
|
+
import { faHome } from '@fortawesome/pro-solid-svg-icons/faHome'
|
|
58
|
+
import { faHouseUser } from '@fortawesome/pro-solid-svg-icons/faHouseUser'
|
|
59
|
+
import { faLaptopCode } from '@fortawesome/pro-solid-svg-icons/faLaptopCode'
|
|
60
|
+
import { faLuggageCart } from '@fortawesome/pro-solid-svg-icons/faLuggageCart'
|
|
61
|
+
import { faLessThanEqual } from '@fortawesome/pro-solid-svg-icons/faLessThanEqual'
|
|
62
|
+
import { faNotEqual } from '@fortawesome/pro-solid-svg-icons/faNotEqual'
|
|
63
|
+
import { faPen } from '@fortawesome/pro-solid-svg-icons/faPen'
|
|
64
|
+
import { faPeopleCarry as fasPeopleCarry } from '@fortawesome/pro-solid-svg-icons/faPeopleCarry'
|
|
65
|
+
import { faSearch } from '@fortawesome/pro-solid-svg-icons/faSearch'
|
|
66
|
+
import { faShippingFast } from '@fortawesome/pro-solid-svg-icons/faShippingFast'
|
|
67
|
+
import { faStore } from '@fortawesome/pro-solid-svg-icons/faStore'
|
|
68
|
+
import { faTags } from '@fortawesome/pro-solid-svg-icons/faTags'
|
|
69
|
+
import { faTruck } from '@fortawesome/pro-solid-svg-icons/faTruck'
|
|
70
|
+
import { faUser } from '@fortawesome/pro-solid-svg-icons/faUser'
|
|
71
|
+
import { faUsersGear } from '@fortawesome/pro-solid-svg-icons/faUsersGear'
|
|
72
|
+
import { faWatch } from '@fortawesome/pro-solid-svg-icons/faWatch'
|
|
73
|
+
import { faChartLine } from '@fortawesome/pro-solid-svg-icons/faChartLine'
|
|
74
|
+
import { faCheck } from '@fortawesome/pro-solid-svg-icons/faCheck'
|
|
75
|
+
import { faSquareCheck } from '@fortawesome/pro-solid-svg-icons/faSquareCheck'
|
|
76
|
+
import { faXmark as fasXmark } from '@fortawesome/pro-solid-svg-icons/faXmark'
|
|
77
|
+
import { faChevronLeft } from '@fortawesome/pro-solid-svg-icons/faChevronLeft'
|
|
78
|
+
import { faNoteSticky } from '@fortawesome/pro-solid-svg-icons/faNoteSticky'
|
|
79
|
+
import { faArrowDownToBracket } from '@fortawesome/pro-solid-svg-icons/faArrowDownToBracket'
|
|
80
|
+
import { faPlus } from '@fortawesome/pro-solid-svg-icons/faPlus'
|
|
81
|
+
import { faMinus } from '@fortawesome/pro-solid-svg-icons/faMinus'
|
|
82
|
+
import { faChevronRight as fasChevronRight } from '@fortawesome/pro-solid-svg-icons/faChevronRight'
|
|
83
|
+
import { faChevronDown as fasChevronDown } from '@fortawesome/pro-solid-svg-icons/faChevronDown'
|
|
84
|
+
import { faChevronUp as fasChevronUp } from '@fortawesome/pro-solid-svg-icons/faChevronUp'
|
|
85
|
+
import { faCircleInfo } from '@fortawesome/pro-solid-svg-icons/faCircleInfo'
|
|
86
|
+
import { faCube } from '@fortawesome/pro-solid-svg-icons/faCube'
|
|
87
|
+
import { faBoxArchive } from '@fortawesome/pro-solid-svg-icons/faBoxArchive'
|
|
88
|
+
import { faLocationCrosshairs } from '@fortawesome/pro-solid-svg-icons/faLocationCrosshairs'
|
|
89
|
+
import { faTruckRampBox } from '@fortawesome/pro-solid-svg-icons/faTruckRampBox'
|
|
90
|
+
import { faGlobe } from '@fortawesome/pro-solid-svg-icons/faGlobe'
|
|
91
|
+
import { faCircleCheck } from '@fortawesome/pro-solid-svg-icons/faCircleCheck'
|
|
92
|
+
import { faCircleXmark } from '@fortawesome/pro-solid-svg-icons/faCircleXmark'
|
|
93
|
+
import { faTriangleExclamation } from '@fortawesome/pro-solid-svg-icons/faTriangleExclamation'
|
|
94
|
+
import { faBadgeCheck } from '@fortawesome/pro-solid-svg-icons/faBadgeCheck'
|
|
95
|
+
import { faWebhook } from '@fortawesome/pro-solid-svg-icons/faWebhook'
|
|
96
|
+
import { faTriangleExclamation as fadTriangleExclamation } from '@fortawesome/pro-duotone-svg-icons/faTriangleExclamation'
|
|
97
|
+
import { faFacebookF } from '@fortawesome/free-brands-svg-icons/faFacebookF'
|
|
98
|
+
import { faTwitter } from '@fortawesome/free-brands-svg-icons/faTwitter'
|
|
99
|
+
import { faLinkedinIn } from '@fortawesome/free-brands-svg-icons/faLinkedinIn'
|
|
100
|
+
import { faInstagram } from '@fortawesome/free-brands-svg-icons/faInstagram'
|
|
101
|
+
import { faBox } from '@fortawesome/pro-solid-svg-icons/faBox'
|
|
102
|
+
import { faBox as faBoxRegular } from '@fortawesome/pro-regular-svg-icons/faBox'
|
|
103
|
+
import { faBoxCircleCheck } from '@fortawesome/pro-solid-svg-icons/faBoxCircleCheck'
|
|
104
|
+
import { faShelves } from '@fortawesome/pro-solid-svg-icons/faShelves'
|
|
105
|
+
import { faBoxesStacked } from '@fortawesome/pro-solid-svg-icons/faBoxesStacked'
|
|
106
|
+
|
|
107
|
+
import { IconProps } from './types'
|
|
108
|
+
|
|
109
|
+
export const iconDictionary: {
|
|
110
|
+
[name: string]: IconDefinition | [IconDefinition, FlipProp]
|
|
111
|
+
} = {
|
|
112
|
+
greaterThan: faAngleRight,
|
|
113
|
+
startsWith: faAnglesRight,
|
|
114
|
+
lessThen: faAngleLeft,
|
|
115
|
+
endsWith: faBan,
|
|
116
|
+
pen: faPen,
|
|
117
|
+
edit: faPenToSquare,
|
|
118
|
+
avatar: faUser,
|
|
119
|
+
arrowLeft: faArrowLeft,
|
|
120
|
+
attachment: faPaperclip,
|
|
121
|
+
dashboard: faChartLine,
|
|
122
|
+
chevronUp: faChevronUp,
|
|
123
|
+
chevronDown: faChevronDown,
|
|
124
|
+
chevronRight: farChevronRight,
|
|
125
|
+
clock: faClock,
|
|
126
|
+
complaint: faFileAlt, // 'file-lines'
|
|
127
|
+
mailLight: faEnvelopeLight,
|
|
128
|
+
eshop: faStore,
|
|
129
|
+
expedition: faShippingFast, // 'truck-fast'
|
|
130
|
+
equals: faEquals, // 'truck-fast'
|
|
131
|
+
ellipsisVertical: faEllipsisVertical,
|
|
132
|
+
greaterThanEqual: faGreaterThanEqual,
|
|
133
|
+
home: faHome,
|
|
134
|
+
gear: faGear,
|
|
135
|
+
inbound: faCartArrowDown,
|
|
136
|
+
inventory: faFile,
|
|
137
|
+
knowledgeBase: faLaptopCode,
|
|
138
|
+
luggageCart: faLuggageCart,
|
|
139
|
+
lessThanEqual: faLessThanEqual,
|
|
140
|
+
logout: faArrowRightToBracket,
|
|
141
|
+
login: faArrowRightToBracket,
|
|
142
|
+
logs: faCopy,
|
|
143
|
+
notification: faBell,
|
|
144
|
+
organisation: faHouseUser,
|
|
145
|
+
partner: farTriangleExclamation,
|
|
146
|
+
exchangeRates: farTriangleExclamation,
|
|
147
|
+
product: faBoxOpen,
|
|
148
|
+
box: faBox,
|
|
149
|
+
boxRegular: faBoxRegular,
|
|
150
|
+
boxes: faBoxesStacked,
|
|
151
|
+
boxChecked: faBoxCircleCheck,
|
|
152
|
+
shelves: faShelves,
|
|
153
|
+
reservation: faHandHoldingBox,
|
|
154
|
+
return: [faShareSquare, 'horizontal'], // 'fa-share-from-square'
|
|
155
|
+
search: faSearch, // 'magnifying-glass'
|
|
156
|
+
supplier: farTriangleExclamation,
|
|
157
|
+
transfer: faExchange, // 'arrow-right-arrow-left'
|
|
158
|
+
users: faUsersGear,
|
|
159
|
+
warning: farTriangleExclamation,
|
|
160
|
+
close: fasXmark,
|
|
161
|
+
false: fasXmark,
|
|
162
|
+
deleteX: fasXmark,
|
|
163
|
+
deleteCan: faTrashCan,
|
|
164
|
+
import: faCircleArrowDown,
|
|
165
|
+
export: faCircleArrowRight,
|
|
166
|
+
check: faCheck,
|
|
167
|
+
squareCheck: faSquareCheck,
|
|
168
|
+
squareMinus: faSquareMinus,
|
|
169
|
+
goLeft: faChevronLeft,
|
|
170
|
+
goRight: fasChevronRight,
|
|
171
|
+
goDown: fasChevronDown,
|
|
172
|
+
goUp: fasChevronUp,
|
|
173
|
+
internal: faEyeSlash,
|
|
174
|
+
password: faLock,
|
|
175
|
+
notEqual: faNotEqual,
|
|
176
|
+
calendar: faCalendar,
|
|
177
|
+
note: faNoteSticky,
|
|
178
|
+
comments: faComments,
|
|
179
|
+
commentDots: faCommentDots,
|
|
180
|
+
calendarPlus: faCalendarPlus,
|
|
181
|
+
download: faArrowDownToBracket,
|
|
182
|
+
plus: faPlus,
|
|
183
|
+
minus: faMinus,
|
|
184
|
+
warningDual: fadTriangleExclamation,
|
|
185
|
+
info: faCircleInfo,
|
|
186
|
+
cube: faCube,
|
|
187
|
+
flatBox: faBoxArchive,
|
|
188
|
+
link: faLink,
|
|
189
|
+
facebook: faFacebookF,
|
|
190
|
+
twitter: faTwitter,
|
|
191
|
+
linkedin: faLinkedinIn,
|
|
192
|
+
instagram: faInstagram,
|
|
193
|
+
faceMeh: faFaceMeh,
|
|
194
|
+
handStop: faHand,
|
|
195
|
+
drag: faHand,
|
|
196
|
+
flag: faFlag,
|
|
197
|
+
findDetail: faFileSearch,
|
|
198
|
+
compass: faLocationCrosshairs,
|
|
199
|
+
boxRamp: faTruckRampBox,
|
|
200
|
+
earth: faGlobe,
|
|
201
|
+
filePlaceholder: faFileLines,
|
|
202
|
+
tags: faTags,
|
|
203
|
+
circleCheck: faCircleCheck,
|
|
204
|
+
circleX: faCircleXmark,
|
|
205
|
+
circleTriangle: faTriangleExclamation,
|
|
206
|
+
questionMak: faCircleQuestion,
|
|
207
|
+
badgeCheck: faBadgeCheck,
|
|
208
|
+
peopleCarry: fasPeopleCarry,
|
|
209
|
+
stopwatch: faStopwatch,
|
|
210
|
+
truck: faTruck,
|
|
211
|
+
webhook: faWebhook,
|
|
212
|
+
watch: faWatch,
|
|
213
|
+
filter: faFilter
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
library.add(
|
|
217
|
+
farCoffee,
|
|
218
|
+
fasCoffee,
|
|
219
|
+
falCoffee,
|
|
220
|
+
faHandHoldingBox,
|
|
221
|
+
faLuggageCart,
|
|
222
|
+
faPaperclip,
|
|
223
|
+
fasPeopleCarry,
|
|
224
|
+
faStopwatch,
|
|
225
|
+
faTruck,
|
|
226
|
+
faWatch,
|
|
227
|
+
faFileSearch,
|
|
228
|
+
faCircleCheck,
|
|
229
|
+
faCircleXmark,
|
|
230
|
+
faTriangleExclamation,
|
|
231
|
+
faBadgeCheck,
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
const iconPrefixMap = {
|
|
235
|
+
normal: 'far',
|
|
236
|
+
light: 'fal',
|
|
237
|
+
solid: 'fas',
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const FaIconSizing = styled.div<{
|
|
241
|
+
size?: string | number
|
|
242
|
+
$colorSecondary?: string
|
|
243
|
+
$fixedWidth: boolean
|
|
244
|
+
}>`
|
|
245
|
+
${({ size }): string | number | undefined => size && `font-size: ${size};`}
|
|
246
|
+
--fa-secondary-color: ${({ $colorSecondary }) => $colorSecondary};
|
|
247
|
+
--fa-secondary-opacity: 1;
|
|
248
|
+
display: ${({ $fixedWidth }) => ($fixedWidth ? 'contents' : 'block')};
|
|
249
|
+
`
|
|
250
|
+
|
|
251
|
+
const Icon = ({
|
|
252
|
+
icon,
|
|
253
|
+
fill,
|
|
254
|
+
style = 'normal',
|
|
255
|
+
size,
|
|
256
|
+
className,
|
|
257
|
+
secondaryColor,
|
|
258
|
+
fixedWidth = true,
|
|
259
|
+
spinning,
|
|
260
|
+
}: IconProps): JSX.Element => {
|
|
261
|
+
const theme = useTheme()
|
|
262
|
+
const colorFill = fill && (th.color(fill)({ theme }) as string) // React.Text wont return number here
|
|
263
|
+
const colorSecondary = secondaryColor && (th.color(secondaryColor)({ theme }) as string)
|
|
264
|
+
|
|
265
|
+
const namedIcon = (typeof icon == 'string' && iconDictionary?.[icon]) || false
|
|
266
|
+
|
|
267
|
+
const iconProp = React.useMemo(() => {
|
|
268
|
+
if (namedIcon) {
|
|
269
|
+
return Array.isArray(namedIcon) ? namedIcon[0] : namedIcon
|
|
270
|
+
}
|
|
271
|
+
return [iconPrefixMap[style], icon]
|
|
272
|
+
}, [icon, style, namedIcon]) as [IconPrefix, IconName]
|
|
273
|
+
|
|
274
|
+
const flipProp = (namedIcon && Array.isArray(namedIcon) && namedIcon[1]) || undefined
|
|
275
|
+
|
|
276
|
+
return (
|
|
277
|
+
<FaIconSizing size={size} className={className ?? ''} $colorSecondary={colorSecondary} $fixedWidth={fixedWidth}>
|
|
278
|
+
<FontAwesomeIcon
|
|
279
|
+
color={colorFill}
|
|
280
|
+
flip={flipProp}
|
|
281
|
+
icon={iconProp}
|
|
282
|
+
className={`faIcon ${fixedWidth ? 'fa-fw' : ''} ${spinning ? 'fa-spin' : ''}`}
|
|
283
|
+
/>
|
|
284
|
+
</FaIconSizing>
|
|
285
|
+
)
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export default Icon
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type FC } from 'react'
|
|
2
|
+
import { SvgProps } from '../types'
|
|
3
|
+
|
|
4
|
+
export const FlagCZ: FC<SvgProps> = (props) => (
|
|
5
|
+
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-cz" viewBox="0 0 640 480" height="1em" width="1em" {...props}>
|
|
6
|
+
<path fill="#fff" d="M0 0h640v240H0z" />
|
|
7
|
+
<path fill="#d7141a" d="M0 240h640v240H0z" />
|
|
8
|
+
<path fill="#11457e" d="M360 240 0 0v480z" />
|
|
9
|
+
</svg>
|
|
10
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type FC } from 'react'
|
|
2
|
+
import { SvgProps } from '../types'
|
|
3
|
+
|
|
4
|
+
export const FlagUSA: FC<SvgProps> = (props) => (
|
|
5
|
+
<svg xmlns="http://www.w3.org/2000/svg" id="flag-icons-us" viewBox="0 0 640 480" height="1em" width="1em" {...props}>
|
|
6
|
+
<g fillRule="evenodd">
|
|
7
|
+
<g strokeWidth="1pt">
|
|
8
|
+
<path
|
|
9
|
+
fill="#bd3d44"
|
|
10
|
+
d="M0 0h972.8v39.4H0zm0 78.8h972.8v39.4H0zm0 78.7h972.8V197H0zm0 78.8h972.8v39.4H0zm0 78.8h972.8v39.4H0zm0 78.7h972.8v39.4H0zm0 78.8h972.8V512H0z"
|
|
11
|
+
transform="scale(.9375)"
|
|
12
|
+
/>
|
|
13
|
+
<path
|
|
14
|
+
fill="#fff"
|
|
15
|
+
d="M0 39.4h972.8v39.4H0zm0 78.8h972.8v39.3H0zm0 78.7h972.8v39.4H0zm0 78.8h972.8v39.4H0zm0 78.8h972.8v39.4H0zm0 78.7h972.8v39.4H0z"
|
|
16
|
+
transform="scale(.9375)"
|
|
17
|
+
/>
|
|
18
|
+
</g>
|
|
19
|
+
<path fill="#192f5d" d="M0 0h389.1v275.7H0z" transform="scale(.9375)" />
|
|
20
|
+
<path
|
|
21
|
+
fill="#fff"
|
|
22
|
+
d="M32.4 11.8 36 22.7h11.4l-9.2 6.7 3.5 11-9.3-6.8-9.2 6.7 3.5-10.9-9.3-6.7H29zm64.9 0 3.5 10.9h11.5l-9.3 6.7 3.5 11-9.2-6.8-9.3 6.7 3.5-10.9-9.2-6.7h11.4zm64.8 0 3.6 10.9H177l-9.2 6.7 3.5 11-9.3-6.8-9.2 6.7 3.5-10.9-9.3-6.7h11.5zm64.9 0 3.5 10.9H242l-9.3 6.7 3.6 11-9.3-6.8-9.3 6.7 3.6-10.9-9.3-6.7h11.4zm64.8 0 3.6 10.9h11.4l-9.2 6.7 3.5 11-9.3-6.8-9.2 6.7 3.5-10.9-9.2-6.7h11.4zm64.9 0 3.5 10.9h11.5l-9.3 6.7 3.6 11-9.3-6.8-9.3 6.7 3.6-10.9-9.3-6.7h11.5zM64.9 39.4l3.5 10.9h11.5L70.6 57 74 67.9l-9-6.7-9.3 6.7L59 57l-9-6.7h11.4zm64.8 0 3.6 10.9h11.4l-9.3 6.7 3.6 10.9-9.3-6.7-9.3 6.7L124 57l-9.3-6.7h11.5zm64.9 0 3.5 10.9h11.5l-9.3 6.7 3.5 10.9-9.2-6.7-9.3 6.7 3.5-10.9-9.2-6.7H191zm64.8 0 3.6 10.9h11.4l-9.3 6.7 3.6 10.9-9.3-6.7-9.2 6.7 3.5-10.9-9.3-6.7H256zm64.9 0 3.5 10.9h11.5L330 57l3.5 10.9-9.2-6.7-9.3 6.7 3.5-10.9-9.2-6.7h11.4zM32.4 66.9 36 78h11.4l-9.2 6.7 3.5 10.9-9.3-6.8-9.2 6.8 3.5-11-9.3-6.7H29zm64.9 0 3.5 11h11.5l-9.3 6.7 3.5 10.9-9.2-6.8-9.3 6.8 3.5-11-9.2-6.7h11.4zm64.8 0 3.6 11H177l-9.2 6.7 3.5 10.9-9.3-6.8-9.2 6.8 3.5-11-9.3-6.7h11.5zm64.9 0 3.5 11H242l-9.3 6.7 3.6 10.9-9.3-6.8-9.3 6.8 3.6-11-9.3-6.7h11.4zm64.8 0 3.6 11h11.4l-9.2 6.7 3.5 10.9-9.3-6.8-9.2 6.8 3.5-11-9.2-6.7h11.4zm64.9 0 3.5 11h11.5l-9.3 6.7 3.6 10.9-9.3-6.8-9.3 6.8 3.6-11-9.3-6.7h11.5zM64.9 94.5l3.5 10.9h11.5l-9.3 6.7 3.5 11-9.2-6.8-9.3 6.7 3.5-10.9-9.2-6.7h11.4zm64.8 0 3.6 10.9h11.4l-9.3 6.7 3.6 11-9.3-6.8-9.3 6.7 3.6-10.9-9.3-6.7h11.5zm64.9 0 3.5 10.9h11.5l-9.3 6.7 3.5 11-9.2-6.8-9.3 6.7 3.5-10.9-9.2-6.7H191zm64.8 0 3.6 10.9h11.4l-9.2 6.7 3.5 11-9.3-6.8-9.2 6.7 3.5-10.9-9.3-6.7H256zm64.9 0 3.5 10.9h11.5l-9.3 6.7 3.5 11-9.2-6.8-9.3 6.7 3.5-10.9-9.2-6.7h11.4zM32.4 122.1 36 133h11.4l-9.2 6.7 3.5 11-9.3-6.8-9.2 6.7 3.5-10.9-9.3-6.7H29zm64.9 0 3.5 10.9h11.5l-9.3 6.7 3.5 10.9-9.2-6.7-9.3 6.7 3.5-10.9-9.2-6.7h11.4zm64.8 0 3.6 10.9H177l-9.2 6.7 3.5 11-9.3-6.8-9.2 6.7 3.5-10.9-9.3-6.7h11.5zm64.9 0 3.5 10.9H242l-9.3 6.7 3.6 11-9.3-6.8-9.3 6.7 3.6-10.9-9.3-6.7h11.4zm64.8 0 3.6 10.9h11.4l-9.2 6.7 3.5 11-9.3-6.8-9.2 6.7 3.5-10.9-9.2-6.7h11.4zm64.9 0 3.5 10.9h11.5l-9.3 6.7 3.6 11-9.3-6.8-9.3 6.7 3.6-10.9-9.3-6.7h11.5zM64.9 149.7l3.5 10.9h11.5l-9.3 6.7 3.5 10.9-9.2-6.8-9.3 6.8 3.5-11-9.2-6.7h11.4zm64.8 0 3.6 10.9h11.4l-9.3 6.7 3.6 10.9-9.3-6.8-9.3 6.8 3.6-11-9.3-6.7h11.5zm64.9 0 3.5 10.9h11.5l-9.3 6.7 3.5 10.9-9.2-6.8-9.3 6.8 3.5-11-9.2-6.7H191zm64.8 0 3.6 10.9h11.4l-9.2 6.7 3.5 10.9-9.3-6.8-9.2 6.8 3.5-11-9.3-6.7H256zm64.9 0 3.5 10.9h11.5l-9.3 6.7 3.5 10.9-9.2-6.8-9.3 6.8 3.5-11-9.2-6.7h11.4zM32.4 177.2l3.6 11h11.4l-9.2 6.7 3.5 10.8-9.3-6.7-9.2 6.7 3.5-10.9-9.3-6.7H29zm64.9 0 3.5 11h11.5l-9.3 6.7 3.6 10.8-9.3-6.7-9.3 6.7 3.6-10.9-9.3-6.7h11.4zm64.8 0 3.6 11H177l-9.2 6.7 3.5 10.8-9.3-6.7-9.2 6.7 3.5-10.9-9.3-6.7h11.5zm64.9 0 3.5 11H242l-9.3 6.7 3.6 10.8-9.3-6.7-9.3 6.7 3.6-10.9-9.3-6.7h11.4zm64.8 0 3.6 11h11.4l-9.2 6.7 3.5 10.8-9.3-6.7-9.2 6.7 3.5-10.9-9.2-6.7h11.4zm64.9 0 3.5 11h11.5l-9.3 6.7 3.6 10.8-9.3-6.7-9.3 6.7 3.6-10.9-9.3-6.7h11.5zM64.9 204.8l3.5 10.9h11.5l-9.3 6.7 3.5 11-9.2-6.8-9.3 6.7 3.5-10.9-9.2-6.7h11.4zm64.8 0 3.6 10.9h11.4l-9.3 6.7 3.6 11-9.3-6.8-9.3 6.7 3.6-10.9-9.3-6.7h11.5zm64.9 0 3.5 10.9h11.5l-9.3 6.7 3.5 11-9.2-6.8-9.3 6.7 3.5-10.9-9.2-6.7H191zm64.8 0 3.6 10.9h11.4l-9.2 6.7 3.5 11-9.3-6.8-9.2 6.7 3.5-10.9-9.3-6.7H256zm64.9 0 3.5 10.9h11.5l-9.3 6.7 3.5 11-9.2-6.8-9.3 6.7 3.5-10.9-9.2-6.7h11.4zM32.4 232.4l3.6 10.9h11.4l-9.2 6.7 3.5 10.9-9.3-6.7-9.2 6.7 3.5-11-9.3-6.7H29zm64.9 0 3.5 10.9h11.5L103 250l3.6 10.9-9.3-6.7-9.3 6.7 3.6-11-9.3-6.7h11.4zm64.8 0 3.6 10.9H177l-9 6.7 3.5 10.9-9.3-6.7-9.2 6.7 3.5-11-9.3-6.7h11.5zm64.9 0 3.5 10.9H242l-9.3 6.7 3.6 10.9-9.3-6.7-9.3 6.7 3.6-11-9.3-6.7h11.4zm64.8 0 3.6 10.9h11.4l-9.2 6.7 3.5 10.9-9.3-6.7-9.2 6.7 3.5-11-9.2-6.7h11.4zm64.9 0 3.5 10.9h11.5l-9.3 6.7 3.6 10.9-9.3-6.7-9.3 6.7 3.6-11-9.3-6.7h11.5z"
|
|
23
|
+
transform="scale(.9375)"
|
|
24
|
+
/>
|
|
25
|
+
</g>
|
|
26
|
+
</svg>
|
|
27
|
+
)
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import BadgeIcon from '../BadgeIcon'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Elements/BadgeIcon',
|
|
6
|
+
component: BadgeIcon,
|
|
7
|
+
decorators: [
|
|
8
|
+
(Story) => (
|
|
9
|
+
<div style={{ width: '30px' }}>
|
|
10
|
+
<Story />
|
|
11
|
+
</div>
|
|
12
|
+
),
|
|
13
|
+
],
|
|
14
|
+
tags: ['autodocs'],
|
|
15
|
+
argTypes: {},
|
|
16
|
+
} satisfies Meta<typeof BadgeIcon>
|
|
17
|
+
|
|
18
|
+
export default meta
|
|
19
|
+
type Story = StoryObj<typeof meta>
|
|
20
|
+
|
|
21
|
+
export const Default: Story = {
|
|
22
|
+
args: {
|
|
23
|
+
icon: 'coffee',
|
|
24
|
+
badge: 'warning'
|
|
25
|
+
},
|
|
26
|
+
}
|
|
27
|
+
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import Icon from '../Icon'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Elements/Icon',
|
|
6
|
+
component: Icon,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {},
|
|
9
|
+
} satisfies Meta<typeof Icon>
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
type Story = StoryObj<typeof meta>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export const Expedition: Story = {
|
|
16
|
+
args: {
|
|
17
|
+
icon: 'expedition',
|
|
18
|
+
size: '40px',
|
|
19
|
+
},
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const Spinning: Story = {
|
|
23
|
+
args: {
|
|
24
|
+
icon: 'expedition',
|
|
25
|
+
size: '40px',
|
|
26
|
+
spinning: true
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const SmallExpedition: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
icon: 'expedition',
|
|
33
|
+
size: '20px',
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const BigExpedition: Story = {
|
|
38
|
+
args: {
|
|
39
|
+
icon: 'expedition',
|
|
40
|
+
size: '80px',
|
|
41
|
+
},
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const ExpeditionPink: Story = {
|
|
45
|
+
args: {
|
|
46
|
+
icon: 'expedition',
|
|
47
|
+
fill: 'pink',
|
|
48
|
+
size: '40px',
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
export const ExpeditionPinkSolid: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
icon: 'expedition',
|
|
56
|
+
style: 'solid',
|
|
57
|
+
fill: 'pink',
|
|
58
|
+
size: '40px',
|
|
59
|
+
},
|
|
60
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MouseEventHandler } from 'react'
|
|
2
|
+
|
|
3
|
+
export type IconProps = {
|
|
4
|
+
icon: string
|
|
5
|
+
style?: 'normal' | 'light' | 'solid'
|
|
6
|
+
fill?: string
|
|
7
|
+
size?: number | string
|
|
8
|
+
className?: string
|
|
9
|
+
fixedWidth?: boolean
|
|
10
|
+
spinning?: boolean // todo refactor as library prop
|
|
11
|
+
secondaryColor?: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface SvgProps {
|
|
15
|
+
width?: number | string
|
|
16
|
+
height?: number | string
|
|
17
|
+
onClick?: MouseEventHandler<SVGSVGElement>
|
|
18
|
+
fill?: string
|
|
19
|
+
stroke?: string
|
|
20
|
+
cursor?: string
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
export interface IIcon {
|
|
25
|
+
(props: IconProps): JSX.Element
|
|
26
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Spinner
|
|
2
|
+
|
|
3
|
+
## Props
|
|
4
|
+
|
|
5
|
+
| Component | Type | Description |
|
|
6
|
+
| ---------- | :--------: | :-------------------------------------------------------------------------------- |
|
|
7
|
+
| variant | React.node | 'default', 'sm' |
|
|
8
|
+
| appearance | string | 'concept', 'done', 'error', 'info', 'processing', 'success', 'warning', 'waiting' |
|
|
9
|
+
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Svg, Circle } from './styles'
|
|
2
|
+
import { ISpinner } from './types'
|
|
3
|
+
|
|
4
|
+
export const appearanceToColorMap = {
|
|
5
|
+
error: 'red1',
|
|
6
|
+
concept: 'bgLightGray1',
|
|
7
|
+
done: 'darkGreen',
|
|
8
|
+
info: 'lightGray6',
|
|
9
|
+
processing: 'blue2',
|
|
10
|
+
success: 'green',
|
|
11
|
+
warning: 'yellow1',
|
|
12
|
+
waiting: 'gray1',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const appearanceToFontColorMap: Record<string, string> = {
|
|
16
|
+
error: 'white',
|
|
17
|
+
concept: 'blue2',
|
|
18
|
+
done: 'white',
|
|
19
|
+
info: 'blue2',
|
|
20
|
+
processing: 'white',
|
|
21
|
+
success: 'white',
|
|
22
|
+
warning: 'blue2',
|
|
23
|
+
waiting: 'white',
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const Spinner: ISpinner = ({ variant = 'default', appearance }) => {
|
|
27
|
+
const color = appearance ? appearanceToFontColorMap[appearance] : 'blue2'
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Svg viewBox="22 22 44 44" $variant={variant}>
|
|
31
|
+
<Circle cx="44" cy="44" r="20.2" fill="none" strokeWidth="3.6" color={color} />
|
|
32
|
+
</Svg>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default Spinner
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react'
|
|
2
|
+
import Spinner from '../'
|
|
3
|
+
|
|
4
|
+
const meta = {
|
|
5
|
+
title: 'Elements/Spinner',
|
|
6
|
+
component: Spinner,
|
|
7
|
+
tags: ['autodocs'],
|
|
8
|
+
argTypes: {},
|
|
9
|
+
} satisfies Meta<typeof Spinner>
|
|
10
|
+
|
|
11
|
+
export default meta
|
|
12
|
+
type Story = StoryObj<typeof meta>
|
|
13
|
+
|
|
14
|
+
export const Default: Story = {
|
|
15
|
+
args: {},
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export const Sm: Story = {
|
|
19
|
+
args: {
|
|
20
|
+
variant: 'sm',
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const AppearanceConcept: Story = {
|
|
25
|
+
args: {
|
|
26
|
+
appearance: 'concept',
|
|
27
|
+
},
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const AppearanceDone: Story = {
|
|
31
|
+
args: {
|
|
32
|
+
appearance: 'done',
|
|
33
|
+
},
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const AppearanceError: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
appearance: 'error',
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const AppearanceInfo: Story = {
|
|
43
|
+
args: {
|
|
44
|
+
appearance: 'info',
|
|
45
|
+
},
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const AppearanceProcessing: Story = {
|
|
49
|
+
args: {
|
|
50
|
+
appearance: 'processing',
|
|
51
|
+
},
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export const AppearanceSuccess: Story = {
|
|
55
|
+
args: {
|
|
56
|
+
appearance: 'success',
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export const AppearanceWarning: Story = {
|
|
61
|
+
args: {
|
|
62
|
+
appearance: 'warning',
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const AppearanceWaiting: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
appearance: 'waiting',
|
|
69
|
+
},
|
|
70
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import styled, { th } from '@xstyled/styled-components'
|
|
2
|
+
import { keyframes } from 'styled-components'
|
|
3
|
+
|
|
4
|
+
const KeyframesCircularDash = keyframes`
|
|
5
|
+
0% {
|
|
6
|
+
stroke-dasharray: 1px, 200px;
|
|
7
|
+
stroke-dashoffset: 0px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
50% {
|
|
11
|
+
stroke-dasharray: 100px, 200px;
|
|
12
|
+
stroke-dashoffset: -15px;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
100% {
|
|
16
|
+
stroke-dasharray: 100px, 200px;
|
|
17
|
+
stroke-dashoffset: -125px;
|
|
18
|
+
}
|
|
19
|
+
`
|
|
20
|
+
|
|
21
|
+
const KeyframesCircularRotate = keyframes`
|
|
22
|
+
100% {
|
|
23
|
+
transform: rotate(360deg);
|
|
24
|
+
}
|
|
25
|
+
`
|
|
26
|
+
|
|
27
|
+
export const Svg = styled.svg<{ $variant: 'default' | 'sm' }>`
|
|
28
|
+
width: ${({ $variant }): string => ($variant === 'sm' ? '16' : '40')}px;
|
|
29
|
+
height: ${({ $variant }): string => ($variant === 'sm' ? '16' : '40')}px;
|
|
30
|
+
animation: ${KeyframesCircularRotate} 1.4s linear infinite;
|
|
31
|
+
`
|
|
32
|
+
|
|
33
|
+
export const Circle = styled.circle`
|
|
34
|
+
animation: ${KeyframesCircularDash} 1.4s ease-in-out infinite;
|
|
35
|
+
stroke-dasharray: 80px, 200px;
|
|
36
|
+
stroke-dashoffset: 0px;
|
|
37
|
+
stroke: ${({ color }) => (color ? th.color(color) : th.color('blue2'))};
|
|
38
|
+
`
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type AppearanceType = 'concept' | 'done' | 'error' | 'info' | 'processing' | 'success' | 'warning' | 'waiting'
|
|
2
|
+
|
|
3
|
+
export interface SpinnerProps {
|
|
4
|
+
variant?: 'default' | 'sm'
|
|
5
|
+
appearance?: AppearanceType
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type ISpinner = (props: SpinnerProps) => JSX.Element
|
|
File without changes
|