glints-aries 4.0.170 → 4.0.171

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,12 @@
1
+ import React from 'react';
2
+ declare const avatarBackgroundColorVariant: readonly ["supplementary", "warning", "danger", "success", "outstanding"];
3
+ declare const avatarSizeVariant: readonly ["large", "medium"];
4
+ export declare type AvatarBackgroundColorVariant = typeof avatarBackgroundColorVariant[number];
5
+ export declare type AvatarSizeVariant = typeof avatarSizeVariant[number];
6
+ export interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {
7
+ variant?: AvatarBackgroundColorVariant;
8
+ size?: AvatarSizeVariant;
9
+ initials?: string;
10
+ }
11
+ export declare const Avatar: ({ variant, size, initials, ...props }: AvatarProps) => JSX.Element;
12
+ export {};
@@ -0,0 +1,25 @@
1
+ import _extends from "@babel/runtime/helpers/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
3
+ var _excluded = ["variant", "size", "initials"];
4
+ import React from 'react';
5
+ import { Typography } from '../Typography';
6
+ import { Neutral } from '../utilities/colors';
7
+ import { AvatarStyle } from './AvatarStyle';
8
+ var avatarBackgroundColorVariant = ['supplementary', 'warning', 'danger', 'success', 'outstanding'];
9
+ var avatarSizeVariant = ['large', 'medium'];
10
+ export var Avatar = function Avatar(_ref) {
11
+ var _ref$variant = _ref.variant,
12
+ variant = _ref$variant === void 0 ? 'supplementary' : _ref$variant,
13
+ _ref$size = _ref.size,
14
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
15
+ initials = _ref.initials,
16
+ props = _objectWithoutPropertiesLoose(_ref, _excluded);
17
+ return /*#__PURE__*/React.createElement(AvatarStyle, _extends({
18
+ variant: variant,
19
+ size: size
20
+ }, props), /*#__PURE__*/React.createElement(Typography, {
21
+ variant: size === 'medium' ? 'body1' : 'headline6',
22
+ color: Neutral.B18,
23
+ as: 'span'
24
+ }, initials.slice(0, 2)));
25
+ };
@@ -0,0 +1,4 @@
1
+ import { Meta } from '@storybook/react';
2
+ declare const _default: Meta<import("@storybook/react").Args>;
3
+ export default _default;
4
+ export declare const Interactive: any;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { BaseContainer } from '../../Layout/GlintsContainer/GlintsContainer';
3
+ import { Avatar } from './Avatar';
4
+ export default {
5
+ title: '@next/Avatar',
6
+ component: Avatar,
7
+ decorators: [function (Story) {
8
+ return /*#__PURE__*/React.createElement(BaseContainer, null, Story());
9
+ }],
10
+ argTypes: {}
11
+ };
12
+ var Template = function Template(args) {
13
+ return /*#__PURE__*/React.createElement(Avatar, args);
14
+ };
15
+ export var Interactive = Template.bind({});
16
+ Interactive.args = {
17
+ initials: 'HE'
18
+ };
@@ -0,0 +1,2 @@
1
+ import { AvatarProps } from './Avatar';
2
+ export declare const AvatarStyle: import("styled-components").StyledComponent<"div", any, AvatarProps, never>;
@@ -0,0 +1,34 @@
1
+ var _avatarBackgroundColo, _avatarSizeVariant;
2
+ import styled from 'styled-components';
3
+ import * as Breakpoints from '../utilities/breakpoints';
4
+ import { Blue, Green, Neutral, Orange, Red } from '../utilities/colors';
5
+ var mediumAvatarSizeStyle = "\n width: 40px;\n height: 40px;\n \n @media (max-width: " + Breakpoints.large + ") {\n width: 32px;\n height: 32px;\n }\n";
6
+ var largeAvatarSizeStyle = "\n width: 60px;\n height: 60px;\n\n @media (max-width: " + Breakpoints.large + ") {\n width: 40px;\n height: 40px;\n }\n";
7
+ var avatarBackgroundColor = (_avatarBackgroundColo = {}, _avatarBackgroundColo['supplementary'] = Neutral.B99, _avatarBackgroundColo['warning'] = Orange.S42, _avatarBackgroundColo['danger'] = Red.B100, _avatarBackgroundColo['success'] = Green.B89, _avatarBackgroundColo['outstanding'] = Blue.S08, _avatarBackgroundColo);
8
+ var avatarSizeVariant = (_avatarSizeVariant = {}, _avatarSizeVariant['large'] = largeAvatarSizeStyle, _avatarSizeVariant['medium'] = mediumAvatarSizeStyle, _avatarSizeVariant);
9
+ var getAvatarBackgroundColor = function getAvatarBackgroundColor(variant) {
10
+ if (!(variant in avatarBackgroundColor)) {
11
+ console.warn(variant + " is not a valid variant for the background color, default will be used");
12
+ return avatarBackgroundColor['supplementary'];
13
+ }
14
+ return avatarBackgroundColor[variant];
15
+ };
16
+ var getAvatarSizeStyle = function getAvatarSizeStyle(sizeVariant) {
17
+ if (!(sizeVariant in avatarSizeVariant)) {
18
+ console.warn(sizeVariant + " is not a valid variant for the size, default will be used");
19
+ return avatarSizeVariant['medium'];
20
+ }
21
+ return avatarSizeVariant[sizeVariant];
22
+ };
23
+ export var AvatarStyle = styled.div.withConfig({
24
+ displayName: "AvatarStyle",
25
+ componentId: "sc-1ys0vpf-0"
26
+ })(["", "}", "}display:flex;align-items:center;justify-content:center;border-radius:50%;"], function (_ref) {
27
+ var size = _ref.size;
28
+ return getAvatarSizeStyle(size);
29
+ }, function (_ref2) {
30
+ var variant = _ref2.variant;
31
+ return {
32
+ 'background-color': getAvatarBackgroundColor(variant)
33
+ };
34
+ });
@@ -0,0 +1 @@
1
+ export * from './Avatar';
@@ -0,0 +1 @@
1
+ export * from './Avatar';
@@ -4,6 +4,7 @@ export { ButtonGroup } from './ButtonGroup';
4
4
  export { Icon } from './Icon';
