react-restyle-components 0.1.45 → 0.1.46
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/lib/cjs/App.js +12 -36
- package/lib/cjs/App.test.js +8 -10
- package/lib/cjs/core-components/atoms/buttons/button.stories.js +24 -26
- package/lib/cjs/core-components/atoms/buttons/buttons.component.js +9 -27
- package/lib/cjs/core-components/atoms/buttons/buttons.test.js +7 -15
- package/lib/cjs/core-components/atoms/check-box/checkBox.component.js +35 -102
- package/lib/cjs/core-components/atoms/check-box/checkBox.stories.js +17 -17
- package/lib/cjs/core-components/atoms/check-box/checkBox.test.js +7 -15
- package/lib/cjs/core-components/atoms/date-picker/date-picker.component.js +37 -98
- package/lib/cjs/core-components/atoms/date-picker/date-picker.stories.js +15 -17
- package/lib/cjs/core-components/atoms/date-picker/date-picker.test.js +7 -16
- package/lib/cjs/core-components/atoms/form/form.component.js +159 -571
- package/lib/cjs/core-components/atoms/form/form.test.js +59 -87
- package/lib/cjs/core-components/atoms/icons/icons.component.js +58 -41
- package/lib/cjs/core-components/atoms/icons/icons.component.js.map +1 -1
- package/lib/cjs/core-components/atoms/icons/icons.stories.js +23 -0
- package/lib/cjs/core-components/atoms/icons/icons.stories.js.map +1 -0
- package/lib/cjs/core-components/atoms/icons/icons.test.js +16 -0
- package/lib/cjs/core-components/atoms/icons/icons.test.js.map +1 -0
- package/lib/cjs/core-components/atoms/input/input-otp.component.js +76 -118
- package/lib/cjs/core-components/atoms/input/input-pin.component.js +98 -180
- package/lib/cjs/core-components/atoms/input/input-pin.stories.js +14 -14
- package/lib/cjs/core-components/atoms/input/input-pin.test.js +10 -28
- package/lib/cjs/core-components/atoms/input/input.component.js +33 -104
- package/lib/cjs/core-components/atoms/input/input.stories.js +15 -15
- package/lib/cjs/core-components/atoms/input/input.test.js +10 -30
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.component.js +53 -127
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.stories.js +12 -12
- package/lib/cjs/core-components/atoms/input-dropdown/input-dropdown.test.js +7 -16
- package/lib/cjs/core-components/atoms/loader/loader.component.js +21 -83
- package/lib/cjs/core-components/atoms/loader/loader.stories.js +8 -8
- package/lib/cjs/core-components/atoms/loader/loader.test.js +7 -11
- package/lib/cjs/core-components/atoms/radio/radio.component.js +37 -102
- package/lib/cjs/core-components/atoms/radio/radio.stories.js +16 -16
- package/lib/cjs/core-components/atoms/radio/radio.test.js +7 -15
- package/lib/cjs/core-components/atoms/stepper/stepper.component.js +34 -77
- package/lib/cjs/core-components/atoms/stepper/stepper.stories.js +13 -13
- package/lib/cjs/core-components/atoms/stepper/stepper.test.js +7 -16
- package/lib/cjs/core-components/atoms/tabs/tabs.component.js +32 -81
- package/lib/cjs/core-components/atoms/tabs/tabs.stories.js +16 -16
- package/lib/cjs/core-components/atoms/tabs/tabs.stories.js.map +1 -1
- package/lib/cjs/core-components/atoms/tabs/tabs.test.js +13 -20
- package/lib/cjs/core-components/atoms/timer/timer.component.js +92 -119
- package/lib/cjs/core-components/atoms/timer/timer.test.js +10 -20
- package/lib/cjs/core-components/atoms/tooltip/tooltip.component.js +45 -85
- package/lib/cjs/core-components/atoms/tooltip/tooltip.component.test.js +9 -13
- package/lib/cjs/core-components/atoms/tooltip/tooltip.stories.js +8 -8
- package/lib/cjs/core-components/index.js +27 -64
- package/lib/cjs/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +106 -210
- package/lib/cjs/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.test.js +9 -23
- package/lib/cjs/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.stories.js +36 -38
- package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +104 -209
- package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.test.js +16 -28
- package/lib/cjs/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js +22 -24
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.component.js +106 -203
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +8 -8
- package/lib/cjs/core-components/molecules/css-multiline-input/css-multiline-input.test.js +7 -14
- package/lib/cjs/core-components/molecules/css-multiline-input/css-properties.js +159 -159
- package/lib/cjs/core-utils/index.js +15 -31
- package/lib/cjs/core-utils/unit-test.utils.js +6 -8
- package/lib/cjs/index.js +15 -31
- package/lib/cjs/library/assets/svg/DownArrow.svg +14 -0
- package/lib/cjs/library/assets/svg/UpArrow.svg +14 -0
- package/lib/cjs/library/assets/svg/checkedBox.svg +14 -0
- package/lib/cjs/library/assets/svg/checkedRadio.svg +13 -0
- package/lib/cjs/library/assets/svg/datePicker.svg +3 -0
- package/lib/cjs/library/assets/svg/index.js +13 -39
- package/lib/cjs/library/assets/svg/index.ts +38 -0
- package/lib/cjs/library/assets/svg/timer copy.svg +3 -0
- package/lib/cjs/library/assets/svg/timer.svg +3 -0
- package/lib/cjs/library/assets/svg/unCheckbox.svg +3 -0
- package/lib/cjs/library/assets/svg/uncheckRadio.svg +3 -0
- package/lib/cjs/reportWebVitals.js +1 -1
- package/lib/cjs/setupTests.js +1 -1
- package/lib/esm/App.js +12 -34
- package/lib/esm/App.test.js +8 -8
- package/lib/esm/core-components/atoms/buttons/button.stories.js +24 -24
- package/lib/esm/core-components/atoms/buttons/buttons.component.js +7 -23
- package/lib/esm/core-components/atoms/buttons/buttons.test.js +7 -13
- package/lib/esm/core-components/atoms/check-box/checkBox.component.js +19 -65
- package/lib/esm/core-components/atoms/check-box/checkBox.stories.js +18 -18
- package/lib/esm/core-components/atoms/check-box/checkBox.test.js +7 -13
- package/lib/esm/core-components/atoms/date-picker/date-picker.component.js +21 -54
- package/lib/esm/core-components/atoms/date-picker/date-picker.stories.js +14 -14
- package/lib/esm/core-components/atoms/date-picker/date-picker.test.js +8 -15
- package/lib/esm/core-components/atoms/form/form.component.js +138 -513
- package/lib/esm/core-components/atoms/form/form.test.js +60 -78
- package/lib/esm/core-components/atoms/icons/icons.component.js +32 -36
- package/lib/esm/core-components/atoms/icons/icons.component.js.map +1 -1
- package/lib/esm/core-components/atoms/icons/icons.stories.js +20 -0
- package/lib/esm/core-components/atoms/icons/icons.stories.js.map +1 -0
- package/lib/esm/core-components/atoms/icons/icons.test.js +11 -0
- package/lib/esm/core-components/atoms/icons/icons.test.js.map +1 -0
- package/lib/esm/core-components/atoms/input/input-otp.component.js +59 -80
- package/lib/esm/core-components/atoms/input/input-pin.component.js +81 -142
- package/lib/esm/core-components/atoms/input/input-pin.stories.js +15 -15
- package/lib/esm/core-components/atoms/input/input-pin.test.js +10 -26
- package/lib/esm/core-components/atoms/input/input.component.js +16 -66
- package/lib/esm/core-components/atoms/input/input.stories.js +16 -16
- package/lib/esm/core-components/atoms/input/input.test.js +10 -28
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.component.js +36 -95
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.stories.js +13 -13
- package/lib/esm/core-components/atoms/input-dropdown/input-dropdown.test.js +7 -14
- package/lib/esm/core-components/atoms/loader/loader.component.js +20 -80
- package/lib/esm/core-components/atoms/loader/loader.stories.js +9 -9
- package/lib/esm/core-components/atoms/loader/loader.test.js +7 -7
- package/lib/esm/core-components/atoms/radio/radio.component.js +21 -65
- package/lib/esm/core-components/atoms/radio/radio.stories.js +17 -17
- package/lib/esm/core-components/atoms/radio/radio.test.js +7 -13
- package/lib/esm/core-components/atoms/stepper/stepper.component.js +32 -74
- package/lib/esm/core-components/atoms/stepper/stepper.stories.js +14 -14
- package/lib/esm/core-components/atoms/stepper/stepper.test.js +7 -14
- package/lib/esm/core-components/atoms/tabs/tabs.component.js +15 -43
- package/lib/esm/core-components/atoms/tabs/tabs.stories.js +17 -17
- package/lib/esm/core-components/atoms/tabs/tabs.stories.js.map +1 -1
- package/lib/esm/core-components/atoms/tabs/tabs.test.js +13 -18
- package/lib/esm/core-components/atoms/timer/timer.component.js +75 -81
- package/lib/esm/core-components/atoms/timer/timer.test.js +10 -10
- package/lib/esm/core-components/atoms/tooltip/tooltip.component.js +25 -46
- package/lib/esm/core-components/atoms/tooltip/tooltip.component.test.js +9 -9
- package/lib/esm/core-components/atoms/tooltip/tooltip.stories.js +9 -9
- package/lib/esm/core-components/index.js +19 -19
- package/lib/esm/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.js +88 -170
- package/lib/esm/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.component.test.js +9 -17
- package/lib/esm/core-components/molecules/auto-complete-filter-multiple-select-multiple-fields-display/auto-complete-filter-multiple-select-multiple-fields-display.stories.js +37 -38
- package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.js +86 -169
- package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.component.test.js +16 -22
- package/lib/esm/core-components/molecules/auto-complete-filter-single-select-multiple-fields-display/auto-complete-filter-single-select-multiple-fields-display.stories.js +23 -24
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.component.js +90 -166
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.stories.js +9 -9
- package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.test.js +7 -9
- package/lib/esm/core-components/molecules/css-multiline-input/css-properties.js +159 -159
- package/lib/esm/core-utils/index.js +2 -2
- package/lib/esm/core-utils/unit-test.utils.js +5 -5
- package/lib/esm/index.js +2 -2
- package/lib/esm/library/assets/svg/index.js +10 -19
- package/lib/esm/reportWebVitals.js +1 -1
- package/lib/esm/setupTests.js +2 -2
- package/lib/package.json +125 -0
- package/package.json +3 -2
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import { render } from
|
|
3
|
-
import { AutoCompleteFilterSingleSelectMultiFieldsDisplay } from
|
|
4
|
-
describe(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
onSelect: () => jest.fn(),
|
|
17
|
-
onFilter: () => jest.fn(),
|
|
18
|
-
}),
|
|
19
|
-
);
|
|
20
|
-
expect(autoCompleteFilterSingleSelectMultiFieldsDisplay).toMatchSnapshot();
|
|
21
|
-
});
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { render } from '@testing-library/react';
|
|
3
|
+
import { AutoCompleteFilterSingleSelectMultiFieldsDisplay } from './auto-complete-filter-single-select-multiple-fields-display.component';
|
|
4
|
+
describe('AutoCompleteFilterSingleSelectMultiFieldsDisplay component', () => {
|
|
5
|
+
it('render autoCompleteFilterSingleSelectMultiFieldsDisplay correctly', () => {
|
|
6
|
+
const autoCompleteFilterSingleSelectMultiFieldsDisplay = render(React.createElement(AutoCompleteFilterSingleSelectMultiFieldsDisplay, { data: {
|
|
7
|
+
list: [
|
|
8
|
+
{ code: 'Lims', name: 'plus' },
|
|
9
|
+
{ code: 'Lims', name: 'plus' },
|
|
10
|
+
{ code: 'Lims', name: 'plus' },
|
|
11
|
+
],
|
|
12
|
+
displayKey: ['name'],
|
|
13
|
+
}, onSelect: () => jest.fn(), onFilter: () => jest.fn() }));
|
|
14
|
+
expect(autoCompleteFilterSingleSelectMultiFieldsDisplay).toMatchSnapshot();
|
|
15
|
+
});
|
|
22
16
|
});
|
|
23
|
-
//# sourceMappingURL=auto-complete-filter-single-select-multiple-fields-display.component.test.js.map
|
|
17
|
+
//# sourceMappingURL=auto-complete-filter-single-select-multiple-fields-display.component.test.js.map
|
|
@@ -1,30 +1,29 @@
|
|
|
1
|
-
import { AutoCompleteFilterSingleSelectMultiFieldsDisplay } from
|
|
1
|
+
import { AutoCompleteFilterSingleSelectMultiFieldsDisplay } from './auto-complete-filter-single-select-multiple-fields-display.component';
|
|
2
2
|
const meta = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
},
|
|
3
|
+
title: 'Design System/Molecules/AutoCompleteFilterSingleSelectMultiFieldsDisplay',
|
|
4
|
+
component: AutoCompleteFilterSingleSelectMultiFieldsDisplay,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
parameters: {
|
|
7
|
+
componentSubtitle: `import { AutoCompleteFilterSingleSelectMultiFieldsDisplay } from 'react-restyle-components'`,
|
|
8
|
+
// backgrounds: {
|
|
9
|
+
// default: 'light-gray',
|
|
10
|
+
// },
|
|
11
|
+
},
|
|
13
12
|
};
|
|
14
13
|
export default meta;
|
|
15
14
|
export const Primary = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
15
|
+
args: {
|
|
16
|
+
data: {
|
|
17
|
+
list: [
|
|
18
|
+
{ code: 'Code1', name: 'Value1' },
|
|
19
|
+
{ code: 'Code2', name: 'Value2' },
|
|
20
|
+
{ code: 'Code3', name: 'Value3' },
|
|
21
|
+
],
|
|
22
|
+
displayKey: ['name'],
|
|
23
|
+
},
|
|
24
|
+
onSelect: (item) => {
|
|
25
|
+
console.log({ item });
|
|
26
|
+
},
|
|
27
27
|
},
|
|
28
|
-
},
|
|
29
28
|
};
|
|
30
|
-
//# sourceMappingURL=auto-complete-filter-single-select-multiple-fields-display.stories.js.map
|
|
29
|
+
//# sourceMappingURL=auto-complete-filter-single-select-multiple-fields-display.stories.js.map
|
package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.component.js
CHANGED
|
@@ -1,178 +1,102 @@
|
|
|
1
|
-
import React, { useEffect, useState, useRef } from
|
|
2
|
-
import { Form } from
|
|
3
|
-
import { properties as propertiesObj } from
|
|
1
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
2
|
+
import { Form } from '../..';
|
|
3
|
+
import { properties as propertiesObj } from './css-properties';
|
|
4
4
|
const mapToArray = (arr) => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
const res = [];
|
|
6
|
+
arr.forEach(function (obj, index) {
|
|
7
|
+
const key = Object.keys(obj)[0];
|
|
8
|
+
const value = key;
|
|
9
|
+
res.push([value, obj[key]]);
|
|
10
|
+
});
|
|
11
|
+
return res;
|
|
12
12
|
};
|
|
13
13
|
const data = mapToArray(propertiesObj);
|
|
14
|
-
export const CSSMultiline = ({
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
style = {},
|
|
19
|
-
placeholder = "Like fontSize: 12,backgroundColor:'#000000',",
|
|
20
|
-
onChange,
|
|
21
|
-
}) => {
|
|
22
|
-
const value = useRef("");
|
|
23
|
-
const [properties, setProperties] = useState([]);
|
|
24
|
-
const [isListOpen, setIsListOpen] = useState(false);
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
value.current = defaultValue;
|
|
27
|
-
setProperties(data);
|
|
28
|
-
}, [defaultValue]);
|
|
29
|
-
const useOutsideAlerter = (ref) => {
|
|
14
|
+
export const CSSMultiline = ({ label = 'Main Box CSS', defaultValue = '', className = '', style = {}, placeholder = "Like fontSize: 12,backgroundColor:'#000000',", onChange, }) => {
|
|
15
|
+
const value = useRef('');
|
|
16
|
+
const [properties, setProperties] = useState([]);
|
|
17
|
+
const [isListOpen, setIsListOpen] = useState(false);
|
|
30
18
|
useEffect(() => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
19
|
+
value.current = defaultValue;
|
|
20
|
+
setProperties(data);
|
|
21
|
+
}, [defaultValue]);
|
|
22
|
+
const useOutsideAlerter = (ref) => {
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
function handleClickOutside(event) {
|
|
25
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
26
|
+
setIsListOpen(false);
|
|
27
|
+
onChange(value.current);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
31
|
+
return () => {
|
|
32
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
33
|
+
};
|
|
34
|
+
}, [ref]);
|
|
35
|
+
};
|
|
36
|
+
const wrapperRef = useRef(null);
|
|
37
|
+
useOutsideAlerter(wrapperRef);
|
|
38
|
+
const list = [];
|
|
39
|
+
const filter = (css) => {
|
|
40
|
+
let matchString = css === null || css === void 0 ? void 0 : css.split(',');
|
|
41
|
+
matchString = matchString[(matchString === null || matchString === void 0 ? void 0 : matchString.length) - 1];
|
|
42
|
+
matchString = matchString === null || matchString === void 0 ? void 0 : matchString.split(':')[0];
|
|
43
|
+
matchString = matchString === null || matchString === void 0 ? void 0 : matchString.split("'")[0];
|
|
44
|
+
if ((css === null || css === void 0 ? void 0 : css.length) == 0)
|
|
45
|
+
return setProperties(data);
|
|
46
|
+
else {
|
|
47
|
+
data === null || data === void 0 ? void 0 : data.map((item) => {
|
|
48
|
+
var _a;
|
|
49
|
+
const innerItem = [];
|
|
50
|
+
const isItems = (_a = item[0]) === null || _a === void 0 ? void 0 : _a.startsWith(matchString);
|
|
51
|
+
if (isItems)
|
|
52
|
+
innerItem.push(item[0]);
|
|
53
|
+
if ((innerItem === null || innerItem === void 0 ? void 0 : innerItem.length) > 0)
|
|
54
|
+
list.push([item[0], item[1]]);
|
|
55
|
+
});
|
|
56
|
+
setProperties(list);
|
|
35
57
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
let matchString = css === null || css === void 0 ? void 0 : css.split(",");
|
|
48
|
-
matchString =
|
|
49
|
-
matchString[
|
|
50
|
-
(matchString === null || matchString === void 0
|
|
51
|
-
? void 0
|
|
52
|
-
: matchString.length) - 1
|
|
53
|
-
];
|
|
54
|
-
matchString =
|
|
55
|
-
matchString === null || matchString === void 0
|
|
56
|
-
? void 0
|
|
57
|
-
: matchString.split(":")[0];
|
|
58
|
-
matchString =
|
|
59
|
-
matchString === null || matchString === void 0
|
|
60
|
-
? void 0
|
|
61
|
-
: matchString.split("'")[0];
|
|
62
|
-
if ((css === null || css === void 0 ? void 0 : css.length) == 0)
|
|
63
|
-
return setProperties(data);
|
|
64
|
-
else {
|
|
65
|
-
data === null || data === void 0
|
|
66
|
-
? void 0
|
|
67
|
-
: data.map((item) => {
|
|
68
|
-
var _a;
|
|
69
|
-
const innerItem = [];
|
|
70
|
-
const isItems =
|
|
71
|
-
(_a = item[0]) === null || _a === void 0
|
|
72
|
-
? void 0
|
|
73
|
-
: _a.startsWith(matchString);
|
|
74
|
-
if (isItems) innerItem.push(item[0]);
|
|
75
|
-
if (
|
|
76
|
-
(innerItem === null || innerItem === void 0
|
|
77
|
-
? void 0
|
|
78
|
-
: innerItem.length) > 0
|
|
79
|
-
)
|
|
80
|
-
list.push([item[0], item[1]]);
|
|
81
|
-
});
|
|
82
|
-
setProperties(list);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const onKeyUp = (e) => {
|
|
86
|
-
setIsListOpen(true);
|
|
87
|
-
};
|
|
88
|
-
return React.createElement(
|
|
89
|
-
"div",
|
|
90
|
-
{ className: "flex flex-col w-full", ref: wrapperRef },
|
|
91
|
-
React.createElement(Form.MultilineInput, {
|
|
92
|
-
label: label,
|
|
93
|
-
style: Object.assign(
|
|
94
|
-
{ color: "#ffffff", backgroundColor: "#000000" },
|
|
95
|
-
style,
|
|
96
|
-
),
|
|
97
|
-
placeholder: placeholder,
|
|
98
|
-
value: value.current,
|
|
99
|
-
className: className,
|
|
100
|
-
onKeyUp: onKeyUp,
|
|
101
|
-
onChange: (css) => {
|
|
102
|
-
value.current = css;
|
|
103
|
-
filter(css);
|
|
104
|
-
},
|
|
105
|
-
}),
|
|
106
|
-
isListOpen &&
|
|
107
|
-
React.createElement(
|
|
108
|
-
"div",
|
|
109
|
-
{ style: { marginTop: -10 } },
|
|
110
|
-
React.createElement(
|
|
111
|
-
"ul",
|
|
112
|
-
{
|
|
113
|
-
className:
|
|
114
|
-
"flex flex-col max-h-40 bg-black m-2 text-white overflow-y-scroll ",
|
|
115
|
-
},
|
|
116
|
-
properties === null || properties === void 0
|
|
117
|
-
? void 0
|
|
118
|
-
: properties.map((item, index) => {
|
|
58
|
+
};
|
|
59
|
+
const onKeyUp = (e) => {
|
|
60
|
+
setIsListOpen(true);
|
|
61
|
+
};
|
|
62
|
+
return (React.createElement("div", { className: "flex flex-col w-full", ref: wrapperRef },
|
|
63
|
+
React.createElement(Form.MultilineInput, { label: label, style: Object.assign({ color: '#ffffff', backgroundColor: '#000000' }, style), placeholder: placeholder, value: value.current, className: className, onKeyUp: onKeyUp, onChange: (css) => {
|
|
64
|
+
value.current = css;
|
|
65
|
+
filter(css);
|
|
66
|
+
} }),
|
|
67
|
+
isListOpen && (React.createElement("div", { style: { marginTop: -10 } },
|
|
68
|
+
React.createElement("ul", { className: "flex flex-col max-h-40 bg-black m-2 text-white overflow-y-scroll " }, properties === null || properties === void 0 ? void 0 : properties.map((item, index) => {
|
|
119
69
|
var _a;
|
|
120
|
-
return React.createElement(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
item[0],
|
|
127
|
-
),
|
|
128
|
-
(_a = item[1]) === null || _a === void 0
|
|
129
|
-
? void 0
|
|
130
|
-
: _a.map((prop) =>
|
|
131
|
-
React.createElement(
|
|
132
|
-
"li",
|
|
133
|
-
{
|
|
134
|
-
className:
|
|
135
|
-
"flex -mt-2 px-2 h-8 bg-slate-800 rounded-md items-center cursor-pointer",
|
|
136
|
-
onClick: () => {
|
|
137
|
-
var _a;
|
|
138
|
-
let existsString =
|
|
139
|
-
(_a = value.current) === null || _a === void 0
|
|
140
|
-
? void 0
|
|
141
|
-
: _a.split(",");
|
|
142
|
-
if (value.current.includes(",")) {
|
|
70
|
+
return (React.createElement("li", { key: index, className: "flex flex-col gap-4 p-2" },
|
|
71
|
+
React.createElement("span", { className: "underline" }, item[0]), (_a = item[1]) === null || _a === void 0 ? void 0 :
|
|
72
|
+
_a.map((prop) => (React.createElement("li", { className: "flex -mt-2 px-2 h-8 bg-slate-800 rounded-md items-center cursor-pointer", onClick: () => {
|
|
73
|
+
var _a;
|
|
74
|
+
let existsString = (_a = value.current) === null || _a === void 0 ? void 0 : _a.split(',');
|
|
75
|
+
if (value.current.includes(',')) {
|
|
143
76
|
existsString = existsString.map((item) => {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
? void 0
|
|
147
|
-
: item.includes(":")
|
|
148
|
-
)
|
|
149
|
-
return item;
|
|
77
|
+
if (item === null || item === void 0 ? void 0 : item.includes(':'))
|
|
78
|
+
return item;
|
|
150
79
|
});
|
|
151
|
-
if (prop !=
|
|
152
|
-
|
|
153
|
-
else
|
|
80
|
+
if (prop != 'number')
|
|
81
|
+
existsString.push(`${item[0]}:'${prop}',`);
|
|
82
|
+
else
|
|
83
|
+
existsString.push(`${item[0]}:1,`);
|
|
154
84
|
value.current = existsString
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
85
|
+
.join(',')
|
|
86
|
+
.replaceAll(',,', ',');
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
if (prop != 'number')
|
|
90
|
+
value.current = `${item[0]}:'${prop}',`;
|
|
160
91
|
else {
|
|
161
|
-
|
|
92
|
+
value.current = `${item[0]}:1,`;
|
|
162
93
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
),
|
|
171
|
-
),
|
|
172
|
-
);
|
|
173
|
-
}),
|
|
174
|
-
),
|
|
175
|
-
),
|
|
176
|
-
);
|
|
94
|
+
}
|
|
95
|
+
filter(existsString.join(''));
|
|
96
|
+
} },
|
|
97
|
+
' ',
|
|
98
|
+
prop,
|
|
99
|
+
' ')))));
|
|
100
|
+
}))))));
|
|
177
101
|
};
|
|
178
|
-
//# sourceMappingURL=css-multiline-input.component.js.map
|
|
102
|
+
//# sourceMappingURL=css-multiline-input.component.js.map
|
package/lib/esm/core-components/molecules/css-multiline-input/css-multiline-input.stories.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { CSSMultiline } from
|
|
1
|
+
import { CSSMultiline } from './css-multiline-input.component';
|
|
2
2
|
const meta = {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
title: 'Design System/Molecules/CSSMultiline',
|
|
4
|
+
component: CSSMultiline,
|
|
5
|
+
tags: ['autodocs'],
|
|
6
|
+
parameters: {
|
|
7
|
+
componentSubtitle: `import { CSSMultiline } from 'react-restyle-components'`,
|
|
8
|
+
},
|
|
9
9
|
};
|
|
10
10
|
export default meta;
|
|
11
11
|
export const Primary = {
|
|
12
|
-
|
|
12
|
+
args: {},
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=css-multiline-input.stories.js.map
|
|
14
|
+
//# sourceMappingURL=css-multiline-input.stories.js.map
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
/* eslint-disable testing-library/await-async-query */
|
|
2
2
|
/* eslint-disable testing-library/prefer-screen-queries */
|
|
3
3
|
/* eslint-disable testing-library/render-result-naming-convention */
|
|
4
|
-
import React from
|
|
5
|
-
import { render } from
|
|
6
|
-
import { CSSMultiline } from
|
|
7
|
-
it(
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
);
|
|
11
|
-
expect(result).toMatchSnapshot();
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { render } from '@core-utils';
|
|
6
|
+
import { CSSMultiline } from './css-multiline-input.component';
|
|
7
|
+
it('render CSSMultiline correctly', () => {
|
|
8
|
+
const result = render(React.createElement(CSSMultiline, { onChange: () => { } }));
|
|
9
|
+
expect(result).toMatchSnapshot();
|
|
12
10
|
});
|
|
13
|
-
//# sourceMappingURL=css-multiline-input.test.js.map
|
|
11
|
+
//# sourceMappingURL=css-multiline-input.test.js.map
|