@semcore/button 5.36.0 → 5.37.0
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/CHANGELOG.md +6 -0
- package/lib/cjs/component/AbstractButton/AbstractButton.js +182 -0
- package/lib/cjs/component/AbstractButton/AbstractButton.js.map +1 -0
- package/lib/cjs/component/AbstractButton/AbstractButton.type.js +2 -0
- package/lib/cjs/component/AbstractButton/AbstractButton.type.js.map +1 -0
- package/lib/cjs/component/AbstractButton/SpinButton.js.map +1 -0
- package/lib/cjs/component/Button/Button.js +94 -0
- package/lib/cjs/component/Button/Button.js.map +1 -0
- package/lib/cjs/component/Button/Button.type.js +2 -0
- package/lib/cjs/component/Button/Button.type.js.map +1 -0
- package/lib/cjs/{style → component/Button}/button.shadow.css +1 -1
- package/lib/cjs/component/ButtonLink/ButtonLink.js +92 -0
- package/lib/cjs/component/ButtonLink/ButtonLink.js.map +1 -0
- package/lib/cjs/component/ButtonLink/ButtonLink.type.js +2 -0
- package/lib/cjs/component/ButtonLink/ButtonLink.type.js.map +1 -0
- package/lib/cjs/component/ButtonLink/buttonLink.shadow.css +160 -0
- package/lib/cjs/index.js +40 -6
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/component/AbstractButton/AbstractButton.js +175 -0
- package/lib/es6/component/AbstractButton/AbstractButton.js.map +1 -0
- package/lib/es6/component/AbstractButton/AbstractButton.type.js +2 -0
- package/lib/es6/component/AbstractButton/AbstractButton.type.js.map +1 -0
- package/lib/es6/component/AbstractButton/SpinButton.js.map +1 -0
- package/lib/es6/component/Button/Button.js +87 -0
- package/lib/es6/component/Button/Button.js.map +1 -0
- package/lib/es6/component/Button/Button.type.js +2 -0
- package/lib/es6/component/Button/Button.type.js.map +1 -0
- package/lib/es6/{style → component/Button}/button.shadow.css +1 -1
- package/lib/es6/component/ButtonLink/ButtonLink.js +85 -0
- package/lib/es6/component/ButtonLink/ButtonLink.js.map +1 -0
- package/lib/es6/component/ButtonLink/ButtonLink.type.js +2 -0
- package/lib/es6/component/ButtonLink/ButtonLink.type.js.map +1 -0
- package/lib/es6/component/ButtonLink/buttonLink.shadow.css +160 -0
- package/lib/es6/index.js +5 -2
- package/lib/es6/index.js.map +1 -1
- package/lib/types/component/AbstractButton/AbstractButton.d.ts +24 -0
- package/lib/types/component/AbstractButton/AbstractButton.type.d.ts +39 -0
- package/lib/types/component/AbstractButton/SpinButton.d.ts +3 -0
- package/lib/types/component/Button/Button.d.ts +3 -0
- package/lib/types/component/Button/Button.type.d.ts +39 -0
- package/lib/types/component/ButtonLink/ButtonLink.d.ts +2 -0
- package/lib/types/component/ButtonLink/ButtonLink.type.d.ts +25 -0
- package/lib/types/index.d.ts +5 -68
- package/package.json +12 -7
- package/src/{Button.jsx → component/AbstractButton/AbstractButton.tsx} +24 -38
- package/src/component/AbstractButton/AbstractButton.type.ts +46 -0
- package/src/{SpinButton.jsx → component/AbstractButton/SpinButton.tsx} +2 -2
- package/src/component/Button/Button.tsx +45 -0
- package/src/component/Button/Button.type.ts +48 -0
- package/src/{style → component/Button}/button.shadow.css +1 -1
- package/src/component/ButtonLink/ButtonLink.tsx +42 -0
- package/src/component/ButtonLink/ButtonLink.type.ts +41 -0
- package/src/component/ButtonLink/buttonLink.shadow.css +160 -0
- package/src/index.ts +5 -0
- package/lib/cjs/Button.js +0 -237
- package/lib/cjs/Button.js.map +0 -1
- package/lib/cjs/SpinButton.js.map +0 -1
- package/lib/cjs/index.d.js +0 -2
- package/lib/cjs/index.d.js.map +0 -1
- package/lib/es6/Button.js +0 -231
- package/lib/es6/Button.js.map +0 -1
- package/lib/es6/SpinButton.js.map +0 -1
- package/lib/es6/index.d.js +0 -2
- package/lib/es6/index.d.js.map +0 -1
- package/src/index.d.ts +0 -68
- package/src/index.js +0 -2
- /package/lib/cjs/{SpinButton.js → component/AbstractButton/SpinButton.js} +0 -0
- /package/lib/es6/{SpinButton.js → component/AbstractButton/SpinButton.js} +0 -0
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import createComponent, { Component, sstyled, Root } from '@semcore/core';
|
|
3
2
|
import { Box } from '@semcore/flex-box';
|
|
4
3
|
import { Hint } from '@semcore/tooltip';
|
|
5
4
|
import NeighborLocation from '@semcore/neighbor-location';
|
|
6
|
-
import keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
7
5
|
import addonTextChildren from '@semcore/utils/lib/addonTextChildren';
|
|
8
6
|
import logger from '@semcore/utils/lib/logger';
|
|
9
7
|
import SpinButton from './SpinButton';
|
|
10
|
-
|
|
11
|
-
import style from './style/button.shadow.css';
|
|
12
8
|
import hasLabels from '@semcore/utils/lib/hasLabels';
|
|
9
|
+
import { AbstractButtonProps } from './AbstractButton.type';
|
|
10
|
+
import { Component, CORE_INSTANCE, Root, sstyled } from '@semcore/core';
|
|
13
11
|
|
|
14
|
-
export const MAP_USE_DEFAULT_THEME = {
|
|
12
|
+
export const MAP_USE_DEFAULT_THEME: Record<string, string> = {
|
|
15
13
|
primary: 'info',
|
|
16
14
|
secondary: 'muted',
|
|
17
15
|
tertiary: 'info',
|
|
18
16
|
};
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
static
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
size: 'm',
|
|
27
|
-
};
|
|
28
|
-
containerRef = React.createRef();
|
|
18
|
+
type Props = AbstractButtonProps<any, any, any>;
|
|
19
|
+
|
|
20
|
+
export abstract class AbstractButton extends Component<Props, {}, {}> {
|
|
21
|
+
static displayName = 'AbstractButton';
|
|
22
|
+
|
|
23
|
+
containerRef = React.createRef<HTMLButtonElement>();
|
|
29
24
|
|
|
30
25
|
state = {
|
|
31
26
|
ariaLabelledByContent: null,
|
|
32
27
|
};
|
|
33
28
|
|
|
29
|
+
protected abstract getTextColor(): string | undefined;
|
|
30
|
+
|
|
34
31
|
getTextProps() {
|
|
35
32
|
const { size } = this.asProps;
|
|
33
|
+
|
|
36
34
|
return {
|
|
37
35
|
size,
|
|
38
36
|
};
|
|
@@ -50,21 +48,22 @@ class RootButton extends Component {
|
|
|
50
48
|
logger.warn(
|
|
51
49
|
this.containerRef.current && !hasLabels(this.containerRef.current) && !this.asProps.title,
|
|
52
50
|
`'title' or 'aria-label' or 'aria-labelledby' are required props for buttons without text content`,
|
|
53
|
-
this.asProps['data-ui-name'] ||
|
|
51
|
+
this.asProps['data-ui-name'] || AbstractButton.displayName,
|
|
54
52
|
);
|
|
55
53
|
}
|
|
56
54
|
|
|
57
|
-
|
|
55
|
+
const ariaLabelledby = this.asProps['aria-labelledby'];
|
|
56
|
+
|
|
57
|
+
if (ariaLabelledby) {
|
|
58
58
|
setTimeout(() => {
|
|
59
59
|
this.setState({
|
|
60
|
-
ariaLabelledByContent:
|
|
61
|
-
document.getElementById(this.asProps['aria-labelledby'])?.textContent ?? '',
|
|
60
|
+
ariaLabelledByContent: document.getElementById(ariaLabelledby)?.textContent ?? '',
|
|
62
61
|
});
|
|
63
62
|
}, 0);
|
|
64
63
|
}
|
|
65
64
|
}
|
|
66
65
|
|
|
67
|
-
renderButton({ buttonProps, children }) {
|
|
66
|
+
renderButton({ buttonProps, children }: any) {
|
|
68
67
|
const { styles } = this.asProps;
|
|
69
68
|
const SButton = Root;
|
|
70
69
|
|
|
@@ -75,7 +74,7 @@ class RootButton extends Component {
|
|
|
75
74
|
);
|
|
76
75
|
}
|
|
77
76
|
|
|
78
|
-
renderButtonWithHint({ buttonProps, children, hintProps }) {
|
|
77
|
+
renderButtonWithHint({ buttonProps, children, hintProps }: any) {
|
|
79
78
|
const { styles } = this.asProps;
|
|
80
79
|
const SButton = Root;
|
|
81
80
|
|
|
@@ -103,17 +102,20 @@ class RootButton extends Component {
|
|
|
103
102
|
addonRight: AddonRight,
|
|
104
103
|
hintPlacement,
|
|
105
104
|
} = this.asProps;
|
|
105
|
+
// @ts-ignore
|
|
106
|
+
const Button = this[CORE_INSTANCE];
|
|
106
107
|
const useTheme = use && theme ? `${use}-${theme}` : false;
|
|
107
108
|
const SInner = Box;
|
|
108
109
|
const SSpin = Box;
|
|
109
110
|
const buttonAriaLabel = title ?? ariaLabel ?? this.state.ariaLabelledByContent ?? '';
|
|
110
111
|
|
|
111
|
-
const buttonProps = {
|
|
112
|
+
const buttonProps: Record<string, any> = {
|
|
112
113
|
type: 'button',
|
|
113
114
|
tag: 'button',
|
|
114
115
|
disabled,
|
|
115
116
|
'use:theme': useTheme,
|
|
116
117
|
ref: this.containerRef,
|
|
118
|
+
'text-color': this.getTextColor(),
|
|
117
119
|
'aria-busy': loading,
|
|
118
120
|
'aria-disabled': disabled,
|
|
119
121
|
__excludeProps: ['title'],
|
|
@@ -132,6 +134,7 @@ class RootButton extends Component {
|
|
|
132
134
|
{(neighborLocation) => {
|
|
133
135
|
const children = sstyled(styles)(
|
|
134
136
|
<>
|
|
137
|
+
{/* @ts-ignore */}
|
|
135
138
|
<SInner tag='span' loading={loading}>
|
|
136
139
|
{AddonLeft ? (
|
|
137
140
|
<Button.Addon>
|
|
@@ -164,20 +167,3 @@ class RootButton extends Component {
|
|
|
164
167
|
);
|
|
165
168
|
}
|
|
166
169
|
}
|
|
167
|
-
|
|
168
|
-
function Text(props) {
|
|
169
|
-
const SText = Root;
|
|
170
|
-
return sstyled(props.styles)(<SText render={Box} tag='span' />);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
function Addon(props) {
|
|
174
|
-
const SAddon = Root;
|
|
175
|
-
return sstyled(props.styles)(<SAddon render={Box} tag='span' />);
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
const Button = createComponent(RootButton, {
|
|
179
|
-
Text,
|
|
180
|
-
Addon,
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
export default Button;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { PropGetterFn } from '@semcore/core';
|
|
3
|
+
import { KeyboardFocusProps } from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
4
|
+
import { BoxProps } from '@semcore/flex-box';
|
|
5
|
+
import { NeighborItemProps } from '@semcore/neighbor-location';
|
|
6
|
+
import { TooltipHintProps } from '@semcore/tooltip';
|
|
7
|
+
|
|
8
|
+
export type AbstractButtonProps<S, U, T> = BoxProps &
|
|
9
|
+
NeighborItemProps &
|
|
10
|
+
KeyboardFocusProps & {
|
|
11
|
+
/** Button activity state */
|
|
12
|
+
active?: boolean;
|
|
13
|
+
/** Disabled button state */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Loading button state */
|
|
16
|
+
loading?: boolean;
|
|
17
|
+
/** Tag for the left Addon */
|
|
18
|
+
addonLeft?: React.ElementType;
|
|
19
|
+
/** Tag for the right Addon */
|
|
20
|
+
addonRight?: React.ElementType;
|
|
21
|
+
/**
|
|
22
|
+
* Placement for hint
|
|
23
|
+
* @default top
|
|
24
|
+
*/
|
|
25
|
+
hintPlacement?: TooltipHintProps['placement'];
|
|
26
|
+
|
|
27
|
+
/** Button type. Defined in Button.type or ButtonLink.type */
|
|
28
|
+
size?: S;
|
|
29
|
+
/** Button usage. Defined in Button.type or ButtonLink.type */
|
|
30
|
+
use?: U;
|
|
31
|
+
/** Button theme. Defined in Button.type or ButtonLink.type */
|
|
32
|
+
theme?: T;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type AbstractButtonAddonProps<S> = BoxProps & {
|
|
36
|
+
size?: S;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export type AbstractButtonTextProps<S> = BoxProps & {
|
|
40
|
+
size?: S;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export type AbstractButtonContext = {
|
|
44
|
+
getTextProps: PropGetterFn;
|
|
45
|
+
getAddonProps: PropGetterFn;
|
|
46
|
+
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Spin from '@semcore/spin';
|
|
3
3
|
|
|
4
|
-
export const SPIN_SIZE_MAP = {
|
|
4
|
+
export const SPIN_SIZE_MAP: Record<string, string> = {
|
|
5
5
|
xl: 'm',
|
|
6
6
|
l: 's',
|
|
7
7
|
m: 'xs',
|
|
8
8
|
s: 'xxs',
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
export default function SpinButton({ theme, size, ...others }) {
|
|
11
|
+
export default function SpinButton({ theme, size, ...others }: any) {
|
|
12
12
|
return (
|
|
13
13
|
<Spin
|
|
14
14
|
size={typeof size === 'string' ? SPIN_SIZE_MAP[size] : size}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import createComponent, { sstyled, Root } from '@semcore/core';
|
|
3
|
+
import { Box } from '@semcore/flex-box';
|
|
4
|
+
import keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
5
|
+
|
|
6
|
+
import style from './button.shadow.css';
|
|
7
|
+
import { AbstractButton } from '../AbstractButton/AbstractButton';
|
|
8
|
+
import {
|
|
9
|
+
ButtonAddonProps,
|
|
10
|
+
ButtonChildren,
|
|
11
|
+
ButtonComponent,
|
|
12
|
+
ButtonProps,
|
|
13
|
+
ButtonTextProps,
|
|
14
|
+
} from './Button.type';
|
|
15
|
+
|
|
16
|
+
class RootButton extends AbstractButton {
|
|
17
|
+
static displayName = 'Button';
|
|
18
|
+
static enhance = [keyboardFocusEnhance()];
|
|
19
|
+
static style = style;
|
|
20
|
+
static defaultProps = {
|
|
21
|
+
use: 'secondary',
|
|
22
|
+
size: 'm',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
protected getTextColor(): string | undefined {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function Text(props: ButtonTextProps) {
|
|
31
|
+
const SText = Root;
|
|
32
|
+
return sstyled(props.styles)(<SText render={Box} tag='span' />);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function Addon(props: ButtonAddonProps) {
|
|
36
|
+
const SAddon = Root;
|
|
37
|
+
return sstyled(props.styles)(<SAddon render={Box} tag='span' />);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const Button = createComponent(RootButton, {
|
|
41
|
+
Text,
|
|
42
|
+
Addon,
|
|
43
|
+
}) as ButtonComponent;
|
|
44
|
+
|
|
45
|
+
export default Button;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { UnknownProperties, Intergalactic } from '@semcore/core';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AbstractButtonAddonProps,
|
|
5
|
+
AbstractButtonContext,
|
|
6
|
+
AbstractButtonTextProps,
|
|
7
|
+
AbstractButtonProps,
|
|
8
|
+
} from '../AbstractButton/AbstractButton.type';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Button size
|
|
12
|
+
* @default m
|
|
13
|
+
*/
|
|
14
|
+
export type ButtonSize = 'l' | 'm';
|
|
15
|
+
/**
|
|
16
|
+
* Button type
|
|
17
|
+
* @default secondary
|
|
18
|
+
*/
|
|
19
|
+
type Use = 'primary' | 'secondary' | 'tertiary';
|
|
20
|
+
|
|
21
|
+
/** Button theme */
|
|
22
|
+
type Theme = 'info' | 'success' | 'warning' | 'danger' | 'muted' | 'invert';
|
|
23
|
+
|
|
24
|
+
/** @deprecated */
|
|
25
|
+
export interface IButtonProps extends ButtonProps, UnknownProperties {}
|
|
26
|
+
export type ButtonProps = AbstractButtonProps<ButtonSize, Use, Theme>;
|
|
27
|
+
|
|
28
|
+
/** @deprecated */
|
|
29
|
+
export interface IButtonTextProps extends ButtonTextProps, UnknownProperties {}
|
|
30
|
+
export type ButtonTextProps = AbstractButtonTextProps<ButtonSize>;
|
|
31
|
+
|
|
32
|
+
/** @deprecated */
|
|
33
|
+
export interface IButtonAddonProps extends ButtonAddonProps, UnknownProperties {}
|
|
34
|
+
export type ButtonAddonProps = AbstractButtonAddonProps<ButtonSize>;
|
|
35
|
+
|
|
36
|
+
/** @deprecated */
|
|
37
|
+
export interface IButtonContext extends ButtonContext, UnknownProperties {}
|
|
38
|
+
export type ButtonContext = AbstractButtonContext;
|
|
39
|
+
|
|
40
|
+
export type ButtonChildren = {
|
|
41
|
+
Text: Intergalactic.Component<'span', ButtonTextProps>;
|
|
42
|
+
Addon: Intergalactic.Component<'span', ButtonAddonProps>;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type ButtonComponent = Intergalactic.Component<'button', ButtonProps, ButtonContext> & {
|
|
46
|
+
Text: Intergalactic.Component<'span', ButtonTextProps>;
|
|
47
|
+
Addon: Intergalactic.Component<'span', ButtonAddonProps>;
|
|
48
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import createComponent, { sstyled, Root } from '@semcore/core';
|
|
3
|
+
import style from './buttonLink.shadow.css';
|
|
4
|
+
import keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
5
|
+
import { Box } from '@semcore/flex-box';
|
|
6
|
+
import { AbstractButton } from '../AbstractButton/AbstractButton';
|
|
7
|
+
import resolveColorEnhance from '@semcore/utils/lib/enhances/resolveColorEnhance';
|
|
8
|
+
import { ButtonLinkAddonProps, ButtonLinkComponent, ButtonLinkTextProps } from './ButtonLink.type';
|
|
9
|
+
|
|
10
|
+
const enhance = {
|
|
11
|
+
keyboardFocused: keyboardFocusEnhance(),
|
|
12
|
+
resolveColor: resolveColorEnhance(),
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
class RootButtonLink extends AbstractButton {
|
|
16
|
+
static displayName = 'ButtonLink';
|
|
17
|
+
static enhance = Object.values(enhance);
|
|
18
|
+
static style = style;
|
|
19
|
+
static defaultProps = {
|
|
20
|
+
use: 'primary',
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
protected getTextColor(): string | undefined {
|
|
24
|
+
const { color, resolveColor } = this.asProps as any;
|
|
25
|
+
return resolveColor(color);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
function Text(props: ButtonLinkTextProps) {
|
|
30
|
+
const SText = Root;
|
|
31
|
+
return sstyled(props.styles)(<SText render={Box} tag='span' />);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function Addon(props: ButtonLinkAddonProps) {
|
|
35
|
+
const SAddon = Root;
|
|
36
|
+
return sstyled(props.styles)(<SAddon render={Box} tag='span' />);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export const ButtonLink = createComponent(RootButtonLink, {
|
|
40
|
+
Text,
|
|
41
|
+
Addon,
|
|
42
|
+
}) as ButtonLinkComponent;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { UnknownProperties, Intergalactic } from '@semcore/core';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
AbstractButtonAddonProps,
|
|
5
|
+
AbstractButtonContext,
|
|
6
|
+
AbstractButtonTextProps,
|
|
7
|
+
AbstractButtonProps,
|
|
8
|
+
} from '../AbstractButton/AbstractButton.type';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Button link size
|
|
12
|
+
* @default m
|
|
13
|
+
*/
|
|
14
|
+
export type ButtonLinkSize = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800;
|
|
15
|
+
/**
|
|
16
|
+
* Button link type
|
|
17
|
+
* @default primary
|
|
18
|
+
*/
|
|
19
|
+
type Use = 'primary' | 'secondary';
|
|
20
|
+
|
|
21
|
+
export type ButtonLinkProps = AbstractButtonProps<ButtonLinkSize, Use, never>;
|
|
22
|
+
|
|
23
|
+
export type ButtonLinkTextProps = AbstractButtonTextProps<ButtonLinkSize>;
|
|
24
|
+
|
|
25
|
+
export type ButtonLinkAddonProps = AbstractButtonAddonProps<ButtonLinkSize>;
|
|
26
|
+
|
|
27
|
+
export type ButtonLinkContext = AbstractButtonContext;
|
|
28
|
+
|
|
29
|
+
export type ButtonLinkChildren = {
|
|
30
|
+
Text: Intergalactic.Component<'span', ButtonLinkTextProps>;
|
|
31
|
+
Addon: Intergalactic.Component<'span', ButtonLinkAddonProps>;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type ButtonLinkComponent = Intergalactic.Component<
|
|
35
|
+
'button',
|
|
36
|
+
ButtonLinkProps,
|
|
37
|
+
ButtonLinkContext
|
|
38
|
+
> & {
|
|
39
|
+
Text: Intergalactic.Component<'span', ButtonLinkTextProps>;
|
|
40
|
+
Addon: Intergalactic.Component<'span', ButtonLinkAddonProps>;
|
|
41
|
+
};
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
SButton {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
font-family: inherit;
|
|
4
|
+
font-size: var(--intergalactic-fs-200, 14px);
|
|
5
|
+
color: var(--intergalactic-text-link, #006dca);
|
|
6
|
+
line-height: normal;
|
|
7
|
+
position: relative;
|
|
8
|
+
cursor: pointer;
|
|
9
|
+
text-decoration: none;
|
|
10
|
+
border: none;
|
|
11
|
+
padding: 0;
|
|
12
|
+
margin: 0;
|
|
13
|
+
box-shadow: none;
|
|
14
|
+
-webkit-tap-highlight-color: transparent;
|
|
15
|
+
outline: 0;
|
|
16
|
+
background: none;
|
|
17
|
+
transition: color 0.15s ease-in-out;
|
|
18
|
+
|
|
19
|
+
&:active,
|
|
20
|
+
&:hover,
|
|
21
|
+
&:focus {
|
|
22
|
+
outline: 0;
|
|
23
|
+
text-decoration: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&::-moz-focus-inner {
|
|
27
|
+
border: none;
|
|
28
|
+
padding: 0;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
&[active],
|
|
32
|
+
&:hover,
|
|
33
|
+
&:active {
|
|
34
|
+
color: var(--intergalactic-text-link-hover-active, #044792);
|
|
35
|
+
|
|
36
|
+
& SText {
|
|
37
|
+
border-color: currentColor;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
&[enableVisited]:visited,
|
|
42
|
+
&[enableVisited]:visited:hover {
|
|
43
|
+
color: var(--intergalactic-text-link-visited, #8649e1);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
SText {
|
|
47
|
+
border-bottom-width: 1px;
|
|
48
|
+
border-bottom-style: solid;
|
|
49
|
+
border-color: transparent;
|
|
50
|
+
transition: border-bottom-color 0.15s ease-in-out;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
SButton[keyboardFocused] {
|
|
55
|
+
outline-color: var(--intergalactic-keyboard-focus-outline, rgba(0, 143, 248, 0.5));
|
|
56
|
+
outline-style: solid;
|
|
57
|
+
outline-width: 3px;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
SButton[visually-disabled] {
|
|
61
|
+
opacity: var(--intergalactic-disabled-opacity, 0.3);
|
|
62
|
+
cursor: default;
|
|
63
|
+
/* Disable link interactions */
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
SButton[use='secondary'] {
|
|
68
|
+
color: var(--intergalactic-text-hint, #6c6e79);
|
|
69
|
+
|
|
70
|
+
&[active],
|
|
71
|
+
&:active,
|
|
72
|
+
&:hover {
|
|
73
|
+
color: var(--intergalactic-text-hint-hover-active, #484a54);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
SText {
|
|
77
|
+
border-bottom-width: 1px;
|
|
78
|
+
border-bottom-style: dashed;
|
|
79
|
+
border-color: currentColor;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
SAddon {
|
|
84
|
+
display: inline-flex;
|
|
85
|
+
justify-content: center;
|
|
86
|
+
align-items: center;
|
|
87
|
+
margin-bottom: var(--intergalactic-spacing-05x, 2px);
|
|
88
|
+
vertical-align: middle;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
SButton SAddon {
|
|
92
|
+
&:not(:only-child):first-child {
|
|
93
|
+
margin-right: var(--intergalactic-spacing-1x, 4px);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
&:not(:only-child):last-child {
|
|
97
|
+
margin-left: var(--intergalactic-spacing-1x, 4px);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
SButton[text-color] {
|
|
102
|
+
color: var(--text-color);
|
|
103
|
+
|
|
104
|
+
&[active],
|
|
105
|
+
&:hover,
|
|
106
|
+
&:active {
|
|
107
|
+
color: var(--text-color);
|
|
108
|
+
filter: brightness(0.8);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
SButton[size='100'] {
|
|
113
|
+
font-size: var(--intergalactic-fs-100, 12px);
|
|
114
|
+
line-height: var(--intergalactic-lh-100, 133%);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
SButton[size='200'] {
|
|
118
|
+
font-size: var(--intergalactic-fs-200, 14px);
|
|
119
|
+
line-height: var(--intergalactic-lh-200, 142%);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
SButton[size='300'] {
|
|
123
|
+
font-size: var(--intergalactic-fs-300, 16px);
|
|
124
|
+
line-height: var(--intergalactic-lh-300, 150%);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
SButton[size='400'] {
|
|
128
|
+
font-size: var(--intergalactic-fs-400, 20px);
|
|
129
|
+
line-height: var(--intergalactic-lh-400, 120%);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
SButton[size='500'] {
|
|
133
|
+
font-size: var(--intergalactic-fs-500, 24px);
|
|
134
|
+
line-height: var(--intergalactic-lh-500, 117%);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
SButton[size='600'] {
|
|
138
|
+
font-size: var(--intergalactic-fs-600, 32px);
|
|
139
|
+
line-height: var(--intergalactic-lh-600, 125%);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
SButton[size='700'] {
|
|
143
|
+
font-size: var(--intergalactic-fs-700, 36px);
|
|
144
|
+
line-height: var(--intergalactic-lh-700, 110%);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
SButton[size='800'] {
|
|
148
|
+
font-size: var(--intergalactic-fs-800, 48px);
|
|
149
|
+
line-height: var(--intergalactic-lh-800, 117%);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@media (prefers-reduced-motion) {
|
|
153
|
+
SButton {
|
|
154
|
+
transition: none;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
SText {
|
|
158
|
+
transition: none;
|
|
159
|
+
}
|
|
160
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default } from './component/Button/Button';
|
|
2
|
+
export * from './component/Button/Button.type';
|
|
3
|
+
export * from './component/ButtonLink/ButtonLink';
|
|
4
|
+
export * from './component/ButtonLink/ButtonLink.type';
|
|
5
|
+
export { MAP_USE_DEFAULT_THEME } from './component/AbstractButton/AbstractButton';
|