@thecb/components 4.2.9 → 4.3.2

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/.tool-versions CHANGED
@@ -1 +1 @@
1
- nodejs 10.15.3
1
+ nodejs 15.5.0
package/dist/index.cjs.js CHANGED
@@ -6471,7 +6471,7 @@ var Center = function Center(_ref) {
6471
6471
  };
6472
6472
 
6473
6473
  function _templateObject2$2() {
6474
- var data = _taggedTemplateLiteral(["\n box-sizing: border-box;\n display: flex;\n flex-wrap: ", ";\n justify-content: ", ";\n align-items: ", ";\n margin: calc(", " / 2 * -1);\n min-height: ", ";\n min-width: ", ";\n\n > * {\n margin: calc(", " / 2);\n }\n"]);
6474
+ var data = _taggedTemplateLiteral(["\n box-sizing: border-box;\n display: flex;\n flex-wrap: ", ";\n justify-content: ", ";\n align-items: ", ";\n margin: calc(", " / 2 * -1);\n min-height: ", ";\n min-width: ", ";\n > * {\n margin: calc(", " / 2);\n }\n"]);
6475
6475
 
6476
6476
  _templateObject2$2 = function _templateObject2() {
6477
6477
  return data;
@@ -39763,11 +39763,11 @@ var formConfig$7 = {
39763
39763
  constraints: [validateWhen(onlyIntegers(), matchesRegex("US"), "country"), validateWhen(hasLength(0, 9), matchesRegex("US"), "country")]
39764
39764
  }
39765
39765
  };
39766
- var formState = createFormState(formConfig$7);
39767
- console.log("form state is", formState);
39768
- var reducer$7 = formState.reducer,
39769
- mapStateToProps$8 = formState.mapStateToProps,
39770
- mapDispatchToProps$7 = formState.mapDispatchToProps;
39766
+
39767
+ var _createFormState$7 = createFormState(formConfig$7),
39768
+ reducer$7 = _createFormState$7.reducer,
39769
+ mapStateToProps$8 = _createFormState$7.mapStateToProps,
39770
+ mapDispatchToProps$7 = _createFormState$7.mapDispatchToProps;
39771
39771
 
39772
39772
  PaymentFormCard.reducer = reducer$7;
39773
39773
  PaymentFormCard.mapStateToProps = mapStateToProps$8;
@@ -39827,10 +39827,10 @@ var formConfig$8 = {
39827
39827
  }
39828
39828
  };
39829
39829
 
39830
- var _createFormState$7 = createFormState(formConfig$8),
39831
- reducer$8 = _createFormState$7.reducer,
39832
- mapStateToProps$9 = _createFormState$7.mapStateToProps,
39833
- mapDispatchToProps$8 = _createFormState$7.mapDispatchToProps;
39830
+ var _createFormState$8 = createFormState(formConfig$8),
39831
+ reducer$8 = _createFormState$8.reducer,
39832
+ mapStateToProps$9 = _createFormState$8.mapStateToProps,
39833
+ mapDispatchToProps$8 = _createFormState$8.mapDispatchToProps;
39834
39834
 
39835
39835
  PhoneForm.reducer = reducer$8;
39836
39836
  PhoneForm.mapStateToProps = mapStateToProps$9;
@@ -40172,10 +40172,10 @@ var formConfig$9 = {
40172
40172
  }
40173
40173
  };
40174
40174
 
40175
- var _createFormState$8 = createFormState(formConfig$9),
40176
- reducer$9 = _createFormState$8.reducer,
40177
- mapStateToProps$a = _createFormState$8.mapStateToProps,
40178
- mapDispatchToProps$9 = _createFormState$8.mapDispatchToProps;
40175
+ var _createFormState$9 = createFormState(formConfig$9),
40176
+ reducer$9 = _createFormState$9.reducer,
40177
+ mapStateToProps$a = _createFormState$9.mapStateToProps,
40178
+ mapDispatchToProps$9 = _createFormState$9.mapDispatchToProps;
40179
40179
 
