@silas-test/ob-atoms-price 0.1.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/README.md +31 -0
- package/index.cjs.css +116 -0
- package/index.cjs.js +2746 -0
- package/index.d.ts +1 -0
- package/package.json +10 -0
- package/src/index.d.ts +1 -0
- package/src/lib/price.d.ts +3 -0
- package/src/lib/price.interface.d.ts +52 -0
- package/src/lib/price.stories.d.ts +11 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./src/index";
|
package/package.json
ADDED
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/price';
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { DefaultProps } from '@silas-test/ui-utils';
|
|
2
|
+
/** @typedef {string} PriceVariants */
|
|
3
|
+
export type CurrencyPositions = 'left' | 'right';
|
|
4
|
+
/** @typedef {string} PriceVariants */
|
|
5
|
+
export type PriceVariants = 'base' | 'accent' | 'danger';
|
|
6
|
+
/** @typedef {string} PriceSizes */
|
|
7
|
+
export type PriceSizes = 'small' | 'medium';
|
|
8
|
+
/**
|
|
9
|
+
* @typedef {Object} PriceProps
|
|
10
|
+
* @property {string | undefined} id - component identification
|
|
11
|
+
* @property {string | undefined} dataTestId - react-testing-library identification
|
|
12
|
+
* @property {string} value - value that should be displayed as the text. This value should be already formatted
|
|
13
|
+
* @property {string} prevValue - previous value that will be used to start the animation effect. This value should be already formatted
|
|
14
|
+
* @property {string | undefined} currency - character of the currency that should be displayed on the price
|
|
15
|
+
* @property {CurrencyPositions | undefined} currencyPosition - position of the currency character, either at the left or right of the price
|
|
16
|
+
* @property {PriceVariants | undefined} variant - styling variant of the component
|
|
17
|
+
* @property {PriceSizes | undefined} size - size of the text
|
|
18
|
+
*/
|
|
19
|
+
export interface IPriceProps extends DefaultProps {
|
|
20
|
+
/** Component identification */
|
|
21
|
+
id?: string;
|
|
22
|
+
/** React-testing-library identification */
|
|
23
|
+
dataTestId?: string;
|
|
24
|
+
/** Value that should be displayed as the text.
|
|
25
|
+
*
|
|
26
|
+
* NOTE: This value should be provided already on the format you want to display
|
|
27
|
+
*/
|
|
28
|
+
value: string;
|
|
29
|
+
/** Previous value that will be used to start the animation effect.
|
|
30
|
+
*
|
|
31
|
+
* NOTE: If the prevValue prop is provided, the `Price` component will animate from the `prevValue` to the `value` prop
|
|
32
|
+
*/
|
|
33
|
+
prevValue?: string;
|
|
34
|
+
/** Character of the currency that should be displayed on the price */
|
|
35
|
+
currency?: string;
|
|
36
|
+
/** Position of the currency character, either at the `left` or `right` of the price */
|
|
37
|
+
currencyPosition?: CurrencyPositions;
|
|
38
|
+
/**
|
|
39
|
+
* Styling variant of the component.
|
|
40
|
+
*
|
|
41
|
+
* Default value is `base`
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
variant?: PriceVariants;
|
|
45
|
+
/**
|
|
46
|
+
* Size of the text:
|
|
47
|
+
*
|
|
48
|
+
* Default value is `medium`
|
|
49
|
+
*
|
|
50
|
+
*/
|
|
51
|
+
size?: PriceSizes;
|
|
52
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Meta } from '@storybook/react';
|
|
2
|
+
import { Price } from './price';
|
|
3
|
+
declare const Story: Meta<typeof Price>;
|
|
4
|
+
export default Story;
|
|
5
|
+
export declare const Animated: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./price.interface").IPriceProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
+
export declare const BaseMedium: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./price.interface").IPriceProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export declare const BaseSmall: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./price.interface").IPriceProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
8
|
+
export declare const AccentMedium: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./price.interface").IPriceProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export declare const AccentSmall: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./price.interface").IPriceProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export declare const DangerMedium: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./price.interface").IPriceProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
|
+
export declare const DangerSmall: import("storybook/internal/csf").AnnotatedStoryFn<import("@storybook/react").ReactRenderer, import("./price.interface").IPriceProps & import("react").RefAttributes<HTMLDivElement>>;
|