@sebgroup/green-react 1.0.0-beta.23 → 1.0.0-beta.24
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/index.esm.js +15 -25
- package/index.umd.js +15 -25
- package/lib/dropdown/dropdown.d.ts +4 -15
- package/lib/dropdown/hooks.d.ts +5 -15
- package/lib/form/button/button.d.ts +2 -1
- package/package.json +3 -3
package/index.esm.js
CHANGED
|
@@ -1061,11 +1061,13 @@ function Button({
|
|
|
1061
1061
|
children,
|
|
1062
1062
|
variant,
|
|
1063
1063
|
onClick,
|
|
1064
|
+
disabled,
|
|
1064
1065
|
active = false,
|
|
1065
1066
|
type = 'button'
|
|
1066
1067
|
}) {
|
|
1067
1068
|
const props = {
|
|
1068
|
-
type
|
|
1069
|
+
type,
|
|
1070
|
+
disabled
|
|
1069
1071
|
};
|
|
1070
1072
|
const classNames = [];
|
|
1071
1073
|
if (variant) classNames.push(variant);
|
|
@@ -2676,8 +2678,8 @@ const useDropdown = ({
|
|
|
2676
2678
|
loop,
|
|
2677
2679
|
multiSelect,
|
|
2678
2680
|
searchable,
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
+
searchFilter,
|
|
2682
|
+
compareWith,
|
|
2681
2683
|
useValue,
|
|
2682
2684
|
display,
|
|
2683
2685
|
togglerRef,
|
|
@@ -2721,14 +2723,7 @@ const useDropdown = ({
|
|
|
2721
2723
|
className: (_a = o.classes) === null || _a === void 0 ? void 0 : _a.join(' '),
|
|
2722
2724
|
children: o[dropdown.display],
|
|
2723
2725
|
selected: o.selected,
|
|
2724
|
-
onClick: () =>
|
|
2725
|
-
handler === null || handler === void 0 ? void 0 : handler.select(o).then(() => {
|
|
2726
|
-
if (onChange) {
|
|
2727
|
-
const result = options.find(item => item.key === o.key);
|
|
2728
|
-
result && onChange(result);
|
|
2729
|
-
}
|
|
2730
|
-
});
|
|
2731
|
-
}
|
|
2726
|
+
onClick: () => handler === null || handler === void 0 ? void 0 : handler.select(o)
|
|
2732
2727
|
});
|
|
2733
2728
|
});
|
|
2734
2729
|
setListItems(newListItems);
|
|
@@ -2740,14 +2735,7 @@ const useDropdown = ({
|
|
|
2740
2735
|
inputProps: {
|
|
2741
2736
|
defaultChecked: o.selected,
|
|
2742
2737
|
type: 'checkbox',
|
|
2743
|
-
|
|
2744
|
-
handler === null || handler === void 0 ? void 0 : handler.select(o, false).then(() => {
|
|
2745
|
-
if (onChange) {
|
|
2746
|
-
const result = options.find(item => item.key === o.key);
|
|
2747
|
-
result && onChange(result);
|
|
2748
|
-
}
|
|
2749
|
-
});
|
|
2750
|
-
}
|
|
2738
|
+
onClick: () => handler === null || handler === void 0 ? void 0 : handler.select(o, false)
|
|
2751
2739
|
},
|
|
2752
2740
|
spanProps: {
|
|
2753
2741
|
children: o[dropdown.display]
|
|
@@ -2781,7 +2769,7 @@ const useDropdown = ({
|
|
|
2781
2769
|
loop,
|
|
2782
2770
|
multiSelect
|
|
2783
2771
|
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2784
|
-
}, [id, texts, options, loop, multiSelect, searchable,
|
|
2772
|
+
}, [id, texts, options, loop, multiSelect, searchable, searchFilter, compareWith, useValue, display]); // When validator changes
|
|
2785
2773
|
|
|
2786
2774
|
useEffect(() => {
|
|
2787
2775
|
if (!dropdown) return;
|
|
@@ -2797,12 +2785,12 @@ const useDropdown = ({
|
|
|
2797
2785
|
loop,
|
|
2798
2786
|
multiSelect,
|
|
2799
2787
|
searchable,
|
|
2800
|
-
|
|
2801
|
-
|
|
2788
|
+
searchFilter,
|
|
2789
|
+
compareWith,
|
|
2802
2790
|
useValue,
|
|
2803
2791
|
display,
|
|
2804
2792
|
validator
|
|
2805
|
-
}, togglerRef.current, listboxRef.current, listboxRef.current, dd => setDropdown(dd)));
|
|
2793
|
+
}, togglerRef.current, listboxRef.current, listboxRef.current, dd => setDropdown(dd), value => onChange === null || onChange === void 0 ? void 0 : onChange(value)));
|
|
2806
2794
|
}
|
|
2807
2795
|
|
|
2808
2796
|
return () => handler === null || handler === void 0 ? void 0 : handler.destroy(); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -2822,7 +2810,8 @@ const Dropdown = ({
|
|
|
2822
2810
|
loop,
|
|
2823
2811
|
multiSelect,
|
|
2824
2812
|
searchable,
|
|
2825
|
-
|
|
2813
|
+
searchFilter,
|
|
2814
|
+
compareWith,
|
|
2826
2815
|
useValue,
|
|
2827
2816
|
display,
|
|
2828
2817
|
texts,
|
|
@@ -2845,7 +2834,8 @@ const Dropdown = ({
|
|
|
2845
2834
|
loop,
|
|
2846
2835
|
multiSelect,
|
|
2847
2836
|
searchable,
|
|
2848
|
-
|
|
2837
|
+
searchFilter,
|
|
2838
|
+
compareWith,
|
|
2849
2839
|
useValue,
|
|
2850
2840
|
display,
|
|
2851
2841
|
togglerRef,
|
package/index.umd.js
CHANGED
|
@@ -1067,11 +1067,13 @@
|
|
|
1067
1067
|
children,
|
|
1068
1068
|
variant,
|
|
1069
1069
|
onClick,
|
|
1070
|
+
disabled,
|
|
1070
1071
|
active = false,
|
|
1071
1072
|
type = 'button'
|
|
1072
1073
|
}) {
|
|
1073
1074
|
const props = {
|
|
1074
|
-
type
|
|
1075
|
+
type,
|
|
1076
|
+
disabled
|
|
1075
1077
|
};
|
|
1076
1078
|
const classNames = [];
|
|
1077
1079
|
if (variant) classNames.push(variant);
|
|
@@ -2682,8 +2684,8 @@
|
|
|
2682
2684
|
loop,
|
|
2683
2685
|
multiSelect,
|
|
2684
2686
|
searchable,
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
+
searchFilter,
|
|
2688
|
+
compareWith,
|
|
2687
2689
|
useValue,
|
|
2688
2690
|
display,
|
|
2689
2691
|
togglerRef,
|
|
@@ -2727,14 +2729,7 @@
|
|
|
2727
2729
|
className: (_a = o.classes) === null || _a === void 0 ? void 0 : _a.join(' '),
|
|
2728
2730
|
children: o[dropdown.display],
|
|
2729
2731
|
selected: o.selected,
|
|
2730
|
-
onClick: () =>
|
|
2731
|
-
handler === null || handler === void 0 ? void 0 : handler.select(o).then(() => {
|
|
2732
|
-
if (onChange) {
|
|
2733
|
-
const result = options.find(item => item.key === o.key);
|
|
2734
|
-
result && onChange(result);
|
|
2735
|
-
}
|
|
2736
|
-
});
|
|
2737
|
-
}
|
|
2732
|
+
onClick: () => handler === null || handler === void 0 ? void 0 : handler.select(o)
|
|
2738
2733
|
});
|
|
2739
2734
|
});
|
|
2740
2735
|
setListItems(newListItems);
|
|
@@ -2746,14 +2741,7 @@
|
|
|
2746
2741
|
inputProps: {
|
|
2747
2742
|
defaultChecked: o.selected,
|
|
2748
2743
|
type: 'checkbox',
|
|
2749
|
-
|
|
2750
|
-
handler === null || handler === void 0 ? void 0 : handler.select(o, false).then(() => {
|
|
2751
|
-
if (onChange) {
|
|
2752
|
-
const result = options.find(item => item.key === o.key);
|
|
2753
|
-
result && onChange(result);
|
|
2754
|
-
}
|
|
2755
|
-
});
|
|
2756
|
-
}
|
|
2744
|
+
onClick: () => handler === null || handler === void 0 ? void 0 : handler.select(o, false)
|
|
2757
2745
|
},
|
|
2758
2746
|
spanProps: {
|
|
2759
2747
|
children: o[dropdown.display]
|
|
@@ -2787,7 +2775,7 @@
|
|
|
2787
2775
|
loop,
|
|
2788
2776
|
multiSelect
|
|
2789
2777
|
}); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2790
|
-
}, [id, texts, options, loop, multiSelect, searchable,
|
|
2778
|
+
}, [id, texts, options, loop, multiSelect, searchable, searchFilter, compareWith, useValue, display]); // When validator changes
|
|
2791
2779
|
|
|
2792
2780
|
React.useEffect(() => {
|
|
2793
2781
|
if (!dropdown) return;
|
|
@@ -2803,12 +2791,12 @@
|
|
|
2803
2791
|
loop,
|
|
2804
2792
|
multiSelect,
|
|
2805
2793
|
searchable,
|
|
2806
|
-
|
|
2807
|
-
|
|
2794
|
+
searchFilter,
|
|
2795
|
+
compareWith,
|
|
2808
2796
|
useValue,
|
|
2809
2797
|
display,
|
|
2810
2798
|
validator
|
|
2811
|
-
}, togglerRef.current, listboxRef.current, listboxRef.current, dd => setDropdown(dd)));
|
|
2799
|
+
}, togglerRef.current, listboxRef.current, listboxRef.current, dd => setDropdown(dd), value => onChange === null || onChange === void 0 ? void 0 : onChange(value)));
|
|
2812
2800
|
}
|
|
2813
2801
|
|
|
2814
2802
|
return () => handler === null || handler === void 0 ? void 0 : handler.destroy(); // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
@@ -2828,7 +2816,8 @@
|
|
|
2828
2816
|
loop,
|
|
2829
2817
|
multiSelect,
|
|
2830
2818
|
searchable,
|
|
2831
|
-
|
|
2819
|
+
searchFilter,
|
|
2820
|
+
compareWith,
|
|
2832
2821
|
useValue,
|
|
2833
2822
|
display,
|
|
2834
2823
|
texts,
|
|
@@ -2851,7 +2840,8 @@
|
|
|
2851
2840
|
loop,
|
|
2852
2841
|
multiSelect,
|
|
2853
2842
|
searchable,
|
|
2854
|
-
|
|
2843
|
+
searchFilter,
|
|
2844
|
+
compareWith,
|
|
2855
2845
|
useValue,
|
|
2856
2846
|
display,
|
|
2857
2847
|
togglerRef,
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
id?: string;
|
|
5
|
-
texts?: DropdownTexts;
|
|
6
|
-
options: DropdownOption[];
|
|
7
|
-
useValue?: string;
|
|
8
|
-
display?: string;
|
|
9
|
-
selectValue?: string;
|
|
10
|
-
loop?: boolean;
|
|
11
|
-
multiSelect?: boolean;
|
|
12
|
-
searchable?: boolean;
|
|
13
|
-
onChange?: (o: DropdownOption) => void;
|
|
14
|
-
validator?: IValidator;
|
|
1
|
+
import { DropdownArgs, OnChange } from '@sebgroup/extract';
|
|
2
|
+
export interface DropdownProps extends DropdownArgs {
|
|
3
|
+
onChange?: OnChange;
|
|
15
4
|
}
|
|
16
|
-
export declare const Dropdown: ({ id, options, loop, multiSelect, searchable,
|
|
5
|
+
export declare const Dropdown: ({ id, options, loop, multiSelect, searchable, searchFilter, compareWith, useValue, display, texts, onChange, validator, }: DropdownProps) => JSX.Element;
|
|
17
6
|
export default Dropdown;
|
package/lib/dropdown/hooks.d.ts
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
|
-
import { DropdownHandler,
|
|
1
|
+
import { DropdownHandler, OnChange, DropdownArgs } from '@sebgroup/extract';
|
|
2
2
|
import { HTMLAttributes, InputHTMLAttributes, RefObject } from 'react';
|
|
3
|
-
import { IValidator } from
|
|
4
|
-
interface HookArgs {
|
|
5
|
-
id?: string;
|
|
6
|
-
texts?: DropdownTexts;
|
|
7
|
-
options: DropdownOption[];
|
|
8
|
-
multiSelect?: boolean;
|
|
9
|
-
searchable?: boolean;
|
|
10
|
-
searchableProperties?: string[];
|
|
11
|
-
loop?: boolean;
|
|
12
|
-
selectValue?: string;
|
|
13
|
-
useValue?: string;
|
|
14
|
-
display?: string;
|
|
3
|
+
import { IValidator } from '@sebgroup/extract';
|
|
4
|
+
interface HookArgs extends DropdownArgs {
|
|
15
5
|
togglerRef: RefObject<HTMLElement>;
|
|
16
6
|
listboxRef: RefObject<HTMLElement>;
|
|
17
|
-
onChange?:
|
|
7
|
+
onChange?: OnChange;
|
|
18
8
|
validator?: IValidator;
|
|
19
9
|
}
|
|
20
10
|
declare type Props = HTMLAttributes<HTMLElement>;
|
|
@@ -35,5 +25,5 @@ interface HookResult {
|
|
|
35
25
|
listItems: Props[];
|
|
36
26
|
multiSelectProps: MultiSelectProps;
|
|
37
27
|
}
|
|
38
|
-
export declare const useDropdown: ({ id, texts, options, loop, multiSelect, searchable,
|
|
28
|
+
export declare const useDropdown: ({ id, texts, options, loop, multiSelect, searchable, searchFilter, compareWith, useValue, display, togglerRef, listboxRef, onChange, validator, }: HookArgs) => HookResult;
|
|
39
29
|
export {};
|
|
@@ -6,6 +6,7 @@ export interface ButtonProps {
|
|
|
6
6
|
variant?: ButtonVariant;
|
|
7
7
|
active?: boolean;
|
|
8
8
|
onClick?: MouseEventHandler<HTMLButtonElement>;
|
|
9
|
+
disabled?: boolean;
|
|
9
10
|
}
|
|
10
|
-
export declare function Button({ children, variant, onClick, active, type, }: ButtonProps): JSX.Element;
|
|
11
|
+
export declare function Button({ children, variant, onClick, disabled, active, type, }: ButtonProps): JSX.Element;
|
|
11
12
|
export default Button;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sebgroup/green-react",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.24",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"react": "^17 || ^18",
|
|
6
6
|
"react-dom": "^17 || ^18"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@sebgroup/chlorophyll": "^1.0.0-beta.
|
|
10
|
-
"@sebgroup/extract": "^1.0.0-beta.
|
|
9
|
+
"@sebgroup/chlorophyll": "^1.0.0-beta.25",
|
|
10
|
+
"@sebgroup/extract": "^1.0.0-beta.24"
|
|
11
11
|
},
|
|
12
12
|
"description": "React components built on top of @sebgroup/chlorophyll.",
|
|
13
13
|
"repository": {
|