40180
40180
  RegistrationForm.reducer = reducer$9;
40181
40181
  RegistrationForm.mapStateToProps = mapStateToProps$a;
@@ -40293,10 +40293,10 @@ var formConfig$a = {
40293
40293
  }
40294
40294
  };
40295
40295
 
40296
- var _createFormState$9 = createFormState(formConfig$a),
40297
- reducer$a = _createFormState$9.reducer,
40298
- mapStateToProps$b = _createFormState$9.mapStateToProps,
40299
- mapDispatchToProps$a = _createFormState$9.mapDispatchToProps;
40296
+ var _createFormState$a = createFormState(formConfig$a),
40297
+ reducer$a = _createFormState$a.reducer,
40298
+ mapStateToProps$b = _createFormState$a.mapStateToProps,
40299
+ mapDispatchToProps$a = _createFormState$a.mapDispatchToProps;
40300
40300
 
40301
40301
  ResetPasswordForm.reducer = reducer$a;
40302
40302
  ResetPasswordForm.mapStateToProps = mapStateToProps$b;
@@ -40360,6 +40360,88 @@ var fallbackValues$A = {
40360
40360
  activeTabHover: activeTabHover
40361
40361
  };
40362
40362
 
40363
+ var Tab = function Tab(_ref) {
40364
+ var label = _ref.label,
40365
+ activeTab = _ref.activeTab,
40366
+ setActiveTab = _ref.setActiveTab;
40367
+
40368
+ var onClick = function onClick() {
40369
+ setActiveTab(label);
40370
+ };
40371
+
40372
+ var className = "tab-list-item";
40373
+
40374
+ if (activeTab === label) {
40375
+ className += " tab-list-active";
40376
+ }
40377
+
40378
+ return /*#__PURE__*/React__default.createElement(Box, {
40379
+ className: className,
40380
+ onClick: onClick,
40381
+ margin: "0 0 -1px 0",
40382
+ padding: "0.5rem 0.75rem",
40383
+ background: activeTab === label ? WHITE : GRECIAN_GREY,
40384
+ extraStyles: "cursor: pointer; flex-grow: 1; text-align: center; ".concat(activeTab === label ? "list-style: none;" : "")
40385
+ }, /*#__PURE__*/React__default.createElement(Text$1, null, label));
40386
+ };
40387
+
40388
+ var HORIZONTAL = "horizontal";
40389
+
40390
+ var Tabs = function Tabs(_ref) {
40391
+ var tabsConfig = _ref.tabsConfig,
40392
+ tabsDisplayMode = _ref.tabsDisplayMode;
40393
+
40394
+ var _useState = React.useState(tabsConfig.tabs[0].label),
40395
+ _useState2 = _slicedToArray(_useState, 2),
40396
+ activeTab = _useState2[0],
40397
+ toggleActiveTab = _useState2[1];
40398
+
40399
+ var createTabs = function createTabs(tabConfig, activeTab) {
40400
+ return tabConfig.tabs.map(function (tab) {
40401
+ return /*#__PURE__*/React__default.createElement(Tab, {
40402
+ activeTab: activeTab,
40403
+ key: tab.label,
40404
+ label: tab.label,
40405
+ setActiveTab: function setActiveTab() {
40406
+ return toggleActiveTab(tab.label);
40407
+ }
40408
+ });
40409
+ });
40410
+ };
40411
+
40412
+ var showHorozontal = function showHorozontal(tabsConfig, activeTab) {
40413
+ return /*#__PURE__*/React__default.createElement(Cluster, {
40414
+ justify: "space-around"
40415
+ }, createTabs(tabsConfig, activeTab));
40416
+ };
40417
+
40418
+ var showVertical = function showVertical(tabsConfig, activeTab) {
40419
+ return /*#__PURE__*/React__default.createElement(Stack, null, createTabs(tabsConfig, activeTab));
40420
+ };
40421
+
40422
+ return /*#__PURE__*/React__default.createElement(Box, {
40423
+ className: "tabs"
40424
+ }, /*#__PURE__*/React__default.createElement(Box, {
40425
+ className: "tab-list"
40426
+ }, tabsDisplayMode == HORIZONTAL ? showHorozontal(tabsConfig, activeTab) : showVertical(tabsConfig, activeTab)), /*#__PURE__*/React__default.createElement(Box, {
40427
+ className: "tab-content"
40428
+ }, /*#__PURE__*/React__default.createElement(Box, null, tabsConfig.tabs.map(function (tab) {
40429
+ if (tab.label !== activeTab) return undefined;
40430
+ return tab.content;
40431
+ }))));
40432
+ };
40433
+
40434
+ var Tabs$1 = themeComponent(Tabs, "NavigationTab", fallbackValues$A);
40435
+
40436
+ var activeTabBackground$1 = "#FFFFFF";
40437
+ var activeTabAccent$1 = "#15749D";
40438
+ var activeTabHover$1 = "#B8D5E1";
40439
+ var fallbackValues$B = {
40440
+ activeTabBackground: activeTabBackground$1,
40441
+ activeTabAccent: activeTabAccent$1,
40442
+ activeTabHover: activeTabHover$1
40443
+ };
40444
+
40363
40445
  var TabSidebar = function TabSidebar(_ref) {
40364
40446
  var links = _ref.links,
40365
40447
  isMobile = _ref.isMobile,
@@ -40410,7 +40492,7 @@ var TabSidebar = function TabSidebar(_ref) {
40410
40492
  })));
