@carbonplan/components 10.1.1 → 10.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dst/index.esm.js +132 -56
- package/dst/index.esm.js.map +1 -1
- package/dst/index.js +132 -55
- package/dst/index.js.map +1 -1
- package/dst/index.modern.js +117 -46
- package/dst/index.modern.js.map +1 -1
- package/package.json +2 -2
package/dst/index.modern.js
CHANGED
|
@@ -76,6 +76,11 @@ const event = ({
|
|
|
76
76
|
label,
|
|
77
77
|
value
|
|
78
78
|
}) => {
|
|
79
|
+
if (typeof window.gtag !== 'function') {
|
|
80
|
+
console.warn(`Missing window.gtag, skipping analytics action: '${action}'.`);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
|
|
79
84
|
window.gtag('event', action, {
|
|
80
85
|
event_category: category,
|
|
81
86
|
event_label: label,
|
|
@@ -830,7 +835,6 @@ const Settings = (_ref) => {
|
|
|
830
835
|
fill: 'none',
|
|
831
836
|
strokeWidth: '2px',
|
|
832
837
|
stroke: 'text',
|
|
833
|
-
fill: 'background',
|
|
834
838
|
'.paren': {
|
|
835
839
|
opacity: '0'
|
|
836
840
|
},
|
|
@@ -854,22 +858,22 @@ const Settings = (_ref) => {
|
|
|
854
858
|
x1: "24",
|
|
855
859
|
y1: "2.1",
|
|
856
860
|
x2: "24",
|
|
861
|
+
y2: "6.1"
|
|
862
|
+
}), /*#__PURE__*/React.createElement("line", {
|
|
863
|
+
x1: "24",
|
|
864
|
+
y1: "24.1",
|
|
865
|
+
x2: "24",
|
|
857
866
|
y2: "33.9"
|
|
858
867
|
}), /*#__PURE__*/React.createElement("line", {
|
|
859
868
|
x1: "44",
|
|
860
869
|
y1: "2.1",
|
|
861
870
|
x2: "44",
|
|
871
|
+
y2: "12.1"
|
|
872
|
+
}), /*#__PURE__*/React.createElement("line", {
|
|
873
|
+
x1: "44",
|
|
874
|
+
y1: "30.1",
|
|
875
|
+
x2: "44",
|
|
862
876
|
y2: "33.9"
|
|
863
|
-
}), /*#__PURE__*/React.createElement("circle", {
|
|
864
|
-
cx: "24",
|
|
865
|
-
cy: "15.1",
|
|
866
|
-
r: "9",
|
|
867
|
-
stroke: "none"
|
|
868
|
-
}), /*#__PURE__*/React.createElement("circle", {
|
|
869
|
-
cx: "44",
|
|
870
|
-
cy: "21.1",
|
|
871
|
-
r: "9",
|
|
872
|
-
stroke: "none"
|
|
873
877
|
}), /*#__PURE__*/React.createElement("circle", {
|
|
874
878
|
cx: "24",
|
|
875
879
|
cy: "15.1",
|
|
@@ -1382,6 +1386,77 @@ const Footer = () => {
|
|
|
1382
1386
|
}))));
|
|
1383
1387
|
};
|
|
1384
1388
|
|
|
1389
|
+
const GitSha = () => {
|
|
1390
|
+
const sha = process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA;
|
|
1391
|
+
const owner = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER;
|
|
1392
|
+
const slug = process.env.NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG;
|
|
1393
|
+
const {
|
|
1394
|
+
theme
|
|
1395
|
+
} = useThemeUI();
|
|
1396
|
+
const color = theme.rawColors.secondary;
|
|
1397
|
+
|
|
1398
|
+
if (sha && owner && slug) {
|
|
1399
|
+
const shortSha = sha.substring(0, 7);
|
|
1400
|
+
const href = 'https://github.com/' + owner + '/' + slug + '/tree/' + sha;
|
|
1401
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
1402
|
+
sx: {
|
|
1403
|
+
display: 'inline-block'
|
|
1404
|
+
}
|
|
1405
|
+
}, /*#__PURE__*/React.createElement(Separator, {
|
|
1406
|
+
color: color
|
|
1407
|
+
}), /*#__PURE__*/React.createElement(Link$1, {
|
|
1408
|
+
href: href,
|
|
1409
|
+
sx: {
|
|
1410
|
+
whiteSpace: 'nowrap',
|
|
1411
|
+
display: 'inline-block',
|
|
1412
|
+
ml: [2],
|
|
1413
|
+
fontFamily: 'mono',
|
|
1414
|
+
letterSpacing: 'body',
|
|
1415
|
+
color: color,
|
|
1416
|
+
fontSize: [1],
|
|
1417
|
+
textTransform: 'uppercase',
|
|
1418
|
+
textDecoration: 'none'
|
|
1419
|
+
}
|
|
1420
|
+
}, shortSha));
|
|
1421
|
+
} else {
|
|
1422
|
+
// fallback
|
|
1423
|
+
return /*#__PURE__*/React.createElement(Box, {
|
|
1424
|
+
sx: {
|
|
1425
|
+
display: 'inline-block'
|
|
1426
|
+
}
|
|
1427
|
+
}, /*#__PURE__*/React.createElement(Separator, {
|
|
1428
|
+
color: color
|
|
1429
|
+
}), /*#__PURE__*/React.createElement(Text, {
|
|
1430
|
+
sx: {
|
|
1431
|
+
whiteSpace: 'nowrap',
|
|
1432
|
+
display: 'inline-block',
|
|
1433
|
+
ml: [2],
|
|
1434
|
+
fontFamily: 'mono',
|
|
1435
|
+
letterSpacing: 'body',
|
|
1436
|
+
color: color,
|
|
1437
|
+
fontSize: [1],
|
|
1438
|
+
textTransform: 'uppercase'
|
|
1439
|
+
}
|
|
1440
|
+
}, color));
|
|
1441
|
+
}
|
|
1442
|
+
};
|
|
1443
|
+
|
|
1444
|
+
const Separator = ({
|
|
1445
|
+
color
|
|
1446
|
+
}) => {
|
|
1447
|
+
return /*#__PURE__*/React.createElement("svg", {
|
|
1448
|
+
fill: color,
|
|
1449
|
+
opacity: "0.8",
|
|
1450
|
+
viewBox: "0 0 24 24",
|
|
1451
|
+
width: "24",
|
|
1452
|
+
height: "24"
|
|
1453
|
+
}, /*#__PURE__*/React.createElement("circle", {
|
|
1454
|
+
r: 5,
|
|
1455
|
+
cx: 19,
|
|
1456
|
+
cy: 19
|
|
1457
|
+
}));
|
|
1458
|
+
};
|
|
1459
|
+
|
|
1385
1460
|
const Value = ({
|
|
1386
1461
|
mode
|
|
1387
1462
|
}) => {
|
|
@@ -1429,10 +1504,6 @@ const Value = ({
|
|
|
1429
1504
|
const Metadata = ({
|
|
1430
1505
|
mode
|
|
1431
1506
|
}) => {
|
|
1432
|
-
const {
|
|
1433
|
-
theme
|
|
1434
|
-
} = useThemeUI();
|
|
1435
|
-
const color = theme.rawColors.secondary;
|
|
1436
1507
|
return /*#__PURE__*/React.createElement(Box, {
|
|
1437
1508
|
sx: {
|
|
1438
1509
|
userSelect: 'none',
|
|
@@ -1445,28 +1516,7 @@ const Metadata = ({
|
|
|
1445
1516
|
}
|
|
1446
1517
|
}, /*#__PURE__*/React.createElement(Value, {
|
|
1447
1518
|
mode: mode
|
|
1448
|
-
}), /*#__PURE__*/React.createElement(
|
|
1449
|
-
fill: color,
|
|
1450
|
-
opacity: "0.8",
|
|
1451
|
-
viewBox: "0 0 24 24",
|
|
1452
|
-
width: "24",
|
|
1453
|
-
height: "24"
|
|
1454
|
-
}, /*#__PURE__*/React.createElement("circle", {
|
|
1455
|
-
r: 5,
|
|
1456
|
-
cx: 19,
|
|
1457
|
-
cy: 19
|
|
1458
|
-
})), /*#__PURE__*/React.createElement(Text, {
|
|
1459
|
-
sx: {
|
|
1460
|
-
whiteSpace: 'nowrap',
|
|
1461
|
-
display: 'inline-block',
|
|
1462
|
-
ml: [2],
|
|
1463
|
-
fontFamily: 'mono',
|
|
1464
|
-
letterSpacing: 'body',
|
|
1465
|
-
color: 'secondary',
|
|
1466
|
-
fontSize: [1],
|
|
1467
|
-
textTransform: 'uppercase'
|
|
1468
|
-
}
|
|
1469
|
-
}, color));
|
|
1519
|
+
}), /*#__PURE__*/React.createElement(GitSha, null));
|
|
1470
1520
|
};
|
|
1471
1521
|
|
|
1472
1522
|
function init(mode) {
|
|
@@ -2416,7 +2466,7 @@ const Tray = ({
|
|
|
2416
2466
|
ml: [-3, -4, -5, -6],
|
|
2417
2467
|
pl: [3, 4, 5, 6],
|
|
2418
2468
|
pr: [3, 4, 5, 6],
|
|
2419
|
-
transform: expanded ? 'translateY(0)' : 'translateY(-
|
|
2469
|
+
transform: expanded ? 'translateY(0)' : 'translateY(-100%)'
|
|
2420
2470
|
}, sx)
|
|
2421
2471
|
}, /*#__PURE__*/React.createElement(Row, null, /*#__PURE__*/React.createElement(Column, {
|
|
2422
2472
|
start: [1, 1, 1, 1],
|
|
@@ -2424,15 +2474,36 @@ const Tray = ({
|
|
|
2424
2474
|
}, children))));
|
|
2425
2475
|
};
|
|
2426
2476
|
|
|
2427
|
-
const
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2477
|
+
const defaultOptions = {
|
|
2478
|
+
month: 'short',
|
|
2479
|
+
day: 'numeric',
|
|
2480
|
+
year: 'numeric'
|
|
2481
|
+
};
|
|
2482
|
+
|
|
2483
|
+
const formatDateElement = (date, element, option) => {
|
|
2484
|
+
if (!option) {
|
|
2485
|
+
return null;
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
const format = typeof option === 'string' ? option : defaultOptions[element];
|
|
2489
|
+
const result = date.toLocaleString('default', {
|
|
2490
|
+
[element]: format
|
|
2431
2491
|
});
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2492
|
+
|
|
2493
|
+
if (format === 'numeric' && element === 'day') {
|
|
2494
|
+
return result.padStart(2, '0');
|
|
2495
|
+
} else {
|
|
2496
|
+
return result;
|
|
2497
|
+
}
|
|
2498
|
+
};
|
|
2499
|
+
|
|
2500
|
+
const formatDate = (date, options = defaultOptions) => {
|
|
2501
|
+
const d = new Date(date.replace(/-/g, '/'));
|
|
2502
|
+
const month = formatDateElement(d, 'month', options.month);
|
|
2503
|
+
const day = formatDateElement(d, 'day', options.day);
|
|
2504
|
+
const year = formatDateElement(d, 'year', options.year);
|
|
2505
|
+
return [month, day, year].filter(Boolean).join(' ');
|
|
2435
2506
|
};
|
|
2436
2507
|
|
|
2437
|
-
export { Badge, Button, Callout, Column, Custom404, Dimmer, Expander, FadeIn, Filter, Footer, Group, Guide, Header, Input, Layout, Link, Logo, Menu, Meta, Monogram, Row, Scrollbar, Select, Slider, Table, Tag, Toggle, Tracking, Tray, formatDate, getScrollbarWidth };
|
|
2508
|
+
export { Badge, Button, Callout, Column, Custom404, Dimmer, Expander, FadeIn, Filter, Footer, Group, Guide, Header, Input, Layout, Link, Logo, Menu, Meta, Monogram, Row, Scrollbar, Select, Settings, Slider, Table, Tag, Toggle, Tracking, Tray, formatDate, getScrollbarWidth };
|
|
2438
2509
|
//# sourceMappingURL=index.modern.js.map
|