@semcore/button 17.2.1 → 17.2.2-prerelease.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/lib/cjs/component/Button/Button.js +37 -38
  3. package/lib/cjs/component/Button/Button.js.map +1 -1
  4. package/lib/cjs/component/Button/Button.type.js.map +1 -1
  5. package/lib/cjs/component/Button/mappers/BUTTON_SIZE_TO_SPIN_SIZE.js +11 -0
  6. package/lib/cjs/component/Button/mappers/BUTTON_SIZE_TO_SPIN_SIZE.js.map +1 -0
  7. package/lib/cjs/component/Button/mappers/BUTTON_USE_TO_DEFAULT_THEME.js +12 -0
  8. package/lib/cjs/component/Button/mappers/BUTTON_USE_TO_DEFAULT_THEME.js.map +1 -0
  9. package/lib/cjs/component/ButtonLink/ButtonLink.js +7 -7
  10. package/lib/cjs/component/ButtonLink/ButtonLink.js.map +1 -1
  11. package/lib/cjs/component/ButtonLink/ButtonLink.type.js.map +1 -1
  12. package/lib/es6/component/Button/Button.js +38 -38
  13. package/lib/es6/component/Button/Button.js.map +1 -1
  14. package/lib/es6/component/Button/Button.type.js.map +1 -1
  15. package/lib/es6/component/Button/mappers/BUTTON_SIZE_TO_SPIN_SIZE.js +5 -0
  16. package/lib/es6/component/Button/mappers/BUTTON_SIZE_TO_SPIN_SIZE.js.map +1 -0
  17. package/lib/es6/component/Button/mappers/BUTTON_USE_TO_DEFAULT_THEME.js +6 -0
  18. package/lib/es6/component/Button/mappers/BUTTON_USE_TO_DEFAULT_THEME.js.map +1 -0
  19. package/lib/es6/component/ButtonLink/ButtonLink.js +7 -7
  20. package/lib/es6/component/ButtonLink/ButtonLink.js.map +1 -1
  21. package/lib/es6/component/ButtonLink/ButtonLink.type.js.map +1 -1
  22. package/lib/esm/component/Button/Button.mjs +37 -39
  23. package/lib/esm/component/Button/mappers/BUTTON_SIZE_TO_SPIN_SIZE.mjs +7 -0
  24. package/lib/esm/component/Button/mappers/BUTTON_USE_TO_DEFAULT_THEME.mjs +8 -0
  25. package/lib/esm/component/ButtonLink/ButtonLink.mjs +8 -8
  26. package/lib/types/component/Button/Button.d.ts +9 -9
  27. package/lib/types/component/Button/Button.d.ts.map +1 -0
  28. package/lib/types/component/Button/Button.type.d.ts +72 -45
  29. package/lib/types/component/Button/Button.type.d.ts.map +1 -0
  30. package/lib/types/component/Button/mappers/BUTTON_SIZE_TO_SPIN_SIZE.d.ts +4 -0
  31. package/lib/types/component/Button/mappers/BUTTON_SIZE_TO_SPIN_SIZE.d.ts.map +1 -0
  32. package/lib/types/component/Button/mappers/BUTTON_USE_TO_DEFAULT_THEME.d.ts +3 -0
  33. package/lib/types/component/Button/mappers/BUTTON_USE_TO_DEFAULT_THEME.d.ts.map +1 -0
  34. package/lib/types/component/ButtonLink/ButtonLink.d.ts +3 -2
  35. package/lib/types/component/ButtonLink/ButtonLink.d.ts.map +1 -0
  36. package/lib/types/component/ButtonLink/ButtonLink.type.d.ts +40 -21
  37. package/lib/types/component/ButtonLink/ButtonLink.type.d.ts.map +1 -0
  38. package/lib/types/index.d.ts +1 -0
  39. package/lib/types/index.d.ts.map +1 -0
  40. package/package.json +7 -7
  41. package/src/component/Button/Button.tsx +20 -20
  42. package/src/component/Button/Button.type.ts +73 -46
  43. package/src/component/Button/mappers/BUTTON_SIZE_TO_SPIN_SIZE.ts +8 -0
  44. package/src/component/Button/mappers/BUTTON_USE_TO_DEFAULT_THEME.ts +7 -0
  45. package/src/component/ButtonLink/ButtonLink.tsx +5 -4
  46. package/src/component/ButtonLink/ButtonLink.type.ts +37 -21
  47. package/lib/cjs/component/Button/SpinButton.js +0 -28
  48. package/lib/cjs/component/Button/SpinButton.js.map +0 -1
  49. package/lib/es6/component/Button/SpinButton.js +0 -20
  50. package/lib/es6/component/Button/SpinButton.js.map +0 -1
  51. package/lib/esm/component/Button/SpinButton.mjs +0 -23
  52. package/lib/types/component/Button/SpinButton.d.ts +0 -3
  53. package/src/component/Button/SpinButton.tsx +0 -19
