enwawa-ui 1.0.7

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.
Files changed (115) hide show
  1. package/.babelrc.json +16 -0
  2. package/.eslintrc.cjs +37 -0
  3. package/.husky/pre-commit +6 -0
  4. package/.prettierignore +6 -0
  5. package/.prettierrc +4 -0
  6. package/.storybook/main.ts +21 -0
  7. package/.storybook/preview.tsx +57 -0
  8. package/.vscode/settings.json +14 -0
  9. package/CHANGELOG.md +118 -0
  10. package/auto.config.ts +34 -0
  11. package/constants.ts +1 -0
  12. package/createIndexes.js +34 -0
  13. package/index.ts +5 -0
  14. package/package.json +94 -0
  15. package/placeholder.ts +1 -0
  16. package/readme.md +1 -0
  17. package/rollup.config.mjs +48 -0
  18. package/stories/Introduction.mdx +221 -0
  19. package/stories/assets/backgrounds/bg-1.png +0 -0
  20. package/stories/assets/carousel/login/1st.png +0 -0
  21. package/stories/assets/icons/code-brackets.svg +1 -0
  22. package/stories/assets/icons/colors.svg +1 -0
  23. package/stories/assets/icons/comments.svg +1 -0
  24. package/stories/assets/icons/direction.svg +1 -0
  25. package/stories/assets/icons/flow.svg +1 -0
  26. package/stories/assets/icons/plugin.svg +1 -0
  27. package/stories/assets/icons/repo.svg +1 -0
  28. package/stories/assets/icons/stackalt.svg +1 -0
  29. package/stories/assets/icons/wawa-isotype.svg +4 -0
  30. package/stories/assets/icons/wawa-logo.svg +6 -0
  31. package/stories/atoms/AtAvatar/AtAvatar.stories.tsx +61 -0
  32. package/stories/atoms/AtAvatar/index.tsx +46 -0
  33. package/stories/atoms/AtButton/AtButton.stories.ts +88 -0
  34. package/stories/atoms/AtButton/index.tsx +69 -0
  35. package/stories/atoms/AtButton/styles.ts +13 -0
  36. package/stories/atoms/AtCheckBox/AtCheckBox.stories.tsx +30 -0
  37. package/stories/atoms/AtCheckBox/index.tsx +38 -0
  38. package/stories/atoms/AtDatePicker/AtDatePicker.stories.tsx +45 -0
  39. package/stories/atoms/AtDatePicker/index.tsx +93 -0
  40. package/stories/atoms/AtDivider/AtDivider.stories.tsx +57 -0
  41. package/stories/atoms/AtDivider/index.tsx +44 -0
  42. package/stories/atoms/AtImage/AtImage.stories.tsx +66 -0
  43. package/stories/atoms/AtImage/index.tsx +41 -0
  44. package/stories/atoms/AtLogo/AtLogo.stories.ts +47 -0
  45. package/stories/atoms/AtLogo/index.tsx +22 -0
  46. package/stories/atoms/AtLogo/styles.ts +26 -0
  47. package/stories/atoms/AtNumberInput/AtNumberInput.stories.ts +40 -0
  48. package/stories/atoms/AtNumberInput/index.tsx +138 -0
  49. package/stories/atoms/AtNumberInput/styles.tsx +7 -0
  50. package/stories/atoms/AtPasswordInput/AtPasswordInput.stories.ts +24 -0
  51. package/stories/atoms/AtPasswordInput/index.tsx +11 -0
  52. package/stories/atoms/AtRadio/AtRadio.stories.tsx +36 -0
  53. package/stories/atoms/AtRadio/index.tsx +44 -0
  54. package/stories/atoms/AtSelect/AtSelect.stories.tsx +132 -0
  55. package/stories/atoms/AtSelect/index.tsx +229 -0
  56. package/stories/atoms/AtSelect/styles.tsx +8 -0
  57. package/stories/atoms/AtText/AtText.stories.ts +104 -0
  58. package/stories/atoms/AtText/index.tsx +65 -0
  59. package/stories/atoms/AtTextInput/AtTextInput.stories.ts +40 -0
  60. package/stories/atoms/AtTextInput/index.tsx +85 -0
  61. package/stories/atoms/AtTitle/AtTitle.stories.ts +103 -0
  62. package/stories/atoms/AtTitle/index.tsx +77 -0
  63. package/stories/atoms/AtTitle/styles.ts +7 -0
  64. package/stories/atoms/index.ts +14 -0
  65. package/stories/molecules/MlBreadCrumb/MlBreadCrumb.stories.tsx +123 -0
  66. package/stories/molecules/MlBreadCrumb/index.tsx +29 -0
  67. package/stories/molecules/MlCard/MlCard.stories.tsx +55 -0
  68. package/stories/molecules/MlCard/index.tsx +100 -0
  69. package/stories/molecules/MlCard/styles.tsx +22 -0
  70. package/stories/molecules/MlCarousel/MlCarousel.stories.tsx +98 -0
  71. package/stories/molecules/MlCarousel/index.tsx +67 -0
  72. package/stories/molecules/MlDropdown/MlDropdown.stories.tsx +121 -0
  73. package/stories/molecules/MlDropdown/index.tsx +97 -0
  74. package/stories/molecules/MlFormItem/MlFormItem.stories.tsx +33 -0
  75. package/stories/molecules/MlFormItem/index.tsx +100 -0
  76. package/stories/molecules/MlRadioGroup/MlRadioGroup.stories.ts +40 -0
  77. package/stories/molecules/MlRadioGroup/index.tsx +60 -0
  78. package/stories/molecules/index.ts +6 -0
  79. package/stories/organisms/OrAlert/OrAlert.stories.tsx +136 -0
  80. package/stories/organisms/OrAlert/index.tsx +64 -0
  81. package/stories/organisms/OrCol/OrCol.stories.tsx +33 -0
  82. package/stories/organisms/OrCol/index.tsx +108 -0
  83. package/stories/organisms/OrCol/styles.ts +86 -0
  84. package/stories/organisms/OrContent/index.tsx +6 -0
  85. package/stories/organisms/OrCountryCard/OrCountryCard.stories.ts +19 -0
  86. package/stories/organisms/OrCountryCard/index.tsx +55 -0
  87. package/stories/organisms/OrFlagGrid/OrFlagGrid.stories.ts +41 -0
  88. package/stories/organisms/OrFlagGrid/index.tsx +54 -0
  89. package/stories/organisms/OrFrom/index.tsx +10 -0
  90. package/stories/organisms/OrHeader/index.tsx +6 -0
  91. package/stories/organisms/OrLayout/index.tsx +6 -0
  92. package/stories/organisms/OrLoginLayout/OrLoginLayout.stories.tsx +34 -0
  93. package/stories/organisms/OrLoginLayout/index.tsx +63 -0
  94. package/stories/organisms/OrLoginLayout/styles.tsx +16 -0
  95. package/stories/organisms/OrRow/OrRow.stories.tsx +48 -0
  96. package/stories/organisms/OrRow/index.tsx +71 -0
  97. package/stories/organisms/OrRow/styles.ts +24 -0
  98. package/stories/organisms/OrSider/index.tsx +6 -0
  99. package/stories/organisms/OrSimpleBanner/OrSimpleBanner.stories.ts +18 -0
  100. package/stories/organisms/OrSimpleBanner/index.tsx +26 -0
  101. package/stories/organisms/OrSimpleBanner/styles.ts +12 -0
  102. package/stories/organisms/OrSpace/OrSpace.stories.tsx +169 -0
  103. package/stories/organisms/OrSpace/index.tsx +43 -0
  104. package/stories/organisms/OrSpaceCompact/OrSpaceCompact.stories.tsx +94 -0
  105. package/stories/organisms/OrSpaceCompact/index.tsx +35 -0
  106. package/stories/organisms/index.ts +14 -0
  107. package/stories/templates/TmLoginCountry/TmLoginCountry.stories.ts +44 -0
  108. package/stories/templates/TmLoginCountry/index.tsx +64 -0
  109. package/stories/templates/TmLoginCountry/styles.tsx +14 -0
  110. package/stories/templates/TmLoginPhone/TmLoginPhone.stories.tsx +49 -0
  111. package/stories/templates/TmLoginPhone/index.tsx +191 -0
  112. package/stories/templates/TmLoginPhone/styles.tsx +31 -0
  113. package/stories/templates/index.ts +2 -0
  114. package/theme.tsx +56 -0
  115. package/tsconfig.json +38 -0
