@apify/ui-library 1.108.2 → 1.109.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/src/components/card_container.d.ts +27 -0
- package/dist/src/components/card_container.d.ts.map +1 -0
- package/dist/src/components/card_container.js +46 -0
- package/dist/src/components/card_container.js.map +1 -0
- package/dist/src/components/card_container.stories.d.ts +10 -0
- package/dist/src/components/card_container.stories.d.ts.map +1 -0
- package/dist/src/components/card_container.stories.js +33 -0
- package/dist/src/components/card_container.stories.js.map +1 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +1 -0
- package/dist/src/components/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/components/card_container.stories.tsx +63 -0
- package/src/components/card_container.tsx +78 -0
- package/src/components/index.ts +1 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import type { ValueOf } from '@apify-packages/types';
|
|
3
|
+
import { type BoxProps } from './box.js';
|
|
4
|
+
declare const HEADER_PLACEMENT: {
|
|
5
|
+
readonly TOP: "TOP";
|
|
6
|
+
readonly BOTTOM: "BOTTOM";
|
|
7
|
+
};
|
|
8
|
+
export type CardContainerProps = BoxProps & {
|
|
9
|
+
/** The header can be placed on the bottom of the card or on the top. */
|
|
10
|
+
headerPlacement?: ValueOf<typeof HEADER_PLACEMENT>;
|
|
11
|
+
/**
|
|
12
|
+
* If string is passed, the correct styles are applied automatically.
|
|
13
|
+
* In case of custom component, use `CardContainer.Heading` component to get the same styles.
|
|
14
|
+
*/
|
|
15
|
+
header: React.ReactNode;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* CardContainer visually wraps it's children and shows a simple header.
|
|
19
|
+
*
|
|
20
|
+
* The header can be customized.
|
|
21
|
+
*/
|
|
22
|
+
export declare const CardContainer: {
|
|
23
|
+
({ children, header, headerPlacement, ...rest }: CardContainerProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
Heading: import("styled-components").StyledComponent<"span", any, {}, never>;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=card_container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card_container.d.ts","sourceRoot":"","sources":["../../../src/components/card_container.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAGrD,OAAO,EAAO,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAO9C,QAAA,MAAM,gBAAgB;;;CAGZ,CAAC;AA8BX,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG;IACxC,wEAAwE;IACxE,eAAe,CAAC,EAAE,OAAO,CAAC,OAAO,gBAAgB,CAAC,CAAC;IACnD;;;OAGG;IACH,MAAM,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,aAAa;qDAKvB,kBAAkB;;CASpB,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { theme } from '../design_system/theme.js';
|
|
4
|
+
import { Box } from './box.js';
|
|
5
|
+
const classNames = {
|
|
6
|
+
CONTENT: 'CardContainer-Content',
|
|
7
|
+
HEADER: 'CardContainer-Header',
|
|
8
|
+
};
|
|
9
|
+
const HEADER_PLACEMENT = {
|
|
10
|
+
TOP: 'TOP',
|
|
11
|
+
BOTTOM: 'BOTTOM',
|
|
12
|
+
};
|
|
13
|
+
const Wrapper = styled(Box) `
|
|
14
|
+
background-color: ${theme.color.neutral.backgroundSubtle};
|
|
15
|
+
border-radius: ${theme.radius.radius12};
|
|
16
|
+
|
|
17
|
+
padding: ${theme.space.space2};
|
|
18
|
+
|
|
19
|
+
display: flex;
|
|
20
|
+
flex-direction: ${({ $headerPlacement }) => ($headerPlacement === HEADER_PLACEMENT.TOP ? 'column' : 'column-reverse')};
|
|
21
|
+
|
|
22
|
+
.${classNames.CONTENT} {
|
|
23
|
+
/* Inner radius = outer radius - padding */
|
|
24
|
+
border-radius: calc(${theme.radius.radius12} - ${theme.space.space2});
|
|
25
|
+
background-color: ${theme.color.neutral.background};
|
|
26
|
+
|
|
27
|
+
padding: ${theme.space.space16};
|
|
28
|
+
flex-grow: 1;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.${classNames.HEADER} {
|
|
32
|
+
padding: ${theme.space.space4} ${theme.space.space8};
|
|
33
|
+
display: flex;
|
|
34
|
+
justify-content: space-between;
|
|
35
|
+
align-items: center;
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
const CardContainerHeading = styled.span `${theme.typography.shared.desktop.bodyMMedium}`;
|
|
39
|
+
/**
|
|
40
|
+
* CardContainer visually wraps it's children and shows a simple header.
|
|
41
|
+
*
|
|
42
|
+
* The header can be customized.
|
|
43
|
+
*/
|
|
44
|
+
export const CardContainer = ({ children, header, headerPlacement = HEADER_PLACEMENT.TOP, ...rest }) => (_jsxs(Wrapper, { ...rest, "$headerPlacement": headerPlacement, children: [_jsx("div", { className: classNames.HEADER, children: typeof header === 'string' ? _jsx(CardContainerHeading, { children: header }) : header }), _jsx("div", { className: classNames.CONTENT, children: children })] }));
|
|
45
|
+
CardContainer.Heading = CardContainerHeading;
|
|
46
|
+
//# sourceMappingURL=card_container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card_container.js","sourceRoot":"","sources":["../../../src/components/card_container.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAIvC,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,GAAG,EAAiB,M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K,QAAQ,CAAC,CAAC,CAAC,KAAC,oBAAoB,cAAE,MAAM,GAAwB,CAAC,CAAC,CAAC,MAAM,GAC1F,EACN,cAAK,SAAS,EAAE,UAAU,CAAC,OAAO,YAC7B,QAAQ,GACP,IACA,CACb,CAAC;AAEF,aAAa,CAAC,OAAO,GAAG,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { type CardContainerProps } from './card_container.js';
|
|
3
|
+
declare const _default: Meta<CardContainerProps>;
|
|
4
|
+
export default _default;
|
|
5
|
+
type Story = StoryObj<CardContainerProps>;
|
|
6
|
+
/**
|
|
7
|
+
* Default color wheel gradient with standard settings
|
|
8
|
+
*/
|
|
9
|
+
export declare const Default: Story;
|
|
10
|
+
//# sourceMappingURL=card_container.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card_container.stories.d.ts","sourceRoot":"","sources":["../../../src/components/card_container.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAK5D,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;wBAYxE,IAAI,CAAC,kBAAkB,CAAC;AAT7B,wBAS8B;AAE9B,KAAK,KAAK,GAAG,QAAQ,CAAC,kBAAkB,CAAC,CAAC;AAO1C;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,KAiCrB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
import { DragIndicatorIcon } from '@apify/ui-icons';
|
|
4
|
+
import { CardContainer } from './card_container.js';
|
|
5
|
+
import { IconButton } from './icon_button.js';
|
|
6
|
+
export default {
|
|
7
|
+
title: 'UI-Library/CardContainer',
|
|
8
|
+
component: CardContainer,
|
|
9
|
+
argTypes: {
|
|
10
|
+
headerPlacement: {
|
|
11
|
+
control: { type: 'select' },
|
|
12
|
+
options: ['TOP', 'BOTTOM'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const StoryWrapper = styled.div `
|
|
17
|
+
display: grid;
|
|
18
|
+
gap: 1rem;
|
|
19
|
+
grid-template-columns: 1fr 1fr 1fr;
|
|
20
|
+
`;
|
|
21
|
+
/**
|
|
22
|
+
* Default color wheel gradient with standard settings
|
|
23
|
+
*/
|
|
24
|
+
export const Default = {
|
|
25
|
+
args: {
|
|
26
|
+
children: 'This is the content',
|
|
27
|
+
header: 'Recently viewed',
|
|
28
|
+
},
|
|
29
|
+
render: (args) => {
|
|
30
|
+
return _jsxs(StoryWrapper, { children: [_jsx(CardContainer, { ...args }), _jsx(CardContainer, { ...args, headerPlacement: 'BOTTOM' }), _jsx(CardContainer, { ...args, header: _jsxs(_Fragment, { children: [_jsx(CardContainer.Heading, { children: "TEst" }), _jsx(IconButton, { Icon: DragIndicatorIcon })] }) }), _jsx(CardContainer, { ...args, header: _jsx(_Fragment, { children: _jsxs("div", { children: [_jsx(CardContainer.Heading, { children: "# Videos with this hashtag" }), _jsx("code", { style: { marginLeft: 8 }, children: "Required" })] }) }) }), _jsx(CardContainer, { ...args, header: _jsx(_Fragment, { children: "Completely custom header content" }) })] });
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=card_container.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card_container.stories.js","sourceRoot":"","sources":["../../../src/components/card_container.stories.tsx"],"names":[],"mappings":";AACA,OAAO,MAAM,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAAE,aAAa,EAA2B,MAAM,qBAAqB,CAAC;AAC7E,OAAO,EAAE,UAAU,EA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;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,iBAAiB,CAAC;AAChC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,iB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