40411
40493
  };
40412
40494
 
40413
- var TabSidebar$1 = themeComponent(TabSidebar, "ProfileTab", fallbackValues$A);
40495
+ var TabSidebar$1 = themeComponent(TabSidebar, "ProfileTab", fallbackValues$B);
40414
40496
 
40415
40497
  var backgroundColor$9 = {
40416
40498
  "default": "#ffffff",
@@ -40444,7 +40526,7 @@ var accessibilityColor = {
40444
40526
  "default": "#3181E3",
40445
40527
  footer: "#3181E3"
40446
40528
  };
40447
- var fallbackValues$B = {
40529
+ var fallbackValues$C = {
40448
40530
  backgroundColor: backgroundColor$9,
40449
40531
  linkColor: linkColor$5,
40450
40532
  border: border$2,
@@ -40506,7 +40588,7 @@ var TermsAndConditionsModal = function TermsAndConditionsModal(_ref) {
40506
40588
  }, link));
40507
40589
  };
40508
40590
 
40509
- var TermsAndConditionsModal$1 = themeComponent(TermsAndConditionsModal, "TermsAndConditionsModal", fallbackValues$B, "default");
40591
+ var TermsAndConditionsModal$1 = themeComponent(TermsAndConditionsModal, "TermsAndConditionsModal", fallbackValues$C, "default");
40510
40592
 
40511
40593
  var TermsAndConditions = function TermsAndConditions(_ref) {
40512
40594
  var onCheck = _ref.onCheck,
@@ -40581,7 +40663,7 @@ var fontColor$1 = WHITE;
40581
40663
  var textAlign$1 = "left";
40582
40664
  var headerBackgroundColor = BRIGHT_GREY;
40583
40665
  var imageBackgroundColor = MATISSE_BLUE;
40584
- var fallbackValues$C = {
40666
+ var fallbackValues$D = {
40585
40667
  fontWeight: fontWeight$9,
40586
40668
  fontColor: fontColor$1,
40587
40669
  textAlign: textAlign$1,
@@ -40634,7 +40716,7 @@ var WelcomeModule = function WelcomeModule(_ref) {
40634
40716
  })))));
40635
40717
  };
