@madie/madie-design-system 1.2.62 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (118) hide show
  1. package/.eslintrc.js +1 -1
  2. package/.storybook/.babelrc +2 -1
  3. package/.storybook/main.js +3 -11
  4. package/components/AutoComplete/AutoComplete.jsx +1 -1
  5. package/components/Button/Button.stories.js +0 -2
  6. package/components/DateField/DateField.jsx +1 -1
  7. package/components/DateField/DateField.stories.jsx +23 -10
  8. package/components/DateTimeField/DateTimeField.jsx +6 -2
  9. package/components/DateTimeField/DateTimeField.stories.jsx +29 -19
  10. package/components/Instant/Instant.stories.js +14 -6
  11. package/components/MadieAlert/MadieAlert.stories.js +35 -29
  12. package/components/MadieAlert/index.jsx +5 -5
  13. package/components/MadieConfirmDialog/MadieConfirmDialog.stories.js +17 -27
  14. package/components/MadieDeleteDialog/MadieDeleteDialog.stories.js +9 -18
  15. package/components/MadieDialog/MadieDialog.stories.js +45 -116
  16. package/components/MadieDialog/index.jsx +4 -2
  17. package/components/MadieDiscardDialog/MadieDiscardDialog.stories.js +5 -7
  18. package/components/MadieSpinner/MadieSpinner.stories.js +1 -3
  19. package/components/MadieTooltip/MadieTooltip.stories.js +7 -2
  20. package/components/Modal/Modal.stories.js +18 -89
  21. package/components/NotificationBanner/NotificationBanner.stories.js +17 -11
  22. package/components/NotificationBanner/index.js +3 -3
  23. package/components/NumberInput/NumberInput.stories.js +51 -63
  24. package/components/Popover/Popover.stories.js +6 -14
  25. package/components/Popover/index.js +2 -2
  26. package/components/RadioButton/RadioButton.jsx +4 -2
  27. package/components/RadioButton/RadioButton.stories.jsx +6 -2
  28. package/components/ReadOnlyTextField/ReadOnlyTextField.stories.js +4 -3
  29. package/components/ReadOnlyTextField/index.jsx +1 -1
  30. package/components/RichTextEditor/RichTextEditor.stories.js +10 -8
  31. package/components/RichTextEditor/index.jsx +14 -15
  32. package/components/Search/Search.stories.js +2 -4
  33. package/components/Select/Select.stories.js +59 -160
  34. package/components/Select/index.jsx +1 -1
  35. package/components/Tabs/Tabs.stories.js +78 -210
  36. package/components/TextArea/TextArea.stories.js +88 -108
  37. package/components/TextArea/index.jsx +1 -1
  38. package/components/TextField/TextField.stories.js +101 -124
  39. package/components/TextField/index.jsx +1 -1
  40. package/components/TimeField/TimeField.stories.js +18 -8
  41. package/components/Toast/Toast.stories.js +42 -102
  42. package/components/TruncateText/TruncateText.stories.js +22 -17
  43. package/components/hooks/useGetConfig.js +2 -2
  44. package/components/index.js +0 -24
  45. package/dist/browser.js +1 -1
  46. package/dist/index.js +1 -1
  47. package/dist/react/index.js +182 -51
  48. package/dist/react/index.js.LICENSE.txt +27 -24
  49. package/dist/react/index.js.map +1 -1
  50. package/eslint.config.js +56 -0
  51. package/index.js +7 -9
  52. package/package.json +43 -75
  53. package/test/components/Accordion.test.js +1 -1
  54. package/test/components/AutoComplete.test.js +11 -6
  55. package/test/components/Button.test.js +7 -3
  56. package/test/components/DateField.test.js +25 -29
  57. package/test/components/DateTimeField.test.js +21 -25
  58. package/test/components/Instant.test.js +1 -1
  59. package/test/components/MadieAlert.test.js +22 -22
  60. package/test/components/MadieConfirmDialog.test.js +42 -64
  61. package/test/components/MadieDeleteDialog.test.js +51 -69
  62. package/test/components/MadieDialog.test.js +13 -13
  63. package/test/components/MadieDiscardDialog.test.js +28 -45
  64. package/test/components/MadieSpinner.test.js +12 -17
  65. package/test/components/Modal.test.js +115 -0
  66. package/test/components/Pagination.test.js +2 -2
  67. package/test/components/RadioButton.test.js +7 -7
  68. package/test/components/ReadOnlyTextField.test.js +4 -2
  69. package/test/components/RichTextEditor.test.js +90 -6
  70. package/test/components/Search.test.js +75 -0
  71. package/test/components/Select.test.js +97 -107
  72. package/test/components/Tabs.test.js +22 -24
  73. package/test/components/TextArea.test.js +78 -92
  74. package/test/components/TextField.test.js +128 -147
  75. package/test/components/Toast.test.js +67 -78
  76. package/test/components/TruncateText.test.js +75 -0
  77. package/test/components/index.test.js +23 -0
  78. package/webpack.config.js +0 -1
  79. package/.eslintignore +0 -5
  80. package/components/Alert/Alert.stories.js +0 -70
  81. package/components/Alert/index.js +0 -55
  82. package/components/Breadcrumb/Breadcrumb.md +0 -28
  83. package/components/Breadcrumb/Breadcrumb.stories.js +0 -76
  84. package/components/Breadcrumb/index.js +0 -92
  85. package/components/CalloutBox/CalloutBox.stories.js +0 -94
  86. package/components/CalloutBox/index.js +0 -109
  87. package/components/Card/Card.stories.js +0 -163
  88. package/components/Card/index.js +0 -144
  89. package/components/Dropdown/Dropdown.stories.js +0 -94
  90. package/components/Dropdown/index.js +0 -85
  91. package/components/Error/Collapsible.jsx +0 -93
  92. package/components/Error/ErrorUI.jsx +0 -31
  93. package/components/Error/error.js +0 -26
  94. package/components/FlashNotification/FlashNotificationUI.jsx +0 -91
  95. package/components/FlashNotification/index.js +0 -30
  96. package/components/Footer/Footer.stories.js +0 -20
  97. package/components/Footer/FooterUI.jsx +0 -137
  98. package/components/Footer/LegacyFooterUI.jsx +0 -204
  99. package/components/Footer/SocialLinks.jsx +0 -63
  100. package/components/Footer/Subscribe.jsx +0 -34
  101. package/components/Footer/footer.js +0 -30
  102. package/components/Infotip/Infotip.jsx +0 -75
  103. package/components/Infotip/Infotip.stories.js +0 -52
  104. package/components/Infotip/InfotipIcon.jsx +0 -41
  105. package/components/Infotip/index.js +0 -3
  106. package/components/Link/Link.stories.js +0 -82
  107. package/components/Link/index.js +0 -61
  108. package/components/Spinner/index.js +0 -9
  109. package/components/TextInput/TextInput.stories.js +0 -118
  110. package/components/TextInput/index.js +0 -137
  111. package/components/Tooltip/Tooltip.jsx +0 -88
  112. package/components/Tooltip/Tooltip.stories.js +0 -80
  113. package/components/Tooltip/index.js +0 -3
  114. package/components/Tooltip/position.js +0 -76
  115. package/test/components/ErrorUI.test.js +0 -32
  116. package/test/components/FooterUI.test.js +0 -122
  117. package/test/components/Infotip.test.js +0 -76
  118. package/test/components/Tooltip.test.js +0 -147
