@integrigo/integrigo-ui 1.6.16 → 1.6.17-a
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/index.d.ts +3 -1
- package/lib/index.esm.js +1 -1
- package/lib/index.esm.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/src/components/atoms/Chip/Chip.d.ts +5 -17
- package/lib/src/components/atoms/DateTime/DateTime.d.ts +10 -0
- package/lib/src/components/atoms/DateTime/DateTime.stories.d.ts +5 -0
- package/lib/src/components/atoms/DateTime/index.d.ts +1 -0
- package/lib/src/components/atoms/Divider/Divider.stories.d.ts +4 -4
- package/lib/src/components/atoms/Dot/Dot.stories.d.ts +3 -3
- package/lib/src/components/atoms/Icon/Icon.d.ts +1 -0
- package/lib/src/components/atoms/Icon/Icon.stories.d.ts +2 -2
- package/lib/src/components/atoms/Icon/icons/CalendarSlash.d.ts +3 -0
- package/lib/src/components/atoms/index.d.ts +1 -0
- package/lib/src/components/molecules/Dropdown/Dropdown.d.ts +6 -4
- package/lib/src/components/molecules/Dropdown/Dropdown.stories.d.ts +12 -6
- package/lib/src/components/molecules/Dropdown/Option.d.ts +5 -2
- package/lib/src/components/molecules/Input/Input.d.ts +1 -1
- package/lib/src/components/molecules/Input/Input.stories.d.ts +9 -9
- package/lib/src/components/organisms/Select/Select.d.ts +10 -0
- package/lib/src/components/organisms/Select/index.d.ts +1 -0
- package/lib/src/components/organisms/index.d.ts +1 -0
- package/lib/src/index.d.ts +2 -2
- package/package.json +2 -1
- package/src/components/atoms/Chip/Chip.test.tsx +11 -9
- package/src/components/atoms/Chip/Chip.tsx +103 -73
- package/src/components/atoms/DateTime/DateTime.stories.tsx +22 -0
- package/src/components/atoms/DateTime/DateTime.tsx +39 -0
- package/src/components/atoms/DateTime/index.ts +1 -0
- package/src/components/atoms/Icon/Icon.tsx +2 -0
- package/src/components/atoms/Icon/icons/CalendarSlash.tsx +9 -0
- package/src/components/atoms/Initials/Initials.tsx +1 -0
- package/src/components/atoms/index.ts +1 -0
- package/src/components/molecules/Dropdown/Dropdown.tsx +4 -4
- package/src/components/molecules/Dropdown/Option.tsx +10 -3
- package/src/components/molecules/Profile/Profile.tsx +12 -3
- package/src/components/organisms/Select/Select.tsx +16 -0
- package/src/components/organisms/Select/index.ts +1 -0
- package/src/components/organisms/index.ts +2 -1
- package/src/index.ts +2 -1
@@ -1,101 +1,95 @@
|
|
1
|
-
import
|
2
|
-
import styled from
|
3
|
-
import { Icon, IconType } from
|
1
|
+
import { MouseEvent, FC } from "react";
|
2
|
+
import styled from "styled-components";
|
3
|
+
import { Icon, IconType } from "../Icon";
|
4
4
|
|
5
5
|
type OnClickFunctionType = (e: MouseEvent<HTMLDivElement>) => void;
|
6
6
|
|
7
7
|
export interface ChipProps {
|
8
|
-
iconLeft?: IconType
|
9
|
-
iconRight?: IconType
|
10
|
-
size?:
|
11
|
-
label:
|
12
|
-
variant?:
|
8
|
+
iconLeft?: IconType;
|
9
|
+
iconRight?: IconType;
|
10
|
+
size?: 's' | 'm' | 'l' | 'xl';
|
11
|
+
label: React.ReactNode;
|
12
|
+
variant?: 'transparent' | 'white' | 'primary' | 'secondary' | 'grey';
|
13
13
|
onClick?: OnClickFunctionType;
|
14
14
|
}
|
15
15
|
|
16
|
-
export enum ChipVariant {
|
17
|
-
transparent = 'transparent',
|
18
|
-
white = 'white',
|
19
|
-
primary = 'primary',
|
20
|
-
secondary = 'secondary',
|
21
|
-
}
|
22
|
-
|
23
|
-
export enum ChipSize {
|
24
|
-
xl = 'xl',
|
25
|
-
l = 'l',
|
26
|
-
m = 'm',
|
27
|
-
s = 's',
|
28
|
-
}
|
29
|
-
|
30
16
|
const sizeVariant = {
|
31
17
|
xl: {
|
32
18
|
iconSize: {
|
33
19
|
width: 25,
|
34
20
|
height: 25,
|
35
21
|
},
|
36
|
-
gap:
|
37
|
-
paddingY:
|
38
|
-
paddingX:
|
39
|
-
border:
|
40
|
-
fontSize:
|
41
|
-
lineHeight:
|
22
|
+
gap: "12.5px",
|
23
|
+
paddingY: "12.5px",
|
24
|
+
paddingX: "17.5px",
|
25
|
+
border: "2px",
|
26
|
+
fontSize: "20px",
|
27
|
+
lineHeight: "30px",
|
42
28
|
},
|
43
29
|
l: {
|
44
30
|
iconSize: {
|
45
31
|
width: 20,
|
46
32
|
height: 20,
|
47
33
|
},
|
48
|
-
gap:
|
49
|
-
paddingY:
|
50
|
-
paddingX:
|
51
|
-
border:
|
52
|
-
fontSize:
|
53
|
-
lineHeight:
|
34
|
+
gap: "10px",
|
35
|
+
paddingY: "10px",
|
36
|
+
paddingX: "14px",
|
37
|
+
border: "2px",
|
38
|
+
fontSize: "16px",
|
39
|
+
lineHeight: "24px",
|
54
40
|
},
|
55
41
|
m: {
|
56
42
|
iconSize: {
|
57
43
|
width: 15,
|
58
44
|
height: 15,
|
59
45
|
},
|
60
|
-
gap:
|
61
|
-
paddingY:
|
62
|
-
paddingX:
|
63
|
-
border:
|
64
|
-
fontSize:
|
65
|
-
lineHeight:
|
46
|
+
gap: "7.5px",
|
47
|
+
paddingY: "7.5px",
|
48
|
+
paddingX: "10.5px",
|
49
|
+
border: "2px",
|
50
|
+
fontSize: "12px",
|
51
|
+
lineHeight: "18px",
|
66
52
|
},
|
67
53
|
s: {
|
68
54
|
iconSize: {
|
69
55
|
width: 10,
|
70
56
|
height: 10,
|
71
57
|
},
|
72
|
-
gap:
|
73
|
-
paddingY:
|
74
|
-
paddingX:
|
75
|
-
border:
|
76
|
-
fontSize:
|
77
|
-
lineHeight:
|
58
|
+
gap: "5px",
|
59
|
+
paddingY: "5px",
|
60
|
+
paddingX: "7px",
|
61
|
+
border: "1.5px",
|
62
|
+
fontSize: "8px",
|
63
|
+
lineHeight: "12px",
|
78
64
|
},
|
79
65
|
};
|
80
66
|
|
81
67
|
const colorVariant = {
|
82
68
|
primary: {
|
83
|
-
fontColor:
|
69
|
+
fontColor: "var(--shades-of-grey-0)",
|
84
70
|
},
|
85
71
|
secondary: {
|
86
|
-
fontColor:
|
72
|
+
fontColor: "var(--color-orange)",
|
87
73
|
},
|
88
74
|
transparent: {
|
89
|
-
fontColor:
|
75
|
+
fontColor: "var(--shades-of-grey-100)",
|
90
76
|
},
|
91
77
|
white: {
|
92
|
-
fontColor:
|
78
|
+
fontColor: "var(--shades-of-grey-100);",
|
79
|
+
},
|
80
|
+
grey: {
|
81
|
+
fontColor: "var(--shades-of-grey-100)",
|
93
82
|
},
|
94
83
|
};
|
95
84
|
|
96
85
|
export const Chip: FC<ChipProps> = (props: ChipProps) => {
|
97
86
|
const {
|
98
|
-
iconLeft,
|
87
|
+
iconLeft,
|
88
|
+
iconRight,
|
89
|
+
label,
|
90
|
+
size = 'm',
|
91
|
+
variant = 'primary',
|
92
|
+
onClick,
|
99
93
|
} = props;
|
100
94
|
|
101
95
|
return (
|
@@ -123,16 +117,18 @@ export const Chip: FC<ChipProps> = (props: ChipProps) => {
|
|
123
117
|
);
|
124
118
|
};
|
125
119
|
|
126
|
-
const getVariantStyles = (variant:
|
120
|
+
const getVariantStyles = (variant: ChipProps['variant'], clickable: boolean): string => {
|
127
121
|
switch (variant) {
|
128
|
-
case
|
122
|
+
case 'secondary':
|
129
123
|
return `
|
130
124
|
background-color: var(--color-white);
|
131
125
|
opacity: 0.9;
|
132
126
|
border-color: var(--color-orange);
|
133
127
|
border-style: solid;
|
134
128
|
|
135
|
-
${
|
129
|
+
${
|
130
|
+
clickable &&
|
131
|
+
`
|
136
132
|
cursor: pointer;
|
137
133
|
|
138
134
|
&:hover {
|
@@ -142,11 +138,14 @@ const getVariantStyles = (variant: ChipVariant, clickable: boolean): string => {
|
|
142
138
|
&:active {
|
143
139
|
opacity: 0.65;
|
144
140
|
}
|
145
|
-
`
|
141
|
+
`
|
142
|
+
}
|
146
143
|
`;
|
147
|
-
case
|
144
|
+
case 'transparent':
|
148
145
|
return `
|
149
|
-
${
|
146
|
+
${
|
147
|
+
clickable &&
|
148
|
+
`
|
150
149
|
&:hover {
|
151
150
|
background-color: var(--shades-of-grey-40);
|
152
151
|
}
|
@@ -154,15 +153,35 @@ const getVariantStyles = (variant: ChipVariant, clickable: boolean): string => {
|
|
154
153
|
&:active {
|
155
154
|
background-color: var(--shades-of-grey-60);
|
156
155
|
}
|
157
|
-
`
|
156
|
+
`
|
157
|
+
}
|
158
|
+
`;
|
159
|
+
case 'grey':
|
160
|
+
return `
|
161
|
+
background-color: var(--shades-of-grey-20);
|
162
|
+
|
163
|
+
${
|
164
|
+
clickable &&
|
165
|
+
`
|
166
|
+
&:hover {
|
167
|
+
background-color: var(--shades-of-grey-40);
|
168
|
+
}
|
169
|
+
|
170
|
+
&:active {
|
171
|
+
background-color: var(--shades-of-grey-40);
|
172
|
+
}
|
173
|
+
`
|
174
|
+
}
|
158
175
|
`;
|
159
|
-
case
|
176
|
+
case 'white':
|
160
177
|
return `
|
161
178
|
background-color: var(--color-white);
|
162
179
|
border-color: var(--shades-of-grey-40);
|
163
180
|
border-style: solid;
|
164
181
|
|
165
|
-
${
|
182
|
+
${
|
183
|
+
clickable &&
|
184
|
+
`
|
166
185
|
&:hover {
|
167
186
|
background-color: var(--shades-of-grey-20);
|
168
187
|
}
|
@@ -170,16 +189,19 @@ const getVariantStyles = (variant: ChipVariant, clickable: boolean): string => {
|
|
170
189
|
&:active {
|
171
190
|
border-color: var(--shades-of-grey-100);
|
172
191
|
}
|
173
|
-
`
|
192
|
+
`
|
193
|
+
}
|
174
194
|
`;
|
175
|
-
case
|
195
|
+
case 'primary':
|
176
196
|
default:
|
177
197
|
return `
|
178
198
|
background-color: var(--color-orange);
|
179
199
|
border-color: var(--color-orange);
|
180
200
|
border-style: solid;
|
181
201
|
|
182
|
-
${
|
202
|
+
${
|
203
|
+
clickable &&
|
204
|
+
`
|
183
205
|
&:hover {
|
184
206
|
opacity: 0.8;
|
185
207
|
}
|
@@ -187,27 +209,35 @@ const getVariantStyles = (variant: ChipVariant, clickable: boolean): string => {
|
|
187
209
|
&:active {
|
188
210
|
opacity: 0.65;
|
189
211
|
}
|
190
|
-
`
|
212
|
+
`
|
213
|
+
}
|
191
214
|
`;
|
192
215
|
}
|
193
216
|
};
|
194
217
|
|
195
|
-
Chip.displayName =
|
218
|
+
Chip.displayName = "Chip";
|
196
219
|
|
197
|
-
const ChipWrapper = styled.div<{
|
220
|
+
const ChipWrapper = styled.div<{
|
221
|
+
size: Exclude<ChipProps['size'], undefined>;
|
222
|
+
variant: Exclude<ChipProps['variant'], undefined>;
|
223
|
+
onClick?: OnClickFunctionType;
|
224
|
+
}>`
|
198
225
|
border-radius: 100px;
|
199
226
|
display: flex;
|
200
227
|
justify-content: center;
|
201
228
|
width: min-content;
|
202
|
-
|
229
|
+
|
203
230
|
${(p) => `
|
204
231
|
border-width: ${sizeVariant[p.size].border};
|
205
232
|
padding: ${sizeVariant[p.size].paddingY} ${sizeVariant[p.size].paddingX};
|
206
233
|
color: ${colorVariant[p.variant].fontColor};
|
207
|
-
${getVariantStyles(p.variant, typeof p.onClick ===
|
208
|
-
${
|
234
|
+
${getVariantStyles(p.variant, typeof p.onClick === "function")}
|
235
|
+
${
|
236
|
+
typeof p.onClick === "function" &&
|
237
|
+
`
|
209
238
|
cursor: pointer;
|
210
|
-
`
|
239
|
+
`
|
240
|
+
}
|
211
241
|
`}
|
212
242
|
`;
|
213
243
|
|
@@ -216,10 +246,10 @@ const IconWrapper = styled.span`
|
|
216
246
|
align-items: center;
|
217
247
|
`;
|
218
248
|
|
219
|
-
IconWrapper.displayName =
|
249
|
+
IconWrapper.displayName = "IconWrapper";
|
220
250
|
|
221
251
|
const Text = styled.span<{
|
222
|
-
size:
|
252
|
+
size: Exclude<ChipProps['size'], undefined>;
|
223
253
|
}>`
|
224
254
|
color: inherit;
|
225
255
|
font-weight: bold;
|
@@ -230,4 +260,4 @@ const Text = styled.span<{
|
|
230
260
|
`}
|
231
261
|
`;
|
232
262
|
|
233
|
-
Text.displayName =
|
263
|
+
Text.displayName = "Text";
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
2
|
+
import { DateTime } from './DateTime';
|
3
|
+
|
4
|
+
export default {
|
5
|
+
title: 'Atoms/DateTime',
|
6
|
+
component: DateTime,
|
7
|
+
argTypes: {
|
8
|
+
format: {
|
9
|
+
name: 'format',
|
10
|
+
type: {
|
11
|
+
name: 'string',
|
12
|
+
required: false,
|
13
|
+
},
|
14
|
+
},
|
15
|
+
},
|
16
|
+
} as ComponentMeta<typeof DateTime>;
|
17
|
+
|
18
|
+
const Template: ComponentStory<typeof DateTime> = (args) => <DateTime {...args} />;
|
19
|
+
|
20
|
+
export const Basic = Template.bind({
|
21
|
+
date: new Date('2022-10-10 11:23')
|
22
|
+
});
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import styled from "styled-components";
|
3
|
+
import dayjs from "dayjs";
|
4
|
+
|
5
|
+
import "dayjs/locale/pl";
|
6
|
+
import "dayjs/locale/en";
|
7
|
+
|
8
|
+
const DEFAULT_FORMAT = "DD-MM-YYYY | HH:mm";
|
9
|
+
|
10
|
+
export interface DateTimeProps {
|
11
|
+
date: Date;
|
12
|
+
format?: string;
|
13
|
+
locale?: "en" | "pl";
|
14
|
+
size?: "xl" | "l" | "m" | "s";
|
15
|
+
}
|
16
|
+
|
17
|
+
const sizeVariant = {
|
18
|
+
xl: 20,
|
19
|
+
l: 16,
|
20
|
+
m: 12,
|
21
|
+
s: 8,
|
22
|
+
};
|
23
|
+
|
24
|
+
export const DateTime: React.FC<DateTimeProps> = ({
|
25
|
+
date,
|
26
|
+
format = DEFAULT_FORMAT,
|
27
|
+
locale = "en",
|
28
|
+
size = "m",
|
29
|
+
}) => {
|
30
|
+
const dateTime = dayjs(date).locale(locale).format(format);
|
31
|
+
|
32
|
+
return <DateTimeString size={size}>{dateTime}</DateTimeString>;
|
33
|
+
};
|
34
|
+
|
35
|
+
const DateTimeString = styled.span<{
|
36
|
+
size: Exclude<DateTimeProps["size"], undefined>;
|
37
|
+
}>`
|
38
|
+
font-size: ${(p) => sizeVariant[p.size]}px;
|
39
|
+
`;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { DateTime } from './DateTime'
|
@@ -6,6 +6,7 @@ import ArrowLeft from "./icons/ArrowLeft";
|
|
6
6
|
import ArrowRight from "./icons/ArrowRight";
|
7
7
|
import Bars from "./icons/Bars";
|
8
8
|
import Bell from "./icons/Bell";
|
9
|
+
import CalendarSlash from "./icons/CalendarSlash";
|
9
10
|
import CheckCircle from "./icons/CheckCircle";
|
10
11
|
import CheckSquare from "./icons/CheckSquare";
|
11
12
|
import ClipboardNotes from "./icons/ClipboardNotes";
|
@@ -43,6 +44,7 @@ export const iconHashMap = {
|
|
43
44
|
"arrow-right": ArrowRight,
|
44
45
|
bars: Bars,
|
45
46
|
bell: Bell,
|
47
|
+
"calendar-slash": CalendarSlash,
|
46
48
|
"check-circle": CheckCircle,
|
47
49
|
"check-square": CheckSquare,
|
48
50
|
"clipboad-notes": ClipboardNotes,
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import React from "react";
|
2
|
+
|
3
|
+
const CalendarSlash: React.FCS = (props) => (
|
4
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" {...props}>
|
5
|
+
<path d="M11.6599 7H14.9999V8C14.9999 8.26522 15.1053 8.51957 15.2928 8.70711C15.4804 8.89465 15.7347 9 15.9999 9C16.2652 9 16.5195 8.89465 16.707 8.70711C16.8946 8.51957 16.9999 8.26522 16.9999 8V7H17.9999C18.2652 7 18.5195 7.10536 18.707 7.2929C18.8946 7.48043 18.9999 7.73479 18.9999 8V11H17.6599C17.3947 11 17.1404 11.1054 16.9528 11.2929C16.7653 11.4804 16.6599 11.7348 16.6599 12C16.6599 12.2652 16.7653 12.5196 16.9528 12.7071C17.1404 12.8946 17.3947 13 17.6599 13H18.9999V14.34C18.9999 14.6052 19.1053 14.8596 19.2928 15.0471C19.4804 15.2346 19.7347 15.34 19.9999 15.34C20.2652 15.34 20.5195 15.2346 20.707 15.0471C20.8946 14.8596 20.9999 14.6052 20.9999 14.34V8C20.9999 7.20435 20.6839 6.44129 20.1213 5.87868C19.5587 5.31607 18.7956 5 17.9999 5H16.9999V4C16.9999 3.73479 16.8946 3.48043 16.707 3.2929C16.5195 3.10536 16.2652 3 15.9999 3C15.7347 3 15.4804 3.10536 15.2928 3.2929C15.1053 3.48043 14.9999 3.73479 14.9999 4V5H11.6599C11.3947 5 11.1404 5.10536 10.9528 5.2929C10.7653 5.48043 10.6599 5.73479 10.6599 6C10.6599 6.26522 10.7653 6.51957 10.9528 6.70711C11.1404 6.89465 11.3947 7 11.6599 7ZM21.7099 20.29L20.1099 18.69L3.70994 2.29C3.6167 2.19676 3.50601 2.1228 3.38419 2.07234C3.26237 2.02188 3.1318 1.99591 2.99994 1.99591C2.86808 1.99591 2.73751 2.02188 2.61569 2.07234C2.49387 2.1228 2.38318 2.19676 2.28994 2.29C2.10164 2.47831 1.99585 2.7337 1.99585 3C1.99585 3.2663 2.10164 3.5217 2.28994 3.71L4.19994 5.61C3.8287 5.88843 3.52711 6.24918 3.31889 6.66389C3.11067 7.0786 3.00149 7.53596 2.99994 8V18C2.99994 18.7957 3.31601 19.5587 3.87862 20.1213C4.44123 20.6839 5.20429 21 5.99994 21H17.9999C18.4469 20.9974 18.8877 20.8949 19.2899 20.7L20.2899 21.7C20.3829 21.7937 20.4935 21.8681 20.6154 21.9189C20.7372 21.9697 20.8679 21.9958 20.9999 21.9958C21.132 21.9958 21.2627 21.9697 21.3845 21.9189C21.5064 21.8681 21.617 21.7937 21.7099 21.7C21.8962 21.5126 22.0007 21.2592 22.0007 20.995C22.0007 20.7308 21.8962 20.4774 21.7099 20.29ZM4.99994 8C5.00207 7.7962 5.06642 7.59791 5.18438 7.4317C5.30234 7.26549 5.46827 7.13929 5.65994 7.07L9.58994 11H4.99994V8ZM5.99994 19C5.73472 19 5.48037 18.8946 5.29283 18.7071C5.1053 18.5196 4.99994 18.2652 4.99994 18V13H11.5899L17.5899 19H5.99994Z" />
|
6
|
+
</svg>
|
7
|
+
);
|
8
|
+
|
9
|
+
export default CalendarSlash;
|
@@ -27,6 +27,7 @@ const Root = styled.div<{ size: number, color: string }>`
|
|
27
27
|
background-color: ${p => p.color};
|
28
28
|
color: var(--color-white);
|
29
29
|
display: flex;
|
30
|
+
font-size: ${p => `calc(${p.size}px / 2)`};
|
30
31
|
align-items: center;
|
31
32
|
justify-content: center;
|
32
33
|
text-transform: uppercase;
|
@@ -2,6 +2,7 @@ export { Alert } from "./Alert";
|
|
2
2
|
export { Avatar } from "./Avatar";
|
3
3
|
export { Card } from "./Card";
|
4
4
|
export { Divider } from "./Divider";
|
5
|
+
export { DateTime } from "./DateTime";
|
5
6
|
export { Icon } from "./Icon";
|
6
7
|
export { Pill } from "./Pill";
|
7
8
|
export { Typography } from "./Typography";
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React from 'react';
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
2
2
|
import styled from 'styled-components';
|
3
3
|
import { getValidationTypeProps } from '../../../helpers/validation';
|
4
4
|
import { ValidationType } from '../../../types/validation';
|
@@ -13,12 +13,12 @@ export interface DropdwonStaticProps {
|
|
13
13
|
|
14
14
|
export interface DropdownProps
|
15
15
|
extends Omit<React.SelectHTMLAttributes<HTMLSelectElement>, 'size'> {
|
16
|
-
validationType
|
16
|
+
validationType?: ValidationType;
|
17
17
|
label?: string;
|
18
|
-
size
|
18
|
+
size?: 'xl' | 'l' | 'm' | 's';
|
19
19
|
}
|
20
20
|
|
21
|
-
const Dropdown = React.forwardRef<HTMLSelectElement, DropdownProps
|
21
|
+
const Dropdown = React.forwardRef<HTMLSelectElement, PropsWithChildren<DropdownProps>>(
|
22
22
|
({ children, label, size = 'm', ...props }, ref) => {
|
23
23
|
return (
|
24
24
|
<FieldWrapper withLabel={Boolean(label)} sizeVariant={size}>
|
@@ -1,5 +1,12 @@
|
|
1
|
-
import React from
|
1
|
+
import React, { PropsWithChildren } from "react";
|
2
2
|
|
3
|
-
export
|
4
|
-
|
3
|
+
export interface OptionProps {
|
4
|
+
value?: string | number;
|
5
|
+
}
|
6
|
+
|
7
|
+
export const Option: React.FC<PropsWithChildren<OptionProps>> = ({
|
8
|
+
value,
|
9
|
+
children,
|
10
|
+
}) => {
|
11
|
+
return <option value={value}>{children}</option>;
|
5
12
|
};
|
@@ -10,6 +10,14 @@ type ProfileProps = Partial<React.ComponentProps<typeof Avatar>> & {
|
|
10
10
|
children?: React.ReactNode;
|
11
11
|
};
|
12
12
|
|
13
|
+
const fontSizeVariant = {
|
14
|
+
s: 12,
|
15
|
+
m: 16,
|
16
|
+
l: 20,
|
17
|
+
xl: 24,
|
18
|
+
xxl: 32,
|
19
|
+
};
|
20
|
+
|
13
21
|
const getInitials = (text: string): string =>
|
14
22
|
text
|
15
23
|
.split(' ')
|
@@ -32,7 +40,7 @@ export const Profile: React.FC<ProfileProps> = ({
|
|
32
40
|
)}
|
33
41
|
|
34
42
|
<Details>
|
35
|
-
<Name as="span">{name}</Name>
|
43
|
+
<Name as="span" size={size}>{name}</Name>
|
36
44
|
{children}
|
37
45
|
</Details>
|
38
46
|
</Root>
|
@@ -40,14 +48,15 @@ export const Profile: React.FC<ProfileProps> = ({
|
|
40
48
|
|
41
49
|
const Root = styled.div`
|
42
50
|
display: flex;
|
43
|
-
gap: var(--padding-
|
51
|
+
gap: var(--padding-s);
|
44
52
|
align-items: center;
|
45
53
|
`;
|
46
54
|
|
47
55
|
Root.displayName = 'Root';
|
48
56
|
|
49
|
-
const Name = styled(Hero)
|
57
|
+
const Name = styled(Hero)<{ size: ProfileProps['size']}>`
|
50
58
|
font-weight: var(--font-bold);
|
59
|
+
font-size: ${p => fontSizeVariant[p.size || 'm']}px;
|
51
60
|
`;
|
52
61
|
|
53
62
|
Name.displayName = 'Name';
|
@@ -0,0 +1,16 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { Dropdown } from "../../molecules";
|
3
|
+
|
4
|
+
interface SelectProps extends React.ComponentProps<typeof Dropdown> {
|
5
|
+
options: { value: string | number; label: React.ReactNode }[];
|
6
|
+
}
|
7
|
+
|
8
|
+
export const Select: React.FC<SelectProps> = ({ options, ...props }) => (
|
9
|
+
<Dropdown {...props}>
|
10
|
+
{options.map((option) => (
|
11
|
+
<Dropdown.Option key={option.value} value={option.value}>
|
12
|
+
{option.label}
|
13
|
+
</Dropdown.Option>
|
14
|
+
))}
|
15
|
+
</Dropdown>
|
16
|
+
);
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Select } from './Select'
|
package/src/index.ts
CHANGED
@@ -3,6 +3,7 @@ export {
|
|
3
3
|
Avatar,
|
4
4
|
Card,
|
5
5
|
Divider,
|
6
|
+
DateTime,
|
6
7
|
Icon,
|
7
8
|
Nav,
|
8
9
|
Pill,
|
@@ -25,6 +26,6 @@ export {
|
|
25
26
|
Tile,
|
26
27
|
} from "./components/molecules";
|
27
28
|
|
28
|
-
export { Menu, Setting, Modal } from "./components/organisms";
|
29
|
+
export { Menu, Setting, Modal, Select } from "./components/organisms";
|
29
30
|
|
30
31
|
export { GlobalStyles as IntegrigoUI, Color } from "./styles";
|