@onewelcome/react-lib-components 0.1.4-alpha → 0.1.7-alpha
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/dist/Button/IconButton.d.ts +2 -1
- package/dist/ContextMenu/ContextMenu.d.ts +2 -3
- package/dist/ContextMenu/ContextMenuItem.d.ts +10 -3
- package/dist/Form/Checkbox/Checkbox.d.ts +2 -2
- package/dist/Form/Toggle/Toggle.d.ts +1 -1
- package/dist/Link/Link.d.ts +4 -3
- package/dist/Notifications/BaseModal/BaseModal.d.ts +4 -2
- package/dist/Notifications/SlideInModal/SlideInModal.d.ts +4 -0
- package/dist/StatusIndicator/StatusIndicator.d.ts +9 -0
- package/dist/index.d.ts +43 -42
- package/dist/react-lib-components.cjs.development.js +2208 -2033
- package/dist/react-lib-components.cjs.development.js.map +1 -1
- package/dist/react-lib-components.cjs.production.min.js +1 -1
- package/dist/react-lib-components.cjs.production.min.js.map +1 -1
- package/dist/react-lib-components.esm.js +2207 -2034
- package/dist/react-lib-components.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/Button/BaseButton.module.scss +3 -18
- package/src/Button/Button.module.scss +4 -311
- package/src/Button/IconButton.module.scss +21 -128
- package/src/Button/IconButton.test.tsx +24 -0
- package/src/Button/IconButton.tsx +6 -1
- package/src/ContextMenu/ContextMenu.test.tsx +121 -6
- package/src/ContextMenu/ContextMenu.tsx +84 -6
- package/src/ContextMenu/ContextMenuItem.tsx +57 -9
- package/src/Form/Checkbox/Checkbox.test.tsx +144 -8
- package/src/Form/Checkbox/Checkbox.tsx +8 -8
- package/src/Form/Toggle/Toggle.test.tsx +45 -19
- package/src/Form/Toggle/Toggle.tsx +3 -3
- package/src/Form/Wrapper/CheckboxWrapper/CheckboxWrapper.test.tsx +1 -1
- package/src/Link/Link.module.scss +20 -0
- package/src/Link/Link.test.tsx +33 -0
- package/src/Link/Link.tsx +8 -2
- package/src/Notifications/BaseModal/BaseModal.test.tsx +75 -11
- package/src/Notifications/BaseModal/BaseModal.tsx +27 -6
- package/src/Notifications/Dialog/Dialog.tsx +1 -1
- package/src/Notifications/SlideInModal/SlideInModal.module.scss +36 -0
- package/src/Notifications/SlideInModal/SlideInModal.test.tsx +69 -0
- package/src/Notifications/SlideInModal/SlideInModal.tsx +31 -0
- package/src/StatusIndicator/StatusIndicator.module.scss +27 -0
- package/src/StatusIndicator/StatusIndicator.test.tsx +127 -0
- package/src/StatusIndicator/StatusIndicator.tsx +25 -0
- package/src/Tiles/Tile.module.scss +1 -1
- package/src/Tiles/Tile.test.tsx +4 -4
- package/src/index.ts +79 -47
- package/src/mixins.module.scss +171 -0
- package/src/readyclasses.module.scss +0 -30
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import { StatusIndicator, Props } from './StatusIndicator';
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
|
+
|
|
5
|
+
const defaultParams: Props = {
|
|
6
|
+
status: 'active',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const createStatusIndicator = (params?: (defaultParams: Props) => Props) => {
|
|
10
|
+
let parameters: Props = defaultParams;
|
|
11
|
+
if (params) {
|
|
12
|
+
parameters = params(defaultParams);
|
|
13
|
+
}
|
|
14
|
+
const queries = render(
|
|
15
|
+
<StatusIndicator {...parameters} data-testid="StatusIndicator">
|
|
16
|
+
content
|
|
17
|
+
</StatusIndicator>
|
|
18
|
+
);
|
|
19
|
+
const statusIndicator = queries.getByTestId('StatusIndicator');
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
...queries,
|
|
23
|
+
statusIndicator,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
describe('StatusIndicator should render', () => {
|
|
28
|
+
it('renders without crashing', () => {
|
|
29
|
+
const { statusIndicator, getByText } = createStatusIndicator();
|
|
30
|
+
|
|
31
|
+
expect(statusIndicator).toBeDefined();
|
|
32
|
+
expect(getByText('content')).toBeInTheDocument();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('passes through custom typography props', () => {
|
|
36
|
+
const { statusIndicator, getByText } = createStatusIndicator((params) => ({
|
|
37
|
+
...params,
|
|
38
|
+
typographyProps: {
|
|
39
|
+
variant: 'body',
|
|
40
|
+
children: <strong>custom children</strong>,
|
|
41
|
+
},
|
|
42
|
+
}));
|
|
43
|
+
|
|
44
|
+
expect(statusIndicator).toBeDefined();
|
|
45
|
+
expect(getByText('custom children')).toBeInTheDocument();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('passes through custom props', () => {
|
|
49
|
+
const { statusIndicator } = createStatusIndicator((params) => ({
|
|
50
|
+
...params,
|
|
51
|
+
'aria-label': 'status indicator',
|
|
52
|
+
}));
|
|
53
|
+
|
|
54
|
+
expect(statusIndicator).toBeDefined();
|
|
55
|
+
expect(statusIndicator).toHaveAttribute('aria-label', 'status indicator');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should set "active" class on status badge', () => {
|
|
59
|
+
const { statusIndicator } = createStatusIndicator((params) => ({
|
|
60
|
+
...params,
|
|
61
|
+
status: 'active',
|
|
62
|
+
}));
|
|
63
|
+
|
|
64
|
+
expect(statusIndicator.firstChild).toHaveClass('active');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('should set "error" class on status badge', () => {
|
|
68
|
+
const { statusIndicator } = createStatusIndicator((params) => ({ ...params, status: 'error' }));
|
|
69
|
+
|
|
70
|
+
expect(statusIndicator.firstChild).toHaveClass('error');
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should set "neutral" class on status badge', () => {
|
|
74
|
+
const { statusIndicator } = createStatusIndicator((params) => ({
|
|
75
|
+
...params,
|
|
76
|
+
status: 'neutral',
|
|
77
|
+
}));
|
|
78
|
+
|
|
79
|
+
expect(statusIndicator.firstChild).toHaveClass('neutral');
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('should pass "warning" class to status badge', () => {
|
|
83
|
+
const { statusIndicator } = createStatusIndicator((params) => ({
|
|
84
|
+
...params,
|
|
85
|
+
status: 'warning',
|
|
86
|
+
}));
|
|
87
|
+
|
|
88
|
+
expect(statusIndicator.firstChild).toHaveClass('warning');
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('should pass custom class to status badge', () => {
|
|
92
|
+
const { statusIndicator } = createStatusIndicator((params) => ({
|
|
93
|
+
...params,
|
|
94
|
+
badgeProps: { className: 'custom' },
|
|
95
|
+
}));
|
|
96
|
+
|
|
97
|
+
expect(statusIndicator.firstChild).toHaveClass('custom');
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
describe('ref should work', () => {
|
|
102
|
+
it('should give back the proper data prop, this also checks if the component propagates ...rest properly', () => {
|
|
103
|
+
const ExampleComponent = ({
|
|
104
|
+
propagateRef,
|
|
105
|
+
}: {
|
|
106
|
+
propagateRef?: (ref: React.RefObject<HTMLElement>) => void;
|
|
107
|
+
}) => {
|
|
108
|
+
const ref = useRef(null);
|
|
109
|
+
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (ref.current) {
|
|
112
|
+
propagateRef && propagateRef(ref);
|
|
113
|
+
}
|
|
114
|
+
}, [ref]);
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<StatusIndicator id="test" children="test" data-ref="testing" ref={ref} status="active" />
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const refCheck = (ref: React.RefObject<HTMLElement>) => {
|
|
122
|
+
expect(ref.current).toHaveAttribute('data-ref', 'testing');
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
render(<ExampleComponent propagateRef={refCheck} />);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
import { Typography, Props as TypographyProps } from '../Typography/Typography';
|
|
3
|
+
import classes from './StatusIndicator.module.scss';
|
|
4
|
+
|
|
5
|
+
export interface Props extends ComponentPropsWithRef<'div'> {
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
status: 'active' | 'error' | 'neutral' | 'warning';
|
|
8
|
+
badgeProps?: ComponentPropsWithRef<'div'>;
|
|
9
|
+
typographyProps?: TypographyProps;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const StatusIndicator = React.forwardRef<HTMLDivElement, Props>(
|
|
13
|
+
({ children, status, badgeProps, typographyProps, ...rest }: Props, ref) => {
|
|
14
|
+
return (
|
|
15
|
+
<div {...rest} className={classes['status-indicator']} ref={ref}>
|
|
16
|
+
<div
|
|
17
|
+
className={`${classes['status-badge']} ${classes[status]} ${badgeProps?.className ?? ''}`}
|
|
18
|
+
/>
|
|
19
|
+
<Typography {...typographyProps} spacing={{ margin: '0' }} variant="body" tag="div">
|
|
20
|
+
{typographyProps?.children || children}
|
|
21
|
+
</Typography>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
);
|
package/src/Tiles/Tile.test.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useRef } from 'react';
|
|
2
2
|
import { Tile, Props } from './Tile';
|
|
3
|
-
import { render
|
|
3
|
+
import { render } from '@testing-library/react';
|
|
4
4
|
import { Icon, Icons } from '../Icon/Icon';
|
|
5
5
|
import { ContextMenu } from '../ContextMenu/ContextMenu';
|
|
6
6
|
import { IconButton } from '../Button/IconButton';
|
|
@@ -130,9 +130,9 @@ describe('contextmenu', () => {
|
|
|
130
130
|
expect(popover).toHaveClass('show');
|
|
131
131
|
expect(popover).toHaveStyle({ opacity: '1;' });
|
|
132
132
|
|
|
133
|
-
userEvent.click(
|
|
134
|
-
userEvent.click(
|
|
135
|
-
userEvent.click(
|
|
133
|
+
userEvent.click(menuitem1);
|
|
134
|
+
userEvent.click(menuitem2);
|
|
135
|
+
userEvent.click(menuitem3);
|
|
136
136
|
|
|
137
137
|
expect(contextMenuItemOnClick).toHaveBeenCalledTimes(3);
|
|
138
138
|
});
|
package/src/index.ts
CHANGED
|
@@ -1,9 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/* Components */
|
|
2
2
|
export { BaseStyling } from './_BaseStyling_/BaseStyling';
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
3
|
+
export { Button, Props as ButtonProps } from './Button/Button';
|
|
4
|
+
export { Breadcrumbs, Props as BreadcrumbsProps } from './Breadcrumbs/Breadcrumbs';
|
|
5
|
+
export { ContextMenu, Props as ContextMenuProps } from './ContextMenu/ContextMenu';
|
|
6
|
+
export { ContextMenuItem, Props as ContextMenuItemProps } from './ContextMenu/ContextMenuItem';
|
|
7
|
+
export { Link, Props as LinkProps, AnchorType } from './Link/Link';
|
|
8
|
+
export { Icon, Icons, Props as IconProps } from './Icon/Icon';
|
|
9
|
+
export { IconButton, Props as IconButtonProps } from './Button/IconButton';
|
|
10
|
+
export { Tab, Props as TabProps } from './Tabs/Tab';
|
|
11
|
+
export { Tabs, Props as TabsProps } from './Tabs/Tabs';
|
|
12
|
+
export { TextEllipsis, Props as TextEllipsisProps } from './TextEllipsis/TextEllipsis';
|
|
13
|
+
export { Tile, Props as TileProps } from './Tiles/Tile';
|
|
14
|
+
export { Tiles, Props as TilesProps } from './Tiles/Tiles';
|
|
15
|
+
export { Tooltip, Props as TooltipProps } from './Tooltip/Tooltip';
|
|
16
|
+
export { Typography, Variant, Props as TypographyProps } from './Typography/Typography';
|
|
7
17
|
export {
|
|
8
18
|
Pagination,
|
|
9
19
|
Props as PaginationProps,
|
|
@@ -11,57 +21,79 @@ export {
|
|
|
11
21
|
PaginationTranslations,
|
|
12
22
|
PageSize,
|
|
13
23
|
} from './Pagination/Pagination';
|
|
14
|
-
export { Icon, Icons } from './Icon/Icon';
|
|
15
|
-
|
|
16
|
-
export { Tabs, Props as TabsProps } from './Tabs/Tabs';
|
|
17
|
-
export { Tab, Props as TabProps } from './Tabs/Tab';
|
|
18
|
-
|
|
19
|
-
export { Dialog } from './Notifications/Dialog/Dialog';
|
|
20
|
-
export { Modal } from './Notifications/Modal/Modal';
|
|
21
|
-
export { ModalActions } from './Notifications/Modal/ModalActions/ModalActions';
|
|
22
|
-
export { ModalContent } from './Notifications/Modal/ModalContent/ModalContent';
|
|
23
|
-
export { ModalHeader } from './Notifications/Modal/ModalHeader/ModalHeader';
|
|
24
|
-
export { DiscardChangesModal } from './Notifications/DiscardChangesModal/DiscardChangesModal';
|
|
25
|
-
export { TextEllipsis, Props as TextEllipsisProps } from './TextEllipsis/TextEllipsis';
|
|
26
|
-
export { Tooltip } from './Tooltip/Tooltip';
|
|
27
|
-
export { Tiles } from './Tiles/Tiles';
|
|
28
|
-
export { Tile } from './Tiles/Tile';
|
|
29
|
-
export { ContextMenu } from './ContextMenu/ContextMenu';
|
|
30
|
-
export { ContextMenuItem } from './ContextMenu/ContextMenuItem';
|
|
31
|
-
export { Breadcrumbs } from './Breadcrumbs/Breadcrumbs';
|
|
32
|
-
|
|
33
|
-
export { SnackbarProvider } from './Notifications/Snackbar/SnackbarProvider/SnackbarProvider';
|
|
34
|
-
export { useSnackbar } from './Notifications/Snackbar/useSnackbar';
|
|
35
24
|
|
|
25
|
+
/* Utils */
|
|
36
26
|
export { useRepeater } from './hooks/useRepeater';
|
|
37
|
-
|
|
38
27
|
export { generateID } from './util/helper';
|
|
39
28
|
|
|
29
|
+
/* Notifications */
|
|
30
|
+
export { Modal, Props as ModalProps } from './Notifications/Modal/Modal';
|
|
31
|
+
export { useSnackbar } from './Notifications/Snackbar/useSnackbar';
|
|
32
|
+
export {
|
|
33
|
+
Dialog,
|
|
34
|
+
Props as DialogProps,
|
|
35
|
+
Action as DialogAction,
|
|
36
|
+
} from './Notifications/Dialog/Dialog';
|
|
37
|
+
export {
|
|
38
|
+
DiscardChangesModal,
|
|
39
|
+
Props as DiscardChangesModalProps,
|
|
40
|
+
} from './Notifications/DiscardChangesModal/DiscardChangesModal';
|
|
41
|
+
export {
|
|
42
|
+
ModalActions,
|
|
43
|
+
Props as ModalActionsProps,
|
|
44
|
+
} from './Notifications/Modal/ModalActions/ModalActions';
|
|
45
|
+
export {
|
|
46
|
+
ModalContent,
|
|
47
|
+
Props as ModalContentProps,
|
|
48
|
+
} from './Notifications/Modal/ModalContent/ModalContent';
|
|
49
|
+
export {
|
|
50
|
+
ModalHeader,
|
|
51
|
+
Props as ModalHeaderProps,
|
|
52
|
+
} from './Notifications/Modal/ModalHeader/ModalHeader';
|
|
53
|
+
export {
|
|
54
|
+
SlideInModal,
|
|
55
|
+
Props as SlideInModalProps,
|
|
56
|
+
} from './Notifications/SlideInModal/SlideInModal';
|
|
57
|
+
export {
|
|
58
|
+
SnackbarProvider,
|
|
59
|
+
Props as SnackbarProviderProps,
|
|
60
|
+
} from './Notifications/Snackbar/SnackbarProvider/SnackbarProvider';
|
|
61
|
+
|
|
40
62
|
/** Form components */
|
|
41
|
-
export {
|
|
42
|
-
export { Fieldset } from './Form/Fieldset/Fieldset';
|
|
43
|
-
export {
|
|
44
|
-
export {
|
|
45
|
-
export {
|
|
46
|
-
export {
|
|
47
|
-
export {
|
|
48
|
-
export {
|
|
49
|
-
export {
|
|
50
|
-
export {
|
|
51
|
-
export {
|
|
52
|
-
export { RadioWrapper } from './Form/Wrapper/RadioWrapper/RadioWrapper';
|
|
53
|
-
export {
|
|
54
|
-
export {
|
|
55
|
-
export {
|
|
56
|
-
export {
|
|
57
|
-
|
|
63
|
+
export { Checkbox, Props as CheckboxProps } from './Form/Checkbox/Checkbox';
|
|
64
|
+
export { Fieldset, Props as FieldsetProps } from './Form/Fieldset/Fieldset';
|
|
65
|
+
export { Form, Props as FormProps } from './Form/Form';
|
|
66
|
+
export { FormControl, Props as FormControlProps } from './Form/FormControl/FormControl';
|
|
67
|
+
export { FormGroup, Props as FormGroupProps } from './Form/FormGroup/FormGroup';
|
|
68
|
+
export { FormHelperText, Props as FormHelperTextProps } from './Form/FormHelperText/FormHelperText';
|
|
69
|
+
export { Input, Props as InputProps, Type as InputType } from './Form/Input/Input';
|
|
70
|
+
export { InputWrapper, Props as InputWrapperProps } from './Form/Wrapper/InputWrapper/InputWrapper';
|
|
71
|
+
export { Label, Props as LabelProps } from './Form/Label/Label';
|
|
72
|
+
export { Option, Props as OptionProps } from './Form/Select/Option';
|
|
73
|
+
export { Radio, Props as RadioProps } from './Form/Radio/Radio';
|
|
74
|
+
export { RadioWrapper, Props as RadioWrapperProps } from './Form/Wrapper/RadioWrapper/RadioWrapper';
|
|
75
|
+
export { Select, Props as SelectProps } from './Form/Select/Select';
|
|
76
|
+
export { Textarea, Props as TextareaProps } from './Form/Textarea/Textarea';
|
|
77
|
+
export { Toggle, Props as ToggleProps } from './Form/Toggle/Toggle';
|
|
78
|
+
export {
|
|
79
|
+
CheckboxWrapper,
|
|
80
|
+
Props as CheckboxWrapperProps,
|
|
81
|
+
} from './Form/Wrapper/CheckboxWrapper/CheckboxWrapper';
|
|
82
|
+
export {
|
|
83
|
+
TextareaWrapper,
|
|
84
|
+
Props as TextareaWrapperProps,
|
|
85
|
+
} from './Form/Wrapper/TextareaWrapper/TextareaWrapper';
|
|
86
|
+
export {
|
|
87
|
+
SelectWrapper,
|
|
88
|
+
Props as SelectWrapperProps,
|
|
89
|
+
} from './Form/Wrapper/SelectWrapper/SelectWrapper';
|
|
58
90
|
|
|
59
91
|
/** Wizard */
|
|
92
|
+
export { Wizard, Props as WizardProps } from './Wizard/Wizard';
|
|
93
|
+
export { WizardActions, Props as WizardActionsProps } from './Wizard/WizardActions/WizardActions';
|
|
94
|
+
export { WizardSteps, Props as WizardStepsProps } from './Wizard/WizardSteps/WizardSteps';
|
|
60
95
|
export {
|
|
61
96
|
BaseWizardSteps,
|
|
62
97
|
Props as BaseWizardStepsProps,
|
|
63
98
|
Step as WizardStep,
|
|
64
99
|
} from './Wizard/BaseWizardSteps/BaseWizardSteps';
|
|
65
|
-
export { WizardActions } from './Wizard/WizardActions/WizardActions';
|
|
66
|
-
export { WizardSteps } from './Wizard/WizardSteps/WizardSteps';
|
|
67
|
-
export { Wizard, Props as WizardProps } from './Wizard/Wizard';
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
@import './readyclasses.module.scss';
|
|
2
|
+
|
|
3
|
+
@mixin button($variant: 'text', $type: 'default') {
|
|
4
|
+
$disabledSelector: if($type == 'link', '.disabled', ':disabled');
|
|
5
|
+
|
|
6
|
+
@if $variant == 'text' {
|
|
7
|
+
border-color: transparent;
|
|
8
|
+
background-color: transparent;
|
|
9
|
+
} @else if $variant == 'fill' {
|
|
10
|
+
@if $type == 'default' {
|
|
11
|
+
color: var(--button-fill-text-color);
|
|
12
|
+
} @else if $type == 'icon' or $type == 'link' {
|
|
13
|
+
&:not(#{$disabledSelector}) {
|
|
14
|
+
color: var(--button-fill-text-color);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
font-weight: bold;
|
|
18
|
+
} @else if $variant == 'outline' {
|
|
19
|
+
background-color: var(--button-fill-background-color);
|
|
20
|
+
font-weight: bold;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.primary:not(#{$disabledSelector}) {
|
|
24
|
+
@include buttonStyles(var(--color-primary), $variant, $type);
|
|
25
|
+
}
|
|
26
|
+
&.secondary:not(#{$disabledSelector}) {
|
|
27
|
+
@include buttonStyles(var(--color-secondary), $variant, $type);
|
|
28
|
+
}
|
|
29
|
+
&.tertiary:not(#{$disabledSelector}) {
|
|
30
|
+
@include buttonStyles(var(--color-tertiary), $variant, $type);
|
|
31
|
+
}
|
|
32
|
+
&.default:not(#{$disabledSelector}) {
|
|
33
|
+
@include buttonStyles(var(--default), $variant, $type);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@if $variant == 'fill' {
|
|
37
|
+
&:hover:not(#{$disabledSelector}),
|
|
38
|
+
&:focus:not(#{$disabledSelector}),
|
|
39
|
+
&:active:not(#{$disabledSelector}) {
|
|
40
|
+
background-color: var(--button-fill-background-color);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&#{$disabledSelector} {
|
|
44
|
+
background-color: var(--disabled);
|
|
45
|
+
border-color: var(--disabled);
|
|
46
|
+
}
|
|
47
|
+
} @else if $variant == 'outline' {
|
|
48
|
+
&:hover:not(#{$disabledSelector}),
|
|
49
|
+
&:focus:not(#{$disabledSelector}) {
|
|
50
|
+
color: var(--button-outline-hover-text-color);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&#{$disabledSelector} {
|
|
54
|
+
border-color: var(--greyed-out);
|
|
55
|
+
background-color: transparent;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@mixin buttonStyles($color, $variant: 'text', $type: 'default') {
|
|
61
|
+
@if $variant == 'text' {
|
|
62
|
+
color: $color;
|
|
63
|
+
} @else if $variant == 'fill' {
|
|
64
|
+
border-color: $color;
|
|
65
|
+
background-color: $color;
|
|
66
|
+
} @else if $variant == 'outline' {
|
|
67
|
+
border-color: $color;
|
|
68
|
+
color: $color;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@include focusOutline($color);
|
|
72
|
+
|
|
73
|
+
&:hover:not(.disabled),
|
|
74
|
+
&:focus:not(.disabled) {
|
|
75
|
+
@if $variant == 'text' {
|
|
76
|
+
border-color: $color;
|
|
77
|
+
} @else if $variant == 'fill' {
|
|
78
|
+
color: $color;
|
|
79
|
+
} @else if $variant == 'outline' {
|
|
80
|
+
background-color: $color;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
@if $variant == 'text' or $variant == 'fill' {
|
|
85
|
+
&:active:not(.disabled) {
|
|
86
|
+
@if $variant == 'text' {
|
|
87
|
+
background-color: transparent;
|
|
88
|
+
position: relative;
|
|
89
|
+
color: $color;
|
|
90
|
+
border-color: var(--button-fill-background-color);
|
|
91
|
+
} @else if $variant == 'fill' {
|
|
92
|
+
position: relative;
|
|
93
|
+
color: $color;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&:after {
|
|
97
|
+
content: '';
|
|
98
|
+
position: absolute;
|
|
99
|
+
@if $variant == 'fill' {
|
|
100
|
+
top: calc(-1 * var(--button-border-width));
|
|
101
|
+
} @else {
|
|
102
|
+
top: calc(-1 * var(--button-border-width) + (var(--button-border-width) / 2));
|
|
103
|
+
}
|
|
104
|
+
@if $type == 'default' or $type == 'link' {
|
|
105
|
+
left: 0;
|
|
106
|
+
width: 100%;
|
|
107
|
+
} @else if $type == 'icon' {
|
|
108
|
+
left: calc(-1 * var(--button-border-width) + (var(--button-border-width) / 2));
|
|
109
|
+
width: calc(100% + var(--button-border-width));
|
|
110
|
+
}
|
|
111
|
+
height: calc(100% + var(--button-border-width));
|
|
112
|
+
background-color: $color;
|
|
113
|
+
border-radius: var(--button-border-radius);
|
|
114
|
+
filter: opacity(0.1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@mixin buttonBase($type: 'default') {
|
|
121
|
+
$disabledSelector: if($type == 'link', '.disabled', ':disabled');
|
|
122
|
+
|
|
123
|
+
border-width: var(--button-border-width);
|
|
124
|
+
border-style: var(--button-border-style);
|
|
125
|
+
border-radius: var(--button-border-radius);
|
|
126
|
+
font-size: var(--button-font-size);
|
|
127
|
+
line-height: var(--button-font-size);
|
|
128
|
+
margin: 0;
|
|
129
|
+
padding: 0.5rem 1.25rem;
|
|
130
|
+
min-height: 2.5rem;
|
|
131
|
+
cursor: pointer;
|
|
132
|
+
transition-property: color, background-color, border-color;
|
|
133
|
+
transition-duration: 0.2s;
|
|
134
|
+
transition-timing-function: ease-in-out;
|
|
135
|
+
font-family: var(--font-family);
|
|
136
|
+
|
|
137
|
+
&#{$disabledSelector} {
|
|
138
|
+
color: var(--greyed-out);
|
|
139
|
+
cursor: not-allowed;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
@mixin skeletonLoading() {
|
|
144
|
+
position: relative;
|
|
145
|
+
overflow: hidden;
|
|
146
|
+
background-color: var(--disabled);
|
|
147
|
+
|
|
148
|
+
&::after {
|
|
149
|
+
position: absolute;
|
|
150
|
+
top: 0;
|
|
151
|
+
right: 0;
|
|
152
|
+
bottom: 0;
|
|
153
|
+
left: 0;
|
|
154
|
+
transform: translateX(-100%);
|
|
155
|
+
background-image: linear-gradient(
|
|
156
|
+
90deg,
|
|
157
|
+
rgba(#fff, 0) 0,
|
|
158
|
+
rgba(#fff, 0.2) 20%,
|
|
159
|
+
rgba(#fff, 0.5) 60%,
|
|
160
|
+
rgba(#fff, 0)
|
|
161
|
+
);
|
|
162
|
+
animation: shimmer 2s infinite;
|
|
163
|
+
content: '';
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
@keyframes shimmer {
|
|
167
|
+
100% {
|
|
168
|
+
transform: translateX(100%);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -9,36 +9,6 @@
|
|
|
9
9
|
border: 0;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
@mixin skeletonLoading() {
|
|
13
|
-
position: relative;
|
|
14
|
-
overflow: hidden;
|
|
15
|
-
background-color: var(--disabled);
|
|
16
|
-
|
|
17
|
-
&::after {
|
|
18
|
-
position: absolute;
|
|
19
|
-
top: 0;
|
|
20
|
-
right: 0;
|
|
21
|
-
bottom: 0;
|
|
22
|
-
left: 0;
|
|
23
|
-
transform: translateX(-100%);
|
|
24
|
-
background-image: linear-gradient(
|
|
25
|
-
90deg,
|
|
26
|
-
rgba(#fff, 0) 0,
|
|
27
|
-
rgba(#fff, 0.2) 20%,
|
|
28
|
-
rgba(#fff, 0.5) 60%,
|
|
29
|
-
rgba(#fff, 0)
|
|
30
|
-
);
|
|
31
|
-
animation: shimmer 2s infinite;
|
|
32
|
-
content: '';
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@keyframes shimmer {
|
|
36
|
-
100% {
|
|
37
|
-
transform: translateX(100%);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
12
|
.hidden {
|
|
43
13
|
display: none;
|
|
44
14
|
}
|