@@ -1,7 +1,8 @@
1
- import type { ButtonLinkComponent } from './ButtonLink.type';
1
+ import type { NSButtonLink } from './ButtonLink.type';
2
2
  /**
3
3
  * ButtonLink
4
4
  *
5
5
  * {@link https://developer.semrush.com/intergalactic/components/button/button-api/|API} | {@link https://developer.semrush.com/intergalactic/components/button/button-code/|Examples}
6
6
  */
7
- export declare const ButtonLink: ButtonLinkComponent;
7
+ export declare const ButtonLink: NSButtonLink.Component;
8
+ //# sourceMappingURL=ButtonLink.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonLink.d.ts","sourceRoot":"","sources":["../../../../src/component/ButtonLink/ButtonLink.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAiCtD;;;;GAIG;AACH,eAAO,MAAM,UAAU,wBAStB,CAAC"}
@@ -1,23 +1,42 @@
1
- import type { BoxProps } from '@semcore/base-components';
1
+ import type { NSBox } from '@semcore/base-components';
2
2
  import type { Intergalactic } from '@semcore/core';
3
- import type { LinkProps } from '@semcore/link';
3
+ import type { NSLink } from '@semcore/link';
4
4
  import type { NSText } from '@semcore/typography';
5
- import type { ButtonContext } from '../Button/Button.type';
6
- export type ButtonLinkProps = Intergalactic.InternalTypings.EfficientOmit<LinkProps, 'enableVisited'> & {
7
- /**
8
- * Button link type
9
- * @default primary
10
- */
11
- use?: 'primary' | 'secondary';
12
- };
13
- export type ButtonLinkDefaultProps = {
14
- use: 'primary';
15
- size: 200;
16
- };
17
- export type ButtonLinkTextProps = NSText.Props;
18
- export type ButtonLinkAddonProps = BoxProps;
19
- export type ButtonLinkChildren = {
20
- Text: Intergalactic.Component<'span', ButtonLinkTextProps>;
21
- Addon: Intergalactic.Component<'span', ButtonLinkAddonProps>;
22
- };
23
- export type ButtonLinkComponent = Intergalactic.Component<'button', ButtonLinkProps, ButtonContext> & ButtonLinkChildren;
5
+ import type { NSButton } from '../Button/Button.type';
6
+ declare namespace NSButtonLink {
7
+ type Props = Intergalactic.InternalTypings.EfficientOmit<NSLink.Props, 'enableVisited'> & {
8
+ /**
9
+ * Button link type
10
+ * @default primary
11
+ */
12
+ use?: 'primary' | 'secondary';
13
+ };
14
+ type DefaultProps = {
15
+ use: 'primary';
16
+ size: 200;
17
+ };
18
+ namespace Text {
19
+ type Props = NSText.Props;
20
+ type Component = Intergalactic.Component<'span', Props>;
21
+ }
22
+ namespace Addon {
23
+ type Props = NSBox.Props;
24
+ type Component = Intergalactic.Component<'span', Props>;
25
+ }
26
+ type Component = Intergalactic.Component<'button', Props, NSButton.Ctx> & {
27
+ Text: Text.Component;
28
+ Addon: Addon.Component;
29
+ };
30
+ }
31
+ /** @deprecated It will be removed in v19. */
32
+ export type ButtonLinkProps = NSButtonLink.Props;
33
+ /** @deprecated It will be removed in v19. */
34
+ export type ButtonLinkDefaultProps = NSButtonLink.DefaultProps;
35
+ /** @deprecated It will be removed in v19. */
36
+ export type ButtonLinkTextProps = NSButtonLink.Text.Props;
37
+ /** @deprecated It will be removed in v19. */
38
+ export type ButtonLinkAddonProps = NSButtonLink.Addon.Props;
39
+ /** @deprecated It will be removed in v19. */
40
+ export type ButtonLinkComponent = NSButtonLink.Component;
41
+ export type { NSButtonLink };
42
+ //# sourceMappingURL=ButtonLink.type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ButtonLink.type.d.ts","sourceRoot":"","sources":["../../../../src/component/ButtonLink/ButtonLink.type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD,OAAO,WAAW,YAAY,CAAC;IAC7B,KAAK,KAAK,GAAG,aAAa,CAAC,eAAe,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,EAAE,eAAe,CAAC,GAAG;QAC1F;;;WAGG;QACD,GAAG,CAAC,EAAE,SAAS,GAAG,WAAW,CAAC;KAC/B,CAAC;IACF,KAAK,YAAY,GAAG;QAClB,GAAG,EAAE,SAAS,CAAC;QACf,IAAI,EAAE,GAAG,CAAC;KACX,CAAC;IAEF,UAAU,IAAI,CAAC;QACb,KAAK,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAE1B,KAAK,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KACzD;IAED,UAAU,KAAK,CAAC;QACd,KAAK,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAEzB,KAAK,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;KACzD;IAED,KAAK,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG;QACxE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;QACrB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC;KACxB,CAAC;CACH;AAED,6CAA6C;AAC7C,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,KAAK,CAAC;AACjD,6CAA6C;AAC7C,MAAM,MAAM,sBAAsB,GAAG,YAAY,CAAC,YAAY,CAAC;AAC/D,6CAA6C;AAC7C,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC;AAC1D,6CAA6C;AAC7C,MAAM,MAAM,oBAAoB,GAAG,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC;AAC5D,6CAA6C;AAC7C,MAAM,MAAM,mBAAmB,GAAG,YAAY,CAAC,SAAS,CAAC;AAEzD,YAAY,EAAE,YAAY,EAAE,CAAC"}
@@ -2,3 +2,4 @@ export { default, MAP_USE_DEFAULT_THEME } 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
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAC3E,cAAc,gCAAgC,CAAC;AAC/C,cAAc,mCAAmC,CAAC;AAClD,cAAc,wCAAwC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/button",
3
3
  "description": "Semrush Button Component",
