@opentripplanner/building-blocks 3.0.1 → 3.0.2-alpha.1
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/README.md +4 -0
- package/esm/stories/ColorPalette.js +2 -1
- package/esm/stories/ColorPalette.js.map +1 -1
- package/lib/alert/Alert.js +103 -72
- package/lib/alert/Alert.js.map +1 -1
- package/lib/colors/blue.js +14 -18
- package/lib/colors/blue.js.map +1 -1
- package/lib/colors/grey.js +14 -18
- package/lib/colors/grey.js.map +1 -1
- package/lib/colors/red.js +14 -18
- package/lib/colors/red.js.map +1 -1
- package/lib/dropdown/index.js +87 -102
- package/lib/dropdown/index.js.map +1 -1
- package/lib/dropdown/styled.js +72 -19
- package/lib/dropdown/styled.js.map +1 -1
- package/lib/focus-trap-wrapper/dom-query.js +20 -36
- package/lib/focus-trap-wrapper/dom-query.js.map +1 -1
- package/lib/focus-trap-wrapper/index.js +52 -51
- package/lib/focus-trap-wrapper/index.js.map +1 -1
- package/lib/index.js +36 -41
- package/lib/index.js.map +1 -1
- package/lib/stories/ColorPalette.d.ts.map +1 -1
- package/lib/stories/ColorPalette.js +37 -23
- package/lib/stories/ColorPalette.js.map +1 -1
- package/package.json +3 -3
- package/src/stories/ColorPalette.tsx +3 -1
- package/src/stories/alerts.story.tsx +1 -1
- package/src/stories/dropdown.story.tsx +2 -2
- package/src/stories/index.story.tsx +1 -1
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dropdown/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAOe;AAEf,+DAGyC;AACzC,qCAAyE;AAWzE;;;;GAIG;AACH,MAAM,QAAQ,GAAG,CAAC,EAChB,aAAa,EACb,QAAQ,EACR,SAAS,EACT,EAAE,EACF,KAAK,EACL,SAAS,EACT,IAA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UAAU,EACnB,SAAS,EAAE,aAAa,EACxB,GAAG,EAAE,YAAY;QAEjB,8BAAC,uBAAc;QACb,mDAAmD;QACnD,+EAA+E;6BAChE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,mBACrB,IAAI,mBACL,SAAS,gBACX,KAAK,EACjB,EAAE,EAAE,GAAG,EAAE,QAAQ,EACjB,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,WAAW,EAClB,KAAK,EAAE,KAAK,EACZ,IAAI,EAAC,QAAQ;YAEb,4CAAO,IAAI,CAAQ;YACnB,wCAAM,SAAS,EAAC,OAAO,EAAC,IAAI,EAAC,cAAc,GAAG,CAC/B;QAChB,IAAI,IAAI,CACP,8BAAC,qBAAY,IACX,EAAE,EAAE,MAAM,IAAI,IAAI,gBACN,SAAS,qBACJ,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,EACtD,EAAE,EAAE,EAAE,EACN,OAAO,EAAE,UAAU,EACnB,SAAS,EAAE,aAAa,EACxB,IAAI,EAAE,MAAM,IAAI,SAAS,EACzB,QAAQ,EAAE,CAAC,CAAC,IAEX,QAAQ,CACI,CAChB,CACe,CACnB,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
package/lib/dropdown/styled.js
CHANGED
|
@@ -1,22 +1,75 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
});
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
6
|
exports.DropdownWrapper = exports.DropdownMenu = exports.DropdownButton = void 0;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
const grey_1 = __importDefault(require("../colors/grey"));
|
|
9
|
+
exports.DropdownButton = styled_components_1.default.button `
|
|
10
|
+
background: #fff;
|
|
11
|
+
border: 1px solid black;
|
|
12
|
+
border-radius: 5px;
|
|
13
|
+
color: inherit;
|
|
14
|
+
padding: 5px 7px;
|
|
15
|
+
transition: all 0.1s ease-in-out;
|
|
16
|
+
|
|
17
|
+
span.caret {
|
|
18
|
+
border-left: 4px solid transparent;
|
|
19
|
+
border-right: 4px solid transparent;
|
|
20
|
+
border-top: 4px solid;
|
|
21
|
+
color: inherit;
|
|
22
|
+
display: inline-block;
|
|
23
|
+
height: 0;
|
|
24
|
+
margin-left: 5px;
|
|
25
|
+
vertical-align: middle;
|
|
26
|
+
width: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&:hover,
|
|
30
|
+
&[aria-expanded="true"] {
|
|
31
|
+
background: ${grey_1.default[50]};
|
|
32
|
+
color: black;
|
|
33
|
+
cursor: pointer;
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
36
|
+
exports.DropdownMenu = styled_components_1.default.div `
|
|
37
|
+
background-clip: padding-box;
|
|
38
|
+
background-color: #fff;
|
|
39
|
+
border-radius: 4px;
|
|
40
|
+
border: 1px solid rgba(0, 0, 0, 0.15);
|
|
41
|
+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
|
|
42
|
+
color: #333;
|
|
43
|
+
list-style: none;
|
|
44
|
+
margin: 2px 0 0;
|
|
45
|
+
min-width: 160px;
|
|
46
|
+
padding: 5px 0;
|
|
47
|
+
position: absolute;
|
|
48
|
+
${props => (props.alignLeft ? "left: 0;" : "right: 0;")}
|
|
49
|
+
top: 100%;
|
|
50
|
+
width: 100%;
|
|
51
|
+
z-index: 1000;
|
|
52
|
+
|
|
53
|
+
hr {
|
|
54
|
+
margin: 0;
|
|
55
|
+
padding: 0;
|
|
56
|
+
}
|
|
57
|
+
a,
|
|
58
|
+
button {
|
|
59
|
+
background: transparent;
|
|
60
|
+
border: none;
|
|
61
|
+
cursor: pointer;
|
|
62
|
+
padding: 5px 15px;
|
|
63
|
+
text-align: start;
|
|
64
|
+
width: 100%;
|
|
65
|
+
|
|
66
|
+
&:hover {
|
|
67
|
+
background: ${grey_1.default[50]};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
exports.DropdownWrapper = styled_components_1.default.span `
|
|
72
|
+
float: ${props => (props.pullRight ? "right" : "left")};
|
|
73
|
+
position: relative;
|
|
74
|
+
`;
|
|
22
75
|
//# sourceMappingURL=styled.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled.js","
|
|
1
|
+
{"version":3,"file":"styled.js","sourceRoot":"","sources":["../../src/dropdown/styled.tsx"],"names":[],"mappings":";;;;;;AAAA,0EAAuC;AACvC,0DAAkC;AAErB,QAAA,cAAc,GAAG,2BAAM,CAAC,MAAM,CAAA;;;;;;;;;;;;;;;;;;;;;;kBAsBzB,cAAI,CAAC,EAAE,CAAC;;;;CAIzB,CAAC;AAEW,QAAA,YAAY,GAAG,2BAAM,CAAC,GAAG,CAAyB;;;;;;;;;;;;IAY3D,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;;;;;;;;;;;;;;;;;;;oBAmBrC,cAAI,CAAC,EAAE,CAAC;;;CAG3B,CAAC;AAEW,QAAA,eAAe,GAAG,2BAAM,CAAC,IAAI,CAAyB;WACxD,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;;CAEvD,CAAC"}
|
|
@@ -1,21 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getNextSibling = getNextSibling;
|
|
7
|
-
exports.getPreviousSibling = getPreviousSibling;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPreviousSibling = exports.getNextSibling = void 0;
|
|
8
4
|
function getEntries(query) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
entries,
|
|
14
|
-
firstElement,
|
|
15
|
-
lastElement
|
|
16
|
-
};
|
|
5
|
+
const entries = Array.from(document.querySelectorAll(query));
|
|
6
|
+
const firstElement = entries[0];
|
|
7
|
+
const lastElement = entries[entries.length - 1];
|
|
8
|
+
return { entries, firstElement, lastElement };
|
|
17
9
|
}
|
|
18
|
-
|
|
19
10
|
/**
|
|
20
11
|
* Helper method to find the next focusable sibling element relative to the
|
|
21
12
|
* specified element.
|
|
@@ -25,18 +16,14 @@ function getEntries(query) {
|
|
|
25
16
|
* @returns {HTMLElement} - element to be focused
|
|
26
17
|
*/
|
|
27
18
|
function getNextSibling(query, element) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return firstElement;
|
|
35
|
-
}
|
|
36
|
-
const elementIndex = entries.indexOf(element);
|
|
37
|
-
return entries[elementIndex + 1];
|
|
19
|
+
const { entries, firstElement, lastElement } = getEntries(query);
|
|
20
|
+
if (element === lastElement) {
|
|
21
|
+
return firstElement;
|
|
22
|
+
}
|
|
23
|
+
const elementIndex = entries.indexOf(element);
|
|
24
|
+
return entries[elementIndex + 1];
|
|
38
25
|
}
|
|
39
|
-
|
|
26
|
+
exports.getNextSibling = getNextSibling;
|
|
40
27
|
/**
|
|
41
28
|
* Helper method to find the previous focusable sibling element relative to the
|
|
42
29
|
* specified element.
|
|
@@ -46,15 +33,12 @@ function getNextSibling(query, element) {
|
|
|
46
33
|
* @returns {HTMLElement} - element to be focused
|
|
47
34
|
*/
|
|
48
35
|
function getPreviousSibling(query, element) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return lastElement;
|
|
56
|
-
}
|
|
57
|
-
const elementIndex = entries.indexOf(element);
|
|
58
|
-
return entries[elementIndex - 1];
|
|
36
|
+
const { entries, firstElement, lastElement } = getEntries(query);
|
|
37
|
+
if (element === firstElement) {
|
|
38
|
+
return lastElement;
|
|
39
|
+
}
|
|
40
|
+
const elementIndex = entries.indexOf(element);
|
|
41
|
+
return entries[elementIndex - 1];
|
|
59
42
|
}
|
|
43
|
+
exports.getPreviousSibling = getPreviousSibling;
|
|
60
44
|
//# sourceMappingURL=dom-query.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dom-query.js","
|
|
1
|
+
{"version":3,"file":"dom-query.js","sourceRoot":"","sources":["../../src/focus-trap-wrapper/dom-query.ts"],"names":[],"mappings":";;;AAAA,SAAS,UAAU,CAAC,KAAa;IAC/B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7D,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAChC,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAEhD,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;AAChD,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,cAAc,CAC5B,KAAa,EACb,OAAoB;IAEpB,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAEjE,IAAI,OAAO,KAAK,WAAW,EAAE;QAC3B,OAAO,YAA2B,CAAC;KACpC;IACD,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,OAAsB,CAAC,CAAC;IAC7D,OAAO,OAAO,CAAC,YAAY,GAAG,CAAC,CAAgB,CAAC;AAClD,CAAC;AAXD,wCAWC;AAED;;;;;;;GAOG;AACH,SAAgB,kBAAkB,CAChC,KAAa,EACb,OAAoB;IAEpB,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;IAEjE,IAAI,OAAO,KAAK,YAAY,EAAE;QAC5B,OAAO,WAA0B,CAAC;KACnC;IACD,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,OAA4B,CAAC,CAAC;IACnE,OAAO,OAAO,CAAC,YAAY,GAAG,CAAC,CAAgB,CAAC;AAClD,CAAC;AAXD,gDAWC"}
|
|
@@ -1,56 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
});
|
|
13
|
-
Object.
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
18
17
|
});
|
|
19
|
-
var
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.getPreviousSibling = exports.getNextSibling = void 0;
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
28
|
+
const dom_query_1 = require("./dom-query");
|
|
29
|
+
Object.defineProperty(exports, "getNextSibling", { enumerable: true, get: function () { return dom_query_1.getNextSibling; } });
|
|
30
|
+
Object.defineProperty(exports, "getPreviousSibling", { enumerable: true, get: function () { return dom_query_1.getPreviousSibling; } });
|
|
31
|
+
const FocusTrapWrapper = ({ children, closePopup = null, focusElements = ["button", "a", "input", "select"], id }) => {
|
|
32
|
+
const queryId = focusElements
|
|
33
|
+
.map(el => `#${id}-focus-trap ${el}:not([disabled])`)
|
|
34
|
+
.join(", ");
|
|
35
|
+
const handleKeyDown = (0, react_1.useCallback)(e => {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
const element = e.target;
|
|
38
|
+
switch (e.key) {
|
|
39
|
+
case "Escape":
|
|
40
|
+
closePopup();
|
|
41
|
+
break;
|
|
42
|
+
case "Tab":
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
if (e.shiftKey) {
|
|
45
|
+
(_a = (0, dom_query_1.getPreviousSibling)(queryId, element)) === null || _a === void 0 ? void 0 : _a.focus();
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
(_b = (0, dom_query_1.getNextSibling)(queryId, element)) === null || _b === void 0 ? void 0 : _b.focus();
|
|
49
|
+
}
|
|
50
|
+
break;
|
|
51
|
+
default:
|
|
44
52
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
}, [closePopup]);
|
|
49
|
-
return /*#__PURE__*/_react.default.createElement("div", {
|
|
50
|
-
id: `${id}-focus-trap`,
|
|
51
|
-
onKeyDown: handleKeyDown,
|
|
52
|
-
role: "presentation"
|
|
53
|
-
}, children);
|
|
53
|
+
}, [closePopup]);
|
|
54
|
+
return (react_1.default.createElement("div", { id: `${id}-focus-trap`, onKeyDown: handleKeyDown, role: "presentation" }, children));
|
|
54
55
|
};
|
|
55
|
-
|
|
56
|
+
exports.default = FocusTrapWrapper;
|
|
56
57
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/focus-trap-wrapper/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAsD;AACtD,2CAAiE;AA4CxD,+FA5CA,0BAAc,OA4CA;AAAE,mGA5CA,8BAAkB,OA4CA;AA1C3C,MAAM,gBAAgB,GAAG,CAAC,EACxB,QAAQ,EACR,UAAU,GAAG,IAAI,EACjB,aAAa,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,CAAC,EAClD,EAAE,EAMH,EAAe,EAAE;IAChB,MAAM,OAAO,GAAG,aAAa;SAC1B,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,eAAe,EAAE,kBAAkB,CAAC;SACpD,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,MAAM,aAAa,GAAG,IAAA,mBAAW,EAC/B,CAAC,CAAC,EAAE;;QACF,MAAM,OAAO,GAAG,CAAC,CAAC,MAAqB,CAAC;QACxC,QAAQ,CAAC,CAAC,GAAG,EAAE;YACb,KAAK,QAAQ;gBACX,UAAU,EAAE,CAAC;gBACb,MAAM;YACR,KAAK,KAAK;gBACR,CAAC,CAAC,cAAc,EAAE,CAAC;gBACnB,IAAI,CAAC,CAAC,QAAQ,EAAE;oBACd,MAAA,IAAA,8BAAkB,EAAC,OAAO,EAAE,OAAO,CAAC,0CAAE,KAAK,EAAE,CAAC;iBAC/C;qBAAM;oBACL,MAAA,IAAA,0BAAc,EAAC,OAAO,EAAE,OAAO,CAAC,0CAAE,KAAK,EAAE,CAAC;iBAC3C;gBACD,MAAM;YACR,QAAQ;SACT;IACH,CAAC,EACD,CAAC,UAAU,CAAC,CACb,CAAC;IAEF,OAAO,CACL,uCAAK,EAAE,EAAE,GAAG,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,IAAI,EAAC,cAAc,IACvE,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC;AAIF,kBAAe,gBAAgB,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -1,45 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Object.
|
|
5
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
6
17
|
});
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
return _focusTrapWrapper.default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
exports.default = void 0;
|
|
20
|
-
Object.defineProperty(exports, "getNextSibling", {
|
|
21
|
-
enumerable: true,
|
|
22
|
-
get: function () {
|
|
23
|
-
return _focusTrapWrapper.getNextSibling;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
Object.defineProperty(exports, "getPreviousSibling", {
|
|
27
|
-
enumerable: true,
|
|
28
|
-
get: function () {
|
|
29
|
-
return _focusTrapWrapper.getPreviousSibling;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
var _blue = _interopRequireDefault(require("./colors/blue"));
|
|
33
|
-
var _red = _interopRequireDefault(require("./colors/red"));
|
|
34
|
-
var _grey = _interopRequireDefault(require("./colors/grey"));
|
|
35
|
-
var _dropdown = _interopRequireDefault(require("./dropdown"));
|
|
36
|
-
var _focusTrapWrapper = _interopRequireWildcard(require("./focus-trap-wrapper"));
|
|
37
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
38
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
39
|
-
// TODO: Fix exports
|
|
40
|
-
var _default = exports.default = {
|
|
41
|
-
blue: _blue.default,
|
|
42
|
-
red: _red.default,
|
|
43
|
-
grey: _grey.default
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
44
27
|
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.getPreviousSibling = exports.getNextSibling = exports.FocusTrapWrapper = exports.Dropdown = void 0;
|
|
30
|
+
const blue_1 = __importDefault(require("./colors/blue"));
|
|
31
|
+
const red_1 = __importDefault(require("./colors/red"));
|
|
32
|
+
const grey_1 = __importDefault(require("./colors/grey"));
|
|
33
|
+
const dropdown_1 = __importDefault(require("./dropdown"));
|
|
34
|
+
exports.Dropdown = dropdown_1.default;
|
|
35
|
+
const focus_trap_wrapper_1 = __importStar(require("./focus-trap-wrapper"));
|
|
36
|
+
exports.FocusTrapWrapper = focus_trap_wrapper_1.default;
|
|
37
|
+
Object.defineProperty(exports, "getNextSibling", { enumerable: true, get: function () { return focus_trap_wrapper_1.getNextSibling; } });
|
|
38
|
+
Object.defineProperty(exports, "getPreviousSibling", { enumerable: true, get: function () { return focus_trap_wrapper_1.getPreviousSibling; } });
|
|
39
|
+
exports.default = { blue: blue_1.default, red: red_1.default, grey: grey_1.default };
|
|
45
40
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAAiC;AACjC,uDAA+B;AAC/B,yDAAiC;AACjC,0DAAkC;AAOzB,mBAPF,kBAAQ,CAOE;AANjB,2EAG8B;AAGX,2BANZ,4BAAgB,CAMY;AAAE,+FALnC,mCAAc,OAKmC;AAAE,mGAJnD,uCAAkB,OAImD;AACvE,kBAAe,EAAE,IAAI,EAAJ,cAAI,EAAE,GAAG,EAAH,aAAG,EAAE,IAAI,EAAJ,cAAI,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPalette.d.ts","sourceRoot":"","sources":["../../src/stories/ColorPalette.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ColorPalette.d.ts","sourceRoot":"","sources":["../../src/stories/ColorPalette.tsx"],"names":[],"mappings":";AAOA,MAAM,WAAW,GAAG;IAClB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;CACvB;AAED,UAAU,KAAK;IACb,KAAK,EAAE,GAAG,CAAC;CACZ;AA0BD,QAAA,MAAM,YAAY,cAAe,KAAK,KAAG,WAiBxC,CAAC;AACF,eAAe,YAAY,CAAC"}
|
|
@@ -1,27 +1,41 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
const core_utils_1 = __importDefault(require("@opentripplanner/core-utils"));
|
|
9
|
+
const { getMostReadableTextColor } = core_utils_1.default.route;
|
|
10
|
+
const ColorBlock = styled_components_1.default.div `
|
|
11
|
+
align-items: center;
|
|
12
|
+
background-color: ${props => props.hex};
|
|
13
|
+
color: ${props => getMostReadableTextColor(props.hex, "#ffffff")};
|
|
14
|
+
text-shadow: ${props => getMostReadableTextColor(props.hex, "#ffffff") === "#ffffff"
|
|
15
|
+
? "1px 1px 2px black"
|
|
16
|
+
: ""};
|
|
17
|
+
display: flex;
|
|
18
|
+
font-family: Arial, Helvetica, sans-serif;
|
|
19
|
+
height: 40px;
|
|
20
|
+
justify-content: space-between;
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 10px;
|
|
23
|
+
width: 300px;
|
|
2
24
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}) => {
|
|
18
|
-
const colorArray = Object.entries(color);
|
|
19
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, colorArray.map(hue => {
|
|
20
|
-
return /*#__PURE__*/_react.default.createElement(ColorBlock, {
|
|
21
|
-
key: hue[0],
|
|
22
|
-
hex: hue[1]
|
|
23
|
-
}, /*#__PURE__*/_react.default.createElement("p", null, hue[0]), /*#__PURE__*/_react.default.createElement("p", null, hue[1]));
|
|
24
|
-
}));
|
|
25
|
+
&:first-of-type {
|
|
26
|
+
border-radius: 8px 8px 0 0;
|
|
27
|
+
}
|
|
28
|
+
&:last-of-type {
|
|
29
|
+
border-radius: 0 0 8px 8px;
|
|
30
|
+
}
|
|
31
|
+
`;
|
|
32
|
+
const ColorPalette = ({ color }) => {
|
|
33
|
+
const colorArray = Object.entries(color);
|
|
34
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, colorArray.map((hue) => {
|
|
35
|
+
return (react_1.default.createElement(ColorBlock, { key: hue[0], hex: hue[1] },
|
|
36
|
+
react_1.default.createElement("p", null, hue[0]),
|
|
37
|
+
react_1.default.createElement("p", null, hue[1])));
|
|
38
|
+
})));
|
|
25
39
|
};
|
|
26
|
-
|
|
40
|
+
exports.default = ColorPalette;
|
|
27
41
|
//# sourceMappingURL=ColorPalette.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPalette.js","
|
|
1
|
+
{"version":3,"file":"ColorPalette.js","sourceRoot":"","sources":["../../src/stories/ColorPalette.tsx"],"names":[],"mappings":";;;;;AAAA,kDAA0B;AAE1B,0EAAuC;AACvC,6EAAoD;AAEpD,MAAM,EAAE,wBAAwB,EAAE,GAAG,oBAAS,CAAC,KAAK,CAAC;AAUrD,MAAM,UAAU,GAAG,2BAAM,CAAC,GAAG,CAAiB;;sBAExB,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG;WAC7B,KAAK,CAAC,EAAE,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC;iBACjD,KAAK,CAAC,EAAE,CACrB,wBAAwB,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,KAAK,SAAS;IAC1D,CAAC,CAAC,mBAAmB;IACrB,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;CAeT,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,EAAE,KAAK,EAAS,EAAe,EAAE;IACrD,MAAM,UAAU,GAAe,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAErD,OAAO,CACL,8DACG,UAAU,CAAC,GAAG,CACb,CAAC,GAAQ,EAAe,EAAE;QACxB,OAAO,CACL,8BAAC,UAAU,IAAC,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;YAClC,yCAAI,GAAG,CAAC,CAAC,CAAC,CAAK;YACf,yCAAI,GAAG,CAAC,CAAC,CAAC,CAAK,CACJ,CACd,CAAC;IACJ,CAAC,CACF,CACA,CACJ,CAAC;AACJ,CAAC,CAAC;AACF,kBAAe,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opentripplanner/building-blocks",
|
|
3
|
-
"version": "3.0.1",
|
|
3
|
+
"version": "3.0.2-alpha.1",
|
|
4
4
|
"description": "Styling and UI Component Library",
|
|
5
5
|
"author": "@binh-dam-ibigroup",
|
|
6
6
|
"homepage": "https://github.com/opentripplanner/otp-ui/#readme",
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
"module": "esm/index.js",
|
|
10
10
|
"private": false,
|
|
11
11
|
"devDependencies": {
|
|
12
|
-
"@opentripplanner/types": "
|
|
13
|
-
"@opentripplanner/core-utils": "
|
|
12
|
+
"@opentripplanner/types": "9.0.0-alpha.1",
|
|
13
|
+
"@opentripplanner/core-utils": "15.0.0-alpha.1"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"react": "^18.2.0",
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
|
|
3
3
|
import styled from "styled-components";
|
|
4
|
-
import
|
|
4
|
+
import coreUtils from "@opentripplanner/core-utils";
|
|
5
|
+
|
|
6
|
+
const { getMostReadableTextColor } = coreUtils.route;
|
|
5
7
|
|
|
6
8
|
export interface Hue {
|
|
7
9
|
[key: number]: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { ReactElement } from "react";
|
|
2
|
-
import { Meta } from "@storybook/react";
|
|
2
|
+
import { Meta } from "@storybook/react-vite";
|
|
3
3
|
import { ExclamationTriangle } from "@styled-icons/bootstrap/ExclamationTriangle";
|
|
4
4
|
import Alert from "../alert/Alert";
|
|
5
5
|
import red from "../colors/red";
|