pixel-react 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. package/lib/components/InputWithDropdown/types.d.ts +1 -1
  2. package/lib/components/LabelEditTextField/LabelEditTextField.d.ts +5 -0
  3. package/lib/components/LabelEditTextField/LabelEditTextField.stories.d.ts +11 -0
  4. package/lib/components/LabelEditTextField/index.d.ts +1 -0
  5. package/lib/components/LabelEditTextField/types.d.ts +38 -0
  6. package/lib/components/Select/Select.d.ts +1 -1
  7. package/lib/components/Select/components/Dropdown/Dropdown.d.ts +1 -1
  8. package/lib/components/Select/components/Dropdown/dropdownTypes.d.ts +2 -0
  9. package/lib/components/Select/types.d.ts +11 -4
  10. package/lib/index.d.ts +56 -8
  11. package/lib/index.esm.js +318 -124
  12. package/lib/index.esm.js.map +1 -1
  13. package/lib/index.js +318 -123
  14. package/lib/index.js.map +1 -1
  15. package/lib/tsconfig.tsbuildinfo +1 -1
  16. package/lib/utils/getSelectOptionValue/getSelectOptionValue.d.ts +8 -0
  17. package/package.json +1 -1
  18. package/src/assets/Themes/BaseTheme.scss +8 -1
  19. package/src/assets/Themes/DarkTheme.scss +17 -8
  20. package/src/components/AppHeader/AppHeader.scss +5 -2
  21. package/src/components/Drawer/Drawer.scss +0 -1
  22. package/src/components/Drawer/Drawer.tsx +1 -1
  23. package/src/components/Icon/Icons.scss +1 -0
  24. package/src/components/InputWithDropdown/types.ts +1 -1
  25. package/src/components/LabelEditTextField/LabelEditTextField.scss +85 -0
  26. package/src/components/LabelEditTextField/LabelEditTextField.stories.tsx +136 -0
  27. package/src/components/LabelEditTextField/LabelEditTextField.tsx +207 -0
  28. package/src/components/LabelEditTextField/index.ts +1 -0
  29. package/src/components/LabelEditTextField/types.ts +38 -0
  30. package/src/components/Select/Select.stories.tsx +5 -3
  31. package/src/components/Select/Select.tsx +13 -5
  32. package/src/components/Select/components/Dropdown/Dropdown.tsx +3 -1
  33. package/src/components/Select/components/Dropdown/dropdownTypes.ts +3 -0
  34. package/src/components/Select/types.ts +12 -5
  35. package/src/index.ts +2 -0
  36. package/src/utils/getSelectOptionValue/getSelectOptionValue.ts +31 -0
