@wonderflow/react-components 12.1.3 → 12.2.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/dist/components/icon-button/icon-button.module.css +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/menu/menu-item/menu-item.d.ts +2 -2
- package/dist/components/menu/menu-item/menu-item.d.ts.map +1 -1
- package/dist/components/menu/menu-item/menu-item.js +1 -1
- package/dist/components/menu/menu-item/menu-item.stories.d.ts +43 -3
- package/dist/components/menu/menu-item/menu-item.stories.d.ts.map +1 -1
- package/dist/components/menu/menu.stories.d.ts +140 -10
- package/dist/components/menu/menu.stories.d.ts.map +1 -1
- package/dist/components/product-card/index.d.ts +3 -0
- package/dist/components/product-card/index.d.ts.map +1 -0
- package/dist/components/product-card/index.js +16 -0
- package/dist/components/product-card/product-card-footer/product-card-footer.d.ts +10 -0
- package/dist/components/product-card/product-card-footer/product-card-footer.d.ts.map +1 -0
- package/dist/components/product-card/product-card-footer/product-card-footer.js +20 -0
- package/dist/components/product-card/product-card-footer/product-card-footer.test.d.ts +2 -0
- package/dist/components/product-card/product-card-footer/product-card-footer.test.d.ts.map +1 -0
- package/dist/components/product-card/product-card-footer/product-card-footer.test.js +13 -0
- package/dist/components/product-card/product-card-header/product-card-header.d.ts +34 -0
- package/dist/components/product-card/product-card-header/product-card-header.d.ts.map +1 -0
- package/dist/components/product-card/product-card-header/product-card-header.js +32 -0
- package/dist/components/product-card/product-card-header/product-card-header.module.css +1 -0
- package/dist/components/product-card/product-card-header/product-card-header.test.d.ts +2 -0
- package/dist/components/product-card/product-card-header/product-card-header.test.d.ts.map +1 -0
- package/dist/components/product-card/product-card-header/product-card-header.test.js +17 -0
- package/dist/components/product-card/product-card-kpis/product-card-kpis.d.ts +84 -0
- package/dist/components/product-card/product-card-kpis/product-card-kpis.d.ts.map +1 -0
- package/dist/components/product-card/product-card-kpis/product-card-kpis.js +98 -0
- package/dist/components/product-card/product-card-kpis/product-card-kpis.module.css +1 -0
- package/dist/components/product-card/product-card-kpis/product-card.kpis.test.d.ts +2 -0
- package/dist/components/product-card/product-card-kpis/product-card.kpis.test.d.ts.map +1 -0
- package/dist/components/product-card/product-card-kpis/product-card.kpis.test.js +17 -0
- package/dist/components/product-card/product-card-media/product-card-media.d.ts +18 -0
- package/dist/components/product-card/product-card-media/product-card-media.d.ts.map +1 -0
- package/dist/components/product-card/product-card-media/product-card-media.js +53 -0
- package/dist/components/product-card/product-card-media/product-card-media.module.css +1 -0
- package/dist/components/product-card/product-card-media/product-card-media.test.d.ts +2 -0
- package/dist/components/product-card/product-card-media/product-card-media.test.d.ts.map +1 -0
- package/dist/components/product-card/product-card-media/product-card-media.test.js +29 -0
- package/dist/components/product-card/product-card.d.ts +43 -0
- package/dist/components/product-card/product-card.d.ts.map +1 -0
- package/dist/components/product-card/product-card.js +43 -0
- package/dist/components/product-card/product-card.module.css +1 -0
- package/dist/components/product-card/product-card.stories.d.ts +12 -0
- package/dist/components/product-card/product-card.stories.d.ts.map +1 -0
- package/dist/components/product-card/product-card.stories.js +118 -0
- package/dist/components/product-card/product-card.test.d.ts +2 -0
- package/dist/components/product-card/product-card.test.d.ts.map +1 -0
- package/dist/components/product-card/product-card.test.js +36 -0
- package/dist/components/select/select.d.ts +8 -0
- package/dist/components/select/select.d.ts.map +1 -1
- package/dist/components/select/select.js +2 -2
- package/dist/components/select/select.module.css +1 -1
- package/dist/components/select/select.stories.d.ts +3 -0
- package/dist/components/select/select.stories.d.ts.map +1 -1
- package/dist/components/select/select.stories.js +4 -0
- package/dist/components/selection-controls/selection-controls.module.css +1 -1
- package/dist/components/slider/slider.module.css +1 -1
- package/dist/components/snackbar/snackbar.module.css +1 -1
- package/dist/components/text/text.stories.js +1 -1
- package/dist/components/textfield/textfield.d.ts +8 -0
- package/dist/components/textfield/textfield.d.ts.map +1 -1
- package/dist/components/textfield/textfield.js +9 -4
- package/dist/components/textfield/textfield.module.css +1 -1
- package/dist/components/textfield/textfield.stories.d.ts.map +1 -1
- package/dist/components/textfield/textfield.stories.js +6 -2
- package/dist/examples/shell.stories.d.ts.map +1 -1
- package/dist/examples/shell.stories.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/utils/browser.d.ts +1 -1
- package/dist/utils/browser.d.ts.map +1 -1
- package/dist/utils/browser.js +1 -1
- package/dist/utils/browser.test.js +2 -2
- package/dist/utils/formatting.d.ts +16 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/formatting.js +76 -0
- package/dist/utils/formatting.test.d.ts +2 -0
- package/dist/utils/formatting.test.d.ts.map +1 -0
- package/dist/utils/formatting.test.js +151 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +19 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer components{.IconButton{padding:0}.IconButton[data-icon-button-squared=false]{border-radius:50%}.IconButton[data-button-dimension=small]{inline-size:1.5rem;min-inline-size:1.5rem;padding:0}.IconButton[data-button-dimension=regular]{block-size:2.
|
|
1
|
+
@layer components{.IconButton{padding:0}.IconButton[data-icon-button-squared=false]{border-radius:50%}.IconButton[data-button-dimension=small]{inline-size:1.5rem;min-inline-size:1.5rem;padding:0}.IconButton[data-button-dimension=regular]{block-size:2.25rem;inline-size:2.25rem;min-inline-size:2.25rem;padding:0}.IconButton[data-button-dimension=big]{inline-size:3rem;min-inline-size:3rem;padding:0}}
|
|
@@ -25,6 +25,7 @@ export * from './modal';
|
|
|
25
25
|
export * from './overlay-container';
|
|
26
26
|
export * from './pagination';
|
|
27
27
|
export * from './popover';
|
|
28
|
+
export * from './product-card';
|
|
28
29
|
export * from './select';
|
|
29
30
|
export * from './selection-controls';
|
|
30
31
|
export * from './separator';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAgBA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAgBA,cAAc,aAAa,CAAC;AAC5B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -40,6 +40,7 @@ export * from './modal';
|
|
|
40
40
|
export * from './overlay-container';
|
|
41
41
|
export * from './pagination';
|
|
42
42
|
export * from './popover';
|
|
43
|
+
export * from './product-card';
|
|
43
44
|
export * from './select';
|
|
44
45
|
export * from './selection-controls';
|
|
45
46
|
export * from './separator';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { Polymorphic, SymbolProps } from '../../..';
|
|
2
|
+
import { Polymorphic, SymbolProps, TooltipProps } from '../../..';
|
|
3
3
|
export declare type MenuItemProps = {
|
|
4
4
|
/**
|
|
5
5
|
* Content to display in the menu item.
|
|
@@ -59,7 +59,7 @@ export declare type MenuItemProps = {
|
|
|
59
59
|
* Assign a string value to the menu option. This is returned when the menu item is clicked.
|
|
60
60
|
*/
|
|
61
61
|
value: string;
|
|
62
|
-
}
|
|
62
|
+
} & Pick<TooltipProps, 'placement'>;
|
|
63
63
|
declare type PolymorphicMenuItem = Polymorphic.ForwardRefComponent<'button', MenuItemProps>;
|
|
64
64
|
export declare const MenuItem: PolymorphicMenuItem;
|
|
65
65
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-item.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu-item/menu-item.tsx"],"names":[],"mappings":"AAkBA,OAAO,EACO,SAAS,EACtB,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,WAAW,EAAiB,WAAW,
|
|
1
|
+
{"version":3,"file":"menu-item.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu-item/menu-item.tsx"],"names":[],"mappings":"AAkBA,OAAO,EACO,SAAS,EACtB,MAAM,OAAO,CAAC;AAGf,OAAO,EACL,WAAW,EAAiB,WAAW,EAGvC,YAAY,EACb,MAAM,cAAc,CAAC;AAItB,oBAAY,aAAa,GAAG;IAC1B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,IAAI,CAAC,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChD;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,IAAI,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;AAEpC,aAAK,mBAAmB,GAAG,WAAW,CAAC,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;AAEpF,eAAO,MAAM,QAAQ,qBAsGI,CAAC"}
|
|
@@ -34,7 +34,7 @@ export const MenuItem = forwardRef(({ className, children, subtext, onClick, ico
|
|
|
34
34
|
}, [handleClick, onClick, value]);
|
|
35
35
|
const InnerContent = useMemo(() => (_jsxs(Stack, { direction: isIconRight ? 'row-reverse' : 'row', as: "span", fill: false, className: styles.ItemContent, hAlign: isIconRight ? 'space-between' : 'start', vAlign: "center", columnGap: 8, hPadding: 16, vPadding: 8, "data-menu-item-icon-right": isIconRight, "data-menu-item-has-icon": Boolean(icon), "data-menu-item-padding": padding, style: { inlineSize: '100%' }, children: [icon && (_jsx(Symbol, { className: styles.Icon, source: icon, dimension: dimension === 'small' ? 12 : 16 })), _jsxs(Stack, { className: styles.DecorationContent, columnGap: 16, fill: false, direction: "row", hAlign: "space-between", children: [_jsxs(Stack, { direction: "column", children: [children, subtext && _jsx(Text, { variant: dimension === 'small' ? 'body-3' : 'body-2', children: subtext })] }), decoration] })] })), [children, subtext, dimension, icon, isIconRight, decoration, padding]);
|
|
36
36
|
return (_jsx(Stack, { as: "li", role: "none", children: _jsx(Wrapper, { autoFocus: autoFocus, ref: itemRef, role: "menuitem", className: clsx(styles.MenuItem, className), onClick: disabled ? undefined : triggerClick, onKeyDown: disabled ? undefined : handleKeyDown, tabIndex: tabIndex, "aria-disabled": disabled, type: Wrapper === 'button' ? 'button' : undefined, "data-menu-item-dimension": dimension, "data-testid": "MenuItem", ...otherProps, children: description
|
|
37
|
-
? (_jsx(Tooltip, { fill: true, open: isFocused || isHovering, placement: "auto", interactive: true, trigger: InnerContent, children: _jsx(Text, { variant: "body-2", children: description }) }))
|
|
37
|
+
? (_jsx(Tooltip, { fill: true, open: isFocused || isHovering, placement: "auto", interactive: true, ...otherProps, trigger: InnerContent, children: _jsx(Text, { variant: "body-2", children: description }) }))
|
|
38
38
|
: InnerContent }) }));
|
|
39
39
|
});
|
|
40
40
|
MenuItem.displayName = 'Menu.Item';
|
|
@@ -1,10 +1,50 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ComponentMeta, ComponentStory } from '@storybook/react';
|
|
2
3
|
import { Menu } from '..';
|
|
3
4
|
declare const story: ComponentMeta<typeof Menu.Item>;
|
|
4
5
|
export default story;
|
|
5
|
-
export declare const DefaultItem: ComponentStory<import("../../../types/polymorphic").ForwardRefComponent<"button",
|
|
6
|
-
|
|
6
|
+
export declare const DefaultItem: ComponentStory<import("../../../types/polymorphic").ForwardRefComponent<"button", {
|
|
7
|
+
children: import("react").ReactNode;
|
|
8
|
+
icon?: import("packages/symbols/dist").SymbolNames | import("react").ReactElement<HTMLOrSVGElement, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
9
|
+
iconPosition?: "left" | "right" | undefined;
|
|
10
|
+
subtext?: string | undefined;
|
|
11
|
+
dimension?: "small" | "regular" | undefined;
|
|
12
|
+
onClick?: ((event: Event, value: string) => void) | undefined;
|
|
13
|
+
description?: import("react").ReactNode;
|
|
14
|
+
disabled?: boolean | undefined;
|
|
15
|
+
padding?: boolean | undefined;
|
|
16
|
+
autoFocus?: boolean | undefined;
|
|
17
|
+
decoration?: import("react").ReactNode;
|
|
18
|
+
value: string;
|
|
19
|
+
} & Pick<import("../..").TooltipProps, "placement">>>;
|
|
20
|
+
export declare const WithCheckboxes: ComponentStory<import("../../../types/polymorphic").ForwardRefComponent<"button", {
|
|
21
|
+
children: import("react").ReactNode;
|
|
22
|
+
icon?: import("packages/symbols/dist").SymbolNames | import("react").ReactElement<HTMLOrSVGElement, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
23
|
+
iconPosition?: "left" | "right" | undefined;
|
|
24
|
+
subtext?: string | undefined;
|
|
25
|
+
dimension?: "small" | "regular" | undefined;
|
|
26
|
+
onClick?: ((event: Event, value: string) => void) | undefined;
|
|
27
|
+
description?: import("react").ReactNode;
|
|
28
|
+
disabled?: boolean | undefined;
|
|
29
|
+
padding?: boolean | undefined;
|
|
30
|
+
autoFocus?: boolean | undefined;
|
|
31
|
+
decoration?: import("react").ReactNode;
|
|
32
|
+
value: string;
|
|
33
|
+
} & Pick<import("../..").TooltipProps, "placement"> & {
|
|
7
34
|
checked?: boolean | undefined;
|
|
8
35
|
}>>;
|
|
9
|
-
export declare const WithDecorations: ComponentStory<import("../../../types/polymorphic").ForwardRefComponent<"button",
|
|
36
|
+
export declare const WithDecorations: ComponentStory<import("../../../types/polymorphic").ForwardRefComponent<"button", {
|
|
37
|
+
children: import("react").ReactNode;
|
|
38
|
+
icon?: import("packages/symbols/dist").SymbolNames | import("react").ReactElement<HTMLOrSVGElement, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
39
|
+
iconPosition?: "left" | "right" | undefined;
|
|
40
|
+
subtext?: string | undefined;
|
|
41
|
+
dimension?: "small" | "regular" | undefined;
|
|
42
|
+
onClick?: ((event: Event, value: string) => void) | undefined;
|
|
43
|
+
description?: import("react").ReactNode;
|
|
44
|
+
disabled?: boolean | undefined;
|
|
45
|
+
padding?: boolean | undefined;
|
|
46
|
+
autoFocus?: boolean | undefined;
|
|
47
|
+
decoration?: import("react").ReactNode;
|
|
48
|
+
value: string;
|
|
49
|
+
} & Pick<import("../..").TooltipProps, "placement">>>;
|
|
10
50
|
//# sourceMappingURL=menu-item.stories.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-item.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu-item/menu-item.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIjE,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE1B,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,IAAI,CAAC,IAAI,CAoB1C,CAAC;AAEF,eAAe,KAAK,CAAC;AAsBrB,eAAO,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"menu-item.stories.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu-item/menu-item.stories.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAIjE,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE1B,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,IAAI,CAAC,IAAI,CAoB1C,CAAC;AAEF,eAAe,KAAK,CAAC;AAsBrB,eAAO,MAAM,WAAW;;;;;;;;;;;;;qDAAwB,CAAC;AA+BjD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;GAAgC,CAAC;AAW5D,eAAO,MAAM,eAAe;;;;;;;;;;;;;qDAAkC,CAAC"}
|
|
@@ -4,36 +4,166 @@ import { Menu } from './menu';
|
|
|
4
4
|
declare const story: ComponentMeta<typeof Menu>;
|
|
5
5
|
export default story;
|
|
6
6
|
export declare const Default: ComponentStory<React.ForwardRefExoticComponent<import("./menu").MenuProps> & {
|
|
7
|
-
Item: import("../../types/polymorphic").ForwardRefComponent<"button",
|
|
8
|
-
|
|
7
|
+
Item: import("../../types/polymorphic").ForwardRefComponent<"button", {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
icon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
10
|
+
iconPosition?: "left" | "right" | undefined;
|
|
11
|
+
subtext?: string | undefined;
|
|
12
|
+
dimension?: "small" | "regular" | undefined;
|
|
13
|
+
onClick?: ((event: Event, value: string) => void) | undefined;
|
|
14
|
+
description?: React.ReactNode;
|
|
15
|
+
disabled?: boolean | undefined;
|
|
16
|
+
padding?: boolean | undefined;
|
|
17
|
+
autoFocus?: boolean | undefined;
|
|
18
|
+
decoration?: React.ReactNode;
|
|
19
|
+
value: string;
|
|
20
|
+
} & Pick<import("../..").TooltipProps, "placement">>;
|
|
21
|
+
ItemCheckbox: import("../../types/polymorphic").ForwardRefComponent<"button", {
|
|
22
|
+
children: React.ReactNode;
|
|
23
|
+
icon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
24
|
+
iconPosition?: "left" | "right" | undefined;
|
|
25
|
+
subtext?: string | undefined;
|
|
26
|
+
dimension?: "small" | "regular" | undefined;
|
|
27
|
+
onClick?: ((event: Event, value: string) => void) | undefined;
|
|
28
|
+
description?: React.ReactNode;
|
|
29
|
+
disabled?: boolean | undefined;
|
|
30
|
+
padding?: boolean | undefined;
|
|
31
|
+
autoFocus?: boolean | undefined;
|
|
32
|
+
decoration?: React.ReactNode;
|
|
33
|
+
value: string;
|
|
34
|
+
} & Pick<import("../..").TooltipProps, "placement"> & {
|
|
9
35
|
checked?: boolean | undefined;
|
|
10
36
|
}>;
|
|
11
37
|
Separator: () => JSX.Element;
|
|
12
38
|
}>;
|
|
13
39
|
export declare const WithMaxHeight: ComponentStory<React.ForwardRefExoticComponent<import("./menu").MenuProps> & {
|
|
14
|
-
Item: import("../../types/polymorphic").ForwardRefComponent<"button",
|
|
15
|
-
|
|
40
|
+
Item: import("../../types/polymorphic").ForwardRefComponent<"button", {
|
|
41
|
+
children: React.ReactNode;
|
|
42
|
+
icon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
43
|
+
iconPosition?: "left" | "right" | undefined;
|
|
44
|
+
subtext?: string | undefined;
|
|
45
|
+
dimension?: "small" | "regular" | undefined;
|
|
46
|
+
onClick?: ((event: Event, value: string) => void) | undefined;
|
|
47
|
+
description?: React.ReactNode;
|
|
48
|
+
disabled?: boolean | undefined;
|
|
49
|
+
padding?: boolean | undefined;
|
|
50
|
+
autoFocus?: boolean | undefined;
|
|
51
|
+
decoration?: React.ReactNode;
|
|
52
|
+
value: string;
|
|
53
|
+
} & Pick<import("../..").TooltipProps, "placement">>;
|
|
54
|
+
ItemCheckbox: import("../../types/polymorphic").ForwardRefComponent<"button", {
|
|
55
|
+
children: React.ReactNode;
|
|
56
|
+
icon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
57
|
+
iconPosition?: "left" | "right" | undefined;
|
|
58
|
+
subtext?: string | undefined;
|
|
59
|
+
dimension?: "small" | "regular" | undefined;
|
|
60
|
+
onClick?: ((event: Event, value: string) => void) | undefined;
|
|
61
|
+
description?: React.ReactNode;
|
|
62
|
+
disabled?: boolean | undefined;
|
|
63
|
+
padding?: boolean | undefined;
|
|
64
|
+
autoFocus?: boolean | undefined;
|
|
65
|
+
decoration?: React.ReactNode;
|
|
66
|
+
value: string;
|
|
67
|
+
} & Pick<import("../..").TooltipProps, "placement"> & {
|
|
16
68
|
checked?: boolean | undefined;
|
|
17
69
|
}>;
|
|
18
70
|
Separator: () => JSX.Element;
|
|
19
71
|
}>;
|
|
20
72
|
export declare const WithIcons: ComponentStory<React.ForwardRefExoticComponent<import("./menu").MenuProps> & {
|
|
21
|
-
Item: import("../../types/polymorphic").ForwardRefComponent<"button",
|
|
22
|
-
|
|
73
|
+
Item: import("../../types/polymorphic").ForwardRefComponent<"button", {
|
|
74
|
+
children: React.ReactNode;
|
|
75
|
+
icon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
76
|
+
iconPosition?: "left" | "right" | undefined;
|
|
77
|
+
subtext?: string | undefined;
|
|
78
|
+
dimension?: "small" | "regular" | undefined;
|
|
79
|
+
onClick?: ((event: Event, value: string) => void) | undefined;
|
|
80
|
+
description?: React.ReactNode;
|
|
81
|
+
disabled?: boolean | undefined;
|
|
82
|
+
padding?: boolean | undefined;
|
|
83
|
+
autoFocus?: boolean | undefined;
|
|
84
|
+
decoration?: React.ReactNode;
|
|
85
|
+
value: string;
|
|
86
|
+
} & Pick<import("../..").TooltipProps, "placement">>;
|
|
87
|
+
ItemCheckbox: import("../../types/polymorphic").ForwardRefComponent<"button", {
|
|
88
|
+
children: React.ReactNode;
|
|
89
|
+
icon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
90
|
+
iconPosition?: "left" | "right" | undefined;
|
|
91
|
+
subtext?: string | undefined;
|
|
92
|
+
dimension?: "small" | "regular" | undefined;
|
|
93
|
+
onClick?: ((event: Event, value: string) => void) | undefined;
|
|
94
|
+
description?: React.ReactNode;
|
|
95
|
+
disabled?: boolean | undefined;
|
|
96
|
+
padding?: boolean | undefined;
|
|
97
|
+
autoFocus?: boolean | undefined;
|
|
98
|
+
decoration?: React.ReactNode;
|
|
99
|
+
value: string;
|
|
100
|
+
} & Pick<import("../..").TooltipProps, "placement"> & {
|
|
23
101
|
checked?: boolean | undefined;
|
|
24
102
|
}>;
|
|
25
103
|
Separator: () => JSX.Element;
|
|
26
104
|
}>;
|
|
27
105
|
export declare const WithCheckboxes: ComponentStory<React.ForwardRefExoticComponent<import("./menu").MenuProps> & {
|
|
28
|
-
Item: import("../../types/polymorphic").ForwardRefComponent<"button",
|
|
29
|
-
|
|
106
|
+
Item: import("../../types/polymorphic").ForwardRefComponent<"button", {
|
|
107
|
+
children: React.ReactNode;
|
|
108
|
+
icon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
109
|
+
iconPosition?: "left" | "right" | undefined;
|
|
110
|
+
subtext?: string | undefined;
|
|
111
|
+
dimension?: "small" | "regular" | undefined;
|
|
112
|
+
onClick?: ((event: Event, value: string) => void) | undefined;
|
|
113
|
+
description?: React.ReactNode;
|
|
114
|
+
disabled?: boolean | undefined;
|
|
115
|
+
padding?: boolean | undefined;
|
|
116
|
+
autoFocus?: boolean | undefined;
|
|
117
|
+
decoration?: React.ReactNode;
|
|
118
|
+
value: string;
|
|
119
|
+
} & Pick<import("../..").TooltipProps, "placement">>;
|
|
120
|
+
ItemCheckbox: import("../../types/polymorphic").ForwardRefComponent<"button", {
|
|
121
|
+
children: React.ReactNode;
|
|
122
|
+
icon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
123
|
+
iconPosition?: "left" | "right" | undefined;
|
|
124
|
+
subtext?: string | undefined;
|
|
125
|
+
dimension?: "small" | "regular" | undefined;
|
|
126
|
+
onClick?: ((event: Event, value: string) => void) | undefined;
|
|
127
|
+
description?: React.ReactNode;
|
|
128
|
+
disabled?: boolean | undefined;
|
|
129
|
+
padding?: boolean | undefined;
|
|
130
|
+
autoFocus?: boolean | undefined;
|
|
131
|
+
decoration?: React.ReactNode;
|
|
132
|
+
value: string;
|
|
133
|
+
} & Pick<import("../..").TooltipProps, "placement"> & {
|
|
30
134
|
checked?: boolean | undefined;
|
|
31
135
|
}>;
|
|
32
136
|
Separator: () => JSX.Element;
|
|
33
137
|
}>;
|
|
34
138
|
export declare const AsLink: ComponentStory<React.ForwardRefExoticComponent<import("./menu").MenuProps> & {
|
|
35
|
-
Item: import("../../types/polymorphic").ForwardRefComponent<"button",
|
|
36
|
-
|
|
139
|
+
Item: import("../../types/polymorphic").ForwardRefComponent<"button", {
|
|
140
|
+
children: React.ReactNode;
|
|
141
|
+
icon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
142
|
+
iconPosition?: "left" | "right" | undefined;
|
|
143
|
+
subtext?: string | undefined;
|
|
144
|
+
dimension?: "small" | "regular" | undefined;
|
|
145
|
+
onClick?: ((event: Event, value: string) => void) | undefined;
|
|
146
|
+
description?: React.ReactNode;
|
|
147
|
+
disabled?: boolean | undefined;
|
|
148
|
+
padding?: boolean | undefined;
|
|
149
|
+
autoFocus?: boolean | undefined;
|
|
150
|
+
decoration?: React.ReactNode;
|
|
151
|
+
value: string;
|
|
152
|
+
} & Pick<import("../..").TooltipProps, "placement">>;
|
|
153
|
+
ItemCheckbox: import("../../types/polymorphic").ForwardRefComponent<"button", {
|
|
154
|
+
children: React.ReactNode;
|
|
155
|
+
icon?: import("packages/symbols/dist").SymbolNames | React.ReactElement<HTMLOrSVGElement, string | React.JSXElementConstructor<any>> | undefined;
|
|
156
|
+
iconPosition?: "left" | "right" | undefined;
|
|
157
|
+
subtext?: string | undefined;
|
|
158
|
+
dimension?: "small" | "regular" | undefined;
|
|
159
|
+
onClick?: ((event: Event, value: string) => void) | undefined;
|
|
160
|
+
description?: React.ReactNode;
|
|
161
|
+
disabled?: boolean | undefined;
|
|
162
|
+
padding?: boolean | undefined;
|
|
163
|
+
autoFocus?: boolean | undefined;
|
|
164
|
+
decoration?: React.ReactNode;
|
|
165
|
+
value: string;
|
|
166
|
+
} & Pick<import("../..").TooltipProps, "placement"> & {
|
|
37
167
|
checked?: boolean | undefined;
|
|
38
168
|
}>;
|
|
39
169
|
Separator: () => JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.stories.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,IAAI,CAGrC,CAAC;AAEF,eAAe,KAAK,CAAC;AAoBrB,eAAO,MAAM,OAAO
|
|
1
|
+
{"version":3,"file":"menu.stories.d.ts","sourceRoot":"","sources":["../../../src/components/menu/menu.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,QAAA,MAAM,KAAK,EAAE,aAAa,CAAC,OAAO,IAAI,CAGrC,CAAC;AAEF,eAAe,KAAK,CAAC;AAoBrB,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAoB,CAAC;AAEzC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAoB,CAAC;AAe/C,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA6B,CAAC;AA0BpD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAgC,CAAC;AAY5D,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAyB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/product-card/index.ts"],"names":[],"mappings":"AAgBA,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2022-2023 Wonderflow Design Team
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export { ProductCard } from './product-card';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PropsWithChildren } from 'react';
|
|
2
|
+
export declare type ProductCardFooterProps = PropsWithChildren<{
|
|
3
|
+
/**
|
|
4
|
+
* Set the loading state showing a skeleton.
|
|
5
|
+
*/
|
|
6
|
+
isLoading?: boolean;
|
|
7
|
+
}>;
|
|
8
|
+
export declare type ProductCardFooterComponent = React.ForwardRefExoticComponent<ProductCardFooterProps>;
|
|
9
|
+
export declare const ProductCardFooter: ProductCardFooterComponent;
|
|
10
|
+
//# sourceMappingURL=product-card-footer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-card-footer.d.ts","sourceRoot":"","sources":["../../../../src/components/product-card/product-card-footer/product-card-footer.tsx"],"names":[],"mappings":"AAgBA,OAAO,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAMtD,oBAAY,sBAAsB,GAAG,iBAAiB,CAAC;IACrD;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,CAAA;AAEF,oBAAY,0BAA0B,GAAG,KAAK,CAAC,yBAAyB,CAAC,sBAAsB,CAAC,CAAC;AAEjG,eAAO,MAAM,iBAAiB,4BAcE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { forwardRef } from 'react';
|
|
18
|
+
import { Skeleton, Stack, } from '../../..';
|
|
19
|
+
export const ProductCardFooter = forwardRef(({ isLoading = false, children, ...otherProps }, forwardedRef) => (_jsx(Stack, { hPadding: 24, vPadding: 24, style: { padding: children ? undefined : '0 24px 24px' }, ...otherProps, ref: forwardedRef, children: isLoading ? _jsx(Skeleton, { height: "24px", style: { lineHeight: '1.5rem' } }) : children })));
|
|
20
|
+
ProductCardFooter.displayName = 'ProductCardFooter';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-card-footer.test.d.ts","sourceRoot":"","sources":["../../../../src/components/product-card/product-card-footer/product-card-footer.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { ProductCardFooter } from './product-card-footer';
|
|
4
|
+
describe('<ProductCardFooter>', () => {
|
|
5
|
+
test('it should render properly', () => {
|
|
6
|
+
const { container } = render(_jsx(ProductCardFooter, {}));
|
|
7
|
+
expect(container).not.toBeNull();
|
|
8
|
+
});
|
|
9
|
+
test('it should render properly with props', () => {
|
|
10
|
+
const { container } = render(_jsx(ProductCardFooter, { isLoading: true, children: _jsx("div", { children: "some content here" }) }));
|
|
11
|
+
expect(container).not.toBeNull();
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare type ProductCardHeaderProps = {
|
|
3
|
+
/**
|
|
4
|
+
* Set the subtitle or product brand.
|
|
5
|
+
*/
|
|
6
|
+
subtitle?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Set the title or product name.
|
|
9
|
+
*/
|
|
10
|
+
title?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Define how many lines the title should be clamped to.
|
|
13
|
+
*/
|
|
14
|
+
titleRows?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Set a description text.
|
|
17
|
+
*/
|
|
18
|
+
description?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Define how many lines the description should be clamped to.
|
|
21
|
+
*/
|
|
22
|
+
descriptionRows?: number;
|
|
23
|
+
/**
|
|
24
|
+
* Set the content to be displayed in the header menu.
|
|
25
|
+
*/
|
|
26
|
+
menuActions?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Set the loading state showing a skeleton.
|
|
29
|
+
*/
|
|
30
|
+
isLoading?: boolean;
|
|
31
|
+
};
|
|
32
|
+
export declare type ProductCardHeaderComponent = React.ForwardRefExoticComponent<ProductCardHeaderProps>;
|
|
33
|
+
export declare const ProductCardHeader: ProductCardHeaderComponent;
|
|
34
|
+
//# sourceMappingURL=product-card-header.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-card-header.d.ts","sourceRoot":"","sources":["../../../../src/components/product-card/product-card-header/product-card-header.tsx"],"names":[],"mappings":";AAyBA,oBAAY,sBAAsB,GAAG;IACnC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAA;AAED,oBAAY,0BAA0B,GAAG,KAAK,CAAC,yBAAyB,CAAC,sBAAsB,CAAC,CAAC;AAEjG,eAAO,MAAM,iBAAiB,4BA8EE,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright 2023 Wonderflow Design Team
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { forwardRef } from 'react';
|
|
18
|
+
import { ClampText, Elevator, IconButton, Popover, Skeleton, Stack, Text, } from '../../..';
|
|
19
|
+
import * as styles from './product-card-header.module.css';
|
|
20
|
+
export const ProductCardHeader = forwardRef(({ subtitle, title, titleRows = 3, description, descriptionRows = 3, menuActions, isLoading = false, }, forwardedRef) => {
|
|
21
|
+
const titleRem = 1.75;
|
|
22
|
+
const descriptionRem = 1.25;
|
|
23
|
+
const dynamicStyle = {
|
|
24
|
+
'--header-title-height': `${(titleRows ?? 0) * titleRem}rem`,
|
|
25
|
+
'--header-description-height': `${(descriptionRows ?? 0) * descriptionRem}rem`,
|
|
26
|
+
};
|
|
27
|
+
if (isLoading) {
|
|
28
|
+
return (_jsxs(Stack, { direction: "row", vPadding: 24, hPadding: 24, columnGap: 8, children: [_jsxs(Stack, { style: { width: '100%' }, rowGap: 8, children: [_jsxs("div", { children: [subtitle && _jsx(Skeleton, { count: 1, width: "50%" }), title && _jsx("div", { children: _jsx(Skeleton, { count: 1, height: "28px", width: "60%" }) })] }), description && _jsx("div", { children: _jsx(Skeleton, { count: 1, width: "80%" }) })] }), menuActions && _jsx(Skeleton, { count: 1, width: "24px", height: "24px" })] }));
|
|
29
|
+
}
|
|
30
|
+
return (_jsxs(Stack, { columnGap: 8, vPadding: 24, direction: "row", hPadding: 24, ref: forwardedRef, style: { ...dynamicStyle }, children: [_jsxs(Stack, { rowGap: 8, children: [_jsxs("div", { children: [subtitle && _jsx(Text, { variant: "subtitle-2", className: styles.Subtitle, children: subtitle }), title && (_jsx("div", { className: styles.Title, children: _jsx(ClampText, { rows: titleRows, children: _jsx(Text, { variant: "heading-6", children: title }) }) }))] }), description && (_jsx("div", { className: styles.Description, children: _jsx(ClampText, { rows: descriptionRows, children: _jsx(Text, { variant: "body-2", children: description }) }) }))] }), menuActions && (_jsx(Stack, { maxWidth: "1.5rem", fill: false, children: _jsx(Popover, { trigger: _jsx(IconButton, { icon: "more-vert", kind: "flat", dimension: "small" }), placement: "bottom-start", offset: 8, closeOnOutsideClick: true, children: _jsx(Elevator, { resting: 1, children: _jsx(_Fragment, { children: menuActions }) }) }) }))] }));
|
|
31
|
+
});
|
|
32
|
+
ProductCardHeader.displayName = 'ProductCardHeader';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer components{.Subtitle{text-transform:uppercase}.Title{height:var(--header-title-height)}.Description{height:var(--header-descriotion-height)}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-card-header.test.d.ts","sourceRoot":"","sources":["../../../../src/components/product-card/product-card-header/product-card-header.test.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { ProductCardHeader } from './product-card-header';
|
|
4
|
+
describe('<ProductCardHeader>', () => {
|
|
5
|
+
test('it should render properly', () => {
|
|
6
|
+
const { container } = render(_jsx(ProductCardHeader, {}));
|
|
7
|
+
expect(container).not.toBeNull();
|
|
8
|
+
});
|
|
9
|
+
test('it should render properly with props', () => {
|
|
10
|
+
const { container } = render(_jsx(ProductCardHeader, { title: "title", subtitle: "subtitle", description: "description", titleRows: 2, descriptionRows: 2 }));
|
|
11
|
+
expect(container).not.toBeNull();
|
|
12
|
+
});
|
|
13
|
+
test('it should render properly with skeleton', () => {
|
|
14
|
+
const { container } = render(_jsx(ProductCardHeader, { title: "title", subtitle: "subtitle", description: "description", menuActions: _jsx("div", { children: "some content" }), isLoading: true }));
|
|
15
|
+
expect(container).not.toBeNull();
|
|
16
|
+
});
|
|
17
|
+
});
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TokensTypes } from '@wonderflow/tokens/platforms/web';
|
|
3
|
+
export declare type Currency = 'EUR' | 'USD' | 'GBP' | 'JPY' | 'CNY';
|
|
4
|
+
export declare type ProductCardKpisProps = PropsWithClass<{
|
|
5
|
+
/**
|
|
6
|
+
* Set the stars rating value.
|
|
7
|
+
*/
|
|
8
|
+
rating?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Set the feedback count value.
|
|
11
|
+
*/
|
|
12
|
+
feedbackCount?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Set the votes count value.
|
|
15
|
+
*/
|
|
16
|
+
votesCount?: number;
|
|
17
|
+
/**
|
|
18
|
+
* Set the votes rating value.
|
|
19
|
+
*/
|
|
20
|
+
votesRating?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Set the sentiment index value.
|
|
23
|
+
*/
|
|
24
|
+
sentiment?: number;
|
|
25
|
+
/**
|
|
26
|
+
* Set the NPS value.
|
|
27
|
+
*/
|
|
28
|
+
nps?: number;
|
|
29
|
+
/**
|
|
30
|
+
* Set the groups value.
|
|
31
|
+
*/
|
|
32
|
+
groups?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Set the TGW value.
|
|
35
|
+
*/
|
|
36
|
+
tgw?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Set the minimum price value.
|
|
39
|
+
*/
|
|
40
|
+
priceMin?: number;
|
|
41
|
+
/**
|
|
42
|
+
* Set the maximum price value.
|
|
43
|
+
*/
|
|
44
|
+
priceMax?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Set the price currency code based on ISO 4217.
|
|
47
|
+
*/
|
|
48
|
+
currency?: Currency;
|
|
49
|
+
/**
|
|
50
|
+
* Set the number of decimal to be used for currency formatting.
|
|
51
|
+
*/
|
|
52
|
+
currencyDecimals?: number;
|
|
53
|
+
/**
|
|
54
|
+
* Set the users value.
|
|
55
|
+
*/
|
|
56
|
+
users?: number;
|
|
57
|
+
/**
|
|
58
|
+
* Set a cap value for users.
|
|
59
|
+
*/
|
|
60
|
+
usersCap?: number;
|
|
61
|
+
/**
|
|
62
|
+
* Set the SKUs value.
|
|
63
|
+
*/
|
|
64
|
+
skus?: number;
|
|
65
|
+
/**
|
|
66
|
+
* Set the a cap value for SKUs.
|
|
67
|
+
*/
|
|
68
|
+
skusCap?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Set the number of Kpis items to be displayed.
|
|
71
|
+
*/
|
|
72
|
+
kpiItems?: number;
|
|
73
|
+
/**
|
|
74
|
+
* Set the space between Kpis items.
|
|
75
|
+
*/
|
|
76
|
+
kpisRowGap?: TokensTypes['space'];
|
|
77
|
+
/**
|
|
78
|
+
* Set the loading state showing a skeleton.
|
|
79
|
+
*/
|
|
80
|
+
isLoading?: boolean;
|
|
81
|
+
}>;
|
|
82
|
+
export declare type ProductCardKpisComponent = React.ForwardRefExoticComponent<ProductCardKpisProps>;
|
|
83
|
+
export declare const ProductCardKpis: ProductCardKpisComponent;
|
|
84
|
+
//# sourceMappingURL=product-card-kpis.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-card-kpis.d.ts","sourceRoot":"","sources":["../../../../src/components/product-card/product-card-kpis/product-card-kpis.tsx"],"names":[],"mappings":";AAgBA,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAiB/D,oBAAY,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAE7D,oBAAY,oBAAoB,GAAG,cAAc,CAAC;IAChD;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;MAEE;IACF,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB;;MAEE;IACF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B;;MAEE;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;MAEE;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;MAEE;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;MAEE;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAClC;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC,CAAA;AAEF,oBAAY,wBAAwB,GAAG,KAAK,CAAC,yBAAyB,CAAC,oBAAoB,CAAC,CAAC;AAS7F,eAAO,MAAM,eAAe,0BAqIE,CAAC"}
|