@mmb-digital/design-system-web 0.1.4 → 0.1.5

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 (50) hide show
  1. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  2. package/.idea/design-system-web_2023-02-07.iml +8 -0
  3. package/.idea/inspectionProfiles/Project_Default.xml +7 -0
  4. package/.idea/modules.xml +8 -0
  5. package/.idea/php.xml +19 -0
  6. package/.idea/prettier.xml +6 -0
  7. package/.idea/vcs.xml +6 -0
  8. package/package.json +1 -1
  9. package/src/@types/json.d.ts +0 -5
  10. package/src/@types/styledComponentCssProps.d.ts +0 -11
  11. package/src/@types/styledComponentTheme.d.ts +0 -9
  12. package/src/components/button/button.stories.tsx +0 -97
  13. package/src/components/button/button.styles.ts +0 -162
  14. package/src/components/button/button.test.tsx +0 -25
  15. package/src/components/button/button.tsx +0 -31
  16. package/src/components/button/button.types.ts +0 -33
  17. package/src/components/button/index.ts +0 -3
  18. package/src/components/form/hint/formHint.style.ts +0 -10
  19. package/src/components/form/hint/formHint.tsx +0 -13
  20. package/src/components/form/hint/formHint.types.ts +0 -5
  21. package/src/components/slider/slider/slider.stories.tsx +0 -176
  22. package/src/components/slider/slider/slider.style.ts +0 -29
  23. package/src/components/slider/slider/slider.tsx +0 -136
  24. package/src/components/slider/slider/slider.types.ts +0 -58
  25. package/src/components/slider/slider/sliderFunction/default/sliderFunctionDefault.ts +0 -21
  26. package/src/components/slider/slider/sliderFunction/default/sliderStep.test.ts +0 -90
  27. package/src/components/slider/slider/sliderFunction/default/sliderStep.ts +0 -18
  28. package/src/components/slider/slider/sliderFunction/linearVisualSteps/sliderFunctionLinearVisualSteps.ts +0 -28
  29. package/src/components/slider/slider/sliderFunction/linearVisualSteps/sliderMax.test.ts +0 -83
  30. package/src/components/slider/slider/sliderFunction/linearVisualSteps/sliderMax.ts +0 -34
  31. package/src/components/slider/slider/sliderFunction/linearVisualSteps/sliderValueByValue.test.ts +0 -249
  32. package/src/components/slider/slider/sliderFunction/linearVisualSteps/sliderValueByValue.ts +0 -41
  33. package/src/components/slider/slider/sliderFunction/linearVisualSteps/valueBySliderValue.test.ts +0 -204
  34. package/src/components/slider/slider/sliderFunction/linearVisualSteps/valueBySliderValue.ts +0 -35
  35. package/src/components/slider/slider/sliderHandleSvgHandler.ts +0 -26
  36. package/src/components/storeButton/assets/androidSvg.tsx +0 -159
  37. package/src/components/storeButton/assets/appleSvg.tsx +0 -31
  38. package/src/components/storeButton/storeButton.stories.tsx +0 -67
  39. package/src/components/storeButton/storeButton.styles.ts +0 -36
  40. package/src/components/storeButton/storeButton.test.tsx +0 -22
  41. package/src/components/storeButton/storeButton.tsx +0 -30
  42. package/src/components/storeButton/storeButton.types.tsx +0 -15
  43. package/src/icons/systemIcon.tsx +0 -26
  44. package/src/index.ts +0 -2
  45. package/src/provider/storybook/storybookProvider.tsx +0 -11
  46. package/src/provider/storybook/storybookProvider.types.ts +0 -5
  47. package/src/provider/styledComponents/theme/styledComponentsThemeProvider.tsx +0 -14
  48. package/src/provider/styledComponents/theme/styledComponentsThemeProvider.types..ts +0 -5
  49. package/src/style/styledComponents/mmb_variables-5224.json +0 -958
  50. package/src/style/styledComponents/theme.ts +0 -450
