@mrshmllw/smores-react 2.1.26 → 2.2.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.
- package/dist/CheckBoxGroup/CheckBox.d.ts +9 -0
- package/dist/CheckBoxGroup/CheckBox.js +67 -0
- package/dist/CheckBoxGroup/CheckBox.js.map +1 -0
- package/dist/ConfirmationRadioButtons/Confirmation.js +6 -5
- package/dist/ConfirmationRadioButtons/Confirmation.js.map +1 -1
- package/dist/ConfirmationRadioButtons/Confirmation.stories.d.ts +1 -0
- package/dist/ConfirmationRadioButtons/Confirmation.stories.js +8 -0
- package/dist/ConfirmationRadioButtons/Confirmation.stories.js.map +1 -1
- package/dist/Dropdown/Dropdown.d.ts +7 -33
- package/dist/Dropdown/Dropdown.js +22 -48
- package/dist/Dropdown/Dropdown.js.map +1 -1
- package/dist/Dropdown/Dropdown.stories.d.ts +3 -39
- package/dist/Field/Field.d.ts +12 -0
- package/dist/Field/Field.js +68 -0
- package/dist/Field/Field.js.map +1 -0
- package/dist/Field/index.d.ts +1 -0
- package/dist/Field/index.js +2 -0
- package/dist/Field/index.js.map +1 -0
- package/dist/Field/types/commonFieldTypes.d.ts +10 -0
- package/dist/Field/types/commonFieldTypes.js +2 -0
- package/dist/Field/types/commonFieldTypes.js.map +1 -0
- package/dist/Fieldset/Fieldset.d.ts +8 -0
- package/dist/Fieldset/Fieldset.js +15 -0
- package/dist/Fieldset/Fieldset.js.map +1 -0
- package/dist/Fieldset/index.d.ts +1 -0
- package/dist/Fieldset/index.js +2 -0
- package/dist/Fieldset/index.js.map +1 -0
- package/dist/SearchInput/SearchInput.d.ts +3 -12
- package/dist/SearchInput/SearchInput.js +12 -21
- package/dist/SearchInput/SearchInput.js.map +1 -1
- package/dist/SupportMessage/SupportMessage.d.ts +2 -2
- package/dist/SupportMessage/SupportMessage.js.map +1 -1
- package/dist/SupportMessage/SupportMessage.stories.d.ts +1 -0
- package/dist/SupportMessage/SupportMessage.stories.js +9 -0
- package/dist/SupportMessage/SupportMessage.stories.js.map +1 -1
- package/dist/SupportMessage/SupportMessage.test.js +8 -0
- package/dist/SupportMessage/SupportMessage.test.js.map +1 -1
- package/dist/Tag/Tag.d.ts +11 -2
- package/dist/Tag/Tag.js +5 -3
- package/dist/Tag/Tag.js.map +1 -1
- package/dist/Tag/Tag.stories.d.ts +1 -0
- package/dist/Tag/Tag.stories.js +6 -0
- package/dist/Tag/Tag.stories.js.map +1 -1
- package/dist/TextInput/TextInput.d.ts +5 -23
- package/dist/TextInput/TextInput.js +19 -49
- package/dist/TextInput/TextInput.js.map +1 -1
- package/dist/Textarea/Textarea.d.ts +1 -15
- package/dist/Textarea/Textarea.js +20 -21
- package/dist/Textarea/Textarea.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
@@ -1,12 +1,11 @@
|
|
1
1
|
import React, { useState } from 'react';
|
2
2
|
import styled from 'styled-components';
|
3
3
|
import { darken } from 'polished';
|
4
|
-
import { Text } from '../Text';
|
5
|
-
import { Box } from '../Box';
|
6
4
|
import { theme } from '../theme';
|
7
5
|
import { Icon } from '../Icon';
|
6
|
+
import { Field } from '../Field';
|
8
7
|
import { useUniqueId } from '../utils/id';
|
9
|
-
export const SearchInput = ({ id: idProp, name = 'search_input', label, placeholder, searchList, onFound, resultsRelativePosition = false, outlined = false, showIcon = false, }) => {
|
8
|
+
export const SearchInput = ({ id: idProp, name = 'search_input', label, className = '', placeholder, searchList, onFound, resultsRelativePosition = false, outlined = false, showIcon = false, renderAsTitle = false, }) => {
|
10
9
|
const id = useUniqueId(idProp);
|
11
10
|
const [active, setActive] = useState(false);
|
12
11
|
const [list, setList] = useState([]);
|
@@ -15,10 +14,8 @@ export const SearchInput = ({ id: idProp, name = 'search_input', label, placehol
|
|
15
14
|
const search = (e) => {
|
16
15
|
const value = e.currentTarget.value;
|
17
16
|
if (value) {
|
18
|
-
// start filtering if the input has at least 2 characters
|
19
17
|
if (value.length >= 2) {
|
20
18
|
const filteredList = searchList.filter((el) => el.label.toLowerCase().includes(value.toLocaleLowerCase()));
|
21
|
-
// update the local state with the filtered results
|
22
19
|
setActive(true);
|
23
20
|
setList(filteredList);
|
24
21
|
}
|
@@ -37,21 +34,15 @@ export const SearchInput = ({ id: idProp, name = 'search_input', label, placehol
|
|
37
34
|
onFound(selectedItem.value);
|
38
35
|
setSelected(true);
|
39
36
|
};
|
40
|
-
return (React.createElement(
|
41
|
-
|
42
|
-
React.createElement(
|
43
|
-
|
44
|
-
|
45
|
-
React.createElement(
|
46
|
-
|
47
|
-
React.createElement(ResultsList, { outlined: outlined }, list.length ? (list.map((el, i) => (React.createElement("li", { key: i, onClick: () => select(el) }, el.label)))) : (React.createElement("li", null, "No results"))))));
|
37
|
+
return (React.createElement(Field, { className: className, renderAsTitle: renderAsTitle, id: id, label: label, outlined: outlined, value: selectedResult },
|
38
|
+
React.createElement(React.Fragment, null,
|
39
|
+
React.createElement(StyledInputBox, { outlined: outlined, selected: selected },
|
40
|
+
showIcon && React.createElement(SearchIcon, { size: 24, render: "search", color: "subtext" }),
|
41
|
+
React.createElement(StyledInput, { id: id, type: "text", name: name, placeholder: placeholder, autoComplete: "off", value: selectedResult, onKeyUp: search, onChange: updateInputState, outlined: outlined, selected: selected })),
|
42
|
+
React.createElement(StyledResultsContainer, { show: active, absolutePosition: !resultsRelativePosition, outlined: outlined },
|
43
|
+
React.createElement(ResultsList, { outlined: outlined }, list.length ? (list.map((el, i) => (React.createElement("li", { key: i, onClick: () => select(el) }, el.label)))) : (React.createElement("li", null, "No results")))))));
|
48
44
|
};
|
49
|
-
const
|
50
|
-
position: relative;
|
51
|
-
width: 100%;
|
52
|
-
background: ${theme.colors.white};
|
53
|
-
`;
|
54
|
-
const InputBox = styled.div `
|
45
|
+
const StyledInputBox = styled.div `
|
55
46
|
display: flex;
|
56
47
|
align-items: center;
|
57
48
|
border-bottom: ${({ outlined }) => outlined ? 'none' : `1px solid ${theme.colors.outline}`};
|
@@ -75,7 +66,7 @@ const InputBox = styled.div `
|
|
75
66
|
`}
|
76
67
|
color: ${({ outlined }) => outlined ? `${theme.colors.outline}` : `${theme.colors.secondary}`};
|
77
68
|
`;
|
78
|
-
const
|
69
|
+
const StyledInput = styled.input `
|
79
70
|
display: block;
|
80
71
|
border: none;
|
81
72
|
outline: none;
|
@@ -92,7 +83,7 @@ const Input = styled.input `
|
|
92
83
|
height: auto;
|
93
84
|
`}
|
94
85
|
`;
|
95
|
-
const
|
86
|
+
const StyledResultsContainer = styled.div `
|
96
87
|
box-sizing: border-box;
|
97
88
|
overflow-y: hidden;
|
98
89
|
${({ absolutePosition }) => absolutePosition && 'position: absolute;'}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SearchInput.js","sourceRoot":"","sources":["../../src/SearchInput/SearchInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"SearchInput.js","sourceRoot":"","sources":["../../src/SearchInput/SearchInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3C,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAkBzC,MAAM,CAAC,MAAM,WAAW,GAAyB,CAAC,EAChD,EAAE,EAAE,MAAM,EACV,IAA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E,CAAC,gBAAgB,IAAI,qBAAqB;;gBAEvD,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC;IACvD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,IAAI,sBAAsB;;;kBAGtC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC;;CAEvD,CAAA;AAED,MAAM,WAAW,GAAG,MAAM,CAAC,EAAE,CAAa;;;;;;sBAMpB,KAAK,CAAC,MAAM,CAAC,KAAK;sBAClB,KAAK,CAAC,MAAM,CAAC,OAAO;;;;;IAKtC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CACjB,QAAQ;IACR;wBACoB,KAAK,CAAC,MAAM,CAAC,OAAO;GACzC;;;;;;aAMU,KAAK,CAAC,MAAM,CAAC,SAAS;;;;0BAIT,KAAK,CAAC,MAAM,CAAC,UAAU;;;CAGhD,CAAA;AAED,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;CAE9B,CAAA"}
|
@@ -1,8 +1,8 @@
|
|
1
|
-
import { FC } from 'react';
|
1
|
+
import { FC, ReactElement } from 'react';
|
2
2
|
declare type SupportMessageType = 'info' | 'info-outline' | 'alert' | 'warning';
|
3
3
|
export declare type SupportMessageProps = {
|
4
4
|
className?: string;
|
5
|
-
description: string;
|
5
|
+
description: string | ReactElement;
|
6
6
|
type: SupportMessageType;
|
7
7
|
title?: string;
|
8
8
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SupportMessage.js","sourceRoot":"","sources":["../../src/SupportMessage/SupportMessage.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"SupportMessage.js","sourceRoot":"","sources":["../../src/SupportMessage/SupportMessage.tsx"],"names":[],"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AC,IAAI,QAAC,SAAS,EAAC,QAAQ;QAChC,KAAK,IAAI,oBAAC,KAAK,QAAE,KAAK,CAAS;QAC/B,WAAW,CACD,CACL,CACX,CAAA;AAMD,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;CAE9B,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CACxB,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,CAAA;;wBAEK,MAAM,CAAC,IAAI,CAAC,CAAC,eAAe;MAC9C,IAAI,KAAK,cAAc,IAAI,qBAAqB,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE;;;;;GAK3E,CACF,CAAA;AAED,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,CAAA;;WAEnB,KAAK,CAAC,MAAM,CAAC,SAAS;;CAEhC,CAAA;AAED,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAA;;iBAEL,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM;WAC9B,KAAK,CAAC,MAAM,CAAC,SAAS;;;CAGhC,CAAA"}
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react';
|
2
2
|
import { SupportMessage } from './SupportMessage';
|
3
|
+
import { Link } from '../Link';
|
3
4
|
import { CollectionPage } from './Collection';
|
4
5
|
export default {
|
5
6
|
title: 'SupportMessage',
|
@@ -13,5 +14,13 @@ const supportMessageArgs = {
|
|
13
14
|
description: 'Some description text',
|
14
15
|
};
|
15
16
|
Default.args = supportMessageArgs;
|
17
|
+
export const WithCustomDescription = Template.bind({});
|
18
|
+
WithCustomDescription.args = {
|
19
|
+
type: 'info',
|
20
|
+
title: 'A SupportMessage using the Link component',
|
21
|
+
description: (React.createElement(React.Fragment, null,
|
22
|
+
"Some text rendered using a ",
|
23
|
+
React.createElement(Link, { href: '' }, "Link"))),
|
24
|
+
};
|
16
25
|
export const Collection = CollectionPage.bind({});
|
17
26
|
//# sourceMappingURL=SupportMessage.stories.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SupportMessage.stories.js","sourceRoot":"","sources":["../../src/SupportMessage/SupportMessage.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,eAAe;IACb,KAAK,EAAE,gBAAgB;IACvB,SAAS,EAAE,cAAc;CAC1B,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,KAA0B,EAAE,EAAE,CAAC,CAC/C,oBAAC,cAAc,oBAAK,KAAK,kCAA+C,CACzE,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAExC,MAAM,kBAAkB,GAAwB;IAC9C,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,uBAAuB;CACrC,CAAA;AAED,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAA;AAEjC,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA"}
|
1
|
+
{"version":3,"file":"SupportMessage.stories.js","sourceRoot":"","sources":["../../src/SupportMessage/SupportMessage.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,eAAe;IACb,KAAK,EAAE,gBAAgB;IACvB,SAAS,EAAE,cAAc;CAC1B,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,KAA0B,EAAE,EAAE,CAAC,CAC/C,oBAAC,cAAc,oBAAK,KAAK,kCAA+C,CACzE,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAExC,MAAM,kBAAkB,GAAwB;IAC9C,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,SAAS;IAChB,WAAW,EAAE,uBAAuB;CACrC,CAAA;AAED,OAAO,CAAC,IAAI,GAAG,kBAAkB,CAAA;AAEjC,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAEtD,qBAAqB,CAAC,IAAI,GAAG;IAC3B,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,2CAA2C;IAClD,WAAW,EAAE,CACX;;QAC6B,oBAAC,IAAI,IAAC,IAAI,EAAE,EAAE,WAAa,CACrD,CACJ;CACF,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA"}
|
@@ -11,6 +11,7 @@ import React from 'react';
|
|
11
11
|
import { render, screen } from '@testing-library/react';
|
12
12
|
import 'jest-styled-components';
|
13
13
|
import { SupportMessage } from './SupportMessage';
|
14
|
+
import { Link } from '../Link';
|
14
15
|
const supportMessageProps = {
|
15
16
|
description: 'Type info support message',
|
16
17
|
type: 'info',
|
@@ -26,5 +27,12 @@ describe('SupportMessage component', () => {
|
|
26
27
|
expect(yield findByText('Type info support message')).toBeInTheDocument();
|
27
28
|
expect(yield findByText('Info title')).toBeInTheDocument();
|
28
29
|
}));
|
30
|
+
it('Renders a Link within the description', () => {
|
31
|
+
const { container } = render(React.createElement(React.Fragment, null,
|
32
|
+
"Some text rendered with a ",
|
33
|
+
React.createElement(Link, { href: '' }, "Link"),
|
34
|
+
' '));
|
35
|
+
expect(container.firstChild).toMatchSnapshot();
|
36
|
+
});
|
29
37
|
});
|
30
38
|
//# sourceMappingURL=SupportMessage.test.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"SupportMessage.test.js","sourceRoot":"","sources":["../../src/SupportMessage/SupportMessage.test.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,wBAAwB,CAAA;AAE/B,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAA;
|
1
|
+
{"version":3,"file":"SupportMessage.test.js","sourceRoot":"","sources":["../../src/SupportMessage/SupportMessage.test.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,wBAAwB,CAAA;AAE/B,OAAO,EAAE,cAAc,EAAuB,MAAM,kBAAkB,CAAA;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAE9B,MAAM,mBAAmB,GAAwB;IAC/C,WAAW,EAAE,2BAA2B;IACxC,IAAI,EAAE,MAAM;CACb,CAAA;AAED,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,CAAA;IAC7B,EAAE,CAAC,2CAA2C,EAAE,GAAS,EAAE;QACzD,MAAM,CAAC,oBAAC,cAAc,oBAAK,mBAAmB,EAAI,CAAC,CAAA;QAEnD,MAAM,CAAC,MAAM,UAAU,CAAC,2BAA2B,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAA;IAC3E,CAAC,CAAA,CAAC,CAAA;IAEF,EAAE,CAAC,sDAAsD,EAAE,GAAS,EAAE;QACpE,MAAM,CAAC,oBAAC,cAAc,oBAAK,mBAAmB,IAAE,KAAK,EAAC,YAAY,IAAG,CAAC,CAAA;QAEtE,MAAM,CAAC,MAAM,UAAU,CAAC,2BAA2B,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAA;QACzE,MAAM,CAAC,MAAM,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAA;IAC5D,CAAC,CAAA,CAAC,CAAA;IAEF,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAC1B;;YAC4B,oBAAC,IAAI,IAAC,IAAI,EAAE,EAAE,WAAa;YAAC,GAAG,CACxD,CACJ,CAAA;QACD,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,eAAe,EAAE,CAAA;IAChD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
package/dist/Tag/Tag.d.ts
CHANGED
@@ -1,11 +1,20 @@
|
|
1
1
|
import { FC } from 'react';
|
2
2
|
import { Color } from '../theme';
|
3
|
-
export declare type
|
3
|
+
export declare type DefaultProps = {
|
4
4
|
label: string;
|
5
5
|
className?: string;
|
6
6
|
color: Color;
|
7
|
+
typo?: string;
|
8
|
+
};
|
9
|
+
declare type GradientProps = {
|
7
10
|
bgColor: Color;
|
8
11
|
borderColor: Color;
|
9
|
-
|
12
|
+
bgGradient?: boolean;
|
13
|
+
} | {
|
14
|
+
bgColor?: Color;
|
15
|
+
borderColor?: Color;
|
16
|
+
bgGradient: boolean;
|
10
17
|
};
|
18
|
+
export declare type TagProps = DefaultProps & GradientProps;
|
11
19
|
export declare const Tag: FC<TagProps>;
|
20
|
+
export {};
|
package/dist/Tag/Tag.js
CHANGED
@@ -2,12 +2,14 @@ import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
3
3
|
import { Text } from '../Text';
|
4
4
|
import { theme } from '../theme';
|
5
|
-
export const Tag = ({ label, color, borderColor, bgColor, className, typo, }) => (React.createElement(Wrapper, { bgColor: bgColor, className: className, borderColor: borderColor },
|
5
|
+
export const Tag = ({ label, color, borderColor, bgColor, className, typo, bgGradient = false, }) => (React.createElement(Wrapper, { bgColor: bgColor, className: className, borderColor: borderColor, bgGradient: bgGradient },
|
6
6
|
React.createElement(TagText, { tag: "span", typo: typo !== null && typo !== void 0 ? typo : 'label', color: color }, label)));
|
7
7
|
const Wrapper = styled.div `
|
8
|
-
background-color: ${({ bgColor }) => theme.colors[bgColor]};
|
8
|
+
background-color: ${({ bgColor }) => bgColor && theme.colors[bgColor]};
|
9
|
+
background: ${({ bgGradient }) => bgGradient &&
|
10
|
+
`linear-gradient(90deg, rgba(247, 46, 73, 1) 0%, rgba(246, 148, 210, 1) 100%)`};
|
9
11
|
border-radius: 8px;
|
10
|
-
border:
|
12
|
+
border: ${({ borderColor }) => borderColor && `1px solid ${theme.colors[borderColor]}`};
|
11
13
|
box-sizing: border-box;
|
12
14
|
display: inline-flex;
|
13
15
|
height: 23px;
|
package/dist/Tag/Tag.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../src/Tag/Tag.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAA;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAS,KAAK,EAAE,MAAM,UAAU,CAAA;
|
1
|
+
{"version":3,"file":"Tag.js","sourceRoot":"","sources":["../../src/Tag/Tag.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAa,MAAM,OAAO,CAAA;AACjC,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAA;AAC9B,OAAO,EAAS,KAAK,EAAE,MAAM,UAAU,CAAA;AAyBvC,MAAM,CAAC,MAAM,GAAG,GAAiB,CAAC,EAChC,KAAK,EACL,KAAK,EACL,WAAW,EACX,OAAO,EACP,SAAS,EACT,IAAI,EACJ,UAAU,GAAG,KAAK,GACnB,EAAE,EAAE,CAAC,CACJ,oBAAC,OAAO,IACN,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,UAAU;IAEtB,oBAAC,OAAO,IAAC,GAAG,EAAC,MAAM,EAAC,IAAI,EAAE,IAAI,aAAJ,IAAI,cAAJ,IAAI,GAAI,OAAO,EAAE,KAAK,EAAE,KAAK,IACpD,KAAK,CACE,CACF,CACX,CAAA;AAID,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAc;sBAClB,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;gBACvD,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,CAC/B,UAAU;IACV,8EAA8E;;YAEtE,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CAC5B,WAAW,IAAI,aAAa,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE;;;;;CAK1D,CAAA;AAED,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAA;;;;;CAK3B,CAAA"}
|
package/dist/Tag/Tag.stories.js
CHANGED
@@ -17,4 +17,10 @@ Default.argTypes = {
|
|
17
17
|
as: { table: { disable: true } },
|
18
18
|
forwardedAs: { table: { disable: true } },
|
19
19
|
};
|
20
|
+
export const BgGradient = Template.bind({});
|
21
|
+
BgGradient.args = {
|
22
|
+
label: 'This is a gradient background tag',
|
23
|
+
bgGradient: true,
|
24
|
+
color: 'white',
|
25
|
+
};
|
20
26
|
//# sourceMappingURL=Tag.stories.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Tag.stories.js","sourceRoot":"","sources":["../../src/Tag/Tag.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,GAAG,EAAY,MAAM,OAAO,CAAA;AAErC,eAAe;IACb,KAAK,EAAE,KAAK;IACZ,SAAS,EAAE,GAAG;CACf,CAAA;AAED,MAAM,QAAQ,GAAG,CAAC,KAAe,EAAE,EAAE,CAAC,oBAAC,GAAG,oBAAK,KA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,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;CAC1C,CAAA;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAE3C,UAAU,CAAC,IAAI,GAAG;IAChB,KAAK,EAAE,mCAAmC;IAC1C,UAAU,EAAE,IAAI;IAChB,KAAK,EAAE,OAAO;CACf,CAAA"}
|
@@ -1,34 +1,16 @@
|
|
1
1
|
import React, { FormEvent } from 'react';
|
2
|
-
|
3
|
-
|
4
|
-
className?: string;
|
5
|
-
/** Input type for proper browser support */
|
2
|
+
import { CommonFieldTypes } from 'Field/types/commonFieldTypes';
|
3
|
+
interface Props extends CommonFieldTypes {
|
6
4
|
type?: 'text' | 'email' | 'password' | 'time' | 'date';
|
7
|
-
/** used to render outlined style */
|
8
|
-
outlined?: boolean;
|
9
|
-
/** Placeholder */
|
10
5
|
placeholder: string;
|
11
|
-
/** label displayed above the input */
|
12
|
-
label?: string;
|
13
|
-
/** used for label - input connection */
|
14
6
|
name?: string;
|
15
|
-
/** input value */
|
16
7
|
value: string;
|
17
|
-
/** error flag */
|
18
|
-
error?: boolean;
|
19
|
-
/** error text message */
|
20
|
-
errorMsg?: string;
|
21
|
-
/** onBlur listener */
|
22
8
|
onBlur?: (e: FormEvent<HTMLInputElement>) => void;
|
23
|
-
/** used for adding a trailing icon */
|
24
9
|
trailingIcon?: string;
|
25
|
-
/** Disabled flag */
|
26
10
|
disabled?: boolean;
|
27
|
-
|
28
|
-
required?: boolean;
|
29
|
-
};
|
11
|
+
}
|
30
12
|
/** on change or on input required */
|
31
|
-
declare type
|
13
|
+
declare type InputProps = {
|
32
14
|
/** on change is required and on input optional */
|
33
15
|
onChange: (e: string) => void;
|
34
16
|
onInputChange?: (e: FormEvent<HTMLInputElement>) => void;
|
@@ -37,6 +19,6 @@ declare type TruncateProps = {
|
|
37
19
|
onChange?: (e: string) => void;
|
38
20
|
onInputChange: (e: FormEvent<HTMLInputElement>) => void;
|
39
21
|
};
|
40
|
-
export declare type TextInputProps =
|
22
|
+
export declare type TextInputProps = Props & InputProps;
|
41
23
|
export declare const TextInput: React.ForwardRefExoticComponent<TextInputProps & React.RefAttributes<HTMLInputElement>>;
|
42
24
|
export {};
|
@@ -1,59 +1,34 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
1
12
|
import React, { forwardRef } from 'react';
|
2
13
|
import styled from 'styled-components';
|
3
|
-
import { darken } from 'polished';
|
4
|
-
import { Box } from '../Box';
|
5
|
-
import { Text } from '../Text';
|
6
|
-
import { Icon } from '../Icon';
|
7
14
|
import { theme } from '../theme';
|
15
|
+
import { Field } from '../Field';
|
8
16
|
import { useUniqueId } from '../utils/id';
|
9
|
-
export const TextInput = forwardRef(function TextInput(
|
17
|
+
export const TextInput = forwardRef(function TextInput(_a, ref) {
|
18
|
+
var { id: idProp, type = 'text', placeholder, name, value, outlined = false, error = false, onBlur, onChange, onInputChange, disabled = false } = _a, fieldProps = __rest(_a, ["id", "type", "placeholder", "name", "value", "outlined", "error", "onBlur", "onChange", "onInputChange", "disabled"]);
|
10
19
|
const id = useUniqueId(idProp);
|
11
|
-
return (React.createElement(
|
12
|
-
|
13
|
-
React.createElement(
|
14
|
-
required && (React.createElement(Text, { tag: "label", color: "error", typo: "label" }, "*")))),
|
15
|
-
React.createElement(Content, { value: value, outlined: outlined, error: error },
|
16
|
-
React.createElement(Input, { disabled: disabled, type: type, id: id, name: name, ref: ref, placeholder: placeholder, value: value, error: error, outlined: outlined, autoComplete: "off", onChange: (e) => {
|
20
|
+
return (React.createElement(Field, Object.assign({}, fieldProps, { id: id, error: error, outlined: outlined, value: value }),
|
21
|
+
React.createElement(React.Fragment, null,
|
22
|
+
React.createElement(StyledInput, { disabled: disabled, type: type, id: id, name: name, ref: ref, placeholder: placeholder, value: value, error: error, outlined: outlined, autoComplete: "off", onChange: (e) => {
|
17
23
|
onChange && onChange(e.currentTarget.value);
|
18
24
|
onInputChange && onInputChange(e);
|
19
25
|
}, onBlur: (e) => {
|
20
26
|
onBlur && onBlur(e);
|
21
|
-
} })
|
22
|
-
trailingIcon && React.createElement(Icon, { render: trailingIcon, color: "subtext" })),
|
23
|
-
error && React.createElement(ErrorBox, null, errorMsg)));
|
27
|
+
} }))));
|
24
28
|
});
|
25
|
-
const
|
26
|
-
display: flex;
|
27
|
-
flex-direction: column;
|
28
|
-
height: auto;
|
29
|
-
`;
|
30
|
-
const Content = styled.div `
|
29
|
+
const StyledInput = styled.input `
|
31
30
|
border-bottom: 1px solid;
|
32
31
|
border-color: ${({ error }) => theme.colors[`${error ? 'error' : 'outline'}`]};
|
33
|
-
background-color: ${({ outlined }) => outlined ? 'transparent' : theme.colors['white']};
|
34
|
-
display: flex;
|
35
|
-
height: 32px;
|
36
|
-
|
37
|
-
&:hover,
|
38
|
-
&:focus-within {
|
39
|
-
border-color: ${({ error }) => error ? theme.colors.error : darken(0.1, theme.colors.outline)};
|
40
|
-
}
|
41
|
-
|
42
|
-
${({ outlined, error }) => outlined &&
|
43
|
-
`
|
44
|
-
border: 2px solid ${error ? theme.colors.error : theme.colors.outline};
|
45
|
-
border-radius: 8px;
|
46
|
-
height: auto;
|
47
|
-
`}
|
48
|
-
|
49
|
-
${({ value }) => value &&
|
50
|
-
value != '' &&
|
51
|
-
`
|
52
|
-
border-color: ${theme.colors.outline};
|
53
|
-
`}
|
54
|
-
`;
|
55
|
-
const Input = styled.input `
|
56
|
-
border: none;
|
57
32
|
background-color: transparent;
|
58
33
|
color: ${({ error }) => theme.colors[`${error ? 'error' : 'secondary'}`]};
|
59
34
|
font-size: 16px;
|
@@ -67,9 +42,4 @@ const Input = styled.input `
|
|
67
42
|
color: ${theme.colors.subtext};
|
68
43
|
}
|
69
44
|
`;
|
70
|
-
const ErrorBox = styled.span `
|
71
|
-
margin-top: 7px;
|
72
|
-
color: ${theme.colors.error};
|
73
|
-
font-size: 12px;
|
74
|
-
`;
|
75
45
|
//# sourceMappingURL=TextInput.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAa,UAAU,EAAgB,MAAM,OAAO,CAAA;AAClE,OAAO,MAAM,MAAM,mBAAmB,CAAA;
|
1
|
+
{"version":3,"file":"TextInput.js","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAAa,UAAU,EAAgB,MAAM,OAAO,CAAA;AAClE,OAAO,MAAM,MAAM,mBAAmB,CAAA;AAEtC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AA4BzC,MAAM,CAAC,MAAM,SAAS,GAAG,UAAU,CAAC,SAAS,SAAS,CACpD,EAaiB,EACjB,GAAmC;QAdnC,EACE,EAAE,EAAE,MAAM,EACV,IAAI,GAAG,MAAM,EACb,WAAW,EACX,IAAI,EACJ,KAAK,EACL,QAAQ,GAAG,KAAK,EAChB,KAAK,GAAG,KAAK,EACb,MAAM,EACN,QAAQ,EACR,aAAa,EACb,QAAQ,GAAG,KAAK,OAED,EADZ,UAAU,cAZf,sHAaC,CADc;IAIf,MAAM,EAAE,GAAG,WAAW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vD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;aAC1C,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;;;aAGtD,KAAK,CAAC,MAAM,CAAC,OAAO;;CAEhC,CAAA"}
|
@@ -2,38 +2,24 @@ import React, { FormEvent } from 'react';
|
|
2
2
|
declare type BaseProps = {
|
3
3
|
id?: string;
|
4
4
|
className?: string;
|
5
|
-
/** Placeholder */
|
6
5
|
placeholder?: string;
|
7
|
-
/** label displayed above the input */
|
8
6
|
label?: string;
|
9
|
-
/** used for label - input connection */
|
10
7
|
name?: string;
|
11
|
-
/** input value */
|
12
8
|
value: string;
|
13
|
-
/** error flag */
|
14
9
|
error?: boolean;
|
15
|
-
/** error text message */
|
16
10
|
errorMsg?: string;
|
17
|
-
/** Allow user to resize the textarea vertically and horizontally or not */
|
18
11
|
resize?: 'none' | 'both';
|
19
|
-
/** Disabled flag */
|
20
12
|
disabled?: boolean;
|
21
|
-
/** maxLength property */
|
22
13
|
maxLength?: number;
|
23
|
-
/** onBlur listener */
|
24
14
|
onBlur?: (e: FormEvent<HTMLTextAreaElement>) => void;
|
25
|
-
/** number of rows of input */
|
26
15
|
rows?: number;
|
27
|
-
/** Required flag */
|
28
16
|
required?: boolean;
|
17
|
+
renderAsTitle?: boolean;
|
29
18
|
};
|
30
|
-
/** on change or on input required */
|
31
19
|
declare type TruncateProps = {
|
32
|
-
/** on change is required and on input optional */
|
33
20
|
onChange: (e: string) => void;
|
34
21
|
onInputChange?: (e: FormEvent<HTMLTextAreaElement>) => void;
|
35
22
|
} | {
|
36
|
-
/** on input is required and on change optional */
|
37
23
|
onChange?: (e: string) => void;
|
38
24
|
onInputChange: (e: FormEvent<HTMLTextAreaElement>) => void;
|
39
25
|
};
|
@@ -1,26 +1,30 @@
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
2
|
+
var t = {};
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
4
|
+
t[p] = s[p];
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
8
|
+
t[p[i]] = s[p[i]];
|
9
|
+
}
|
10
|
+
return t;
|
11
|
+
};
|
1
12
|
import React, { forwardRef } from 'react';
|
2
13
|
import styled from 'styled-components';
|
3
14
|
import { darken } from 'polished';
|
4
|
-
import { Text } from '../Text';
|
5
|
-
import { Box } from '../Box';
|
6
15
|
import { theme } from '../theme';
|
7
16
|
import { useUniqueId } from '../utils/id';
|
8
|
-
|
17
|
+
import { Field } from '../Field';
|
18
|
+
export const Textarea = forwardRef(function Textarea(_a, ref) {
|
19
|
+
var { id: idProp, name, value, onChange, onInputChange, resize = 'none', error = false, placeholder, disabled = false, maxLength, onBlur, rows = 4 } = _a, fieldProps = __rest(_a, ["id", "name", "value", "onChange", "onInputChange", "resize", "error", "placeholder", "disabled", "maxLength", "onBlur", "rows"]);
|
9
20
|
const id = useUniqueId(idProp);
|
10
|
-
return (React.createElement(
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
React.createElement(Field, { error: error, id: id, name: name, disabled: disabled, resize: resize, placeholder: placeholder, value: value, onChange: (e) => {
|
16
|
-
onChange && onChange(e.currentTarget.value);
|
17
|
-
onInputChange && onInputChange(e);
|
18
|
-
}, maxLength: maxLength, ref: ref, onBlur: (e) => {
|
19
|
-
onBlur && onBlur(e);
|
20
|
-
}, rows: rows })),
|
21
|
-
error && React.createElement(ErrorBox, null, errorMsg)));
|
21
|
+
return (React.createElement(Field, Object.assign({}, fieldProps, { id: id, error: error, value: value, fullHeight: true }),
|
22
|
+
React.createElement(StyledTextArea, { error: error, id: id, name: name, disabled: disabled, resize: resize, placeholder: placeholder, value: value, onChange: (e) => {
|
23
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e.currentTarget.value);
|
24
|
+
onInputChange === null || onInputChange === void 0 ? void 0 : onInputChange(e);
|
25
|
+
}, maxLength: maxLength, onBlur: onBlur, rows: rows })));
|
22
26
|
});
|
23
|
-
const
|
27
|
+
const StyledTextArea = styled.textarea `
|
24
28
|
font-size: 16px;
|
25
29
|
line-height: 20px;
|
26
30
|
background: ${theme.colors.white};
|
@@ -48,9 +52,4 @@ const Field = styled.textarea `
|
|
48
52
|
border-color: ${theme.colors.outline};
|
49
53
|
`}
|
50
54
|
`;
|
51
|
-
const ErrorBox = styled.span `
|
52
|
-
margin-top: 7px;
|
53
|
-
font-size: 12px;
|
54
|
-
color: ${theme.colors.error};
|
55
|
-
`;
|
56
55
|
//# sourceMappingURL=Textarea.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../src/Textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA2B,UAAU,EAAE,MAAM,OAAO,CAAA;AAClE,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,
|
1
|
+
{"version":3,"file":"Textarea.js","sourceRoot":"","sources":["../../src/Textarea/Textarea.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,EAAE,EAA2B,UAAU,EAAE,MAAM,OAAO,CAAA;AAClE,OAAO,MAAM,MAAM,mBAAmB,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,E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,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM;YACtB,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC;aACpD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC;kBACrC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAC5B,KAAK,CAAC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;;;;;;oBAM9B,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAC5B,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC;;;IAGhE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CACd,KAAK;IACL,KAAK,IAAI,EAAE;IACX;sBACkB,KAAK,CAAC,MAAM,CAAC,OAAO;KACrC;CACJ,CAAA"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,OAAO,CAAA;AACrB,cAAc,UAAU,CAAA;AACxB,cAAc,QAAQ,CAAA;AACtB,cAAc,YAAY,CAAA;AAC1B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,QAAQ,CAAA;AACtB,cAAc,4BAA4B,CAAA;AAC1C,cAAc,cAAc,CAAA;AAC5B,cAAc,WAAW,CAAA;AACzB,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA;A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Ac,aAAa,CAAA;AAC3B,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,YAAY,CAAA"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@mrshmllw/smores-react",
|
3
|
-
"version": "2.
|
3
|
+
"version": "2.2.0",
|
4
4
|
"main": "./dist/index.js",
|
5
5
|
"description": "Collection of React components used by Marshmallow Technology",
|
6
6
|
"keywords": [
|
@@ -41,7 +41,7 @@
|
|
41
41
|
"@testing-library/react": "^12.0.0",
|
42
42
|
"@testing-library/react-hooks": "^8.0.0",
|
43
43
|
"@types/jest": "^28.1.1",
|
44
|
-
"@types/node": "^
|
44
|
+
"@types/node": "^18.0.0",
|
45
45
|
"@types/react": "^17.0.0",
|
46
46
|
"@types/react-dom": "^17.0.9",
|
47
47
|
"@types/styled-components": "^5.1.3",
|