@symply.io/basic-components 1.6.6-alpha.1 → 1.6.6-beta.1

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,3 +1,3 @@
1
1
  import { MultipleSelectorProps } from "./types";
2
- declare function MultipleSelector(props: MultipleSelectorProps): import("react/jsx-runtime").JSX.Element;
2
+ declare function MultipleSelector<T extends string | number>(props: MultipleSelectorProps<T>): import("react/jsx-runtime").JSX.Element;
3
3
  export default MultipleSelector;
@@ -55,8 +55,8 @@ function MultipleSelector(props) {
55
55
  .join("; ");
56
56
  }
57
57
  : undefined }, { children: (options === null || options === void 0 ? void 0 : options.length) > 0 ? (options.map(function (option) {
58
- var _a = option, label = _a.label, v = _a.value;
59
- return (_jsxs(MenuItem, __assign({ value: v }, { children: [showCheckmarks ? (_jsx(Checkbox, { checked: !!options.find(function (opt) { return opt.value === v; }) })) : (_jsx(_Fragment, {})), _jsx(ListItemText, { primary: label })] }), v));
58
+ var label = option.label, v = option.value;
59
+ return (_jsxs(MenuItem, __assign({ value: v }, { children: [showCheckmarks ? (_jsx(Checkbox, { checked: !!value.includes(v) })) : (_jsx(_Fragment, {})), _jsx(ListItemText, { primary: label })] }), v));
60
60
  })) : (_jsx(MenuItem, __assign({ value: "", disabled: true }, { children: "No Options" }))) })), !!helperText && showHelperText && (_jsx(FormHelperText, { children: showHelperText }))] })) })) })));
61
61
  }
62
62
  export default MultipleSelector;
@@ -1,3 +1,3 @@
1
1
  import { SimpleSelectorProps } from "./types";
2
- declare function SimpleSelector(props: SimpleSelectorProps): import("react/jsx-runtime").JSX.Element;
2
+ declare function SimpleSelector<T extends string | number>(props: SimpleSelectorProps<T>): import("react/jsx-runtime").JSX.Element;
3
3
  export default SimpleSelector;
@@ -1,7 +1,7 @@
1
1
  import { ReactNode, CSSProperties } from "react";
2
2
  import { SelectProps } from "@mui/material/Select";
3
3
  import { FormControlProps } from "@mui/material/FormControl";
4
- interface SelectorBaseProps extends Omit<FormControlProps, "onChange"> {
4
+ interface SelectorBaseProps<T extends string | number> extends Omit<FormControlProps, "onChange"> {
5
5
  label?: string;
6
6
  name?: string;
7
7
  tooltip?: ReactNode;
@@ -12,17 +12,17 @@ interface SelectorBaseProps extends Omit<FormControlProps, "onChange"> {
12
12
  secondaryColor?: CSSProperties["color"];
13
13
  options: Array<{
14
14
  label: string;
15
- value: string | number;
15
+ value: T;
16
16
  disabled?: boolean;
17
17
  }>;
18
18
  }
19
- export interface SimpleSelectorProps extends SelectorBaseProps {
20
- value: number | string;
21
- onChange: (value?: string | number) => void;
19
+ export interface SimpleSelectorProps<T extends string | number> extends SelectorBaseProps<T> {
20
+ value: T;
21
+ onChange: (value?: string | T) => void;
22
22
  }
23
- export interface MultipleSelectorProps extends SelectorBaseProps {
24
- value: Array<number> | Array<string>;
23
+ export interface MultipleSelectorProps<T extends string | number> extends SelectorBaseProps<T> {
24
+ value: Array<T>;
25
25
  showCheckmarks?: boolean;
26
- onChange: (value?: string | Array<number> | Array<string>) => void;
26
+ onChange: (value?: string | Array<T>) => void;
27
27
  }
28
28
  export {};
package/README.md CHANGED
@@ -573,11 +573,11 @@ import { MultipleSelector } from '@symply.io/basic-components/FormRadioGroup';
573
573
 
574
574
  <h5>Selector Option Props</h5>
575
575
 
576
- | Name | Type | Default | Required | Description |
577
- | -------- | ------------------------ | ------- | -------- | ---------------------------------------- |
578
- | disabled | bool | false | false | If `true`, the opiton would be disabled. |
579
- | label | string | | true | The label of the option. |
580
- | value | string \| number \| bool | | true | The value of the option. |
576
+ | Name | Type | Default | Required | Description |
577
+ | -------- | -------------------------- | ------- | -------- | ---------------------------------------- |
578
+ | disabled | bool | false | false | If `true`, the opiton would be disabled. |
579
+ | label | string | | true | The label of the option. |
580
+ | value | T extends number \| string | | | The value of the option. |
581
581
 
582
582
  <h5>Base Props</h5>
583
583
 
@@ -594,18 +594,18 @@ It is extended from `@mui/material/FormControl`, so it includes all properties o
594
594
 
595
595
  <h5>Simple Selector Props</h5> Extended from the Base Props
596
596
 
597
- | Name | Type | Default | Required | Description |
598
- | -------- | ---------------- | ------- | -------- | ------------------------------------------------------------ |
599
- | onChange | func | | true | Callback fired when the `Select` value is changed.<br />**Signature:**<br/>`function(value: string | number) => void`<br/>*value:* The value of the `Select` element. |
600
- | value | number \| string | | true | The value of the `Select` element. |
597
+ | Name | Type | Default | Required | Description |
598
+ | -------- | -------------------------- | ------- | -------- | ------------------------------------------------------------ |
599
+ | onChange | func | | true | Callback fired when the `Select` value is changed.<br />**Signature:**<br/>`function(value: string | number) => void`<br/>*value:* The value of the `Select` element. |
600
+ | value | T extends number \| string | | true | The value of the `Select` element. |
601
601
 
602
602
  <h5>Multiple Selector Props</h5> Extended from the Base Props
603
603
 
604
- | Name | Type | Default | Required | Description |
605
- | -------------- | ---------------------------------- | ------- | -------- | ------------------------------------------------------------ |
606
- | onChange | func | | true | Callback fired when the `Select` value is changed.<br />**Signature:**<br/>`function(value: Array<number> | Array<string>) => void`<br/>*value:* The value of the `Select` element. |
607
- | showCheckmarks | bool | false | false | If `true` the option will be shown with a checkbox. |
608
- | value | Array\<number\> \| Array\<string\> | | false | The value of the `Select` element. |
604
+ | Name | Type | Default | Required | Description |
605
+ | -------------- | ----------------------------------- | ------- | -------- | ------------------------------------------------------------ |
606
+ | onChange | func | | true | Callback fired when the `Select` value is changed.<br />**Signature:**<br/>`function(value: Array<number> | Array<string>) => void`<br/>*value:* The value of the `Select` element. |
607
+ | showCheckmarks | bool | false | false | If `true` the option will be shown with a checkbox. |
608
+ | value | Array\<T extends number \| string\> | | | The value of the `Select` element. |
609
609
 
610
610
 
611
611
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@symply.io/basic-components",
3
- "version": "1.6.6-alpha.1",
3
+ "version": "1.6.6-beta.1",
4
4
  "description": "Basic and reusable components for all frontend of Symply apps",
5
5
  "keywords": [
6
6
  "react",