@@ -1,12 +1,22 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
- import { withKnobs } from "@storybook/addon-knobs";
4
3
  import TextArea from "./index";
5
4
  import { FormHelperText } from "@mui/material";
5
+
6
6
  export default {
7
7
  title: "TextArea",
8
8
  component: TextArea,
9
- decorators: [withKnobs],
9
+ argTypes: {
10
+ disabled: { control: "boolean" },
11
+ error: { control: "boolean" },
12
+ required: { control: "boolean" },
13
+ size: {
14
+ control: { type: "select" },
15
+ options: ["small", "medium", "large"], // adjust if needed
16
+ },
17
+ helperText: { control: "text" },
18
+ value: { control: "text" },
19
+ },
10
20
  };
11
21
 
12
22
  const Wrapper = ({ children }) => (
@@ -14,148 +24,118 @@ const Wrapper = ({ children }) => (
14
24
  {children}
15
25
  </div>
16
26
  );
27
+
17
28
  Wrapper.propTypes = {
18
29
  className: PropTypes.string,
19
30
  children: PropTypes.node,
20
31
  };
21
- export const Textarea = () => (
22
- <Wrapper>
23
- <TextArea
24
- placeholder="Placeholder"
25
- label="Text Label"
26
- id="measureName"
27
- inputProps={{ "data-testid": "measure-name-input" }}
28
- data-testid="measure-name-text-field"
29
- size="small"
30
- />
31
- </Wrapper>
32
- );
33
32
 
34
- export const WithHelperText = () => (
33
+ const Template = (args) => (
35
34
  <Wrapper>
36
35
  <TextArea
37
- placeholder="Placeholder"
38
- label="Text Label"
36
+ {...args}
39
37
  id="measureName"
40
38
  inputProps={{ "data-testid": "measure-name-input" }}
41
39
  data-testid="measure-name-text-field"
42
- size="small"
43
- helperText={
44
- <FormHelperText data-testid={`helper-text`} error={false}>
45
- a descriptive message
46
- </FormHelperText>
47
- }
40
+ label="Text Label"
41
+ placeholder="Placeholder"
48
42
  />
49
43
  </Wrapper>
50
44
  );
51
45
 
52
- export const DisabledWithValue = () => (
53
- <Wrapper>
46
+ export const Interactive = Template.bind({});
47
+ Interactive.args = {
48
+ size: "small",
49
+ disabled: false,
50
+ error: false,
51
+ required: false,
52
+ helperText: "",
53
+ value: "",
54
+ };
55
+
56
+ export const WithHelperText = Template.bind({});
57
+ WithHelperText.args = {
58
+ ...Interactive.args,
59
+ helperText: (
60
+ <FormHelperText data-testid="helper-text" error={false}>
61
+ a descriptive message
62
+ </FormHelperText>
63
+ ),
64
+ };
65
+
66
+ export const DisabledWithValue = Template.bind({});
67
+ DisabledWithValue.args = {
68
+ ...Interactive.args,
69
+ value: "This is a disabled text area",
70
+ disabled: true,
71
+ required: true,
72
+ };
73
+
74
+ export const DisabledWithNoValue = Template.bind({});
75
+ DisabledWithNoValue.args = {
76
+ ...Interactive.args,
77
+ disabled: true,
78
+ required: true,
79
+ };
80
+
81
+ export const Required = Template.bind({});
82
+ Required.args = {
83
+ ...Interactive.args,
84
+ required: true,
85
+ };
86
+
87
+ export const Error = Template.bind({});
88
+ Error.args = {
89
+ ...Interactive.args,
90
+ error: true,
91
+ required: true,
92
+ helperText: "An error message",
93
+ };
94
+
95
+ export const VariedHeights = () => (
96
+ <div
97
+ className="qpp-u-padding--16"
98
+ style={{ width: 900, marginBottom: "16px", display: "flex", gap: 16 }}
99
+ >
54
100
  <TextArea
55
101
  placeholder="Placeholder"
102
+ required
56
103
  label="Text Label"
57
- id="measureName"
58
- inputProps={{ "data-testid": "measure-name-input" }}
59
- data-testid="measure-name-text-field"
104
+ id="measureName1"
105
+ inputProps={{ "data-testid": "measure-name-input1" }}
106
+ data-testid="measure-name-text-field1"
60
107
  size="small"
61
- value="This is a disabled text area"
62
- disabled
63
- required
108
+ helperText="An error message"
64
109
  />
65
- </Wrapper>
66
- );
67
-
68
- export const DisabledWithNoValue = () => (
69
- <Wrapper>
70
110
  <TextArea
71
111
  placeholder="Placeholder"
112
+ required
72
113
  label="Text Label"
73
- id="measureName"
74
- inputProps={{ "data-testid": "measure-name-input" }}
75
- data-testid="measure-name-text-field"
114
+ id="measureName2"
115
+ inputProps={{ "data-testid": "measure-name-input2" }}
116
+ data-testid="measure-name-text-field2"
76
117
  size="small"
77
- disabled
78
- required
118
+ helperText="An error message"
79
119
  />
80
- </Wrapper>
81
- );
82
-
83
- export const Required = () => (
84
- <Wrapper>
85
120
  <TextArea
86
121
  placeholder="Placeholder"
87
- required
88
122
  label="Text Label"
89
- id="measureName"
90
- inputProps={{ "data-testid": "measure-name-input" }}
91
- data-testid="measure-name-text-field"
123
+ id="measureName3"
124
+ inputProps={{ "data-testid": "measure-name-input3" }}
125
+ data-testid="measure-name-text-field3"
92
126
  size="small"
127
+ helperText="An error message designed to take up a lot of space to see how we space multiple input elements within the same row in a responsive manner"
93
128
  />
94
- </Wrapper>
95
- );
96
-
97
- export const Error = () => (
98
- <Wrapper>
99
129
  <TextArea
100
130
  placeholder="Placeholder"
101
131
  error
102
132
  required
103
133
  label="Text Label"
104
- id="measureName"
105
- inputProps={{ "data-testid": "measure-name-input" }}
106
- data-testid="measure-name-text-field"
134
+ id="measureName4"
135
+ inputProps={{ "data-testid": "measure-name-input4" }}
136
+ data-testid="measure-name-text-field4"
107
137
  size="small"
108
138
  helperText="An error message"
109
139
  />
110
- </Wrapper>
111
- );
112
-
113
- export const VariedHeights = () => (
114
- <div
115
- className="qpp-u-padding--16"
116
- style={{ width: 900, marginBottom: "16px" }}
117
- >
118
- <div style={{ display: "flex", flexDirection: "row" }}>
119
- <TextArea
120
- placeholder="Placeholder"
121
- required
122
- label="Text Label"
123
- id="measureName"
124
- inputProps={{ "data-testid": "measure-name-input" }}
125
- data-testid="measure-name-text-field"
126
- size="small"
127
- helperText="An error message"
128
- />
129
- <TextArea
130
- placeholder="Placeholder"
131
- required
132
- label="Text Label"
133
- id="measureName"
134
- inputProps={{ "data-testid": "measure-name-input" }}
135
- data-testid="measure-name-text-field"
136
- size="small"
137
- helperText="An error message"
138
- />
139
- <TextArea
140
- placeholder="Placeholder"
141
- label="Text Label"
142
- id="measureName"
143
- inputProps={{ "data-testid": "measure-name-input" }}
144
- data-testid="measure-name-text-field"
145
- size="small"
146
- helperText="An error message designed to take up a lot of space to see how we space multiple input elements within the same row in a responsive manner "
147
- />
148
- <TextArea
149
- placeholder="Placeholder"
150
- error
151
- required
152
- label="Text Label"
153
- id="measureName"
154
- inputProps={{ "data-testid": "measure-name-input" }}
155
- data-testid="measure-name-text-field"
156
- size="small"
157
- helperText="An error message"
158
- />
159
- </div>
160
140
  </div>
161
141
  );
@@ -24,7 +24,7 @@ const TextArea = ({
24
24
  size="small"
25
25
  {...rest}
26
26
  />
27
- )
27
+ );
28
28
  }
29
29
  // coerce this to avoid issue passing props to dom.
30
30
  // text area autosize is deprecated and only takes style rules
@@ -1,14 +1,27 @@
1
1
  import React from "react";
2
2
  import PropTypes from "prop-types";
3
- import { withKnobs } from "@storybook/addon-knobs";
4
3
  import TextField from "./index";
5
4
  import { FormHelperText, IconButton, InputAdornment } from "@mui/material";
6
5
  import SearchIcon from "@mui/icons-material/Search";
7
6
  import ClearIcon from "@mui/icons-material/Clear";
7
+
8
8
  export default {
9
9
  title: "TextField",
10
10
  component: TextField,
11
- decorators: [withKnobs],
11
+ argTypes: {
12
+ disabled: { control: "boolean" },
13
+ error: { control: "boolean" },
14
+ required: { control: "boolean" },
15
+ size: {
16
+ control: { type: "select" },
17
+ options: ["small", "medium", "large"], // adjust if your component supports different sizes
18
+ },
19
+ helperText: { control: "text" },
20
+ label: { control: "text" },
21
+ placeholder: { control: "text" },
22
+ labelColor: { control: "color" },
23
+ value: { control: "text" },
24
+ },
12
25
  };
13
26
 
14
27
  const Wrapper = ({ children }) => (
@@ -16,143 +29,114 @@ const Wrapper = ({ children }) => (
16
29
  {children}
17
30
  </div>
18
31
  );
32
+
19
33
  Wrapper.propTypes = {
20
34
  className: PropTypes.string,
21
35
  children: PropTypes.node,
22
36
  };
23
37
 
24
- export const Textfield = () => (
38
+ const Template = (args) => (
25
39
  <Wrapper>
26
40
  <TextField
27
- placeholder="Placeholder"
28
- label="Text Label"
29
- id="measureName"
30
- inputProps={{ "data-testid": "measure-name-input" }}
31
- data-testid="measure-name-text-field"
32
- size="small"
41
+ {...args}
42
+ id={args.id || "measureName"}
43
+ inputProps={{
44
+ "data-testid": "measure-name-input",
45
+ ...args.inputProps,
46
+ }}
47
+ data-testid={args["data-testid"] || "measure-name-text-field"}
33
48
  />
34
49
  </Wrapper>
35
50
  );
36
51
 
37
- export const WithHelperText = () => (
38
- <Wrapper>
39
- <TextField
40
- placeholder="Placeholder"
41
- label="Text Label"
42
- id="measureName"
43
- inputProps={{ "data-testid": "measure-name-input" }}
44
- data-testid="measure-name-text-field"
45
- size="small"
46
- helperText={
47
- <FormHelperText data-testid={`helper-text`} error={false}>
48
- a descriptive message
49
- </FormHelperText>
50
- }
51
- />
52
- </Wrapper>
53
- );
52
+ export const Interactive = Template.bind({});
53
+ Interactive.args = {
54
+ size: "small",
55
+ disabled: false,
56
+ error: false,
57
+ required: false,
58
+ helperText: "",
59
+ label: "Text Label",
60
+ placeholder: "Placeholder",
61
+ labelColor: undefined,
62
+ value: "",
63
+ };
54
64
 
55
- export const Disabled = () => (
56
- <Wrapper>
65
+ export const WithHelperText = Template.bind({});
66
+ WithHelperText.args = {
67
+ ...Interactive.args,
68
+ helperText: (
69
+ <FormHelperText data-testid="helper-text" error={false}>
70
+ a descriptive message
71
+ </FormHelperText>
72
+ ),
73
+ };
74
+
75
+ export const Disabled = Template.bind({});
76
+ Disabled.args = {
77
+ ...Interactive.args,
78
+ disabled: true,
79
+ label: "Disabled Text Label",
80
+ };
81
+
82
+ export const Required = Template.bind({});
83
+ Required.args = {
84
+ ...Interactive.args,
85
+ required: true,
86
+ };
87
+
88
+ export const Error = Template.bind({});
89
+ Error.args = {
90
+ ...Interactive.args,
91
+ error: true,
92
+ required: true,
93
+ helperText: "An error message",
94
+ };
95
+
96
+ export const WithToolTipText = Template.bind({});
97
+ WithToolTipText.args = {
98
+ ...Interactive.args,
99
+ label: "Confirm New Version #",
100
+ tooltipText: "Input the new version # located to the left to confirm.",
101
+ helperText: "test",
102
+ id: "measure-name",
103
+ };
104
+
105
+ export const VariedHeights = () => (
106
+ <div
107
+ className="qpp-u-padding--16"
108
+ style={{ width: 900, marginBottom: "16px", display: "flex", gap: 16 }}
109
+ >
57
110
  <TextField
58
111
  placeholder="Placeholder"
59
- label="Disabled Text Label"
60
- id="measureName"
61
- inputProps={{ "data-testid": "measure-name-input" }}
62
- data-testid="measure-name-text-field"
112
+ required
113
+ label="Text Label"
114
+ id="measureName1"
115
+ inputProps={{ "data-testid": "measure-name-input1" }}
116
+ data-testid="measure-name-text-field1"
63
117
  size="small"
64
- disabled
118
+ helperText="An error message"
65
119
  />
66
- </Wrapper>
67
- );
68
-
69
- export const Required = () => (
70
- <Wrapper>
71
120
  <TextField
72
121
  placeholder="Placeholder"
73
- required
74
122
  label="Text Label"
75
- id="measureName"
76
- inputProps={{ "data-testid": "measure-name-input" }}
77
- data-testid="measure-name-text-field"
123
+ id="measureName2"
124
+ inputProps={{ "data-testid": "measure-name-input2" }}
125
+ data-testid="measure-name-text-field2"
78
126
  size="small"
127
+ helperText="An error message designed to take up a lot of space to see how we space multiple input elements within the same row in a responsive manner "
79
128
  />
80
- </Wrapper>
81
- );
82
-
83
- export const Error = () => (
84
- <Wrapper>
85
129
  <TextField
86
130
  placeholder="Placeholder"
87
131
  error
88
132
  required
89
133
  label="Text Label"
90
- id="measureName"
91
- inputProps={{ "data-testid": "measure-name-input" }}
92
- data-testid="measure-name-text-field"
134
+ id="measureName3"
135
+ inputProps={{ "data-testid": "measure-name-input3" }}
136
+ data-testid="measure-name-text-field3"
93
137
  size="small"
94
138
  helperText="An error message"
95
139
  />
96
- </Wrapper>
97
- );
98
-
99
- export const WithToolTipText = () => (
100
- <Wrapper>
101
- <TextField
102
- placeholder="Placeholder"
103
- label="Confirm New Version #"
104
- data-testid="measure-name-text-field"
105
- size="small"
106
- tooltipText="Input the new version # located to the left to confirm."
107
- helperText="test"
108
- id="measure-name"
109
- // previously this was how it was done. it could make more sense to only pass it an id and progrematically determine it. Example:
110
- // inputProps={{
111
- // "data-testid": "measure-name-input",
112
- // "aria-describedby":
113
- // "measure-name-helper-text measure-name-tooltip",
114
- // }}
115
- />
116
- </Wrapper>
117
- );
118
-
119
- export const VariedHeights = () => (
120
- <div
121
- className="qpp-u-padding--16"
122
- style={{ width: 900, marginBottom: "16px" }}
123
- >
124
- <div style={{ display: "flex", flexDirection: "row" }}>
125
- <TextField
126
- placeholder="Placeholder"
127
- required
128
- label="Text Label"
129
- id="measureName"
130
- inputProps={{ "data-testid": "measure-name-input" }}
131
- data-testid="measure-name-text-field"
132
- size="small"
133
- helperText="An error message"
134
- />
135
- <TextField
136
- placeholder="Placeholder"
137
- label="Text Label"
138
- id="measureName"
139
- inputProps={{ "data-testid": "measure-name-input" }}
140
- data-testid="measure-name-text-field"
141
- size="small"
142
- helperText="An error message designed to take up a lot of space to see how we space multiple input elements within the same row in a responsive manner "
143
- />
144
- <TextField
145
- placeholder="Placeholder"
146
- error
147
- required
148
- label="Text Label"
149
- id="measureName"
150
- inputProps={{ "data-testid": "measure-name-input" }}
151
- data-testid="measure-name-text-field"
152
- size="small"
153
- helperText="An error message"
154
- />
155
- </div>
156
140
  </div>
157
141
  );
158
142
 
@@ -176,7 +160,7 @@ export const WithLeftAndRightIcon = () => (
176
160
  ),
177
161
  endAdornment: (
178
162
  <InputAdornment position="end">
179
- <IconButton onClick="">
163
+ <IconButton onClick={() => {}}>
180
164
  <ClearIcon />
181
165
  </IconButton>
182
166
  </InputAdornment>
@@ -188,16 +172,9 @@ export const WithLeftAndRightIcon = () => (
188
172
  </Wrapper>
189
173
  );
190
174
 
191
- export const TextfieldDifferentLabel = () => (
192
- <Wrapper>
193
- <TextField
194
- placeholder="Placeholder"
195
- label="Text Label with different color"
196
- labelColor={"#1976d2"}
197
- id="measureName"
198
- inputProps={{ "data-testid": "measure-name-input" }}
199
- data-testid="measure-name-text-field"
200
- size="small"
201
- />
202
- </Wrapper>
203
- );
175
+ export const TextfieldDifferentLabel = Template.bind({});
176
+ TextfieldDifferentLabel.args = {
177
+ ...Interactive.args,
178
+ label: "Text Label with different color",
179
+ labelColor: "#1976d2",
180
+ };
@@ -32,7 +32,7 @@ const TextField = ({
32
32
  size="small"
33
33
  {...rest}
34
34
  />
35
- )
35
+ );
36
36
  }
37
37
  // get a copy of input props
38
38
  const newInputProps = { ...inputProps } || {};
@@ -1,26 +1,36 @@
1
1
  import React, { useState } from "react";
2
2
  import TimeField from "./TimeField";
3
- import { withKnobs } from "@storybook/addon-knobs";
4
3
 
5
4
  export default {
6
5
  title: "TimeField",
7
6
  component: TimeField,
8
- decorators: [withKnobs],
7
+ argTypes: {
8
+ disabled: { control: "boolean" },
9
+ label: { control: "text" },
10
+ },
9
11
  };
10
- export const TimeFieldComponent = (args) => {
12
+
13
+ const Template = (args) => {
11
14
  const [value, setValue] = useState("");
12
- const handleTimeChange = (newValue, v) => {
15
+
16
+ const handleTimeChange = (newValue) => {
13
17
  console.log("Time changed: newValue = ", newValue);
14
18
  setValue(newValue);
15
19
  };
20
+
16
21
  return (
17
- <div className="qpp-u-padding--16">
22
+ <div className="qpp-u-padding--16" style={{ width: 300 }}>
18
23
  <TimeField
19
- disabled={false}
20
- label="Result Time"
21
- handleTimeChange={handleTimeChange}
24
+ {...args}
22
25
  value={value}
26
+ handleTimeChange={handleTimeChange}
23
27
  />
24
28
  </div>
25
29
  );
26
30
  };
31
+
32
+ export const Default = Template.bind({});
33
+ Default.args = {
34
+ disabled: false,
35
+ label: "Result Time",
36
+ };