40636
40718
 
40637
- var WelcomeModule$1 = /*#__PURE__*/React.memo(themeComponent(WelcomeModule, "WelcomeModule", fallbackValues$C));
40719
+ var WelcomeModule$1 = /*#__PURE__*/React.memo(themeComponent(WelcomeModule, "WelcomeModule", fallbackValues$D));
40638
40720
 
40639
40721
  var WorkflowTile = function WorkflowTile(_ref) {
40640
40722
  var _ref$workflowName = _ref.workflowName,
@@ -40682,7 +40764,7 @@ var WorkflowTile = function WorkflowTile(_ref) {
40682
40764
  };
40683
40765
 
40684
40766
  var pageBackground = "#F6F6F9";
40685
- var fallbackValues$D = {
40767
+ var fallbackValues$E = {
40686
40768
  pageBackground: pageBackground
40687
40769
  };
40688
40770
 
@@ -40729,7 +40811,7 @@ var CenterSingle = function CenterSingle(_ref) {
40729
40811
  })));
40730
40812
  };
40731
40813
 
40732
- var CenterSingle$1 = withWindowSize(themeComponent(CenterSingle, "Global", fallbackValues$D));
40814
+ var CenterSingle$1 = withWindowSize(themeComponent(CenterSingle, "Global", fallbackValues$E));
40733
40815
 
40734
40816
  var CenterStack = function CenterStack(_ref) {
40735
40817
  var header = _ref.header,
@@ -40771,7 +40853,7 @@ var CenterStack = function CenterStack(_ref) {
40771
40853
  })));
40772
40854
  };
40773
40855
 
40774
- var CenterStack$1 = withWindowSize(themeComponent(CenterStack, "Global", fallbackValues$D));
40856
+ var CenterStack$1 = withWindowSize(themeComponent(CenterStack, "Global", fallbackValues$E));
40775
40857
 
40776
40858
  var CenterSingle$2 = function CenterSingle(_ref) {
40777
40859
  var header = _ref.header,
@@ -40811,7 +40893,7 @@ var CenterSingle$2 = function CenterSingle(_ref) {
40811
40893
  })));
40812
40894
  };
40813
40895
 
40814
- var DefaultPageTemplate = withWindowSize(themeComponent(CenterSingle$2, "Global", fallbackValues$D));
40896
+ var DefaultPageTemplate = withWindowSize(themeComponent(CenterSingle$2, "Global", fallbackValues$E));
40815
40897
 
40816
40898
  var SidebarSingleContent = function SidebarSingleContent(_ref) {
40817
40899
  var header = _ref.header,
@@ -40865,7 +40947,7 @@ var SidebarSingleContent = function SidebarSingleContent(_ref) {
40865
40947
  })));
40866
40948
  };
40867
40949
 
40868
- var SidebarSingleContent$1 = withWindowSize(themeComponent(SidebarSingleContent, "Global", fallbackValues$D));
40950
+ var SidebarSingleContent$1 = withWindowSize(themeComponent(SidebarSingleContent, "Global", fallbackValues$E));
40869
40951
 
40870
40952
  var SidebarStackContent = function SidebarStackContent(_ref) {
40871
40953
  var header = _ref.header,
@@ -40936,7 +41018,7 @@ var SidebarStackContent = function SidebarStackContent(_ref) {
40936
41018
  })));
40937
41019
  };
40938
41020
 
40939
- var SidebarStackContent$1 = withWindowSize(themeComponent(SidebarStackContent, "Global", fallbackValues$D));
41021
+ var SidebarStackContent$1 = withWindowSize(themeComponent(SidebarStackContent, "Global", fallbackValues$E));
40940
41022
 
40941
41023
 
40942
41024
 
@@ -41084,6 +41166,7 @@ exports.SuccessfulIcon = SuccessfulIcon;
41084
41166
  exports.Switcher = Switcher;
41085
41167
  exports.TabSidebar = TabSidebar$1;
