@faststore/ui 1.8.34 → 1.8.35

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.8.35 (2022-05-26)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add OutOfStock component ([#1314](https://github.com/vtex/faststore/issues/1314)) ([37eac86](https://github.com/vtex/faststore/commit/37eac86ede448ef68aef426f65f2d224694b2cfc))
12
+
13
+
14
+
15
+
16
+
6
17
  ## 1.8.34 (2022-05-25)
7
18
 
8
19
  **Note:** Version bump only for package @faststore/ui
package/dist/index.d.ts CHANGED
@@ -72,5 +72,7 @@ export { default as QuantitySelector } from './molecules/QuantitySelector';
72
72
  export type { QuantitySelectorProps } from './molecules/QuantitySelector';
73
73
  export { default as Dropdown, DropdownButton, DropdownItem, DropdownMenu, } from './molecules/Dropdown';
74
74
  export type { DropdownProps, DropdownButtonProps, DropdownItemProps, DropdownMenuProps, } from './molecules/Dropdown';
75
+ export { default as OutOfStock, OutOfStockTitle, OutOfStockMessage, } from './organisms/OutOfStock';
76
+ export type { OutOfStockProps, OutOfStockMessageProps, OutOfStockTitleProps, } from './organisms/OutOfStock';
75
77
  export { default as useSlider } from './hooks/useSlider';
76
78
  export type { UseSliderArgs, SliderState, SliderDispatch, SlideDirection, } from './hooks/useSlider';
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ import type { ReactNode, FormHTMLAttributes } from 'react';
3
+ export declare type OutOfStockBaseProps = {
4
+ /**
5
+ * ID to find this component in testing tools (e.g.: cypress,
6
+ * testing-library, and jest).
7
+ */
8
+ testId?: string;
9
+ /**
10
+ * Children for Out of Stock components.
11
+ */
12
+ children: string | ReactNode;
13
+ };
14
+ export declare type OutOfStockProps = OutOfStockBaseProps & {
15
+ /**
16
+ * Event emitted when form is submitted.
17
+ */
18
+ onSubmit?: (event: React.FormEvent<HTMLFormElement>) => void;
19
+ } & FormHTMLAttributes<HTMLFormElement>;
20
+ declare const OutOfStock: ({ testId, children, ...otherProps }: OutOfStockProps) => JSX.Element;
21
+ export default OutOfStock;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { OutOfStockBaseProps } from './OutOfStock';
3
+ export declare type OutOfStockMessageProps = {
4
+ /**
5
+ * Attribute used for polymorphic component.
6
+ */
7
+ as?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'div' | 'span';
8
+ } & OutOfStockBaseProps;
9
+ export declare const OutOfStockMessage: ({ as: MessageComponent, testId, children, }: OutOfStockMessageProps) => JSX.Element;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { OutOfStockBaseProps } from './OutOfStock';
3
+ export declare type OutOfStockTitleProps = {
4
+ /**
5
+ * Attribute used for polymorphic component.
6
+ */
7
+ as?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p';
8
+ } & OutOfStockBaseProps;
9
+ export declare const OutOfStockTitle: ({ as: TitleComponent, testId, children, }: OutOfStockTitleProps) => JSX.Element;
@@ -0,0 +1,6 @@
1
+ export { default } from './OutOfStock';
2
+ export { OutOfStockMessage } from './OutOfStockMessage';
3
+ export { OutOfStockTitle } from './OutOfStockTitle';
4
+ export type { OutOfStockProps } from './OutOfStock';
5
+ export type { OutOfStockMessageProps } from './OutOfStockMessage';
6
+ export type { OutOfStockTitleProps } from './OutOfStockTitle';
@@ -0,0 +1,10 @@
1
+ import type { OutOfStockMessageProps, OutOfStockTitleProps, OutOfStockProps } from '..';
2
+ declare type OutOfStockTemplateProps = {
3
+ title: string;
4
+ message: string;
5
+ titleAs: OutOfStockTitleProps['as'];
6
+ messageAs: OutOfStockMessageProps['as'];
7
+ } & OutOfStockProps;
8
+ export declare const OutOfStock: import("@storybook/csf").AnnotatedStoryFn<import("@storybook/react").ReactFramework, OutOfStockTemplateProps>;
9
+ declare const _default: import("@storybook/csf").ComponentAnnotations<import("@storybook/react").ReactFramework, import("@storybook/react").Args>;
10
+ export default _default;
@@ -1967,6 +1967,42 @@ const DropdownMenu = ({
1967
1967
  }, otherProps), children)), document.body) : clearChildrenReferences();
1968
1968
  };
1969
1969
 
1970
+ const OutOfStock = ({
1971
+ testId = 'store-out-of-stock',
1972
+ children,
1973
+ ...otherProps
1974
+ }) => {
1975
+ return React__default.createElement("section", {
1976
+ "data-store-out-of-stock": true,
1977
+ "data-testid": testId
1978
+ }, React__default.createElement(Form, Object.assign({
1979
+ "data-out-of-stock-form": true,
1980
+ testId: `${testId}-form`
1981
+ }, otherProps), children));
1982
+ };
1983
+
1984
+ const OutOfStockMessage = ({
1985
+ as: MessageComponent = 'p',
1986
+ testId = 'store-out-of-stock-message',
1987
+ children
1988
+ }) => {
1989
+ return React__default.createElement(MessageComponent, {
1990
+ "data-out-of-stock-message": true,
1991
+ "data-testid": testId
1992
+ }, children);
1993
+ };
1994
+
1995
+ const OutOfStockTitle = ({
1996
+ as: TitleComponent = 'h2',
1997
+ testId = 'store-out-of-stock-title',
1998
+ children
1999
+ }) => {
2000
+ return React__default.createElement(TitleComponent, {
2001
+ "data-out-of-stock-title": true,
2002
+ "data-testid": testId
2003
+ }, children);
2004
+ };
2005
+
1970
2006
  exports.Accordion = Accordion;
1971
2007
  exports.AccordionButton = AccordionButton;
1972
2008
  exports.AccordionItem = AccordionItem;
@@ -2000,6 +2036,9 @@ exports.Link = Link;
2000
2036
  exports.List = List;
2001
2037
  exports.LoadingButton = LoadingButton;
2002
2038
  exports.Modal = Modal;
2039
+ exports.OutOfStock = OutOfStock;
2040
+ exports.OutOfStockMessage = OutOfStockMessage;
2041
+ exports.OutOfStockTitle = OutOfStockTitle;
2003
2042
  exports.Overlay = Overlay;
2004
2043
  exports.PaymentMethods = PaymentMethods;
2005
2044
  exports.Popover = Popover;