@apify/ui-library 1.170.2-uilibraryversion2candida-85b55e.17 → 1.171.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/README.md +1 -1
- package/dist/components/banner/banner.d.ts +11 -0
- package/dist/components/banner/banner.d.ts.map +1 -0
- package/dist/components/banner/banner.js +76 -0
- package/dist/components/banner/index.d.ts +2 -0
- package/dist/components/banner/index.d.ts.map +1 -0
- package/dist/components/chip/chip.d.ts +55 -0
- package/dist/components/chip/chip.d.ts.map +1 -0
- package/dist/components/chip/chip.js +144 -0
- package/dist/components/chip/index.d.ts +2 -0
- package/dist/components/chip/index.d.ts.map +1 -0
- package/dist/components/code/code_block/code_block.d.ts +3 -1
- package/dist/components/code/code_block/code_block.d.ts.map +1 -1
- package/dist/components/code/code_block/code_block.js +7 -1
- package/dist/components/code/code_block/code_block.styled.d.ts +1 -0
- package/dist/components/code/code_block/code_block.styled.d.ts.map +1 -1
- package/dist/components/code/code_block/code_block.styled.js +10 -0
- package/dist/components/code/inline_code/inline_code.d.ts.map +1 -1
- package/dist/components/color_wheel_gradient/color_wheel_gradient.d.ts +9 -0
- package/dist/components/color_wheel_gradient/color_wheel_gradient.d.ts.map +1 -0
- package/dist/components/color_wheel_gradient/color_wheel_gradient.js +27 -0
- package/dist/components/color_wheel_gradient/index.d.ts +2 -0
- package/dist/components/color_wheel_gradient/index.d.ts.map +1 -0
- package/dist/components/icon_button/icon_button.js +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/tag/tag.d.ts +1 -1
- package/dist/components/tag/tag.d.ts.map +1 -1
- package/dist/files_hash_at_build.txt +1 -1
- package/dist/index.js +4 -1
- package/dist/src/components/banner/banner.d.ts +11 -0
- package/dist/src/components/banner/banner.d.ts.map +1 -0
- package/dist/src/components/banner/banner.js +70 -0
- package/dist/src/components/banner/banner.js.map +1 -0
- package/dist/src/components/banner/index.d.ts +2 -0
- package/dist/src/components/banner/index.d.ts.map +1 -0
- package/dist/src/components/banner/index.js +2 -0
- package/dist/src/components/banner/index.js.map +1 -0
- package/dist/src/components/chip/chip.d.ts +56 -0
- package/dist/src/components/chip/chip.d.ts.map +1 -0
- package/dist/src/components/chip/chip.js +123 -0
- package/dist/src/components/chip/chip.js.map +1 -0
- package/dist/src/components/chip/index.d.ts +2 -0
- package/dist/src/components/chip/index.d.ts.map +1 -0
- package/dist/src/components/chip/index.js +2 -0
- package/dist/src/components/chip/index.js.map +1 -0
- package/dist/src/components/code/code_block/code_block.d.ts +3 -1
- package/dist/src/components/code/code_block/code_block.d.ts.map +1 -1
- package/dist/src/components/code/code_block/code_block.js +3 -2
- package/dist/src/components/code/code_block/code_block.js.map +1 -1
- package/dist/src/components/code/code_block/code_block.styled.d.ts +1 -0
- package/dist/src/components/code/code_block/code_block.styled.d.ts.map +1 -1
- package/dist/src/components/code/code_block/code_block.styled.js +10 -0
- package/dist/src/components/code/code_block/code_block.styled.js.map +1 -1
- package/dist/src/components/code/inline_code/inline_code.d.ts.map +1 -1
- package/dist/src/components/code/inline_code/inline_code.js +1 -0
- package/dist/src/components/code/inline_code/inline_code.js.map +1 -1
- package/dist/src/components/color_wheel_gradient/color_wheel_gradient.d.ts +9 -0
- package/dist/src/components/color_wheel_gradient/color_wheel_gradient.d.ts.map +1 -0
- package/dist/src/components/color_wheel_gradient/color_wheel_gradient.js +25 -0
- package/dist/src/components/color_wheel_gradient/color_wheel_gradient.js.map +1 -0
- package/dist/src/components/color_wheel_gradient/index.d.ts +2 -0
- package/dist/src/components/color_wheel_gradient/index.d.ts.map +1 -0
- package/dist/src/components/color_wheel_gradient/index.js +2 -0
- package/dist/src/components/color_wheel_gradient/index.js.map +1 -0
- package/dist/src/components/icon_button/icon_button.js +1 -1
- package/dist/src/components/index.d.ts +3 -0
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +3 -0
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/tag/tag.d.ts +1 -1
- package/dist/src/components/tag/tag.d.ts.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/components/banner/banner.stories.tsx +238 -0
- package/src/components/banner/banner.tsx +91 -0
- package/src/components/banner/index.ts +1 -0
- package/src/components/chip/chip.stories.tsx +311 -0
- package/src/components/chip/chip.tsx +167 -0
- package/src/components/chip/index.ts +1 -0
- package/src/components/code/code_block/code_block.stories.jsx +13 -6
- package/src/components/code/code_block/code_block.styled.tsx +11 -0
- package/src/components/code/code_block/code_block.tsx +8 -0
- package/src/components/code/inline_code/inline_code.tsx +1 -0
- package/src/components/color_wheel_gradient/color_wheel_gradient.stories.tsx +152 -0
- package/src/components/color_wheel_gradient/color_wheel_gradient.tsx +33 -0
- package/src/components/color_wheel_gradient/index.ts +1 -0
- package/src/components/icon_button/icon_button.tsx +1 -1
- package/src/components/index.ts +3 -0
- package/src/components/tag/tag.tsx +1 -1
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import type { FC } from 'react';
|
|
3
|
+
import type React from 'react';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import styled, { css } from 'styled-components';
|
|
6
|
+
|
|
7
|
+
import { theme } from '../../design_system/theme';
|
|
8
|
+
import type { ValueOf } from '../../internal_type_utils';
|
|
9
|
+
import type { RegularBoxProps } from '../box';
|
|
10
|
+
|
|
11
|
+
export const CHIP_SIZES = {
|
|
12
|
+
EXTRA_SMALL: 'XS',
|
|
13
|
+
SMALL: 'S',
|
|
14
|
+
MEDIUM: 'M',
|
|
15
|
+
LARGE: 'L',
|
|
16
|
+
} as const;
|
|
17
|
+
type CHIP_SIZES = ValueOf<typeof CHIP_SIZES>;
|
|
18
|
+
|
|
19
|
+
export const CHIP_TYPES = {
|
|
20
|
+
DEFAULT: 'DEFAULT',
|
|
21
|
+
PRIMARY: 'PRIMARY',
|
|
22
|
+
SUCCESS: 'SUCCESS',
|
|
23
|
+
WARNING: 'WARNING',
|
|
24
|
+
DANGER: 'DANGER',
|
|
25
|
+
} as const;
|
|
26
|
+
export type CHIP_TYPES = ValueOf<typeof CHIP_TYPES>;
|
|
27
|
+
|
|
28
|
+
export const classNames = {
|
|
29
|
+
BODY: 'Chip-body',
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
const chipSizeStyle = {
|
|
33
|
+
[CHIP_SIZES.EXTRA_SMALL]: css`
|
|
34
|
+
font-size: 12px;
|
|
35
|
+
line-height: 16px;
|
|
36
|
+
padding: 0 4px;
|
|
37
|
+
border-radius: 6px;
|
|
38
|
+
`,
|
|
39
|
+
[CHIP_SIZES.SMALL]: css`
|
|
40
|
+
font-size: 12px;
|
|
41
|
+
line-height: 16px;
|
|
42
|
+
padding: 2px 4px;
|
|
43
|
+
border-radius: 6px;
|
|
44
|
+
`,
|
|
45
|
+
[CHIP_SIZES.MEDIUM]: css`
|
|
46
|
+
font-size: 14px;
|
|
47
|
+
line-height: 20px;
|
|
48
|
+
padding: 2px 8px;
|
|
49
|
+
border-radius: 100px;
|
|
50
|
+
`,
|
|
51
|
+
[CHIP_SIZES.LARGE]: css`
|
|
52
|
+
/* TODO: (typography-mismatch) 16px/20px does not match any canonical typography token — needs designer input. Blocks migrating chipSizeStyle to typography token interpolations (XS/S match bodyS, M matches bodyM). */
|
|
53
|
+
font-size: 16px;
|
|
54
|
+
line-height: 20px;
|
|
55
|
+
padding: 2px 8px;
|
|
56
|
+
border-radius: 100px;
|
|
57
|
+
`,
|
|
58
|
+
} satisfies Record<CHIP_SIZES, unknown>;
|
|
59
|
+
|
|
60
|
+
const chipTypeStyle = {
|
|
61
|
+
[CHIP_TYPES.DEFAULT]: css`
|
|
62
|
+
color: ${theme.color.neutral.text};
|
|
63
|
+
background: ${theme.color.neutral.chipBackground};
|
|
64
|
+
`,
|
|
65
|
+
[CHIP_TYPES.PRIMARY]: css`
|
|
66
|
+
color: ${theme.color.primary.chipText};
|
|
67
|
+
background: ${theme.color.primary.chipBackground};
|
|
68
|
+
`,
|
|
69
|
+
[CHIP_TYPES.SUCCESS]: css`
|
|
70
|
+
color: ${theme.color.success.chipText};
|
|
71
|
+
background: ${theme.color.success.chipBackground};
|
|
72
|
+
`,
|
|
73
|
+
[CHIP_TYPES.WARNING]: css`
|
|
74
|
+
color: ${theme.color.warning.chipText};
|
|
75
|
+
background: ${theme.color.warning.chipBackground};
|
|
76
|
+
`,
|
|
77
|
+
[CHIP_TYPES.DANGER]: css`
|
|
78
|
+
color: ${theme.color.danger.chipText};
|
|
79
|
+
background: ${theme.color.danger.chipBackground};
|
|
80
|
+
`,
|
|
81
|
+
} satisfies Record<CHIP_TYPES, unknown>;
|
|
82
|
+
|
|
83
|
+
const chipTypeHoverStyle = {
|
|
84
|
+
[CHIP_TYPES.DEFAULT]: css`
|
|
85
|
+
background: ${theme.color.neutral.chipBackgroundHover};
|
|
86
|
+
`,
|
|
87
|
+
[CHIP_TYPES.PRIMARY]: css`
|
|
88
|
+
background: ${theme.color.primary.chipBackgroundHover};
|
|
89
|
+
`,
|
|
90
|
+
[CHIP_TYPES.SUCCESS]: css`
|
|
91
|
+
background: ${theme.color.success.chipBackgroundHover};
|
|
92
|
+
`,
|
|
93
|
+
[CHIP_TYPES.WARNING]: css`
|
|
94
|
+
background: ${theme.color.warning.chipBackgroundHover};
|
|
95
|
+
`,
|
|
96
|
+
[CHIP_TYPES.DANGER]: css`
|
|
97
|
+
background: ${theme.color.danger.chipBackgroundHover};
|
|
98
|
+
`,
|
|
99
|
+
} satisfies Record<CHIP_TYPES, unknown>;
|
|
100
|
+
|
|
101
|
+
const StyledChip = styled.span<{ size: CHIP_SIZES; type: CHIP_TYPES; clickable: boolean }>`
|
|
102
|
+
${({ size }) => chipSizeStyle[size]};
|
|
103
|
+
${({ type }) => chipTypeStyle[type]};
|
|
104
|
+
${({ type, clickable }) =>
|
|
105
|
+
clickable &&
|
|
106
|
+
css`
|
|
107
|
+
&:hover {
|
|
108
|
+
${chipTypeHoverStyle[type]};
|
|
109
|
+
}
|
|
110
|
+
`};
|
|
111
|
+
/* Static styles */
|
|
112
|
+
width: fit-content;
|
|
113
|
+
display: flex;
|
|
114
|
+
flex-direction: row;
|
|
115
|
+
justify-content: center;
|
|
116
|
+
align-items: center;
|
|
117
|
+
/* TODO: (typography-keyword) 'normal' keyword used instead of numeric value (400) or typography token. */
|
|
118
|
+
font-weight: normal;
|
|
119
|
+
white-space: nowrap;
|
|
120
|
+
cursor: ${({ clickable }) => (clickable ? 'pointer' : 'default')};
|
|
121
|
+
gap: ${theme.space.space4};
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
export type ChipProps = RegularBoxProps & {
|
|
125
|
+
type?: CHIP_TYPES;
|
|
126
|
+
size?: CHIP_SIZES;
|
|
127
|
+
icon?: React.ReactNode;
|
|
128
|
+
clickable?: boolean;
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Component for displaying status and for labelling other components.
|
|
133
|
+
* @deprecated Use Tag or Badge
|
|
134
|
+
*/
|
|
135
|
+
export const Chip = forwardRef(
|
|
136
|
+
(
|
|
137
|
+
{
|
|
138
|
+
type = CHIP_TYPES.DEFAULT,
|
|
139
|
+
size = CHIP_SIZES.MEDIUM,
|
|
140
|
+
clickable = false,
|
|
141
|
+
icon,
|
|
142
|
+
children,
|
|
143
|
+
className,
|
|
144
|
+
...passThroughProps
|
|
145
|
+
}: ChipProps,
|
|
146
|
+
ref,
|
|
147
|
+
) => {
|
|
148
|
+
const otherProps = { ...passThroughProps, type, size, clickable, className: clsx(className, classNames.BODY) };
|
|
149
|
+
|
|
150
|
+
return (
|
|
151
|
+
<StyledChip ref={ref} {...otherProps}>
|
|
152
|
+
{children}
|
|
153
|
+
{icon}
|
|
154
|
+
</StyledChip>
|
|
155
|
+
);
|
|
156
|
+
},
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
Chip.displayName = 'Chip';
|
|
160
|
+
|
|
161
|
+
type SpecificChipProps = Omit<ChipProps, 'type'>;
|
|
162
|
+
|
|
163
|
+
export const PrimaryChip: FC<SpecificChipProps> = (props) => <Chip type={CHIP_TYPES.PRIMARY} {...props} />;
|
|
164
|
+
export const NeutralChip: FC<SpecificChipProps> = (props) => <Chip type={CHIP_TYPES.DEFAULT} {...props} />;
|
|
165
|
+
export const SuccessChip: FC<SpecificChipProps> = (props) => <Chip type={CHIP_TYPES.SUCCESS} {...props} />;
|
|
166
|
+
export const DangerChip: FC<SpecificChipProps> = (props) => <Chip type={CHIP_TYPES.DANGER} {...props} />;
|
|
167
|
+
export const WarningChip: FC<SpecificChipProps> = (props) => <Chip type={CHIP_TYPES.WARNING} {...props} />;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './chip';
|
|
@@ -43,13 +43,20 @@ const Template = ({ content, ...args }) => {
|
|
|
43
43
|
<CodeBlock content={content} {...args} />
|
|
44
44
|
<h2>CodeBlock with title</h2>
|
|
45
45
|
<CodeBlock title="What a code" content={content} {...args} />
|
|
46
|
-
<h2>CodeBlock with dots and action</h2>
|
|
47
|
-
<CodeBlock
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
<h2>CodeBlock with gradient, dots and action</h2>
|
|
47
|
+
<CodeBlock
|
|
48
|
+
content={content}
|
|
49
|
+
highlightLines={[2, 3, 7]}
|
|
50
|
+
showGradient
|
|
51
|
+
showDotsHeader
|
|
52
|
+
showActionButton
|
|
53
|
+
{...args}
|
|
54
|
+
/>
|
|
55
|
+
<h2>CodeBlock with long lines, action and gradient</h2>
|
|
56
|
+
<CodeBlock content={longCode} showGradient showActionButton {...args} />
|
|
50
57
|
|
|
51
|
-
<h2>CodeBlock with multiple long codes, highlighted lines and
|
|
52
|
-
<CodeBlock content={multipleLongCodes} showActionButton {...args} />
|
|
58
|
+
<h2>CodeBlock with multiple long codes, highlighted lines, action and gradient</h2>
|
|
59
|
+
<CodeBlock content={multipleLongCodes} showGradient showActionButton {...args} />
|
|
53
60
|
<h2>CodeBlock with multiple codes</h2>
|
|
54
61
|
<CodeBlock content={multipleCodes} {...args} />
|
|
55
62
|
</div>
|
|
@@ -34,6 +34,7 @@ export const SyntaxHighlighterBaseStylesWrapper = styled(Box)<SyntaxHighlighterB
|
|
|
34
34
|
|
|
35
35
|
export const CodeBlockWrapper = styled(SyntaxHighlighterBaseStylesWrapper)<{
|
|
36
36
|
$hasHeader: boolean;
|
|
37
|
+
$gradientRotation?: number;
|
|
37
38
|
$highlightLines?: number[];
|
|
38
39
|
$hasActionButton?: boolean;
|
|
39
40
|
$hasTabs?: boolean;
|
|
@@ -157,6 +158,16 @@ export const CodeBlockWrapper = styled(SyntaxHighlighterBaseStylesWrapper)<{
|
|
|
157
158
|
`}
|
|
158
159
|
}
|
|
159
160
|
|
|
161
|
+
.CodeBlock-Gradient {
|
|
162
|
+
right: 0px;
|
|
163
|
+
bottom: 0px;
|
|
164
|
+
|
|
165
|
+
aspect-ratio: 1/1;
|
|
166
|
+
height: 250%;
|
|
167
|
+
|
|
168
|
+
transform: translate(50%, 70%) rotate(${({ $gradientRotation }) => $gradientRotation ?? 0}deg) scaleX(-1);
|
|
169
|
+
}
|
|
170
|
+
|
|
160
171
|
.CodeBlock-HederDotsWrapper {
|
|
161
172
|
display: flex;
|
|
162
173
|
padding: ${theme.space.space8};
|
|
@@ -3,6 +3,7 @@ import type React from 'react';
|
|
|
3
3
|
import { useMemo, useRef, useState } from 'react';
|
|
4
4
|
|
|
5
5
|
import type { RegularBoxProps } from '../../box';
|
|
6
|
+
import { ColorWheelGradient } from '../../color_wheel_gradient';
|
|
6
7
|
import { Link } from '../../link';
|
|
7
8
|
import { Text } from '../../text';
|
|
8
9
|
import type { SharedTextSize } from '../../text/text_shared';
|
|
@@ -102,6 +103,8 @@ export type CodeBlockProps = RegularBoxProps & {
|
|
|
102
103
|
className?: string;
|
|
103
104
|
hideBashHeader?: boolean;
|
|
104
105
|
onTabChange?: (key: string, e: React.MouseEvent) => Promise<void> | void;
|
|
106
|
+
showGradient?: boolean;
|
|
107
|
+
gradientRotation?: number;
|
|
105
108
|
highlightLines?: number[];
|
|
106
109
|
showActionButton?: boolean;
|
|
107
110
|
actionButtonLabel?: string;
|
|
@@ -123,10 +126,12 @@ export const CodeBlock = ({
|
|
|
123
126
|
highlightLines,
|
|
124
127
|
onTabChange,
|
|
125
128
|
defaultTabKey,
|
|
129
|
+
showGradient,
|
|
126
130
|
hideBashHeader,
|
|
127
131
|
showActionButton,
|
|
128
132
|
fullWidth,
|
|
129
133
|
actionButtonLabel,
|
|
134
|
+
gradientRotation = 340,
|
|
130
135
|
hideLineNumbers,
|
|
131
136
|
fullHeight,
|
|
132
137
|
title,
|
|
@@ -180,6 +185,7 @@ export const CodeBlock = ({
|
|
|
180
185
|
return (
|
|
181
186
|
<CodeBlockWrapper
|
|
182
187
|
$hasHeader={showHeader}
|
|
188
|
+
$gradientRotation={gradientRotation}
|
|
183
189
|
$hasActionButton={showActionButton}
|
|
184
190
|
$hasTabs={isMultiTab}
|
|
185
191
|
$fullWidth={fullWidth}
|
|
@@ -215,6 +221,8 @@ export const CodeBlock = ({
|
|
|
215
221
|
)}
|
|
216
222
|
{!hideCopyButton && <CopyButton code={currentCode} />}
|
|
217
223
|
</div>
|
|
224
|
+
|
|
225
|
+
{showGradient && <ColorWheelGradient className="CodeBlock-Gradient" blurSize={69} />}
|
|
218
226
|
</CodeBlockWrapper>
|
|
219
227
|
);
|
|
220
228
|
};
|
|
@@ -46,6 +46,7 @@ export type InlineCodeProps = RegularBoxProps & {
|
|
|
46
46
|
withCopyButton?: boolean;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
|
+
// This might be just a Chip component
|
|
49
50
|
export const InlineCode: React.FC<InlineCodeProps> = ({ children, size, withCopyButton, ...props }) => (
|
|
50
51
|
<Wrapper {...props}>
|
|
51
52
|
<Text type="code" as="code" size={size}>
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { Meta, StoryContext, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import type { ElementType } from 'react';
|
|
3
|
+
|
|
4
|
+
import { ColorWheelGradient, type ColorWheelGradientProps } from './color_wheel_gradient';
|
|
5
|
+
|
|
6
|
+
const Wrapper = ({ children }: { children: React.ReactNode }) => (
|
|
7
|
+
<div
|
|
8
|
+
style={{
|
|
9
|
+
position: 'relative',
|
|
10
|
+
width: '400px',
|
|
11
|
+
height: '400px',
|
|
12
|
+
backgroundColor: '#f5f5f5',
|
|
13
|
+
border: '1px solid #ddd',
|
|
14
|
+
borderRadius: '8px',
|
|
15
|
+
overflow: 'hidden',
|
|
16
|
+
}}
|
|
17
|
+
>
|
|
18
|
+
<style>
|
|
19
|
+
{`
|
|
20
|
+
@keyframes rotate {
|
|
21
|
+
from { transform: rotate(0deg); }
|
|
22
|
+
to { transform: rotate(360deg); }
|
|
23
|
+
}
|
|
24
|
+
`}
|
|
25
|
+
</style>
|
|
26
|
+
{children}
|
|
27
|
+
</div>
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
// oxlint-disable-next-line local/storybook-figma-design-url -- decorative gradient, no Figma counterpart
|
|
31
|
+
export default {
|
|
32
|
+
title: 'UI-Library/ColorWheelGradient',
|
|
33
|
+
tags: ['deprecated'],
|
|
34
|
+
component: ColorWheelGradient,
|
|
35
|
+
decorators: [
|
|
36
|
+
(Story: ElementType, _context: StoryContext) => (
|
|
37
|
+
<Wrapper>
|
|
38
|
+
<Story />
|
|
39
|
+
</Wrapper>
|
|
40
|
+
),
|
|
41
|
+
],
|
|
42
|
+
argTypes: {
|
|
43
|
+
translateX: {
|
|
44
|
+
control: 'number',
|
|
45
|
+
},
|
|
46
|
+
translateY: {
|
|
47
|
+
control: 'number',
|
|
48
|
+
},
|
|
49
|
+
rotation: {
|
|
50
|
+
control: 'number',
|
|
51
|
+
},
|
|
52
|
+
radius: {
|
|
53
|
+
control: 'number',
|
|
54
|
+
},
|
|
55
|
+
blurSize: {
|
|
56
|
+
control: 'number',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
} as Meta<ColorWheelGradientProps>;
|
|
60
|
+
|
|
61
|
+
type Story = StoryObj<ColorWheelGradientProps>;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Default color wheel gradient with standard settings
|
|
65
|
+
*/
|
|
66
|
+
export const Default: Story = {
|
|
67
|
+
args: {
|
|
68
|
+
radius: 200,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Small color wheel gradient
|
|
74
|
+
*/
|
|
75
|
+
export const Small: Story = {
|
|
76
|
+
args: {
|
|
77
|
+
radius: 100,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Medium color wheel gradient
|
|
83
|
+
*/
|
|
84
|
+
export const Medium: Story = {
|
|
85
|
+
args: {
|
|
86
|
+
radius: 150,
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Large color wheel gradient
|
|
92
|
+
*/
|
|
93
|
+
export const Large: Story = {
|
|
94
|
+
args: {
|
|
95
|
+
radius: 250,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Color wheel gradient with custom translation in both directions
|
|
101
|
+
*/
|
|
102
|
+
export const Translated: Story = {
|
|
103
|
+
args: {
|
|
104
|
+
radius: 150,
|
|
105
|
+
translateX: 30,
|
|
106
|
+
translateY: -30,
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Color wheel gradient with minimal blur
|
|
112
|
+
*/
|
|
113
|
+
export const MinimalBlur: Story = {
|
|
114
|
+
args: {
|
|
115
|
+
radius: 200,
|
|
116
|
+
blurSize: 10,
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Color wheel gradient with no blur (sharp edges)
|
|
122
|
+
*/
|
|
123
|
+
export const NoBlur: Story = {
|
|
124
|
+
args: {
|
|
125
|
+
radius: 200,
|
|
126
|
+
blurSize: 0,
|
|
127
|
+
},
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Animated rotating color wheel gradient
|
|
132
|
+
*/
|
|
133
|
+
export const AnimatedRotation: Story = {
|
|
134
|
+
args: {
|
|
135
|
+
radius: 180,
|
|
136
|
+
},
|
|
137
|
+
render: (args) => (
|
|
138
|
+
<ColorWheelGradient
|
|
139
|
+
{...args}
|
|
140
|
+
style={{
|
|
141
|
+
animation: 'rotate 4s linear infinite',
|
|
142
|
+
}}
|
|
143
|
+
/>
|
|
144
|
+
),
|
|
145
|
+
parameters: {
|
|
146
|
+
docs: {
|
|
147
|
+
description: {
|
|
148
|
+
story: 'This story demonstrates a continuously rotating color wheel gradient using CSS animation.',
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export interface ColorWheelGradientProps {
|
|
4
|
+
translateX?: number;
|
|
5
|
+
translateY?: number;
|
|
6
|
+
rotation?: number;
|
|
7
|
+
radius?: number;
|
|
8
|
+
blurSize?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const ColorWheelGradient = styled.div<ColorWheelGradientProps>`
|
|
12
|
+
${({ radius, rotation = 0, blurSize = 40, translateX = 0, translateY = 0 }) => `
|
|
13
|
+
z-index: 1;
|
|
14
|
+
position: absolute;
|
|
15
|
+
width: ${radius ? `${radius}px` : 'auto'};
|
|
16
|
+
height: ${radius ? `${radius}px` : 'auto'};
|
|
17
|
+
transform-origin: center;
|
|
18
|
+
transform: translate(${translateX}px, ${translateY}px) rotate(${rotation}deg);
|
|
19
|
+
|
|
20
|
+
opacity: 0.30;
|
|
21
|
+
background: conic-gradient(
|
|
22
|
+
rgba(93, 133, 225, 0.99) 0deg,
|
|
23
|
+
rgba(106, 20, 222, 0.99) 69deg,
|
|
24
|
+
rgba(228, 68, 103, 0.99) 150deg,
|
|
25
|
+
rgba(250, 129, 54, 0.99) 221deg,
|
|
26
|
+
rgba(240, 178, 27, 0.99) 287deg,
|
|
27
|
+
rgba(18, 150, 111, 0.99) 360deg
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
border-radius: 50%;
|
|
31
|
+
filter: blur(${blurSize}px)
|
|
32
|
+
`}
|
|
33
|
+
`;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './color_wheel_gradient';
|
package/src/components/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ export * from './link';
|
|
|
10
10
|
export * from './action_link';
|
|
11
11
|
export * from './simple_markdown';
|
|
12
12
|
export * from './code';
|
|
13
|
+
export * from './color_wheel_gradient';
|
|
13
14
|
export * from './readme_renderer';
|
|
14
15
|
export * from './card';
|
|
15
16
|
export * from './markdown';
|
|
@@ -17,7 +18,9 @@ export * from './pagination';
|
|
|
17
18
|
export * from './tab_number_chip';
|
|
18
19
|
export * from './tile';
|
|
19
20
|
export * from './blog_article';
|
|
21
|
+
export * from './banner';
|
|
20
22
|
export * from './actor_template_card';
|
|
23
|
+
export * from './chip';
|
|
21
24
|
export * from './image';
|
|
22
25
|
export * from './rating';
|
|
23
26
|
export * from './badge';
|
|
@@ -13,7 +13,7 @@ import { Link, type RegularLinkProps } from '../link';
|
|
|
13
13
|
import { Text } from '../text';
|
|
14
14
|
import { type SharedTextSize, type SharedTextType } from '../text';
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
type TagSize = SharedTextSize;
|
|
17
17
|
export const TAG_SIZES: TagSize[] = ['big', 'regular', 'small'];
|
|
18
18
|
|
|
19
19
|
const TAG_ICON_SIZES = {
|