41086
41168
  exports.TableListItem = TableListItem;
41169
+ exports.Tabs = Tabs$1;
41087
41170
  exports.TermsAndConditions = TermsAndConditions;
41088
41171
  exports.TermsAndConditionsModal = TermsAndConditionsModal$1;
41089
41172
  exports.Text = Text$1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecb/components",
3
- "version": "4.2.9",
3
+ "version": "4.3.2",
4
4
  "description": "Common lib for CityBase react components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -22,7 +22,6 @@ export const ClusterInnerWrapper = styled.div`
22
22
  margin: calc(${({ childGap }) => childGap} / 2 * -1);
23
23
  min-height: ${({ minHeight }) => minHeight};
24
24
  min-width: ${({ minWidth }) => minWidth};
25
-
26
25
  > * {
27
26
  margin: calc(${({ childGap }) => childGap} / 2);
28
27
  }
@@ -0,0 +1,32 @@
1
+ import React from "react";
2
+ import Text from "../text";
3
+ import { WHITE, GRECIAN_GREY } from "../../../constants/colors";
4
+ import { Box } from "../../atoms/layouts";
5
+
6
+ const Tab = ({ label, activeTab, setActiveTab }) => {
7
+ const onClick = () => {
8
+ setActiveTab(label);
9
+ };
10
+
11
+ let className = "tab-list-item";
12
+ if (activeTab === label) {
13
+ className += " tab-list-active";
14
+ }
15
+
16
+ return (
17
+ <Box
18
+ className={className}
19
+ onClick={onClick}
20
+ margin="0 0 -1px 0"
21
+ padding="0.5rem 0.75rem"
22
+ background={activeTab === label ? WHITE : GRECIAN_GREY}
23
+ extraStyles={`cursor: pointer; flex-grow: 1; text-align: center; ${
24
+ activeTab === label ? `list-style: none;` : ``
25
+ }`}
26
+ >
27
+ <Text>{label}</Text>
28
+ </Box>
29
+ );
30
+ };
31
+
32
+ export default Tab;
@@ -0,0 +1,15 @@
1
+ import React from "react";
2
+
3
+ import Tab from "./Tab";
4
+ import page from "../../../../.storybook/page";
5
+
6
+ export const tab = () => (
7
+ <Tab label={"Test"} onClick={() => console.log("test")} />
8
+ );
9
+
10
+ const story = page({
11
+ title: "Components|Atoms/Tab",
12
+ Component: Tab
13
+ });
14
+
15
+ export default story;
@@ -0,0 +1,26 @@
1
+ const fontFamily = {
2
+ p: "Public Sans",
3
+ pL: "Public Sans",
4
+ pS: "Public Sans",
5
+ pXS: "Public Sans",
6
+ pXXS: "Public Sans",
7
+ pXL: "Public Sans"
8
+ };
9
+
10
+ // Text uses the same variants as paragraph
11
+ // Use a Paragraph if you want a block level element
12
+ // Use a Text if you want an inline element
13
+
14
+ const fontSize = {
15
+ p: "1rem",
16
+ pL: "1.125rem",
17
+ pS: "0.875rem",
18
+ pXS: "0.75rem",
19
+ pXXS: "0.65rem",
20
+ pXL: "1.5rem"
21
+ };
22
+
23
+ export const fallbackValues = {
24
+ fontFamily,
25
+ fontSize
26
+ };
@@ -0,0 +1,3 @@
1
+ import Tab from "./Tab";
2
+
3
+ export default Tab;
@@ -25,6 +25,7 @@ export { default as RegistrationForm } from "./registration-form";
25
25
  export { default as ResetConfirmationForm } from "./reset-confirmation-form";
26
26
  export { default as ResetPasswordForm } from "./reset-password-form";
27
27
  export { default as ResetPasswordSuccess } from "./reset-password-success";
