@faststore/ui 1.3.39 → 1.3.40

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 CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## 1.3.40 (2021-12-18)
7
+
8
+
9
+ ### Features
10
+
11
+ * **ui:** Link atom ([#1067](https://github.com/vtex/faststore/issues/1067)) ([c49b2dd](https://github.com/vtex/faststore/commit/c49b2ddc31ba4184bed19a8934fbf4d5f0b47a5f))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 1.3.39 (2021-12-17)
7
18
 
8
19
  **Note:** Version bump only for package @faststore/ui
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import type { ElementType, ReactElement } from 'react';
3
+ import type { PolymorphicComponentPropsWithRef } from '../../typings';
4
+ interface Props {
5
+ /**
6
+ * ID to find this component in testing tools (e.g.: cypress, testing library, and jest).
7
+ */
8
+ testId?: string;
9
+ }
10
+ export declare type LinkProps<C extends ElementType> = PolymorphicComponentPropsWithRef<C, Props>;
11
+ declare type LinkComponent = <C extends ElementType = 'a'>(props: LinkProps<C>) => ReactElement | null;
12
+ declare const Link: LinkComponent;
13
+ /**
14
+ * This is only being exported to make it easier to use in Storybook.
15
+ * **DON'T** import this directly to use this component, use the default export
16
+ * instead.
17
+ */
18
+ export declare const StorybookLink: React.FC<Props>;
19
+ export default Link;
@@ -0,0 +1,2 @@
1
+ export { default } from './Link';
2
+ export type { LinkProps } from './Link';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ export { default as Link } from './atoms/Link';
2
+ export type { LinkProps } from './atoms/Link';
1
3
  export { default as Button } from './atoms/Button';
2
4
  export type { ButtonProps } from './atoms/Button';
3
5
  export { default as Input } from './atoms/Input';
@@ -24,4 +24,5 @@ export declare type PolymorphicComponentProps<C extends ElementType, Props = Rec
24
24
  export declare type PolymorphicComponentPropsWithRef<C extends ElementType, P = Record<string, never>> = PolymorphicComponentProps<C, P> & {
25
25
  ref?: ComponentPropsWithRef<C>['ref'];
26
26
  };
27
+ export declare type PolymorphicRef<C extends ElementType> = PolymorphicComponentPropsWithRef<C>['ref'];
27
28
  export {};
@@ -1 +1 @@
1
- export type { PolymorphicComponentProps, PolymorphicComponentPropsWithRef, } from './PolymorphicGenerics';
1
+ export type { PolymorphicComponentProps, PolymorphicComponentPropsWithRef, PolymorphicRef, } from './PolymorphicGenerics';
@@ -12,6 +12,20 @@ var reactSwipeable = require('react-swipeable');
12
12
  var reactDom = require('react-dom');
13
13
  var tabbable = require('tabbable');
14
14
 
15
+ const Link = /*#__PURE__*/React.forwardRef(function Link({
16
+ as,
17
+ children,
18
+ testId = 'store-link',
19
+ ...otherProps
20
+ }, ref) {
21
+ const Component = as != null ? as : 'a';
22
+ return React__default.createElement(Component, Object.assign({
23
+ ref: ref,
24
+ "data-store-link": true,
25
+ "data-testid": testId
26
+ }, otherProps), children);
27
+ });
28
+
15
29
  const Button = /*#__PURE__*/React.forwardRef(function Button({
16
30
  children,
17
31
  testId = 'store-button',
@@ -1569,6 +1583,7 @@ exports.Icon = Icon;
1569
1583
  exports.IconButton = IconButton;
1570
1584
  exports.Input = Input;
1571
1585
  exports.Label = Label;
1586
+ exports.Link = Link;
1572
1587
  exports.List = List;
1573
1588
  exports.LoadingButton = LoadingButton;
1574
1589
  exports.Modal = Modal;