@volvo-cars/ced-os-react-components
Advanced tools
Comparing version 1.0.0-alpha.0 to 1.0.0-alpha.1
224
lib/index.js
@@ -12,7 +12,7 @@ // src/utils/classNames.ts | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
}) => { | ||
return /* @__PURE__ */ jsx(Element, { | ||
className: classNames(root, className2), | ||
className: classNames(root, className4), | ||
...props, | ||
@@ -28,6 +28,6 @@ children | ||
import { jsx as jsx2 } from "react/jsx-runtime"; | ||
function Caption({ className: className2, ...props }) { | ||
function Caption({ className: className4, ...props }) { | ||
return /* @__PURE__ */ jsx2(Block, { | ||
as: "figcaption", | ||
className: classNames(root2, className2), | ||
className: classNames(root2, className4), | ||
...props | ||
@@ -61,3 +61,3 @@ }); | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
@@ -69,3 +69,3 @@ }) { | ||
href, | ||
className: classNames(root3, className2), | ||
className: classNames(root3, className4), | ||
...props, | ||
@@ -93,10 +93,13 @@ children | ||
import { Children } from "react"; | ||
var filterValidChildren = (children, validTypes, parentName) => Children.toArray(children)?.filter((child) => { | ||
const type = child.type; | ||
const isValid = validTypes.includes(type); | ||
if (isValid) { | ||
return true; | ||
} | ||
return false; | ||
}); | ||
var filterValidChildren = (children, validTypes, parentName) => { | ||
var _a; | ||
return (_a = Children.toArray(children)) == null ? void 0 : _a.filter((child) => { | ||
const type = child.type; | ||
const isValid = validTypes.includes(type); | ||
if (isValid) { | ||
return true; | ||
} | ||
return false; | ||
}); | ||
}; | ||
@@ -145,7 +148,7 @@ // src/support/atoms/Img/Img.css.ts | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
}) { | ||
return /* @__PURE__ */ jsx7("span", { | ||
className: classNames(root5, className2), | ||
className: classNames(root5, className4), | ||
...props, | ||
@@ -161,7 +164,7 @@ children | ||
import { jsx as jsx8 } from "react/jsx-runtime"; | ||
function Symbol({ src, alt = "", className: className2, ...props }) { | ||
function Symbol({ src, alt = "", className: className4, ...props }) { | ||
return /* @__PURE__ */ jsx8("img", { | ||
src, | ||
alt, | ||
className: classNames(root6, className2), | ||
className: classNames(root6, className4), | ||
...props | ||
@@ -178,3 +181,3 @@ }); | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
@@ -189,3 +192,3 @@ }) { | ||
return /* @__PURE__ */ jsx9("li", { | ||
className: classNames(root7, className2), | ||
className: classNames(root7, className4), | ||
...props, | ||
@@ -204,3 +207,3 @@ children: validChildren | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
@@ -215,3 +218,3 @@ }) { | ||
return /* @__PURE__ */ jsx10("ol", { | ||
className: classNames(root8, className2), | ||
className: classNames(root8, className4), | ||
...props, | ||
@@ -228,5 +231,5 @@ children: validChildren | ||
import { jsx as jsx11 } from "react/jsx-runtime"; | ||
function Paragraph({ className: className2, ...props }) { | ||
function Paragraph({ className: className4, ...props }) { | ||
return /* @__PURE__ */ jsx11("p", { | ||
className: classNames(root9, className2), | ||
className: classNames(root9, className4), | ||
...props | ||
@@ -241,3 +244,3 @@ }); | ||
import { jsx as jsx12 } from "react/jsx-runtime"; | ||
function Media({ children, className: className2, ...props }) { | ||
function Media({ children, className: className4, ...props }) { | ||
const childrenArr = Children4.toArray(children); | ||
@@ -250,6 +253,6 @@ const validChildren = filterValidChildren( | ||
return /* @__PURE__ */ jsx12("figure", { | ||
className: classNames(root10, className2), | ||
className: classNames(root10, className4), | ||
...props, | ||
children: validChildren.map((child, index) => { | ||
if (child?.type === Paragraph) { | ||
if ((child == null ? void 0 : child.type) === Paragraph) { | ||
return /* @__PURE__ */ jsx12(Caption, { | ||
@@ -284,7 +287,7 @@ children: child | ||
}; | ||
function Title({ level = 1, children, className: className2, ...props }) { | ||
function Title({ level = 1, children, className: className4, ...props }) { | ||
const Element = element[level]; | ||
const levelStyles = variant[level]; | ||
return /* @__PURE__ */ jsx13(Element, { | ||
className: classNames(root11, levelStyles, className2), | ||
className: classNames(root11, levelStyles, className4), | ||
...props, | ||
@@ -298,3 +301,3 @@ children | ||
const childrenArray = Children5.toArray(children); | ||
if (!childrenArray?.length) | ||
if (!(childrenArray == null ? void 0 : childrenArray.length)) | ||
return { children: childrenArray }; | ||
@@ -321,3 +324,3 @@ const firstChild = childrenArray[0]; | ||
}; | ||
var Icon = ({ type, color: color2, label, size: size2, className: className2 }) => { | ||
var Icon = ({ type, color: color2, label, size: size2, className: className4 }) => { | ||
const { icons } = useConfig(); | ||
@@ -338,3 +341,3 @@ const imageSrc = icons && typeof icons[type] === "string" ? icons[type] : defaultIcons[type]; | ||
iconSizeClassName, | ||
className2 | ||
className4 | ||
) | ||
@@ -354,11 +357,12 @@ }); | ||
variant: variant4, | ||
className: className2 | ||
className: className4 | ||
}) { | ||
var _a, _b, _c, _d; | ||
const { titleComponent, children } = separateFirstTitleFromChildren(originalChildren); | ||
const variantClassName = variant2[variant4]; | ||
return /* @__PURE__ */ jsxs("div", { | ||
className: classNames(root13, className2, variantClassName), | ||
className: classNames(root13, className4, variantClassName), | ||
children: [ | ||
/* @__PURE__ */ jsxs(Title, { | ||
...titleComponent?.props, | ||
...titleComponent == null ? void 0 : titleComponent.props, | ||
level: 4, | ||
@@ -376,7 +380,7 @@ className: title, | ||
/* @__PURE__ */ jsx15("span", { | ||
children: titleComponent?.props?.children?.length > 0 ? titleComponent?.props?.children : variant4 | ||
children: ((_b = (_a = titleComponent == null ? void 0 : titleComponent.props) == null ? void 0 : _a.children) == null ? void 0 : _b.length) > 0 ? (_c = titleComponent == null ? void 0 : titleComponent.props) == null ? void 0 : _c.children : variant4 | ||
}) | ||
] | ||
}), | ||
Children6.toArray(children)?.map((child) => { | ||
(_d = Children6.toArray(children)) == null ? void 0 : _d.map((child) => { | ||
if (child.type === React5.Fragment) { | ||
@@ -414,12 +418,12 @@ return /* @__PURE__ */ jsx15(Paragraph, { | ||
import { jsx as jsx17 } from "react/jsx-runtime"; | ||
function Lead({ children, className: className2, ...props }) { | ||
function Lead({ children, className: className4, ...props }) { | ||
return /* @__PURE__ */ jsx17("div", { | ||
className: classNames(root14, className2), | ||
className: classNames(root14, className4), | ||
...props, | ||
children: !Children7.toArray(children).find( | ||
(child) => child?.type === Paragraph | ||
(child) => (child == null ? void 0 : child.type) === Paragraph | ||
) ? /* @__PURE__ */ jsx17(Paragraph, { | ||
children | ||
}) : Children7.toArray(children).map((child, index) => { | ||
if (child?.type !== Paragraph) { | ||
if ((child == null ? void 0 : child.type) !== Paragraph) { | ||
return /* @__PURE__ */ jsx17(Paragraph, { | ||
@@ -442,7 +446,7 @@ children: child | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
}) { | ||
return /* @__PURE__ */ jsx18("li", { | ||
className: classNames(root15, className2), | ||
className: classNames(root15, className4), | ||
...props, | ||
@@ -468,3 +472,3 @@ children | ||
children: !Children8.toArray(children).find( | ||
(child) => child?.type === Paragraph | ||
(child) => (child == null ? void 0 : child.type) === Paragraph | ||
) ? /* @__PURE__ */ jsx19(Paragraph, { | ||
@@ -488,3 +492,3 @@ children | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
@@ -496,3 +500,3 @@ }) { | ||
return /* @__PURE__ */ jsxs2("div", { | ||
className: classNames(root17, className2), | ||
className: classNames(root17, className4), | ||
...props, | ||
@@ -514,7 +518,7 @@ children: [ | ||
import { jsx as jsx21 } from "react/jsx-runtime"; | ||
function MediaBlock({ ratio = "16:9", className: className2, ...props }) { | ||
function MediaBlock({ ratio = "16:9", className: className4, ...props }) { | ||
const [w, h] = parseRatio(ratio); | ||
const paddingPercent = h / w * 100; | ||
return /* @__PURE__ */ jsx21("div", { | ||
className: classNames(root18, className2), | ||
className: classNames(root18, className4), | ||
style: { paddingBottom: `${paddingPercent}%` }, | ||
@@ -524,3 +528,6 @@ ...props | ||
} | ||
var parseRatio = (ratio) => ratio ? (ratio.match(/^(\d+)[x:](\d+)$/)?.slice(1) || [])?.map((n) => parseInt(n)) : []; | ||
var parseRatio = (ratio) => { | ||
var _a, _b; | ||
return ratio ? (_b = ((_a = ratio.match(/^(\d+)[x:](\d+)$/)) == null ? void 0 : _a.slice(1)) || []) == null ? void 0 : _b.map((n) => parseInt(n)) : []; | ||
}; | ||
@@ -541,7 +548,7 @@ // src/support/atoms/MenuPathText/index.tsx | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
}) { | ||
return /* @__PURE__ */ jsx22("span", { | ||
className: classNames(root19, className2), | ||
className: classNames(root19, className4), | ||
...props, | ||
@@ -563,3 +570,3 @@ children: insertBetween(Children10.toArray(children), /* @__PURE__ */ jsx22("span", { | ||
import { jsx as jsx23 } from "react/jsx-runtime"; | ||
function OrderedList({ listType, className: className2, ...props }) { | ||
function OrderedList({ listType, className: className4, ...props }) { | ||
let listStyleType; | ||
@@ -580,3 +587,3 @@ switch (listType) { | ||
as: "ol", | ||
className: classNames(className2, listStyleType), | ||
className: classNames(className4, listStyleType), | ||
...props | ||
@@ -602,6 +609,6 @@ }); | ||
children, | ||
className: className2 | ||
className: className4 | ||
}) { | ||
return /* @__PURE__ */ jsx25("div", { | ||
className: classNames(root20, className2), | ||
className: classNames(root20, className4), | ||
children | ||
@@ -624,3 +631,3 @@ }); | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
@@ -635,3 +642,3 @@ }) { | ||
return /* @__PURE__ */ jsx26(ListItem, { | ||
className: classNames(root21, className2), | ||
className: classNames(root21, className4), | ||
...props, | ||
@@ -650,3 +657,3 @@ children: validChildren | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
@@ -661,3 +668,3 @@ }) { | ||
return /* @__PURE__ */ jsx27(OrderedList, { | ||
className: classNames(root22, className2), | ||
className: classNames(root22, className4), | ||
...props, | ||
@@ -692,3 +699,3 @@ children: validChildren | ||
children, | ||
className: className2, | ||
className: className4, | ||
morerows, | ||
@@ -706,3 +713,3 @@ valign, | ||
style: { verticalAlign: valign }, | ||
className: classNames(root23, isHead ? head : void 0, className2), | ||
className: classNames(root23, isHead ? head : void 0, className4), | ||
rowSpan: rowSpan || moreRowsInteger + 1, | ||
@@ -722,3 +729,3 @@ colSpan, | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
@@ -733,3 +740,3 @@ }) { | ||
return /* @__PURE__ */ jsx29("tr", { | ||
className: classNames(root24, className2), | ||
className: classNames(root24, className4), | ||
...props, | ||
@@ -748,3 +755,3 @@ children: validChildren | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
@@ -759,3 +766,3 @@ }) { | ||
return /* @__PURE__ */ jsx30("tbody", { | ||
className: classNames(root25, className2), | ||
className: classNames(root25, className4), | ||
...props, | ||
@@ -772,6 +779,6 @@ children: validChildren | ||
import { jsx as jsx31 } from "react/jsx-runtime"; | ||
function TableColSpec({ align, className: className2, ...props }) { | ||
function TableColSpec({ align, className: className4, ...props }) { | ||
return /* @__PURE__ */ jsx31("col", { | ||
align, | ||
className: classNames(root26, className2), | ||
className: classNames(root26, className4), | ||
...props | ||
@@ -789,5 +796,5 @@ }); | ||
import { jsx as jsx32 } from "react/jsx-runtime"; | ||
function TableCaption({ className: className2, ...props }) { | ||
function TableCaption({ className: className4, ...props }) { | ||
return /* @__PURE__ */ jsx32("caption", { | ||
className: classNames(root27, className2), | ||
className: classNames(root27, className4), | ||
...props | ||
@@ -807,3 +814,3 @@ }); | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
@@ -818,3 +825,3 @@ }) { | ||
return /* @__PURE__ */ jsx33("tfoot", { | ||
className: classNames(root28, className2), | ||
className: classNames(root28, className4), | ||
...props, | ||
@@ -836,3 +843,3 @@ children: validChildren | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
@@ -849,3 +856,3 @@ }) { | ||
children: /* @__PURE__ */ jsx34("thead", { | ||
className: classNames(root29, className2), | ||
className: classNames(root29, className4), | ||
...props, | ||
@@ -863,3 +870,3 @@ children: validChildren | ||
import { jsx as jsx35, jsxs as jsxs3 } from "react/jsx-runtime"; | ||
function TableGroup({ title: title2, children, className: className2, ...props }) { | ||
function TableGroup({ title: title2, children, className: className4, ...props }) { | ||
const childrenArr = Children17.toArray(children); | ||
@@ -878,3 +885,3 @@ const validChildren = filterValidChildren( | ||
return /* @__PURE__ */ jsxs3("table", { | ||
className: classNames(root30, className2), | ||
className: classNames(root30, className4), | ||
...props, | ||
@@ -897,3 +904,3 @@ children: [ | ||
import { jsx as jsx36 } from "react/jsx-runtime"; | ||
function TableRoot({ className: className2, ...props }) { | ||
function TableRoot({ className: className4, ...props }) { | ||
const { titleComponent, children } = separateFirstTitleFromChildren( | ||
@@ -911,3 +918,3 @@ props.children | ||
children: /* @__PURE__ */ jsx36("div", { | ||
className: classNames(root24, className2), | ||
className: classNames(root24, className4), | ||
...props, | ||
@@ -957,3 +964,3 @@ children: hasGroup ? validChildren.map( | ||
import { jsxs as jsxs4 } from "react/jsx-runtime"; | ||
function Segment({ className: className2, ...props }) { | ||
function Segment({ className: className4, ...props }) { | ||
const { titleComponent, children } = separateFirstTitleFromChildren( | ||
@@ -963,3 +970,3 @@ props.children | ||
return /* @__PURE__ */ jsxs4("section", { | ||
className: classNames(root31, className2), | ||
className: classNames(root31, className4), | ||
...props, | ||
@@ -985,3 +992,3 @@ children: [ | ||
function Article({ | ||
className: className2, | ||
className: className4, | ||
children: originalChildren, | ||
@@ -1000,3 +1007,3 @@ ...props | ||
lang: locale, | ||
className: classNames(root32, className2), | ||
className: classNames(root32, className4), | ||
...props, | ||
@@ -1018,7 +1025,7 @@ dir: direction, | ||
import { jsx as jsx39 } from "react/jsx-runtime"; | ||
function TextNode({ children, options, className: className2 }) { | ||
function TextNode({ children, options, className: className4 }) { | ||
const optionsArr = wrapArray(options); | ||
const variant4 = optionsArr?.map((option) => variant3[option]).reduce((result, curr) => classNames(result, curr)); | ||
const variant4 = optionsArr == null ? void 0 : optionsArr.map((option) => variant3[option]).reduce((result, curr) => classNames(result, curr)); | ||
return /* @__PURE__ */ jsx39("span", { | ||
className: classNames(root33, variant4, className2, ...optionsArr), | ||
className: classNames(root33, variant4, className4, ...optionsArr), | ||
children | ||
@@ -1095,3 +1102,3 @@ }); | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
@@ -1132,3 +1139,3 @@ }) { | ||
children, | ||
className: className2, | ||
className: className4, | ||
...props | ||
@@ -1141,3 +1148,3 @@ }) { | ||
return /* @__PURE__ */ jsxs9("div", { | ||
className: classNames(root35, className2), | ||
className: classNames(root35, className4), | ||
...props, | ||
@@ -1166,3 +1173,3 @@ children: [ | ||
import { jsxs as jsxs10 } from "react/jsx-runtime"; | ||
function SubSegment({ className: className2, ...props }) { | ||
function SubSegment({ className: className4, ...props }) { | ||
const { titleComponent, children } = separateFirstTitleFromChildren( | ||
@@ -1172,3 +1179,3 @@ props.children | ||
return /* @__PURE__ */ jsxs10("section", { | ||
className: classNames(root36, className2), | ||
className: classNames(root36, className4), | ||
...props, | ||
@@ -1193,3 +1200,3 @@ children: [ | ||
src, | ||
className: className2, | ||
className: className4, | ||
ratio = "16:9", | ||
@@ -1200,3 +1207,3 @@ ...props | ||
return /* @__PURE__ */ jsxs11("div", { | ||
className: classNames(root37, className2), | ||
className: classNames(root37, className4), | ||
children: [ | ||
@@ -1224,2 +1231,8 @@ titleComponent ? React24.cloneElement(titleComponent, { level: 4 }) : null, | ||
// src/themes/dcs-polestar-theme.css.ts | ||
var className2 = "dcs-polestar-theme"; | ||
// src/themes/dcs-volvo-theme.css.ts | ||
var className3 = "dcs-volvo-theme"; | ||
// src/themes/ThemeProvider.tsx | ||
@@ -1232,17 +1245,17 @@ import { jsx as jsx45 } from "react/jsx-runtime"; | ||
}) { | ||
let className2 = ""; | ||
let className4 = ""; | ||
switch (theme) { | ||
case "volvo": | ||
className2 = "dcs-volvo-theme"; | ||
className4 = className3; | ||
break; | ||
case "polestar": | ||
className2 = "dcs-polestar-theme"; | ||
className4 = className2; | ||
break; | ||
default: | ||
className2 = ""; | ||
className4 = ""; | ||
} | ||
return /* @__PURE__ */ jsx45(ThemeContext.Provider, { | ||
value: { theme, className: className2 }, | ||
value: { theme, className: className4 }, | ||
children: /* @__PURE__ */ jsx45("div", { | ||
className: `${className} ${className2}`, | ||
className: `${className} ${className4}`, | ||
children | ||
@@ -1317,7 +1330,7 @@ }) | ||
function MenuEntry({ | ||
className: className2, | ||
className: className4, | ||
children | ||
}) { | ||
return /* @__PURE__ */ jsx51("div", { | ||
className: classNames(root41, className2), | ||
className: classNames(root41, className4), | ||
children | ||
@@ -1332,5 +1345,5 @@ }); | ||
import { jsx as jsx52 } from "react/jsx-runtime"; | ||
function MenuRoot({ className: className2, ...props }) { | ||
function MenuRoot({ className: className4, ...props }) { | ||
return /* @__PURE__ */ jsx52("div", { | ||
className: classNames(className2, root42), | ||
className: classNames(className4, root42), | ||
...props | ||
@@ -1345,6 +1358,6 @@ }); | ||
import { jsx as jsx53 } from "react/jsx-runtime"; | ||
function Time({ value, datetime, className: className2, ...props }) { | ||
function Time({ value, datetime, className: className4, ...props }) { | ||
return /* @__PURE__ */ jsx53("time", { | ||
dateTime: datetime, | ||
className: classNames(root43, className2), | ||
className: classNames(root43, className4), | ||
...props, | ||
@@ -1460,3 +1473,3 @@ children: value | ||
if (isHead) { | ||
modifiedChildren = children?.map((child) => ({ | ||
modifiedChildren = children == null ? void 0 : children.map((child) => ({ | ||
...child, | ||
@@ -1643,3 +1656,3 @@ isHead | ||
let jsonNode; | ||
if (data?.type) { | ||
if (data == null ? void 0 : data.type) { | ||
jsonNode = data; | ||
@@ -1729,4 +1742,3 @@ } else { | ||
Video, | ||
className as baseThemeClassName, | ||
createRenderer | ||
}; |
{ | ||
"name": "@volvo-cars/ced-os-react-components", | ||
"version": "1.0.0-alpha.0", | ||
"version": "1.0.0-alpha.1", | ||
"description": "Set of components for developing UIs in the onboarding and support apps", | ||
@@ -21,2 +21,6 @@ "keywords": [], | ||
"module": "lib/index.js", | ||
"exports": { | ||
"import": "./lib/index.js", | ||
"require": "./lib/index.cjs" | ||
}, | ||
"scripts": { | ||
@@ -23,0 +27,0 @@ "prepare": "husky install", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1232636
28752