@latte-macchiat-io/latte-vanilla-components 0.0.468 → 0.0.470

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latte-macchiat-io/latte-vanilla-components",
3
- "version": "0.0.468",
3
+ "version": "0.0.470",
4
4
  "description": "Beautiful components for amazing projects, with a touch of Vanilla 🥤",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -1,26 +1,27 @@
1
- import { alertBox, alertBoxContent } from './styles.css';
1
+ import { alertBox, alertBoxContent, AlertBoxVariants } from './styles.css';
2
2
 
3
3
  import { Box } from '..';
4
4
 
5
5
  import { themeContract } from '../../../theme/contract.css';
6
6
 
7
7
  import { cn } from '../../../utils/styleOverride';
8
+
8
9
  import { Heading } from '../../Heading';
9
10
  import { Icon } from '../../Icon';
10
11
  import icons from '../../Icon/path';
11
12
  import { Paragraph } from '../../Paragraph';
12
13
 
13
- export type AlertBoxProps = React.HTMLAttributes<HTMLDivElement> & {
14
- text: string;
15
- noIcon?: boolean;
16
- title?: string | null;
17
- variant?: 'info';
18
- };
14
+ export type AlertBoxProps = React.HTMLAttributes<HTMLDivElement> &
15
+ AlertBoxVariants & {
16
+ text: string;
17
+ noIcon?: boolean;
18
+ title?: string | null;
19
+ };
19
20
 
20
21
  export const AlertBox = ({ title, text, noIcon = false, variant = 'info', className }: AlertBoxProps) => {
21
22
  return (
22
- <Box direction="row" className={cn(alertBox({ variant }), className)}>
23
- {!noIcon && <Icon iconPath={icons.close} size={50} color={themeContract.boxAlert.variant[variant].iconColor} />}
23
+ <Box direction="row" className={className}>
24
+ {!noIcon && <Icon iconPath={icons[variant]} size={50} color={themeContract.boxAlert.variant[variant].iconColor} />}
24
25
  <div className={alertBoxContent}>
25
26
  {title && <Heading as="h4">{title}</Heading>}
26
27
  <Paragraph>{text}</Paragraph>
@@ -1,29 +1,29 @@
1
- // import type { Meta, StoryObj } from '@storybook/react-vite';
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
 
3
- // import { AlertBox } from '.';
3
+ import { AlertBox } from '.';
4
4
 
5
- // // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
6
- // const meta: Meta<typeof AlertBox> = {
7
- // title: 'Latte Components / 1. Global / AlertBox',
8
- // component: AlertBox,
9
- // parameters: {
10
- // // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
11
- // layout: 'centered',
12
- // },
13
- // // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
14
- // tags: ['autodocs'],
15
- // // More on argTypes: https://storybook.js.org/docs/api/argtypes
16
- // argTypes: {},
17
- // // 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
18
- // };
5
+ // More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
6
+ const meta: Meta<typeof AlertBox> = {
7
+ title: 'Latte Components / 1. Global / AlertBox',
8
+ component: AlertBox,
9
+ parameters: {
10
+ // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
11
+ layout: 'centered',
12
+ },
13
+ // This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
14
+ tags: ['autodocs'],
15
+ // More on argTypes: https://storybook.js.org/docs/api/argtypes
16
+ argTypes: {},
17
+ // 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
18
+ };
19
19
 
20
- // export default meta;
21
- // type Story = StoryObj<typeof meta>;
20
+ export default meta;
21
+ type Story = StoryObj<typeof meta>;
22
22
 
23
- // // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
24
- // export const Default: Story = {
25
- // args: {
26
- // title: 'Lorem ipsum',
27
- // text: 'Lorem ipsum Lorem ipsum',
28
- // },
29
- // };
23
+ // More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
24
+ export const Default: Story = {
25
+ args: {
26
+ title: 'Lorem ipsum',
27
+ text: 'Lorem ipsum Lorem ipsum',
28
+ },
29
+ };
@@ -1,12 +1,8 @@
1
- // import { globalStyle, style } from '@vanilla-extract/css';
1
+ import { globalStyle, style } from '@vanilla-extract/css';
2
+ import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
2
3
 
3
- import { style } from '@vanilla-extract/css';
4
- import { recipe } from '@vanilla-extract/recipes';
5
4
  import { themeContract } from '../../../theme/contract.css';
6
-
7
- // import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
8
- // import { themeContract } from '../../../theme/contract.css';
9
- // import { generateResponsiveMedia } from '../../../utils/generateResponsiveMedia';
5
+ import { generateResponsiveMedia } from '../../../utils/generateResponsiveMedia';
10
6
 
11
7
  export const alertBox = recipe({
12
8
  base: {},
@@ -26,18 +22,21 @@ export const alertBox = recipe({
26
22
  },
27
23
  },
28
24
  },
25
+ defaultVariants: {
26
+ variant: 'warning',
27
+ },
29
28
  });
30
29
 
31
- // globalStyle(`${alertBox} > div `, {
32
- // flexDirection: 'row',
30
+ globalStyle(`${alertBox} > div `, {
31
+ flexDirection: 'row',
33
32
 
34
- // '@media': generateResponsiveMedia({
35
- // gap: themeContract.box.gap,
36
- // }),
37
- // });
33
+ '@media': generateResponsiveMedia({
34
+ gap: themeContract.box.gap,
35
+ }),
36
+ });
38
37
 
39
38
  export const alertBoxContent = style({
40
39
  width: '100%',
41
40
  });
42
41
 
43
- // export type AlertBoxVariants = RecipeVariants<typeof alertBox>;
42
+ export type AlertBoxVariants = RecipeVariants<typeof alertBox>;
@@ -8,6 +8,14 @@ const icons = {
8
8
  arrowForward:
9
9
  'M5 13h11.17l-4.88 4.88c-.39.39-.39 1.03 0 1.42s1.02.39 1.41 0l6.59-6.59c.39-.39.39-1.02 0-1.41l-6.58-6.6a.996.996 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41L16.17 11H5c-.55 0-1 .45-1 1s.45 1 1 1',
10
10
 
11
+ warning:
12
+ 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 11c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1m1 4h-2v-2h2z',
13
+ info: 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 15c-.55 0-1-.45-1-1v-4c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1m1-8h-2V7h2z',
14
+ success:
15
+ 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M9.29 16.29 5.7 12.7a.996.996 0 0 1 0-1.41c.39-.39 1.02-.39 1.41 0L10 14.17l6.88-6.88c.39-.39 1.02-.39 1.41 0s.39 1.02 0 1.41l-7.59 7.59c-.38.39-1.02.39-1.41 0',
16
+ danger:
17
+ 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 11c-.55 0-1-.45-1-1V8c0-.55.45-1 1-1s1 .45 1 1v4c0 .55-.45 1-1 1m1 4h-2v-2h2z',
18
+
11
19
  //video
12
20
  play: 'M8 5v14l11-7z',
13
21
  pause: 'M6 19h4V5H6zm8-14v14h4V5z',
@@ -1 +0,0 @@
1
- export type AlertVariant = 'warning' | 'info' | 'success' | 'danger';