@homefile/components-v2 2.8.24 → 2.8.25
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/components/inputs/ItemSubTypeSelect.js +1 -1
- package/dist/stories/forms/ItemFormPanel/ItemFormPanel.stories.js +10 -2
- package/dist/stories/inputs/ItemSubTypeSelect.stories.d.ts +1 -1
- package/dist/stories/inputs/ItemSubTypeSelect.stories.js +1 -1
- package/package.json +1 -1
- package/src/components/inputs/ItemSubTypeSelect.tsx +3 -3
- package/src/stories/forms/ItemFormPanel/ItemFormPanel.stories.tsx +15 -0
- package/src/stories/inputs/ItemSubTypeSelect.stories.tsx +1 -1
|
@@ -2,5 +2,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box, Flex, Text } from '@chakra-ui/react';
|
|
3
3
|
import { SelectInput } from '..';
|
|
4
4
|
export const ItemSubTypeSelect = ({ onSelectSubType, subTypes, initialSubType, label, }) => {
|
|
5
|
-
return (_jsx(Box, { bg: "lightBlue.1", py: "1rem",
|
|
5
|
+
return (_jsx(Box, { bg: "lightBlue.1", py: "1rem", px: "base", children: initialSubType && (_jsxs(Flex, { alignItems: "center", gap: "base", children: [label && _jsx(Text, { flexShrink: 0, children: label }), _jsx(SelectInput, { handleClick: onSelectSubType, initialValue: initialSubType.name, items: subTypes })] })) }));
|
|
6
6
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ItemFormPanel, ItemFormTabs, ItemNameHeader, RightPanel, } from '../../../components';
|
|
2
|
+
import { ItemFormPanel, ItemFormTabs, ItemNameHeader, ItemSubTypeSelect, RightPanel, } from '../../../components';
|
|
3
3
|
import { Paint } from '../../../assets/images/groups';
|
|
4
4
|
import { action } from '@storybook/addon-actions';
|
|
5
5
|
import { contactFieldsMock } from '../../../mocks';
|
|
@@ -16,5 +16,13 @@ export default {
|
|
|
16
16
|
},
|
|
17
17
|
};
|
|
18
18
|
export const ItemFormPanelComponent = (args) => {
|
|
19
|
-
return (_jsx(RightPanel, { isOpen: true, onClose: () => null, children: _jsxs(ItemFormPanel, Object.assign({}, args, { children: [_jsx(ItemNameHeader, { id: "item-name-header", onSave: action('onSaveItemName') }), _jsx(
|
|
19
|
+
return (_jsx(RightPanel, { isOpen: true, onClose: () => null, children: _jsxs(ItemFormPanel, Object.assign({}, args, { children: [_jsx(ItemNameHeader, { id: "item-name-header", onSave: action('onSaveItemName') }), _jsx(ItemSubTypeSelect, { initialSubType: {
|
|
20
|
+
_id: '1',
|
|
21
|
+
name: 'Sub Type',
|
|
22
|
+
}, onSelectSubType: action('onSelectSubType'), label: "Category", subTypes: [
|
|
23
|
+
{
|
|
24
|
+
_id: '1',
|
|
25
|
+
name: 'Sub Type',
|
|
26
|
+
},
|
|
27
|
+
] }), _jsx(ItemFormTabs, { form: contactFieldsMock })] })) }));
|
|
20
28
|
};
|
|
@@ -5,7 +5,7 @@ export default _default;
|
|
|
5
5
|
export declare const ItemSubTypeSelectComponent: {
|
|
6
6
|
(args: ItemSubTypeSelectI): import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
args: {
|
|
8
|
-
|
|
8
|
+
onSelectSubType: () => null;
|
|
9
9
|
subTypes: {
|
|
10
10
|
_id: string;
|
|
11
11
|
name: string;
|
|
@@ -10,7 +10,7 @@ export const ItemSubTypeSelectComponent = (args) => {
|
|
|
10
10
|
return (_jsx(Center, { width: "fit-content", p: "base", bg: "white", children: _jsx(ItemSubTypeSelect, Object.assign({}, args)) }));
|
|
11
11
|
};
|
|
12
12
|
ItemSubTypeSelectComponent.args = {
|
|
13
|
-
|
|
13
|
+
onSelectSubType: () => null,
|
|
14
14
|
subTypes: SelectGroups,
|
|
15
15
|
initialSubType: SelectGroups[0],
|
|
16
16
|
label: 'Category Name',
|
package/package.json
CHANGED
|
@@ -9,10 +9,10 @@ export const ItemSubTypeSelect = ({
|
|
|
9
9
|
label,
|
|
10
10
|
}: ItemSubTypeSelectI) => {
|
|
11
11
|
return (
|
|
12
|
-
<Box bg="lightBlue.1" py="1rem"
|
|
12
|
+
<Box bg="lightBlue.1" py="1rem" px="base">
|
|
13
13
|
{initialSubType && (
|
|
14
|
-
<Flex alignItems="center"
|
|
15
|
-
{label && <Text
|
|
14
|
+
<Flex alignItems="center" gap="base">
|
|
15
|
+
{label && <Text flexShrink={0}>{label}</Text>}
|
|
16
16
|
<SelectInput
|
|
17
17
|
handleClick={onSelectSubType}
|
|
18
18
|
initialValue={initialSubType.name}
|
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ItemFormPanel,
|
|
4
4
|
ItemFormTabs,
|
|
5
5
|
ItemNameHeader,
|
|
6
|
+
ItemSubTypeSelect,
|
|
6
7
|
RightPanel,
|
|
7
8
|
} from '@/components'
|
|
8
9
|
import { ItemFormPanelI } from '@/interfaces'
|
|
@@ -31,6 +32,20 @@ export const ItemFormPanelComponent = (args: ItemFormPanelI) => {
|
|
|
31
32
|
id="item-name-header"
|
|
32
33
|
onSave={action('onSaveItemName')}
|
|
33
34
|
/>
|
|
35
|
+
<ItemSubTypeSelect
|
|
36
|
+
initialSubType={{
|
|
37
|
+
_id: '1',
|
|
38
|
+
name: 'Sub Type',
|
|
39
|
+
}}
|
|
40
|
+
onSelectSubType={action('onSelectSubType')}
|
|
41
|
+
label="Category"
|
|
42
|
+
subTypes={[
|
|
43
|
+
{
|
|
44
|
+
_id: '1',
|
|
45
|
+
name: 'Sub Type',
|
|
46
|
+
},
|
|
47
|
+
]}
|
|
48
|
+
/>
|
|
34
49
|
<ItemFormTabs form={contactFieldsMock} />
|
|
35
50
|
</ItemFormPanel>
|
|
36
51
|
</RightPanel>
|
|
@@ -18,7 +18,7 @@ export const ItemSubTypeSelectComponent = (args: ItemSubTypeSelectI) => {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
ItemSubTypeSelectComponent.args = {
|
|
21
|
-
|
|
21
|
+
onSelectSubType: () => null,
|
|
22
22
|
subTypes: SelectGroups,
|
|
23
23
|
initialSubType: SelectGroups[0],
|
|
24
24
|
label: 'Category Name',
|