@factorearth/component-library 3.0.0-alpha.0 → 3.0.2-alpha.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.
@@ -5,6 +5,8 @@ interface NumberFieldProps {
5
5
  handleChange: (event: React.ChangeEvent<HTMLInputElement>) => void;
6
6
  handleBlur: () => void;
7
7
  fromTable?: boolean;
8
+ value: number | undefined;
9
+ placeholder?: string;
8
10
  }
9
- export declare const NumberField: ({ colorPalette, handleChange, handleBlur, fromTable }: NumberFieldProps) => React.JSX.Element;
11
+ export declare const NumberField: ({ colorPalette, handleChange, handleBlur, fromTable, value, placeholder, }: NumberFieldProps) => React.JSX.Element;
10
12
  export {};
@@ -4,7 +4,6 @@ import { FiPlus, FiMinus } from "react-icons/fi";
4
4
  import { MoreHorizonButton } from "../MoreHorizonButton/MoreHorizonButton";
5
5
  const NumberFieldContainer = styled.div `
6
6
  display: flex;
7
- min-width: 180px;
8
7
  align-items: center;
9
8
  gap: -0.5px;
10
9
  `;
@@ -13,6 +12,7 @@ const NumberInput = styled.input `
13
12
  justify-content: center;
14
13
  align-items: center;
15
14
  text-align: center;
15
+ min-width: 180px;
16
16
  gap: 10px;
17
17
  align-self: stretch;
18
18
  color: ${({ color }) => color.text.primary};
@@ -57,32 +57,36 @@ const IncrementButton = styled.div `
57
57
  background: ${({ color }) => color.background.primary};
58
58
  color: ${({ color }) => color.text.primary};
59
59
  `;
60
- export const NumberField = ({ colorPalette, handleChange, handleBlur, fromTable }) => {
61
- const [value, setValue] = useState();
60
+ export const NumberField = ({ colorPalette, handleChange, handleBlur, fromTable, value, placeholder, }) => {
61
+ const [numberValue, setNumberValue] = useState(value);
62
62
  const ref = useRef(null);
63
63
  const handleIncrement = () => {
64
- if (value === undefined) {
65
- setValue(1);
64
+ if (numberValue === undefined) {
65
+ setNumberValue(1);
66
66
  return;
67
67
  }
68
- setValue(value + 1);
68
+ setNumberValue(numberValue + 1);
69
69
  };
70
70
  const handleDecrement = () => {
71
- if (value === undefined) {
72
- setValue(1);
71
+ if (numberValue === undefined) {
72
+ setNumberValue(1);
73
73
  return;
74
74
  }
75
- setValue(value - 1);
75
+ setNumberValue(numberValue - 1);
76
76
  };
77
77
  const handleFocus = () => {
78
78
  if (fromTable) {
79
- ref.current?.scrollIntoView({ block: "center", behavior: "smooth", inline: "center" });
79
+ ref.current?.scrollIntoView({
80
+ block: "center",
81
+ behavior: "smooth",
82
+ inline: "center",
83
+ });
80
84
  }
81
85
  };
82
86
  return (React.createElement(NumberFieldContainer, { color: colorPalette },
83
87
  React.createElement(DecrementButton, { color: colorPalette, onClick: handleDecrement },
84
88
  React.createElement(FiMinus, null)),
85
- React.createElement(NumberInput, { value: value, onChange: handleChange, onBlur: handleBlur, type: "number", color: colorPalette, ref: ref, onFocus: handleFocus }),
89
+ React.createElement(NumberInput, { value: value, onChange: handleChange, onBlur: handleBlur, type: "number", color: colorPalette, ref: ref, onFocus: handleFocus, placeholder: placeholder }),
86
90
  React.createElement(IncrementButton, { color: colorPalette, onClick: handleIncrement },
87
91
  React.createElement(FiPlus, null)),
88
92
  React.createElement(MoreHorizonButton, { colorPalette: colorPalette })));
@@ -1 +1 @@
1
- {"version":3,"file":"NumberField.js","sourceRoot":"","sources":["../../../lib/Atoms/NumberField/NumberField.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,MAAM,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAG3E,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAmB;;;;;CAKzD,CAAC;AAEF,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAmB;;;;;;;UAOzC,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KA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7D,oBAAC,MAAM,OAAG,CACO;QAClB,oBAAC,iBAAiB,IAAC,YAAY,EAAE,YAAY,GAAI,CAC3B,CACvB,CAAC;AACH,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from "./Atoms/MoreHorizonButton/MoreHorizonButton";
2
+ export * from "./Atoms/NumberField/NumberField";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "./Atoms/MoreHorizonButton/MoreHorizonButton";
2
- // export * from "./Atoms/NumberField/NumberField";
2
+ export * from "./Atoms/NumberField/NumberField";
3
3
  // export * from "./Atoms/PhoneNumberField/PhoneNumberField";
4
4
  // export * from "./Atoms/Pagination/Pagination";
5
5
  // export * from "./Atoms/SortDropdown/SortDropdown";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,mDAAmD;AACnD,6DAA6D;AAC7D,iDAAiD;AACjD,qDAAqD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../lib/index.ts"],"names":[],"mappings":"AAAA,cAAc,6CAA6C,CAAC;AAC5D,cAAc,iCAAiC,CAAC;AAChD,6DAA6D;AAC7D,iDAAiD;AACjD,qDAAqD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@factorearth/component-library",
3
- "version": "3.0.0-alpha.0",
3
+ "version": "3.0.2-alpha.0",
4
4
  "description": " A storybook component library for FactorEarth",
5
5
  "author": "madtrx <marlin.makori@gmail.com>",
6
6
  "homepage": "https://github.com/FactorEarth/RecordMiddleware#readme",
@@ -45,7 +45,7 @@
45
45
  "access": "public",
46
46
  "registry": "https://registry.npmjs.org/"
47
47
  },
48
- "gitHead": "35406ad5c9d8449d02ff56f43719b10543b9ea01",
48
+ "gitHead": "7d8405249afcf1dd23d67ee8a939bf79e5f32e08",
49
49
  "dependencies": {
50
50
  "@emotion/react": "^11.13.0",
51
51
  "@emotion/styled": "^11.13.0",