@teamturing/react-kit 2.19.2 → 2.19.3
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/dist/core/BadgeAttacher/index.d.ts +8 -0
- package/dist/core/CounterBadge/index.d.ts +17 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +75 -0
- package/esm/core/BadgeAttacher/index.js +27 -0
- package/esm/core/CounterBadge/index.js +59 -0
- package/esm/index.js +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HTMLAttributes, PropsWithChildren, ReactNode } from 'react';
|
|
2
|
+
import { SxProp } from '../../utils/styled-system';
|
|
3
|
+
type Props = {
|
|
4
|
+
renderBadge: (badgeProps: Pick<HTMLAttributes<HTMLElement>, 'style'>) => ReactNode;
|
|
5
|
+
} & SxProp;
|
|
6
|
+
declare const BadgeAttacher: ({ children, renderBadge, ...props }: PropsWithChildren<Props>) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export default BadgeAttacher;
|
|
8
|
+
export type { Props as BadgeAttacherProps };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
import { ResponsiveValue } from 'styled-system';
|
|
3
|
+
import { SxProp } from '../../utils/styled-system';
|
|
4
|
+
type CounterBadgeVariantType = 'red';
|
|
5
|
+
type CounterBadgeSizeType = 'm';
|
|
6
|
+
type Props = {
|
|
7
|
+
variant?: ResponsiveValue<CounterBadgeVariantType>;
|
|
8
|
+
size?: ResponsiveValue<CounterBadgeSizeType>;
|
|
9
|
+
/**
|
|
10
|
+
* maxCounter보다 큰 숫자가 children에 명시되면, {maxCounter+} 형식으로 표기됩니다.
|
|
11
|
+
*/
|
|
12
|
+
maxCounter?: number;
|
|
13
|
+
children?: string | number;
|
|
14
|
+
} & SxProp & Pick<HTMLAttributes<HTMLSpanElement>, 'style'>;
|
|
15
|
+
declare const CounterBadge: ({ variant, size, children: propChildren, maxCounter, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export default CounterBadge;
|
|
17
|
+
export type { Props as CounterBadgeProps };
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export { default as AnimatePresence } from './core/AnimatePresence';
|
|
|
7
7
|
export type { AnimatePresenceProps } from './core/AnimatePresence';
|
|
8
8
|
export { default as Avatar } from './core/Avatar';
|
|
9
9
|
export type { AvatarProps } from './core/Avatar';
|
|
10
|
+
export { default as BadgeAttacher } from './core/BadgeAttacher';
|
|
11
|
+
export type { BadgeAttacherProps } from './core/BadgeAttacher';
|
|
10
12
|
export { default as Breadcrumbs } from './core/Breadcrumbs';
|
|
11
13
|
export type { BreadcrumbsProps } from './core/Breadcrumbs';
|
|
12
14
|
export { default as Button } from './core/Button';
|
|
@@ -15,6 +17,8 @@ export { default as Checkbox } from './core/Checkbox';
|
|
|
15
17
|
export type { CheckboxProps } from './core/Checkbox';
|
|
16
18
|
export { default as Chip } from './core/Chip';
|
|
17
19
|
export type { ChipProps } from './core/Chip';
|
|
20
|
+
export { default as CounterBadge } from './core/CounterBadge';
|
|
21
|
+
export type { CounterBadgeProps } from './core/CounterBadge';
|
|
18
22
|
export { default as Datagrid } from './core/Datagrid';
|
|
19
23
|
export type { DatagridProps, DatagridBodyProps, DatagridCellProps, DatagridHeaderProps, DatagridRowProps, } from './core/Datagrid';
|
|
20
24
|
export { default as DescriptionList } from './core/DescriptionList';
|
package/dist/index.js
CHANGED
|
@@ -16377,6 +16377,28 @@ const BaseAvatar = styled__default.default(Image)`
|
|
|
16377
16377
|
`;
|
|
16378
16378
|
var index$9 = /*#__PURE__*/React.forwardRef(Avatar);
|
|
16379
16379
|
|
|
16380
|
+
const BadgeAttacher = ({
|
|
16381
|
+
children,
|
|
16382
|
+
renderBadge,
|
|
16383
|
+
...props
|
|
16384
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsxs(BadgeAttacherWrapper, {
|
|
16385
|
+
...props,
|
|
16386
|
+
children: [children, renderBadge({
|
|
16387
|
+
style: {
|
|
16388
|
+
position: 'absolute',
|
|
16389
|
+
top: 0,
|
|
16390
|
+
right: 0,
|
|
16391
|
+
transform: 'translate(10%, -10%)'
|
|
16392
|
+
}
|
|
16393
|
+
})]
|
|
16394
|
+
});
|
|
16395
|
+
const BadgeAttacherWrapper = styled__default.default.div`
|
|
16396
|
+
position: relative;
|
|
16397
|
+
width: fit-content;
|
|
16398
|
+
|
|
16399
|
+
${sx}
|
|
16400
|
+
`;
|
|
16401
|
+
|
|
16380
16402
|
const Tooltip = ({
|
|
16381
16403
|
children,
|
|
16382
16404
|
direction = 'top-center',
|
|
@@ -17473,6 +17495,57 @@ const BaseChip = styled__default.default.span({
|
|
|
17473
17495
|
}
|
|
17474
17496
|
}), sx);
|
|
17475
17497
|
|
|
17498
|
+
const CounterBadge = ({
|
|
17499
|
+
variant = 'red',
|
|
17500
|
+
size = 'm',
|
|
17501
|
+
children: propChildren = '',
|
|
17502
|
+
maxCounter = 99,
|
|
17503
|
+
...props
|
|
17504
|
+
}) => {
|
|
17505
|
+
const numberChildren = typeof propChildren === 'number' ? propChildren : parseInt(propChildren);
|
|
17506
|
+
const children = maxCounter < numberChildren ? `${maxCounter}+` : `${numberChildren}`;
|
|
17507
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(BaseCounterBadge, {
|
|
17508
|
+
variant: variant,
|
|
17509
|
+
size: size,
|
|
17510
|
+
...props,
|
|
17511
|
+
"aria-label": `${numberChildren}`,
|
|
17512
|
+
children: children
|
|
17513
|
+
});
|
|
17514
|
+
};
|
|
17515
|
+
const BaseCounterBadge = styled__default.default.span`
|
|
17516
|
+
display: inline-flex;
|
|
17517
|
+
align-items: center;
|
|
17518
|
+
justify-content: center;
|
|
17519
|
+
border-radius: ${({
|
|
17520
|
+
theme
|
|
17521
|
+
}) => forcePixelValue(theme.radii.full)};
|
|
17522
|
+
|
|
17523
|
+
${variant({
|
|
17524
|
+
prop: 'variant',
|
|
17525
|
+
variants: {
|
|
17526
|
+
red: {
|
|
17527
|
+
backgroundColor: 'bg/accent/red',
|
|
17528
|
+
color: 'text/inverse'
|
|
17529
|
+
}
|
|
17530
|
+
}
|
|
17531
|
+
})}
|
|
17532
|
+
${variant({
|
|
17533
|
+
prop: 'size',
|
|
17534
|
+
variants: {
|
|
17535
|
+
m: {
|
|
17536
|
+
minWidth: forcePixelValue(20),
|
|
17537
|
+
fontSize: 'xxs',
|
|
17538
|
+
fontWeight: 'medium',
|
|
17539
|
+
lineHeight: 2,
|
|
17540
|
+
px: 1,
|
|
17541
|
+
py: 0.25
|
|
17542
|
+
}
|
|
17543
|
+
}
|
|
17544
|
+
})}
|
|
17545
|
+
|
|
17546
|
+
${sx}
|
|
17547
|
+
`;
|
|
17548
|
+
|
|
17476
17549
|
/**
|
|
17477
17550
|
* `children`의 컴포넌트들을 시각적으로 재배치하기 위한 훅입니다.
|
|
17478
17551
|
*/
|
|
@@ -23939,10 +24012,12 @@ const useOutsideClick = ({
|
|
|
23939
24012
|
exports.ActionList = index$a;
|
|
23940
24013
|
exports.AnimatePresence = AnimatePresence;
|
|
23941
24014
|
exports.Avatar = index$9;
|
|
24015
|
+
exports.BadgeAttacher = BadgeAttacher;
|
|
23942
24016
|
exports.Breadcrumbs = index$8;
|
|
23943
24017
|
exports.Button = Button;
|
|
23944
24018
|
exports.Checkbox = Checkbox$1;
|
|
23945
24019
|
exports.Chip = Chip;
|
|
24020
|
+
exports.CounterBadge = CounterBadge;
|
|
23946
24021
|
exports.Datagrid = index$7;
|
|
23947
24022
|
exports.DescriptionList = DescriptionList;
|
|
23948
24023
|
exports.Dialog = index$6;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { sx } from '../../utils/styled-system/index.js';
|
|
3
|
+
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
4
|
+
|
|
5
|
+
const BadgeAttacher = ({
|
|
6
|
+
children,
|
|
7
|
+
renderBadge,
|
|
8
|
+
...props
|
|
9
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsxs(BadgeAttacherWrapper, {
|
|
10
|
+
...props,
|
|
11
|
+
children: [children, renderBadge({
|
|
12
|
+
style: {
|
|
13
|
+
position: 'absolute',
|
|
14
|
+
top: 0,
|
|
15
|
+
right: 0,
|
|
16
|
+
transform: 'translate(10%, -10%)'
|
|
17
|
+
}
|
|
18
|
+
})]
|
|
19
|
+
});
|
|
20
|
+
const BadgeAttacherWrapper = styled.div`
|
|
21
|
+
position: relative;
|
|
22
|
+
width: fit-content;
|
|
23
|
+
|
|
24
|
+
${sx}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
export { BadgeAttacher as default };
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import '../../node_modules/styled-system/dist/index.esm.js';
|
|
3
|
+
import { forcePixelValue } from '../../utils/forcePixelValue.js';
|
|
4
|
+
import { sx } from '../../utils/styled-system/index.js';
|
|
5
|
+
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
6
|
+
import { variant } from '../../node_modules/@styled-system/variant/dist/index.esm.js';
|
|
7
|
+
|
|
8
|
+
const CounterBadge = ({
|
|
9
|
+
variant = 'red',
|
|
10
|
+
size = 'm',
|
|
11
|
+
children: propChildren = '',
|
|
12
|
+
maxCounter = 99,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
const numberChildren = typeof propChildren === 'number' ? propChildren : parseInt(propChildren);
|
|
16
|
+
const children = maxCounter < numberChildren ? `${maxCounter}+` : `${numberChildren}`;
|
|
17
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(BaseCounterBadge, {
|
|
18
|
+
variant: variant,
|
|
19
|
+
size: size,
|
|
20
|
+
...props,
|
|
21
|
+
"aria-label": `${numberChildren}`,
|
|
22
|
+
children: children
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
const BaseCounterBadge = styled.span`
|
|
26
|
+
display: inline-flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
border-radius: ${({
|
|
30
|
+
theme
|
|
31
|
+
}) => forcePixelValue(theme.radii.full)};
|
|
32
|
+
|
|
33
|
+
${variant({
|
|
34
|
+
prop: 'variant',
|
|
35
|
+
variants: {
|
|
36
|
+
red: {
|
|
37
|
+
backgroundColor: 'bg/accent/red',
|
|
38
|
+
color: 'text/inverse'
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
})}
|
|
42
|
+
${variant({
|
|
43
|
+
prop: 'size',
|
|
44
|
+
variants: {
|
|
45
|
+
m: {
|
|
46
|
+
minWidth: forcePixelValue(20),
|
|
47
|
+
fontSize: 'xxs',
|
|
48
|
+
fontWeight: 'medium',
|
|
49
|
+
lineHeight: 2,
|
|
50
|
+
px: 1,
|
|
51
|
+
py: 0.25
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
})}
|
|
55
|
+
|
|
56
|
+
${sx}
|
|
57
|
+
`;
|
|
58
|
+
|
|
59
|
+
export { CounterBadge as default };
|
package/esm/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export { default as ActionList } from './core/ActionList/index.js';
|
|
2
2
|
export { default as Avatar } from './core/Avatar/index.js';
|
|
3
|
+
export { default as BadgeAttacher } from './core/BadgeAttacher/index.js';
|
|
3
4
|
export { default as Breadcrumbs } from './core/Breadcrumbs/index.js';
|
|
4
5
|
export { default as Button } from './core/Button/index.js';
|
|
5
6
|
export { default as Checkbox } from './core/Checkbox/index.js';
|
|
6
7
|
export { default as Chip } from './core/Chip/index.js';
|
|
8
|
+
export { default as CounterBadge } from './core/CounterBadge/index.js';
|
|
7
9
|
export { default as Datagrid } from './core/Datagrid/index.js';
|
|
8
10
|
export { default as DescriptionList } from './core/DescriptionList/index.js';
|
|
9
11
|
export { default as Dialog } from './core/Dialog/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamturing/react-kit",
|
|
3
|
-
"version": "2.19.
|
|
3
|
+
"version": "2.19.3",
|
|
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",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"react-is": "^18.2.0",
|
|
63
63
|
"styled-system": "^5.1.5"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "b45053ed94e44f578e44dce29e277726777ef881"
|
|
66
66
|
}
|