4
- "version": "17.2.1",
4
+ "version": "17.2.2-prerelease.0",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -14,12 +14,12 @@
14
14
  "require": "./lib/cjs/index.js"
15
15
  },
16
16
  "dependencies": {
17
- "@semcore/spin": "^17.2.1",
18
- "@semcore/typography": "^17.2.1",
19
- "@semcore/link": "^17.2.1"
17
+ "@semcore/spin": "^17.2.1-prerelease.0",
18
+ "@semcore/typography": "^17.2.1-prerelease.0",
19
+ "@semcore/link": "^17.2.2-prerelease.0"
20
20
  },
21
21
  "peerDependencies": {
22
- "@semcore/base-components": "^17.2.1"
22
+ "@semcore/base-components": "^17.2.2"
23
23
  },
24
24
  "repository": {
25
25
  "type": "git",
@@ -27,9 +27,9 @@
27
27
  "directory": "semcore/button"
28
28
  },
29
29
  "devDependencies": {
30
+ "@semcore/core": "17.3.1-prerelease.0",
30
31
  "@semcore/testing-utils": "1.0.0",
31
- "@semcore/core": "17.2.1",
32
- "@semcore/base-components": "17.2.1",
32
+ "@semcore/base-components": "17.2.2-prerelease.0",
33
33
  "@semcore/icon": "17.2.0"
34
34
  },