28
+ export { default as Tabs } from "./tabs";
28
29
  export { default as TabSidebar } from "./tab-sidebar";
29
30
  export { default as TermsAndConditions } from "./terms-and-conditions";
30
31
  export { default as TermsAndConditionsModal } from "./terms-and-conditions-modal";
@@ -54,7 +54,6 @@ const formConfig = {
54
54
  }
55
55
  };
56
56
 
57
- const formState = createFormState(formConfig);
58
- console.log("form state is", formState);
59
-
60
- export const { reducer, mapStateToProps, mapDispatchToProps } = formState;
57
+ export const { reducer, mapStateToProps, mapDispatchToProps } = createFormState(
58
+ formConfig
59
+ );
@@ -0,0 +1,59 @@
1
+ import React, { useState } from "react";
2
+ import { Stack, Box, Cluster } from "../../atoms/layouts";
3
+ import { themeComponent } from "../../../util/themeUtils";
4
+ import { fallbackValues } from "./Tabs.theme";
5
+ import Tab from "../../atoms/tab";
6
+
7
+ const HORIZONTAL = "horizontal";
8
+
9
+ const Tabs = ({
10
+ tabsConfig,
11
+ tabsDisplayMode // can be either HORIZONTAL or VERTICAL
12
+ }) => {
13
+ const [activeTab, toggleActiveTab] = useState(tabsConfig.tabs[0].label);
14
+
15
+ const createTabs = (tabConfig, activeTab) => {
16
+ return tabConfig.tabs.map(tab => {
17
+ return (
18
+ <Tab
19
+ activeTab={activeTab}
20
+ key={tab.label}
21
+ label={tab.label}
22
+ setActiveTab={() => toggleActiveTab(tab.label)}
23
+ />
24
+ );
25
+ });
26
+ };
27
+
28
+ const showHorozontal = (tabsConfig, activeTab) => {
29
+ return (
30
+ <Cluster justify={"space-around"}>
31
+ {createTabs(tabsConfig, activeTab)}
32
+ </Cluster>
33
+ );
34
+ };
35
+
36
+ const showVertical = (tabsConfig, activeTab) => {
37
+ return <Stack>{createTabs(tabsConfig, activeTab)}</Stack>;
38
+ };
39
+
40
+ return (
41
+ <Box className="tabs">
42
+ <Box className="tab-list">
43
+ {tabsDisplayMode == HORIZONTAL
44
+ ? showHorozontal(tabsConfig, activeTab)
45
+ : showVertical(tabsConfig, activeTab)}
46
+ </Box>
47
+ <Box className="tab-content">
48
+ <Box>
49
+ {tabsConfig.tabs.map(tab => {
50
+ if (tab.label !== activeTab) return undefined;
51
+ return tab.content;
52
+ })}
53
+ </Box>
54
+ </Box>
55
+ </Box>
56
+ );
57
+ };
58
+
59
+ export default themeComponent(Tabs, "NavigationTab", fallbackValues);
@@ -0,0 +1,241 @@
1
+ import React from "react";
2
+ import { createStore } from "redux";
3
+ import Tabs from "./Tabs";
4
+
5
+ import page from "../../../../.storybook/page";
6
+ import Text from "../../atoms/text";
7
+
8
+ import { createFormState, onlyIntegers, required } from "redux-freeform";
9
+ import DisplayBox from "../../atoms/display-box";
10
+ import { Box } from "../../atoms/layouts";
11
+
12
+ // Including commented out configs as a preliminary work for
13
+ // https://citybase.atlassian.net/browse/KCORE-2973
14
+ // https://citybase.atlassian.net/browse/KCORE-2974
15
+ // https://citybase.atlassian.net/browse/KCORE-2975
16
+
17
+ const ButtonTest = () => (
18
+ <DisplayBox>
19
+ <Text>Test Button Clicks</Text>
20
+ <Box>
21
+ <button onClick={() => console.log("BUTTON TEST;")}>Click me</button>
22
+ </Box>
23
+ </DisplayBox>
24
+ );
25
+
26
+ //const creditCardFormConfig = {
27
+ // amount: {
28
+ // defaultValue: "100.00",
29
+ // validators: [required()]
30
+ // }
31
+ //};
32
+
33
+ const checkFormConfig = {
34
+ amount: {
35
+ defaultValue: "100.00",
36
+ validators: [required()]
37
+ },
38
+ name: {
39
+ validators: [required()]
40
+ },
41
+ accountNumber: {
42
+ validators: [onlyIntegers()]
43
+ },
44
+ routingNumber: {
45
+ validators: [onlyIntegers()]
46
+ },
47
+ checkType: {
48
+ defaultValue: "Personal"
49
+ }
50
+ };
51
+
52
+ //const cashFormConfig = {
53
+ // amount: {
54
+ // defaultValue: "100.00",
55
+ // validators: [required()]
56
+ // }
57
+ //};
58
+ //
59
+ //const MyCreditCardForm = ({ actions, fields }) => {
60
+ // return (
61
+ // <div>
62
+ // {fields.amount.hasErrors && fields.amount.errors.includes(required.error)
63
+ // ? "Amount"
64
+ // : "Amount"}
65
+ // <input
66
+ // value={fields.amount.rawValue}
67
+ // onChange={evt => actions.fields.amount.set(evt.target.value)}
68
+ // type="text"
69
+ // />
70
+ // </div>
71
+ // );
72
+ //};
73
+
74
+ const MyCheckForm = ({ actions, fields }) => (
75
+ <div>
76
+ {fields.amount.hasErrors && fields.amount.errors.includes(required.error)
77
+ ? "AmountError"
78
+ : "Amount"}
79
+ <input
80
+ value={fields.amount.rawValue}
81
+ onChange={evt => actions.fields.amount.set(evt.target.value)}
82
+ type="text"
83
+ />
84
+ {fields.name.hasErrors && fields.name.errors.includes(required.error)
85
+ ? "Name Error"
86
+ : "Name"}
87
+ <input
88
+ value={fields.name.rawValue}
89
+ onChange={evt => actions.fields.name.set(evt.target.value)}
90
+ type="text"
91
+ />
92
+ {fields.accountNumber.hasErrors &&
93
+ fields.accountNumber.errors.includes(required.error)
94
+ ? "Account Number Error"
95
+ : "Account Number"}
96
+ <input
97
+ value={fields.accountNumber.rawValue}
98
+ onChange={evt => actions.fields.accountNumber.set(evt.target.value)}
99
+ type="text"
100
+ />
101
+ {fields.routingNumber.hasErrors &&
102
+ fields.routingNumber.errors.includes(required.error)
103
+ ? "Routing Number Error"
104
+ : "Routing Number"}
105
+ <input
106
+ value={fields.routingNumber.rawValue}
107
+ onChange={evt => actions.fields.routingNumber.set(evt.target.value)}
108
+ type="text"
109
+ />
110
+ {fields.checkType.hasErrors &&
111
+ fields.checkType.errors.includes(required.error)
112
+ ? "Check Type Error"
113
+ : "Check Type"}
114
+ <input
115
+ value={fields.checkType.rawValue}
116
+ onChange={evt => actions.fields.checkType.set(evt.target.value)}
117
+ type="text"
118
+ />
119
+ </div>
120
+ );
121
+
122
+ //const MyCashForm = ({ actions, fields }) => (
123
+ // <div>
124
+ // {fields.amount.hasErrors && fields.amount.errors.includes(required.error)
125
+ // ? "Amount Error"
126
+ // : "Amount"}
127
+ // <input
128
+ // value={fields.amount.rawValue}
129
+ // onChange={evt => actions.fields.amount.set(evt.target.value)}
130
+ // type="text"
131
+ // />
132
+ // </div>
133
+ //);
134
+
135
+ //const {
136
+ // reducer: cardReducer,
137
+ // mapStateToProps: cardMapStateToProps,
138
+ // mapDispatchToProps: cardMapDispatchToProps
139
+ //} = createFormState(creditCardFormConfig);
140
+
141
+ const {
142
+ reducer: checkReducer,
143
+ mapStateToProps: checkMapStateToProps,
144
+ mapDispatchToProps: checkMapDispatchToProps
145
+ } = createFormState(checkFormConfig);
146
+
147
+ //const {
148
+ // reducer: cashReducer,
149
+ // mapStateToProps: cashMapStateToProps,
150
+ // mapDispatchToProps: cashMapDispatchToProps
151
+ //} = createFormState(cashFormConfig);
152
+
153
+ //const cardStore = createStore(
154
+ // cardReducer,
155
+ // window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
156
+ //);
157
+
158
+ const checkStore = createStore(
159
+ checkReducer,
160
+ window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
161
+ );
162
+
163
+ //const cashStore = createStore(
164
+ // cashReducer,
165
+ // window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()
166
+ //);
167
+
168
+ //const tabsConfig = {
169
+ // tabs: [
170
+ // {
171
+ // label: 'Credit Card',
172
+ // active: true,
173
+ // content: MyCreditCardForm(
174
+ // {...cardMapStateToProps(cardStore.getState())},
175
+ // {...cardMapDispatchToProps(cardStore.dispatch)}
176
+ // )
177
+ // },
178
+ // {
179
+ // label: 'Check',
180
+ // active: true,
181
+ // content: MyCheckForm(
182
+ // {...checkMapStateToProps(checkStore.getState())},
183
+ // {...checkMapDispatchToProps(checkStore.dispatch)}
184
+ // )
185
+ // },
186
+ // {
187
+ // true: 'Cash',
188
+ // active: true,
189
+ // content: MyCashForm(
190
+ // {...cashMapStateToProps(cashStore.getState())},
191
+ // {...cashMapDispatchToProps(cashStore.dispatch)}
192
+ // )
193
+ // }
194
+ // ]
195
+ //};
196
+
197
+ const LOREM = `
198
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit,
199
+ sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
200
+ Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
201
+ nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in
202
+ reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
203
+ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia
204
+ deserunt mollit anim id est laborum.
205
+ `;
206
+
207
+ const tabsConfig = {
208
+ tabs: [
209
+ {
210
+ label: "Credit Card",
211
+ active: true,
212
+ content: <Text>{LOREM}</Text>
213
+ },
214
+ {
215
+ label: "Check",
216
+ active: true,
217
+ content: MyCheckForm(
218
+ { ...checkMapStateToProps(checkStore.getState()) },
219
+ { ...checkMapDispatchToProps(checkStore.dispatch) }
220
+ )
221
+ },
222
+ {
223
+ label: "Cash",
224
+ active: true,
225
+ content: <ButtonTest></ButtonTest>
226
+ }
227
+ ]
228
+ };
229
+
230
+ const HORIZONTAL = "horizontal";
231
+
232
+ export const tabs = () => (
233
+ <Tabs tabsConfig={tabsConfig} tabsDisplayMode={HORIZONTAL} />
234
+ );
235
+
236
+ const story = page({
237
+ title: "Components|Molecules/Tabs",
238
+ Component: Tabs
239
+ });
240
+
241
+ export default story;
@@ -0,0 +1,9 @@
1
+ const activeTabBackground = "#FFFFFF";
2
+ const activeTabAccent = "#15749D";
3
+ const activeTabHover = "#B8D5E1";
4
+
5
+ export const fallbackValues = {
6
+ activeTabBackground,
7
+ activeTabAccent,
8
+ activeTabHover
9
+ };
@@ -0,0 +1,3 @@
1
+ import Tabs from "./Tabs";
2
+
3
+ export default Tabs;