@@ -59,7 +59,7 @@ export interface InputWithDropdownProps {
59
59
  /**
60
60
  * onChange handler for dropdown changes
61
61
  */
62
- onDropdownChangeHandler?: (option: Option) => void;
62
+ onDropdownChangeHandler?: (option: any) => void;
63
63
  /**
64
64
  * onInputBlurHandler action for input field
65
65
  */
@@ -0,0 +1,5 @@
1
+ import { FC } from 'react';
2
+ import './LabelEditTextField.scss';
3
+ import { LabelEditTextFieldTypes } from './types';
4
+ declare const LabelEditTextField: FC<LabelEditTextFieldTypes>;
5
+ export default LabelEditTextField;
@@ -0,0 +1,11 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import LabelEditTextField from './LabelEditTextField';
3
+ import '../../assets/styles/_colors.scss';
4
+ import './LabelEditTextField.scss';
5
+ declare const meta: Meta<typeof LabelEditTextField>;
6
+ type Story = StoryObj<typeof LabelEditTextField>;
7
+ export declare const textField: Story;
8
+ export declare const textFieldWithOutLabel: Story;
9
+ export declare const textFieldWithDropdown: Story;
10
+ export declare const textFieldWithHighlight: Story;
11
+ export default meta;
@@ -0,0 +1 @@
1
+ export { default } from './LabelEditTextField';
@@ -0,0 +1,38 @@
1
+ export interface IconProps {
2
+ /** Name of the icon to be displayed. */
3
+ name: string;
4
+ /** Optional click handler function for the icon. */
5
+ onClick?: () => void;
6
+ }
7
+ export interface DropdownOption {
8
+ /** Unique identifier for the dropdown option. */
9
+ id: number;
10
+ /** Value associated with the dropdown option. */
11
+ value: string;
12
+ /** Label displayed for the dropdown option. */
13
+ label: string;
14
+ }
15
+ export interface LabelEditTextFieldTypes {
16
+ /** Label text displayed above the input field. */
17
+ label?: string;
18
+ /** Initial text displayed in the input field. */
19
+ text: string;
20
+ /** Text to be highlighted within the displayed text, if provided. */
21
+ highlightText?: string;
22
+ /** Custom error message to be displayed, if applicable. */
23
+ customError?: string;
24
+ /** Confirm icon properties including icon name and click handler. */
25
+ confirmIcon?: IconProps;
26
+ /** Cancel icon properties including icon name and click handler. */
27
+ cancelIcon?: IconProps;
28
+ /** Type of input field - standard text field or text field with a dropdown. */
29
+ variant?: 'textFieldWithDropdown' | 'textField';
30
+ /** Array of dropdown options used if the dropdown variant is selected. */
31
+ dropdownData?: DropdownOption[];
32
+ /** Width of the input field component. */
33
+ width?: string;
34
+ /** Height of the input field component. */
35
+ height?: string;
36
+ /** Function called when confirming input changes, with input and dropdown values as arguments. */
37
+ confirmAction?: (inputValue: string, dropdownValue: string) => void;
38
+ }
@@ -1,4 +1,4 @@
1
1
  import { SelectProps } from './types';
2
2
  import './Select.scss';
3
- declare const Select: ({ label, showLabel, optionsList, selectedOption, onChange, errorMsg, className, optionZIndex, disabled, borderRadius, showBorder, required, optionsRequired, selectedOptionColor, }: SelectProps) => import("react/jsx-runtime").JSX.Element;
3
+ declare const Select: ({ label, showLabel, optionsList, selectedOption, onChange, errorMsg, className, optionZIndex, disabled, borderRadius, showBorder, required, optionsRequired, selectedOptionColor, labelAccessor, valueAccessor, }: SelectProps) => import("react/jsx-runtime").JSX.Element;
4
4
  export default Select;
@@ -1,4 +1,4 @@
1
1
  import { DropDownListProps } from './dropdownTypes';
2
2
  import './Dropdown.scss';
3
- declare const Dropdown: ({ onSelectBlur, onSelectOptionSelector, dropdownPosition, options, optionZIndex, inputRef, }: DropDownListProps) => import("react/jsx-runtime").JSX.Element;
3
+ declare const Dropdown: ({ onSelectBlur, onSelectOptionSelector, dropdownPosition, options, optionZIndex, inputRef, labelAccessor, }: DropDownListProps) => import("react/jsx-runtime").JSX.Element;
4
4
  export default Dropdown;
@@ -6,6 +6,8 @@ export interface DropDownListProps {
6
6
  options?: Option[];
7
7
  optionZIndex?: number;
8
8
  inputRef?: React.RefObject<HTMLInputElement>;
9
+ labelAccessor?: string;
10
+ valueAccessor?: string;
9
11
  }
10
12
  export declare const dropdownDefaultCSSData: {
11
13
  margin: number;
@@ -1,4 +1,3 @@
1
- import { ReactNode } from 'react';
2
1
  export interface SelectProps {
3
2
  label?: string;
4
3
  showLabel?: boolean;
@@ -20,6 +19,14 @@ export interface SelectProps {
20
19
  * selectedOptionColor prop provides the custom color for the selected option
21
20
  */
22
21
  selectedOptionColor?: string;
22
+ /**
23
+ * Label accessor
24
+ */
25
+ labelAccessor?: string;
26
+ /**
27
+ * Value accessor
28
+ */
29
+ valueAccessor?: string;
23
30
  }
24
31
  export interface DrowdownPosition {
25
32
  positionX: number;
@@ -69,8 +76,8 @@ export type SelectAction = {
69
76
  option: Option['value'];
70
77
  };
71
78
  };
79
+ type OptionValue = any;
72
80
  export interface Option {
73
- label: string | ReactNode;
74
- value: string;
75
- disabled?: boolean;
81
+ [key: string]: OptionValue;
76
82
  }
83
+ export {};
package/lib/index.d.ts CHANGED
@@ -194,7 +194,7 @@ interface DrawerProps {
194
194
 
195
195
  declare const Drawer: FC<DrawerProps>;
196
196
 
197
- interface IconProps {
197
+ interface IconProps$1 {
198
198
  name: string;
199
199
  className?: string;
200
200
  height?: number;
@@ -206,7 +206,7 @@ interface IconProps {
206
206
  variant?: "dark" | "light";
207
207
  }
208
208
 
209
- declare const Icon: React$1.ForwardRefExoticComponent<IconProps & React$1.RefAttributes<HTMLSpanElement>>;
209
+ declare const Icon: React$1.ForwardRefExoticComponent<IconProps$1 & React$1.RefAttributes<HTMLSpanElement>>;
210
210
 
211
211
  interface AccordionProps {
212
212
  /**
@@ -622,14 +622,21 @@ interface SelectProps$1 {
622
622
  * selectedOptionColor prop provides the custom color for the selected option
623
623
  */
624
624
  selectedOptionColor?: string;
625
+ /**
626
+ * Label accessor
627
+ */
628
+ labelAccessor?: string;
629
+ /**
630
+ * Value accessor
631
+ */
632
+ valueAccessor?: string;
625
633
  }
634
+ type OptionValue = any;
626
635
  interface Option$2 {
627
- label: string | ReactNode;
628
- value: string;
629
- disabled?: boolean;
636
+ [key: string]: OptionValue;
630
637
  }
631
638
 
632
- declare const Select: ({ label, showLabel, optionsList, selectedOption, onChange, errorMsg, className, optionZIndex, disabled, borderRadius, showBorder, required, optionsRequired, selectedOptionColor, }: SelectProps$1) => react_jsx_runtime.JSX.Element;
639
+ declare const Select: ({ label, showLabel, optionsList, selectedOption, onChange, errorMsg, className, optionZIndex, disabled, borderRadius, showBorder, required, optionsRequired, selectedOptionColor, labelAccessor, valueAccessor, }: SelectProps$1) => react_jsx_runtime.JSX.Element;
633
640
 
634
641
  interface TextareaProps {
635
642
  /**
@@ -1195,7 +1202,7 @@ interface InputWithDropdownProps {
1195
1202
  /**
1196
1203
  * onChange handler for dropdown changes
1197
1204
  */
1198
- onDropdownChangeHandler?: (option: Option$1) => void;
1205
+ onDropdownChangeHandler?: (option: any) => void;
1199
1206
  /**
1200
1207
  * onInputBlurHandler action for input field
1201
1208
  */
@@ -1840,6 +1847,47 @@ interface AttachmentUploaderProps {
1840
1847
 
1841
1848
  declare const AttachmentButton: React__default.FC<AttachmentUploaderProps>;
1842
1849
 
1850
+ interface IconProps {
1851
+ /** Name of the icon to be displayed. */
1852
+ name: string;
1853
+ /** Optional click handler function for the icon. */
1854
+ onClick?: () => void;
1855
+ }
1856
+ interface DropdownOption {
1857
+ /** Unique identifier for the dropdown option. */
1858
+ id: number;
1859
+ /** Value associated with the dropdown option. */
1860
+ value: string;
1861
+ /** Label displayed for the dropdown option. */
1862
+ label: string;
1863
+ }
1864
+ interface LabelEditTextFieldTypes {
1865
+ /** Label text displayed above the input field. */
1866
+ label?: string;
1867
+ /** Initial text displayed in the input field. */
1868
+ text: string;
1869
+ /** Text to be highlighted within the displayed text, if provided. */
1870
+ highlightText?: string;
1871
+ /** Custom error message to be displayed, if applicable. */
1872
+ customError?: string;
1873
+ /** Confirm icon properties including icon name and click handler. */
1874
+ confirmIcon?: IconProps;
1875
+ /** Cancel icon properties including icon name and click handler. */
1876
+ cancelIcon?: IconProps;
1877
+ /** Type of input field - standard text field or text field with a dropdown. */
1878
+ variant?: 'textFieldWithDropdown' | 'textField';
1879
+ /** Array of dropdown options used if the dropdown variant is selected. */
1880
+ dropdownData?: DropdownOption[];
1881
+ /** Width of the input field component. */
1882
+ width?: string;
1883
+ /** Height of the input field component. */
1884
+ height?: string;
1885
+ /** Function called when confirming input changes, with input and dropdown values as arguments. */
1886
+ confirmAction?: (inputValue: string, dropdownValue: string) => void;
1887
+ }
1888
+
1889
+ declare const LabelEditTextField: FC<LabelEditTextFieldTypes>;
1890
+
1843
1891
  type valueType$1 = any;
1844
1892
  declare const checkEmpty: (value: valueType$1) => boolean;
1845
1893
 
@@ -1887,4 +1935,4 @@ declare const throttle: (func: Callback, limit: number) => ThrottledFunction;
1887
1935
 
1888
1936
  declare const truncateText: (text: string, maxLength: number) => string;
1889
1937
 
1890
- export { Accordion, AddButton as AddResourceButton, AllProjectsDropdown, AppHeader, AttachmentButton, Button, Checkbox, Chip, Col, Container, DashboardDonutChart, CustomDatePicker as DatePicker, DonutChart, DragAndDrop, Drawer, ExpandableMenu, FileDropzone, Form, HighlightText, Icon, IconButton, IconRadioGroup, Input, InputWithDropdown, MachineInputField, MenuOption, MiniModal, Modal, MultiSelect, NlpInput as NLPInput, Paper, PieChart, RadialChart, RadioButton, RadioGroup, Recaptcha, Row, Search, Select, SequentialConnectingBranch, StateDropdown, StatusButton, Table, TableTree, Tabs, Textarea as TextArea, ThemeProvider, Toaster, Toggle, Tooltip, Typography, VariableInput, checkEmpty, compareArrays, compareObjects, debounce, ffid, findAndInsert, getEncryptedData, getExtension, getExtensionWithPeriod, throttle, truncateText, useTheme };
1938
+ export { Accordion, AddButton as AddResourceButton, AllProjectsDropdown, AppHeader, AttachmentButton, Button, Checkbox, Chip, Col, Container, DashboardDonutChart, CustomDatePicker as DatePicker, DonutChart, DragAndDrop, Drawer, ExpandableMenu, FileDropzone, Form, HighlightText, Icon, IconButton, IconRadioGroup, Input, InputWithDropdown, LabelEditTextField, MachineInputField, MenuOption, MiniModal, Modal, MultiSelect, NlpInput as NLPInput, Paper, PieChart, RadialChart, RadioButton, RadioGroup, Recaptcha, Row, Search, Select, SequentialConnectingBranch, StateDropdown, StatusButton, Table, TableTree, Tabs, Textarea as TextArea, ThemeProvider, Toaster, Toggle, Tooltip, Typography, VariableInput, checkEmpty, compareArrays, compareObjects, debounce, ffid, findAndInsert, getEncryptedData, getExtension, getExtensionWithPeriod, throttle, truncateText, useTheme };