@homefile/components-v2 2.8.23 → 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.
@@ -1,2 +1,2 @@
1
1
  import { ItemSubTypeSelectI } from '../../interfaces';
2
- export declare const ItemSubTypeSelect: ({ handleSelectSubType, subTypes, initialSubType, label, }: ItemSubTypeSelectI) => import("react/jsx-runtime").JSX.Element;
2
+ export declare const ItemSubTypeSelect: ({ onSelectSubType, subTypes, initialSubType, label, }: ItemSubTypeSelectI) => import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  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
- export const ItemSubTypeSelect = ({ handleSelectSubType, subTypes, initialSubType, label, }) => {
5
- return (_jsx(Box, { bg: "lightBlue.1", py: "1rem", w: "100%", children: initialSubType && (_jsxs(Flex, { alignItems: "center", justifyContent: "flex-start", children: [label && _jsx(Text, { p: ".5rem", children: label }), _jsx(SelectInput, { handleClick: handleSelectSubType, initialValue: initialSubType.name, items: subTypes })] })) }));
4
+ export const ItemSubTypeSelect = ({ onSelectSubType, subTypes, initialSubType, label, }) => {
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,6 +1,6 @@
1
1
  import { SelectItemI } from '..';
2
2
  export interface ItemSubTypeSelectI {
3
- handleSelectSubType: (form: SelectItemI | string) => void;
3
+ onSelectSubType: (form: SelectItemI | string) => void;
4
4
  subTypes: SelectItemI[];
5
5
  initialSubType: SelectItemI;
6
6
  label?: string;
@@ -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(ItemFormTabs, { form: contactFieldsMock })] })) }));
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
- handleSelectSubType: () => null;
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
- handleSelectSubType: () => null,
13
+ onSelectSubType: () => null,
14
14
  subTypes: SelectGroups,
15
15
  initialSubType: SelectGroups[0],
16
16
  label: 'Category Name',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homefile/components-v2",
3
- "version": "2.8.23",
3
+ "version": "2.8.25",
4
4
  "author": "Homefile",
5
5
  "license": "UNLICENSED",
6
6
  "typings": "dist/index.d.ts",
@@ -3,18 +3,18 @@ import { SelectInput } from '@/components'
3
3
  import { ItemSubTypeSelectI } from '@/interfaces'
4
4
 
5
5
  export const ItemSubTypeSelect = ({
6
- handleSelectSubType,
6
+ onSelectSubType,
7
7
  subTypes,
8
8
  initialSubType,
9
9
  label,
10
10
  }: ItemSubTypeSelectI) => {
11
11
  return (
12
- <Box bg="lightBlue.1" py="1rem" w="100%">
12
+ <Box bg="lightBlue.1" py="1rem" px="base">
13
13
  {initialSubType && (
14
- <Flex alignItems="center" justifyContent="flex-start">
15
- {label && <Text p=".5rem">{label}</Text>}
14
+ <Flex alignItems="center" gap="base">
15
+ {label && <Text flexShrink={0}>{label}</Text>}
16
16
  <SelectInput
17
- handleClick={handleSelectSubType}
17
+ handleClick={onSelectSubType}
18
18
  initialValue={initialSubType.name}
19
19
  items={subTypes}
20
20
  />
@@ -1,8 +1,8 @@
1
1
  import { SelectItemI } from '@/interfaces'
2
2
 
3
3
  export interface ItemSubTypeSelectI {
4
- handleSelectSubType: (form: SelectItemI | string) => void
4
+ onSelectSubType: (form: SelectItemI | string) => void
5
5
  subTypes: SelectItemI[]
6
6
  initialSubType: SelectItemI
7
7
  label?: string
8
- }
8
+ }
@@ -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
- handleSelectSubType: () => null,
21
+ onSelectSubType: () => null,
22
22
  subTypes: SelectGroups,
23
23
  initialSubType: SelectGroups[0],
24
24
  label: 'Category Name',