@@ -0,0 +1,85 @@
1
+ import React, { ChangeEvent, ReactNode } from 'react';
2
+ import { Input } from 'antd';
3
+
4
+ export interface AtTextInputProps {
5
+ /**
6
+ * The label text displayed after (on the right side of) the input field
7
+ */
8
+ addonAfter?: ReactNode;
9
+ /**
10
+ * The label text displayed before (on the left side of) the input field
11
+ */
12
+ addonBefore?: ReactNode;
13
+ /**
14
+ * If allow to remove input content with clear icon
15
+ */
16
+ allowClear?: boolean | { clearIcon?: ReactNode };
17
+ /**
18
+ * Whether has border style
19
+ */
20
+ bordered?: boolean;
21
+ /**
22
+ * The initial input content
23
+ */
24
+ defaultValue?: string;
25
+ /**
26
+ * Whether the input is disabled
27
+ */
28
+ disabled?: boolean;
29
+ /**
30
+ * The ID for input
31
+ */
32
+ id?: string;
33
+ /**
34
+ * The maximum number of characters in Input
35
+ */
36
+ maxLength?: number;
37
+ /**
38
+ * Set validation status
39
+ */
40
+ status?: 'error' | 'warning' | undefined;
41
+ /**
42
+ * Whether to show character count
43
+ */
44
+ showCount?: boolean;
45
+ /**
46
+ * Placeholder text to display into the input
47
+ */
48
+ placeholder?: string;
49
+ /**
50
+ * The prefix icon for the Input
51
+ */
52
+ prefix?: ReactNode;
53
+ /**
54
+ * The size of the input box. Note: in the context of a form, the middle size is used
55
+ */
56
+ size?: 'large' | 'middle' | 'small';
57
+ /**
58
+ * The suffix icon for the Input
59
+ */
60
+ suffix?: ReactNode;
61
+ /**
62
+ * The input content value
63
+ */
64
+ value?: string;
65
+ /**
66
+ * Callback when user input
67
+ */
68
+ onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
69
+ }
70
+
71
+ /**
72
+ * Primary input UI component for user interaction
73
+ */
74
+ export const AtTextInput: React.FC<AtTextInputProps> = (props) => {
75
+ return <Input {...props} />;
76
+ };
77
+
78
+ AtTextInput.defaultProps = {
79
+ allowClear: false,
80
+ bordered: true,
81
+ size: 'middle',
82
+ status: undefined,
83
+ disabled: false,
84
+ showCount: false,
85
+ };
@@ -0,0 +1,103 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { AtTitle } from '.';
3
+
4
+ const meta: Meta = {
5
+ title: 'Atoms/AtTitle',
6
+ component: AtTitle,
7
+ tags: ['autodocs'],
8
+ argTypes: {
9
+ type: {
10
+ options: ['none', 'secondary', 'success', 'warning', 'danger'],
11
+ },
12
+ copyable: {
13
+ control: 'boolean',
14
+ },
15
+ editable: {
16
+ control: 'boolean',
17
+ },
18
+ ellipsis: {
19
+ control: 'boolean',
20
+ },
21
+ level: {
22
+ control: {
23
+ type: 'select',
24
+ labels: {
25
+ 1: 'h1',
26
+ 2: 'h2',
27
+ 3: 'h3',
28
+ 4: 'h4',
29
+ 5: 'h5',
30
+ },
31
+ },
32
+ },
33
+ onClick: {
34
+ control: 'none',
35
+ },
36
+ },
37
+ };
38
+
39
+ export default meta;
40
+
41
+ type Story = StoryObj<typeof meta>;
42
+
43
+ export const Base: Story = {
44
+ args: {
45
+ children: 'Title',
46
+ },
47
+ };
48
+
49
+ export const Secondary: Story = {
50
+ args: {
51
+ type: 'secondary',
52
+ children: 'Secondary',
53
+ },
54
+ };
55
+
56
+ export const Danger: Story = {
57
+ args: {
58
+ type: 'danger',
59
+ children: 'Danger',
60
+ },
61
+ };
62
+
63
+ export const Code: Story = {
64
+ args: {
65
+ code: true,
66
+ children: 'Code',
67
+ },
68
+ };
69
+
70
+ export const Copyable: Story = {
71
+ args: {
72
+ copyable: true,
73
+ children: 'Copyable',
74
+ },
75
+ };
76
+
77
+ export const Editable: Story = {
78
+ args: {
79
+ editable: true,
80
+ children: 'Editable',
81
+ },
82
+ };
83
+
84
+ export const Mark: Story = {
85
+ args: {
86
+ mark: true,
87
+ children: 'Mark',
88
+ },
89
+ };
90
+
91
+ export const Italic: Story = {
92
+ args: {
93
+ italic: true,
94
+ children: 'Italic',
95
+ },
96
+ };
97
+
98
+ export const Underline: Story = {
99
+ args: {
100
+ underline: true,
101
+ children: 'Underline',
102
+ },
103
+ };
@@ -0,0 +1,77 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { Typography } from 'antd';
3
+ import { BlockProps, EllipsisConfig, BaseType } from 'antd/es/typography/Base';
4
+
5
+ export interface AtTitleProps {
6
+ /**
7
+ * Code style
8
+ */
9
+ code?: boolean;
10
+ /**
11
+ * Whether to be copyable, customize it via setting an object
12
+ */
13
+ copyable?: boolean | BlockProps['copyable'];
14
+ /**
15
+ * Deleted line style
16
+ */
17
+ delete?: boolean;
18
+ /**
19
+ * Disabled content
20
+ */
21
+ disabled?: boolean;
22
+ /**
23
+ * If editable. Can control edit state when is object
24
+ */
25
+ editable?: boolean | BlockProps['editable'];
26
+ /**
27
+ * Display ellipsis when text overflows, can configure rows and expandable by using object
28
+ */
29
+ ellipsis?: boolean | EllipsisConfig;
30
+ /**
31
+ * Set content importance. Match with h1, h2, h3, h4, h5
32
+ */
33
+ level?: 1 | 2 | 3 | 4 | 5;
34
+ /**
35
+ * Whether the text is mark or not
36
+ */
37
+ mark?: boolean;
38
+ /**
39
+ * Set the handler to handle click event
40
+ */
41
+ onClick?: React.MouseEventHandler<HTMLAnchorElement>;
42
+ /**
43
+ * Whether the text is italic or not
44
+ */
45
+ italic?: boolean;
46
+ /**
47
+ * Content type
48
+ */
49
+ type?: BaseType;
50
+ /**
51
+ * Whether the text is underline or not
52
+ */
53
+ underline?: boolean;
54
+ /**
55
+ * Additional content to include
56
+ */
57
+ children?: ReactNode;
58
+ /**
59
+ * Color of the title
60
+ */
61
+ color?: 'violet' | 'gold' | 'white';
62
+ }
63
+
64
+ export const AtTitle: React.FC<AtTitleProps> = (props) => {
65
+ return <Typography.Title {...props}>{props.children}</Typography.Title>;
66
+ };
67
+
68
+ AtTitle.defaultProps = {
69
+ code: false,
70
+ copyable: false,
71
+ delete: false,
72
+ editable: false,
73
+ level: 1,
74
+ mark: false,
75
+ italic: false,
76
+ underline: false,
77
+ };
@@ -0,0 +1,7 @@
1
+ import { Typography } from 'antd';
2
+ import { styled } from 'styled-components';
3
+ import { AtTitleProps } from '.';
4
+
5
+ export const StyledTitle = styled(Typography.Title) <AtTitleProps>`
6
+ font-weight: ${({ level }) => (level === 1 ? 700 : 500)};
7
+ `;
@@ -0,0 +1,14 @@
1
+ export * from './AtAvatar';
2
+ export * from './AtButton';
3
+ export * from './AtCheckBox';
4
+ export * from './AtDatePicker';
5
+ export * from './AtDivider';
6
+ export * from './AtImage';
7
+ export * from './AtLogo';
8
+ export * from './AtNumberInput';
9
+ export * from './AtPasswordInput';
10
+ export * from './AtRadio';
11
+ export * from './AtSelect';
12
+ export * from './AtText';
13
+ export * from './AtTextInput';
14
+ export * from './AtTitle';
@@ -0,0 +1,123 @@
1
+ import React from 'react';
2
+ import { Meta, StoryObj } from '@storybook/react';
3
+ import { MlBreadcrumb } from '.';
4
+
5
+ const meta = {
6
+ title: 'Molecules/MlBreadcrumb',
7
+ component: MlBreadcrumb,
8
+ tags: ['autodocs'],
9
+ argTypes: {},
10
+ } satisfies Meta<typeof MlBreadcrumb>;
11
+
12
+ export default meta;
13
+ type Story = StoryObj<typeof meta>;
14
+
15
+ const items = [
16
+ {
17
+ title: 'Home',
18
+ },
19
+ {
20
+ title: <a href="">Application Center</a>,
21
+ },
22
+ {
23
+ title: <a href="">Application List</a>,
24
+ },
25
+ {
26
+ title: 'An Application',
27
+ },
28
+ ];
29
+
30
+ const menuItems = [
31
+ {
32
+ key: '1',
33
+ label: (
34
+ <a
35
+ target="_blank"
36
+ rel="noopener noreferrer"
37
+ href="https://www.youtube.com/"
38
+ >
39
+ General
40
+ </a>
41
+ ),
42
+ },
43
+ {
44
+ key: '2',
45
+ label: (
46
+ <a
47
+ target="_blank"
48
+ rel="noopener noreferrer"
49
+ href="https://www.youtube.com/"
50
+ >
51
+ Layout
52
+ </a>
53
+ ),
54
+ },
55
+ {
56
+ key: '3',
57
+ label: (
58
+ <a
59
+ target="_blank"
60
+ rel="noopener noreferrer"
61
+ href="https://www.youtube.com/"
62
+ >
63
+ Navigation
64
+ </a>
65
+ ),
66
+ },
67
+ ];
68
+
69
+ export const Basic: Story = {
70
+ args: {
71
+ items: items,
72
+ },
73
+ };
74
+
75
+ export const CustomItemRender: Story = {
76
+ args: {
77
+ items: items,
78
+ itemRender: (route, params, routes, paths) => {
79
+ const last = routes.indexOf(route) === routes.length - 1;
80
+ return last ? (
81
+ <span>{route.title}</span>
82
+ ) : (
83
+ <a href={paths.join('/')}>{route.title}</a>
84
+ );
85
+ },
86
+ },
87
+ };
88
+
89
+ export const WithParams: Story = {
90
+ args: {
91
+ items: items,
92
+ params: {
93
+ id: '123',
94
+ },
95
+ },
96
+ };
97
+
98
+ export const WithSeparator: Story = {
99
+ args: {
100
+ items: items,
101
+ separator: '>',
102
+ },
103
+ };
104
+
105
+ export const WithDropdown: Story = {
106
+ args: {
107
+ items: [
108
+ {
109
+ title: 'Ant Design',
110
+ },
111
+ {
112
+ title: <a href="">Component</a>,
113
+ },
114
+ {
115
+ title: <a href="">General</a>,
116
+ menu: { items: menuItems },
117
+ },
118
+ {
119
+ title: 'Button',
120
+ },
121
+ ],
122
+ },
123
+ };
@@ -0,0 +1,29 @@
1
+ import React from 'react';
2
+ import { Breadcrumb, BreadcrumbProps } from 'antd';
3
+
4
+ interface MlBreadcrumbProps {
5
+ /**
6
+ * Custom item renderer
7
+ */
8
+ itemRender?: BreadcrumbProps['itemRender'];
9
+ /**
10
+ * Routing parameters
11
+ */
12
+ params?: Record<string, string>;
13
+ /**
14
+ * The routing stack information of router
15
+ */
16
+ items: BreadcrumbProps['items'];
17
+ /**
18
+ * Separator character
19
+ */
20
+ separator?: BreadcrumbProps['separator'];
21
+ }
22
+
23
+ export const MlBreadcrumb: React.FC<MlBreadcrumbProps> = (props) => {
24
+ return <Breadcrumb {...props} />;
25
+ };
26
+
27
+ MlBreadcrumb.defaultProps = {
28
+ separator: '/',
29
+ };
@@ -0,0 +1,55 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { MlCard } from '.';
3
+ import React from 'react';
4
+
5
+ const meta = {
6
+ title: 'Molecules/MlCard',
7
+ component: MlCard,
8
+ tags: ['autodocs'],
9
+ argTypes: {
10
+ size: {
11
+ options: ['default', 'small'],
12
+ },
13
+ type: {
14
+ options: ['inner'],
15
+ },
16
+ },
17
+ } satisfies Meta<typeof MlCard>;
18
+
19
+ export default meta;
20
+ type Story = StoryObj<typeof meta>;
21
+
22
+ const items = (
23
+ <>
24
+ <p>Card content</p> <p>Card content</p> <p>Card content</p>
25
+ </>
26
+ );
27
+
28
+ export const Basic: Story = {
29
+ args: {
30
+ children: items,
31
+ id: '1',
32
+ },
33
+ };
34
+
35
+ export const Borderless: Story = {
36
+ args: {
37
+ children: items,
38
+ id: '1',
39
+ bordered: false,
40
+ },
41
+ };
42
+ export const Loading: Story = {
43
+ args: {
44
+ children: items,
45
+ id: '1',
46
+ loading: true,
47
+ },
48
+ };
49
+ export const Small: Story = {
50
+ args: {
51
+ children: items,
52
+ id: '1',
53
+ size: 'small',
54
+ },
55
+ };
@@ -0,0 +1,100 @@
1
+ import React, { CSSProperties, ReactNode } from 'react';
2
+ import { CardTabListType } from 'antd/es/card';
3
+ import { CardType } from 'antd/es/card/Card';
4
+ import { TabsProps } from 'antd/es/tabs';
5
+ import { StyledCard } from './styles';
6
+
7
+ export interface MlCardProps {
8
+ /**
9
+ * The ID for input
10
+ */
11
+ id?: string;
12
+ /**
13
+ * The action list, shows at the bottom of the Card
14
+ */
15
+ actions?: Array<ReactNode>;
16
+ /**
17
+ * Current TabPane's key
18
+ */
19
+ activeTabKey?: string;
20
+ /**
21
+ * Inline style to apply to the card content CSSProperties
22
+ */
23
+ bodyStyle?: CSSProperties;
24
+ /**
25
+ * Toggles rendering of the border around the card
26
+ */
27
+ bordered?: boolean;
28
+ /**
29
+ * Card cover
30
+ */
31
+ cover?: ReactNode;
32
+ /**
33
+ * Initial active TabPane's key, if activeTabKey is not set
34
+ */
35
+ defaultActiveTabKey?: string;
36
+ /**
37
+ * Content to render in the top-right corner of the card
38
+ */
39
+ extra?: ReactNode;
40
+ /**
41
+ * Lift up when hovering card
42
+ */
43
+ hoverable?: boolean;
44
+ /**
45
+ * Shows a loading indicator while the contents of the card are being fetched
46
+ */
47
+ loading?: boolean;
48
+ /**
49
+ * Mark item as selected
50
+ */
51
+ selected?: boolean;
52
+ /**
53
+ * Size of card
54
+ */
55
+ size?: 'default' | 'small';
56
+ /**
57
+ * Extra content in tab bar
58
+ */
59
+ tabBarExtraContent?: ReactNode;
60
+ /**
61
+ * List of TabPane's head
62
+ */
63
+ tabList?: CardTabListType[];
64
+ /**
65
+ * Tabs
66
+ */
67
+ tabProps?: TabsProps;
68
+ /**
69
+ * Card title
70
+ */
71
+ title?: ReactNode;
72
+ /**
73
+ * Card style type, can be set to inner or not set
74
+ */
75
+ type?: CardType;
76
+ /**
77
+ * Callback when card is clicked
78
+ */
79
+ onClick?: React.MouseEventHandler<HTMLDivElement>;
80
+ /**
81
+ * Callback when tab is switched
82
+ */
83
+ onTabChange?: (key: string) => void;
84
+ children?: React.ReactElement;
85
+ }
86
+
87
+ /**
88
+ * Primary input UI component for user interaction
89
+ */
90
+ export const MlCard: React.FC<MlCardProps> = (props) => {
91
+ return <StyledCard {...props}>{props.children}</StyledCard>;
92
+ };
93
+
94
+ MlCard.defaultProps = {
95
+ bordered: true,
96
+ hoverable: false,
97
+ loading: false,
98
+ size: 'default',
99
+ selected: false,
100
+ };
@@ -0,0 +1,22 @@
1
+ import { styled } from 'styled-components';
2
+ import { Card } from 'antd';
3
+ import { MlCardProps } from '.';
4
+ import { violet } from '../../../theme';
5
+
6
+ export const StyledCard = styled(Card)<MlCardProps>`
7
+ ${({ selected }) =>
8
+ selected
9
+ ? `
10
+ border-color: ${violet[5]};
11
+ box-shadow: 0 1px 2px -2px rgba(0, 0, 0, 0.16), 0 3px 6px 0 rgba(0, 0, 0, 0.12), 0 5px 12px 4px rgba(0, 0, 0, 0.09);
12
+ `
13
+ : ''}
14
+
15
+ &:hover * {
16
+ ${({ hoverable }) => (hoverable ? `color: ${violet[5]};` : '')}
17
+ }
18
+
19
+ & * {
20
+ ${({ selected }) => (selected ? `color: ${violet[5]};` : '')}
21
+ }
22
+ `;
@@ -0,0 +1,98 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { MlCarousel } from '.';
3
+ import React from 'react';
4
+
5
+ const meta = {
6
+ title: 'Molecules/MlCarousel',
7
+ component: MlCarousel,
8
+ tags: ['autodocs'],
9
+ argTypes: {
10
+ dotPosition: { options: ['top', 'bottom', 'left', 'right'] },
11
+ effect: { options: ['scrollx', 'fade'] },
12
+ dots: {
13
+ control: 'boolean',
14
+ },
15
+ },
16
+ } satisfies Meta<typeof MlCarousel>;
17
+
18
+ export default meta;
19
+ type Story = StoryObj<typeof meta>;
20
+
21
+ const contentStyle: React.CSSProperties = {
22
+ margin: 0,
23
+ height: '160px',
24
+ color: '#fff',
25
+ lineHeight: '160px',
26
+ textAlign: 'center',
27
+ background: '#364d79',
28
+ };
29
+
30
+ const Elements = [
31
+ <div>
32
+ <h3 style={contentStyle}>1</h3>
33
+ </div>,
34
+ <div>
35
+ <h3 style={contentStyle}>2</h3>
36
+ </div>,
37
+ <div>
38
+ <h3 style={contentStyle}>3</h3>
39
+ </div>,
40
+ <div>
41
+ <h3 style={contentStyle}>4</h3>
42
+ </div>,
43
+ ];
44
+
45
+ export const Basic: Story = {
46
+ args: {
47
+ id: '1',
48
+ children: Elements,
49
+ },
50
+ };
51
+
52
+ export const Autoplay: Story = {
53
+ args: {
54
+ id: '3',
55
+ autoplay: true,
56
+ children: Elements,
57
+ },
58
+ };
59
+
60
+ export const Fade: Story = {
61
+ args: {
62
+ id: '4',
63
+ effect: 'fade',
64
+ children: Elements,
65
+ },
66
+ };
67
+
68
+ export const Top: Story = {
69
+ args: {
70
+ id: '5',
71
+ dotPosition: 'top',
72
+ children: Elements,
73
+ },
74
+ };
75
+
76
+ export const Bottom: Story = {
77
+ args: {
78
+ id: '6',
79
+ dotPosition: 'bottom',
80
+ children: Elements,
81
+ },
82
+ };
83
+
84
+ export const Left: Story = {
85
+ args: {
86
+ id: '7',
87
+ dotPosition: 'left',
88
+ children: Elements,
89
+ },
90
+ };
91
+
92
+ export const Right: Story = {
93
+ args: {
94
+ id: '7',
95
+ dotPosition: 'right',
96
+ children: Elements,
97
+ },
98
+ };