@@ -0,0 +1,5 @@
1
+ <component name="ProjectCodeStyleConfiguration">
2
+ <state>
3
+ <option name="PREFERRED_PROJECT_CODE_STYLE" value="Default (1)" />
4
+ </state>
5
+ </component>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="WEB_MODULE" version="4">
3
+ <component name="NewModuleRootManager">
4
+ <content url="file://$MODULE_DIR$" />
5
+ <orderEntry type="inheritedJdk" />
6
+ <orderEntry type="sourceFolder" forTests="false" />
7
+ </component>
8
+ </module>
@@ -0,0 +1,7 @@
1
+ <component name="InspectionProjectProfileManager">
2
+ <profile version="1.0">
3
+ <option name="myName" value="Project Default" />
4
+ <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
+ <inspection_tool class="Stylelint" enabled="true" level="ERROR" enabled_by_default="true" />
6
+ </profile>
7
+ </component>
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/design-system-web_2023-02-07.iml" filepath="$PROJECT_DIR$/.idea/design-system-web_2023-02-07.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
package/.idea/php.xml ADDED
@@ -0,0 +1,19 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="MessDetectorOptionsConfiguration">
4
+ <option name="transferred" value="true" />
5
+ </component>
6
+ <component name="PHPCSFixerOptionsConfiguration">
7
+ <option name="transferred" value="true" />
8
+ </component>
9
+ <component name="PHPCodeSnifferOptionsConfiguration">
10
+ <option name="highlightLevel" value="WARNING" />
11
+ <option name="transferred" value="true" />
12
+ </component>
13
+ <component name="PhpStanOptionsConfiguration">
14
+ <option name="transferred" value="true" />
15
+ </component>
16
+ <component name="PsalmOptionsConfiguration">
17
+ <option name="transferred" value="true" />
18
+ </component>
19
+ </project>
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="PrettierConfiguration">
4
+ <option name="myConfigurationMode" value="AUTOMATIC" />
5
+ </component>
6
+ </project>
package/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmb-digital/design-system-web",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "MMB design-system-web",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -1,5 +0,0 @@
1
- declare module '*.json' {
2
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
3
- const value: any;
4
- export default value;
5
- }
@@ -1,11 +0,0 @@
1
- import { CSSProp } from 'styled-components';
2
-
3
- import { theme } from '@/style/styledComponents/theme';
4
-
5
- type CustomTheme = typeof theme;
6
-
7
- declare module 'react' {
8
- interface Attributes {
9
- css?: CSSProp<CustomTheme>;
10
- }
11
- }
@@ -1,9 +0,0 @@
1
- import 'styled-components';
2
-
3
- import { theme } from '@/style/styledComponents/theme';
4
-
5
- type CustomTheme = typeof theme;
6
-
7
- declare module 'styled-components' {
8
- export interface DefaultTheme extends CustomTheme {}
9
- }
@@ -1,97 +0,0 @@
1
- import type { Meta, StoryObj } from '@storybook/react';
2
-
3
- import Button from './button';
4
- import { ButtonSize, ButtonStyle, ButtonType, Props } from './button.types';
5
- import React from 'react';
6
- import { SystemIcon } from '@/icons/systemIcon';
7
-
8
- const meta = {
9
- title: 'Button',
10
- component: Button,
11
- parameters: {},
12
- tags: ['autodocs'],
13
- argTypes: {},
14
- decorators: [
15
- (story) => {
16
- return <>{story()}</>;
17
- },
18
- ],
19
- } satisfies Meta<typeof Button>;
20
-
21
- export default meta;
22
-
23
- type Story = StoryObj<typeof meta>;
24
-
25
- const defaultStyle: ButtonStyle = ButtonStyle.PRIMARY;
26
- const defaultSize: ButtonSize = ButtonSize.MD;
27
- const defaultChildren = 'button';
28
-
29
- const defaultProps: Props = {
30
- buttonStyle: defaultStyle,
31
- size: defaultSize,
32
- children: defaultChildren,
33
- };
34
-
35
- export const Default: Story = {
36
- args: {
37
- children: 'button',
38
- buttonStyle: ButtonStyle.PRIMARY,
39
- size: ButtonSize.MD,
40
- disabled: false,
41
- displayOnlyIcon: false,
42
- iconLeft: <SystemIcon />,
43
- iconRight: <SystemIcon />,
44
- type: ButtonType.BUTTON,
45
- },
46
- argTypes: {
47
- buttonStyle: {
48
- type: {
49
- name: 'enum',
50
- value: Object.values(ButtonStyle),
51
- },
52
- },
53
- size: {
54
- type: {
55
- name: 'enum',
56
- value: Object.values(ButtonSize),
57
- },
58
- },
59
- displayOnlyIcon: {
60
- type: {
61
- name: 'boolean',
62
- },
63
- },
64
- disabled: {
65
- type: {
66
- name: 'boolean',
67
- },
68
- },
69
- },
70
- };
71
-
72
- export const TypeButton: Story = {
73
- args: {
74
- ...defaultProps,
75
- },
76
- };
77
-
78
- export const TypePrimary: Story = {
79
- args: { children: 'Primary button', buttonStyle: ButtonStyle.PRIMARY, size: defaultSize },
80
- };
81
-
82
- export const TypeSecondary: Story = {
83
- args: { children: 'Secondary button', buttonStyle: ButtonStyle.SECONDARY, size: defaultSize },
84
- };
85
-
86
- export const TypeTertiary: Story = {
87
- args: { children: 'Tertiary button', buttonStyle: ButtonStyle.TERTIARY, size: defaultSize },
88
- };
89
-
90
- export const WithOnClick: Story = {
91
- args: {
92
- ...defaultProps,
93
- onClick: () => {
94
- console.log('onClick');
95
- },
96
- },
97
- };
@@ -1,162 +0,0 @@
1
- import styled, { css } from 'styled-components';
2
-
3
- import { ButtonSize, ButtonStyle, Props } from './button.types';
4
-
5
- export const ButtonStyled = styled.button<Partial<Props>>`
6
- /* common styles */
7
- display: flex;
8
- flex-shrink: 0;
9
- align-items: center;
10
- justify-content: center;
11
- cursor: pointer;
12
-
13
- /* type specific styles */
14
- ${({ buttonStyle }) => {
15
- switch (buttonStyle) {
16
- case ButtonStyle.PRIMARY:
17
- return css`
18
- color: ${({ theme }) => theme.colors.fg.neutral.white.light};
19
- background-color: ${({ theme }) => theme.colors.bg.brand.bold.light};
20
- border: 1px solid ${({ theme }) => theme.colors.border.brand.bold.light};
21
-
22
- &:hover {
23
- background-color: ${({ theme }) => theme.colors.bg.brand.bold.hover.light};
24
- }
25
-
26
- &:focus {
27
- box-shadow: ${({ theme }) => theme.colors.shadow.buttonFocus};
28
- }
29
-
30
- &:active {
31
- background-color: ${({ theme }) => theme.colors.bg.brand.bold.pressed.light};
32
- }
33
-
34
- &:disabled {
35
- color: ${({ theme }) => theme.colors.fg.disabled.light};
36
- background-color: ${({ theme }) => theme.colors.bg.disabled.light};
37
- border: 1px solid ${({ theme }) => theme.colors.bg.disabled.light};
38
- }
39
- `;
40
- case ButtonStyle.SECONDARY:
41
- return css`
42
- color: ${({ theme }) => theme.colors.fg.neutral.subtle.light};
43
- background-color: ${({ theme }) => theme.colors.bg.neutral.white.light};
44
- border: 1px solid ${({ theme }) => theme.colors.border.neutral.subtle.light};
45
-
46
- &:hover {
47
- background-color: ${({ theme }) => theme.colors.bg.brand.default.light};
48
- border: 2px solid ${({ theme }) => theme.colors.border.brand.subtle.light};
49
- }
50
-
51
- &:focus {
52
- box-shadow: ${({ theme }) => theme.colors.shadow.buttonFocus};
53
- }
54
-
55
- &:active {
56
- background-color: ${({ theme }) => theme.colors.bg.brand.default.pressed.light};
57
- border: 2px solid ${({ theme }) => theme.colors.border.brand.subtle.light};
58
- }
59
-
60
- &:disabled {
61
- color: ${({ theme }) => theme.colors.fg.disabled.light};
62
- background-color: ${({ theme }) => theme.colors.bg.neutral.white.light};
63
- border: 1px solid ${({ theme }) => theme.colors.bg.disabled.light};
64
- }
65
- `;
66
- case ButtonStyle.TERTIARY:
67
- return css`
68
- color: ${({ theme }) => theme.colors.fg.neutral.subtle.light};
69
- background-color: ${({ theme }) => theme.colors.bg.neutral.white.light};
70
- border: none;
71
-
72
- &:hover {
73
- background-color: ${({ theme }) => theme.colors.bg.brand.default.light};
74
- }
75
-
76
- &:focus {
77
- box-shadow: ${({ theme }) => theme.colors.shadow.buttonFocus};
78
- }
79
-
80
- &:active {
81
- background-color: ${({ theme }) => theme.colors.bg.brand.default.pressed.light};
82
- }
83
-
84
- &:disabled {
85
- color: ${({ theme }) => theme.colors.fg.disabled.light};
86
- background-color: ${({ theme }) => theme.colors.bg.neutral.white.light};
87
- }
88
- `;
89
- default:
90
- return '';
91
- }
92
- }}
93
-
94
- /* size specific styles */
95
- ${({ size }) => {
96
- switch (size) {
97
- case ButtonSize.XS:
98
- return css`
99
- gap: ${({ theme }) => theme.spacing.xxs};
100
- min-height: ${({ theme }) => theme.spacing.xl};
101
- padding: ${({ theme }) => theme.spacing.xxs} ${({ theme }) => theme.spacing.xs};
102
- font-size: ${({ theme }) => theme.font.size.body.xs};
103
- font-weight: ${({ theme }) => theme.font.weight.medium};
104
- line-height: ${({ theme }) => theme.font.lineHeight.body.xs};
105
- letter-spacing: ${({ theme }) => theme.font.letterSpacing.body.md};
106
- border-radius: ${({ theme }) => theme.borderRadius.xxs};
107
- `;
108
- case ButtonSize.SM:
109
- return css`
110
- gap: ${({ theme }) => theme.spacing.xxs};
111
- min-height: ${({ theme }) => theme.spacing.xl};
112
- padding: ${({ theme }) => theme.spacing.xxs} ${({ theme }) => theme.spacing.xs};
113
- font-size: ${({ theme }) => theme.font.size.body.sm};
114
- font-weight: ${({ theme }) => theme.font.weight.medium};
115
- line-height: ${({ theme }) => theme.font.lineHeight.body.sm};
116
- letter-spacing: ${({ theme }) => theme.font.letterSpacing.body.md};
117
- border-radius: ${({ theme }) => theme.borderRadius.xxs};
118
- `;
119
- case ButtonSize.MD:
120
- return css`
121
- gap: ${({ theme }) => theme.spacing.xxs};
122
- min-height: ${({ theme }) => theme.spacing.xxl};
123
- padding: ${({ theme }) => theme.spacing.xs} ${({ theme }) => theme.spacing.sm};
124
- font-size: ${({ theme }) => theme.font.size.body.sm};
125
- font-weight: ${({ theme }) => theme.font.weight.medium};
126
- line-height: ${({ theme }) => theme.font.lineHeight.body.sm};
127
- letter-spacing: ${({ theme }) => theme.font.letterSpacing.body.md};
128
- border-radius: ${({ theme }) => theme.borderRadius.xs};
129
- `;
130
- case ButtonSize.XL:
131
- return css`
132
- gap: ${({ theme }) => theme.spacing.xs};
133
- min-height: ${({ theme }) => theme.spacing.xxxl};
134
- padding: ${({ theme }) => theme.spacing.sm};
135
- font-size: ${({ theme }) => theme.font.size.body.md};
136
- font-weight: ${({ theme }) => theme.font.weight.medium};
137
- line-height: ${({ theme }) => theme.font.lineHeight.body.md};
138
- border-radius: ${({ theme }) => theme.borderRadius.xs};
139
- `;
140
- case ButtonSize.XXL:
141
- return css`
142
- gap: ${({ theme }) => theme.spacing.sm};
143
- min-height: ${({ theme }) => theme.spacing.xxxxl};
144
- padding: ${({ theme }) => theme.spacing.md} ${({ theme }) => theme.spacing.xl};
145
- font-size: ${({ theme }) => theme.font.size.body.lg};
146
- font-weight: ${({ theme }) => theme.font.weight.medium};
147
- line-height: ${({ theme }) => theme.font.lineHeight.body.lg};
148
- border-radius: ${({ theme }) => theme.borderRadius.sm};
149
- `;
150
- default:
151
- return css`
152
- border-radius: ${({ theme }) => theme.borderRadius.xxs};
153
- `;
154
- }
155
- }}
156
- `;
157
-
158
- export const IconWrapperStyled = styled.div<Partial<Props>>`
159
- display: flex;
160
- align-items: center;
161
- height: 100%;
162
- `;
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import '@testing-library/jest-dom';
3
- import { render, screen } from '@testing-library/react';
4
-
5
- import { ButtonSize, ButtonStyle, ButtonType } from './button.types';
6
- import Button from './button';
7
- import StyledComponentsThemeProvider from '@/provider/styledComponents/theme/styledComponentsThemeProvider';
8
-
9
- describe('Running Test for Button', () => {
10
- test('Check Button Disabled', () => {
11
- render(
12
- <StyledComponentsThemeProvider>
13
- <Button
14
- buttonStyle={ButtonStyle.PRIMARY}
15
- disabled={true}
16
- size={ButtonSize.MD}
17
- type={ButtonType.BUTTON}
18
- >
19
- Button
20
- </Button>
21
- </StyledComponentsThemeProvider>,
22
- );
23
- expect(screen.getByRole('button', { name: 'Button' })).toBeDisabled();
24
- });
25
- });
@@ -1,31 +0,0 @@
1
- 'use client';
2
-
3
- import React, { FC } from 'react';
4
-
5
- import { ButtonStyled, IconWrapperStyled } from './button.styles';
6
- import { ButtonType, Props } from './button.types';
7
-
8
- const Button: FC<Props> = (props) => {
9
- const { buttonStyle, children, disabled = false, displayOnlyIcon = false, iconLeft, iconRight, onClick, size, type = ButtonType.BUTTON } = props;
10
-
11
- return (
12
- <ButtonStyled
13
- buttonStyle={buttonStyle}
14
- disabled={disabled}
15
- displayOnlyIcon={displayOnlyIcon}
16
- size={size}
17
- type={type}
18
- onClick={onClick}
19
- >
20
- {iconLeft !== undefined && <IconWrapperStyled size={size}>{iconLeft}</IconWrapperStyled>}
21
- {!displayOnlyIcon && (
22
- <>
23
- {children}
24
- {iconRight !== undefined && <IconWrapperStyled size={size}>{iconRight}</IconWrapperStyled>}
25
- </>
26
- )}
27
- </ButtonStyled>
28
- );
29
- };
30
-
31
- export default Button;
@@ -1,33 +0,0 @@
1
- import { ReactNode } from 'react';
2
-
3
- export enum ButtonStyle {
4
- PRIMARY = 'primary',
5
- SECONDARY = 'secondary',
6
- TERTIARY = 'tertiary',
7
- }
8
-
9
- export enum ButtonSize {
10
- MD = 'md',
11
- SM = 'sm',
12
- XL = 'xl',
13
- XS = 'xs',
14
- XXL = 'xxl',
15
- }
16
-
17
- export enum ButtonType {
18
- BUTTON = 'button',
19
- RESET = 'reset',
20
- SUBMIT = 'submit',
21
- }
22
-
23
- export interface Props {
24
- buttonStyle: ButtonStyle;
25
- children: ReactNode;
26
- disabled?: boolean;
27
- displayOnlyIcon?: boolean;
28
- iconLeft?: ReactNode;
29
- iconRight?: ReactNode;
30
- onClick?: () => void;
31
- size: ButtonSize;
32
- type?: ButtonType;
33
- }
@@ -1,3 +0,0 @@
1
- import Button from './button';
2
-
3
- export { Button };
@@ -1,10 +0,0 @@
1
- import { css } from 'styled-components';
2
-
3
- export const hint = css`
4
- display: inline;
5
- font-size: ${({ theme }) => theme.font.size.body.sm};
6
- line-height: ${({ theme }) => theme.font.lineHeight.body.sm};
7
- font-weight: ${({ theme }) => theme.font.weight.normal};
8
- letter-spacing: ${({ theme }) => theme.font.letterSpacing.body.md};
9
- color: ${({ theme }) => theme.colors.fg.neutral.subtle.light};
10
- `;
@@ -1,13 +0,0 @@
1
- //TODO: this is mock
2
-
3
- import React from 'react';
4
- import { Props } from '@/components/form/hint/formHint.types';
5
- import { hint } from '@/components/form/hint/formHint.style';
6
-
7
- const FormHint: React.FC<Props> = (props) => {
8
- const { children } = props;
9
-
10
- return <span css={[hint]}>{children}</span>;
11
- };
12
-
13
- export default FormHint;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
-
3
- export interface Props {
4
- readonly children: React.ReactNode;
5
- }
@@ -1,176 +0,0 @@
1
- import React, { useState } from 'react';
2
- import type { Meta, Parameters, StoryObj } from '@storybook/react';
3
- import Slider from '@/components/slider/slider/slider';
4
- import { MinMaxLabels, Props, SliderSteps, SliderStepType } from '@/components/slider/slider/slider.types';
5
-
6
- interface SliderParameters extends Parameters {
7
- defaultValue: number;
8
- }
9
-
10
- const defaultValueParamName = 'defaultValue';
11
-
12
- const defaultMin = 100;
13
- const defaultMax = 1000;
14
- const defaultMinMaxLabels: MinMaxLabels = {
15
- min: `${defaultMin} Kč`,
16
- max: `${defaultMax} Kč`,
17
- };
18
- const argTypeMinMaxLabels = {
19
- default: defaultMinMaxLabels,
20
- undefined: undefined,
21
- };
22
-
23
- const meta = {
24
- title: 'Slider/Slider',
25
- component: Slider,
26
- parameters: {},
27
- tags: ['autodocs'],
28
- argTypes: {
29
- stepType: {
30
- type: {
31
- name: 'enum',
32
- value: Object.values(SliderStepType),
33
- },
34
- },
35
- value: {
36
- table: {
37
- disable: true,
38
- },
39
- },
40
- onChange: {
41
- table: {
42
- disable: true,
43
- },
44
- },
45
- disable: {
46
- type: {
47
- name: 'boolean',
48
- },
49
- },
50
- minMaxLabels: {
51
- defaultValue: argTypeMinMaxLabels.default,
52
- options: Object.keys(argTypeMinMaxLabels),
53
- mapping: argTypeMinMaxLabels,
54
- control: {
55
- type: 'radio',
56
- },
57
- },
58
- },
59
- decorators: [
60
- (story, context) => {
61
- const { args, parameters } = context;
62
- const params: SliderParameters = parameters as SliderParameters;
63
-
64
- const [value, setValue] = useState<number>(params[defaultValueParamName]);
65
-
66
- return (
67
- <>
68
- {story({
69
- args: {
70
- ...args,
71
- value: value,
72
- onChange: setValue,
73
- },
74
- })}
75
- <span
76
- style={{
77
- fontSize: 32,
78
- }}
79
- >
80
- {value.toLocaleString('cs-CZ')}
81
- </span>
82
- </>
83
- );
84
- },
85
- ],
86
- } satisfies Meta<typeof Slider>;
87
-
88
- export default meta;
89
-
90
- type Story = StoryObj<typeof meta>;
91
-
92
- const defaultSteps: SliderSteps = {
93
- baseStep: 2,
94
- breakpointList: [
95
- {
96
- step: 50,
97
- bottomBreakpoint: 500,
98
- },
99
- ],
100
- };
101
-
102
- const defaultOnFinalChange = (value: number) => {
103
- console.log('defaultOnFinalChange', value);
104
- };
105
-
106
- const defaultProps: Props = {
107
- steps: defaultSteps,
108
- min: defaultMin,
109
- max: defaultMax,
110
- onFinalChange: defaultOnFinalChange,
111
- stepType: SliderStepType.DEFAULT,
112
- // is overwritten in the decorator
113
- onChange: () => {
114
- console.log('mock');
115
- },
116
- value: Number.NaN, // is overwritten in the decorator
117
- minMaxLabels: defaultMinMaxLabels,
118
- };
119
-
120
- export const Default: Story = {
121
- args: {
122
- ...defaultProps,
123
- },
124
- parameters: ((): SliderParameters => {
125
- return {
126
- defaultValue: 200,
127
- };
128
- })(),
129
- };
130
-
131
- export const LinearVisualSteps: Story = {
132
- args: {
133
- ...defaultProps,
134
- stepType: SliderStepType.LINEAR_VISUAL_STEP,
135
- },
136
- parameters: ((): SliderParameters => {
137
- return {
138
- defaultValue: 200,
139
- };
140
- })(),
141
- };
142
-
143
- export const AirBankMortgage: Story = {
144
- args: {
145
- ...defaultProps,
146
- stepType: SliderStepType.LINEAR_VISUAL_STEP,
147
- min: 334_000,
148
- max: 38_000_000,
149
- steps: {
150
- baseStep: 16_000,
151
- breakpointList: [
152
- {
153
- step: 25_000,
154
- bottomBreakpoint: 350_000,
155
- },
156
- {
157
- step: 50_000,
158
- bottomBreakpoint: 1_500_000,
159
- },
160
- {
161
- step: 100_000,
162
- bottomBreakpoint: 2_500_000,
163
- },
164
- {
165
- step: 2_500_000,
166
- bottomBreakpoint: 10_000_000,
167
- },
168
- ],
169
- },
170
- },
171
- parameters: ((): SliderParameters => {
172
- return {
173
- defaultValue: 3_000_000,
174
- };
175
- })(),
176
- };