@semcore/button 16.1.0 → 16.1.1
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 +1 -1
- package/lib/cjs/component/AbstractButton/AbstractButton.js +189 -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 +50 -160
- package/lib/cjs/component/Button/Button.js.map +1 -1
- package/lib/cjs/component/Button/Button.type.js.map +1 -1
- package/lib/cjs/component/ButtonLink/ButtonLink.js +54 -29
- package/lib/cjs/component/ButtonLink/ButtonLink.js.map +1 -1
- package/lib/cjs/component/ButtonLink/ButtonLink.type.js.map +1 -1
- package/lib/cjs/component/ButtonLink/buttonLink.shadow.css +140 -10
- package/lib/cjs/index.js +4 -3
- package/lib/cjs/index.js.map +1 -1
- package/lib/es6/component/AbstractButton/AbstractButton.js +184 -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 +49 -160
- package/lib/es6/component/Button/Button.js.map +1 -1
- package/lib/es6/component/Button/Button.type.js.map +1 -1
- package/lib/es6/component/ButtonLink/ButtonLink.js +56 -30
- package/lib/es6/component/ButtonLink/ButtonLink.js.map +1 -1
- package/lib/es6/component/ButtonLink/ButtonLink.type.js.map +1 -1
- package/lib/es6/component/ButtonLink/buttonLink.shadow.css +140 -10
- package/lib/es6/index.js +2 -1
- package/lib/es6/index.js.map +1 -1
- package/lib/esm/component/AbstractButton/AbstractButton.mjs +157 -0
- package/lib/esm/component/{Button → AbstractButton}/SpinButton.mjs +2 -1
- package/lib/esm/component/Button/Button.mjs +48 -140
- package/lib/esm/component/ButtonLink/ButtonLink.mjs +52 -30
- package/lib/esm/component/ButtonLink/buttonLink.shadow.css +140 -10
- package/lib/esm/index.mjs +2 -3
- package/lib/types/component/AbstractButton/AbstractButton.d.ts +24 -0
- package/lib/types/component/AbstractButton/AbstractButton.type.d.ts +38 -0
- package/lib/types/component/Button/Button.d.ts +1 -28
- package/lib/types/component/Button/Button.type.d.ts +39 -40
- package/lib/types/component/ButtonLink/ButtonLink.type.d.ts +19 -14
- package/lib/types/index.d.ts +2 -1
- package/package.json +7 -7
- package/lib/cjs/component/Button/SpinButton.js.map +0 -1
- package/lib/es6/component/Button/SpinButton.js.map +0 -1
- package/lib/esm/component/Button/Button.type.mjs +0 -1
- package/lib/esm/component/ButtonLink/ButtonLink.type.mjs +0 -1
- /package/lib/cjs/component/{Button → AbstractButton}/SpinButton.js +0 -0
- /package/lib/es6/component/{Button → AbstractButton}/SpinButton.js +0 -0
- /package/lib/types/component/{Button → AbstractButton}/SpinButton.d.ts +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PropGetterFn } from '@semcore/core';
|
|
2
|
+
import type { BoxProps } from '@semcore/flex-box';
|
|
3
|
+
import type { NeighborItemProps } from '@semcore/neighbor-location';
|
|
4
|
+
import type { TooltipHintProps } from '@semcore/tooltip';
|
|
5
|
+
import type React from 'react';
|
|
6
|
+
export type AbstractButtonProps<S, U, T> = BoxProps & NeighborItemProps & {
|
|
7
|
+
/** Button activity state */
|
|
8
|
+
active?: boolean;
|
|
9
|
+
/** Disabled button state */
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
/** Loading button state */
|
|
12
|
+
loading?: boolean;
|
|
13
|
+
/** Tag for the left Addon */
|
|
14
|
+
addonLeft?: React.ElementType;
|
|
15
|
+
/** Tag for the right Addon */
|
|
16
|
+
addonRight?: React.ElementType;
|
|
17
|
+
/**
|
|
18
|
+
* Placement for hint
|
|
19
|
+
* @default top
|
|
20
|
+
*/
|
|
21
|
+
hintPlacement?: TooltipHintProps['placement'];
|
|
22
|
+
/** Button size. Defined in Button.type or ButtonLink.type */
|
|
23
|
+
size?: S;
|
|
24
|
+
/** Button usage. Defined in Button.type or ButtonLink.type */
|
|
25
|
+
use?: U;
|
|
26
|
+
/** Button theme. Defined in Button.type or ButtonLink.type */
|
|
27
|
+
theme?: T;
|
|
28
|
+
};
|
|
29
|
+
export type AbstractButtonAddonProps<S> = BoxProps & {
|
|
30
|
+
size?: S;
|
|
31
|
+
};
|
|
32
|
+
export type AbstractButtonTextProps<S> = BoxProps & {
|
|
33
|
+
size?: S;
|
|
34
|
+
};
|
|
35
|
+
export type AbstractButtonContext = {
|
|
36
|
+
getTextProps: PropGetterFn;
|
|
37
|
+
getAddonProps: PropGetterFn;
|
|
38
|
+
};
|
|
@@ -1,30 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { ButtonProps, ButtonComponent } from './Button.type';
|
|
4
|
-
export declare const MAP_USE_DEFAULT_THEME: Record<string, string>;
|
|
5
|
-
type State = {
|
|
6
|
-
ariaLabelledByContent: null | string;
|
|
7
|
-
};
|
|
8
|
-
export declare class RootButton extends Component<ButtonProps, [], never, {}, State> {
|
|
9
|
-
static displayName: string;
|
|
10
|
-
static style: {
|
|
11
|
-
[key: string]: string;
|
|
12
|
-
};
|
|
13
|
-
static defaultProps: {
|
|
14
|
-
use: string;
|
|
15
|
-
size: string;
|
|
16
|
-
};
|
|
17
|
-
containerRef: React.RefObject<HTMLButtonElement>;
|
|
18
|
-
state: State;
|
|
19
|
-
getTextProps(): {
|
|
20
|
-
size: "l" | "m" | undefined;
|
|
21
|
-
'hint:triggerRef': React.RefObject<HTMLButtonElement>;
|
|
22
|
-
};
|
|
23
|
-
getAddonProps(): {
|
|
24
|
-
size: "l" | "m" | undefined;
|
|
25
|
-
};
|
|
26
|
-
componentDidMount(): void;
|
|
27
|
-
render(): React.JSX.Element;
|
|
28
|
-
}
|
|
1
|
+
import type { ButtonComponent } from './Button.type';
|
|
29
2
|
declare const Button: ButtonComponent;
|
|
30
3
|
export default Button;
|
|
@@ -1,44 +1,43 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
}
|
|
34
|
-
export type
|
|
35
|
-
export type ButtonAddonProps = BoxProps;
|
|
36
|
-
export type ButtonContext = {
|
|
37
|
-
getTextProps: PropGetterFn;
|
|
38
|
-
getAddonProps: PropGetterFn;
|
|
39
|
-
};
|
|
1
|
+
import type { UnknownProperties, Intergalactic } from '@semcore/core';
|
|
2
|
+
import type { AbstractButtonAddonProps, AbstractButtonContext, AbstractButtonTextProps, AbstractButtonProps } from '../AbstractButton/AbstractButton.type';
|
|
3
|
+
/**
|
|
4
|
+
* Button size
|
|
5
|
+
* @default m
|
|
6
|
+
*/
|
|
7
|
+
export type ButtonSize = 'l' | 'm';
|
|
8
|
+
/**
|
|
9
|
+
* Button type
|
|
10
|
+
* @default secondary
|
|
11
|
+
*/
|
|
12
|
+
type Use = 'primary' | 'secondary' | 'tertiary';
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated don't use it. use `danger` for incorrect or danger behavior and `brand` for the orange one.
|
|
15
|
+
*/
|
|
16
|
+
type DeprecatedTheme = 'warning';
|
|
17
|
+
/** Button theme */
|
|
18
|
+
type Theme = 'info' | 'success' | 'brand' | 'danger' | 'muted' | 'invert';
|
|
19
|
+
/** @deprecated */
|
|
20
|
+
export interface IButtonProps extends ButtonProps, UnknownProperties {
|
|
21
|
+
}
|
|
22
|
+
export type ButtonProps = AbstractButtonProps<ButtonSize, Use, Theme | DeprecatedTheme>;
|
|
23
|
+
/** @deprecated */
|
|
24
|
+
export interface IButtonTextProps extends ButtonTextProps, UnknownProperties {
|
|
25
|
+
}
|
|
26
|
+
export type ButtonTextProps = AbstractButtonTextProps<ButtonSize>;
|
|
27
|
+
/** @deprecated */
|
|
28
|
+
export interface IButtonAddonProps extends ButtonAddonProps, UnknownProperties {
|
|
29
|
+
}
|
|
30
|
+
export type ButtonAddonProps = AbstractButtonAddonProps<ButtonSize>;
|
|
31
|
+
/** @deprecated */
|
|
32
|
+
export interface IButtonContext extends ButtonContext, UnknownProperties {
|
|
33
|
+
}
|
|
34
|
+
export type ButtonContext = AbstractButtonContext;
|
|
40
35
|
export type ButtonChildren = {
|
|
41
36
|
Text: Intergalactic.Component<'span', ButtonTextProps>;
|
|
42
37
|
Addon: Intergalactic.Component<'span', ButtonAddonProps>;
|
|
43
38
|
};
|
|
44
|
-
export type ButtonComponent = Intergalactic.Component<'button', ButtonProps, ButtonContext> &
|
|
39
|
+
export type ButtonComponent = Intergalactic.Component<'button', ButtonProps, ButtonContext> & {
|
|
40
|
+
Text: Intergalactic.Component<'span', ButtonTextProps>;
|
|
41
|
+
Addon: Intergalactic.Component<'span', ButtonAddonProps>;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import type { BoxProps } from '@semcore/base-components';
|
|
2
1
|
import type { Intergalactic } from '@semcore/core';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export type
|
|
14
|
-
export type
|
|
2
|
+
import type { AbstractButtonAddonProps, AbstractButtonContext, AbstractButtonTextProps, AbstractButtonProps } from '../AbstractButton/AbstractButton.type';
|
|
3
|
+
/**
|
|
4
|
+
* Button link size
|
|
5
|
+
*/
|
|
6
|
+
export type ButtonLinkSize = 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800;
|
|
7
|
+
/**
|
|
8
|
+
* Button link type
|
|
9
|
+
* @default primary
|
|
10
|
+
*/
|
|
11
|
+
type Use = 'primary' | 'secondary';
|
|
12
|
+
export type ButtonLinkProps = AbstractButtonProps<ButtonLinkSize, Use, never>;
|
|
13
|
+
export type ButtonLinkTextProps = AbstractButtonTextProps<ButtonLinkSize>;
|
|
14
|
+
export type ButtonLinkAddonProps = AbstractButtonAddonProps<ButtonLinkSize>;
|
|
15
|
+
export type ButtonLinkContext = AbstractButtonContext;
|
|
15
16
|
export type ButtonLinkChildren = {
|
|
16
17
|
Text: Intergalactic.Component<'span', ButtonLinkTextProps>;
|
|
17
18
|
Addon: Intergalactic.Component<'span', ButtonLinkAddonProps>;
|
|
18
19
|
};
|
|
19
|
-
export type ButtonLinkComponent = Intergalactic.Component<'button', ButtonLinkProps,
|
|
20
|
+
export type ButtonLinkComponent = Intergalactic.Component<'button', ButtonLinkProps, ButtonLinkContext> & {
|
|
21
|
+
Text: Intergalactic.Component<'span', ButtonLinkTextProps>;
|
|
22
|
+
Addon: Intergalactic.Component<'span', ButtonLinkAddonProps>;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
package/lib/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { default
|
|
1
|
+
export { default } from './component/Button/Button';
|
|
2
2
|
export * from './component/Button/Button.type';
|
|
3
3
|
export * from './component/ButtonLink/ButtonLink';
|
|
4
4
|
export * from './component/ButtonLink/ButtonLink.type';
|
|
5
|
+
export { MAP_USE_DEFAULT_THEME } from './component/AbstractButton/AbstractButton';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/button",
|
|
3
3
|
"description": "Semrush Button Component",
|
|
4
|
-
"version": "16.1.
|
|
4
|
+
"version": "16.1.1",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
"types": "./lib/types/index.d.ts"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@semcore/flex-box": "16.1.
|
|
18
|
-
"@semcore/neighbor-location": "16.1.
|
|
19
|
-
"@semcore/spin": "16.1.
|
|
20
|
-
"@semcore/tooltip": "16.1.
|
|
17
|
+
"@semcore/flex-box": "16.1.1",
|
|
18
|
+
"@semcore/neighbor-location": "16.1.1",
|
|
19
|
+
"@semcore/spin": "16.1.1",
|
|
20
|
+
"@semcore/tooltip": "16.1.1"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@semcore/base-components": "^16.6.0"
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
"directory": "semcore/button"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"@semcore/
|
|
32
|
-
"@semcore/icon": "16.8.0",
|
|
31
|
+
"@semcore/icon": "16.8.1",
|
|
33
32
|
"@semcore/testing-utils": "1.0.0",
|
|
33
|
+
"@semcore/core": "16.6.0",
|
|
34
34
|
"@semcore/base-components": "16.6.0"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SpinButton.js","names":["_spin","_interopRequireDefault","require","_react","_excluded","SPIN_SIZE_MAP","exports","xl","l","m","s","SpinButton","_ref","theme","size","others","_objectWithoutProperties2","createElement","_extends2"],"sources":["../../../../src/component/Button/SpinButton.tsx"],"sourcesContent":["import Spin from '@semcore/spin';\nimport React from 'react';\n\nexport const SPIN_SIZE_MAP: Record<string, string> = {\n xl: 'm',\n l: 's',\n m: 'xs',\n s: 'xxs',\n};\n\nexport default function SpinButton({ theme, size, ...others }: any) {\n return (\n <Spin\n size={typeof size === 'string' ? SPIN_SIZE_MAP[size] : size}\n theme='currentColor'\n {...others}\n />\n );\n}\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,MAAA,GAAAF,sBAAA,CAAAC,OAAA;AAA0B,IAAAE,SAAA;AAEnB,IAAMC,aAAqC,GAAAC,OAAA,CAAAD,aAAA,GAAG;EACnDE,EAAE,EAAE,GAAG;EACPC,CAAC,EAAE,GAAG;EACNC,CAAC,EAAE,IAAI;EACPC,CAAC,EAAE;AACL,CAAC;AAEc,SAASC,UAAUA,CAAAC,IAAA,EAAkC;EAAA,IAA/BC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IAAKC,MAAM,OAAAC,yBAAA,aAAAJ,IAAA,EAAAR,SAAA;EACzD,oBACED,MAAA,YAAAc,aAAA,CAACjB,KAAA,WAAI,MAAAkB,SAAA;IACHJ,IAAI,EAAE,OAAOA,IAAI,KAAK,QAAQ,GAAGT,aAAa,CAACS,IAAI,CAAC,GAAGA,IAAK;IAC5DD,KAAK,EAAC;EAAc,GAChBE,MAAM,CACX,CAAC;AAEN","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SpinButton.js","names":["Spin","React","SPIN_SIZE_MAP","xl","l","m","s","SpinButton","_ref","theme","size","others","_objectWithoutProperties","_excluded","createElement","_extends"],"sources":["../../../../src/component/Button/SpinButton.tsx"],"sourcesContent":["import Spin from '@semcore/spin';\nimport React from 'react';\n\nexport const SPIN_SIZE_MAP: Record<string, string> = {\n xl: 'm',\n l: 's',\n m: 'xs',\n s: 'xxs',\n};\n\nexport default function SpinButton({ theme, size, ...others }: any) {\n return (\n <Spin\n size={typeof size === 'string' ? SPIN_SIZE_MAP[size] : size}\n theme='currentColor'\n {...others}\n />\n );\n}\n"],"mappings":";;;AAAA,OAAOA,IAAI,MAAM,eAAe;AAChC,OAAOC,KAAK,MAAM,OAAO;AAEzB,OAAO,IAAMC,aAAqC,GAAG;EACnDC,EAAE,EAAE,GAAG;EACPC,CAAC,EAAE,GAAG;EACNC,CAAC,EAAE,IAAI;EACPC,CAAC,EAAE;AACL,CAAC;AAED,eAAe,SAASC,UAAUA,CAAAC,IAAA,EAAkC;EAAA,IAA/BC,KAAK,GAAAD,IAAA,CAALC,KAAK;IAAEC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IAAKC,MAAM,GAAAC,wBAAA,CAAAJ,IAAA,EAAAK,SAAA;EACzD,oBACEZ,KAAA,CAAAa,aAAA,CAACd,IAAI,EAAAe,QAAA;IACHL,IAAI,EAAE,OAAOA,IAAI,KAAK,QAAQ,GAAGR,aAAa,CAACQ,IAAI,CAAC,GAAGA,IAAK;IAC5DD,KAAK,EAAC;EAAc,GAChBE,MAAM,CACX,CAAC;AAEN","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
File without changes
|
|
File without changes
|
|
File without changes
|