@drivy/cobalt 0.42.3 → 0.42.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/cjs/tokens/palette.js +78 -60
- package/cjs/tokens/palette.js.map +1 -1
- package/cjs/tokens/theme.js +194 -167
- package/cjs/tokens/theme.js.map +1 -1
- package/components/ContainedIcon/index.js +3 -2
- package/components/ContainedIcon/index.js.map +1 -1
- package/components/Flag/index.js +3 -3
- package/components/Flag/index.js.map +1 -1
- package/components/Form/RadioWithDetails.js +2 -2
- package/components/Form/RadioWithDetails.js.map +1 -1
- package/components/Layout/Components/LayoutCard.js +15 -0
- package/components/Layout/Components/LayoutCard.js.map +1 -0
- package/components/Layout/Components/LayoutSection.js +11 -0
- package/components/Layout/Components/LayoutSection.js.map +1 -0
- package/components/Layout/Components/LayoutSectionTitle.js +8 -0
- package/components/Layout/Components/LayoutSectionTitle.js.map +1 -0
- package/components/Layout/Components/LayoutStack.js +44 -0
- package/components/Layout/Components/LayoutStack.js.map +1 -0
- package/index.js +4 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/styles/components/Form/RadioWithDetails.scss +14 -3
- package/styles/components/Icon/iconColors.scss +64 -52
- package/styles/components/PlateNumber/index.scss +4 -0
- package/styles/components/Tag/index.scss +4 -0
- package/styles/core/_colors-map.scss +180 -155
- package/styles/core/default-theme.scss +136 -111
- package/styles/core/palette.scss +54 -40
- package/styles/core/theme.scss +281 -231
- package/tokens/palette.js +78 -61
- package/tokens/palette.js.map +1 -1
- package/tokens/theme.js +194 -168
- package/tokens/theme.js.map +1 -1
- package/types/src/components/ContainedIcon/index.d.ts +2 -1
- package/types/src/components/Flag/index.d.ts +2 -1
- package/types/src/components/Icon/index.d.ts +1 -1
- package/types/src/index.d.ts +2 -0
- package/types/src/tokens/index.d.ts +174 -133
- package/utilities.css +370 -327
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/ContainedIcon/index.tsx"],"sourcesContent":["import React from \"react\"\nimport capitalize from \"../utils/capitalize\"\nimport { IconColorsType } from \"../Icon\"\n\ntype Extends<T, U extends T> = U\n\ntype ContainedIconColorType = Extends<\n IconColorsType,\n \"base\" | \"accent\" | \"disabled\" | \"error\" | \"info\" | \"success\" | \"connect\"\n>\n\nexport type ContainedIconPropsType = {\n icon: React.JSX.Element\n color?: ContainedIconColorType\n}\n\nexport function ContainedIcon({\n icon,\n color = \"base\",\n}: ContainedIconPropsType) {\n return (\n <div\n className={`cobalt-contained-icon cobalt-contained-icon--color${capitalize(
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/ContainedIcon/index.tsx"],"sourcesContent":["import React from \"react\"\nimport capitalize from \"../utils/capitalize\"\nimport { IconColorsType } from \"../Icon\"\nimport cx from \"classnames\"\n\ntype Extends<T, U extends T> = U\n\ntype ContainedIconColorType = Extends<\n IconColorsType,\n \"base\" | \"accent\" | \"disabled\" | \"error\" | \"info\" | \"success\" | \"connect\"\n>\n\nexport type ContainedIconPropsType = {\n icon: React.JSX.Element\n color?: ContainedIconColorType\n className?: string\n}\n\nexport function ContainedIcon({\n icon,\n color = \"base\",\n className,\n}: ContainedIconPropsType) {\n return (\n <div\n className={cx(\n className,\n `cobalt-contained-icon cobalt-contained-icon--color${capitalize(color)}`\n )}\n >\n {icon}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;AAkBM,SAAU,aAAa,CAAC,EAC5B,IAAI,EACJ,KAAK,GAAG,MAAM,EACd,SAAS,GACc,EAAA;AACvB,IAAA,QACE,KACE,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,EAAE,CACX,SAAS,EACT,CAAA,kDAAA,EAAqD,UAAU,CAAC,KAAK,CAAC,CAAE,CAAA,CACzE,IAEA,IAAI,CACD,EACP;AACH;;;;"}
|
package/components/Flag/index.js
CHANGED
|
@@ -11,8 +11,8 @@ const BUNDLED_FLAGS = Object.freeze(Object.keys(countries.flags).reduce((bundled
|
|
|
11
11
|
...bundledFlags,
|
|
12
12
|
[name]: index[name],
|
|
13
13
|
}), {}));
|
|
14
|
-
const Flag = ({ country, size = 24 }) => {
|
|
15
|
-
const
|
|
14
|
+
const Flag = ({ country, size = 24, className }) => {
|
|
15
|
+
const _className = cx("cobalt-Flag", className, {
|
|
16
16
|
"cobalt-Flag--size16": size === 16,
|
|
17
17
|
"cobalt-Flag--size20": size === 20,
|
|
18
18
|
"cobalt-Flag--size32": size === 32,
|
|
@@ -20,7 +20,7 @@ const Flag = ({ country, size = 24 }) => {
|
|
|
20
20
|
const countryFlag = BUNDLED_FLAGS[country];
|
|
21
21
|
if (countryFlag == null)
|
|
22
22
|
throw new Error(`'${country}' Flag can not be found. Did you add the source and export it`);
|
|
23
|
-
return (React.createElement("span", { className:
|
|
23
|
+
return (React.createElement("span", { className: _className, dangerouslySetInnerHTML: { __html: countryFlag } }));
|
|
24
24
|
};
|
|
25
25
|
|
|
26
26
|
export { BUNDLED_FLAGS, Flag };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Flag/index.tsx"],"sourcesContent":["import React from \"react\"\nimport cx from \"classnames\"\nimport { countries } from \"../../tokens\"\n\nimport * as flags from \"../../icons/countries\"\nimport { eqSet } from \"../utils\"\n\nif (\n !eqSet<string>(\n new Set(Object.keys(flags)),\n new Set(Object.keys(countries.flags))\n )\n)\n throw new Error(\n \"Flag sources and tokens are not consistent. Did you add the source and export it\"\n )\n\ninterface FlagsMap {\n [name: string]: string\n}\n\nexport const BUNDLED_FLAGS: FlagsMap = Object.freeze(\n Object.keys(countries.flags).reduce(\n (bundledFlags, name) => ({\n ...bundledFlags,\n [name]: (flags as FlagsMap)[name],\n }),\n {}\n )\n)\n\nexport interface FlagProps {\n country: string\n /**\n * Available size in px\n * @default 24\n */\n size?: 16 | 20 | 24 | 32\n}\n\nexport const Flag = ({ country, size = 24 }: FlagProps) => {\n const
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Flag/index.tsx"],"sourcesContent":["import React from \"react\"\nimport cx from \"classnames\"\nimport { countries } from \"../../tokens\"\n\nimport * as flags from \"../../icons/countries\"\nimport { eqSet } from \"../utils\"\n\nif (\n !eqSet<string>(\n new Set(Object.keys(flags)),\n new Set(Object.keys(countries.flags))\n )\n)\n throw new Error(\n \"Flag sources and tokens are not consistent. Did you add the source and export it\"\n )\n\ninterface FlagsMap {\n [name: string]: string\n}\n\nexport const BUNDLED_FLAGS: FlagsMap = Object.freeze(\n Object.keys(countries.flags).reduce(\n (bundledFlags, name) => ({\n ...bundledFlags,\n [name]: (flags as FlagsMap)[name],\n }),\n {}\n )\n)\n\nexport interface FlagProps {\n country: string\n className?: string\n /**\n * Available size in px\n * @default 24\n */\n size?: 16 | 20 | 24 | 32\n}\n\nexport const Flag = ({ country, size = 24, className }: FlagProps) => {\n const _className = cx(\"cobalt-Flag\", className, {\n \"cobalt-Flag--size16\": size === 16,\n \"cobalt-Flag--size20\": size === 20,\n \"cobalt-Flag--size32\": size === 32,\n })\n\n const countryFlag = BUNDLED_FLAGS[country]\n\n if (countryFlag == null)\n throw new Error(\n `'${country}' Flag can not be found. Did you add the source and export it`\n )\n\n return (\n <span\n className={_className}\n dangerouslySetInnerHTML={{ __html: countryFlag }}\n />\n )\n}\n"],"names":["flags"],"mappings":";;;;;;;AAOA,IACE,CAAC,KAAK,CACJ,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAACA,KAAK,CAAC,CAAC,EAC3B,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CACtC;AAED,IAAA,MAAM,IAAI,KAAK,CACb,kFAAkF,CACnF,CAAA;AAMU,MAAA,aAAa,GAAa,MAAM,CAAC,MAAM,CAClD,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,CACjC,CAAC,YAAY,EAAE,IAAI,MAAM;AACvB,IAAA,GAAG,YAAY;AACf,IAAA,CAAC,IAAI,GAAIA,KAAkB,CAAC,IAAI,CAAC;AAClC,CAAA,CAAC,EACF,EAAE,CACH,EACF;AAYM,MAAM,IAAI,GAAG,CAAC,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAE,SAAS,EAAa,KAAI;AACnE,IAAA,MAAM,UAAU,GAAG,EAAE,CAAC,aAAa,EAAE,SAAS,EAAE;QAC9C,qBAAqB,EAAE,IAAI,KAAK,EAAE;QAClC,qBAAqB,EAAE,IAAI,KAAK,EAAE;QAClC,qBAAqB,EAAE,IAAI,KAAK,EAAE;AACnC,KAAA,CAAC,CAAA;AAEF,IAAA,MAAM,WAAW,GAAG,aAAa,CAAC,OAAO,CAAC,CAAA;IAE1C,IAAI,WAAW,IAAI,IAAI;AACrB,QAAA,MAAM,IAAI,KAAK,CACb,IAAI,OAAO,CAAA,6DAAA,CAA+D,CAC3E,CAAA;AAEH,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EACE,SAAS,EAAE,UAAU,EACrB,uBAAuB,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,EAAA,CAChD,EACH;AACH;;;;"}
|
|
@@ -10,8 +10,8 @@ const RadioWithDetails = ({ icon, title, description, className, ...inputProps }
|
|
|
10
10
|
className: "cobalt-radio-with-details__icon",
|
|
11
11
|
}),
|
|
12
12
|
React.createElement("div", { className: "cobalt-radio-with-details__content" },
|
|
13
|
-
React.createElement("
|
|
14
|
-
description && (React.createElement("
|
|
13
|
+
React.createElement("div", { className: "cobalt-radio-with-details__title" }, title),
|
|
14
|
+
description && (React.createElement("div", { className: "cobalt-radio-with-details__description" }, description))),
|
|
15
15
|
React.createElement("div", { className: "cobalt-radio-with-details__visual-input" }))));
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioWithDetails.js","sources":["../../../src/components/Form/RadioWithDetails.tsx"],"sourcesContent":["import React from \"react\"\nimport cx from \"classnames\"\n\nexport type RadioWithDetailsPropsType = {\n icon?: JSX.Element\n title: string\n description?: string\n name: string\n className?: string\n} & React.InputHTMLAttributes<HTMLInputElement>\n\nconst RadioWithDetails = ({\n icon,\n title,\n description,\n className,\n ...inputProps\n}: RadioWithDetailsPropsType) => {\n return (\n <label\n className={cx(\n \"cobalt-radio-with-details\",\n !description && \"cobalt-radio-with-details--noDescription\",\n className\n )}\n >\n <input\n {...inputProps}\n type=\"radio\"\n className=\"cobalt-radio-with-details__input\"\n />\n <div className=\"cobalt-radio-with-details__inner\">\n {icon &&\n React.cloneElement(icon, {\n className: \"cobalt-radio-with-details__icon\",\n })}\n <div className=\"cobalt-radio-with-details__content\">\n <
|
|
1
|
+
{"version":3,"file":"RadioWithDetails.js","sources":["../../../src/components/Form/RadioWithDetails.tsx"],"sourcesContent":["import React from \"react\"\nimport cx from \"classnames\"\n\nexport type RadioWithDetailsPropsType = {\n icon?: JSX.Element\n title: string\n description?: string\n name: string\n className?: string\n} & React.InputHTMLAttributes<HTMLInputElement>\n\nconst RadioWithDetails = ({\n icon,\n title,\n description,\n className,\n ...inputProps\n}: RadioWithDetailsPropsType) => {\n return (\n <label\n className={cx(\n \"cobalt-radio-with-details\",\n !description && \"cobalt-radio-with-details--noDescription\",\n className\n )}\n >\n <input\n {...inputProps}\n type=\"radio\"\n className=\"cobalt-radio-with-details__input\"\n />\n <div className=\"cobalt-radio-with-details__inner\">\n {icon &&\n React.cloneElement(icon, {\n className: \"cobalt-radio-with-details__icon\",\n })}\n <div className=\"cobalt-radio-with-details__content\">\n <div className=\"cobalt-radio-with-details__title\">{title}</div>\n {description && (\n <div className=\"cobalt-radio-with-details__description\">\n {description}\n </div>\n )}\n </div>\n <div className=\"cobalt-radio-with-details__visual-input\" />\n </div>\n </label>\n )\n}\n\nexport default RadioWithDetails\n"],"names":[],"mappings":";;;AAWA,MAAM,gBAAgB,GAAG,CAAC,EACxB,IAAI,EACJ,KAAK,EACL,WAAW,EACX,SAAS,EACT,GAAG,UAAU,EACa,KAAI;AAC9B,IAAA,QACE,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EACE,SAAS,EAAE,EAAE,CACX,2BAA2B,EAC3B,CAAC,WAAW,IAAI,0CAA0C,EAC1D,SAAS,CACV,EAAA;QAED,KACM,CAAA,aAAA,CAAA,OAAA,EAAA,EAAA,GAAA,UAAU,EACd,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,kCAAkC,EAC5C,CAAA;QACF,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,kCAAkC,EAAA;YAC9C,IAAI;AACH,gBAAA,KAAK,CAAC,YAAY,CAAC,IAAI,EAAE;AACvB,oBAAA,SAAS,EAAE,iCAAiC;iBAC7C,CAAC;YACJ,KAAK,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAC,oCAAoC,EAAA;AACjD,gBAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,kCAAkC,EAAA,EAAE,KAAK,CAAO;gBAC9D,WAAW,KACV,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,wCAAwC,EACpD,EAAA,WAAW,CACR,CACP,CACG;AACN,YAAA,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAK,SAAS,EAAC,yCAAyC,GAAG,CACvD,CACA,EACT;AACH;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
|
|
4
|
+
const LayoutCardItem = ({ children }) => {
|
|
5
|
+
return React.createElement("div", { className: "cobalt-layout-card__item" }, children);
|
|
6
|
+
};
|
|
7
|
+
const LayoutCard = ({ children, isPageHeader, }) => {
|
|
8
|
+
return (React.createElement("div", { className: cx("cobalt-layout-card", {
|
|
9
|
+
"cobalt-layout--isPageHeader": isPageHeader,
|
|
10
|
+
}) }, children));
|
|
11
|
+
};
|
|
12
|
+
LayoutCard.Item = LayoutCardItem;
|
|
13
|
+
|
|
14
|
+
export { LayoutCard as default };
|
|
15
|
+
//# sourceMappingURL=LayoutCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutCard.js","sources":["../../../../src/components/Layout/Components/LayoutCard.tsx"],"sourcesContent":["import React from \"react\"\nimport cx from \"classnames\"\n\nconst LayoutCardItem = ({ children }: { children: React.ReactNode }) => {\n return <div className=\"cobalt-layout-card__item\">{children}</div>\n}\n\nconst LayoutCard = ({\n children,\n isPageHeader,\n}: {\n children: React.ReactNode\n isPageHeader?: boolean\n}) => {\n return (\n <div\n className={cx(\"cobalt-layout-card\", {\n \"cobalt-layout--isPageHeader\": isPageHeader,\n })}\n >\n {children}\n </div>\n )\n}\n\nLayoutCard.Item = LayoutCardItem\n\nexport default LayoutCard\n"],"names":[],"mappings":";;;AAGA,MAAM,cAAc,GAAG,CAAC,EAAE,QAAQ,EAAiC,KAAI;AACrE,IAAA,OAAO,6BAAK,SAAS,EAAC,0BAA0B,EAAE,EAAA,QAAQ,CAAO,CAAA;AACnE,CAAC,CAAA;AAEK,MAAA,UAAU,GAAG,CAAC,EAClB,QAAQ,EACR,YAAY,GAIb,KAAI;AACH,IAAA,QACE,KACE,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,EAAE,CAAC,oBAAoB,EAAE;AAClC,YAAA,6BAA6B,EAAE,YAAY;AAC5C,SAAA,CAAC,EAED,EAAA,QAAQ,CACL,EACP;AACH,EAAC;AAED,UAAU,CAAC,IAAI,GAAG,cAAc;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cx from 'classnames';
|
|
3
|
+
|
|
4
|
+
const LayoutSection = ({ children, isPageHeader, }) => {
|
|
5
|
+
return (React.createElement("div", { className: cx("cobalt-layout-section", {
|
|
6
|
+
"cobalt-layout--isPageHeader": isPageHeader,
|
|
7
|
+
}) }, children));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { LayoutSection as default };
|
|
11
|
+
//# sourceMappingURL=LayoutSection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutSection.js","sources":["../../../../src/components/Layout/Components/LayoutSection.tsx"],"sourcesContent":["import React from \"react\"\nimport cx from \"classnames\"\n\nconst LayoutSection = ({\n children,\n isPageHeader,\n}: {\n children: React.ReactNode\n isPageHeader?: boolean\n}) => {\n return (\n <div\n className={cx(\"cobalt-layout-section\", {\n \"cobalt-layout--isPageHeader\": isPageHeader,\n })}\n >\n {children}\n </div>\n )\n}\n\nexport default LayoutSection\n"],"names":[],"mappings":";;;AAGM,MAAA,aAAa,GAAG,CAAC,EACrB,QAAQ,EACR,YAAY,GAIb,KAAI;AACH,IAAA,QACE,KACE,CAAA,aAAA,CAAA,KAAA,EAAA,EAAA,SAAS,EAAE,EAAE,CAAC,uBAAuB,EAAE;AACrC,YAAA,6BAA6B,EAAE,YAAY;AAC5C,SAAA,CAAC,EAED,EAAA,QAAQ,CACL,EACP;AACH;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
const LayoutSectionTitle = ({ children }) => {
|
|
4
|
+
return React.createElement("h2", { className: "cobalt-layout-section-title" }, children);
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export { LayoutSectionTitle as default };
|
|
8
|
+
//# sourceMappingURL=LayoutSectionTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutSectionTitle.js","sources":["../../../../src/components/Layout/Components/LayoutSectionTitle.tsx"],"sourcesContent":["import React from \"react\"\n\nconst LayoutSectionTitle = ({ children }: { children: string }) => {\n return <h2 className=\"cobalt-layout-section-title\">{children}</h2>\n}\n\nexport default LayoutSectionTitle\n"],"names":[],"mappings":";;AAEA,MAAM,kBAAkB,GAAG,CAAC,EAAE,QAAQ,EAAwB,KAAI;AAChE,IAAA,OAAO,4BAAI,SAAS,EAAC,6BAA6B,EAAE,EAAA,QAAQ,CAAM,CAAA;AACpE;;;;"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { nanoid } from 'nanoid';
|
|
2
|
+
import React, { Children, cloneElement, isValidElement } from 'react';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
|
|
5
|
+
const LayoutStackItem = ({ children, isTable }) => {
|
|
6
|
+
const Comp = isTable ? "tr" : "div";
|
|
7
|
+
return React.createElement(Comp, { className: "cobalt-layout-stack__item" }, children);
|
|
8
|
+
};
|
|
9
|
+
const isStackItem = (child) => {
|
|
10
|
+
return isValidElement(child) && child.type === LayoutStackItem;
|
|
11
|
+
};
|
|
12
|
+
const LayoutStack = ({ children, isTable, isPageHeader, }) => {
|
|
13
|
+
const headerElements = [];
|
|
14
|
+
const bodyElements = [];
|
|
15
|
+
const content = Children.map(children, (child) => {
|
|
16
|
+
if (isStackItem(child)) {
|
|
17
|
+
const newChild = cloneElement(child, { isTable, key: nanoid() });
|
|
18
|
+
if (newChild.props.isTable) {
|
|
19
|
+
if (newChild.props.isPageHeader) {
|
|
20
|
+
headerElements.push(newChild);
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
bodyElements.push(newChild);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return child;
|
|
28
|
+
});
|
|
29
|
+
const className = cx("cobalt-layout-stack", {
|
|
30
|
+
"cobalt-layout--isPageHeader": isPageHeader,
|
|
31
|
+
});
|
|
32
|
+
if (isTable) {
|
|
33
|
+
return (React.createElement("table", { className: className },
|
|
34
|
+
!!headerElements.length && React.createElement("thead", null, headerElements),
|
|
35
|
+
React.createElement("tbody", null, bodyElements)));
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
return React.createElement("div", { className: className }, content);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
LayoutStack.Item = LayoutStackItem;
|
|
42
|
+
|
|
43
|
+
export { LayoutStack as default };
|
|
44
|
+
//# sourceMappingURL=LayoutStack.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LayoutStack.js","sources":["../../../../src/components/Layout/Components/LayoutStack.tsx"],"sourcesContent":["import { nanoid } from \"nanoid\"\nimport React, { Children, isValidElement, cloneElement } from \"react\"\nimport cx from \"classnames\"\n\ntype LayoutStackItemPropsType =\n | {\n children: React.ReactNode\n isTable: never\n isPageHeader: never\n }\n | {\n children: React.ReactNode\n isPageHeader?: boolean\n isTable?: boolean\n }\n\nconst LayoutStackItem = ({ children, isTable }: LayoutStackItemPropsType) => {\n const Comp = isTable ? \"tr\" : \"div\"\n return <Comp className=\"cobalt-layout-stack__item\">{children}</Comp>\n}\n\nconst isStackItem = (\n child: React.ReactNode\n): child is React.ReactElement<Omit<LayoutStackItemPropsType, \"children\">> => {\n return isValidElement(child) && child.type === LayoutStackItem\n}\n\nconst LayoutStack = ({\n children,\n isTable,\n isPageHeader,\n}: {\n children: React.ReactNode\n isTable?: boolean\n isPageHeader?: boolean\n}) => {\n const headerElements: React.ReactElement[] = []\n const bodyElements: React.ReactElement[] = []\n const content = Children.map(children, (child) => {\n if (isStackItem(child)) {\n const newChild = cloneElement(child, { isTable, key: nanoid() })\n if (newChild.props.isTable) {\n if (newChild.props.isPageHeader) {\n headerElements.push(newChild)\n } else {\n bodyElements.push(newChild)\n }\n }\n }\n return child\n })\n const className = cx(\"cobalt-layout-stack\", {\n \"cobalt-layout--isPageHeader\": isPageHeader,\n })\n if (isTable) {\n return (\n <table className={className}>\n {!!headerElements.length && <thead>{headerElements}</thead>}\n <tbody>{bodyElements}</tbody>\n </table>\n )\n } else {\n return <div className={className}>{content}</div>\n }\n}\n\nLayoutStack.Item = LayoutStackItem\n\nexport default LayoutStack\n"],"names":[],"mappings":";;;;AAgBA,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAA4B,KAAI;IAC1E,MAAM,IAAI,GAAG,OAAO,GAAG,IAAI,GAAG,KAAK,CAAA;IACnC,OAAO,KAAA,CAAA,aAAA,CAAC,IAAI,EAAC,EAAA,SAAS,EAAC,2BAA2B,EAAA,EAAE,QAAQ,CAAQ,CAAA;AACtE,CAAC,CAAA;AAED,MAAM,WAAW,GAAG,CAClB,KAAsB,KACqD;IAC3E,OAAO,cAAc,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,CAAA;AAChE,CAAC,CAAA;AAEK,MAAA,WAAW,GAAG,CAAC,EACnB,QAAQ,EACR,OAAO,EACP,YAAY,GAKb,KAAI;IACH,MAAM,cAAc,GAAyB,EAAE,CAAA;IAC/C,MAAM,YAAY,GAAyB,EAAE,CAAA;IAC7C,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,KAAK,KAAI;AAC/C,QAAA,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE;AACtB,YAAA,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,CAAA;AAChE,YAAA,IAAI,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE;AAC1B,gBAAA,IAAI,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE;AAC/B,oBAAA,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;iBAC9B;qBAAM;AACL,oBAAA,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;iBAC5B;aACF;SACF;AACD,QAAA,OAAO,KAAK,CAAA;AACd,KAAC,CAAC,CAAA;AACF,IAAA,MAAM,SAAS,GAAG,EAAE,CAAC,qBAAqB,EAAE;AAC1C,QAAA,6BAA6B,EAAE,YAAY;AAC5C,KAAA,CAAC,CAAA;IACF,IAAI,OAAO,EAAE;AACX,QAAA,QACE,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAO,SAAS,EAAE,SAAS,EAAA;AACxB,YAAA,CAAC,CAAC,cAAc,CAAC,MAAM,IAAI,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,IAAA,EAAQ,cAAc,CAAS;AAC3D,YAAA,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,IAAA,EAAQ,YAAY,CAAS,CACvB,EACT;KACF;SAAM;AACL,QAAA,OAAO,6BAAK,SAAS,EAAE,SAAS,EAAG,EAAA,OAAO,CAAO,CAAA;KAClD;AACH,EAAC;AAED,WAAW,CAAC,IAAI,GAAG,eAAe;;;;"}
|
package/index.js
CHANGED
|
@@ -47,6 +47,10 @@ export { ToggleSwitch } from './components/Form/ToggleSwitch.js';
|
|
|
47
47
|
export { CalendarView } from './components/Calendar/CalendarView/index.js';
|
|
48
48
|
export { default as Popover } from './components/Popover/index.js';
|
|
49
49
|
export { default as HorizontalList, HorizontalListPaddingBlock } from './components/HorizontalList/index.js';
|
|
50
|
+
export { default as LayoutSection } from './components/Layout/Components/LayoutSection.js';
|
|
51
|
+
export { default as LayoutSectionTitle } from './components/Layout/Components/LayoutSectionTitle.js';
|
|
52
|
+
export { default as LayoutCard } from './components/Layout/Components/LayoutCard.js';
|
|
53
|
+
export { default as LayoutStack } from './components/Layout/Components/LayoutStack.js';
|
|
50
54
|
export { default as useBreakpoint } from './hooks/useBreakpoint.js';
|
|
51
55
|
export { getMonthDaysByWeeks, getWeekDays } from './components/Calendar/utils.js';
|
|
52
56
|
export { default as AccountDetailsIcon } from './components/Icon/__generated__/AccountDetailsIcon.js';
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -23,12 +23,13 @@
|
|
|
23
23
|
border-radius: border-radius(lg);
|
|
24
24
|
|
|
25
25
|
transition: all 120ms ease-in-out;
|
|
26
|
+
|
|
27
|
+
gap: spacing(xs);
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
.cobalt-radio-with-details__icon {
|
|
29
31
|
flex-shrink: 0;
|
|
30
32
|
margin: 0;
|
|
31
|
-
margin-right: spacing(xs);
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
.cobalt-radio-with-details__content {
|
|
@@ -43,14 +44,16 @@
|
|
|
43
44
|
@include text-color(base);
|
|
44
45
|
font-size: 14px;
|
|
45
46
|
font-weight: 600;
|
|
46
|
-
line-height:
|
|
47
|
+
line-height: 20px;
|
|
47
48
|
|
|
48
49
|
transition: color 150ms ease-in-out;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
.cobalt-radio-with-details__description {
|
|
52
|
-
@include c-text-body-sm;
|
|
53
53
|
@include text-color(subdued);
|
|
54
|
+
font-family: font-family(base);
|
|
55
|
+
font-size: 14px;
|
|
56
|
+
line-height: 20px;
|
|
54
57
|
|
|
55
58
|
transition: color 150ms ease-in-out;
|
|
56
59
|
}
|
|
@@ -105,6 +108,14 @@
|
|
|
105
108
|
@include bg-color(accentAlt);
|
|
106
109
|
}
|
|
107
110
|
|
|
111
|
+
&:checked + #{ $self }__inner .cobalt-Icon {
|
|
112
|
+
@include fill-color(accent);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&:checked + #{ $self }__inner .cobalt-contained-icon {
|
|
116
|
+
@include bg-color(accentAlt);
|
|
117
|
+
}
|
|
118
|
+
|
|
108
119
|
&:checked + #{ $self }__inner #{ $self }__visual-input {
|
|
109
120
|
@include semantic-color(icon, accentAlt, border-color);
|
|
110
121
|
}
|
|
@@ -6,62 +6,22 @@
|
|
|
6
6
|
fill: var(--c-icon-base);
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
.cobalt-Icon--colorBaseInteractive {
|
|
10
|
-
fill: var(--c-icon-baseInteractive);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.cobalt-Icon--colorBaseInteractive:hover,
|
|
14
|
-
.cobalt-Icon--colorBaseInteractive:focus {
|
|
15
|
-
fill: var(--c-icon-baseInteractive--hover);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
9
|
.cobalt-Icon--colorSubdued {
|
|
19
10
|
fill: var(--c-icon-subdued);
|
|
20
11
|
}
|
|
21
12
|
|
|
22
|
-
.cobalt-Icon--colorSubduedInteractive {
|
|
23
|
-
fill: var(--c-icon-subduedInteractive);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.cobalt-Icon--colorSubduedInteractive:hover,
|
|
27
|
-
.cobalt-Icon--colorSubduedInteractive:focus {
|
|
28
|
-
fill: var(--c-icon-subduedInteractive--hover);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
13
|
.cobalt-Icon--colorAccent {
|
|
32
14
|
fill: var(--c-icon-accent);
|
|
33
15
|
}
|
|
34
16
|
|
|
35
|
-
.cobalt-Icon--colorAccentInteractive {
|
|
36
|
-
fill: var(--c-icon-accentInteractive);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
.cobalt-Icon--colorAccentInteractive:hover,
|
|
40
|
-
.cobalt-Icon--colorAccentInteractive:focus {
|
|
41
|
-
fill: var(--c-icon-accentInteractive--hover);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
17
|
.cobalt-Icon--colorAccentAlt {
|
|
45
18
|
fill: var(--c-icon-accentAlt);
|
|
46
19
|
}
|
|
47
20
|
|
|
48
|
-
.cobalt-Icon--colorAccentAltInteractive {
|
|
49
|
-
fill: var(--c-icon-accentAltInteractive);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.cobalt-Icon--colorAccentAltInteractive:hover,
|
|
53
|
-
.cobalt-Icon--colorAccentAltInteractive:focus {
|
|
54
|
-
fill: var(--c-icon-accentAltInteractive--hover);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
21
|
.cobalt-Icon--colorInfo {
|
|
58
22
|
fill: var(--c-icon-info);
|
|
59
23
|
}
|
|
60
24
|
|
|
61
|
-
.cobalt-Icon--colorInfoAlt {
|
|
62
|
-
fill: var(--c-icon-infoAlt);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
25
|
.cobalt-Icon--colorError {
|
|
66
26
|
fill: var(--c-icon-error);
|
|
67
27
|
}
|
|
@@ -78,10 +38,6 @@
|
|
|
78
38
|
fill: var(--c-icon-successAlt);
|
|
79
39
|
}
|
|
80
40
|
|
|
81
|
-
.cobalt-Icon--colorWarning {
|
|
82
|
-
fill: var(--c-icon-warning);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
41
|
.cobalt-Icon--colorConnect {
|
|
86
42
|
fill: var(--c-icon-connect);
|
|
87
43
|
}
|
|
@@ -98,18 +54,74 @@
|
|
|
98
54
|
fill: var(--c-icon-owner);
|
|
99
55
|
}
|
|
100
56
|
|
|
101
|
-
.cobalt-Icon--colorInversed {
|
|
102
|
-
fill: var(--c-icon-inversed);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
57
|
.cobalt-Icon--colorDisabled {
|
|
106
58
|
fill: var(--c-icon-disabled);
|
|
107
59
|
}
|
|
108
60
|
|
|
109
|
-
.cobalt-Icon--
|
|
110
|
-
fill: var(--c-icon-
|
|
61
|
+
.cobalt-Icon--colorDisabledAlt {
|
|
62
|
+
fill: var(--c-icon-disabledAlt);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.cobalt-Icon--colorWarning {
|
|
66
|
+
fill: var(--c-icon-warning);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.cobalt-Icon--colorInfoAlt {
|
|
70
|
+
fill: var(--c-icon-infoAlt);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.cobalt-Icon--colorOnAccent {
|
|
74
|
+
fill: var(--c-icon-onAccent);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.cobalt-Icon--colorRideshare {
|
|
78
|
+
fill: var(--c-icon-rideshare);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.cobalt-Icon--colorOnRideshare {
|
|
82
|
+
fill: var(--c-icon-onRideshare);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.cobalt-Icon--colorOnSuccess {
|
|
86
|
+
fill: var(--c-icon-onSuccess);
|
|
111
87
|
}
|
|
112
88
|
|
|
113
|
-
.cobalt-Icon--
|
|
114
|
-
fill: var(--c-icon-
|
|
89
|
+
.cobalt-Icon--colorOnError {
|
|
90
|
+
fill: var(--c-icon-onError);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.cobalt-Icon--colorBaseInteractive {
|
|
94
|
+
fill: var(--c-icon-baseInteractive);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.cobalt-Icon--colorBaseInteractive:hover,
|
|
98
|
+
.cobalt-Icon--colorBaseInteractive:focus {
|
|
99
|
+
fill: var(--c-icon-baseInteractive--hover);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.cobalt-Icon--colorSubduedInteractive {
|
|
103
|
+
fill: var(--c-icon-subduedInteractive);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.cobalt-Icon--colorSubduedInteractive:hover,
|
|
107
|
+
.cobalt-Icon--colorSubduedInteractive:focus {
|
|
108
|
+
fill: var(--c-icon-subduedInteractive--hover);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.cobalt-Icon--colorAccentInteractive {
|
|
112
|
+
fill: var(--c-icon-accentInteractive);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.cobalt-Icon--colorAccentInteractive:hover,
|
|
116
|
+
.cobalt-Icon--colorAccentInteractive:focus {
|
|
117
|
+
fill: var(--c-icon-accentInteractive--hover);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.cobalt-Icon--colorAccentAltInteractive {
|
|
121
|
+
fill: var(--c-icon-accentAltInteractive);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.cobalt-Icon--colorAccentAltInteractive:hover,
|
|
125
|
+
.cobalt-Icon--colorAccentAltInteractive:focus {
|
|
126
|
+
fill: var(--c-icon-accentAltInteractive--hover);
|
|
115
127
|
}
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
|
|
11
11
|
padding: 2px spacing("2xs");
|
|
12
12
|
|
|
13
|
+
font-family: font-family(base);
|
|
14
|
+
|
|
13
15
|
font-size: 14px;
|
|
14
16
|
|
|
15
17
|
font-weight: 600;
|
|
@@ -17,6 +19,8 @@
|
|
|
17
19
|
line-height: 16px;
|
|
18
20
|
|
|
19
21
|
border-radius: border-radius();
|
|
22
|
+
|
|
23
|
+
letter-spacing: normal;
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
&Tag--muted {
|