@teamturing/react-kit 2.8.1 → 2.10.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.
- package/dist/core/Breadcrumbs/BreadcrumbsItem.d.ts +9 -0
- package/dist/core/Breadcrumbs/index.d.ts +17 -0
- package/dist/core/GradientText/index.d.ts +6 -6
- package/dist/core/Grid/index.d.ts +2 -2
- package/dist/core/IconButton/index.d.ts +1 -1
- package/dist/core/Spinner/index.d.ts +196 -196
- package/dist/core/Stack/index.d.ts +2 -2
- package/dist/enigma/EnigmaUI/index.d.ts +16 -16
- package/dist/enigma/Layout/SingleColumnLayout/index.d.ts +1 -1
- package/dist/enigma/View/ChipGroupView/index.d.ts +2 -2
- package/dist/enigma/View/GridView/index.d.ts +2 -2
- package/dist/enigma/View/IconView/index.d.ts +2 -2
- package/dist/enigma/View/ImageView/index.d.ts +2 -2
- package/dist/enigma/View/TextView/index.d.ts +2 -2
- package/dist/enigma/types/index.d.ts +33 -33
- package/dist/index.d.ts +2 -0
- package/dist/index.js +6070 -5916
- package/esm/core/Breadcrumbs/BreadcrumbsItem.js +77 -0
- package/esm/core/Breadcrumbs/index.js +72 -0
- package/esm/enigma/View/ChipGroupView/index.js +29 -24
- package/esm/enigma/View/GridView/index.js +25 -20
- package/esm/enigma/View/IconView/index.js +6 -2
- package/esm/enigma/View/ImageView/index.js +4 -2
- package/esm/enigma/View/TextView/index.js +5 -1
- package/esm/index.js +1 -0
- package/package.json +6 -4
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { useRef, useState, useEffect } from 'react';
|
|
2
|
+
import styled, { css } from 'styled-components';
|
|
3
|
+
import { forcePixelValue } from '../../utils/forcePixelValue.js';
|
|
4
|
+
import Tooltip from '../Tooltip/index.js';
|
|
5
|
+
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
6
|
+
|
|
7
|
+
const BreadcrumbsItem = ({
|
|
8
|
+
text,
|
|
9
|
+
selected = false,
|
|
10
|
+
truncatedWidth = 100,
|
|
11
|
+
...props
|
|
12
|
+
}) => {
|
|
13
|
+
const itemRef = useRef(null);
|
|
14
|
+
const [isOverflow, setIsOverflow] = useState(false);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (itemRef.current) {
|
|
17
|
+
if (truncatedWidth <= itemRef.current.clientWidth) {
|
|
18
|
+
setIsOverflow(true);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}, []);
|
|
22
|
+
const baseBreadCrumbsItem = /*#__PURE__*/jsxRuntimeExports.jsx(BaseBreadcrumbsItem, {
|
|
23
|
+
ref: itemRef,
|
|
24
|
+
selected: selected,
|
|
25
|
+
truncatedWidth: truncatedWidth,
|
|
26
|
+
...props,
|
|
27
|
+
children: text
|
|
28
|
+
});
|
|
29
|
+
return isOverflow ? /*#__PURE__*/jsxRuntimeExports.jsx(Tooltip, {
|
|
30
|
+
text: text,
|
|
31
|
+
direction: 'bottom-center',
|
|
32
|
+
sx: {
|
|
33
|
+
display: 'inline-flex'
|
|
34
|
+
},
|
|
35
|
+
children: baseBreadCrumbsItem
|
|
36
|
+
}) : baseBreadCrumbsItem;
|
|
37
|
+
};
|
|
38
|
+
const BaseBreadcrumbsItem = styled.a`
|
|
39
|
+
display: inline-block;
|
|
40
|
+
font-size: ${({
|
|
41
|
+
theme
|
|
42
|
+
}) => forcePixelValue(theme.fontSizes.xxs)};
|
|
43
|
+
font-weight: ${({
|
|
44
|
+
theme
|
|
45
|
+
}) => theme.fontWeights.medium};
|
|
46
|
+
line-height: ${({
|
|
47
|
+
theme
|
|
48
|
+
}) => theme.lineHeights[2]};
|
|
49
|
+
color: ${({
|
|
50
|
+
theme
|
|
51
|
+
}) => theme.colors['text/neutral/subtlest']};
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
|
|
54
|
+
&:hover {
|
|
55
|
+
text-decoration: underline;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
text-overflow: ellipsis;
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
word-break: break-word;
|
|
61
|
+
white-space: nowrap;
|
|
62
|
+
|
|
63
|
+
max-width: ${({
|
|
64
|
+
truncatedWidth
|
|
65
|
+
}) => truncatedWidth ? forcePixelValue(truncatedWidth) : ''};
|
|
66
|
+
|
|
67
|
+
${({
|
|
68
|
+
selected
|
|
69
|
+
}) => selected ? css`
|
|
70
|
+
color: ${({
|
|
71
|
+
theme
|
|
72
|
+
}) => theme.colors['text/neutral/subtle']};
|
|
73
|
+
pointer-events: none;
|
|
74
|
+
` : ''}
|
|
75
|
+
`;
|
|
76
|
+
|
|
77
|
+
export { BreadcrumbsItem as default };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { Children, useState } from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { forcePixelValue } from '../../utils/forcePixelValue.js';
|
|
4
|
+
import BreadcrumbsItem from './BreadcrumbsItem.js';
|
|
5
|
+
import { j as jsxRuntimeExports } from '../../node_modules/react/jsx-runtime.js';
|
|
6
|
+
|
|
7
|
+
const Breadcrumbs = ({
|
|
8
|
+
children,
|
|
9
|
+
maxItemCount = 5,
|
|
10
|
+
...props
|
|
11
|
+
}) => {
|
|
12
|
+
const childrenArray = Children.toArray(children);
|
|
13
|
+
const shouldCollapse = maxItemCount < childrenArray.length;
|
|
14
|
+
const [isExpanded, setIsExpanded] = useState(!shouldCollapse);
|
|
15
|
+
const breadcrumbsItems = isExpanded ? childrenArray : [...childrenArray.slice(0, 1), /*#__PURE__*/jsxRuntimeExports.jsx(BreadcrumbsItem, {
|
|
16
|
+
text: '...',
|
|
17
|
+
onClick: () => setIsExpanded(true)
|
|
18
|
+
}, 'collapse'), ...childrenArray.slice(1 + 1 + childrenArray.length - maxItemCount)];
|
|
19
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(BaseBreadcrumbs, {
|
|
20
|
+
...props,
|
|
21
|
+
children: Children.map(breadcrumbsItems, child => /*#__PURE__*/jsxRuntimeExports.jsx(BreadcrumbsItemWrapper, {
|
|
22
|
+
role: 'listitem',
|
|
23
|
+
children: child
|
|
24
|
+
}))
|
|
25
|
+
});
|
|
26
|
+
};
|
|
27
|
+
const BaseBreadcrumbs = styled.nav`
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: flex-start;
|
|
31
|
+
flex-wrap: wrap;
|
|
32
|
+
|
|
33
|
+
column-gap: ${({
|
|
34
|
+
theme
|
|
35
|
+
}) => forcePixelValue(theme.space[2])};
|
|
36
|
+
row-gap: ${({
|
|
37
|
+
theme
|
|
38
|
+
}) => forcePixelValue(theme.space[1])};
|
|
39
|
+
`;
|
|
40
|
+
const BreadcrumbsItemWrapper = styled.span`
|
|
41
|
+
display: inline-flex;
|
|
42
|
+
|
|
43
|
+
&::after {
|
|
44
|
+
content: '/';
|
|
45
|
+
font-size: ${({
|
|
46
|
+
theme
|
|
47
|
+
}) => forcePixelValue(theme.fontSizes.xxs)};
|
|
48
|
+
font-weight: ${({
|
|
49
|
+
theme
|
|
50
|
+
}) => theme.fontWeights.medium};
|
|
51
|
+
line-height: ${({
|
|
52
|
+
theme
|
|
53
|
+
}) => theme.lineHeights[2]};
|
|
54
|
+
color: ${({
|
|
55
|
+
theme
|
|
56
|
+
}) => theme.colors['text/neutral/subtlest']};
|
|
57
|
+
margin-left: ${({
|
|
58
|
+
theme
|
|
59
|
+
}) => forcePixelValue(theme.space[2])};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
&:last-child {
|
|
63
|
+
&::after {
|
|
64
|
+
content: none;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`;
|
|
68
|
+
var index = Object.assign(Breadcrumbs, {
|
|
69
|
+
Item: BreadcrumbsItem
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
export { index as default };
|
|
@@ -1,36 +1,41 @@
|
|
|
1
1
|
import Chip from '../../../core/Chip/index.js';
|
|
2
2
|
import ItemList from '../../../core/ItemList/index.js';
|
|
3
|
+
import Space from '../../../core/Space/index.js';
|
|
3
4
|
import Stack from '../../../core/Stack/index.js';
|
|
4
5
|
import { j as jsxRuntimeExports } from '../../../node_modules/react/jsx-runtime.js';
|
|
5
6
|
|
|
6
7
|
const ChipGroupView = ({
|
|
7
8
|
view: {
|
|
8
9
|
chips = [],
|
|
9
|
-
chipGroupProps
|
|
10
|
-
size
|
|
11
|
-
gapX
|
|
12
|
-
gapY
|
|
13
|
-
}
|
|
10
|
+
chipGroupProps = {
|
|
11
|
+
size: 'm',
|
|
12
|
+
gapX: 1,
|
|
13
|
+
gapY: 1
|
|
14
|
+
},
|
|
15
|
+
spaceProps
|
|
14
16
|
}
|
|
15
|
-
}) => /*#__PURE__*/jsxRuntimeExports.jsx(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
17
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsx(Space, {
|
|
18
|
+
...spaceProps,
|
|
19
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(Stack, {
|
|
20
|
+
gapX: chipGroupProps.gapX,
|
|
21
|
+
gapY: chipGroupProps.gapY,
|
|
22
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(ItemList, {
|
|
23
|
+
items: chips,
|
|
24
|
+
renderItem: ({
|
|
25
|
+
text,
|
|
26
|
+
variant
|
|
27
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsx(Chip, {
|
|
28
|
+
size: chipGroupProps.size,
|
|
29
|
+
variant: variant,
|
|
30
|
+
children: text
|
|
31
|
+
}),
|
|
32
|
+
renderItemWrapper: (children, {
|
|
33
|
+
text,
|
|
34
|
+
variant
|
|
35
|
+
}, i) => /*#__PURE__*/jsxRuntimeExports.jsx(Stack.Item, {
|
|
36
|
+
children: children
|
|
37
|
+
}, `${text}-${variant}-${i}`)
|
|
38
|
+
})
|
|
34
39
|
})
|
|
35
40
|
});
|
|
36
41
|
|
|
@@ -1,31 +1,36 @@
|
|
|
1
1
|
import Grid from '../../../core/Grid/index.js';
|
|
2
|
+
import Space from '../../../core/Space/index.js';
|
|
2
3
|
import { getViewComponent } from '../../EnigmaUI/index.js';
|
|
3
4
|
import { j as jsxRuntimeExports } from '../../../node_modules/react/jsx-runtime.js';
|
|
4
5
|
|
|
5
6
|
const GridView = ({
|
|
6
7
|
view: {
|
|
7
8
|
units = [],
|
|
8
|
-
gridProps
|
|
9
|
+
gridProps,
|
|
10
|
+
spaceProps
|
|
9
11
|
}
|
|
10
|
-
}) => /*#__PURE__*/jsxRuntimeExports.jsx(
|
|
11
|
-
...
|
|
12
|
-
children:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
}) => /*#__PURE__*/jsxRuntimeExports.jsx(Space, {
|
|
13
|
+
...spaceProps,
|
|
14
|
+
children: /*#__PURE__*/jsxRuntimeExports.jsx(Grid, {
|
|
15
|
+
...gridProps,
|
|
16
|
+
children: units.map(({
|
|
17
|
+
views: viewContainers,
|
|
18
|
+
unitProps
|
|
19
|
+
}) => {
|
|
20
|
+
const unitKeySeperator = '_';
|
|
21
|
+
const unitKey = viewContainers.map(({
|
|
22
|
+
id
|
|
23
|
+
}) => id).join(unitKeySeperator);
|
|
24
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(Grid.Unit, {
|
|
25
|
+
...unitProps,
|
|
26
|
+
children: viewContainers.map(viewContainer => {
|
|
27
|
+
const ViewComponent = getViewComponent(viewContainer);
|
|
28
|
+
return /*#__PURE__*/jsxRuntimeExports.jsx(ViewComponent, {
|
|
29
|
+
view: viewContainer.view
|
|
30
|
+
}, viewContainer.id);
|
|
31
|
+
})
|
|
32
|
+
}, unitKey);
|
|
33
|
+
})
|
|
29
34
|
})
|
|
30
35
|
});
|
|
31
36
|
|
|
@@ -8,11 +8,15 @@ const IconView = ({
|
|
|
8
8
|
iconProps = {
|
|
9
9
|
color: 'icon/neutral',
|
|
10
10
|
size: 24
|
|
11
|
-
}
|
|
11
|
+
},
|
|
12
|
+
spaceProps
|
|
12
13
|
}
|
|
13
14
|
}) => /*#__PURE__*/jsxRuntimeExports.jsx(StyledIcon, {
|
|
14
15
|
icon: index[icon],
|
|
15
|
-
...iconProps
|
|
16
|
+
...iconProps,
|
|
17
|
+
sx: {
|
|
18
|
+
...spaceProps
|
|
19
|
+
}
|
|
16
20
|
});
|
|
17
21
|
|
|
18
22
|
export { IconView as default };
|
|
@@ -3,14 +3,16 @@ import { j as jsxRuntimeExports } from '../../../node_modules/react/jsx-runtime.
|
|
|
3
3
|
|
|
4
4
|
const ImageView = ({
|
|
5
5
|
view: {
|
|
6
|
-
|
|
6
|
+
spaceProps,
|
|
7
7
|
...props
|
|
8
8
|
}
|
|
9
9
|
}) => /*#__PURE__*/jsxRuntimeExports.jsx(Image, {
|
|
10
10
|
loading: 'lazy',
|
|
11
11
|
display: 'block',
|
|
12
12
|
...props,
|
|
13
|
-
|
|
13
|
+
sx: {
|
|
14
|
+
...spaceProps
|
|
15
|
+
}
|
|
14
16
|
});
|
|
15
17
|
|
|
16
18
|
export { ImageView as default };
|
|
@@ -4,10 +4,14 @@ import { j as jsxRuntimeExports } from '../../../node_modules/react/jsx-runtime.
|
|
|
4
4
|
const TextView = ({
|
|
5
5
|
view: {
|
|
6
6
|
text,
|
|
7
|
-
textProps
|
|
7
|
+
textProps,
|
|
8
|
+
spaceProps
|
|
8
9
|
}
|
|
9
10
|
}) => /*#__PURE__*/jsxRuntimeExports.jsx(Text, {
|
|
10
11
|
...textProps,
|
|
12
|
+
sx: {
|
|
13
|
+
...spaceProps
|
|
14
|
+
},
|
|
11
15
|
children: text
|
|
12
16
|
});
|
|
13
17
|
|
package/esm/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teamturing/react-kit",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.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",
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"scripts": {
|
|
25
25
|
"check:lint": "eslint ./src --cache",
|
|
26
26
|
"check:type": "tsc --noEmit",
|
|
27
|
-
"build": "rm -rf dist esm && tsc --project tsconfig.cjs.json --declaration --emitDeclarationOnly --declarationDir dist && rollup --config rollup.config.js"
|
|
27
|
+
"build": "rm -rf dist esm && tsc --project tsconfig.cjs.json --declaration --emitDeclarationOnly --declarationDir dist && rollup --config rollup.config.js",
|
|
28
|
+
"generate-enigma-json-schema": "typescript-json-schema ./tsconfig.json EnigmaSectionType --aliasRefs --topRef --out ./src/enigma/schema/generated.json"
|
|
28
29
|
},
|
|
29
30
|
"bugs": {
|
|
30
31
|
"url": "https://github.com/weareteamturing/bombe/issues"
|
|
@@ -39,7 +40,8 @@
|
|
|
39
40
|
"csstype": "^3.1.2",
|
|
40
41
|
"react": "^18.2.0",
|
|
41
42
|
"rollup-plugin-postcss": "^4.0.2",
|
|
42
|
-
"styled-components": "^6.0.7"
|
|
43
|
+
"styled-components": "^6.0.7",
|
|
44
|
+
"typescript-json-schema": "^0.62.0"
|
|
43
45
|
},
|
|
44
46
|
"peerDependencies": {
|
|
45
47
|
"@styled-system/css": "^5.1.5",
|
|
@@ -57,5 +59,5 @@
|
|
|
57
59
|
"react-is": "^18.2.0",
|
|
58
60
|
"styled-system": "^5.1.5"
|
|
59
61
|
},
|
|
60
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "41d8e954aa81797361f7156a2b65a006f53c48b5"
|
|
61
63
|
}
|