@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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_domQuery","_styled","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","Dropdown","alignMenuLeft","children","className","id","label","listLabel","text","buttonStyle","open","setOpen","useState","containerRef","useRef","toggleOpen","useCallback","queryId","isList","Array","isArray","every","child","React","isValidElement","type","useEffect","handleExternalAction","_containerRef$current","current","contains","target","document","addEventListener","removeEventListener","handleKeyDown","_getPreviousSibling","_getNextSibling","element","key","preventDefault","getPreviousSibling","focus","getNextSibling","click","createElement","DropdownWrapper","onKeyDown","ref","DropdownButton","undefined","onClick","style","title","role","DropdownMenu","as","alignLeft","tabIndex","_default","exports"],"sources":["../../src/dropdown/index.tsx"],"sourcesContent":["import React, {\n HTMLAttributes,\n KeyboardEvent,\n useCallback,\n useEffect,\n useRef,\n useState\n} from \"react\";\n\nimport {\n getNextSibling,\n getPreviousSibling\n} from \"../focus-trap-wrapper/dom-query\";\nimport { DropdownButton, DropdownMenu, DropdownWrapper } from \"./styled\";\n\nexport interface Props extends HTMLAttributes<HTMLElement> {\n alignMenuLeft?: boolean;\n buttonStyle?: React.CSSProperties;\n label?: string;\n listLabel?: string;\n text?: JSX.Element | string;\n nav?: boolean;\n}\n\n/**\n * Renders a dropdown menu. By default, only a passed \"text\" is rendered. If clicked,\n * a floating div is rendered below the \"text\" with list contents inside. Clicking anywhere\n * outside the floating div will close the dropdown.\n */\nconst Dropdown = ({\n alignMenuLeft,\n children,\n className,\n id,\n label,\n listLabel,\n text,\n buttonStyle\n}: Props): JSX.Element => {\n const [open, setOpen] = useState(false);\n\n const containerRef = useRef<HTMLSpanElement>(null);\n\n const toggleOpen = useCallback(() => setOpen(!open), [open, setOpen]);\n\n // Argument for document.querySelectorAll to target focusable elements.\n const queryId = `#${id} button, #${id}-label`;\n\n const isList = Array.isArray(children)\n ? children.every(\n child => React.isValidElement(child) && child.type === \"li\"\n )\n : React.isValidElement(children) && children.type === \"li\";\n\n // Adding document event listeners allows us to close the dropdown\n // when the user interacts with any part of the page that isn't the dropdown\n useEffect(() => {\n const handleExternalAction = (e: Event): void => {\n if (!containerRef?.current?.contains(e.target as HTMLElement)) {\n setOpen(false);\n }\n };\n document.addEventListener(\"mousedown\", handleExternalAction);\n document.addEventListener(\"focusin\", handleExternalAction);\n document.addEventListener(\"keydown\", handleExternalAction);\n return () => {\n document.removeEventListener(\"mousedown\", handleExternalAction);\n document.removeEventListener(\"focusin\", handleExternalAction);\n document.removeEventListener(\"keydown\", handleExternalAction);\n };\n }, [containerRef]);\n\n const handleKeyDown = useCallback(\n (e: KeyboardEvent): void => {\n const element = e.target as HTMLElement;\n switch (e.key) {\n case \"ArrowUp\":\n e.preventDefault();\n getPreviousSibling(queryId, element)?.focus();\n break;\n case \"ArrowDown\":\n e.preventDefault();\n getNextSibling(queryId, element)?.focus();\n break;\n case \"Escape\":\n setOpen(false);\n break;\n case \" \":\n case \"Enter\":\n e.preventDefault();\n element.click();\n if (element.id === `${id}-label` || element.id === `${id}-wrapper`) {\n toggleOpen();\n }\n break;\n default:\n }\n },\n [id, toggleOpen]\n );\n\n return (\n <DropdownWrapper\n className={className}\n id={`${id}-wrapper`}\n onKeyDown={handleKeyDown}\n ref={containerRef}\n >\n <DropdownButton\n // Only set aria-controls when the dropdown is open\n // (otherwise, assistive technologies may not announce the dropdown correctly).\n aria-controls={open ? id : undefined}\n aria-expanded={open}\n aria-haspopup=\"listbox\"\n aria-label={label}\n id={`${id}-label`}\n onClick={toggleOpen}\n style={buttonStyle}\n title={label}\n type=\"button\"\n >\n <span>{text}</span>\n <span className=\"caret\" role=\"presentation\" />\n </DropdownButton>\n {open && (\n <DropdownMenu\n as={isList && \"ul\"}\n aria-label={listLabel}\n aria-labelledby={listLabel ? undefined : `${id}-label`}\n id={id}\n onClick={toggleOpen}\n alignLeft={alignMenuLeft}\n role={isList && \"listbox\"}\n tabIndex={-1}\n >\n {children}\n </DropdownMenu>\n )}\n </DropdownWrapper>\n );\n};\n\nexport default Dropdown;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AASA,IAAAC,SAAA,GAAAD,OAAA;AAIA,IAAAE,OAAA,GAAAF,OAAA;AAAyE,SAAAG,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAA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AAQ,CAAC"}
@@ -1,22 +1,75 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
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
- var _styledComponents = _interopRequireDefault(require("styled-components"));
9
- var _grey = _interopRequireDefault(require("../colors/grey"));
10
- const DropdownButton = exports.DropdownButton = _styledComponents.default.button.withConfig({
11
- displayName: "styled__DropdownButton",
12
- componentId: "sc-kes9ha-0"
13
- })(["background:#fff;border:1px solid black;border-radius:5px;color:inherit;padding:5px 7px;transition:all 0.1s ease-in-out;span.caret{border-left:4px solid transparent;border-right:4px solid transparent;border-top:4px solid;color:inherit;display:inline-block;height:0;margin-left:5px;vertical-align:middle;width:0;}&:hover,&[aria-expanded=\"true\"]{background:", ";color:black;cursor:pointer;}"], _grey.default[50]);
14
- const DropdownMenu = exports.DropdownMenu = _styledComponents.default.div.withConfig({
15
- displayName: "styled__DropdownMenu",
16
- componentId: "sc-kes9ha-1"
17
- })(["background-clip:padding-box;background-color:#fff;border-radius:4px;border:1px solid rgba(0,0,0,0.15);box-shadow:0 6px 12px rgba(0,0,0,0.175);color:#333;list-style:none;margin:2px 0 0;min-width:160px;padding:5px 0;position:absolute;", " top:100%;width:100%;z-index:1000;hr{margin:0;padding:0;}a,button{background:transparent;border:none;cursor:pointer;padding:5px 15px;text-align:start;width:100%;&:hover{background:", ";}}"], props => props.alignLeft ? "left: 0;" : "right: 0;", _grey.default[50]);
18
- const DropdownWrapper = exports.DropdownWrapper = _styledComponents.default.span.withConfig({
19
- displayName: "styled__DropdownWrapper",
20
- componentId: "sc-kes9ha-2"
21
- })(["float:", ";position:relative;"], props => props.pullRight ? "right" : "left");
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","names":["_styledComponents","_interopRequireDefault","require","_grey","DropdownButton","exports","styled","button","withConfig","displayName","componentId","grey","DropdownMenu","div","props","alignLeft","DropdownWrapper","span","pullRight"],"sources":["../../src/dropdown/styled.tsx"],"sourcesContent":["import styled from \"styled-components\";\nimport grey from \"../colors/grey\";\n\nexport const DropdownButton = styled.button`\n background: #fff;\n border: 1px solid black;\n border-radius: 5px;\n color: inherit;\n padding: 5px 7px;\n transition: all 0.1s ease-in-out;\n\n span.caret {\n border-left: 4px solid transparent;\n border-right: 4px solid transparent;\n border-top: 4px solid;\n color: inherit;\n display: inline-block;\n height: 0;\n margin-left: 5px;\n vertical-align: middle;\n width: 0;\n }\n\n &:hover,\n &[aria-expanded=\"true\"] {\n background: ${grey[50]};\n color: black;\n cursor: pointer;\n }\n`;\n\nexport const DropdownMenu = styled.div<{ alignLeft?: boolean }>`\n background-clip: padding-box;\n background-color: #fff;\n border-radius: 4px;\n border: 1px solid rgba(0, 0, 0, 0.15);\n box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);\n color: #333;\n list-style: none;\n margin: 2px 0 0;\n min-width: 160px;\n padding: 5px 0;\n position: absolute;\n ${props => (props.alignLeft ? \"left: 0;\" : \"right: 0;\")}\n top: 100%;\n width: 100%;\n z-index: 1000;\n\n hr {\n margin: 0;\n padding: 0;\n }\n a,\n button {\n background: transparent;\n border: none;\n cursor: pointer;\n padding: 5px 15px;\n text-align: start;\n width: 100%;\n\n &:hover {\n background: ${grey[50]};\n }\n }\n`;\n\nexport const DropdownWrapper = styled.span<{ pullRight?: boolean }>`\n float: ${props => (props.pullRight ? \"right\" : \"left\")};\n position: relative;\n`;\n"],"mappings":";;;;;;;AAAA,IAAAA,iBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,KAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEO,MAAME,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAGE,yBAAM,CAACC,MAAM,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,8YAsBzBC,aAAI,CAAC,EAAE,CAAC,CAIzB;AAEM,MAAMC,YAAY,GAAAP,OAAA,CAAAO,YAAA,GAAGN,yBAAM,CAACO,GAAG,CAAAL,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,gbAYlCI,KAAK,IAAKA,KAAK,CAACC,SAAS,GAAG,UAAU,GAAG,WAAY,EAmBrCJ,aAAI,CAAC,EAAE,CAAC,CAG3B;AAEM,MAAMK,eAAe,GAAAX,OAAA,CAAAW,eAAA,GAAGV,yBAAM,CAACW,IAAI,CAAAT,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,sCAC/BI,KAAK,IAAKA,KAAK,CAACI,SAAS,GAAG,OAAO,GAAG,MAAO,CAEvD","ignoreList":[]}
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
- Object.defineProperty(exports, "__esModule", {
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
- const entries = Array.from(document.querySelectorAll(query));
10
- const firstElement = entries[0];
11
- const lastElement = entries[entries.length - 1];
12
- return {
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
- const {
29
- entries,
30
- firstElement,
31
- lastElement
32
- } = getEntries(query);
33
- if (element === lastElement) {
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
- const {
50
- entries,
51
- firstElement,
52
- lastElement
53
- } = getEntries(query);
54
- if (element === firstElement) {
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","names":["getEntries","query","entries","Array","from","document","querySelectorAll","firstElement","lastElement","length","getNextSibling","element","elementIndex","indexOf","getPreviousSibling"],"sources":["../../src/focus-trap-wrapper/dom-query.ts"],"sourcesContent":["function getEntries(query: string) {\n const entries = Array.from(document.querySelectorAll(query));\n const firstElement = entries[0];\n const lastElement = entries[entries.length - 1];\n\n return { entries, firstElement, lastElement };\n}\n\n/**\n * Helper method to find the next focusable sibling element relative to the\n * specified element.\n *\n * @param {string} query - Argument that gets passed to document.querySelectorAll\n * @param {HTMLElement} element - Specified element (e.target)\n * @returns {HTMLElement} - element to be focused\n */\nexport function getNextSibling(\n query: string,\n element: EventTarget\n): HTMLElement {\n const { entries, firstElement, lastElement } = getEntries(query);\n\n if (element === lastElement) {\n return firstElement as HTMLElement;\n }\n const elementIndex = entries.indexOf(element as HTMLElement);\n return entries[elementIndex + 1] as HTMLElement;\n}\n\n/**\n * Helper method to find the previous focusable sibling element relative to the\n * specified element.\n *\n * @param {string} query - Argument that gets passed to document.querySelectorAll\n * @param {HTMLElement} element - Specified element (e.target)\n * @returns {HTMLElement} - element to be focused\n */\nexport function getPreviousSibling(\n query: string,\n element: EventTarget\n): HTMLElement {\n const { entries, firstElement, lastElement } = getEntries(query);\n\n if (element === firstElement) {\n return lastElement as HTMLElement;\n }\n const elementIndex = entries.indexOf(element as HTMLButtonElement);\n return entries[elementIndex - 1] as HTMLElement;\n}\n"],"mappings":";;;;;;;AAAA,SAASA,UAAUA,CAACC,KAAa,EAAE;EACjC,MAAMC,OAAO,GAAGC,KAAK,CAACC,IAAI,CAACC,QAAQ,CAACC,gBAAgB,CAACL,KAAK,CAAC,CAAC;EAC5D,MAAMM,YAAY,GAAGL,OAAO,CAAC,CAAC,CAAC;EAC/B,MAAMM,WAAW,GAAGN,OAAO,CAACA,OAAO,CAACO,MAAM,GAAG,CAAC,CAAC;EAE/C,OAAO;IAAEP,OAAO;IAAEK,YAAY;IAAEC;EAAY,CAAC;AAC/C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAC5BT,KAAa,EACbU,OAAoB,EACP;EACb,MAAM;IAAET,OAAO;IAAEK,YAAY;IAAEC;EAAY,CAAC,GAAGR,UAAU,CAACC,KAAK,CAAC;EAEhE,IAAIU,OAAO,KAAKH,WAAW,EAAE;IAC3B,OAAOD,YAAY;EACrB;EACA,MAAMK,YAAY,GAAGV,OAAO,CAACW,OAAO,CAACF,OAAsB,CAAC;EAC5D,OAAOT,OAAO,CAACU,YAAY,GAAG,CAAC,CAAC;AAClC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,kBAAkBA,CAChCb,KAAa,EACbU,OAAoB,EACP;EACb,MAAM;IAAET,OAAO;IAAEK,YAAY;IAAEC;EAAY,CAAC,GAAGR,UAAU,CAACC,KAAK,CAAC;EAEhE,IAAIU,OAAO,KAAKJ,YAAY,EAAE;IAC5B,OAAOC,WAAW;EACpB;EACA,MAAMI,YAAY,GAAGV,OAAO,CAACW,OAAO,CAACF,OAA4B,CAAC;EAClE,OAAOT,OAAO,CAACU,YAAY,GAAG,CAAC,CAAC;AAClC","ignoreList":[]}
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
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- Object.defineProperty(exports, "getNextSibling", {
8
- enumerable: true,
9
- get: function () {
10
- return _domQuery.getNextSibling;
11
- }
12
- });
13
- Object.defineProperty(exports, "getPreviousSibling", {
14
- enumerable: true,
15
- get: function () {
16
- return _domQuery.getPreviousSibling;
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 _react = _interopRequireWildcard(require("react"));
20
- var _domQuery = require("./dom-query");
21
- 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); }
22
- 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; }
23
- const FocusTrapWrapper = ({
24
- children,
25
- closePopup = null,
26
- focusElements = ["button", "a", "input", "select"],
27
- id
28
- }) => {
29
- const queryId = focusElements.map(el => `#${id}-focus-trap ${el}:not([disabled])`).join(", ");
30
- const handleKeyDown = (0, _react.useCallback)(e => {
31
- const element = e.target;
32
- switch (e.key) {
33
- case "Escape":
34
- closePopup();
35
- break;
36
- case "Tab":
37
- e.preventDefault();
38
- if (e.shiftKey) {
39
- var _getPreviousSibling;
40
- (_getPreviousSibling = (0, _domQuery.getPreviousSibling)(queryId, element)) === null || _getPreviousSibling === void 0 || _getPreviousSibling.focus();
41
- } else {
42
- var _getNextSibling;
43
- (_getNextSibling = (0, _domQuery.getNextSibling)(queryId, element)) === null || _getNextSibling === void 0 || _getNextSibling.focus();
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
- break;
46
- default:
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
- var _default = exports.default = FocusTrapWrapper;
56
+ exports.default = FocusTrapWrapper;
56
57
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_react","_interopRequireWildcard","require","_domQuery","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","FocusTrapWrapper","children","closePopup","focusElements","id","queryId","map","el","join","handleKeyDown","useCallback","element","target","key","preventDefault","shiftKey","_getPreviousSibling","getPreviousSibling","focus","_getNextSibling","getNextSibling","createElement","onKeyDown","role","_default","exports"],"sources":["../../src/focus-trap-wrapper/index.tsx"],"sourcesContent":["import React, { ReactNode, useCallback } from \"react\";\nimport { getNextSibling, getPreviousSibling } from \"./dom-query\";\n\nconst FocusTrapWrapper = ({\n children,\n closePopup = null,\n focusElements = [\"button\", \"a\", \"input\", \"select\"],\n id\n}: {\n children: ReactNode | ReactNode[];\n closePopup?: (arg?: boolean) => void;\n id: string;\n focusElements?: string[];\n}): JSX.Element => {\n const queryId = focusElements\n .map(el => `#${id}-focus-trap ${el}:not([disabled])`)\n .join(\", \");\n const handleKeyDown = useCallback(\n e => {\n const element = e.target as HTMLElement;\n switch (e.key) {\n case \"Escape\":\n closePopup();\n break;\n case \"Tab\":\n e.preventDefault();\n if (e.shiftKey) {\n getPreviousSibling(queryId, element)?.focus();\n } else {\n getNextSibling(queryId, element)?.focus();\n }\n break;\n default:\n }\n },\n [closePopup]\n );\n\n return (\n <div id={`${id}-focus-trap`} onKeyDown={handleKeyDown} role=\"presentation\">\n {children}\n </div>\n );\n};\n\nexport { getNextSibling, getPreviousSibling };\n\nexport default FocusTrapWrapper;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,SAAA,GAAAD,OAAA;AAAiE,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA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C1B,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
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
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
- Object.defineProperty(exports, "Dropdown", {
8
- enumerable: true,
9
- get: function () {
10
- return _dropdown.default;
11
- }
12
- });
13
- Object.defineProperty(exports, "FocusTrapWrapper", {
14
- enumerable: true,
15
- get: function () {
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","names":["_blue","_interopRequireDefault","require","_red","_grey","_dropdown","_focusTrapWrapper","_interopRequireWildcard","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","_default","exports","blue","red","grey"],"sources":["../src/index.ts"],"sourcesContent":["import blue from \"./colors/blue\";\nimport red from \"./colors/red\";\nimport grey from \"./colors/grey\";\nimport Dropdown from \"./dropdown\";\nimport FocusTrapWrapper, {\n getNextSibling,\n getPreviousSibling\n} from \"./focus-trap-wrapper\";\n\n// TODO: Fix exports\nexport { Dropdown, FocusTrapWrapper, getNextSibling, getPreviousSibling };\nexport default { blue, red, grey };\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,IAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,KAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,SAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,iBAAA,GAAAC,uBAAA,CAAAL,OAAA;AAG8B,SAAAM,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAF,wBAAAE,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,WAAAK,OAAA,EAAAL,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,CAAAH,OAAA,GAAAL,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,CAAA,EAAAQ,CAAA,GAAAA,CAAA;AAE9B;AAAA,IAAAW,QAAA,GAAAC,OAAA,CAAAf,OAAA,GAEe;EAAEgB,IAAI,EAAJA,aAAI;EAAEC,GAAG,EAAHA,YAAG;EAAEC,IAAI,EAAJA;AAAK,CAAC","ignoreList":[]}
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":";AAKA,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
+ {"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
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireDefault(require("react"));
9
- var _styledComponents = _interopRequireDefault(require("styled-components"));
10
- var _route = require("@opentripplanner/core-utils/lib/route");
11
- const ColorBlock = _styledComponents.default.div.withConfig({
12
- displayName: "ColorPalette__ColorBlock",
13
- componentId: "sc-fil65c-0"
14
- })(["align-items:center;background-color:", ";color:", ";text-shadow:", ";display:flex;font-family:Arial,Helvetica,sans-serif;height:40px;justify-content:space-between;margin:0;padding:10px;width:300px;&:first-of-type{border-radius:8px 8px 0 0;}&:last-of-type{border-radius:0 0 8px 8px;}"], props => props.hex, props => (0, _route.getMostReadableTextColor)(props.hex, "#ffffff"), props => (0, _route.getMostReadableTextColor)(props.hex, "#ffffff") === "#ffffff" ? "1px 1px 2px black" : "");
15
- const ColorPalette = ({
16
- color
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
- var _default = exports.default = ColorPalette;
40
+ exports.default = ColorPalette;
27
41
  //# sourceMappingURL=ColorPalette.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPalette.js","names":["_react","_interopRequireDefault","require","_styledComponents","_route","ColorBlock","styled","div","withConfig","displayName","componentId","props","hex","getMostReadableTextColor","ColorPalette","color","colorArray","Object","entries","default","createElement","Fragment","map","hue","key","_default","exports"],"sources":["../../src/stories/ColorPalette.tsx"],"sourcesContent":["import React from \"react\";\n\nimport styled from \"styled-components\";\nimport { getMostReadableTextColor } from \"@opentripplanner/core-utils/lib/route\";\n\nexport interface Hue {\n [key: number]: string;\n}\n\ninterface Props {\n color: Hue;\n}\n\nconst ColorBlock = styled.div<{ hex: string }>`\n align-items: center;\n background-color: ${props => props.hex};\n color: ${props => getMostReadableTextColor(props.hex, \"#ffffff\")};\n text-shadow: ${props =>\n getMostReadableTextColor(props.hex, \"#ffffff\") === \"#ffffff\"\n ? \"1px 1px 2px black\"\n : \"\"};\n display: flex;\n font-family: Arial, Helvetica, sans-serif;\n height: 40px;\n justify-content: space-between;\n margin: 0;\n padding: 10px;\n width: 300px;\n\n &:first-of-type {\n border-radius: 8px 8px 0 0;\n }\n &:last-of-type {\n border-radius: 0 0 8px 8px;\n }\n`;\n\nconst ColorPalette = ({ color }: Props): JSX.Element => {\n const colorArray: Array<Hue> = Object.entries(color);\n\n return (\n <>\n {colorArray.map(\n (hue: Hue): JSX.Element => {\n return (\n <ColorBlock key={hue[0]} hex={hue[1]}>\n <p>{hue[0]}</p>\n <p>{hue[1]}</p>\n </ColorBlock>\n );\n }\n )}\n </>\n );\n};\nexport default ColorPalette;\n"],"mappings":";;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,iBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AAUA,MAAMG,UAAU,GAAGC,yBAAM,CAACC,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,mSAEPC,KAAK,IAAIA,KAAK,CAACC,GAAG,EAC7BD,KAAK,IAAI,IAAAE,+BAAwB,EAACF,KAAK,CAACC,GAAG,EAAE,SAAS,CAAC,EACjDD,KAAK,IAClB,IAAAE,+BAAwB,EAACF,KAAK,CAACC,GAAG,EAAE,SAAS,CAAC,KAAK,SAAS,GACxD,mBAAmB,GACnB,EAAE,CAeT;AAED,MAAME,YAAY,GAAGA,CAAC;EAAEC;AAAa,CAAC,KAAkB;EACtD,MAAMC,UAAsB,GAAGC,MAAM,CAACC,OAAO,CAACH,KAAK,CAAC;EAEpD,oBACEf,MAAA,CAAAmB,OAAA,CAAAC,aAAA,CAAApB,MAAA,CAAAmB,OAAA,CAAAE,QAAA,QACGL,UAAU,CAACM,GAAG,CACZC,GAAQ,IAAkB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,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": "6.5.3",
13
- "@opentripplanner/core-utils": "13.0.1"
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 { getMostReadableTextColor } from "@opentripplanner/core-utils/lib/route";
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";