@tapcart/mobile-components 0.6.2 → 0.6.4
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/hooks/use-collection.js +1 -1
- package/dist/components/hooks/use-products.d.ts +1 -0
- package/dist/components/hooks/use-products.d.ts.map +1 -1
- package/dist/components/hooks/use-products.js +10 -3
- package/dist/components/ui/accordion.d.ts +3 -1
- package/dist/components/ui/accordion.d.ts.map +1 -1
- package/dist/components/ui/accordion.js +2 -2
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/chip.d.ts +2 -2
- package/dist/components/ui/favorite.d.ts +1 -0
- package/dist/components/ui/favorite.d.ts.map +1 -1
- package/dist/components/ui/favorite.js +2 -2
- package/dist/components/ui/text.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/lib/utils.d.ts +91 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +76 -1
- package/dist/styles.css +6 -3
- package/package.json +1 -1
|
@@ -29,7 +29,7 @@ export const useCollection = ({ apiUrl, appId, collectionId, collectionHandle, l
|
|
|
29
29
|
const collectionBy = collectionHandle ? "by-handle" : "by-id";
|
|
30
30
|
specificCollectionUrl = `${apiUrl}/collections/${collectionBy}?${params}`;
|
|
31
31
|
}
|
|
32
|
-
const fetchAllCollections = allCollectionsUrl
|
|
32
|
+
const fetchAllCollections = getCollections && allCollectionsUrl
|
|
33
33
|
? fetch(allCollectionsUrl, {
|
|
34
34
|
method: "GET",
|
|
35
35
|
headers: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-products.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-products.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,KAAK,GAAG,GAAG,MAAM,CAAA;AACjB,KAAK,gBAAgB,GAAG;IACtB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,OAAO,EAAE,GAAG,CAAA;IACZ,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;CACxC,CAAA;AACD,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,iBAAiB,
|
|
1
|
+
{"version":3,"file":"use-products.d.ts","sourceRoot":"","sources":["../../../components/hooks/use-products.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAA;AAE1C,KAAK,GAAG,GAAG,MAAM,CAAA;AACjB,KAAK,gBAAgB,GAAG;IACtB,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,OAAO,EAAE,GAAG,CAAA;IACZ,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;CACxC,CAAA;AACD,KAAK,iBAAiB,GAAG;IACvB,QAAQ,EAAE,OAAO,EAAE,CAAA;IACnB,KAAK,EAAE,GAAG,CAAA;IACV,SAAS,EAAE,OAAO,CAAA;CACnB,CAAA;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,GAAG,iBAAiB,CAqB7E"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import useSWR from "swr";
|
|
2
2
|
export function useProducts(props) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
let url = null;
|
|
4
|
+
if (props) {
|
|
5
|
+
const { baseURL, productIds, productHandles } = props;
|
|
6
|
+
if ((productIds === null || productIds === void 0 ? void 0 : productIds.length) > 0) {
|
|
7
|
+
url = `${baseURL}/products/by-ids?ids=${productIds.join(",")}`;
|
|
8
|
+
}
|
|
9
|
+
else if ((productHandles === null || productHandles === void 0 ? void 0 : productHandles.length) > 0) {
|
|
10
|
+
url = `${baseURL}/products/by-ids?handles=${productHandles.join(",")}`;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
6
13
|
const fetcher = (props === null || props === void 0 ? void 0 : props.fetcher) || ((url) => fetch(url).then((res) => res.json()));
|
|
7
14
|
const { data, error } = useSWR(url, fetcher);
|
|
8
15
|
return {
|
|
@@ -2,7 +2,9 @@ import * as React from "react";
|
|
|
2
2
|
import * as AccordionPrimitive from "@radix-ui/react-accordion";
|
|
3
3
|
declare const Accordion: React.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & React.RefAttributes<HTMLDivElement>>;
|
|
4
4
|
declare const AccordionItem: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
-
declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> &
|
|
5
|
+
declare const AccordionTrigger: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
|
|
6
|
+
showDefaultIcon?: boolean | undefined;
|
|
7
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
6
8
|
declare const AccordionContent: React.ForwardRefExoticComponent<Omit<AccordionPrimitive.AccordionContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
9
|
export { Accordion, AccordionItem, AccordionTrigger, AccordionContent };
|
|
8
10
|
//# sourceMappingURL=accordion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../components/ui/accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAA;AAK/D,QAAA,MAAM,SAAS,8JAA0B,CAAA;AAEzC,QAAA,MAAM,aAAa,iKASjB,CAAA;AAGF,QAAA,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"accordion.d.ts","sourceRoot":"","sources":["../../../components/ui/accordion.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,kBAAkB,MAAM,2BAA2B,CAAA;AAK/D,QAAA,MAAM,SAAS,8JAA0B,CAAA;AAEzC,QAAA,MAAM,aAAa,iKASjB,CAAA;AAGF,QAAA,MAAM,gBAAgB;;2CA2BpB,CAAA;AAGF,QAAA,MAAM,gBAAgB,oKAWpB,CAAA;AAIF,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -22,8 +22,8 @@ const AccordionItem = React.forwardRef((_a, ref) => {
|
|
|
22
22
|
});
|
|
23
23
|
AccordionItem.displayName = "AccordionItem";
|
|
24
24
|
const AccordionTrigger = React.forwardRef((_a, ref) => {
|
|
25
|
-
var { className, children } = _a, props = __rest(_a, ["className", "children"]);
|
|
26
|
-
return (_jsx(AccordionPrimitive.Header, Object.assign({ className: "flex" }, { children: _jsxs(AccordionPrimitive.Trigger, Object.assign({ ref: ref, className: cn("px-4 flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]_svg]:rotate-180 active:opacity-70", className) }, props, { children: [children, _jsx(Icon, { name: "chevron-down", size: "sm", className: "text-coreColors-secondaryIcon shrink-0 transition-transform duration-200
|
|
25
|
+
var { className, children, showDefaultIcon = true } = _a, props = __rest(_a, ["className", "children", "showDefaultIcon"]);
|
|
26
|
+
return (_jsx(AccordionPrimitive.Header, Object.assign({ className: "flex" }, { children: _jsxs(AccordionPrimitive.Trigger, Object.assign({ ref: ref, className: cn("px-4 flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]_svg]:rotate-180 active:opacity-70", className) }, props, { children: [children, showDefaultIcon && (_jsx(Icon, { name: "chevron-down", size: "sm", className: "text-coreColors-secondaryIcon shrink-0 transition-transform duration-200" }))] })) })));
|
|
27
27
|
});
|
|
28
28
|
AccordionTrigger.displayName = AccordionPrimitive.Trigger.displayName;
|
|
29
29
|
const AccordionContent = React.forwardRef((_a, ref) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { type VariantProps } from "class-variance-authority";
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
alignment?: "
|
|
4
|
+
alignment?: "center" | "end" | "start" | null | undefined;
|
|
5
5
|
cornerRadius?: "circle" | "square" | "rounded" | null | undefined;
|
|
6
6
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
7
7
|
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
@@ -3,7 +3,7 @@ import React from "react";
|
|
|
3
3
|
declare const chipVariants: (props?: ({
|
|
4
4
|
variant?: "secondary" | "primary" | null | undefined;
|
|
5
5
|
direction?: "horizontal" | "vertical" | null | undefined;
|
|
6
|
-
iconPosition?: "
|
|
6
|
+
iconPosition?: "left" | "right" | "default" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
8
8
|
type ChipProps = React.ComponentPropsWithoutRef<"div"> & VariantProps<typeof chipVariants> & {
|
|
9
9
|
icon?: React.ElementType;
|
|
@@ -14,7 +14,7 @@ type ChipProps = React.ComponentPropsWithoutRef<"div"> & VariantProps<typeof chi
|
|
|
14
14
|
declare const Chip: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & VariantProps<(props?: ({
|
|
15
15
|
variant?: "secondary" | "primary" | null | undefined;
|
|
16
16
|
direction?: "horizontal" | "vertical" | null | undefined;
|
|
17
|
-
iconPosition?: "
|
|
17
|
+
iconPosition?: "left" | "right" | "default" | null | undefined;
|
|
18
18
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string> & {
|
|
19
19
|
icon?: React.ElementType<any> | undefined;
|
|
20
20
|
iconPosition?: "left" | "right" | undefined;
|
|
@@ -12,6 +12,7 @@ export interface FavoriteProps extends React.ButtonHTMLAttributes<HTMLButtonElem
|
|
|
12
12
|
showBackground?: boolean;
|
|
13
13
|
cornerRadius?: number;
|
|
14
14
|
layoutType?: "below-image-on-right" | "top-right" | "top-left" | "bottom-left" | "bottom-right";
|
|
15
|
+
favoriteFillColor?: string;
|
|
15
16
|
}
|
|
16
17
|
declare const Favorite: React.ForwardRefExoticComponent<FavoriteProps & React.RefAttributes<HTMLButtonElement>>;
|
|
17
18
|
export { Favorite, favoriteVariants };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../components/ui/favorite.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE,QAAA,MAAM,gBAAgB;;;;mFA0BrB,CAAA;AAED,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,gBAAgB,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EACP,sBAAsB,GACtB,WAAW,GACX,UAAU,GACV,aAAa,GACb,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"favorite.d.ts","sourceRoot":"","sources":["../../../components/ui/favorite.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAKjE,QAAA,MAAM,gBAAgB;;;;mFA0BrB,CAAA;AAED,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EACnD,YAAY,CAAC,OAAO,gBAAgB,CAAC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EACP,sBAAsB,GACtB,WAAW,GACX,UAAU,GACV,aAAa,GACb,cAAc,CAAA;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,QAAA,MAAM,QAAQ,yFA0Cb,CAAA;AAGD,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA"}
|
|
@@ -39,14 +39,14 @@ const favoriteVariants = cva("flex p-2 gap-2 rounded-[4px] shadow-buttonColors-p
|
|
|
39
39
|
},
|
|
40
40
|
});
|
|
41
41
|
const Favorite = React.forwardRef((_a, ref) => {
|
|
42
|
-
var { className, size = "small", selected = false, onClick, iconUrl = "", showBackground = false, cornerRadius = 4, layoutType = "below-image-on-right" } = _a, props = __rest(_a, ["className", "size", "selected", "onClick", "iconUrl", "showBackground", "cornerRadius", "layoutType"]);
|
|
42
|
+
var { className, size = "small", selected = false, onClick, iconUrl = "https://storage.googleapis.com/tapcart-asset-uploads-prod/default-icon-options/Heart_1.svg", showBackground = false, cornerRadius = 4, layoutType = "below-image-on-right", favoriteFillColor = "#D91E18FF" } = _a, props = __rest(_a, ["className", "size", "selected", "onClick", "iconUrl", "showBackground", "cornerRadius", "layoutType", "favoriteFillColor"]);
|
|
43
43
|
return (_jsx("button", Object.assign({ onClick: onClick, ref: ref, className: cn(favoriteVariants({
|
|
44
44
|
size,
|
|
45
45
|
showBackground,
|
|
46
46
|
layoutType,
|
|
47
47
|
}), className), style: {
|
|
48
48
|
borderRadius: `${cornerRadius}px`,
|
|
49
|
-
} }, props, { children: _jsx(Icon, { url: iconUrl, color: selected ? "stateColors-favorites" : "stateColors-disabled", size: size === "small" ? "xs" : "sm" }) })));
|
|
49
|
+
} }, props, { children: _jsx(Icon, { url: iconUrl, color: selected ? "stateColors-favorites" : "stateColors-disabled", size: size === "small" ? "xs" : "sm", fillColor: favoriteFillColor }) })));
|
|
50
50
|
});
|
|
51
51
|
Favorite.displayName = "Favorite";
|
|
52
52
|
export { Favorite, favoriteVariants };
|
|
@@ -16,7 +16,7 @@ const textVariants = cva("", {
|
|
|
16
16
|
variants: {
|
|
17
17
|
type: {
|
|
18
18
|
h1: "text-[23px] font-fontRegular leading-[130%] font-normal text-textColors-primaryColor",
|
|
19
|
-
h2: "text-lg font-
|
|
19
|
+
h2: "text-lg font-fontRegular leading-[130%] font-medium text-textColors-primaryColor",
|
|
20
20
|
"body-primary": "text-[14px] font-fontRegular leading-[160%] font-normal text-textColors-primaryColor",
|
|
21
21
|
"body-secondary": "text-[12px] font-fontRegular leading-[130%] font-normal text-textColors-secondaryColor",
|
|
22
22
|
label: "text-[10px] font-fontRegular leading-[130%] font-normal text-textColors-secondaryColor",
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { cn, cva, getColor } from "./lib/utils";
|
|
1
|
+
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, } from "./lib/utils";
|
|
2
2
|
export * from "./components/hooks/use-collection";
|
|
3
3
|
export * from "./components/hooks/use-infinite-scroll";
|
|
4
4
|
export * from "./components/hooks/use-recommendations";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,EAAE,EACF,GAAG,EACH,QAAQ,EACR,4BAA4B,EAC5B,mBAAmB,EACnB,YAAY,EACZ,yBAAyB,EACzB,4BAA4B,GAC7B,MAAM,aAAa,CAAA;AACpB,cAAc,mCAAmC,CAAA;AACjD,cAAc,wCAAwC,CAAA;AACtD,cAAc,wCAAwC,CAAA;AACtD,cAAc,iCAAiC,CAAA;AAC/C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,yCAAyC,CAAA;AACvD,cAAc,2BAA2B,CAAA;AACzC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,wBAAwB,CAAA;AACtC,cAAc,0BAA0B,CAAA;AACxC,cAAc,+BAA+B,CAAA;AAC7C,cAAc,0BAA0B,CAAA;AACxC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA;AACrC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,uBAAuB,CAAA;AACrC,cAAc,sCAAsC,CAAA;AACpD,cAAc,uBAAuB,CAAA;AACrC,cAAc,uBAAuB,CAAA;AACrC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,iCAAiC,CAAA;AAC/C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,6BAA6B,CAAA;AAC3C,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wBAAwB,CAAA;AACtC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,sBAAsB,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,0BAA0B,CAAA;AACxC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yBAAyB,CAAA;AACvC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,wBAAwB,CAAA;AACtC,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,0BAA0B,CAAA;AACxC,cAAc,wCAAwC,CAAA;AACtD,cAAc,iCAAiC,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// component exports
|
|
2
|
-
export { cn, cva, getColor } from "./lib/utils";
|
|
2
|
+
export { cn, cva, getColor, getBackgroundAndPaddingStyle, getBorderSidesStyle, getTextStyle, getVerticalAlignmentStyle, getBackgroundAndSpacingStyle, } from "./lib/utils";
|
|
3
3
|
export * from "./components/hooks/use-collection";
|
|
4
4
|
export * from "./components/hooks/use-infinite-scroll";
|
|
5
5
|
export * from "./components/hooks/use-recommendations";
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -8,4 +8,95 @@ export declare const iconColorLevels: string[];
|
|
|
8
8
|
export declare const iconColorVariantClasses: Record<string, string>;
|
|
9
9
|
export { cva } from "class-variance-authority";
|
|
10
10
|
export declare const getColor: (colorOption: Color | undefined) => string | undefined;
|
|
11
|
+
type BorderSide = "all" | "top" | "bottom" | "left" | "right";
|
|
12
|
+
type BorderSides = BorderSide[];
|
|
13
|
+
export declare const getBorderSidesStyle: (borderSides: BorderSides) => {
|
|
14
|
+
borderWidth: string;
|
|
15
|
+
borderTopWidth?: undefined;
|
|
16
|
+
borderBottomWidth?: undefined;
|
|
17
|
+
borderLeftWidth?: undefined;
|
|
18
|
+
borderRightWidth?: undefined;
|
|
19
|
+
} | {
|
|
20
|
+
borderTopWidth: string | number;
|
|
21
|
+
borderBottomWidth: string | number;
|
|
22
|
+
borderLeftWidth: string | number;
|
|
23
|
+
borderRightWidth: string | number;
|
|
24
|
+
borderWidth?: undefined;
|
|
25
|
+
};
|
|
26
|
+
type VerticalAlignment = "top" | "middle" | "bottom";
|
|
27
|
+
type Spacing = {
|
|
28
|
+
top: number;
|
|
29
|
+
bottom: number;
|
|
30
|
+
left: number;
|
|
31
|
+
right: number;
|
|
32
|
+
};
|
|
33
|
+
interface AlignmentAndSpacing {
|
|
34
|
+
alignment: VerticalAlignment;
|
|
35
|
+
spacing: Spacing;
|
|
36
|
+
}
|
|
37
|
+
export declare const getVerticalAlignmentStyle: (alignmentAndSpacing: AlignmentAndSpacing) => {
|
|
38
|
+
bottom: string;
|
|
39
|
+
top: string;
|
|
40
|
+
transform?: undefined;
|
|
41
|
+
} | {
|
|
42
|
+
top: string;
|
|
43
|
+
transform: string;
|
|
44
|
+
bottom?: undefined;
|
|
45
|
+
} | {
|
|
46
|
+
bottom?: undefined;
|
|
47
|
+
top?: undefined;
|
|
48
|
+
transform?: undefined;
|
|
49
|
+
};
|
|
50
|
+
type BackgroundAndPadding = {
|
|
51
|
+
backgroundColor?: Color;
|
|
52
|
+
borderSides?: BorderSides;
|
|
53
|
+
borderColor?: Color;
|
|
54
|
+
cornerRadius?: number;
|
|
55
|
+
padding?: Partial<Spacing>;
|
|
56
|
+
};
|
|
57
|
+
export declare const getBackgroundAndPaddingStyle: (backgroundAndPadding: BackgroundAndPadding) => {
|
|
58
|
+
backgroundColor: string | undefined;
|
|
59
|
+
borderColor: string | undefined;
|
|
60
|
+
borderTopWidth: string | undefined;
|
|
61
|
+
borderBottomWidth: string | undefined;
|
|
62
|
+
borderLeftWidth: string | undefined;
|
|
63
|
+
borderRightWidth: string | undefined;
|
|
64
|
+
paddingTop: string | undefined;
|
|
65
|
+
paddingBottom: string | undefined;
|
|
66
|
+
paddingLeft: string | undefined;
|
|
67
|
+
paddingRight: string | undefined;
|
|
68
|
+
borderStyle: string | undefined;
|
|
69
|
+
borderRadius: string | undefined;
|
|
70
|
+
};
|
|
71
|
+
type BackgroundAndSpacing = AlignmentAndSpacing & {
|
|
72
|
+
backgroundColor?: Color;
|
|
73
|
+
borderColor?: Color;
|
|
74
|
+
backgroundCorners?: number;
|
|
75
|
+
};
|
|
76
|
+
export declare const getBackgroundAndSpacingStyle: (backgroundAndSpacing: BackgroundAndSpacing) => {
|
|
77
|
+
padding: string;
|
|
78
|
+
borderColor: string;
|
|
79
|
+
backgroundColor: string;
|
|
80
|
+
borderRadius: string;
|
|
81
|
+
};
|
|
82
|
+
type TextStyle = {
|
|
83
|
+
font: {
|
|
84
|
+
family: string;
|
|
85
|
+
weight: number | string;
|
|
86
|
+
};
|
|
87
|
+
size: number | string;
|
|
88
|
+
color: Color;
|
|
89
|
+
uppercase: boolean;
|
|
90
|
+
textAlignment: "left" | "center" | "right" | "justify";
|
|
91
|
+
};
|
|
92
|
+
type Headline = TextStyle;
|
|
93
|
+
type Subtext = TextStyle;
|
|
94
|
+
export declare const getTextStyle: (textStyle: Headline | Subtext) => {
|
|
95
|
+
fontFamily: string | undefined;
|
|
96
|
+
fontWeight: string | number | undefined;
|
|
97
|
+
fontSize: string | number;
|
|
98
|
+
color: string | undefined;
|
|
99
|
+
textTransform: string;
|
|
100
|
+
textAlign: "left" | "right" | "center" | "justify";
|
|
101
|
+
};
|
|
11
102
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAA;AAGvC,MAAM,MAAM,KAAK,GAAG;IAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,MAAM,CAAA;AAGvC,MAAM,MAAM,KAAK,GAAG;IAAE,IAAI,EAAE,QAAQ,GAAG,WAAW,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnE,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,eAAO,MAAM,eAAe,UAc3B,CAAA;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,CAAA;AAMjE,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAI9C,eAAO,MAAM,QAAQ,gBAAiB,KAAK,GAAG,SAAS,uBAMtD,CAAA;AAED,KAAK,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,CAAA;AAC7D,KAAK,WAAW,GAAG,UAAU,EAAE,CAAA;AAE/B,eAAO,MAAM,mBAAmB;;;;;;;;;;;;CAU/B,CAAA;AAED,KAAK,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAA;AAEpD,KAAK,OAAO,GAAG;IACb,GAAG,EAAE,MAAM,CAAA;IACX,MAAM,EAAE,MAAM,CAAA;IACd,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,UAAU,mBAAmB;IAC3B,SAAS,EAAE,iBAAiB,CAAA;IAC5B,OAAO,EAAE,OAAO,CAAA;CACjB;AAED,eAAO,MAAM,yBAAyB,wBACf,mBAAmB;;;;;;;;;;;;CAczC,CAAA;AAED,KAAK,oBAAoB,GAAG;IAC1B,eAAe,CAAC,EAAE,KAAK,CAAA;IACvB,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,4BAA4B,yBACjB,oBAAoB;;;;;;;;;;;;;CAgC3C,CAAA;AAED,KAAK,oBAAoB,GAAG,mBAAmB,GAAG;IAChD,eAAe,CAAC,EAAE,KAAK,CAAA;IACvB,WAAW,CAAC,EAAE,KAAK,CAAA;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED,eAAO,MAAM,4BAA4B,yBACjB,oBAAoB;;;;;CAU3C,CAAA;AAED,KAAK,SAAS,GAAG;IACf,IAAI,EAAE;QACJ,MAAM,EAAE,MAAM,CAAA;QACd,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;KACxB,CAAA;IACD,IAAI,EAAE,MAAM,GAAG,MAAM,CAAA;IACrB,KAAK,EAAE,KAAK,CAAA;IACZ,SAAS,EAAE,OAAO,CAAA;IAClB,aAAa,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAA;CACvD,CAAA;AAED,KAAK,QAAQ,GAAG,SAAS,CAAA;AACzB,KAAK,OAAO,GAAG,SAAS,CAAA;AAExB,eAAO,MAAM,YAAY,cAAe,QAAQ,GAAG,OAAO;;;;;;;CAUzD,CAAA"}
|
package/dist/lib/utils.js
CHANGED
|
@@ -23,6 +23,81 @@ for (let iconColorLevel of iconColorLevels) {
|
|
|
23
23
|
iconColorVariantClasses[iconColorLevel] = `text-${iconColorLevel}`;
|
|
24
24
|
}
|
|
25
25
|
export { cva } from "class-variance-authority";
|
|
26
|
+
// #region =-=-=-= Block Utils =-=-=-=
|
|
26
27
|
export const getColor = (colorOption) => {
|
|
27
|
-
return colorOption
|
|
28
|
+
return colorOption
|
|
29
|
+
? (colorOption === null || colorOption === void 0 ? void 0 : colorOption.type) === "brand-kit"
|
|
30
|
+
? `var(--${colorOption.value})`
|
|
31
|
+
: colorOption.value
|
|
32
|
+
: undefined;
|
|
28
33
|
};
|
|
34
|
+
export const getBorderSidesStyle = (borderSides) => {
|
|
35
|
+
const style = borderSides.includes("all")
|
|
36
|
+
? { borderWidth: "1px" }
|
|
37
|
+
: {
|
|
38
|
+
borderTopWidth: borderSides.includes("top") ? "1px" : 0,
|
|
39
|
+
borderBottomWidth: borderSides.includes("bottom") ? "1px" : 0,
|
|
40
|
+
borderLeftWidth: borderSides.includes("left") ? "1px" : 0,
|
|
41
|
+
borderRightWidth: borderSides.includes("right") ? "1px" : 0,
|
|
42
|
+
};
|
|
43
|
+
return style;
|
|
44
|
+
};
|
|
45
|
+
export const getVerticalAlignmentStyle = (alignmentAndSpacing) => {
|
|
46
|
+
const { alignment, spacing } = alignmentAndSpacing;
|
|
47
|
+
switch (alignment) {
|
|
48
|
+
case "bottom":
|
|
49
|
+
return { bottom: `${spacing.bottom}px`, top: "auto" };
|
|
50
|
+
case "middle":
|
|
51
|
+
return { top: "50%", transform: "translateY(-50%)" };
|
|
52
|
+
case "top":
|
|
53
|
+
return { top: `${spacing.top}px`, bottom: "auto" };
|
|
54
|
+
default:
|
|
55
|
+
return {};
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
export const getBackgroundAndPaddingStyle = (backgroundAndPadding) => {
|
|
59
|
+
const { backgroundColor, borderSides, borderColor, cornerRadius, padding } = backgroundAndPadding;
|
|
60
|
+
return {
|
|
61
|
+
backgroundColor: getColor(backgroundColor),
|
|
62
|
+
borderColor: getColor(borderColor),
|
|
63
|
+
borderTopWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("top")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
64
|
+
? "1px"
|
|
65
|
+
: undefined,
|
|
66
|
+
borderBottomWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("bottom")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
67
|
+
? "1px"
|
|
68
|
+
: undefined,
|
|
69
|
+
borderLeftWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("left")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
70
|
+
? "1px"
|
|
71
|
+
: undefined,
|
|
72
|
+
borderRightWidth: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("right")) || (borderSides === null || borderSides === void 0 ? void 0 : borderSides.includes("all"))
|
|
73
|
+
? "1px"
|
|
74
|
+
: undefined,
|
|
75
|
+
paddingTop: (padding === null || padding === void 0 ? void 0 : padding.top) !== undefined ? `${padding.top}px` : undefined,
|
|
76
|
+
paddingBottom: (padding === null || padding === void 0 ? void 0 : padding.bottom) !== undefined ? `${padding.bottom}px` : undefined,
|
|
77
|
+
paddingLeft: (padding === null || padding === void 0 ? void 0 : padding.left) !== undefined ? `${padding.left}px` : undefined,
|
|
78
|
+
paddingRight: (padding === null || padding === void 0 ? void 0 : padding.right) !== undefined ? `${padding.right}px` : undefined,
|
|
79
|
+
borderStyle: (borderSides === null || borderSides === void 0 ? void 0 : borderSides.length) ? "solid" : undefined,
|
|
80
|
+
borderRadius: cornerRadius !== undefined ? `${cornerRadius}px` : undefined,
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export const getBackgroundAndSpacingStyle = (backgroundAndSpacing) => {
|
|
84
|
+
const { spacing, borderColor, backgroundColor, backgroundCorners } = backgroundAndSpacing;
|
|
85
|
+
return {
|
|
86
|
+
padding: `${spacing.top}px ${spacing.right}px ${spacing.bottom}px ${spacing.left}px`,
|
|
87
|
+
borderColor: borderColor ? borderColor.value : "transparent",
|
|
88
|
+
backgroundColor: getColor(backgroundColor) || "transparent",
|
|
89
|
+
borderRadius: `${backgroundCorners !== null && backgroundCorners !== void 0 ? backgroundCorners : 0}px`,
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
export const getTextStyle = (textStyle) => {
|
|
93
|
+
const { font, size, color, uppercase, textAlignment } = textStyle;
|
|
94
|
+
return {
|
|
95
|
+
fontFamily: font.family === "initial" ? undefined : font.family,
|
|
96
|
+
fontWeight: font.weight === "initial" ? undefined : font.weight,
|
|
97
|
+
fontSize: size,
|
|
98
|
+
color: getColor(color),
|
|
99
|
+
textTransform: uppercase ? "uppercase" : "none",
|
|
100
|
+
textAlign: textAlignment,
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
// #endregion =-=-=-= END BLOCK UTILS =-=-=-=
|
package/dist/styles.css
CHANGED
|
@@ -1419,6 +1419,9 @@ video {
|
|
|
1419
1419
|
.border-t {
|
|
1420
1420
|
border-top-width: 1px;
|
|
1421
1421
|
}
|
|
1422
|
+
.border-t-\[0px\] {
|
|
1423
|
+
border-top-width: 0px;
|
|
1424
|
+
}
|
|
1422
1425
|
.border-t-\[1px\] {
|
|
1423
1426
|
border-top-width: 1px;
|
|
1424
1427
|
}
|
|
@@ -1719,9 +1722,6 @@ video {
|
|
|
1719
1722
|
.align-top {
|
|
1720
1723
|
vertical-align: top;
|
|
1721
1724
|
}
|
|
1722
|
-
.font-fontMedium {
|
|
1723
|
-
font-family: var(--fontMedium);
|
|
1724
|
-
}
|
|
1725
1725
|
.font-fontRegular {
|
|
1726
1726
|
font-family: var(--fontRegular);
|
|
1727
1727
|
}
|
|
@@ -1779,6 +1779,9 @@ video {
|
|
|
1779
1779
|
.uppercase {
|
|
1780
1780
|
text-transform: uppercase;
|
|
1781
1781
|
}
|
|
1782
|
+
.lowercase {
|
|
1783
|
+
text-transform: lowercase;
|
|
1784
|
+
}
|
|
1782
1785
|
.capitalize {
|
|
1783
1786
|
text-transform: capitalize;
|
|
1784
1787
|
}
|