@opentripplanner/building-blocks 3.0.1-alpha.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/esm/dropdown/index.js +3 -2
- package/esm/dropdown/index.js.map +1 -1
- 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.d.ts.map +1 -1
- package/lib/dropdown/index.js +87 -101
- 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/dropdown/index.tsx +2 -1
- package/src/stories/ColorPalette.tsx +3 -1
- package/src/stories/__snapshots__/dropdown.story.tsx.snap +4 -0
- 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
package/esm/dropdown/index.js
CHANGED
|
@@ -91,7 +91,8 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
91
91
|
id: "".concat(id, "-label"),
|
|
92
92
|
onClick: toggleOpen,
|
|
93
93
|
style: buttonStyle,
|
|
94
|
-
title: label
|
|
94
|
+
title: label,
|
|
95
|
+
type: "button"
|
|
95
96
|
}, /*#__PURE__*/React.createElement("span", null, text), /*#__PURE__*/React.createElement("span", {
|
|
96
97
|
className: "caret",
|
|
97
98
|
role: "presentation"
|
|
@@ -102,7 +103,7 @@ var Dropdown = function Dropdown(_ref) {
|
|
|
102
103
|
id: id,
|
|
103
104
|
onClick: toggleOpen,
|
|
104
105
|
alignLeft: alignMenuLeft,
|
|
105
|
-
role: isList && "
|
|
106
|
+
role: isList && "listbox",
|
|
106
107
|
tabIndex: -1
|
|
107
108
|
}, children));
|
|
108
109
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["React","useCallback","useEffect","useRef","useState","getNextSibling","getPreviousSibling","DropdownButton","DropdownMenu","DropdownWrapper","Dropdown","_ref","alignMenuLeft","children","className","id","label","listLabel","text","buttonStyle","_useState","_useState2","_slicedToArray","open","setOpen","containerRef","toggleOpen","queryId","concat","isList","Array","isArray","every","child","isValidElement","type","handleExternalAction","e","_containerRef$current","current","contains","target","document","addEventListener","removeEventListener","handleKeyDown","_getPreviousSibling","_getNextSibling","element","key","preventDefault","focus","click","createElement","onKeyDown","ref","undefined","onClick","style","title","role","as","alignLeft","tabIndex"],"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 >\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 && \"
|
|
1
|
+
{"version":3,"file":"index.js","names":["React","useCallback","useEffect","useRef","useState","getNextSibling","getPreviousSibling","DropdownButton","DropdownMenu","DropdownWrapper","Dropdown","_ref","alignMenuLeft","children","className","id","label","listLabel","text","buttonStyle","_useState","_useState2","_slicedToArray","open","setOpen","containerRef","toggleOpen","queryId","concat","isList","Array","isArray","every","child","isValidElement","type","handleExternalAction","e","_containerRef$current","current","contains","target","document","addEventListener","removeEventListener","handleKeyDown","_getPreviousSibling","_getNextSibling","element","key","preventDefault","focus","click","createElement","onKeyDown","ref","undefined","onClick","style","title","role","as","alignLeft","tabIndex"],"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,OAAOA,KAAK,IAGVC,WAAW,EACXC,SAAS,EACTC,MAAM,EACNC,QAAQ,QACH,OAAO;AAEd,SACEC,cAAc,EACdC,kBAAkB,QACb,iCAAiC;AACxC,SAASC,cAAc,EAAEC,YAAY,EAAEC,eAAe,QAAQ,UAAU;AAWxE;AACA;AACA;AACA;AACA;AACA,IAAMC,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EASY;EAAA,IARxBC,aAAa,GAAAD,IAAA,CAAbC,aAAa;IACbC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,EAAE,GAAAJ,IAAA,CAAFI,EAAE;IACFC,KAAK,GAAAL,IAAA,CAALK,KAAK;IACLC,SAAS,GAAAN,IAAA,CAATM,SAAS;IACTC,IAAI,GAAAP,IAAA,CAAJO,IAAI;IACJC,WAAW,GAAAR,IAAA,CAAXQ,WAAW;EAEX,IAAAC,SAAA,GAAwBhB,QAAQ,CAAC,KAAK,CAAC;IAAAiB,UAAA,GAAAC,cAAA,CAAAF,SAAA;IAAhCG,IAAI,GAAAF,UAAA;IAAEG,OAAO,GAAAH,UAAA;EAEpB,IAAMI,YAAY,GAAGtB,MAAM,CAAkB,IAAI,CAAC;EAElD,IAAMuB,UAAU,GAAGzB,WAAW,CAAC;IAAA,OAAMuB,OAAO,CAAC,CAACD,IAAI,CAAC;EAAA,GAAE,CAACA,IAAI,EAAEC,OAAO,CAAC,CAAC;;EAErE;EACA,IAAMG,OAAO,OAAAC,MAAA,CAAOb,EAAE,gBAAAa,MAAA,CAAab,EAAE,WAAQ;EAE7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EvC,WAAY;IACnBwC,KAAK,EAAE3C,KAAM;IACbmB,IAAI,EAAC;EAAQ,gBAEbnC,KAAA,CAAAqD,aAAA,eAAOnC,IAAW,CAAC,eACnBlB,KAAA,CAAAqD,aAAA;IAAMvC,SAAS,EAAC,OAAO;IAAC8C,IAAI,EAAC;EAAc,CAAE,CAC/B,CAAC,EAChBrC,IAAI,iBACHvB,KAAA,CAAAqD,aAAA,CAAC7C,YAAY;IACXqD,EAAE,EAAEhC,MAAM,IAAI,IAAK;IACnB,cAAYZ,SAAU;IACtB,mBAAiBA,SAAS,GAAGuC,SAAS,MAAA5B,MAAA,CAAMb,EAAE,WAAS;IACvDA,EAAE,EAAEA,EAAG;IACP0C,OAAO,EAAE/B,UAAW;IACpBoC,SAAS,EAAElD,aAAc;IACzBgD,IAAI,EAAE/B,MAAM,IAAI,SAAU;IAC1BkC,QAAQ,EAAE,CAAC;EAAE,GAEZlD,QACW,CAED,CAAC;AAEtB,CAAC;AAED,eAAeH,QAAQ","ignoreList":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import styled from "styled-components";
|
|
3
|
-
import
|
|
3
|
+
import coreUtils from "@opentripplanner/core-utils";
|
|
4
|
+
var getMostReadableTextColor = coreUtils.route.getMostReadableTextColor;
|
|
4
5
|
var ColorBlock = styled.div.withConfig({
|
|
5
6
|
displayName: "ColorPalette__ColorBlock",
|
|
6
7
|
componentId: "sc-fil65c-0"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPalette.js","names":["React","styled","getMostReadableTextColor","ColorBlock","div","withConfig","displayName","componentId","props","hex","ColorPalette","_ref","color","colorArray","Object","entries","createElement","Fragment","map","hue","key"],"sources":["../../src/stories/ColorPalette.tsx"],"sourcesContent":["import React from \"react\";\n\nimport styled from \"styled-components\";\nimport
|
|
1
|
+
{"version":3,"file":"ColorPalette.js","names":["React","styled","coreUtils","getMostReadableTextColor","route","ColorBlock","div","withConfig","displayName","componentId","props","hex","ColorPalette","_ref","color","colorArray","Object","entries","createElement","Fragment","map","hue","key"],"sources":["../../src/stories/ColorPalette.tsx"],"sourcesContent":["import React from \"react\";\n\nimport styled from \"styled-components\";\nimport coreUtils from \"@opentripplanner/core-utils\";\n\nconst { getMostReadableTextColor } = coreUtils.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,OAAOA,KAAK,MAAM,OAAO;AAEzB,OAAOC,MAAM,MAAM,mBAAmB;AACtC,OAAOC,SAAS,MAAM,6BAA6B;AAEnD,IAAQC,wBAAwB,GAAKD,SAAS,CAACE,KAAK,CAA5CD,wBAAwB;AAUhC,IAAME,UAAU,GAAGJ,MAAM,CAACK,GAAG,CAAAC,UAAA;EAAAC,WAAA;EAAAC,WAAA;AAAA,mSAEP,UAAAC,KAAK;EAAA,OAAIA,KAAK,CAACC,GAAG;AAAA,GAC7B,UAAAD,KAAK;EAAA,OAAIP,wBAAwB,CAACO,KAAK,CAACC,GAAG,EAAE,SAAS,CAAC;AAAA,GACjD,UAAAD,KAAK;EAAA,OAClBP,wBAAwB,CAACO,KAAK,CAACC,GAAG,EAAE,SAAS,CAAC,KAAK,SAAS,GACxD,mBAAmB,GACnB,EAAE;AAAA,EAeT;AAED,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAAsC;EAAA,IAAhCC,KAAK,GAAAD,IAAA,CAALC,KAAK;EAC3B,IAAMC,UAAsB,GAAGC,MAAM,CAACC,OAAO,CAACH,KAAK,CAAC;EAEpD,oBACEd,KAAA,CAAAkB,aAAA,CAAAlB,KAAA,CAAAmB,QAAA,QACGJ,UAAU,CAACK,GAAG,CACb,UAACC,GAAQ,EAAkB;IACzB,oBACErB,KAAA,CAAAkB,aAAA,CAACb,UAAU;MAACiB,GAAG,EAAED,GAAG,CAAC,CAAC,CAAE;MAACV,GAAG,EAAEU,GAAG,CAAC,CAAC;IAAE,gBACnCrB,KAAA,CAAAkB,aAAA,YAAIG,GAAG,CAAC,CAAC,CAAK,CAAC,eACfrB,KAAA,CAAAkB,aAAA,YAAIG,GAAG,CAAC,CAAC,CAAK,CACJ,CAAC;EAEjB,CACF,CACA,CAAC;AAEP,CAAC;AACD,eAAeT,YAAY","ignoreList":[]}
|
package/lib/alert/Alert.js
CHANGED
|
@@ -1,76 +1,107 @@
|
|
|
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
|
-
var
|
|
10
|
-
var
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
var
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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 };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const react_1 = __importStar(require("react"));
|
|
30
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
31
|
+
const react_animate_height_1 = __importDefault(require("react-animate-height"));
|
|
32
|
+
const ChevronUp_1 = require("@styled-icons/bootstrap/ChevronUp");
|
|
33
|
+
const Bell_1 = require("@styled-icons/bootstrap/Bell");
|
|
34
|
+
const react_intl_1 = require("react-intl");
|
|
35
|
+
const blue_1 = __importDefault(require("../colors/blue"));
|
|
36
|
+
const AlertContainer = styled_components_1.default.div `
|
|
37
|
+
background-color: ${props => props.backgroundColor ? props.backgroundColor : blue_1.default[50]};
|
|
38
|
+
display: grid;
|
|
39
|
+
grid-template-columns: 50px auto auto;
|
|
40
|
+
grid-template-rows: minmax(25px, auto) auto;
|
|
41
|
+
max-width: 715px;
|
|
42
|
+
padding: 1.5em 2em;
|
|
43
|
+
|
|
44
|
+
svg {
|
|
45
|
+
align-self: center;
|
|
46
|
+
grid-column: 1;
|
|
47
|
+
grid-row: 1 / span 2;
|
|
48
|
+
justify-self: start;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
button {
|
|
52
|
+
background: transparent;
|
|
53
|
+
border: none;
|
|
54
|
+
width: 40px;
|
|
55
|
+
|
|
56
|
+
svg {
|
|
57
|
+
transform: ${props => !props.expandAlert && "rotate(180deg)"};
|
|
58
|
+
transition: all 0.2s ease-in;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@media (max-width: 550px) {
|
|
63
|
+
grid-template-columns: 40px auto auto;
|
|
64
|
+
padding: 1.25em 1.25em;
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
const ButtonContainer = styled_components_1.default.span `
|
|
68
|
+
align-items: center;
|
|
69
|
+
display: flex;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
justify-self: right;
|
|
72
|
+
`;
|
|
73
|
+
const AlertHeader = styled_components_1.default.span `
|
|
74
|
+
align-self: center;
|
|
75
|
+
font-weight: 700;
|
|
76
|
+
grid-column: 2;
|
|
77
|
+
`;
|
|
78
|
+
const AlertSubheader = (0, styled_components_1.default)(AlertHeader) `
|
|
79
|
+
font-weight: 400;
|
|
80
|
+
margin-top: 0.3em;
|
|
81
|
+
`;
|
|
82
|
+
const AlertContent = styled_components_1.default.div `
|
|
83
|
+
grid-column: 2;
|
|
84
|
+
grid-row: 3;
|
|
85
|
+
`;
|
|
86
|
+
const ContentPadding = styled_components_1.default.div `
|
|
87
|
+
margin-top: ${props => (props.collapsible ? "1em" : ".5em")};
|
|
88
|
+
`;
|
|
89
|
+
const Alert = ({ alertHeader, alertSubheader, backgroundColor, children, collapsible, Icon = Bell_1.Bell }) => {
|
|
90
|
+
const [expandAlert, setExpandAlert] = (0, react_1.useState)(false);
|
|
91
|
+
const intl = (0, react_intl_1.useIntl)();
|
|
92
|
+
const label = intl.formatMessage({
|
|
93
|
+
id: "otpUi.buildingBlocks.alert.expand",
|
|
94
|
+
defaultMessage: "Expand"
|
|
95
|
+
});
|
|
96
|
+
return (react_1.default.createElement(AlertContainer, { backgroundColor: backgroundColor, expandAlert: expandAlert, collapsible: collapsible },
|
|
97
|
+
react_1.default.createElement(Icon, { size: 24 }),
|
|
98
|
+
react_1.default.createElement(AlertHeader, null, alertHeader),
|
|
99
|
+
react_1.default.createElement(ButtonContainer, null, collapsible && (react_1.default.createElement("button", { type: "button", onClick: () => setExpandAlert(!expandAlert), "aria-label": label, title: label },
|
|
100
|
+
react_1.default.createElement(ChevronUp_1.ChevronUp, { size: 16 })))),
|
|
101
|
+
alertSubheader && react_1.default.createElement(AlertSubheader, null, alertSubheader),
|
|
102
|
+
children && (react_1.default.createElement(AlertContent, null,
|
|
103
|
+
react_1.default.createElement(react_animate_height_1.default, { duration: 500, height: collapsible ? (expandAlert ? "auto" : 0) : "auto" },
|
|
104
|
+
react_1.default.createElement(ContentPadding, { collapsible: collapsible }, children))))));
|
|
74
105
|
};
|
|
75
|
-
|
|
106
|
+
exports.default = Alert;
|
|
76
107
|
//# sourceMappingURL=Alert.js.map
|
package/lib/alert/Alert.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","
|
|
1
|
+
{"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../src/alert/Alert.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAoD;AACpD,0EAAuC;AACvC,gFAAiD;AACjD,iEAA8D;AAC9D,uDAAoD;AAEpD,2CAAqC;AACrC,0DAAkC;AAWlC,MAAM,cAAc,GAAG,2BAAM,CAAC,GAAG,CAI/B;sBACoB,KAAK,CAAC,EAAE,CAC1B,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,cAAI,CAAC,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;mBAoBzC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,IAAI,gBAAgB;;;;;;;;;CASjE,CAAC;AAEF,MAAM,eAAe,GAAG,2BAAM,CAAC,IAAI,CAAA;;;;;CAKlC,CAAC;AAEF,MAAM,WAAW,GAAG,2BAAM,CAAC,IAAI,CAAA;;;;CAI9B,CAAC;AAEF,MAAM,cAAc,GAAG,IAAA,2BAAM,EAAC,WAAW,CAAC,CAAA;;;CAGzC,CAAC;AAEF,MAAM,YAAY,GAAG,2BAAM,CAAC,GAAG,CAAA;;;CAG9B,CAAC;AAEF,MAAM,cAAc,GAAG,2BAAM,CAAC,GAAG,CAE/B;gBACc,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,KAA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,kBAAe,KAAK,CAAC"}
|
package/lib/colors/blue.js
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
3
|
const blue = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
50: "#E5ECF3",
|
|
5
|
+
100: "#CCDAE7",
|
|
6
|
+
200: "#B2C7DB",
|
|
7
|
+
300: "#99B5CF",
|
|
8
|
+
400: "#7FA2C2",
|
|
9
|
+
500: "#6690B7",
|
|
10
|
+
600: "#4D7EAB",
|
|
11
|
+
// 700 and above text is WCAG AA accessible on white backgrounds.
|
|
12
|
+
700: "#336B9E",
|
|
13
|
+
// 800 and above text is WCAG AAA accessible on white backgrounds.
|
|
14
|
+
800: "#1A5992",
|
|
15
|
+
900: "#004686"
|
|
20
16
|
};
|
|
21
|
-
|
|
17
|
+
exports.default = blue;
|
|
22
18
|
//# sourceMappingURL=blue.js.map
|
package/lib/colors/blue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blue.js","
|
|
1
|
+
{"version":3,"file":"blue.js","sourceRoot":"","sources":["../../src/colors/blue.ts"],"names":[],"mappings":";;AAAA,MAAM,IAAI,GAAG;IACX,EAAE,EAAE,SAAS;IACb,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,iEAAiE;IACjE,GAAG,EAAE,SAAS;IACd,kEAAkE;IAClE,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;CACf,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
package/lib/colors/grey.js
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
3
|
const grey = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
50: "#ECECEC",
|
|
5
|
+
100: "#D9D9D9",
|
|
6
|
+
200: "#C5C5C5",
|
|
7
|
+
300: "#B3B3B3",
|
|
8
|
+
400: "#9F9F9F",
|
|
9
|
+
500: "#8C8C8C",
|
|
10
|
+
600: "#797979",
|
|
11
|
+
// 700 and above text is WCAG AA accessible on white backgrounds.
|
|
12
|
+
700: "#666666",
|
|
13
|
+
// 800 and above text is WCAG AAA accessible on white backgrounds.
|
|
14
|
+
800: "#535353",
|
|
15
|
+
900: "#404040"
|
|
20
16
|
};
|
|
21
|
-
|
|
17
|
+
exports.default = grey;
|
|
22
18
|
//# sourceMappingURL=grey.js.map
|
package/lib/colors/grey.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grey.js","
|
|
1
|
+
{"version":3,"file":"grey.js","sourceRoot":"","sources":["../../src/colors/grey.ts"],"names":[],"mappings":";;AAAA,MAAM,IAAI,GAAG;IACX,EAAE,EAAE,SAAS;IACb,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,iEAAiE;IACjE,GAAG,EAAE,SAAS;IACd,kEAAkE;IAClE,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;CACf,CAAC;AAEF,kBAAe,IAAI,CAAC"}
|
package/lib/colors/red.js
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
3
|
const red = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
50: "#F7E7E6",
|
|
5
|
+
100: "#EFCFCE",
|
|
6
|
+
200: "#E7B6B4",
|
|
7
|
+
300: "#DF9E9C",
|
|
8
|
+
400: "#D78683",
|
|
9
|
+
500: "#CF6E6B",
|
|
10
|
+
600: "#C75652",
|
|
11
|
+
// 700 and above text is WCAG AA accessible on white backgrounds.
|
|
12
|
+
700: "#BF3E3A",
|
|
13
|
+
800: "#B72620",
|
|
14
|
+
// 900 text is WCAG AAA accessible on white backgrounds.
|
|
15
|
+
900: "#AF0E08"
|
|
20
16
|
};
|
|
21
|
-
|
|
17
|
+
exports.default = red;
|
|
22
18
|
//# sourceMappingURL=red.js.map
|
package/lib/colors/red.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"red.js","
|
|
1
|
+
{"version":3,"file":"red.js","sourceRoot":"","sources":["../../src/colors/red.ts"],"names":[],"mappings":";;AAAA,MAAM,GAAG,GAAG;IACV,EAAE,EAAE,SAAS;IACb,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,iEAAiE;IACjE,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,wDAAwD;IACxD,GAAG,EAAE,SAAS;CACf,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dropdown/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,cAAc,EAMf,MAAM,OAAO,CAAC;AAQf,MAAM,WAAW,KAAM,SAAQ,cAAc,CAAC,WAAW,CAAC;IACxD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;;GAIG;AACH,QAAA,MAAM,QAAQ,oFASX,KAAK,KAAG,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dropdown/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EACZ,cAAc,EAMf,MAAM,OAAO,CAAC;AAQf,MAAM,WAAW,KAAM,SAAQ,cAAc,CAAC,WAAW,CAAC;IACxD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,WAAW,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IAC5B,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;;GAIG;AACH,QAAA,MAAM,QAAQ,oFASX,KAAK,KAAG,WAsGV,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|