@via-profit/ui-kit 0.1.0-rc.65 → 0.1.0-rc.66
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/Avatar/AvatarBase.d.ts +73 -0
- package/Avatar/AvatarBase.js +33 -0
- package/Avatar/AvatarContainer.d.ts +26 -0
- package/Avatar/AvatarContainer.js +45 -0
- package/Avatar/AvatarIconWrapper.d.ts +4 -0
- package/Avatar/AvatarIconWrapper.js +30 -0
- package/Avatar/AvatarOnlineBadge.d.ts +4 -0
- package/Avatar/AvatarOnlineBadge.js +36 -0
- package/Avatar/AvatarPicture.d.ts +40 -0
- package/Avatar/AvatarPicture.js +54 -0
- package/Avatar/AvatarStandard.d.ts +5 -0
- package/Avatar/AvatarStandard.js +117 -0
- package/Avatar/AvatarTextWrapper.d.ts +4 -0
- package/Avatar/AvatarTextWrapper.js +36 -0
- package/Avatar/index.d.ts +33 -0
- package/Avatar/index.js +10 -0
- package/Calendar/CalendarBottomBar.d.ts +4 -0
- package/Calendar/CalendarBottomBar.js +28 -0
- package/Calendar/CalendarMonthControl.d.ts +6 -0
- package/Calendar/CalendarMonthControl.js +41 -0
- package/Calendar/IconChevronLeft.d.ts +3 -0
- package/Calendar/IconChevronLeft.js +9 -0
- package/Selectbox/IconShow.d.ts +3 -0
- package/Selectbox/IconShow.js +9 -0
- package/package.json +1 -1
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AvatarIconWrapperProps } from './AvatarIconWrapper';
|
|
3
|
+
import { AvatarTextWrapperProps } from './AvatarTextWrapper';
|
|
4
|
+
import { AvatarContainerProps } from './AvatarContainer';
|
|
5
|
+
import { AvatarPictureProps } from './AvatarPicture';
|
|
6
|
+
type AvatarNativeProps = React.HTMLAttributes<HTMLSpanElement>;
|
|
7
|
+
export interface AvatarBaseProps extends Omit<AvatarNativeProps, 'color'> {
|
|
8
|
+
/**
|
|
9
|
+
* image object of Avatar component
|
|
10
|
+
* Example:
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <Avatar src={[{
|
|
13
|
+
* srcSet: 'https://google.com/images/img.png',
|
|
14
|
+
* type: 'image/png',
|
|
15
|
+
* isDefault: true,
|
|
16
|
+
* }]}>
|
|
17
|
+
* Label
|
|
18
|
+
* </Avatar>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
readonly src?: AvatarPictureProps['src'];
|
|
22
|
+
/**
|
|
23
|
+
* Avatar style variant\
|
|
24
|
+
* Allowed variants: `circular`,`rounded` or `square`\
|
|
25
|
+
* \
|
|
26
|
+
* **Default**: `circular`
|
|
27
|
+
*/
|
|
28
|
+
readonly variant?: 'circular' | 'rounded' | 'square';
|
|
29
|
+
/**
|
|
30
|
+
* Avatar size variant\
|
|
31
|
+
* \
|
|
32
|
+
* **Default**: `2.5em`
|
|
33
|
+
*/
|
|
34
|
+
readonly size?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Show avatar online badge\
|
|
37
|
+
* \
|
|
38
|
+
* **Default**: `undefined`
|
|
39
|
+
*/
|
|
40
|
+
readonly isOnline?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* You can pass the primary, default, secondary name of the colors or your specified color value
|
|
43
|
+
*/
|
|
44
|
+
readonly color?: AvatarContainerProps['color'];
|
|
45
|
+
/**
|
|
46
|
+
* Overridable components map
|
|
47
|
+
*/
|
|
48
|
+
readonly overrides?: AvatarBaseOverrides;
|
|
49
|
+
/**
|
|
50
|
+
* HTML image alt attribute
|
|
51
|
+
*/
|
|
52
|
+
readonly alt?: string;
|
|
53
|
+
}
|
|
54
|
+
export interface AvatarBaseOverrides {
|
|
55
|
+
/**
|
|
56
|
+
* Element container
|
|
57
|
+
*/
|
|
58
|
+
readonly Container?: React.ForwardRefExoticComponent<AvatarContainerProps & React.RefAttributes<HTMLSpanElement>>;
|
|
59
|
+
/**
|
|
60
|
+
* icon wrapper
|
|
61
|
+
*/
|
|
62
|
+
readonly IconWrapper?: React.ForwardRefExoticComponent<AvatarIconWrapperProps & React.RefAttributes<HTMLSpanElement>>;
|
|
63
|
+
/**
|
|
64
|
+
* text wrapper
|
|
65
|
+
*/
|
|
66
|
+
readonly TextWrapper?: React.ForwardRefExoticComponent<AvatarTextWrapperProps & React.RefAttributes<HTMLSpanElement>>;
|
|
67
|
+
/**
|
|
68
|
+
* picture tag
|
|
69
|
+
*/
|
|
70
|
+
readonly Picture?: React.ForwardRefExoticComponent<AvatarPictureProps & React.RefAttributes<HTMLPictureElement>>;
|
|
71
|
+
}
|
|
72
|
+
declare const _default: React.ForwardRefExoticComponent<AvatarBaseProps & React.RefAttributes<HTMLSpanElement>>;
|
|
73
|
+
export default _default;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const AvatarIconWrapper_1 = __importDefault(require("./AvatarIconWrapper"));
|
|
19
|
+
const AvatarTextWrapper_1 = __importDefault(require("./AvatarTextWrapper"));
|
|
20
|
+
const AvatarContainer_1 = __importDefault(require("./AvatarContainer"));
|
|
21
|
+
const AvatarPicture_1 = __importDefault(require("./AvatarPicture"));
|
|
22
|
+
const AvatarBase = (props, ref) => {
|
|
23
|
+
const { children, src, color, alt, variant, overrides, isOnline } = props, nativeProps = __rest(props, ["children", "src", "color", "alt", "variant", "overrides", "isOnline"]);
|
|
24
|
+
const overridesMap = react_1.default.useMemo(() => (Object.assign({ TextWrapper: AvatarTextWrapper_1.default,
|
|
25
|
+
IconWrapper: AvatarIconWrapper_1.default,
|
|
26
|
+
Container: AvatarContainer_1.default,
|
|
27
|
+
Picture: AvatarPicture_1.default }, overrides)), [overrides]);
|
|
28
|
+
return (react_1.default.createElement(overridesMap.Container, Object.assign({}, nativeProps, { color: color, ref: ref }),
|
|
29
|
+
typeof src !== 'undefined' && src !== null && (src === null || src === void 0 ? void 0 : src.length) !== 0 && (react_1.default.createElement(overridesMap.IconWrapper, null,
|
|
30
|
+
react_1.default.createElement(overridesMap.Picture, { src: src }))),
|
|
31
|
+
(!src || src === null || (src === null || src === void 0 ? void 0 : src.length) === 0) && (react_1.default.createElement(overridesMap.TextWrapper, null, children))));
|
|
32
|
+
};
|
|
33
|
+
exports.default = react_1.default.forwardRef(AvatarBase);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type AvatarContainerProps = React.HTMLAttributes<HTMLSpanElement> & {
|
|
3
|
+
/**
|
|
4
|
+
* You can pass the primary, default, secondary name of the colors or your specified color value
|
|
5
|
+
*/
|
|
6
|
+
readonly color?: 'default' | 'primary' | 'secondary' | string;
|
|
7
|
+
/**
|
|
8
|
+
* Avatar size variant\
|
|
9
|
+
* \
|
|
10
|
+
* **Default**: `2.5em`
|
|
11
|
+
*/
|
|
12
|
+
readonly size?: string;
|
|
13
|
+
};
|
|
14
|
+
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLSpanElement> & {
|
|
15
|
+
/**
|
|
16
|
+
* You can pass the primary, default, secondary name of the colors or your specified color value
|
|
17
|
+
*/
|
|
18
|
+
readonly color?: string | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Avatar size variant\
|
|
21
|
+
* \
|
|
22
|
+
* **Default**: `2.5em`
|
|
23
|
+
*/
|
|
24
|
+
readonly size?: string | undefined;
|
|
25
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
26
|
+
export default _default;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const StyledAvatar = styled_1.default.span `
|
|
20
|
+
font-size: 1em;
|
|
21
|
+
border-width: 0;
|
|
22
|
+
outline-style: solid;
|
|
23
|
+
outline-color: transparent;
|
|
24
|
+
outline-width: 0.14em;
|
|
25
|
+
transition: all 180ms ease-out 0s;
|
|
26
|
+
background: none;
|
|
27
|
+
position: relative;
|
|
28
|
+
width: ${({ size }) => size || '2.5em'};
|
|
29
|
+
height: ${({ size }) => size || '2.5em'};
|
|
30
|
+
display: inline-flex;
|
|
31
|
+
overflow: hidden;
|
|
32
|
+
align-items: center;
|
|
33
|
+
color: ${({ color, theme }) => {
|
|
34
|
+
switch (true) {
|
|
35
|
+
case typeof color === 'undefined':
|
|
36
|
+
default:
|
|
37
|
+
return theme.color.textPrimary.toString();
|
|
38
|
+
}
|
|
39
|
+
}};
|
|
40
|
+
`;
|
|
41
|
+
const AvatarContainer = (props, ref) => {
|
|
42
|
+
const { children } = props, nativeProps = __rest(props, ["children"]);
|
|
43
|
+
return (react_1.default.createElement(StyledAvatar, Object.assign({}, nativeProps, { ref: ref }), children));
|
|
44
|
+
};
|
|
45
|
+
exports.default = react_1.default.forwardRef(AvatarContainer);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const Wrapper = styled_1.default.span `
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
23
|
+
width: 100%;
|
|
24
|
+
height: 100%;
|
|
25
|
+
`;
|
|
26
|
+
const AvatarIconWrapper = (props, ref) => {
|
|
27
|
+
const { children } = props, nativeProps = __rest(props, ["children"]);
|
|
28
|
+
return (react_1.default.createElement(Wrapper, Object.assign({}, nativeProps, { ref: ref }), children));
|
|
29
|
+
};
|
|
30
|
+
exports.default = react_1.default.forwardRef(AvatarIconWrapper);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const OnlineBadge = styled_1.default.span `
|
|
20
|
+
display: block;
|
|
21
|
+
position: absolute;
|
|
22
|
+
border-radius: 50%;
|
|
23
|
+
bottom: 14%;
|
|
24
|
+
right: 7%;
|
|
25
|
+
width: 0.6em;
|
|
26
|
+
height: 0.6em;
|
|
27
|
+
transition: transform 225ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
|
|
28
|
+
transform: scale(1) translate(50%, 50%);
|
|
29
|
+
transform-origin: 100% 100%;
|
|
30
|
+
background-color: ${({ theme }) => theme.color.success.toString()};
|
|
31
|
+
`;
|
|
32
|
+
const AvatarOnlineBadge = (props, ref) => {
|
|
33
|
+
const { children } = props, nativeProps = __rest(props, ["children"]);
|
|
34
|
+
return react_1.default.createElement(OnlineBadge, Object.assign({}, nativeProps, { ref: ref }));
|
|
35
|
+
};
|
|
36
|
+
exports.default = react_1.default.forwardRef(AvatarOnlineBadge);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type MimeType = 'image/webp' | 'image/jpeg' | 'image/png' | 'image/gif' | 'image/apng' | 'image/svg+xml' | 'image/bmp' | 'image/x-icon';
|
|
3
|
+
export type SrcObject = {
|
|
4
|
+
srcSet: string;
|
|
5
|
+
type: MimeType;
|
|
6
|
+
isDefault?: boolean;
|
|
7
|
+
};
|
|
8
|
+
export type AvatarPictureProps = React.HTMLAttributes<HTMLPictureElement> & {
|
|
9
|
+
/**
|
|
10
|
+
* image object of Avatar component
|
|
11
|
+
* Example:
|
|
12
|
+
* ```tsx
|
|
13
|
+
* <Avatar src={[{
|
|
14
|
+
* srcSet: 'https://google.com/images/img.png',
|
|
15
|
+
* type: 'image/png',
|
|
16
|
+
* isDefault: true,
|
|
17
|
+
* }]}>
|
|
18
|
+
* Label
|
|
19
|
+
* </Avatar>
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
readonly src: SrcObject[];
|
|
23
|
+
};
|
|
24
|
+
declare const _default: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLPictureElement> & {
|
|
25
|
+
/**
|
|
26
|
+
* image object of Avatar component
|
|
27
|
+
* Example:
|
|
28
|
+
* ```tsx
|
|
29
|
+
* <Avatar src={[{
|
|
30
|
+
* srcSet: 'https://google.com/images/img.png',
|
|
31
|
+
* type: 'image/png',
|
|
32
|
+
* isDefault: true,
|
|
33
|
+
* }]}>
|
|
34
|
+
* Label
|
|
35
|
+
* </Avatar>
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
readonly src: SrcObject[];
|
|
39
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
40
|
+
export default _default;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const Picture = styled_1.default.picture `
|
|
20
|
+
background-position: center;
|
|
21
|
+
background-size: cover;
|
|
22
|
+
width: 100%;
|
|
23
|
+
height: 100%;
|
|
24
|
+
& img {
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
}
|
|
28
|
+
`;
|
|
29
|
+
const generateKey = () => (Math.random() * 10000).toFixed();
|
|
30
|
+
const AvatarPicture = (props, ref) => {
|
|
31
|
+
const { src } = props, nativeProps = __rest(props, ["src"]);
|
|
32
|
+
const defaultSrc = react_1.default.useMemo(() => {
|
|
33
|
+
if (typeof src === 'undefined' || (src === null || src === void 0 ? void 0 : src.length) === 0) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
let retData = src.find(({ isDefault }) => isDefault);
|
|
37
|
+
if (retData) {
|
|
38
|
+
return retData;
|
|
39
|
+
}
|
|
40
|
+
retData = src.find(src => src.type === 'image/png');
|
|
41
|
+
if (retData) {
|
|
42
|
+
return retData;
|
|
43
|
+
}
|
|
44
|
+
retData = src.find(src => src.type === 'image/jpeg');
|
|
45
|
+
return retData ? retData : null;
|
|
46
|
+
}, [src]);
|
|
47
|
+
return (react_1.default.createElement(Picture, Object.assign({}, nativeProps, { ref: ref }),
|
|
48
|
+
src.map((_a) => {
|
|
49
|
+
var { isDefault } = _a, srcProps = __rest(_a, ["isDefault"]);
|
|
50
|
+
return (react_1.default.createElement("source", Object.assign({ key: generateKey() }, srcProps)));
|
|
51
|
+
}),
|
|
52
|
+
react_1.default.createElement("img", { src: (defaultSrc === null || defaultSrc === void 0 ? void 0 : defaultSrc.srcSet) || '' })));
|
|
53
|
+
};
|
|
54
|
+
exports.default = react_1.default.forwardRef(AvatarPicture);
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const react_2 = require("@emotion/react");
|
|
20
|
+
const Color_1 = __importDefault(require("../Color"));
|
|
21
|
+
const AvatarBase_1 = __importDefault(require("./AvatarBase"));
|
|
22
|
+
const AvatarOnlineBadge_1 = __importDefault(require("./AvatarOnlineBadge"));
|
|
23
|
+
const Container = styled_1.default.span `
|
|
24
|
+
position: relative;
|
|
25
|
+
`;
|
|
26
|
+
const StyledStandardAvatar = (0, styled_1.default)(AvatarBase_1.default) `
|
|
27
|
+
color: ${({ $color }) => $color.toString()};
|
|
28
|
+
background-color: ${({ $background }) => $background.toString()};
|
|
29
|
+
${({ $background }) => {
|
|
30
|
+
switch (true) {
|
|
31
|
+
case $background.luminance() > 0.49:
|
|
32
|
+
return $background.darken(40).alpha(0.8).toString();
|
|
33
|
+
default:
|
|
34
|
+
return $background.darken(20).alpha(0.5).toString();
|
|
35
|
+
}
|
|
36
|
+
}};
|
|
37
|
+
&:hover {
|
|
38
|
+
background-color: ${({ $background, $clickable }) => $clickable && $background.darken(30).toString()};
|
|
39
|
+
}
|
|
40
|
+
&:focus-visible {
|
|
41
|
+
outline-color: ${({ theme, $background }) => $background.rgbString() === theme.color.accentPrimary.rgbString()
|
|
42
|
+
? theme.color.textPrimary.toString()
|
|
43
|
+
: theme.color.accentPrimary.toString()};
|
|
44
|
+
}
|
|
45
|
+
${({ $clickable }) => $clickable &&
|
|
46
|
+
(0, react_2.css) `
|
|
47
|
+
cursor: pointer;
|
|
48
|
+
`}
|
|
49
|
+
|
|
50
|
+
${({ variant, theme }) => {
|
|
51
|
+
switch (variant) {
|
|
52
|
+
case 'rounded':
|
|
53
|
+
return (0, react_2.css) `
|
|
54
|
+
border-radius: ${theme.shape.radiusFactor * 0.8}em;
|
|
55
|
+
`;
|
|
56
|
+
case 'square':
|
|
57
|
+
return (0, react_2.css) `
|
|
58
|
+
border-radius: inherit;
|
|
59
|
+
`;
|
|
60
|
+
default:
|
|
61
|
+
return (0, react_2.css) `
|
|
62
|
+
border-radius: 100%;
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
}}
|
|
66
|
+
`;
|
|
67
|
+
const AvatarStandard = (props, ref) => {
|
|
68
|
+
const { children, color, onClick, isOnline } = props, restProps = __rest(props, ["children", "color", "onClick", "isOnline"]);
|
|
69
|
+
const theme = (0, react_2.useTheme)();
|
|
70
|
+
const clickable = react_1.default.useMemo(() => typeof onClick === 'function', [onClick]);
|
|
71
|
+
const { $background, $color } = react_1.default.useMemo(() => {
|
|
72
|
+
switch (true) {
|
|
73
|
+
case color === 'primary':
|
|
74
|
+
return {
|
|
75
|
+
$color: theme.color.accentPrimaryContrast,
|
|
76
|
+
$background: theme.color.accentPrimary,
|
|
77
|
+
};
|
|
78
|
+
case color === 'secondary':
|
|
79
|
+
return {
|
|
80
|
+
$color: theme.color.accentSecondaryContrast,
|
|
81
|
+
$background: theme.color.accentSecondary,
|
|
82
|
+
};
|
|
83
|
+
case typeof color === 'undefined':
|
|
84
|
+
case color === 'default':
|
|
85
|
+
return {
|
|
86
|
+
$background: theme.color.surface.darken(10),
|
|
87
|
+
$color: theme.color.textPrimary,
|
|
88
|
+
};
|
|
89
|
+
case typeof color === 'string': {
|
|
90
|
+
let $background = theme.color.surface;
|
|
91
|
+
try {
|
|
92
|
+
if (color) {
|
|
93
|
+
$background = new Color_1.default(color);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
console.error(`invalid color value «${color}»`);
|
|
98
|
+
}
|
|
99
|
+
return {
|
|
100
|
+
$background,
|
|
101
|
+
$color: $background.contrast(theme.color.textPrimary) > 5
|
|
102
|
+
? theme.color.textPrimary
|
|
103
|
+
: theme.color.surface,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
default:
|
|
107
|
+
return {
|
|
108
|
+
$background: theme.color.surface,
|
|
109
|
+
$color: theme.color.textPrimary,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
}, [color, theme.color]);
|
|
113
|
+
return (react_1.default.createElement(Container, null,
|
|
114
|
+
react_1.default.createElement(StyledStandardAvatar, Object.assign({ variant: "circular", "$clickable": clickable, "$color": $color, "$background": $background, color: color, onClick: onClick }, restProps, { tabIndex: clickable ? 0 : -1, ref: ref }), children),
|
|
115
|
+
isOnline && react_1.default.createElement(AvatarOnlineBadge_1.default, null)));
|
|
116
|
+
};
|
|
117
|
+
exports.default = react_1.default.forwardRef(AvatarStandard);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const TextWrapper = styled_1.default.span `
|
|
20
|
+
font-size: 1.5em;
|
|
21
|
+
padding: 2px;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
left: 50%;
|
|
26
|
+
transform: translate(-50%, -50%);
|
|
27
|
+
position: relative;
|
|
28
|
+
user-select: none;
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: 50%;
|
|
31
|
+
`;
|
|
32
|
+
const AvatarTextWrapper = (props, ref) => {
|
|
33
|
+
const { children } = props, nativeProps = __rest(props, ["children"]);
|
|
34
|
+
return (react_1.default.createElement(TextWrapper, Object.assign({}, nativeProps, { ref: ref }), children));
|
|
35
|
+
};
|
|
36
|
+
exports.default = react_1.default.forwardRef(AvatarTextWrapper);
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AvatarStandardProps } from './AvatarStandard';
|
|
3
|
+
export type AvatarProps = AvatarStandardProps & {
|
|
4
|
+
/**
|
|
5
|
+
* Avatar style variant\
|
|
6
|
+
* Allowed variants: `circular`, 'rounded' or `square`\
|
|
7
|
+
* \
|
|
8
|
+
* **Default**: `circular`
|
|
9
|
+
*/
|
|
10
|
+
readonly variant?: 'circular' | 'rounded' | 'square';
|
|
11
|
+
/**
|
|
12
|
+
* Avatar size variant\
|
|
13
|
+
* \
|
|
14
|
+
* **Default**: `2.5em`
|
|
15
|
+
*/
|
|
16
|
+
readonly size?: string;
|
|
17
|
+
};
|
|
18
|
+
declare const _default: React.ForwardRefExoticComponent<import("./AvatarBase").AvatarBaseProps & {
|
|
19
|
+
/**
|
|
20
|
+
* Avatar style variant\
|
|
21
|
+
* Allowed variants: `circular`, 'rounded' or `square`\
|
|
22
|
+
* \
|
|
23
|
+
* **Default**: `circular`
|
|
24
|
+
*/
|
|
25
|
+
readonly variant?: "square" | "circular" | "rounded" | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Avatar size variant\
|
|
28
|
+
* \
|
|
29
|
+
* **Default**: `2.5em`
|
|
30
|
+
*/
|
|
31
|
+
readonly size?: string | undefined;
|
|
32
|
+
} & React.RefAttributes<HTMLSpanElement>>;
|
|
33
|
+
export default _default;
|
package/Avatar/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const AvatarStandard_1 = __importDefault(require("./AvatarStandard"));
|
|
8
|
+
//TODO add documentation
|
|
9
|
+
const Avatar = (props, ref) => (react_1.default.createElement(AvatarStandard_1.default, Object.assign({}, props, { ref: ref })));
|
|
10
|
+
exports.default = react_1.default.forwardRef(Avatar);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const Container = styled_1.default.div `
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: space-between;
|
|
22
|
+
align-items: center;
|
|
23
|
+
`;
|
|
24
|
+
const CalendarBottomBar = (props, ref) => {
|
|
25
|
+
const { children } = props, restProps = __rest(props, ["children"]);
|
|
26
|
+
return (react_1.default.createElement(Container, Object.assign({}, restProps, { ref: ref }), children));
|
|
27
|
+
};
|
|
28
|
+
exports.default = react_1.default.forwardRef(CalendarBottomBar);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface CalendarMonthControlProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
readonly displayIcon: 'prev' | 'next';
|
|
4
|
+
}
|
|
5
|
+
declare const _default: React.ForwardRefExoticComponent<CalendarMonthControlProps & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
const react_1 = __importDefault(require("react"));
|
|
18
|
+
const styled_1 = __importDefault(require("@emotion/styled"));
|
|
19
|
+
const react_2 = require("@emotion/react");
|
|
20
|
+
const Button_1 = __importDefault(require("../Button"));
|
|
21
|
+
const IconChevronLeft_1 = __importDefault(require("./IconChevronLeft"));
|
|
22
|
+
const IconChevronRight_1 = __importDefault(require("./IconChevronRight"));
|
|
23
|
+
const StyledButton = (0, styled_1.default)(Button_1.default) `
|
|
24
|
+
color: ${({ theme }) => theme.color.accentSecondaryContrast.toString()};
|
|
25
|
+
&:hover {
|
|
26
|
+
color: ${({ theme }) => theme.color.accentSecondaryContrast.alpha(0.5).toString()};
|
|
27
|
+
background-color: ${({ theme }) => theme.color.accentSecondary.lighten(10).toString()};
|
|
28
|
+
}
|
|
29
|
+
&:active {
|
|
30
|
+
color: ${({ theme }) => theme.color.accentSecondaryContrast.alpha(0.9).toString()};
|
|
31
|
+
}
|
|
32
|
+
${({ disabled }) => disabled &&
|
|
33
|
+
(0, react_2.css) `
|
|
34
|
+
opacity: 0.5;
|
|
35
|
+
`};
|
|
36
|
+
`;
|
|
37
|
+
const CalendarMonthControl = (props, ref) => {
|
|
38
|
+
const { displayIcon } = props, restProps = __rest(props, ["displayIcon"]);
|
|
39
|
+
return (react_1.default.createElement(StyledButton, Object.assign({ variant: "plain", iconOnly: true, type: "button" }, restProps, { ref: ref }), displayIcon === 'next' ? react_1.default.createElement(IconChevronRight_1.default, null) : react_1.default.createElement(IconChevronLeft_1.default, null)));
|
|
40
|
+
};
|
|
41
|
+
exports.default = react_1.default.forwardRef(CalendarMonthControl);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const IconChevronLeft = (props, ref) => (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", width: "1em", height: "1em", ref: ref }, props),
|
|
8
|
+
react_1.default.createElement("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 48, d: "M328 112 184 256l144 144" })));
|
|
9
|
+
exports.default = react_1.default.forwardRef(IconChevronLeft);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const IconShow = (props, ref) => (react_1.default.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", version: "1.1", width: "1em", height: "1em", viewBox: "0 0 512 512" }, props, { ref: ref }),
|
|
8
|
+
react_1.default.createElement("path", { d: "m105.79 160.82a24 24 0 0 0-10.76 6.2109 24 24 0 0 0 0 33.941l144 144a24.002 24.002 0 0 0 33.941 0l144-144a24 24 0 0 0 0-33.941 24 24 0 0 0-33.941 0l-127.03 127.03-127.03-127.03a24 24 0 0 0-23.182-6.2109z", fill: "currentColor" })));
|
|
9
|
+
exports.default = react_1.default.forwardRef(IconShow);
|