@sproutsocial/seeds-react-tabs 1.0.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/.eslintignore +6 -0
- package/.eslintrc.js +4 -0
- package/.turbo/turbo-build.log +21 -0
- package/CHANGELOG.md +7 -0
- package/dist/esm/index.js +204 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/index.d.mts +59 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.js +241 -0
- package/dist/index.js.map +1 -0
- package/jest.config.js +9 -0
- package/package.json +43 -0
- package/src/Tabs.stories.tsx +122 -0
- package/src/Tabs.tsx +171 -0
- package/src/TabsTypes.ts +31 -0
- package/src/__tests__/Tabs.typetest.tsx +20 -0
- package/src/__tests__/tabs.test.tsx +271 -0
- package/src/index.ts +5 -0
- package/src/styled.d.ts +7 -0
- package/src/styles.ts +80 -0
- package/tsconfig.json +9 -0
- package/tsup.config.ts +12 -0
package/src/styles.ts
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import styled, { css } from "styled-components";
|
|
2
|
+
import { COMMON } from "@sproutsocial/seeds-react-system-props";
|
|
3
|
+
import { Button } from "@sproutsocial/seeds-react-button";
|
|
4
|
+
import { type TypeTabsProps } from "./TabsTypes";
|
|
5
|
+
|
|
6
|
+
interface TypeTabState {
|
|
7
|
+
isSelected: boolean;
|
|
8
|
+
}
|
|
9
|
+
type TypeFullWidth = Pick<TypeTabsProps, "fullWidth">;
|
|
10
|
+
interface TypeStyleProps extends TypeFullWidth, TypeTabState {}
|
|
11
|
+
|
|
12
|
+
const Container = styled.ul<TypeTabsProps>`
|
|
13
|
+
display: ${(props) => (props.fullWidth ? "flex" : "inline-flex")};
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
margin: 0;
|
|
16
|
+
padding: 0;
|
|
17
|
+
list-style: none;
|
|
18
|
+
border-bottom: ${(props) => props.theme.borders[500]}
|
|
19
|
+
${(props) => props.theme.colors.container.border.base};
|
|
20
|
+
|
|
21
|
+
${COMMON}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export const TabItem = styled.li<TypeStyleProps>`
|
|
25
|
+
margin-bottom: -1px;
|
|
26
|
+
${(props) =>
|
|
27
|
+
props.fullWidth &&
|
|
28
|
+
css`
|
|
29
|
+
flex-grow: 1;
|
|
30
|
+
`};
|
|
31
|
+
|
|
32
|
+
&:not(:last-child) {
|
|
33
|
+
${(props) =>
|
|
34
|
+
!props.fullWidth &&
|
|
35
|
+
css`
|
|
36
|
+
margin-right: ${(props) => props.theme.space[350]};
|
|
37
|
+
`};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
${(props) =>
|
|
41
|
+
props.isSelected &&
|
|
42
|
+
css`
|
|
43
|
+
box-shadow: ${(props) =>
|
|
44
|
+
`inset 0 -3px 0 0 ${props.theme.colors.button.primary.background.base}`};
|
|
45
|
+
`};
|
|
46
|
+
|
|
47
|
+
&:hover {
|
|
48
|
+
${(props) =>
|
|
49
|
+
props.isSelected &&
|
|
50
|
+
css`
|
|
51
|
+
box-shadow: ${(props) =>
|
|
52
|
+
`inset 0 -3px 0 0 ${props.theme.colors.button.primary.background.hover}`};
|
|
53
|
+
`};
|
|
54
|
+
}
|
|
55
|
+
`;
|
|
56
|
+
|
|
57
|
+
export const TabButton = styled(Button)<TypeStyleProps>`
|
|
58
|
+
padding: ${(props) => `${props.theme.space[350]} 0`};
|
|
59
|
+
color: ${(props) => props.theme.colors.text.headline};
|
|
60
|
+
width: 100%;
|
|
61
|
+
|
|
62
|
+
${(props) =>
|
|
63
|
+
props.isSelected &&
|
|
64
|
+
css`
|
|
65
|
+
color: ${(props) => props.theme.colors.link.base};
|
|
66
|
+
`};
|
|
67
|
+
|
|
68
|
+
&:hover {
|
|
69
|
+
${(props) =>
|
|
70
|
+
props.isSelected &&
|
|
71
|
+
css`
|
|
72
|
+
color: ${(props) => props.theme.colors.link.hover};
|
|
73
|
+
`};
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&:active {
|
|
77
|
+
transform: none;
|
|
78
|
+
}
|
|
79
|
+
`;
|
|
80
|
+
export default Container;
|
package/tsconfig.json
ADDED
package/tsup.config.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineConfig } from "tsup";
|
|
2
|
+
|
|
3
|
+
export default defineConfig((options) => ({
|
|
4
|
+
entry: ["src/index.ts"],
|
|
5
|
+
format: ["cjs", "esm"],
|
|
6
|
+
clean: true,
|
|
7
|
+
legacyOutput: true,
|
|
8
|
+
dts: options.dts,
|
|
9
|
+
external: ["react"],
|
|
10
|
+
sourcemap: true,
|
|
11
|
+
metafile: options.metafile,
|
|
12
|
+
}));
|