@windstream/react-shared-components 0.0.18 → 0.0.20
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/contentful/index.esm.js +1 -1
- package/dist/contentful/index.esm.js.map +1 -1
- package/dist/contentful/index.js +1 -1
- package/dist/contentful/index.js.map +1 -1
- package/dist/core.d.ts +38 -10
- package/dist/index.d.ts +35 -7
- package/dist/index.esm.js +5 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utils/index.esm.js.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/accordion/Accordion.stories.tsx +16 -11
- package/src/components/accordion/index.tsx +19 -8
- package/src/components/accordion/types.ts +8 -9
- package/src/components/alert-card/AlertCard.stories.tsx +4 -5
- package/src/components/alert-card/index.tsx +6 -9
- package/src/components/alert-card/types.ts +9 -9
- package/src/components/brand-button/BrandButton.stories.tsx +8 -10
- package/src/components/brand-button/helpers.ts +8 -8
- package/src/components/brand-button/index.tsx +30 -27
- package/src/components/brand-button/types.ts +6 -8
- package/src/components/button/Button.stories.tsx +6 -6
- package/src/components/button/index.tsx +3 -1
- package/src/components/button/types.ts +14 -14
- package/src/components/call-button/CallButton.stories.tsx +1 -1
- package/src/components/call-button/index.tsx +3 -4
- package/src/components/call-button/types.ts +1 -0
- package/src/components/checkbox/Checkbox.stories.tsx +6 -7
- package/src/components/checkbox/index.tsx +17 -7
- package/src/components/checkbox/types.ts +19 -16
- package/src/components/checklist/Checklist.stories.tsx +1 -2
- package/src/components/checklist/index.tsx +12 -6
- package/src/components/checklist/types.ts +5 -5
- package/src/components/collapse/Collapse.stories.tsx +18 -19
- package/src/components/collapse/index.tsx +1 -1
- package/src/components/collapse/types.ts +4 -4
- package/src/components/divider/Divider.stories.tsx +16 -17
- package/src/components/divider/index.tsx +2 -3
- package/src/components/divider/type.ts +2 -2
- package/src/components/image/Image.stories.tsx +113 -0
- package/src/components/image/index.tsx +22 -0
- package/src/components/image/types.ts +28 -0
- package/src/components/input/Input.stories.tsx +13 -46
- package/src/components/input/index.tsx +18 -15
- package/src/components/input/types.ts +1 -1
- package/src/components/link/Link.stories.tsx +1 -1
- package/src/components/link/index.tsx +1 -2
- package/src/components/link/types.ts +25 -25
- package/src/components/list/List.stories.tsx +1 -1
- package/src/components/list/index.tsx +86 -86
- package/src/components/list/list-item/index.tsx +36 -36
- package/src/components/list/list-item/types.ts +13 -13
- package/src/components/list/types.ts +29 -29
- package/src/components/material-icon/MaterialIcon.stories.tsx +1 -1
- package/src/components/material-icon/constants.ts +1 -1
- package/src/components/material-icon/index.tsx +44 -44
- package/src/components/material-icon/types.ts +31 -31
- package/src/components/modal/Modal.stories.tsx +9 -9
- package/src/components/modal/index.tsx +8 -14
- package/src/components/modal/types.ts +1 -1
- package/src/components/radio-button/RadioButton.stories.tsx +7 -7
- package/src/components/radio-button/index.tsx +11 -9
- package/src/components/radio-button/types.ts +18 -19
- package/src/components/see-more/SeeMore.stories.tsx +14 -15
- package/src/components/see-more/index.tsx +33 -29
- package/src/components/see-more/types.ts +3 -3
- package/src/components/select/Select.stories.tsx +3 -2
- package/src/components/select/index.tsx +15 -17
- package/src/components/select/types.ts +2 -1
- package/src/components/select-plan-button/SelectPlanButton.stories.tsx +20 -12
- package/src/components/select-plan-button/index.tsx +28 -20
- package/src/components/select-plan-button/types.ts +1 -1
- package/src/components/skeleton/Skeleton.stories.tsx +9 -10
- package/src/components/skeleton/index.tsx +61 -61
- package/src/components/skeleton/types.ts +3 -3
- package/src/components/spinner/Spinner.stories.tsx +1 -1
- package/src/components/spinner/index.tsx +1 -1
- package/src/components/spinner/types.ts +4 -4
- package/src/components/text/Text.stories.tsx +35 -16
- package/src/components/text/index.tsx +2 -5
- package/src/components/text/types.ts +45 -45
- package/src/components/tooltip/Tooltip.stories.tsx +15 -16
- package/src/components/tooltip/index.tsx +1 -5
- package/src/components/tooltip/types.ts +4 -4
- package/src/components/view-cart-button/ViewCartButton.stories.tsx +23 -12
- package/src/components/view-cart-button/index.tsx +11 -6
- package/src/components/view-cart-button/types.ts +1 -1
- package/src/contentful/blocks/accordion/Accordion.stories.tsx +23 -0
- package/src/contentful/blocks/accordion/index.tsx +11 -1
- package/src/contentful/blocks/accordion/types.ts +1 -1
- package/src/contentful/blocks/button/Button.stories.tsx +40 -0
- package/src/contentful/blocks/button/index.tsx +15 -14
- package/src/contentful/blocks/button/types.ts +17 -17
- package/src/contentful/blocks/callout/Callout.stories.tsx +23 -0
- package/src/contentful/blocks/callout/index.tsx +9 -1
- package/src/contentful/blocks/callout/types.ts +1 -1
- package/src/contentful/blocks/cards/Cards.stories.tsx +23 -0
- package/src/contentful/blocks/cards/index.tsx +7 -1
- package/src/contentful/blocks/cards/types.ts +1 -1
- package/src/contentful/blocks/carousel/Carousel.stories.tsx +23 -0
- package/src/contentful/blocks/carousel/index.tsx +7 -1
- package/src/contentful/blocks/carousel/types.ts +1 -1
- package/src/contentful/blocks/cta-callout/CtaCallout.stories.tsx +46 -0
- package/src/contentful/blocks/cta-callout/index.tsx +5 -5
- package/src/contentful/blocks/cta-callout/types.ts +16 -16
- package/src/contentful/blocks/floating-banner/FloatingBanner.stories.tsx +23 -0
- package/src/contentful/blocks/floating-banner/index.tsx +6 -2
- package/src/contentful/blocks/floating-banner/types.ts +1 -1
- package/src/contentful/blocks/footer/Footer.stories.tsx +30 -0
- package/src/contentful/blocks/footer/index.tsx +8 -7
- package/src/contentful/blocks/footer/types.ts +7 -6
- package/src/contentful/blocks/image-promo-bar/ImagePromoBar.stories.tsx +23 -0
- package/src/contentful/blocks/image-promo-bar/index.tsx +2 -1
- package/src/contentful/blocks/image-promo-bar/types.ts +28 -28
- package/src/contentful/blocks/modal/Modal.stories.tsx +23 -0
- package/src/contentful/blocks/modal/index.tsx +8 -2
- package/src/contentful/blocks/modal/types.ts +1 -1
- package/src/contentful/blocks/navigation/Navigation.stories.tsx +23 -0
- package/src/contentful/blocks/navigation/index.tsx +6 -2
- package/src/contentful/blocks/navigation/types.ts +1 -1
- package/src/contentful/blocks/primary-hero/PrimaryHero.stories.tsx +23 -0
- package/src/contentful/blocks/primary-hero/index.tsx +4 -3
- package/src/contentful/blocks/primary-hero/types.ts +29 -29
- package/src/contentful/blocks/shape-background-wrapper/ShapeBackgroundWrapper.stories.tsx +26 -0
- package/src/contentful/blocks/shape-background-wrapper/index.tsx +107 -106
- package/src/contentful/blocks/shape-background-wrapper/types.ts +24 -23
- package/src/contentful/blocks/text/Text.stories.tsx +23 -0
- package/src/contentful/blocks/text/index.tsx +7 -1
- package/src/contentful/blocks/text/types.ts +1 -1
- package/src/contentful/index.ts +1 -1
- package/src/hooks/use-body-scroll-lock.ts +2 -1
- package/src/index.ts +14 -2
- package/src/setupTests.ts +46 -46
- package/src/stories/DocsTemplate.tsx +0 -2
- package/src/styles/globals.css +162 -162
- package/src/types/global.d.ts +9 -9
- package/src/utils/index.ts +34 -34
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
import React, { forwardRef } from "react";
|
|
2
|
-
import { cx } from "../../utils";
|
|
3
|
-
import { ListItem, ListItemProps } from "./list-item";
|
|
4
|
-
import { ListProps } from "./types";
|
|
5
|
-
|
|
6
|
-
export const List = forwardRef<HTMLUListElement | HTMLOListElement, ListProps>(
|
|
7
|
-
(
|
|
8
|
-
{
|
|
9
|
-
type = "ul",
|
|
10
|
-
items,
|
|
11
|
-
className = "",
|
|
12
|
-
renderItem,
|
|
13
|
-
children,
|
|
14
|
-
variant = "unstyled",
|
|
15
|
-
style,
|
|
16
|
-
...props
|
|
17
|
-
},
|
|
18
|
-
ref
|
|
19
|
-
) => {
|
|
20
|
-
// Get Tailwind classes for different variants
|
|
21
|
-
const getVariantClasses = () => {
|
|
22
|
-
if (variant === "unstyled") {
|
|
23
|
-
return "";
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// TODO: Add styles based on the figma design for all variants
|
|
27
|
-
const baseClasses = "m-0 p-0";
|
|
28
|
-
const typeClasses =
|
|
29
|
-
type === "ol" ? "pl-6 list-decimal" : "pl-5 list-disc";
|
|
30
|
-
|
|
31
|
-
return `${baseClasses} ${typeClasses}`;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const tailwindClasses = getVariantClasses();
|
|
35
|
-
const combinedClassName = cx(
|
|
36
|
-
tailwindClasses,
|
|
37
|
-
`list--${type}`,
|
|
38
|
-
`list--${variant}`,
|
|
39
|
-
className
|
|
40
|
-
);
|
|
41
|
-
|
|
42
|
-
// Render items if provided
|
|
43
|
-
const renderItems = () => {
|
|
44
|
-
if (!items || items.length === 0) return null;
|
|
45
|
-
|
|
46
|
-
return items.map((item, index) => {
|
|
47
|
-
if (renderItem) {
|
|
48
|
-
return renderItem(item, index);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return (
|
|
52
|
-
<ListItem
|
|
53
|
-
key={item.id || index}
|
|
54
|
-
className={item.className}
|
|
55
|
-
variant={variant}
|
|
56
|
-
>
|
|
57
|
-
{item.content}
|
|
58
|
-
</ListItem>
|
|
59
|
-
);
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const content = children || renderItems();
|
|
64
|
-
|
|
65
|
-
// Create props object to avoid duplication
|
|
66
|
-
const listProps = {
|
|
67
|
-
className: combinedClassName,
|
|
68
|
-
style,
|
|
69
|
-
...props,
|
|
70
|
-
children: content,
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
// Return appropriate list type with conditional rendering for proper TypeScript inference
|
|
74
|
-
if (type === "ol") {
|
|
75
|
-
return <ol {...listProps} ref={ref as React.Ref<HTMLOListElement>} />;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return <ul {...listProps} ref={ref as React.Ref<HTMLUListElement>} />;
|
|
79
|
-
}
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
List.displayName = "List";
|
|
83
|
-
|
|
84
|
-
export { ListItem };
|
|
85
|
-
|
|
86
|
-
export type { ListProps, ListItemProps };
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { cx } from "../../utils";
|
|
3
|
+
import { ListItem, ListItemProps } from "./list-item";
|
|
4
|
+
import { ListProps } from "./types";
|
|
5
|
+
|
|
6
|
+
export const List = forwardRef<HTMLUListElement | HTMLOListElement, ListProps>(
|
|
7
|
+
(
|
|
8
|
+
{
|
|
9
|
+
type = "ul",
|
|
10
|
+
items,
|
|
11
|
+
className = "",
|
|
12
|
+
renderItem,
|
|
13
|
+
children,
|
|
14
|
+
variant = "unstyled",
|
|
15
|
+
style,
|
|
16
|
+
...props
|
|
17
|
+
},
|
|
18
|
+
ref
|
|
19
|
+
) => {
|
|
20
|
+
// Get Tailwind classes for different variants
|
|
21
|
+
const getVariantClasses = () => {
|
|
22
|
+
if (variant === "unstyled") {
|
|
23
|
+
return "";
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
// TODO: Add styles based on the figma design for all variants
|
|
27
|
+
const baseClasses = "m-0 p-0";
|
|
28
|
+
const typeClasses =
|
|
29
|
+
type === "ol" ? "pl-6 list-decimal" : "pl-5 list-disc";
|
|
30
|
+
|
|
31
|
+
return `${baseClasses} ${typeClasses}`;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const tailwindClasses = getVariantClasses();
|
|
35
|
+
const combinedClassName = cx(
|
|
36
|
+
tailwindClasses,
|
|
37
|
+
`list--${type}`,
|
|
38
|
+
`list--${variant}`,
|
|
39
|
+
className
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
// Render items if provided
|
|
43
|
+
const renderItems = () => {
|
|
44
|
+
if (!items || items.length === 0) return null;
|
|
45
|
+
|
|
46
|
+
return items.map((item, index) => {
|
|
47
|
+
if (renderItem) {
|
|
48
|
+
return renderItem(item, index);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<ListItem
|
|
53
|
+
key={item.id || index}
|
|
54
|
+
className={item.className}
|
|
55
|
+
variant={variant}
|
|
56
|
+
>
|
|
57
|
+
{item.content}
|
|
58
|
+
</ListItem>
|
|
59
|
+
);
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const content = children || renderItems();
|
|
64
|
+
|
|
65
|
+
// Create props object to avoid duplication
|
|
66
|
+
const listProps = {
|
|
67
|
+
className: combinedClassName,
|
|
68
|
+
style,
|
|
69
|
+
...props,
|
|
70
|
+
children: content,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
// Return appropriate list type with conditional rendering for proper TypeScript inference
|
|
74
|
+
if (type === "ol") {
|
|
75
|
+
return <ol {...listProps} ref={ref as React.Ref<HTMLOListElement>} />;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return <ul {...listProps} ref={ref as React.Ref<HTMLUListElement>} />;
|
|
79
|
+
}
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
List.displayName = "List";
|
|
83
|
+
|
|
84
|
+
export { ListItem };
|
|
85
|
+
|
|
86
|
+
export type { ListProps, ListItemProps };
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { forwardRef } from "react";
|
|
2
|
-
import { cx } from "../../../utils";
|
|
3
|
-
import { ListItemProps } from "./types";
|
|
4
|
-
|
|
5
|
-
export const ListItem = forwardRef<HTMLLIElement, ListItemProps>(
|
|
6
|
-
(
|
|
7
|
-
{ children, className = "", variant = "unstyled", style, ...props },
|
|
8
|
-
ref
|
|
9
|
-
) => {
|
|
10
|
-
// Get Tailwind classes for different variants
|
|
11
|
-
const getVariantClasses = () => {
|
|
12
|
-
if (variant === "unstyled") return "";
|
|
13
|
-
|
|
14
|
-
// TODO: Add styles based on the figma design for all variants
|
|
15
|
-
return "mb-1 leading-6";
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const tailwindClasses = getVariantClasses();
|
|
19
|
-
const combinedClassName = cx(
|
|
20
|
-
tailwindClasses,
|
|
21
|
-
"list-item",
|
|
22
|
-
`list-item--${variant}`,
|
|
23
|
-
className
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
return (
|
|
27
|
-
<li ref={ref} className={combinedClassName} style={style} {...props}>
|
|
28
|
-
{children}
|
|
29
|
-
</li>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
ListItem.displayName = "ListItem";
|
|
35
|
-
|
|
36
|
-
export type { ListItemProps };
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import { cx } from "../../../utils";
|
|
3
|
+
import { ListItemProps } from "./types";
|
|
4
|
+
|
|
5
|
+
export const ListItem = forwardRef<HTMLLIElement, ListItemProps>(
|
|
6
|
+
(
|
|
7
|
+
{ children, className = "", variant = "unstyled", style, ...props },
|
|
8
|
+
ref
|
|
9
|
+
) => {
|
|
10
|
+
// Get Tailwind classes for different variants
|
|
11
|
+
const getVariantClasses = () => {
|
|
12
|
+
if (variant === "unstyled") return "";
|
|
13
|
+
|
|
14
|
+
// TODO: Add styles based on the figma design for all variants
|
|
15
|
+
return "mb-1 leading-6";
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const tailwindClasses = getVariantClasses();
|
|
19
|
+
const combinedClassName = cx(
|
|
20
|
+
tailwindClasses,
|
|
21
|
+
"list-item",
|
|
22
|
+
`list-item--${variant}`,
|
|
23
|
+
className
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<li ref={ref} className={combinedClassName} style={style} {...props}>
|
|
28
|
+
{children}
|
|
29
|
+
</li>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
|
|
34
|
+
ListItem.displayName = "ListItem";
|
|
35
|
+
|
|
36
|
+
export type { ListItemProps };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { CSSProperties, LiHTMLAttributes, ReactNode } from "react";
|
|
2
|
-
import { ListVariant } from "../types";
|
|
3
|
-
|
|
4
|
-
export interface ListItemProps extends LiHTMLAttributes<HTMLLIElement> {
|
|
5
|
-
/** Content to render inside the list item */
|
|
6
|
-
children: ReactNode;
|
|
7
|
-
/** Custom className for the list item */
|
|
8
|
-
className?: string;
|
|
9
|
-
/** Additional styling options */
|
|
10
|
-
variant?: ListVariant;
|
|
11
|
-
/** Custom styles */
|
|
12
|
-
style?: CSSProperties;
|
|
13
|
-
}
|
|
1
|
+
import { CSSProperties, LiHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import { ListVariant } from "../types";
|
|
3
|
+
|
|
4
|
+
export interface ListItemProps extends LiHTMLAttributes<HTMLLIElement> {
|
|
5
|
+
/** Content to render inside the list item */
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** Custom className for the list item */
|
|
8
|
+
className?: string;
|
|
9
|
+
/** Additional styling options */
|
|
10
|
+
variant?: ListVariant;
|
|
11
|
+
/** Custom styles */
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import { CSSProperties, HTMLAttributes, ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
export type ListType = "ul" | "ol";
|
|
4
|
-
export type ListVariant = "default" | "unstyled";
|
|
5
|
-
|
|
6
|
-
export type ListItem = {
|
|
7
|
-
id: string | number;
|
|
8
|
-
content: ReactNode;
|
|
9
|
-
className?: string;
|
|
10
|
-
[key: string]: any;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export interface ListProps
|
|
14
|
-
extends Omit<HTMLAttributes<HTMLUListElement | HTMLOListElement>, "type"> {
|
|
15
|
-
/** List type - unordered (ul) or ordered (ol) */
|
|
16
|
-
type?: ListType;
|
|
17
|
-
/** Array of items to render */
|
|
18
|
-
items?: ListItem[];
|
|
19
|
-
/** Custom className for the list */
|
|
20
|
-
className?: string;
|
|
21
|
-
/** Custom item renderer function */
|
|
22
|
-
renderItem?: (item: ListItem, index: number) => ReactNode;
|
|
23
|
-
/** Children to render instead of items */
|
|
24
|
-
children?: ReactNode;
|
|
25
|
-
/** Additional styling options */
|
|
26
|
-
variant?: ListVariant;
|
|
27
|
-
/** Custom styles */
|
|
28
|
-
style?: CSSProperties;
|
|
29
|
-
}
|
|
1
|
+
import { CSSProperties, HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
|
|
3
|
+
export type ListType = "ul" | "ol";
|
|
4
|
+
export type ListVariant = "default" | "unstyled";
|
|
5
|
+
|
|
6
|
+
export type ListItem = {
|
|
7
|
+
id: string | number;
|
|
8
|
+
content: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export interface ListProps
|
|
14
|
+
extends Omit<HTMLAttributes<HTMLUListElement | HTMLOListElement>, "type"> {
|
|
15
|
+
/** List type - unordered (ul) or ordered (ol) */
|
|
16
|
+
type?: ListType;
|
|
17
|
+
/** Array of items to render */
|
|
18
|
+
items?: ListItem[];
|
|
19
|
+
/** Custom className for the list */
|
|
20
|
+
className?: string;
|
|
21
|
+
/** Custom item renderer function */
|
|
22
|
+
renderItem?: (item: ListItem, index: number) => ReactNode;
|
|
23
|
+
/** Children to render instead of items */
|
|
24
|
+
children?: ReactNode;
|
|
25
|
+
/** Additional styling options */
|
|
26
|
+
variant?: ListVariant;
|
|
27
|
+
/** Custom styles */
|
|
28
|
+
style?: CSSProperties;
|
|
29
|
+
}
|
|
@@ -1,44 +1,44 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { cx } from "../../utils";
|
|
3
|
-
import type { IconProps } from "./types";
|
|
4
|
-
|
|
5
|
-
const MaterialIcon: React.FC<IconProps> = ({
|
|
6
|
-
name,
|
|
7
|
-
fill = 0,
|
|
8
|
-
opticalSize = "48dp",
|
|
9
|
-
weight = "200",
|
|
10
|
-
emphasis = 145,
|
|
11
|
-
size = 24,
|
|
12
|
-
color = "currentColor",
|
|
13
|
-
style = {},
|
|
14
|
-
className,
|
|
15
|
-
onClick,
|
|
16
|
-
dataTestId,
|
|
17
|
-
}) => {
|
|
18
|
-
const fontVariationSettings = `'FILL' ${fill}, 'wght' ${weight}, 'GRAD' ${emphasis}, 'opsz' ${opticalSize.substring(0, 2)}`;
|
|
19
|
-
|
|
20
|
-
const combinedStyle: React.CSSProperties = {
|
|
21
|
-
fontVariationSettings,
|
|
22
|
-
fontSize: `${size}px`,
|
|
23
|
-
fontFamily: "'Material Symbols Rounded'",
|
|
24
|
-
color: color || "currentColor",
|
|
25
|
-
...style,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<span
|
|
30
|
-
style={combinedStyle}
|
|
31
|
-
className={cx("material-symbols-rounded", className)}
|
|
32
|
-
onClick={onClick}
|
|
33
|
-
data-testid={dataTestId}
|
|
34
|
-
>
|
|
35
|
-
{name}
|
|
36
|
-
</span>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export { MaterialIcon };
|
|
41
|
-
|
|
42
|
-
MaterialIcon.displayName = "MaterialIcon";
|
|
43
|
-
|
|
44
|
-
export type { IconProps, IconName } from "./types";
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { cx } from "../../utils";
|
|
3
|
+
import type { IconProps } from "./types";
|
|
4
|
+
|
|
5
|
+
const MaterialIcon: React.FC<IconProps> = ({
|
|
6
|
+
name,
|
|
7
|
+
fill = 0,
|
|
8
|
+
opticalSize = "48dp",
|
|
9
|
+
weight = "200",
|
|
10
|
+
emphasis = 145,
|
|
11
|
+
size = 24,
|
|
12
|
+
color = "currentColor",
|
|
13
|
+
style = {},
|
|
14
|
+
className,
|
|
15
|
+
onClick,
|
|
16
|
+
dataTestId,
|
|
17
|
+
}) => {
|
|
18
|
+
const fontVariationSettings = `'FILL' ${fill}, 'wght' ${weight}, 'GRAD' ${emphasis}, 'opsz' ${opticalSize.substring(0, 2)}`;
|
|
19
|
+
|
|
20
|
+
const combinedStyle: React.CSSProperties = {
|
|
21
|
+
fontVariationSettings,
|
|
22
|
+
fontSize: `${size}px`,
|
|
23
|
+
fontFamily: "'Material Symbols Rounded'",
|
|
24
|
+
color: color || "currentColor",
|
|
25
|
+
...style,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<span
|
|
30
|
+
style={combinedStyle}
|
|
31
|
+
className={cx("material-symbols-rounded", className)}
|
|
32
|
+
onClick={onClick}
|
|
33
|
+
data-testid={dataTestId}
|
|
34
|
+
>
|
|
35
|
+
{name}
|
|
36
|
+
</span>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { MaterialIcon };
|
|
41
|
+
|
|
42
|
+
MaterialIcon.displayName = "MaterialIcon";
|
|
43
|
+
|
|
44
|
+
export type { IconProps, IconName } from "./types";
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import type { CSSProperties } from "react";
|
|
2
|
-
import {
|
|
3
|
-
emphasis,
|
|
4
|
-
iconNameList,
|
|
5
|
-
OpticalSizes,
|
|
6
|
-
sizes,
|
|
7
|
-
weights,
|
|
8
|
-
} from "./constants";
|
|
9
|
-
|
|
10
|
-
export type Fill = 1 | 0;
|
|
11
|
-
|
|
12
|
-
export type IconName = (typeof iconNameList)[number];
|
|
13
|
-
|
|
14
|
-
export type OpticalSize = (typeof OpticalSizes)[number];
|
|
15
|
-
export type Weight = (typeof weights)[number];
|
|
16
|
-
export type Emphasis = (typeof emphasis)[number];
|
|
17
|
-
export type Size = (typeof sizes)[number];
|
|
18
|
-
|
|
19
|
-
export type IconProps = {
|
|
20
|
-
name: IconName;
|
|
21
|
-
fill?: Fill;
|
|
22
|
-
opticalSize?: OpticalSize;
|
|
23
|
-
weight?: Weight;
|
|
24
|
-
emphasis?: Emphasis;
|
|
25
|
-
size?: Size;
|
|
26
|
-
color?: string;
|
|
27
|
-
style?: CSSProperties;
|
|
28
|
-
className?: string;
|
|
29
|
-
onClick?: () => void;
|
|
30
|
-
dataTestId?: string;
|
|
31
|
-
};
|
|
1
|
+
import type { CSSProperties } from "react";
|
|
2
|
+
import {
|
|
3
|
+
emphasis,
|
|
4
|
+
iconNameList,
|
|
5
|
+
OpticalSizes,
|
|
6
|
+
sizes,
|
|
7
|
+
weights,
|
|
8
|
+
} from "./constants";
|
|
9
|
+
|
|
10
|
+
export type Fill = 1 | 0;
|
|
11
|
+
|
|
12
|
+
export type IconName = (typeof iconNameList)[number];
|
|
13
|
+
|
|
14
|
+
export type OpticalSize = (typeof OpticalSizes)[number];
|
|
15
|
+
export type Weight = (typeof weights)[number];
|
|
16
|
+
export type Emphasis = (typeof emphasis)[number];
|
|
17
|
+
export type Size = (typeof sizes)[number];
|
|
18
|
+
|
|
19
|
+
export type IconProps = {
|
|
20
|
+
name: IconName;
|
|
21
|
+
fill?: Fill;
|
|
22
|
+
opticalSize?: OpticalSize;
|
|
23
|
+
weight?: Weight;
|
|
24
|
+
emphasis?: Emphasis;
|
|
25
|
+
size?: Size;
|
|
26
|
+
color?: string;
|
|
27
|
+
style?: CSSProperties;
|
|
28
|
+
className?: string;
|
|
29
|
+
onClick?: () => void;
|
|
30
|
+
dataTestId?: string;
|
|
31
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Modal } from "./index";
|
|
2
|
-
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
3
2
|
|
|
3
|
+
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
4
4
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
5
5
|
|
|
6
6
|
const meta: Meta<typeof Modal> = {
|
|
@@ -69,14 +69,14 @@ export const Default: Story = {
|
|
|
69
69
|
children: (
|
|
70
70
|
<div className="space-y-4">
|
|
71
71
|
<p className="text-gray-600">
|
|
72
|
-
This is a default modal with some content. You can close it by
|
|
73
|
-
the X button, pressing Escape, or clicking outside the modal.
|
|
72
|
+
This is a default modal with some content. You can close it by
|
|
73
|
+
clicking the X button, pressing Escape, or clicking outside the modal.
|
|
74
74
|
</p>
|
|
75
75
|
<div className="flex justify-end space-x-2">
|
|
76
76
|
<button className="px-4 py-2 text-gray-600 hover:text-gray-800">
|
|
77
77
|
Cancel
|
|
78
78
|
</button>
|
|
79
|
-
<button className="px-4 py-2
|
|
79
|
+
<button className="rounded bg-blue-600 px-4 py-2 text-white hover:bg-blue-700">
|
|
80
80
|
Confirm
|
|
81
81
|
</button>
|
|
82
82
|
</div>
|
|
@@ -107,8 +107,8 @@ export const Large: Story = {
|
|
|
107
107
|
for forms, detailed information, or complex layouts.
|
|
108
108
|
</p>
|
|
109
109
|
<div className="grid grid-cols-2 gap-4">
|
|
110
|
-
<div className="
|
|
111
|
-
<div className="
|
|
110
|
+
<div className="rounded bg-gray-100 p-4">Content 1</div>
|
|
111
|
+
<div className="rounded bg-gray-100 p-4">Content 2</div>
|
|
112
112
|
</div>
|
|
113
113
|
</div>
|
|
114
114
|
),
|
|
@@ -127,13 +127,13 @@ export const BottomSheet: Story = {
|
|
|
127
127
|
This modal slides up from the bottom, perfect for mobile interfaces.
|
|
128
128
|
</p>
|
|
129
129
|
<div className="space-y-2">
|
|
130
|
-
<button className="w-full p-3 text-left hover:bg-gray-100
|
|
130
|
+
<button className="w-full rounded p-3 text-left hover:bg-gray-100">
|
|
131
131
|
Option 1
|
|
132
132
|
</button>
|
|
133
|
-
<button className="w-full p-3 text-left hover:bg-gray-100
|
|
133
|
+
<button className="w-full rounded p-3 text-left hover:bg-gray-100">
|
|
134
134
|
Option 2
|
|
135
135
|
</button>
|
|
136
|
-
<button className="w-full p-3 text-left hover:bg-gray-100
|
|
136
|
+
<button className="w-full rounded p-3 text-left hover:bg-gray-100">
|
|
137
137
|
Option 3
|
|
138
138
|
</button>
|
|
139
139
|
</div>
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useState } from "react";
|
|
2
|
-
import ReactModal from "react-modal";
|
|
3
|
-
import { Transition } from "react-transition-group";
|
|
4
|
-
|
|
5
|
-
import { MaterialIcon } from "../material-icon";
|
|
6
|
-
import { cx } from "../../utils";
|
|
7
2
|
import useBodyScrollLock from "../../hooks/use-body-scroll-lock";
|
|
8
|
-
|
|
9
|
-
import { ModalProps, Size, Shape, Animation } from "./types";
|
|
3
|
+
import { cx } from "../../utils";
|
|
10
4
|
import { Button } from "../button";
|
|
5
|
+
import { MaterialIcon } from "../material-icon";
|
|
6
|
+
import { Animation, ModalProps, Shape, Size } from "./types";
|
|
7
|
+
import ReactModal from "react-modal";
|
|
8
|
+
import { Transition } from "react-transition-group";
|
|
11
9
|
|
|
12
10
|
const Modal: React.FC<ModalProps> = ({
|
|
13
11
|
size = "md",
|
|
@@ -102,7 +100,7 @@ const Modal: React.FC<ModalProps> = ({
|
|
|
102
100
|
closeTimeoutMS={0}
|
|
103
101
|
parentSelector={() => parent}
|
|
104
102
|
className={cx(
|
|
105
|
-
"absolute
|
|
103
|
+
"absolute min-w-[150px] max-w-[calc(100vw-30px)] overflow-auto rounded-lg bg-white outline-none",
|
|
106
104
|
getSizeClasses(size),
|
|
107
105
|
shape === "rounded" && "rounded-3xl",
|
|
108
106
|
centered && "top-0 translate-y-[calc(50vh-50%)]",
|
|
@@ -129,10 +127,7 @@ const Modal: React.FC<ModalProps> = ({
|
|
|
129
127
|
data-track-click-text="Close Modal"
|
|
130
128
|
data-track-element-clicked="modal"
|
|
131
129
|
>
|
|
132
|
-
<MaterialIcon
|
|
133
|
-
name="close"
|
|
134
|
-
size={24}
|
|
135
|
-
/>
|
|
130
|
+
<MaterialIcon name="close" size={24} />
|
|
136
131
|
</Button>
|
|
137
132
|
</div>
|
|
138
133
|
)}
|
|
@@ -140,7 +135,7 @@ const Modal: React.FC<ModalProps> = ({
|
|
|
140
135
|
{title ? (
|
|
141
136
|
<div
|
|
142
137
|
className={cx(
|
|
143
|
-
"
|
|
138
|
+
"border-b border-border-secondary-on-bg-fill px-[7px] py-[7px] text-text"
|
|
144
139
|
)}
|
|
145
140
|
>
|
|
146
141
|
{title}
|
|
@@ -165,4 +160,3 @@ export { Modal };
|
|
|
165
160
|
Modal.displayName = "Modal";
|
|
166
161
|
|
|
167
162
|
export type { ModalProps, Size, Shape, Animation };
|
|
168
|
-
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
1
2
|
import { RadioButton } from "./index";
|
|
2
|
-
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
3
3
|
|
|
4
|
+
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
4
5
|
import type { Meta, StoryObj } from "@storybook/react";
|
|
5
|
-
import { useState } from "react";
|
|
6
6
|
|
|
7
7
|
const meta: Meta<typeof RadioButton> = {
|
|
8
8
|
title: "Components/RadioButton",
|
|
@@ -177,7 +177,7 @@ export const GroupWithError: Story = {
|
|
|
177
177
|
name="payment"
|
|
178
178
|
value="credit"
|
|
179
179
|
checked={selected === "credit"}
|
|
180
|
-
onChange={
|
|
180
|
+
onChange={val =>
|
|
181
181
|
setSelected(
|
|
182
182
|
typeof val === "string" || typeof val === "number"
|
|
183
183
|
? String(val)
|
|
@@ -191,7 +191,7 @@ export const GroupWithError: Story = {
|
|
|
191
191
|
name="payment"
|
|
192
192
|
value="debit"
|
|
193
193
|
checked={selected === "debit"}
|
|
194
|
-
onChange={
|
|
194
|
+
onChange={val =>
|
|
195
195
|
setSelected(
|
|
196
196
|
typeof val === "string" || typeof val === "number"
|
|
197
197
|
? String(val)
|
|
@@ -205,7 +205,7 @@ export const GroupWithError: Story = {
|
|
|
205
205
|
name="payment"
|
|
206
206
|
value="paypal"
|
|
207
207
|
checked={selected === "paypal"}
|
|
208
|
-
onChange={
|
|
208
|
+
onChange={val =>
|
|
209
209
|
setSelected(
|
|
210
210
|
typeof val === "string" || typeof val === "number"
|
|
211
211
|
? String(val)
|
|
@@ -224,7 +224,8 @@ export const GroupWithError: Story = {
|
|
|
224
224
|
parameters: {
|
|
225
225
|
docs: {
|
|
226
226
|
description: {
|
|
227
|
-
story:
|
|
227
|
+
story:
|
|
228
|
+
"Radio button group with error state when no option is selected.",
|
|
228
229
|
},
|
|
229
230
|
},
|
|
230
231
|
},
|
|
@@ -304,4 +305,3 @@ export const AllVariants: Story = {
|
|
|
304
305
|
},
|
|
305
306
|
},
|
|
306
307
|
};
|
|
307
|
-
|