@via-profit/ui-kit 0.1.0-rc.65 → 0.1.0-rc.67

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.
@@ -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,4 @@
1
+ import React from 'react';
2
+ export type AvatarIconWrapperProps = React.HTMLAttributes<HTMLSpanElement>;
3
+ declare const _default: React.ForwardRefExoticComponent<AvatarIconWrapperProps & React.RefAttributes<HTMLSpanElement>>;
4
+ export default _default;
@@ -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,4 @@
1
+ import React from 'react';
2
+ export type AvatarOnlineBadgeProps = React.HTMLAttributes<HTMLSpanElement>;
3
+ declare const _default: React.ForwardRefExoticComponent<AvatarOnlineBadgeProps & React.RefAttributes<HTMLSpanElement>>;
4
+ export default _default;
@@ -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,5 @@
1
+ import React from 'react';
2
+ import { AvatarBaseProps } from './AvatarBase';
3
+ export type AvatarStandardProps = AvatarBaseProps;
4
+ declare const _default: React.ForwardRefExoticComponent<AvatarBaseProps & React.RefAttributes<HTMLSpanElement>>;
5
+ export default _default;
@@ -0,0 +1,119 @@
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
+ width: ${({ size }) => (size ? size : '2.5em')};
26
+ height: ${({ size }) => (size ? size : '2.5em')};
27
+ `;
28
+ const StyledStandardAvatar = (0, styled_1.default)(AvatarBase_1.default) `
29
+ color: ${({ $color }) => $color.toString()};
30
+ background-color: ${({ $background }) => $background.toString()};
31
+ ${({ $background }) => {
32
+ switch (true) {
33
+ case $background.luminance() > 0.49:
34
+ return $background.darken(40).alpha(0.8).toString();
35
+ default:
36
+ return $background.darken(20).alpha(0.5).toString();
37
+ }
38
+ }};
39
+ &:hover {
40
+ background-color: ${({ $background, $clickable }) => $clickable && $background.darken(30).toString()};
41
+ }
42
+ &:focus-visible {
43
+ outline-color: ${({ theme, $background }) => $background.rgbString() === theme.color.accentPrimary.rgbString()
44
+ ? theme.color.textPrimary.toString()
45
+ : theme.color.accentPrimary.toString()};
46
+ }
47
+ ${({ $clickable }) => $clickable &&
48
+ (0, react_2.css) `
49
+ cursor: pointer;
50
+ `}
51
+
52
+ ${({ variant, theme }) => {
53
+ switch (variant) {
54
+ case 'rounded':
55
+ return (0, react_2.css) `
56
+ border-radius: ${theme.shape.radiusFactor * 0.8}em;
57
+ `;
58
+ case 'square':
59
+ return (0, react_2.css) `
60
+ border-radius: inherit;
61
+ `;
62
+ default:
63
+ return (0, react_2.css) `
64
+ border-radius: 100%;
65
+ `;
66
+ }
67
+ }}
68
+ `;
69
+ const AvatarStandard = (props, ref) => {
70
+ const { children, color, onClick, isOnline, size } = props, restProps = __rest(props, ["children", "color", "onClick", "isOnline", "size"]);
71
+ const theme = (0, react_2.useTheme)();
72
+ const clickable = react_1.default.useMemo(() => typeof onClick === 'function', [onClick]);
73
+ const { $background, $color } = react_1.default.useMemo(() => {
74
+ switch (true) {
75
+ case color === 'primary':
76
+ return {
77
+ $color: theme.color.accentPrimaryContrast,
78
+ $background: theme.color.accentPrimary,
79
+ };
80
+ case color === 'secondary':
81
+ return {
82
+ $color: theme.color.accentSecondaryContrast,
83
+ $background: theme.color.accentSecondary,
84
+ };
85
+ case typeof color === 'undefined':
86
+ case color === 'default':
87
+ return {
88
+ $background: theme.color.surface.darken(10),
89
+ $color: theme.color.textPrimary,
90
+ };
91
+ case typeof color === 'string': {
92
+ let $background = theme.color.surface;
93
+ try {
94
+ if (color) {
95
+ $background = new Color_1.default(color);
96
+ }
97
+ }
98
+ catch (err) {
99
+ console.error(`invalid color value «${color}»`);
100
+ }
101
+ return {
102
+ $background,
103
+ $color: $background.contrast(theme.color.textPrimary) > 5
104
+ ? theme.color.textPrimary
105
+ : theme.color.surface,
106
+ };
107
+ }
108
+ default:
109
+ return {
110
+ $background: theme.color.surface,
111
+ $color: theme.color.textPrimary,
112
+ };
113
+ }
114
+ }, [color, theme.color]);
115
+ return (react_1.default.createElement(Container, null,
116
+ 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),
117
+ isOnline && react_1.default.createElement(AvatarOnlineBadge_1.default, null)));
118
+ };
119
+ exports.default = react_1.default.forwardRef(AvatarStandard);
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export type AvatarTextWrapperProps = React.HTMLAttributes<HTMLSpanElement>;
3
+ declare const _default: React.ForwardRefExoticComponent<AvatarTextWrapperProps & React.RefAttributes<HTMLSpanElement>>;
4
+ export default _default;
@@ -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;
@@ -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 AvatarStandard_1 = __importDefault(require("./AvatarStandard"));
8
+ const Avatar = (props, ref) => (react_1.default.createElement(AvatarStandard_1.default, Object.assign({}, props, { ref: ref })));
9
+ exports.default = react_1.default.forwardRef(Avatar);
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export type CalendarBottomBarProps = React.HTMLAttributes<HTMLDivElement>;
3
+ declare const _default: React.ForwardRefExoticComponent<CalendarBottomBarProps & React.RefAttributes<HTMLDivElement>>;
4
+ export default _default;
@@ -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);
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  declare const _default: React.NamedExoticComponent<{
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
- as?: React.ElementType<any> | undefined;
4
+ as?: React.ElementType<any, keyof React.JSX.IntrinsicElements> | undefined;
5
5
  } & React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement>>;
6
6
  export default _default;
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
3
+ export default _default;
@@ -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);
@@ -15,8 +15,8 @@ const US_1 = __importDefault(require("../CountryFlags/US"));
15
15
  const IL_1 = __importDefault(require("../CountryFlags/IL"));
16
16
  exports.templates = [
17
17
  // Russian template
18
- ['RU', react_1.default.createElement(RU_1.default, { key: "ru-1" }), '7', '+x (xxx) xxx-xx-xx', '+7 (987) 654-32-10', /^\+$/],
19
- ['RU', react_1.default.createElement(RU_1.default, { key: "ru-2" }), '7', '8 (xxx) xxx-xx-xx', '8 (987) 654-32-10', /^8[^1]{0,}/],
18
+ ['RU', react_1.default.createElement(RU_1.default, { key: "ru-1" }), '7', '+x (xxx) xxx-xx-xx', '+7 (987) 654-32-10', /^\+$/], // must be at first (Default RU)
19
+ ['RU', react_1.default.createElement(RU_1.default, { key: "ru-2" }), '7', '8 (xxx) xxx-xx-xx', '8 (987) 654-32-10', /^8[^1]{0,}/], // 8912...
20
20
  [
21
21
  'RU',
22
22
  react_1.default.createElement(RU_1.default, { key: "ru-3" }),
@@ -24,7 +24,7 @@ exports.templates = [
24
24
  '+7 (xxx) xxx-xx-xx',
25
25
  '+7 (987) 654-32-10',
26
26
  /^\+{0,1}7([0-5]|[8-9])[0-9][0-9]/,
27
- ],
27
+ ], // +79...
28
28
  // Other fucking countries
29
29
  ['BY', react_1.default.createElement(BY_1.default, { key: "by" }), '375', '+375 (xx) xxx-xx-xx', '+375 (98) 765-43-21', /^\+{0,1}375/],
30
30
  ['KZ', react_1.default.createElement(KZ_1.default, { key: "kz-1" }), '7', '+997 (xx) xxx-xx-xx', '+997 (98) 765-43-21', /^\+{0,1}997/],
@@ -35,7 +35,7 @@ exports.templates = [
35
35
  '+7 (xxx) xxx-xx-xx',
36
36
  '+7 (600) 765-43-21',
37
37
  /^\+{0,1}7[6-7][0-9][0-9]/,
38
- ],
38
+ ], // +7600 - +7700
39
39
  ['UA', react_1.default.createElement(UA_1.default, { key: "ua" }), '380', '+380 (xx) xxx-xxxx', '+380 (98) 765-4321', /^\+{0,1}380/],
40
40
  ['JP', react_1.default.createElement(JP_1.default, { key: "jp" }), '81', '+81 (xx) xxx-xxxx', '+81 (98) 765-4321', /^\+{0,1}81/],
41
41
  ['US', react_1.default.createElement(US_1.default, { key: "us" }), '1', '+1 xxx xxx-xx-xx', '+1 987 654-32-10', /^\+{0,1}1/],
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const _default: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
3
+ export default _default;
@@ -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);
package/Table/Table.js CHANGED
@@ -37,6 +37,61 @@ const StyledTable = styled_1.default.table `
37
37
  (0, react_2.css) `
38
38
  width: 100%;
39
39
  `};
