@latte-macchiat-io/latte-vanilla-components 0.0.512 → 0.0.514
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/package.json +1 -1
- package/src/components/Box/Alert/index.tsx +1 -2
- package/src/components/Box/Alert/stories.tsx +14 -2
- package/src/components/Box/Alert/theme.ts +12 -11
- package/src/components/Box/index.tsx +1 -1
- package/src/components/Box/stories.tsx +8 -0
- package/src/components/Box/styles.css.ts +1 -11
package/package.json
CHANGED
|
@@ -13,10 +13,9 @@ export type AlertBoxProps = React.HTMLAttributes<HTMLDivElement> &
|
|
|
13
13
|
AlertBoxVariants & {
|
|
14
14
|
noIcon?: boolean;
|
|
15
15
|
icon?: string | React.ReactNode;
|
|
16
|
-
title?: string | null;
|
|
17
16
|
};
|
|
18
17
|
|
|
19
|
-
export const AlertBox = ({ noIcon = false, variant = 'info', className, icon =
|
|
18
|
+
export const AlertBox = ({ noIcon = false, variant = 'info', className, icon = icons.info, children }: AlertBoxProps) => (
|
|
20
19
|
<Box direction="row" className={cn(alertBox({ variant }), className)}>
|
|
21
20
|
{!noIcon &&
|
|
22
21
|
(typeof icon === 'string' ? (
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
2
|
|
|
3
|
+
import { Heading } from '../../Heading';
|
|
4
|
+
import { Paragraph } from '../../Paragraph';
|
|
3
5
|
import { AlertBox } from '.';
|
|
4
6
|
|
|
5
7
|
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
@@ -27,7 +29,17 @@ type Story = StoryObj<typeof meta>;
|
|
|
27
29
|
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
|
28
30
|
export const Default: Story = {
|
|
29
31
|
args: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
children: (
|
|
33
|
+
<>
|
|
34
|
+
<Heading as="h3">Lorem ipsum</Heading>
|
|
35
|
+
<Paragraph>
|
|
36
|
+
<p>
|
|
37
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
|
|
38
|
+
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
|
39
|
+
voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
40
|
+
</p>
|
|
41
|
+
</Paragraph>
|
|
42
|
+
</>
|
|
43
|
+
),
|
|
32
44
|
},
|
|
33
45
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { alertColorDanger, alertColorInfo, alertColorSuccess, alertColorWarning } from '../../../styles/colors';
|
|
2
|
+
|
|
1
3
|
const themeBoxBase = {
|
|
2
4
|
boxAlert: {},
|
|
3
5
|
};
|
|
@@ -5,14 +7,12 @@ const themeBoxBase = {
|
|
|
5
7
|
export const themeBoxAlertLight = {
|
|
6
8
|
boxAlert: {
|
|
7
9
|
...themeBoxBase.boxAlert,
|
|
10
|
+
|
|
8
11
|
variant: {
|
|
9
|
-
warning: {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
13
|
-
info: { iconColor: '', backgroundColor: '#FF0000' },
|
|
14
|
-
success: { iconColor: '', backgroundColor: '' },
|
|
15
|
-
danger: { iconColor: '', backgroundColor: '' },
|
|
12
|
+
warning: { iconColor: '', backgroundColor: alertColorWarning },
|
|
13
|
+
info: { iconColor: '', backgroundColor: alertColorInfo },
|
|
14
|
+
success: { iconColor: '', backgroundColor: alertColorSuccess },
|
|
15
|
+
danger: { iconColor: '', backgroundColor: alertColorDanger },
|
|
16
16
|
},
|
|
17
17
|
},
|
|
18
18
|
};
|
|
@@ -20,11 +20,12 @@ export const themeBoxAlertLight = {
|
|
|
20
20
|
export const themeBoxAlertDark = {
|
|
21
21
|
boxAlert: {
|
|
22
22
|
...themeBoxBase.boxAlert,
|
|
23
|
+
|
|
23
24
|
variant: {
|
|
24
|
-
warning: { iconColor: '', backgroundColor:
|
|
25
|
-
info: { iconColor: '', backgroundColor:
|
|
26
|
-
success: { iconColor: '', backgroundColor:
|
|
27
|
-
danger: { iconColor: '', backgroundColor:
|
|
25
|
+
warning: { iconColor: '', backgroundColor: alertColorWarning },
|
|
26
|
+
info: { iconColor: '', backgroundColor: alertColorInfo },
|
|
27
|
+
success: { iconColor: '', backgroundColor: alertColorSuccess },
|
|
28
|
+
danger: { iconColor: '', backgroundColor: alertColorDanger },
|
|
28
29
|
},
|
|
29
30
|
},
|
|
30
31
|
};
|
|
@@ -15,7 +15,7 @@ export type BoxProps = React.HTMLAttributes<HTMLDivElement> &
|
|
|
15
15
|
background?: string;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export const Box = ({ align, vAlign, children, variant, isLight, className, direction, isReversed, paddingTop }: BoxProps) => {
|
|
18
|
+
export const Box = ({ align, vAlign, children, variant = 'primary', isLight, className, direction, isReversed, paddingTop }: BoxProps) => {
|
|
19
19
|
return (
|
|
20
20
|
<div className={cn(box({ variant, paddingTop }), className)}>
|
|
21
21
|
<div className={boxContent({ vAlign, isLight, align, direction, isReversed })}>{children}</div>
|
|
@@ -17,7 +17,13 @@ const meta: Meta<typeof Box> = {
|
|
|
17
17
|
tags: ['autodocs'],
|
|
18
18
|
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
19
19
|
argTypes: {
|
|
20
|
+
variant: {
|
|
21
|
+
options: ['primary', 'secondary', 'transparent'],
|
|
22
|
+
},
|
|
20
23
|
isLight: { control: 'boolean' },
|
|
24
|
+
paddingTop: {
|
|
25
|
+
options: ['small', 'medium', 'large'],
|
|
26
|
+
},
|
|
21
27
|
isReversed: { control: 'boolean' },
|
|
22
28
|
},
|
|
23
29
|
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
@@ -30,6 +36,8 @@ type Story = StoryObj<typeof meta>;
|
|
|
30
36
|
export const Default: Story = {
|
|
31
37
|
args: {
|
|
32
38
|
variant: 'primary',
|
|
39
|
+
isLight: false,
|
|
40
|
+
isReversed: false,
|
|
33
41
|
children: (
|
|
34
42
|
<>
|
|
35
43
|
<Heading as="h3">Lorem ipsum</Heading>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { style } from '@vanilla-extract/css';
|
|
2
2
|
import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
|
|
3
3
|
import { queries, themeContract } from '@latte-macchiat-io/latte-vanilla-components';
|
|
4
4
|
|
|
@@ -83,12 +83,6 @@ export const boxContent = recipe({
|
|
|
83
83
|
display: 'flex',
|
|
84
84
|
maxWidth: '100%',
|
|
85
85
|
flexDirection: 'column',
|
|
86
|
-
|
|
87
|
-
'@media': {
|
|
88
|
-
...generateResponsiveMedia({
|
|
89
|
-
gap: themeContract.box.gap,
|
|
90
|
-
}),
|
|
91
|
-
},
|
|
92
86
|
},
|
|
93
87
|
],
|
|
94
88
|
variants: {
|
|
@@ -168,9 +162,5 @@ export const boxContent = recipe({
|
|
|
168
162
|
},
|
|
169
163
|
});
|
|
170
164
|
|
|
171
|
-
globalStyle(`${boxBase} h1, ${boxBase} h2, ${boxBase} h3, ${boxBase} h4, ${boxBase} h5, ${boxBase} h6 `, {
|
|
172
|
-
paddingBottom: 0,
|
|
173
|
-
});
|
|
174
|
-
|
|
175
165
|
export type BoxVariants = RecipeVariants<typeof box>;
|
|
176
166
|
export type BoxContentVariants = RecipeVariants<typeof boxContent>;
|