Skip to content

Commit 6c59d42

Browse files
authored
fix: various issues (#136)
* Fix Barlist key * add type="button" to all buttons * Datepicker CalendarIcon flex-none * fix SelectBox button spacing * add form to input elem stories * move resize-observer-polyfill tp devDependencies * Update BarList.tsx * Update package-lock.json * Update SelectBox.tsx
1 parent 6a67cf2 commit 6c59d42

File tree

16 files changed

+35
-18
lines changed

16 files changed

+35
-18
lines changed

package-lock.json

+8-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@
2727
"dependencies": {
2828
"@tippyjs/react": "^4.2.6",
2929
"date-fns": "^2.28.0",
30-
"recharts": "^2.1.13",
31-
"resize-observer-polyfill": "^1.5.1"
30+
"recharts": "^2.1.13"
3231
},
3332
"devDependencies": {
3433
"@babel/core": "^7.17.9",
@@ -59,6 +58,7 @@
5958
"jest": "^27.5.1",
6059
"postcss": "^8.4.12",
6160
"react-dom": "^18.0.0",
61+
"resize-observer-polyfill": "^1.5.1",
6262
"rollup": "^2.70.2",
6363
"rollup-plugin-dts": "^4.2.1",
6464
"rollup-plugin-peer-deps-external": "^2.2.4",

src/components/input-elements/Datepicker/Datepicker.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ const Datepicker = ({
165165
) }
166166
>
167167
<button
168+
type="button"
168169
ref={ datePickerRef }
169170
onClick={ () => setShowDatePickerModal(!showDatePickerModal) }
170171
className={ classNames(
@@ -184,7 +185,7 @@ const Datepicker = ({
184185
>
185186
<CalendarIcon
186187
className={ classNames(
187-
'flex-none',
188+
'tr-flex-none',
188189
getColorVariantsFromColorThemeValue(defaultColors.lightText).textColor,
189190
sizing.lg.height,
190191
sizing.lg.width,
@@ -206,6 +207,7 @@ const Datepicker = ({
206207
</button>
207208
{ enableRelativeDates ? (
208209
<button
210+
type="button"
209211
ref={ dropdownRef }
210212
onClick={ () => setShowDropdownModal(!showDropdownModal) }
211213
className={ classNames(
@@ -424,6 +426,7 @@ const Datepicker = ({
424426
{ relativeFilterOptions.map((filterOption) => (
425427
<button
426428
key={ filterOption.value }
429+
type="button"
427430
onClick={ () => {
428431
setSelectedRelativeFilterOption(filterOption.value);
429432
handleRelativeFilterOptionClick(filterOption.value);

src/components/input-elements/Dropdown/Dropdown.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ const Dropwdown = ({
7272
) }
7373
>
7474
<button
75+
type="button"
7576
className={ classNames(
7677
'input-elem tr-flex tr-justify-between tr-items-center tr-w-full',
7778
'focus:tr-ring-2 focus:tr-outline-0',

src/components/input-elements/Dropdown/DropdownItem.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const DropdownItem = ({
2828
const Icon = icon ? icon : null;
2929
return (
3030
<button
31+
type="button"
3132
onClick={() => privateProps!.handleDropdownItemClick(value)}
3233
className={classNames(
3334
'input-elem tr-flex tr-items-center tr-justify-between tr-w-full',

src/components/input-elements/MultiSelectBox/MultiSelectBox.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ const MultiSelectBox = ({
104104
) }
105105
>
106106
<button
107+
type="button"
107108
className={ classNames(
108109
'input-elem tr-flex tr-justify-between tr-items-center tr-w-full',
109110
'focus:tr-ring-2 focus:tr-outline-0',

src/components/input-elements/MultiSelectBox/MultiSelectBoxItem.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const MultiSelectBoxItem = ({
2727
privateProps,
2828
}: MultiSelectBoxItemProps) => (
2929
<button
30+
type="button"
3031
onClick={ () => privateProps!.handleMultiSelectBoxItemClick(value) }
3132
className={ classNames(
3233
'input-elem tr-flex tr-items-center tr-justify-between tr-w-full',

src/components/input-elements/SelectBox/SelectBox.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,10 @@ const SelectBox = ({
110110
onClick={ () => setShowModal(!showModal) }
111111
/>
112112
<button
113+
type="button"
113114
className={ classNames(
114-
'input-elem tr-absolute tr-top-1/2 -tr-translate-y-1/2',
115+
'tr-absolute tr-top-1/2 -tr-translate-y-1/2',
116+
'tr-m-0 tr-p-0',
115117
spacing.twoXl.right,
116118
) }
117119
onClick={ () => setShowModal(!showModal) }

src/components/input-elements/SelectBox/SelectBoxItem.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const SelectBoxItem = ({
2525
const Icon = icon ? icon : null;
2626
return (
2727
<button
28+
type="button"
2829
onClick={() => privateProps!.handleSelectBoxItemClick(value)}
2930
className={classNames(
3031
'input-elem tr-flex tr-items-center tr-justify-between tr-w-full',

src/components/input-elements/Tab/Tab.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ const Tab = ({
4242
return(
4343
<li>
4444
<button
45+
type="button"
4546
className={ classNames(
4647
'input-elem tr-flex tr-whitespace-nowrap tr-max-w-xs tr-truncate',
4748
spacing.twoXs.paddingRight,

src/components/input-elements/Toggle/ToggleItem.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ const ToggleItem = ({
4545
const Icon = icon ? icon : null;
4646
return (
4747
<button
48+
type="button"
4849
className={classNames(
4950
'input-elem tr-flex tr-items-center tr-ring-1',
5051
spacing.lg.paddingLeft,

src/components/layout-elements/Accordion/AccordionHeader.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const AccordionHeader = ({
1717
}: AccordionHeaderProps) => {
1818
return(
1919
<button
20+
type="button"
2021
className={ classNames(
2122
'input-elem tr-w-full tr-flex tr-items-center tr-justify-between',
2223
spacing.threeXl.paddingLeft,

src/components/vis-elements/BarList/BarList.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const BarList = ({
6060
<div className="tr-relative tr-w-full">
6161
{ data.map((item, idx) => (
6262
<div
63-
key={ item.value }
63+
key={ item.name }
6464
className={ classNames(
6565
'tr-flex tr-items-center',
6666
rowHeight,
@@ -84,7 +84,7 @@ const BarList = ({
8484
<div className="tr-text-right tr-min-w-min">
8585
{ data.map((item, idx) => (
8686
<div
87-
key={ item.value }
87+
key={ item.name }
8888
className={ classNames(
8989
'tr-flex tr-justify-end tr-items-center',
9090
rowHeight,

src/stories/input-elements/Dropdown.stories.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
1515

1616
const ResponsiveTemplate: ComponentStory<typeof Dropdown> = (args) => (
17-
<>
17+
<form>
1818
<Title>Mobile</Title>
1919
<div className="tr-w-64">
2020
<Card>
@@ -25,7 +25,7 @@ const ResponsiveTemplate: ComponentStory<typeof Dropdown> = (args) => (
2525
<Card>
2626
<SimpleDropdown { ...args } />
2727
</Card>
28-
</>
28+
</form>
2929
);
3030

3131
const FlexTemplate: ComponentStory<typeof Dropdown> = (args) => (

src/stories/input-elements/MultiSelectBox.stories.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default {
1414
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
1515

1616
const ResponsiveTemplate: ComponentStory<typeof MultiSelectBox> = (args) => (
17-
<>
17+
<form>
1818
<Title>Mobile</Title>
1919
<div className="tr-w-64">
2020
<Card>
@@ -25,7 +25,7 @@ const ResponsiveTemplate: ComponentStory<typeof MultiSelectBox> = (args) => (
2525
<Card>
2626
<SimpleMultiSelectBox { ...args } />
2727
</Card>
28-
</>
28+
</form>
2929
);
3030

3131
const FlexTemplate: ComponentStory<typeof MultiSelectBox> = (args) => (

src/stories/input-elements/SelectBox.stories.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ComponentMeta, ComponentStory } from '@storybook/react';
44

55
import { Card, Flex, SelectBox, Text, Title } from 'components';
66
import { SelectElementsFlexTemplate } from './helpers/SelectElementsFlexTemplate';
7+
import { SimpleDropdown } from 'stories/input-elements/helpers/SimpleDropdown';
78
import { SimpleSelectBox } from './helpers/SimpleSelectBox';
89

910
// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
@@ -14,18 +15,19 @@ export default {
1415
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
1516

1617
const ResponsiveTemplate: ComponentStory<typeof SelectBox> = (args) => (
17-
<>
18+
<form>
1819
<Title>Mobile</Title>
1920
<div className="tr-w-64">
2021
<Card>
2122
<SimpleSelectBox { ...args } />
23+
<SimpleDropdown />
2224
</Card>
2325
</div>
2426
<Title marginTop="mt-5">Desktop</Title>
2527
<Card>
2628
<SimpleSelectBox { ...args } />
2729
</Card>
28-
</>
30+
</form>
2931
);
3032

3133
const FlexTemplate: ComponentStory<typeof SelectBox> = (args) => (

0 commit comments

Comments
 (0)