@carbonplan/components 10.5.0 → 11.0.0-alpha.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 +44 -21
- package/dst/index.esm.js.map +1 -1
- package/dst/index.js +38 -15
- package/dst/index.js.map +1 -1
- package/dst/index.modern.js +44 -21
- package/dst/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dst/index.modern.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React, { cloneElement, useCallback, useState, useEffect, useRef } from 'react';
|
|
2
|
-
import { Box, Link as Link$
|
|
1
|
+
import React, { forwardRef, cloneElement, useCallback, useState, useEffect, useRef } from 'react';
|
|
2
|
+
import { Box, Link as Link$2, Flex, Grid, IconButton, useColorMode, Container, useThemeUI, Text, Styled, Input as Input$1, Slider as Slider$1 } from 'theme-ui';
|
|
3
3
|
import { transparentize } from '@theme-ui/color';
|
|
4
4
|
import NextLink from 'next/link';
|
|
5
5
|
import { Arrow, Sun } from '@carbonplan/icons';
|
|
@@ -92,7 +92,7 @@ const event = ({
|
|
|
92
92
|
});
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
-
const Link = _ref => {
|
|
95
|
+
const Link = (_ref, ref) => {
|
|
96
96
|
let {
|
|
97
97
|
href,
|
|
98
98
|
children,
|
|
@@ -105,7 +105,9 @@ const Link = _ref => {
|
|
|
105
105
|
return /*#__PURE__*/React.createElement(NextLink, {
|
|
106
106
|
href: href,
|
|
107
107
|
passHref: true
|
|
108
|
-
}, /*#__PURE__*/React.createElement(Link$
|
|
108
|
+
}, /*#__PURE__*/React.createElement(Link$2, _extends({
|
|
109
|
+
ref: ref
|
|
110
|
+
}, props), children));
|
|
109
111
|
} else if (tracking) {
|
|
110
112
|
let action;
|
|
111
113
|
let category;
|
|
@@ -126,18 +128,22 @@ const Link = _ref => {
|
|
|
126
128
|
});
|
|
127
129
|
};
|
|
128
130
|
|
|
129
|
-
return /*#__PURE__*/React.createElement(Link$
|
|
131
|
+
return /*#__PURE__*/React.createElement(Link$2, _extends({
|
|
132
|
+
ref: ref,
|
|
130
133
|
onClick: track,
|
|
131
134
|
onContextMenu: track,
|
|
132
135
|
href: href
|
|
133
136
|
}, props), children);
|
|
134
137
|
} else {
|
|
135
|
-
return /*#__PURE__*/React.createElement(Link$
|
|
138
|
+
return /*#__PURE__*/React.createElement(Link$2, _extends({
|
|
139
|
+
ref: ref,
|
|
136
140
|
href: href
|
|
137
141
|
}, props), children);
|
|
138
142
|
}
|
|
139
143
|
};
|
|
140
144
|
|
|
145
|
+
var Link$1 = forwardRef(Link);
|
|
146
|
+
|
|
141
147
|
const getSizeStyles = size => {
|
|
142
148
|
if (!['xs', 'sm', 'md', 'lg', 'xl'].includes(size)) {
|
|
143
149
|
throw new Error('Size must be xs, sm, md, lg, or xl');
|
|
@@ -190,7 +196,7 @@ const getSizeStyles = size => {
|
|
|
190
196
|
|
|
191
197
|
const _excluded$e = ["size", "prefix", "suffix", "inverted", "sx", "children", "align", "href", "internal", "tracking"];
|
|
192
198
|
|
|
193
|
-
const Button = _ref => {
|
|
199
|
+
const Button = (_ref, ref) => {
|
|
194
200
|
let {
|
|
195
201
|
size = 'sm',
|
|
196
202
|
prefix,
|
|
@@ -361,7 +367,8 @@ const Button = _ref => {
|
|
|
361
367
|
}, suffix && suffix));
|
|
362
368
|
|
|
363
369
|
if (href) {
|
|
364
|
-
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
370
|
+
return /*#__PURE__*/React.createElement(Link$1, _extends({
|
|
371
|
+
ref: ref,
|
|
365
372
|
href: href,
|
|
366
373
|
internal: internal,
|
|
367
374
|
tracking: tracking,
|
|
@@ -371,15 +378,18 @@ const Button = _ref => {
|
|
|
371
378
|
}, props), Inner);
|
|
372
379
|
} else {
|
|
373
380
|
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
381
|
+
ref: ref,
|
|
374
382
|
as: "button",
|
|
375
383
|
sx: style
|
|
376
384
|
}, props), Inner);
|
|
377
385
|
}
|
|
378
386
|
};
|
|
379
387
|
|
|
388
|
+
var button = forwardRef(Button);
|
|
389
|
+
|
|
380
390
|
const _excluded$d = ["label", "children", "inverted", "color", "href", "internal", "tracking", "sx"];
|
|
381
391
|
|
|
382
|
-
const Callout = _ref => {
|
|
392
|
+
const Callout = (_ref, ref) => {
|
|
383
393
|
let {
|
|
384
394
|
label,
|
|
385
395
|
children,
|
|
@@ -455,7 +465,8 @@ const Callout = _ref => {
|
|
|
455
465
|
})));
|
|
456
466
|
|
|
457
467
|
if (href) {
|
|
458
|
-
return /*#__PURE__*/React.createElement(Link, _extends({
|
|
468
|
+
return /*#__PURE__*/React.createElement(Link$1, _extends({
|
|
469
|
+
ref: ref,
|
|
459
470
|
href: href,
|
|
460
471
|
internal: internal,
|
|
461
472
|
tracking: tracking,
|
|
@@ -463,12 +474,15 @@ const Callout = _ref => {
|
|
|
463
474
|
}, props), Inner);
|
|
464
475
|
} else {
|
|
465
476
|
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
477
|
+
ref: ref,
|
|
466
478
|
as: "button",
|
|
467
479
|
sx: style
|
|
468
480
|
}, props), Inner);
|
|
469
481
|
}
|
|
470
482
|
};
|
|
471
483
|
|
|
484
|
+
var callout = forwardRef(Callout);
|
|
485
|
+
|
|
472
486
|
const _excluded$c = ["colormap", "label", "clim", "discrete", "units", "width", "height", "format", "horizontal"];
|
|
473
487
|
const sx$2 = {
|
|
474
488
|
clim: {
|
|
@@ -1196,14 +1210,14 @@ const Nav = ({
|
|
|
1196
1210
|
return /*#__PURE__*/React.createElement(NextLink, {
|
|
1197
1211
|
href: href,
|
|
1198
1212
|
passHref: true
|
|
1199
|
-
}, /*#__PURE__*/React.createElement(Link$
|
|
1213
|
+
}, /*#__PURE__*/React.createElement(Link$2, {
|
|
1200
1214
|
onClick: () => {
|
|
1201
1215
|
if (nav === url) setExpanded(false);
|
|
1202
1216
|
},
|
|
1203
1217
|
sx: sx$1.link(nav, url, first)
|
|
1204
1218
|
}, /*#__PURE__*/React.createElement(HoverArrow, null), display));
|
|
1205
1219
|
} else {
|
|
1206
|
-
return /*#__PURE__*/React.createElement(Link$
|
|
1220
|
+
return /*#__PURE__*/React.createElement(Link$2, {
|
|
1207
1221
|
href: href,
|
|
1208
1222
|
sx: sx$1.link(nav, url, first)
|
|
1209
1223
|
}, /*#__PURE__*/React.createElement(HoverArrow, null), display);
|
|
@@ -1258,7 +1272,7 @@ const Header = ({
|
|
|
1258
1272
|
}, (mode == 'homepage' || mode == 'local') && /*#__PURE__*/React.createElement(NextLink, {
|
|
1259
1273
|
href: "/",
|
|
1260
1274
|
passHref: true
|
|
1261
|
-
}, /*#__PURE__*/React.createElement(Link$
|
|
1275
|
+
}, /*#__PURE__*/React.createElement(Link$2, {
|
|
1262
1276
|
"aria-label": "CarbonPlan Homepage",
|
|
1263
1277
|
sx: {
|
|
1264
1278
|
display: 'block'
|
|
@@ -1269,7 +1283,7 @@ const Header = ({
|
|
|
1269
1283
|
cursor: 'pointer',
|
|
1270
1284
|
color: 'primary'
|
|
1271
1285
|
}
|
|
1272
|
-
}))), (mode == null || mode == 'remote') && /*#__PURE__*/React.createElement(Link$
|
|
1286
|
+
}))), (mode == null || mode == 'remote') && /*#__PURE__*/React.createElement(Link$2, {
|
|
1273
1287
|
href: "https://carbonplan.org",
|
|
1274
1288
|
"aria-label": "CarbonPlan Homepage",
|
|
1275
1289
|
sx: {
|
|
@@ -1413,7 +1427,7 @@ const Footer = () => {
|
|
|
1413
1427
|
letterSpacing: 'mono',
|
|
1414
1428
|
mb: [2]
|
|
1415
1429
|
}
|
|
1416
|
-
}, "EMAIL"), /*#__PURE__*/React.createElement(Link$
|
|
1430
|
+
}, "EMAIL"), /*#__PURE__*/React.createElement(Link$2, {
|
|
1417
1431
|
href: "mailto:hello@carbonplan.org",
|
|
1418
1432
|
sx: {
|
|
1419
1433
|
textDecoration: 'none',
|
|
@@ -1447,7 +1461,7 @@ const Footer = () => {
|
|
|
1447
1461
|
letterSpacing: 'mono',
|
|
1448
1462
|
mb: [2]
|
|
1449
1463
|
}
|
|
1450
|
-
}, "FOLLOW"), /*#__PURE__*/React.createElement(Link$
|
|
1464
|
+
}, "FOLLOW"), /*#__PURE__*/React.createElement(Link$2, {
|
|
1451
1465
|
href: "https://twitter.com/carbonplanorg",
|
|
1452
1466
|
sx: {
|
|
1453
1467
|
textDecoration: 'none',
|
|
@@ -1559,7 +1573,7 @@ const GitSha = () => {
|
|
|
1559
1573
|
}
|
|
1560
1574
|
}, /*#__PURE__*/React.createElement(Separator, {
|
|
1561
1575
|
color: color
|
|
1562
|
-
}), /*#__PURE__*/React.createElement(Link$
|
|
1576
|
+
}), /*#__PURE__*/React.createElement(Link$2, {
|
|
1563
1577
|
href: href,
|
|
1564
1578
|
sx: {
|
|
1565
1579
|
whiteSpace: 'nowrap',
|
|
@@ -2224,7 +2238,7 @@ const Group = ({
|
|
|
2224
2238
|
|
|
2225
2239
|
const _excluded$3 = ["size", "inverted", "sx"];
|
|
2226
2240
|
|
|
2227
|
-
const Input = _ref => {
|
|
2241
|
+
const Input = (_ref, ref) => {
|
|
2228
2242
|
let {
|
|
2229
2243
|
size = 'sm',
|
|
2230
2244
|
inverted,
|
|
@@ -2264,10 +2278,13 @@ const Input = _ref => {
|
|
|
2264
2278
|
}, getSizeStyles(size), sx);
|
|
2265
2279
|
|
|
2266
2280
|
return /*#__PURE__*/React.createElement(Input$1, _extends({}, props, {
|
|
2281
|
+
ref: ref,
|
|
2267
2282
|
sx: styles
|
|
2268
2283
|
}));
|
|
2269
2284
|
};
|
|
2270
2285
|
|
|
2286
|
+
var input = forwardRef(Input);
|
|
2287
|
+
|
|
2271
2288
|
const getProps = test => props => {
|
|
2272
2289
|
const next = {};
|
|
2273
2290
|
|
|
@@ -2375,7 +2392,7 @@ const Select = _ref => {
|
|
|
2375
2392
|
|
|
2376
2393
|
const _excluded$1 = ["sx"];
|
|
2377
2394
|
|
|
2378
|
-
const Slider = _ref => {
|
|
2395
|
+
const Slider = (_ref, ref) => {
|
|
2379
2396
|
let {
|
|
2380
2397
|
sx
|
|
2381
2398
|
} = _ref,
|
|
@@ -2388,6 +2405,7 @@ const Slider = _ref => {
|
|
|
2388
2405
|
}
|
|
2389
2406
|
} = useThemeUI();
|
|
2390
2407
|
return /*#__PURE__*/React.createElement(Slider$1, _extends({
|
|
2408
|
+
ref: ref,
|
|
2391
2409
|
sx: _extends({
|
|
2392
2410
|
'&::-webkit-slider-thumb': {
|
|
2393
2411
|
height: [22, 18, 16],
|
|
@@ -2419,6 +2437,8 @@ const Slider = _ref => {
|
|
|
2419
2437
|
}, props));
|
|
2420
2438
|
};
|
|
2421
2439
|
|
|
2440
|
+
var slider = forwardRef(Slider);
|
|
2441
|
+
|
|
2422
2442
|
const styles = {
|
|
2423
2443
|
reset: {
|
|
2424
2444
|
verticalAlign: 'baseline',
|
|
@@ -2521,7 +2541,7 @@ const Table = ({
|
|
|
2521
2541
|
|
|
2522
2542
|
const _excluded = ["value", "onClick", "disabled", "sx"];
|
|
2523
2543
|
|
|
2524
|
-
const Toggle = _ref => {
|
|
2544
|
+
const Toggle = (_ref, ref) => {
|
|
2525
2545
|
let {
|
|
2526
2546
|
value,
|
|
2527
2547
|
onClick,
|
|
@@ -2533,6 +2553,7 @@ const Toggle = _ref => {
|
|
|
2533
2553
|
const color = sx && sx.color ? sx.color : 'primary';
|
|
2534
2554
|
value = disabled ? false : value;
|
|
2535
2555
|
return /*#__PURE__*/React.createElement(Box, _extends({
|
|
2556
|
+
ref: ref,
|
|
2536
2557
|
as: "button",
|
|
2537
2558
|
onClick: onClick,
|
|
2538
2559
|
role: "checkbox",
|
|
@@ -2570,6 +2591,8 @@ const Toggle = _ref => {
|
|
|
2570
2591
|
})));
|
|
2571
2592
|
};
|
|
2572
2593
|
|
|
2594
|
+
var toggle = forwardRef(Toggle);
|
|
2595
|
+
|
|
2573
2596
|
const Tracking = ({
|
|
2574
2597
|
id
|
|
2575
2598
|
}) => {
|
|
@@ -2672,5 +2695,5 @@ const formatDate = (date, options = defaultOptions) => {
|
|
|
2672
2695
|
return [month, day, year].filter(Boolean).join(' ');
|
|
2673
2696
|
};
|
|
2674
2697
|
|
|
2675
|
-
export { Badge, Button, Callout, Colorbar, 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 };
|
|
2698
|
+
export { Badge, button as Button, callout as Callout, Colorbar, Column, Custom404, Dimmer, Expander, FadeIn, Filter, Footer, Group, Guide, Header, input as Input, Layout, Link$1 as Link, Logo, Menu, Meta, Monogram, Row, Scrollbar, Select, Settings, slider as Slider, Table, Tag, toggle as Toggle, Tracking, Tray, formatDate, getScrollbarWidth };
|
|
2676
2699
|
//# sourceMappingURL=index.modern.js.map
|