40
+
41
+ @media only screen and (max-width: 1200px) {
42
+ /* Force table to not be like tables anymore */
43
+ table,
44
+ thead,
45
+ tbody,
46
+ th,
47
+ td,
48
+ tr {
49
+ display: block;
50
+ }
51
+
52
+ /* Hide table headers (but not display: none;, for accessibility) */
53
+ thead tr {
54
+ position: absolute;
55
+ top: -9999px;
56
+ left: -9999px;
57
+ }
58
+
59
+ tr {
60
+ margin: 0 0 1rem 0;
61
+ background: ${({ theme }) => theme.color.surface.toString()};
62
+ }
63
+
64
+ tr:nth-of-type(odd) {
65
+ background: ${({ theme }) => theme.color.surface.darken(30).toString()};
66
+ }
67
+
68
+ td {
69
+ /* Behave like a "row" */
70
+ border: none;
71
+ border-bottom: 1px solid
72
+ ${({ theme }) => theme.color.surface.darken(20).alpha(0.8).toString()};
73
+ position: relative;
74
+ padding-left: 50%;
75
+ text-align: left !important;
76
+ }
77
+
78
+ tr:nth-of-type(odd) td {
79
+ border-bottom: 1px solid
80
+ ${({ theme }) => theme.color.surface.darken(50).alpha(0.8).toString()};
81
+ }
82
+
83
+ td:before {
84
+ /* Now like a table header */
85
+ position: absolute;
86
+ /* Top/left values mimic padding */
87
+ top: 50%;
88
+ transform: translateY(-50%);
89
+ left: 1em;
90
+ width: 45%;
91
+ padding-right: 1em;
92
+ white-space: nowrap;
93
+ }
94
+ }
40
95
  `;
41
96
  const Table = (props, ref) => {
42
97
  const { children, fullWidth } = props, nativeProps = __rest(props, ["children", "fullWidth"]);
@@ -5,6 +5,6 @@
5
5
  */
6
6
  declare const Base: import("@emotion/styled").StyledComponent<{
7
7
  theme?: import("@emotion/react").Theme | undefined;
8
- as?: import("react").ElementType<any> | undefined;
8
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
9
9
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, {}>;
10
10
  export default Base;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  declare const Blockquote: import("@emotion/styled").StyledComponent<{
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any> | undefined;
4
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
5
  }, import("react").DetailedHTMLProps<import("react").BlockquoteHTMLAttributes<HTMLQuoteElement>, HTMLQuoteElement>, {}>;
6
6
  export default Blockquote;
@@ -1,14 +1,14 @@
1
1
  /// <reference types="react" />
2
2
  export declare const Ul: import("@emotion/styled").StyledComponent<{
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any> | undefined;
4
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLUListElement>, HTMLUListElement>, {}>;
6
6
  export declare const Ol: import("@emotion/styled").StyledComponent<{
7
7
  theme?: import("@emotion/react").Theme | undefined;
8
- as?: import("react").ElementType<any> | undefined;
8
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
9
9
  }, import("react").DetailedHTMLProps<import("react").OlHTMLAttributes<HTMLOListElement>, HTMLOListElement>, {}>;
10
10
  export declare const Li: import("@emotion/styled").StyledComponent<{
11
11
  theme?: import("@emotion/react").Theme | undefined;
12
- as?: import("react").ElementType<any> | undefined;
12
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
13
13
  }, import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, {}>;
14
14
  export default Ul;
package/Typography/U.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  declare const U: import("@emotion/styled").StyledComponent<{
3
3
  theme?: import("@emotion/react").Theme | undefined;
4
- as?: import("react").ElementType<any> | undefined;
4
+ as?: import("react").ElementType<any, keyof import("react").JSX.IntrinsicElements> | undefined;
5
5
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, {}>;
6
6
  export default U;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@via-profit/ui-kit",
3
- "version": "0.1.0-rc.65",
3
+ "version": "0.1.0-rc.67",
4
4
  "description": "UI Kit",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,71 +28,71 @@
28
28
  "react-dom": "^18.2.0"
29
29
  },
30
30
  "devDependencies": {
31
- "@babel/cli": "^7.23.0",
32
- "@babel/core": "^7.23.2",
31
+ "@babel/cli": "^7.23.4",
32
+ "@babel/core": "^7.23.6",
33
33
  "@babel/plugin-proposal-class-properties": "^7.18.6",
34
34
  "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6",
35
35
  "@babel/plugin-proposal-optional-chaining": "^7.21.0",
36
36
  "@babel/plugin-syntax-dynamic-import": "^7.8.3",
37
- "@babel/plugin-transform-runtime": "^7.23.2",
38
- "@babel/plugin-transform-typescript": "^7.22.15",
39
- "@babel/preset-env": "^7.23.2",
40
- "@babel/preset-react": "^7.22.15",
41
- "@babel/preset-typescript": "^7.23.2",
42
- "@babel/runtime": "^7.23.2",
37
+ "@babel/plugin-transform-runtime": "^7.23.6",
38
+ "@babel/plugin-transform-typescript": "^7.23.6",
39
+ "@babel/preset-env": "^7.23.6",
40
+ "@babel/preset-react": "^7.23.3",
41
+ "@babel/preset-typescript": "^7.23.3",
42
+ "@babel/runtime": "^7.23.6",
43
43
  "@emotion/babel-plugin": "^11.11.0",
44
- "@emotion/react": "^11.11.1",
44
+ "@emotion/react": "^11.11.3",
45
45
  "@emotion/styled": "^11.11.0",
46
46
  "@loadable/babel-plugin": "^5.16.1",
47
47
  "@loadable/webpack-plugin": "^5.15.2",
48
48
  "@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
49
- "@types/node": "^20.8.10",
50
- "@types/nodemon": "^1.19.4",
51
- "@types/react": "^18.2.34",
52
- "@types/react-dom": "^18.2.14",
53
- "@types/react-slick": "^0.23.11",
54
- "@types/webpack-bundle-analyzer": "^4.6.2",
55
- "@types/webpack-env": "^1.18.3",
56
- "@typescript-eslint/eslint-plugin": "^6.9.1",
57
- "@typescript-eslint/parser": "^6.9.1",
49
+ "@types/node": "^20.10.5",
50
+ "@types/nodemon": "^1.19.6",
51
+ "@types/react": "^18.2.45",
52
+ "@types/react-dom": "^18.2.18",
53
+ "@types/react-slick": "^0.23.13",
54
+ "@types/webpack-bundle-analyzer": "^4.6.3",
55
+ "@types/webpack-env": "^1.18.4",
56
+ "@typescript-eslint/eslint-plugin": "^6.16.0",
57
+ "@typescript-eslint/parser": "^6.16.0",
58
58
  "babel-loader": "^9.1.3",
59
59
  "concurrently": "^8.2.2",
60
60
  "cross-env": "^7.0.3",
61
61
  "dotenv": "^16.3.1",
62
- "eslint": "^8.52.0",
63
- "eslint-config-prettier": "^9.0.0",
62
+ "eslint": "^8.56.0",
63
+ "eslint-config-prettier": "^9.1.0",
64
64
  "eslint-import-resolver-alias": "^1.1.2",
65
65
  "eslint-import-resolver-node": "^0.3.9",
66
66
  "eslint-import-resolver-webpack": "^0.13.8",
67
67
  "eslint-plugin-file-progress": "^1.3.0",
68
- "eslint-plugin-formatjs": "^4.11.0",
69
- "eslint-plugin-import": "^2.29.0",
68
+ "eslint-plugin-formatjs": "^4.11.3",
69
+ "eslint-plugin-import": "^2.29.1",
70
70
  "eslint-plugin-jsx-a11y": "^6.8.0",
71
71
  "eslint-plugin-node": "^11.1.0",
72
- "eslint-plugin-prettier": "^5.0.1",
72
+ "eslint-plugin-prettier": "^5.1.2",
73
73
  "eslint-plugin-promise": "^6.1.1",
74
74
  "eslint-plugin-react": "^7.33.2",
75
75
  "eslint-plugin-react-hooks": "^4.6.0",
76
76
  "html-loader": "^4.2.0",
77
- "html-webpack-plugin": "^5.5.3",
78
- "nodemon": "^3.0.1",
77
+ "html-webpack-plugin": "^5.6.0",
78
+ "nodemon": "^3.0.2",
79
79
  "nodemon-webpack-plugin": "^4.8.2",
80
80
  "npm-run-all": "^4.1.5",
81
- "prettier": "^3.0.3",
81
+ "prettier": "^3.1.1",
82
82
  "raw-loader": "^4.0.2",
83
83
  "react": "^18.2.0",
84
84
  "react-dom": "^18.2.0",
85
85
  "react-refresh": "^0.14.0",
86
- "react-router-dom": "^6.18.0",
86
+ "react-router-dom": "^6.21.1",
87
87
  "react-test-renderer": "^18.2.0",
88
88
  "shebang-loader": "^0.0.1",
89
89
  "terser-webpack-plugin": "^5.3.9",
90
- "ts-node": "^10.9.1",
91
- "type-fest": "^4.6.0",
92
- "typescript": "^5.2.2",
90
+ "ts-node": "^10.9.2",
91
+ "type-fest": "^4.8.3",
92
+ "typescript": "^5.3.3",
93
93
  "url-loader": "^4.1.1",
94
94
  "webpack": "^5.89.0",
95
- "webpack-bundle-analyzer": "^4.9.1",
95
+ "webpack-bundle-analyzer": "^4.10.1",
96
96
  "webpack-cli": "^5.1.4",
97
97
  "webpack-dev-server": "^4.15.1"
98
98
  }