@teamturing/react-kit 2.46.5 → 2.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -66,6 +66,6 @@ const BaseAvatar = styled(Image)`
66
66
 
67
67
  ${sx}
68
68
  `;
69
- var index = /*#__PURE__*/forwardRef(Avatar);
69
+ var Avatar$1 = /*#__PURE__*/forwardRef(Avatar);
70
70
 
71
- export { index as default };
71
+ export { Avatar$1 as default };
@@ -0,0 +1,29 @@
1
+ import { forwardRef } from 'react';
2
+ import styled from 'styled-components';
3
+ import Avatar from '../Avatar/index.js';
4
+ import Tooltip from '../Tooltip/index.js';
5
+ import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
6
+
7
+ const AvatarGroupItem = ({
8
+ onClick,
9
+ ...props
10
+ }, ref) => /*#__PURE__*/jsxRuntimeExports.jsx(BaseAvatarGroupItem, {
11
+ onClick: onClick,
12
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(Tooltip, {
13
+ text: props.alt,
14
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(Avatar, {
15
+ ref: ref,
16
+ size: 's',
17
+ ...props
18
+ })
19
+ })
20
+ });
21
+ const BaseAvatarGroupItem = styled.li`
22
+ display: inline-flex;
23
+ list-style: none;
24
+ padding: 0;
25
+ margin: 0;
26
+ `;
27
+ var AvatarGroupItem$1 = /*#__PURE__*/forwardRef(AvatarGroupItem);
28
+
29
+ export { AvatarGroupItem$1 as default };
@@ -0,0 +1,128 @@
1
+ import { forcePixelValue } from '../../packages/utils/esm/forcePixelValue.js';
2
+ import React__default, { forwardRef } from 'react';
3
+ import styled from 'styled-components';
4
+ import { sx } from '../../utils/styled-system/index.js';
5
+ import Avatar from '../Avatar/index.js';
6
+ import Overlay from '../Overlay/index.js';
7
+ import OverlayPopper from '../OverlayPopper/index.js';
8
+ import Space from '../Space/index.js';
9
+ import Text from '../Text/index.js';
10
+ import View from '../View/index.js';
11
+ import UnstyledButton from '../_UnstyledButton.js';
12
+ import AvatarGroupItem from './AvatarGroupItem.js';
13
+ import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
14
+
15
+ const AvatarGroup = ({
16
+ children: propChildren,
17
+ maxItemCount = 5,
18
+ ...props
19
+ }, ref) => {
20
+ const childrenArray = React__default.Children.toArray(propChildren);
21
+ const isOverflown = childrenArray.length > maxItemCount;
22
+ return /*#__PURE__*/jsxRuntimeExports.jsxs(AvatarGroupWrapper, {
23
+ ref: ref,
24
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(BaseAvatarGroup, {
25
+ ...props,
26
+ children: [...childrenArray.slice(0, maxItemCount)].reverse()
27
+ }), isOverflown ? /*#__PURE__*/jsxRuntimeExports.jsx(OverlayPopper, {
28
+ placement: 'bottom',
29
+ renderOverlay: overlayProps => {
30
+ return /*#__PURE__*/jsxRuntimeExports.jsx(Overlay, {
31
+ size: 's',
32
+ maxHeight: 300,
33
+ sx: {
34
+ overflow: 'auto'
35
+ },
36
+ onClick: e => e.stopPropagation(),
37
+ ...overlayProps,
38
+ children: /*#__PURE__*/jsxRuntimeExports.jsx(Space, {
39
+ px: 1,
40
+ py: 2,
41
+ children: childrenArray.slice(maxItemCount).map(({
42
+ key,
43
+ props
44
+ }) => /*#__PURE__*/jsxRuntimeExports.jsxs(View, {
45
+ sx: {
46
+ p: 3,
47
+ display: 'flex',
48
+ alignItems: 'center',
49
+ columnGap: 2
50
+ },
51
+ children: [/*#__PURE__*/jsxRuntimeExports.jsx(Avatar, {
52
+ size: 'xs',
53
+ src: props.src,
54
+ alt: props.alt
55
+ }), /*#__PURE__*/jsxRuntimeExports.jsx(Text, {
56
+ typography: 'xs',
57
+ color: 'text/neutral',
58
+ children: props.alt
59
+ })]
60
+ }, key))
61
+ })
62
+ });
63
+ },
64
+ children: popperProps => /*#__PURE__*/jsxRuntimeExports.jsxs(UnstyledButton, {
65
+ ...popperProps,
66
+ onClick: e => {
67
+ e.stopPropagation();
68
+ popperProps.onClick?.(e);
69
+ },
70
+ sx: {
71
+ 'p': 0.5,
72
+ 'fontSize': 'xxs',
73
+ 'fontWeight': 'medium',
74
+ 'color': 'text/neutral/subtle',
75
+ 'borderRadius': 'xxs',
76
+ '&:hover': {
77
+ backgroundColor: 'bg/neutral/subtlest/hovered'
78
+ }
79
+ },
80
+ children: ["+", childrenArray.length - maxItemCount]
81
+ })
82
+ }) : null]
83
+ });
84
+ };
85
+ const AvatarGroupWrapper = styled.div`
86
+ display: inline-flex;
87
+ align-items: center;
88
+ column-gap: ${({
89
+ theme
90
+ }) => forcePixelValue(theme.space[1])};
91
+ `;
92
+ const BaseAvatarGroup = styled.ol`
93
+ list-style: none;
94
+ padding: 0;
95
+ margin: 0;
96
+
97
+ display: inline-flex;
98
+ flex-direction: row-reverse;
99
+ align-items: center;
100
+
101
+ & > * {
102
+ position: relative;
103
+ background-color: ${({
104
+ theme
105
+ }) => theme.colors['border/neutral/subtle']};
106
+ padding: ${({
107
+ theme
108
+ }) => forcePixelValue(theme.space['0.25'])};
109
+ border-radius: ${({
110
+ theme
111
+ }) => forcePixelValue(theme.radii.full)};
112
+
113
+ margin-left: ${({
114
+ theme
115
+ }) => forcePixelValue(theme.space[-1])};
116
+
117
+ &:last-child {
118
+ margin-left: 0;
119
+ }
120
+ }
121
+
122
+ ${sx}
123
+ `;
124
+ var index = Object.assign( /*#__PURE__*/forwardRef(AvatarGroup), {
125
+ Item: AvatarGroupItem
126
+ });
127
+
128
+ export { index as default };
@@ -14,6 +14,7 @@ const FormControlTooltipIcon = ({
14
14
  }) => /*#__PURE__*/jsxRuntimeExports.jsx(Tooltip, {
15
15
  text: text,
16
16
  direction: direction,
17
+ mouseOnly: false,
17
18
  children: /*#__PURE__*/jsxRuntimeExports.jsx(StyledIcon, {
18
19
  icon: icon,
19
20
  size: size,
package/esm/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  export { default as UnstyledTable } from './core/_UnstyledTable/index.js';
2
2
  export { default as ActionList } from './core/ActionList/index.js';
3
3
  export { default as Avatar } from './core/Avatar/index.js';
4
+ export { default as AvatarGroup } from './core/AvatarGroup/index.js';
4
5
  export { default as BadgeAttacher } from './core/BadgeAttacher/index.js';
5
6
  export { default as Breadcrumbs } from './core/Breadcrumbs/index.js';
6
7
  export { default as Button } from './core/Button/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamturing/react-kit",
3
- "version": "2.46.5",
3
+ "version": "2.47.0",
4
4
  "description": "React components, hooks for create teamturing web application",
5
5
  "author": "Sungchang Park <psch300@gmail.com> (https://github.com/psch300)",
6
6
  "homepage": "https://github.com/weareteamturing/bombe#readme",
@@ -66,5 +66,5 @@
66
66
  "react-textarea-autosize": "^8.5.3",
67
67
  "styled-system": "^5.1.5"
68
68
  },
69
- "gitHead": "fc093fecce517059d071cf41c0993cfafe8e2f90"
69
+ "gitHead": "e32009b5d122928a1b9dc24800de22aa3b39344c"
70
70
  }