35
35
  "scripts": {
@@ -1,32 +1,28 @@
1
1
  import { NeighborLocation, Box, Hint } from '@semcore/base-components';
2
+ import type { Intergalactic } from '@semcore/core';
2
3
  import { Component, CORE_INSTANCE, createComponent, Root, sstyled } from '@semcore/core';
3
4
  import addonTextChildren from '@semcore/core/lib/utils/addonTextChildren';
4
5
  import hasLabels from '@semcore/core/lib/utils/hasLabels';
5
6
  import logger from '@semcore/core/lib/utils/logger';
7
+ import Spin from '@semcore/spin';
6
8
  import { Text } from '@semcore/typography';
7
9
  import React from 'react';
8
10
 
9
11
  import style from './button.shadow.css';
10
- import type { ButtonProps, ButtonAddonProps, ButtonTextProps, ButtonComponent, ButtonDefaultProps } from './Button.type';
11
- import SpinButton from './SpinButton';
12
+ import type { NSButton } from './Button.type';
13
+ import { BUTTON_SIZE_TO_SPIN_SIZE } from './mappers/BUTTON_SIZE_TO_SPIN_SIZE';
14
+ import { BUTTON_USE_TO_DEFAULT_THEME } from './mappers/BUTTON_USE_TO_DEFAULT_THEME';
12
15
 
13
- export const MAP_USE_DEFAULT_THEME: Record<string, string> = {
14
- primary: 'info',
15
- secondary: 'muted',
16
- tertiary: 'info',
17
- };
18
-
19
- type State = {
20
- ariaLabelledByContent: null | string;
21
- };
16
+ /** @deprecated It will be removed in v19. */
17
+ export const MAP_USE_DEFAULT_THEME = BUTTON_USE_TO_DEFAULT_THEME;
22
18
 
23
19
  export class RootButton extends Component<
24
- ButtonProps,
20
+ Intergalactic.InternalTypings.InferComponentProps<NSButton.Component>,
25
21
  [],
26
22
  never,
27
23
  {},
28
- State,
29
- ButtonDefaultProps
24
+ NSButton.State,
25
+ NSButton.DefaultProps
30
26
  > {
31
27
  static displayName = 'Button';
32
28
  static style = style;
@@ -37,7 +33,7 @@ export class RootButton extends Component<
37
33
 
38
34
  containerRef = React.createRef<HTMLButtonElement>();
39
35
 
40
- state: State = {
36
+ state: NSButton.State = {
41
37
  ariaLabelledByContent: null,
42
38
  };
43
39
 
@@ -81,7 +77,7 @@ export class RootButton extends Component<
81
77
  const {
82
78
  styles,
83
79
  use,
84
- theme = typeof use === 'string' && MAP_USE_DEFAULT_THEME[use],
80
+ theme = typeof use === 'string' && BUTTON_USE_TO_DEFAULT_THEME[use],
85
81
  loading,
86
82
  disabled = loading,
87
83
  size,
@@ -143,7 +139,11 @@ export class RootButton extends Component<
143
139
  </SInner>
144
140
  {loading && (
145
141
  <SSpin tag='span'>
146
- <SpinButton centered size={size} theme={useTheme} />
142
+ <Spin
143
+ size={BUTTON_SIZE_TO_SPIN_SIZE[size]}
144
+ theme='currentColor'
145
+ centered
146
+ />
147
147
  </SSpin>
148
148
  )}
149
149
  </SButton>
@@ -164,12 +164,12 @@ export class RootButton extends Component<
164
164
  }
165
165
  }
166
166
 
167
- function ButtonText(props: ButtonTextProps) {
167
+ function ButtonText(props: Intergalactic.InternalTypings.InferChildComponentProps<NSButton.Text.Component, typeof RootButton, 'Text'>) {
168
168
  const SText = Root;
169
169
  return sstyled(props.styles)(<SText render={Text} />);
170
170
  }
171
171
 
172
- function Addon(props: ButtonAddonProps) {
172
+ function Addon(props: Intergalactic.InternalTypings.InferChildComponentProps<NSButton.Text.Component, typeof RootButton, 'Addon'>) {
173
173
  const SAddon = Root;
174
174
  return sstyled(props.styles)(<SAddon render={Box} tag='span' />);
175
175
  }
@@ -180,7 +180,7 @@ function Addon(props: ButtonAddonProps) {
180
180
  * {@link https://developer.semrush.com/intergalactic/components/button/button-api/|API} | {@link https://developer.semrush.com/intergalactic/components/button/button-code/|Examples}
181
181
  */
182
182
  const Button = createComponent<
183
- ButtonComponent,
183
+ NSButton.Component,
184
184
  typeof RootButton
185
185
  >(RootButton, {
186
186
  Text: ButtonText,
@@ -1,57 +1,84 @@
1
- import type { BoxProps, NeighborItemProps, SimpleHintPopperProps } from '@semcore/base-components';
1
+ import type { NSBox, NSNeighborLocation, NSHint } from '@semcore/base-components';
2
2
  import type { Intergalactic, PropGetterFn } from '@semcore/core';
3
3
  import type { NSText } from '@semcore/typography';
4
4
  import type React from 'react';
5
5
 
6
- export type ButtonProps = BoxProps &
7
- NeighborItemProps & {
8
- /** Button activity state */
9
- active?: boolean;
10
- /** Disabled button state */
11
- disabled?: boolean;
12
- /** Loading button state */
13
- loading?: boolean;
14
- /** Tag for the left Addon */
15
- addonLeft?: React.ElementType;
16
- /** Tag for the right Addon */
17
- addonRight?: React.ElementType;
18
- /**
19
- * Placement for hint
20
- * @default top
21
- */
22
- hintPlacement?: SimpleHintPopperProps['placement'];
23
-
24
- /** Button size.
25
- * @default `m`
26
- */
27
- size?: 'l' | 'm';
28
- /** Button usage.
29
- * @default `primary`
30
- */
31
- use?: 'primary' | 'secondary' | 'tertiary';
32
- /** Button theme.
33
- * @default undefined
34
- */
35
- theme?: 'info' | 'success' | 'brand' | 'danger' | 'muted' | 'invert';
6
+ declare namespace NSButton {
7
+ type Size = 'l' | 'm';
8
+ type Theme = 'info' | 'success' | 'brand' | 'danger' | 'muted' | 'invert';
9
+ type Use = 'primary' | 'secondary' | 'tertiary';
10
+ type Props = NSBox.Props &
11
+ NSNeighborLocation.Detect.Props & {
12
+ /** Button activity state */
13
+ active?: boolean;
14
+ /** Disabled button state */
15
+ disabled?: boolean;
16
+ /** Loading button state */
17
+ loading?: boolean;
18
+ /** Tag for the left Addon */
19
+ addonLeft?: React.ElementType;
20
+ /** Tag for the right Addon */
21
+ addonRight?: React.ElementType;
22
+ /**
23
+ * Placement for hint
24
+ * @default top
25
+ */
26
+ hintPlacement?: NSHint.Props['placement'];
27
+
28
+ /** Button size.
29
+ * @default `m`
30
+ */
31
+ size?: NSButton.Size;
32
+ /** Button usage.
33
+ * @default `primary`
34
+ */
35
+ use?: 'primary' | 'secondary' | 'tertiary';
36
+ /** Button theme.
37
+ * @default undefined
38
+ */
39
+ theme?: NSButton.Theme;
40
+ };
41
+ type DefaultProps = {
42
+ use: 'secondary';
43
+ size: 'm';
44
+ };
45
+ type State = {
46
+ ariaLabelledByContent: null | string;
47
+ };
48
+ type Ctx = {
49
+ getTextProps: PropGetterFn;
50
+ getAddonProps: PropGetterFn;
36
51
  };
37
52
 
38
- export type ButtonDefaultProps = {
39
- use: 'secondary';
40
- size: 'm';
41
- };
53
+ namespace Text {
54
+ type Props = NSText.Props;
42
55
 
43
- export type ButtonTextProps = NSText.Props;
56
+ type Component = Intergalactic.Component<'span', Props>;
57
+ }
44
58
 
45
- export type ButtonAddonProps = BoxProps;
59
+ namespace Addon {
60
+ type Props = NSBox.Props;
46
61
 
47
- export type ButtonContext = {
48
- getTextProps: PropGetterFn;
49
- getAddonProps: PropGetterFn;
50
- };
62
+ type Component = Intergalactic.Component<'span', Props>;
63
+ }
64
+
65
+ type Component = Intergalactic.Component<'button', Props, Ctx> & {
66
+ Text: Text.Component;
67
+ Addon: Addon.Component;
68
+ };
69
+ }
51
70
 
52
- export type ButtonChildren = {
53
- Text: Intergalactic.Component<'span', ButtonTextProps>;
54
- Addon: Intergalactic.Component<'span', ButtonAddonProps>;
55
- };
71
+ /** @deprecated It will be removed in v19. */
72
+ export type ButtonProps = NSButton.Props;
73
+ /** @deprecated It will be removed in v19. */
74
+ export type ButtonDefaultProps = NSButton.DefaultProps;
75
+ /** @deprecated It will be removed in v19. */
76
+ export type ButtonTextProps = NSButton.Text.Props;
77
+ /** @deprecated It will be removed in v19. */
78
+ export type ButtonAddonProps = NSButton.Addon.Props;
79
+ /** @deprecated It will be removed in v19. */
80
+ export type ButtonContext = NSButton.Ctx;
81
+ /** @deprecated It will be removed in v19. */
82
+ export type ButtonComponent = NSButton.Component;
56
83
 
57
- export type ButtonComponent = Intergalactic.Component<'button', ButtonProps, ButtonContext> & ButtonChildren;
84
+ export type { NSButton };
@@ -0,0 +1,8 @@
1
+ import type { NSSpin } from '@semcore/spin';
2
+
3
+ import type { NSButton } from '../Button.type';
4
+
5
+ export const BUTTON_SIZE_TO_SPIN_SIZE: Record<NSButton.Size, NSSpin.Size> = {
6
+ m: 'xs',
7
+ l: 's',
8
+ };
@@ -0,0 +1,7 @@
1
+ import type { NSButton } from '../Button.type';
2
+
3
+ export const BUTTON_USE_TO_DEFAULT_THEME: Record<NSButton.Use, NSButton.Theme> = {
4
+ primary: 'info',
5
+ secondary: 'muted',
6
+ tertiary: 'info',
7
+ };
@@ -1,17 +1,18 @@
1
+ import type { Intergalactic } from '@semcore/core';
1
2
  import { createComponent, sstyled, Root, Component } from '@semcore/core';
2
3
  import Link from '@semcore/link';
3
4
  import React from 'react';
4
5
 
5
6
  import style from './buttonLink.shadow.css';
6
- import type { ButtonLinkComponent, ButtonLinkDefaultProps, ButtonLinkProps } from './ButtonLink.type';
7
+ import type { NSButtonLink } from './ButtonLink.type';
7
8
 
8
9
  class RootButtonLink extends Component<
9
- ButtonLinkProps,
10
+ Intergalactic.InternalTypings.InferComponentProps<NSButtonLink.Component>,
10
11
  [],
11
12
  {},
12
13
  {},
13
14
  {},
14
- ButtonLinkDefaultProps
15
+ NSButtonLink.DefaultProps
15
16
  > {
16
17
  static displayName = 'ButtonLink';
17
18
  static style = style;
@@ -41,7 +42,7 @@ class RootButtonLink extends Component<
41
42
  *
42
43
  * {@link https://developer.semrush.com/intergalactic/components/button/button-api/|API} | {@link https://developer.semrush.com/intergalactic/components/button/button-code/|Examples}
43
44
  */
44
- export const ButtonLink = createComponent<ButtonLinkComponent, typeof RootButtonLink>(
45
+ export const ButtonLink = createComponent<NSButtonLink.Component, typeof RootButtonLink>(
45
46
  RootButtonLink,
46
47
  {
47
48
  Text: Link.Text,
@@ -1,34 +1,50 @@
1
- import type { BoxProps } from '@semcore/base-components';
1
+ import type { NSBox } from '@semcore/base-components';
2
2
  import type { Intergalactic } from '@semcore/core';
3
- import type { LinkProps } from '@semcore/link';
3
+ import type { NSLink } from '@semcore/link';
4
4
  import type { NSText } from '@semcore/typography';
5
5
 
6
- import type { ButtonContext } from '../Button/Button.type';
6
+ import type { NSButton } from '../Button/Button.type';
7
7
 
8
- export type ButtonLinkProps = Intergalactic.InternalTypings.EfficientOmit<LinkProps, 'enableVisited'> & {
8
+ declare namespace NSButtonLink {
9
+ type Props = Intergalactic.InternalTypings.EfficientOmit<NSLink.Props, 'enableVisited'> & {
9
10
  /**
10
11
  * Button link type
11
12
  * @default primary
12
13
  */
13
- use?: 'primary' | 'secondary';
14
- };
14
+ use?: 'primary' | 'secondary';
15
+ };
16
+ type DefaultProps = {
17
+ use: 'primary';
18
+ size: 200;
19
+ };
15
20
 
16
- export type ButtonLinkDefaultProps = {
17
- use: 'primary';
18
- size: 200;
19
- };
21
+ namespace Text {
22
+ type Props = NSText.Props;
20
23
 
21
- export type ButtonLinkTextProps = NSText.Props;
24
+ type Component = Intergalactic.Component<'span', Props>;
25
+ }
22
26
 
23
- export type ButtonLinkAddonProps = BoxProps;
27
+ namespace Addon {
28
+ type Props = NSBox.Props;
24
29
 
25
- export type ButtonLinkChildren = {
26
- Text: Intergalactic.Component<'span', ButtonLinkTextProps>;
27
- Addon: Intergalactic.Component<'span', ButtonLinkAddonProps>;
28
- };
30
+ type Component = Intergalactic.Component<'span', Props>;
31
+ }
29
32
 
30
- export type ButtonLinkComponent = Intergalactic.Component<
31
- 'button',
32
- ButtonLinkProps,
33
- ButtonContext
34
- > & ButtonLinkChildren;
33
+ type Component = Intergalactic.Component<'button', Props, NSButton.Ctx> & {
34
+ Text: Text.Component;
35
+ Addon: Addon.Component;
36
+ };
37
+ }
38
+
39
+ /** @deprecated It will be removed in v19. */
40
+ export type ButtonLinkProps = NSButtonLink.Props;
41
+ /** @deprecated It will be removed in v19. */
42
+ export type ButtonLinkDefaultProps = NSButtonLink.DefaultProps;
43
+ /** @deprecated It will be removed in v19. */
44
+ export type ButtonLinkTextProps = NSButtonLink.Text.Props;
45
+ /** @deprecated It will be removed in v19. */
46
+ export type ButtonLinkAddonProps = NSButtonLink.Addon.Props;
47
+ /** @deprecated It will be removed in v19. */
48
+ export type ButtonLinkComponent = NSButtonLink.Component;
49
+
50
+ export type { NSButtonLink };
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.SPIN_SIZE_MAP = void 0;
8
- exports.default = SpinButton;
9
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
- var _spin = _interopRequireDefault(require("@semcore/spin"));
11
- var _react = _interopRequireDefault(require("react"));
12
- const SPIN_SIZE_MAP = exports.SPIN_SIZE_MAP = {
13
- xl: 'm',
14
- l: 's',
15
- m: 'xs',
16
- s: 'xxs'
17
- };
18
- function SpinButton({
19
- theme,
20
- size,
21
- ...others
22
- }) {
23
- return /*#__PURE__*/_react.default.createElement(_spin.default, (0, _extends2.default)({
24
- size: typeof size === 'string' ? SPIN_SIZE_MAP[size] : size,
25
- theme: "currentColor"
26
- }, others));
27
- }
28
- //# sourceMappingURL=SpinButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SpinButton.js","names":["_spin","_interopRequireDefault","require","_react","SPIN_SIZE_MAP","exports","xl","l","m","s","SpinButton","theme","size","others","default","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;AAEO,MAAME,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,CAAC;EAAEC,KAAK;EAAEC,IAAI;EAAE,GAAGC;AAAY,CAAC,EAAE;EAClE,oBACEV,MAAA,CAAAW,OAAA,CAAAC,aAAA,CAACf,KAAA,CAAAc,OAAI,MAAAE,SAAA,CAAAF,OAAA;IACHF,IAAI,EAAE,OAAOA,IAAI,KAAK,QAAQ,GAAGR,aAAa,CAACQ,IAAI,CAAC,GAAGA,IAAK;IAC5DD,KAAK,EAAC;EAAc,GAChBE,MAAM,CACX,CAAC;AAEN","ignoreList":[]}
@@ -1,20 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import Spin from '@semcore/spin';
3
- import React from 'react';
4
- export const SPIN_SIZE_MAP = {
5
- xl: 'm',
6
- l: 's',
7
- m: 'xs',
8
- s: 'xxs'
9
- };
10
- export default function SpinButton({
11
- theme,
12
- size,
13
- ...others
14
- }) {
15
- return /*#__PURE__*/React.createElement(Spin, _extends({
16
- size: typeof size === 'string' ? SPIN_SIZE_MAP[size] : size,
17
- theme: "currentColor"
18
- }, others));
19
- }
20
- //# sourceMappingURL=SpinButton.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SpinButton.js","names":["Spin","React","SPIN_SIZE_MAP","xl","l","m","s","SpinButton","theme","size","others","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,MAAMC,aAAqC,GAAG;EACnDC,EAAE,EAAE,GAAG;EACPC,CAAC,EAAE,GAAG;EACNC,CAAC,EAAE,IAAI;EACPC,CAAC,EAAE;AACL,CAAC;AAED,eAAe,SAASC,UAAUA,CAAC;EAAEC,KAAK;EAAEC,IAAI;EAAE,GAAGC;AAAY,CAAC,EAAE;EAClE,oBACET,KAAA,CAAAU,aAAA,CAACX,IAAI,EAAAY,QAAA;IACHH,IAAI,EAAE,OAAOA,IAAI,KAAK,QAAQ,GAAGP,aAAa,CAACO,IAAI,CAAC,GAAGA,IAAK;IAC5DD,KAAK,EAAC;EAAc,GAChBE,MAAM,CACX,CAAC;AAEN","ignoreList":[]}
@@ -1,23 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/extends";
2
- import Spin from "@semcore/spin";
3
- import React from "react";
4
- const SPIN_SIZE_MAP = {
5
- xl: "m",
6
- l: "s",
7
- m: "xs",
8
- s: "xxs"
9
- };
10
- function SpinButton({
11
- theme,
12
- size,
13
- ...others
14
- }) {
15
- return /* @__PURE__ */ React.createElement(Spin, _extends({
16
- size: typeof size === "string" ? SPIN_SIZE_MAP[size] : size,
17
- theme: "currentColor"
18
- }, others));
19
- }
20
- export {
21
- SPIN_SIZE_MAP,
22
- SpinButton as default
23
- };
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const SPIN_SIZE_MAP: Record<string, string>;
3
- export default function SpinButton({ theme, size, ...others }: any): React.JSX.Element;
@@ -1,19 +0,0 @@
1
- import Spin from '@semcore/spin';
2
- import React from 'react';
3
-
4
- export const SPIN_SIZE_MAP: Record<string, string> = {
5
- xl: 'm',
6
- l: 's',
7
- m: 'xs',
8
- s: 'xxs',
9
- };
10
-
11
- export default function SpinButton({ theme, size, ...others }: any) {
12
- return (
13
- <Spin
14
- size={typeof size === 'string' ? SPIN_SIZE_MAP[size] : size}
15
- theme='currentColor'
16
- {...others}
17
- />
18
- );
19
- }