5
5
  export { Tab, TabProps, Tabs, TabsProps } from './Tabs';
6
6
  export { Typography } from './Typography';
7
+ export { Avatar } from './Avatar';
7
8
  import * as BorderRadius from './utilities/borderRadius';
8
9
  import * as Breakpoints from './utilities/breakpoints';
9
10
  import * as Colors from './utilities/colors';
package/es/@next/index.js CHANGED
@@ -4,6 +4,7 @@ export { ButtonGroup } from './ButtonGroup';
4
4
  export { Icon } from './Icon';
5
5
  export { Tab, TabProps, Tabs, TabsProps } from './Tabs';
6
6
  export { Typography } from './Typography';
7
+ export { Avatar } from './Avatar';
7
8
 
8
9
  // Utilities
9
10
  import * as BorderRadius from './utilities/borderRadius';
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ declare const avatarBackgroundColorVariant: readonly ["supplementary", "warning", "danger", "success", "outstanding"];
3
+ declare const avatarSizeVariant: readonly ["large", "medium"];
4
+ export declare type AvatarBackgroundColorVariant = typeof avatarBackgroundColorVariant[number];
5
+ export declare type AvatarSizeVariant = typeof avatarSizeVariant[number];
6
+ export interface AvatarProps extends React.HTMLAttributes<HTMLDivElement> {
7
+ variant?: AvatarBackgroundColorVariant;
8
+ size?: AvatarSizeVariant;
9
+ initials?: string;
10
+ }
11
+ export declare const Avatar: ({ variant, size, initials, ...props }: AvatarProps) => JSX.Element;
12
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.Avatar = void 0;
6
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
7
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
8
+ var _react = _interopRequireDefault(require("react"));
9
+ var _Typography = require("../Typography");
10
+ var _colors = require("../utilities/colors");
11
+ var _AvatarStyle = require("./AvatarStyle");
12
+ var _excluded = ["variant", "size", "initials"];
13
+ var avatarBackgroundColorVariant = ['supplementary', 'warning', 'danger', 'success', 'outstanding'];
14
+ var avatarSizeVariant = ['large', 'medium'];
15
+ var Avatar = function Avatar(_ref) {
16
+ var _ref$variant = _ref.variant,
17
+ variant = _ref$variant === void 0 ? 'supplementary' : _ref$variant,
18
+ _ref$size = _ref.size,
19
+ size = _ref$size === void 0 ? 'medium' : _ref$size,
20
+ initials = _ref.initials,
21
+ props = (0, _objectWithoutPropertiesLoose2["default"])(_ref, _excluded);
22
+ return /*#__PURE__*/_react["default"].createElement(_AvatarStyle.AvatarStyle, (0, _extends2["default"])({
23
+ variant: variant,
24
+ size: size
25
+ }, props), /*#__PURE__*/_react["default"].createElement(_Typography.Typography, {
26
+ variant: size === 'medium' ? 'body1' : 'headline6',
27
+ color: _colors.Neutral.B18,
28
+ as: 'span'
29
+ }, initials.slice(0, 2)));
30
+ };
31
+ exports.Avatar = Avatar;
@@ -0,0 +1,4 @@
1
+ import { Meta } from '@storybook/react';
2
+ declare const _default: Meta<import("@storybook/react").Args>;
3
+ export default _default;
4
+ export declare const Interactive: any;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports["default"] = exports.Interactive = void 0;
6
+ var _react = _interopRequireDefault(require("react"));
7
+ var _GlintsContainer = require("../../Layout/GlintsContainer/GlintsContainer");
8
+ var _Avatar = require("./Avatar");
9
+ var _default = {
10
+ title: '@next/Avatar',
11
+ component: _Avatar.Avatar,
12
+ decorators: [function (Story) {
13
+ return /*#__PURE__*/_react["default"].createElement(_GlintsContainer.BaseContainer, null, Story());
14
+ }],
15
+ argTypes: {}
16
+ };
17
+ exports["default"] = _default;
18
+ var Template = function Template(args) {
19
+ return /*#__PURE__*/_react["default"].createElement(_Avatar.Avatar, args);
20
+ };
21
+ var Interactive = Template.bind({});
22
+ exports.Interactive = Interactive;
23
+ Interactive.args = {
24
+ initials: 'HE'
25
+ };
@@ -0,0 +1,2 @@
1
+ import { AvatarProps } from './Avatar';
2
+ export declare const AvatarStyle: import("styled-components").StyledComponent<"div", any, AvatarProps, never>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ exports.__esModule = true;
5
+ exports.AvatarStyle = void 0;
6
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
7
+ var Breakpoints = _interopRequireWildcard(require("../utilities/breakpoints"));
8
+ var _colors = require("../utilities/colors");
9
+ var _avatarBackgroundColo, _avatarSizeVariant;
10
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
+ var mediumAvatarSizeStyle = "\n width: 40px;\n height: 40px;\n \n @media (max-width: " + Breakpoints.large + ") {\n width: 32px;\n height: 32px;\n }\n";
13
+ var largeAvatarSizeStyle = "\n width: 60px;\n height: 60px;\n\n @media (max-width: " + Breakpoints.large + ") {\n width: 40px;\n height: 40px;\n }\n";
14
+ var avatarBackgroundColor = (_avatarBackgroundColo = {}, _avatarBackgroundColo['supplementary'] = _colors.Neutral.B99, _avatarBackgroundColo['warning'] = _colors.Orange.S42, _avatarBackgroundColo['danger'] = _colors.Red.B100, _avatarBackgroundColo['success'] = _colors.Green.B89, _avatarBackgroundColo['outstanding'] = _colors.Blue.S08, _avatarBackgroundColo);
15
+ var avatarSizeVariant = (_avatarSizeVariant = {}, _avatarSizeVariant['large'] = largeAvatarSizeStyle, _avatarSizeVariant['medium'] = mediumAvatarSizeStyle, _avatarSizeVariant);
16
+ var getAvatarBackgroundColor = function getAvatarBackgroundColor(variant) {
17
+ if (!(variant in avatarBackgroundColor)) {
18
+ console.warn(variant + " is not a valid variant for the background color, default will be used");
19
+ return avatarBackgroundColor['supplementary'];
20
+ }
21
+ return avatarBackgroundColor[variant];
22
+ };
23
+ var getAvatarSizeStyle = function getAvatarSizeStyle(sizeVariant) {
24
+ if (!(sizeVariant in avatarSizeVariant)) {
25
+ console.warn(sizeVariant + " is not a valid variant for the size, default will be used");
26
+ return avatarSizeVariant['medium'];
27
+ }
28
+ return avatarSizeVariant[sizeVariant];
29
+ };
30
+ var AvatarStyle = _styledComponents["default"].div.withConfig({
31
+ displayName: "AvatarStyle",
32
+ componentId: "sc-1ys0vpf-0"
33
+ })(["", "}", "}display:flex;align-items:center;justify-content:center;border-radius:50%;"], function (_ref) {
34
+ var size = _ref.size;
35
+ return getAvatarSizeStyle(size);
36
+ }, function (_ref2) {
37
+ var variant = _ref2.variant;
38
+ return {
39
+ 'background-color': getAvatarBackgroundColor(variant)
40
+ };
41
+ });
42
+ exports.AvatarStyle = AvatarStyle;
@@ -0,0 +1 @@
1
+ export * from './Avatar';
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ var _Avatar = require("./Avatar");
5
+ Object.keys(_Avatar).forEach(function (key) {
6
+ if (key === "default" || key === "__esModule") return;
7
+ if (key in exports && exports[key] === _Avatar[key]) return;
8
+ exports[key] = _Avatar[key];
9
+ });
@@ -4,6 +4,7 @@ export { ButtonGroup } from './ButtonGroup';
4
4
  export { Icon } from './Icon';
