@os-design/core 1.0.229 → 1.0.230
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/cjs/Button/ButtonContent.js +1 -1
- package/dist/cjs/Button/ButtonContent.js.map +1 -1
- package/dist/cjs/Button/index.js +2 -2
- package/dist/cjs/Button/index.js.map +1 -1
- package/dist/cjs/Button/utils/useButtonColors.js +1 -1
- package/dist/cjs/Button/utils/useButtonColors.js.map +1 -1
- package/dist/cjs/ButtonLink/index.js +89 -0
- package/dist/cjs/ButtonLink/index.js.map +1 -0
- package/dist/cjs/Link/index.js +3 -14
- package/dist/cjs/Link/index.js.map +1 -1
- package/dist/cjs/LinkButton/index.js +17 -58
- package/dist/cjs/LinkButton/index.js.map +1 -1
- package/dist/cjs/Select/index.js +2 -2
- package/dist/cjs/Select/index.js.map +1 -1
- package/dist/cjs/index.js +19 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/Button/ButtonContent.js +1 -1
- package/dist/esm/Button/ButtonContent.js.map +1 -1
- package/dist/esm/Button/index.js +2 -2
- package/dist/esm/Button/index.js.map +1 -1
- package/dist/esm/Button/utils/useButtonColors.js +1 -1
- package/dist/esm/Button/utils/useButtonColors.js.map +1 -1
- package/dist/esm/ButtonLink/index.js +73 -0
- package/dist/esm/ButtonLink/index.js.map +1 -0
- package/dist/esm/Link/index.js +2 -13
- package/dist/esm/Link/index.js.map +1 -1
- package/dist/esm/LinkButton/index.js +25 -59
- package/dist/esm/LinkButton/index.js.map +1 -1
- package/dist/esm/Select/index.js +2 -2
- package/dist/esm/Select/index.js.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/types/ButtonLink/index.d.ts +286 -0
- package/dist/types/ButtonLink/index.d.ts.map +1 -0
- package/dist/types/Link/index.d.ts +2 -0
- package/dist/types/Link/index.d.ts.map +1 -1
- package/dist/types/LinkButton/index.d.ts +6 -283
- package/dist/types/LinkButton/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/Button/ButtonContent.tsx +1 -1
- package/src/Button/index.tsx +2 -2
- package/src/Button/utils/useButtonColors.ts +1 -1
- package/src/ButtonLink/index.tsx +96 -0
- package/src/Link/index.tsx +2 -11
- package/src/LinkButton/index.tsx +38 -81
- package/src/Select/index.tsx +2 -2
- package/src/index.ts +2 -0
package/src/LinkButton/index.tsx
CHANGED
|
@@ -1,94 +1,51 @@
|
|
|
1
|
-
import { css } from '@emotion/react';
|
|
2
1
|
import styled from '@emotion/styled';
|
|
2
|
+
import { resetButtonStyles, sizeStyles, WithSize } from '@os-design/styles';
|
|
3
|
+
import { clr } from '@os-design/theming';
|
|
3
4
|
import { omitEmotionProps } from '@os-design/utils';
|
|
4
5
|
import React, { forwardRef } from 'react';
|
|
5
|
-
import {
|
|
6
|
-
import ButtonContent from '../Button/ButtonContent';
|
|
7
|
-
import useButtonColors from '../Button/utils/useButtonColors';
|
|
8
|
-
import { LinkProps, ReactRouterLinkProps } from '../Link';
|
|
6
|
+
import { underlineAlwaysStyles, underlineHoverStyles } from '../Link';
|
|
9
7
|
|
|
10
|
-
type
|
|
11
|
-
export type LinkButtonProps = JsxAProps &
|
|
12
|
-
ReactRouterLinkProps &
|
|
13
|
-
Pick<LinkProps, 'as'> &
|
|
14
|
-
ButtonProps;
|
|
8
|
+
type JsxButtonProps = Omit<JSX.IntrinsicElements['button'], 'ref'>;
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
export interface LinkButtonProps extends JsxButtonProps, WithSize {
|
|
11
|
+
/**
|
|
12
|
+
* Type of the underline styles.
|
|
13
|
+
* @default hover
|
|
14
|
+
*/
|
|
15
|
+
underline?: 'hover' | 'always' | 'never';
|
|
16
|
+
}
|
|
21
17
|
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
omitEmotionProps('
|
|
25
|
-
)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
const StyledButton = styled(
|
|
19
|
+
'button',
|
|
20
|
+
omitEmotionProps('size', 'underline')
|
|
21
|
+
)<LinkButtonProps>`
|
|
22
|
+
${resetButtonStyles};
|
|
23
|
+
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
text-align: left;
|
|
26
|
+
line-height: 1.2;
|
|
27
|
+
color: ${(p) => clr(p.theme.linkColor)};
|
|
28
|
+
|
|
29
|
+
${underlineHoverStyles};
|
|
30
|
+
${underlineAlwaysStyles};
|
|
31
|
+
${sizeStyles};
|
|
29
32
|
`;
|
|
30
33
|
|
|
31
34
|
/**
|
|
32
|
-
* The
|
|
35
|
+
* The link component that is rendered as a button.
|
|
33
36
|
*/
|
|
34
|
-
const LinkButton = forwardRef<
|
|
35
|
-
(
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
onMouseDown = () => {},
|
|
47
|
-
onKeyDown = () => {},
|
|
48
|
-
children,
|
|
49
|
-
...rest
|
|
50
|
-
},
|
|
51
|
-
ref
|
|
52
|
-
) => {
|
|
53
|
-
const { buttonColors, loadingColors } = useButtonColors({
|
|
54
|
-
type,
|
|
55
|
-
danger,
|
|
56
|
-
disabled,
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<StyledLinkButton
|
|
61
|
-
btnType={type}
|
|
62
|
-
colors={buttonColors}
|
|
63
|
-
wide={wide}
|
|
64
|
-
loading={loading}
|
|
65
|
-
disabled={disabled || loading}
|
|
66
|
-
size={size}
|
|
67
|
-
as={as}
|
|
68
|
-
onMouseDown={(e) => {
|
|
69
|
-
onMouseDown(e);
|
|
70
|
-
e.preventDefault();
|
|
71
|
-
}}
|
|
72
|
-
onKeyDown={(e) => {
|
|
73
|
-
onKeyDown(e);
|
|
74
|
-
if (disabled || loading) e.preventDefault();
|
|
75
|
-
}}
|
|
76
|
-
aria-disabled={disabled || loading}
|
|
77
|
-
aria-busy={loading}
|
|
78
|
-
{...rest}
|
|
79
|
-
ref={ref}
|
|
80
|
-
>
|
|
81
|
-
<ButtonContent
|
|
82
|
-
left={left}
|
|
83
|
-
right={right}
|
|
84
|
-
loading={loading}
|
|
85
|
-
loadingColors={loadingColors}
|
|
86
|
-
>
|
|
87
|
-
{children}
|
|
88
|
-
</ButtonContent>
|
|
89
|
-
</StyledLinkButton>
|
|
90
|
-
);
|
|
91
|
-
}
|
|
37
|
+
const LinkButton = forwardRef<HTMLButtonElement, LinkButtonProps>(
|
|
38
|
+
({ underline = 'hover', onMouseDown = () => {}, ...rest }, ref) => (
|
|
39
|
+
<StyledButton
|
|
40
|
+
underline={underline}
|
|
41
|
+
onMouseDown={(e) => {
|
|
42
|
+
onMouseDown(e);
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
}}
|
|
45
|
+
{...rest}
|
|
46
|
+
ref={ref}
|
|
47
|
+
/>
|
|
48
|
+
)
|
|
92
49
|
);
|
|
93
50
|
|
|
94
51
|
LinkButton.displayName = 'LinkButton';
|
package/src/Select/index.tsx
CHANGED
|
@@ -331,7 +331,7 @@ export const Placeholder = styled.span`
|
|
|
331
331
|
${ellipsisStyles};
|
|
332
332
|
`;
|
|
333
333
|
|
|
334
|
-
const
|
|
334
|
+
const titleUnborderedStyles = (p) =>
|
|
335
335
|
p.unbordered &&
|
|
336
336
|
css`
|
|
337
337
|
font-weight: 500;
|
|
@@ -350,7 +350,7 @@ export const Title = styled(
|
|
|
350
350
|
omitEmotionProps('disabled', 'unbordered')
|
|
351
351
|
)<TitleProps>`
|
|
352
352
|
color: ${(p) => clr(p.theme.colorText)};
|
|
353
|
-
${
|
|
353
|
+
${titleUnborderedStyles};
|
|
354
354
|
${titleDisabledStyles};
|
|
355
355
|
${ellipsisStyles};
|
|
356
356
|
`;
|
package/src/index.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { default as AvatarSkeleton } from './AvatarSkeleton';
|
|
|
4
4
|
export { default as Breadcrumb } from './Breadcrumb';
|
|
5
5
|
export { default as BreadcrumbItem } from './BreadcrumbItem';
|
|
6
6
|
export { default as Button } from './Button';
|
|
7
|
+
export { default as ButtonLink } from './ButtonLink';
|
|
7
8
|
export { default as Checkbox } from './Checkbox';
|
|
8
9
|
export { default as CheckboxSkeleton } from './CheckboxSkeleton';
|
|
9
10
|
export { default as DatePicker } from './DatePicker';
|
|
@@ -68,6 +69,7 @@ export * from './AvatarSkeleton';
|
|
|
68
69
|
export * from './Breadcrumb';
|
|
69
70
|
export * from './BreadcrumbItem';
|
|
70
71
|
export * from './Button';
|
|
72
|
+
export * from './ButtonLink';
|
|
71
73
|
export * from './Checkbox';
|
|
72
74
|
export * from './CheckboxSkeleton';
|
|
73
75
|
export * from './DatePicker';
|