5
5
  export { Tab, TabProps, Tabs, TabsProps } from './Tabs';
6
6
  export { Typography } from './Typography';
7
+ export { Avatar } from './Avatar';
7
8
  import * as BorderRadius from './utilities/borderRadius';
8
9
  import * as Breakpoints from './utilities/breakpoints';
9
10
  import * as Colors from './utilities/colors';
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  exports.__esModule = true;
4
- exports.Typography = exports.TabsProps = exports.Tabs = exports.TabProps = exports.Tab = exports.Spacing = exports.PrimaryButton = exports.OutlineMonochromeButton = exports.OutlineButton = exports.Icon = exports.Fonts = exports.DropShadow = exports.DestructiveButton = exports.Colors = exports.ButtonGroup = exports.Button = exports.Breakpoints = exports.BorderRadius = exports.Badge = void 0;
4
+ exports.Typography = exports.TabsProps = exports.Tabs = exports.TabProps = exports.Tab = exports.Spacing = exports.PrimaryButton = exports.OutlineMonochromeButton = exports.OutlineButton = exports.Icon = exports.Fonts = exports.DropShadow = exports.DestructiveButton = exports.Colors = exports.ButtonGroup = exports.Button = exports.Breakpoints = exports.BorderRadius = exports.Badge = exports.Avatar = void 0;
5
5
  var _Badge = require("./Badge");
6
6
  exports.Badge = _Badge.Badge;
7
7
  var _Button = require("./Button");
@@ -21,6 +21,8 @@ exports.Tabs = _Tabs.Tabs;
21
21
  exports.TabsProps = _Tabs.TabsProps;
22
22
  var _Typography = require("./Typography");
23
23
  exports.Typography = _Typography.Typography;
24
+ var _Avatar = require("./Avatar");
25
+ exports.Avatar = _Avatar.Avatar;
24
26
  var BorderRadius = _interopRequireWildcard(require("./utilities/borderRadius"));
25
27
  exports.BorderRadius = BorderRadius;
26
28
  var Breakpoints = _interopRequireWildcard(require("./utilities/breakpoints"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "glints-aries",
3
- "version": "4.0.170",
3
+ "version": "4.0.171",
4
4
  "description": "Glints ui-kit for frontend",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./es/index.js",