react-hook-form-cloudscape 1.2.0 → 1.3.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.
- package/README.md +4 -14
- package/components/components/multiselect/multiselect.d.ts +3 -5
- package/components/components/multiselect/utils.d.ts +3 -1
- package/components/components/property-filter/index.d.ts +1 -0
- package/components/components/property-filter/property-filter.d.ts +12 -0
- package/components/components/s3-resource-selector/index.d.ts +1 -0
- package/components/components/s3-resource-selector/s3-resource-selector.d.ts +12 -0
- package/components/multiselect/multiselect.d.ts +3 -5
- package/components/multiselect/multiselect.js +10 -12
- package/components/multiselect/multiselect.js.map +1 -1
- package/components/multiselect/utils.d.ts +3 -1
- package/components/multiselect/utils.js +3 -6
- package/components/multiselect/utils.js.map +1 -1
- package/components/property-filter/index.d.ts +1 -0
- package/components/property-filter/index.js +2 -0
- package/components/property-filter/index.js.map +1 -0
- package/components/property-filter/property-filter.d.ts +12 -0
- package/components/property-filter/property-filter.js +15 -0
- package/components/property-filter/property-filter.js.map +1 -0
- package/components/s3-resource-selector/index.d.ts +1 -0
- package/components/s3-resource-selector/index.js +2 -0
- package/components/s3-resource-selector/index.js.map +1 -0
- package/components/s3-resource-selector/s3-resource-selector.d.ts +12 -0
- package/components/s3-resource-selector/s3-resource-selector.js +14 -0
- package/components/s3-resource-selector/s3-resource-selector.js.map +1 -0
- package/package.json +1 -1
- package/react-hook-form-cloudscape.es.js +308 -315
- package/react-hook-form-cloudscape.es.js.map +1 -1
- package/react-hook-form-cloudscape.umd.js +8 -8
- package/react-hook-form-cloudscape.umd.js.map +1 -1
package/README.md
CHANGED
|
@@ -2,20 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
A React library that simplifies the integration of [`react-hook-form`](https://github.com/react-hook-form/react-hook-form) with [`Cloudscape Design System`](https://github.com/cloudscape-design/components). It provides a set of pre-built, controlled input components that handle validation, allowing you to focus on building complex form logic with minimal effort.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
<a href="https://securityscorecards.dev/viewer/?uri=github.com/abudayah/react-hook-form-cloudscape" target="_blank">
|
|
10
|
-
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/abudayah/react-hook-form-cloudscape/badge">
|
|
11
|
-
</a>
|
|
12
|
-
<a href="https://github.com/abudayah/react-hook-form-cloudscape/actions/workflows/dependabot/dependabot-updates" target="_blank">
|
|
13
|
-
<img alt="OpenSSF Scorecard" src="https://github.com/abudayah/react-hook-form-cloudscape/actions/workflows/dependabot/dependabot-updates/badge.svg">
|
|
14
|
-
</a>
|
|
15
|
-
<a href="https://github.com/abudayah/react-hook-form-cloudscape" target="_blank">
|
|
16
|
-
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/abudayah/react-hook-form-cloudscape">
|
|
17
|
-
</a>
|
|
18
|
-
</p>
|
|
5
|
+
[](https://www.npmjs.com/package/react-hook-form-cloudscape)
|
|
6
|
+
[](https://securityscorecards.dev/viewer/?uri=github.com/abudayah/react-hook-form-cloudscape)
|
|
7
|
+
[](https://github.com/abudayah/react-hook-form-cloudscape/actions/workflows/dependabot/dependabot-updates)
|
|
8
|
+
[](https://github.com/abudayah/react-hook-form-cloudscape)
|
|
19
9
|
|
|
20
10
|
### Installation
|
|
21
11
|
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Control, FieldValues, FieldPathValue, FieldPath, RegisterOptions } from 'react-hook-form';
|
|
3
3
|
import { MultiselectProps } from '@cloudscape-design/components';
|
|
4
|
-
export interface
|
|
4
|
+
export interface ControlledMultiselectProps<T extends FieldValues> extends Omit<MultiselectProps, 'selectedOptions'> {
|
|
5
5
|
name: FieldPath<T>;
|
|
6
6
|
control?: Control<T>;
|
|
7
|
-
options
|
|
7
|
+
options?: MultiselectProps.Options;
|
|
8
8
|
defaultValue?: FieldPathValue<T, FieldPath<T>>;
|
|
9
9
|
rules?: Omit<RegisterOptions<T, FieldPath<T>>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
10
10
|
shouldUnregister?: boolean;
|
|
11
|
-
onBlur?: MultiselectProps['onBlur'];
|
|
12
|
-
onChange?: MultiselectProps['onChange'];
|
|
13
11
|
}
|
|
14
|
-
declare const CMultiselect: <TFieldValues extends FieldValues>({ name, control, options, defaultValue, rules, onBlur, onChange, shouldUnregister, ...props }:
|
|
12
|
+
declare const CMultiselect: <TFieldValues extends FieldValues>({ name, control, options, defaultValue, rules, onBlur, onChange, shouldUnregister, ...props }: ControlledMultiselectProps<TFieldValues>) => React.JSX.Element;
|
|
15
13
|
export default CMultiselect;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { MultiselectProps } from '@cloudscape-design/components';
|
|
1
|
+
import { MultiselectProps } from '@cloudscape-design/components/multiselect/interfaces';
|
|
2
|
+
export declare const transformMultiselectOptionsToArray: (selectedOptions?: MultiselectProps.Options) => string[];
|
|
3
|
+
export declare const mapSelectedOptionsWithOptions: (options?: MultiselectProps.Options, selectedOptions?: string[]) => Array<MultiselectProps.Option | MultiselectProps.OptionGroup>;
|
|
2
4
|
declare const MultiSelectUtils: {
|
|
3
5
|
transformMultiselectOptionsToArray: (selectedOptions?: MultiselectProps.Options) => string[];
|
|
4
6
|
mapSelectedOptionsWithOptions: (options?: MultiselectProps.Options, selectedOptions?: string[]) => Array<MultiselectProps.Option | MultiselectProps.OptionGroup>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CPropertyFilter } from './property-filter';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Control, FieldValues, FieldPathValue, FieldPath, RegisterOptions } from 'react-hook-form';
|
|
3
|
+
import { PropertyFilterProps } from '@cloudscape-design/components';
|
|
4
|
+
export interface ControlledPropertyFilterProps<T extends FieldValues> extends Omit<PropertyFilterProps, 'query' | 'onChange'> {
|
|
5
|
+
name: FieldPath<T>;
|
|
6
|
+
control?: Control<T>;
|
|
7
|
+
defaultValue?: FieldPathValue<T, FieldPath<T>>;
|
|
8
|
+
rules?: Omit<RegisterOptions<T, FieldPath<T>>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
9
|
+
shouldUnregister?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const CPropertyFilter: <TFieldValues extends FieldValues>(CPropertyFilterProperties: ControlledPropertyFilterProps<TFieldValues>) => React.JSX.Element;
|
|
12
|
+
export default CPropertyFilter;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CS3ResourceSelector } from './s3-resource-selector';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { S3ResourceSelectorProps } from '@cloudscape-design/components';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Control, FieldValues, FieldPathValue, FieldPath, RegisterOptions } from 'react-hook-form';
|
|
4
|
+
export interface ControlledS3ResourceSelectorProps<T extends FieldValues> extends Omit<S3ResourceSelectorProps, 'resource'> {
|
|
5
|
+
name: FieldPath<T>;
|
|
6
|
+
control?: Control<T>;
|
|
7
|
+
defaultValue?: FieldPathValue<T, FieldPath<T>>;
|
|
8
|
+
rules?: Omit<RegisterOptions<T, FieldPath<T>>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
9
|
+
shouldUnregister?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const CS3ResourceSelector: <TFieldValues extends FieldValues>({ name, control, defaultValue, rules, shouldUnregister, onChange, ...props }: ControlledS3ResourceSelectorProps<TFieldValues>) => React.ReactElement;
|
|
12
|
+
export default CS3ResourceSelector;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
2
|
import { Control, FieldValues, FieldPathValue, FieldPath, RegisterOptions } from 'react-hook-form';
|
|
3
3
|
import { MultiselectProps } from '@cloudscape-design/components';
|
|
4
|
-
export interface
|
|
4
|
+
export interface ControlledMultiselectProps<T extends FieldValues> extends Omit<MultiselectProps, 'selectedOptions'> {
|
|
5
5
|
name: FieldPath<T>;
|
|
6
6
|
control?: Control<T>;
|
|
7
|
-
options
|
|
7
|
+
options?: MultiselectProps.Options;
|
|
8
8
|
defaultValue?: FieldPathValue<T, FieldPath<T>>;
|
|
9
9
|
rules?: Omit<RegisterOptions<T, FieldPath<T>>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
10
10
|
shouldUnregister?: boolean;
|
|
11
|
-
onBlur?: MultiselectProps['onBlur'];
|
|
12
|
-
onChange?: MultiselectProps['onChange'];
|
|
13
11
|
}
|
|
14
|
-
declare const CMultiselect: <TFieldValues extends FieldValues>({ name, control, options, defaultValue, rules, onBlur, onChange, shouldUnregister, ...props }:
|
|
12
|
+
declare const CMultiselect: <TFieldValues extends FieldValues>({ name, control, options, defaultValue, rules, onBlur, onChange, shouldUnregister, ...props }: ControlledMultiselectProps<TFieldValues>) => React.JSX.Element;
|
|
15
13
|
export default CMultiselect;
|
|
@@ -2,22 +2,20 @@ import { __rest } from "tslib";
|
|
|
2
2
|
import React, { useCallback } from 'react';
|
|
3
3
|
import { Controller } from 'react-hook-form';
|
|
4
4
|
import { Multiselect } from '@cloudscape-design/components';
|
|
5
|
-
import
|
|
5
|
+
import { transformMultiselectOptionsToArray, mapSelectedOptionsWithOptions } from './utils';
|
|
6
6
|
const CMultiselect = (_a) => {
|
|
7
7
|
var { name, control, options, defaultValue, rules, onBlur, onChange, shouldUnregister = false } = _a, props = __rest(_a, ["name", "control", "options", "defaultValue", "rules", "onBlur", "onChange", "shouldUnregister"]);
|
|
8
|
-
const handleOnBlur = useCallback((
|
|
9
|
-
|
|
8
|
+
const handleOnBlur = useCallback((formOnBlur, e) => {
|
|
9
|
+
formOnBlur();
|
|
10
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(e);
|
|
10
11
|
}, [onBlur]);
|
|
11
|
-
const handleOnChange = useCallback((
|
|
12
|
-
|
|
12
|
+
const handleOnChange = useCallback((formOnChange, e) => {
|
|
13
|
+
formOnChange(transformMultiselectOptionsToArray(e.detail.selectedOptions));
|
|
14
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
13
15
|
}, [onChange]);
|
|
14
|
-
return (React.createElement(Controller, { name: name, control: control, defaultValue: defaultValue, rules: rules, shouldUnregister: shouldUnregister, render: ({ field: { ref,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}, onChange: (e) => {
|
|
18
|
-
formOnChange(MultiSelectUtils.transformMultiselectOptionsToArray(e.detail.selectedOptions)); // Transform selectedOptions
|
|
19
|
-
handleOnChange(e);
|
|
20
|
-
}, selectedOptions: value }, props))) }));
|
|
16
|
+
return (React.createElement(Controller, { name: name, control: control, defaultValue: defaultValue, rules: rules, shouldUnregister: shouldUnregister, render: ({ field: { ref, onChange, onBlur, value } }) => {
|
|
17
|
+
return (React.createElement(Multiselect, Object.assign({ ref: ref, options: options, onBlur: () => handleOnBlur.bind(null, onBlur), onChange: handleOnChange.bind(null, onChange), selectedOptions: mapSelectedOptionsWithOptions(options, value) }, props)));
|
|
18
|
+
} }));
|
|
21
19
|
};
|
|
22
20
|
export default CMultiselect;
|
|
23
21
|
//# sourceMappingURL=multiselect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multiselect.js","sourceRoot":"","sources":["../../src/components/multiselect/multiselect.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAW,UAAU,EAA2D,MAAM,iBAAiB,CAAC;AAC/G,OAAO,
|
|
1
|
+
{"version":3,"file":"multiselect.js","sourceRoot":"","sources":["../../src/components/multiselect/multiselect.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAW,UAAU,EAA2D,MAAM,iBAAiB,CAAC;AAC/G,OAAO,EAA8C,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACxG,OAAO,EAAE,kCAAkC,EAAE,6BAA6B,EAAE,MAAM,SAAS,CAAC;AAW5F,MAAM,YAAY,GAAG,CAAmC,EAUb,EAAE,EAAE;QAVS,EACtD,IAAI,EACJ,OAAO,EACP,OAAO,EACP,YAAY,EACZ,KAAK,EACL,MAAM,EACN,QAAQ,EACR,gBAAgB,GAAG,KAAK,OAEiB,EADtC,KAAK,cAT8C,iGAUvD,CADS;IAER,MAAM,YAAY,GAAG,WAAW,CAC9B,CAAC,UAAsB,EAAE,CAAqE,EAAE,EAAE;QAChG,UAAU,EAAE,CAAC;QACb,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAG,CAAC,CAAC,CAAC;IACd,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,MAAM,cAAc,GAAG,WAAW,CAChC,CAAC,YAAsC,EAAE,CAAqE,EAAE,EAAE;QAChH,YAAY,CAAC,kCAAkC,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC;QAC3E,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,CAAC,CAAC,CAAC;IAChB,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,oBAAC,UAAU,IACT,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YACtD,OAAO,CACL,oBAAC,WAAW,kBACV,GAAG,EAAE,GAAG,EACR,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EAC7C,QAAQ,EAAE,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,EAC7C,eAAe,EAAE,6BAA6B,CAAC,OAAO,EAAE,KAAK,CAAC,IAC1D,KAAK,EACT,CACH,CAAC;QACJ,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { MultiselectProps } from '@cloudscape-design/components';
|
|
1
|
+
import { MultiselectProps } from '@cloudscape-design/components/multiselect/interfaces';
|
|
2
|
+
export declare const transformMultiselectOptionsToArray: (selectedOptions?: MultiselectProps.Options) => string[];
|
|
3
|
+
export declare const mapSelectedOptionsWithOptions: (options?: MultiselectProps.Options, selectedOptions?: string[]) => Array<MultiselectProps.Option | MultiselectProps.OptionGroup>;
|
|
2
4
|
declare const MultiSelectUtils: {
|
|
3
5
|
transformMultiselectOptionsToArray: (selectedOptions?: MultiselectProps.Options) => string[];
|
|
4
6
|
mapSelectedOptionsWithOptions: (options?: MultiselectProps.Options, selectedOptions?: string[]) => Array<MultiselectProps.Option | MultiselectProps.OptionGroup>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const transformMultiselectOptionsToArray = (selectedOptions = []) => {
|
|
1
|
+
export const transformMultiselectOptionsToArray = (selectedOptions = []) => {
|
|
2
2
|
if (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length) {
|
|
3
3
|
return selectedOptions
|
|
4
4
|
.map((option) => {
|
|
@@ -11,7 +11,7 @@ const transformMultiselectOptionsToArray = (selectedOptions = []) => {
|
|
|
11
11
|
}
|
|
12
12
|
return [];
|
|
13
13
|
};
|
|
14
|
-
const mapSelectedOptionsWithOptions = (options = [], selectedOptions = []) => {
|
|
14
|
+
export const mapSelectedOptionsWithOptions = (options = [], selectedOptions = []) => {
|
|
15
15
|
if ((options === null || options === void 0 ? void 0 : options.length) && (selectedOptions === null || selectedOptions === void 0 ? void 0 : selectedOptions.length)) {
|
|
16
16
|
return options
|
|
17
17
|
.reduce((accOptions, currentOption) => {
|
|
@@ -34,9 +34,6 @@ const mapSelectedOptionsWithOptions = (options = [], selectedOptions = []) => {
|
|
|
34
34
|
}
|
|
35
35
|
return [];
|
|
36
36
|
};
|
|
37
|
-
const MultiSelectUtils = {
|
|
38
|
-
transformMultiselectOptionsToArray,
|
|
39
|
-
mapSelectedOptionsWithOptions,
|
|
40
|
-
};
|
|
37
|
+
const MultiSelectUtils = { transformMultiselectOptionsToArray, mapSelectedOptionsWithOptions };
|
|
41
38
|
export default MultiSelectUtils;
|
|
42
39
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/components/multiselect/utils.ts"],"names":[],"mappings":"AAEA,MAAM,kCAAkC,GAAG,CAAC,kBAA4C,EAAE,EAAY,EAAE;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/components/multiselect/utils.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,kBAA4C,EAAE,EAAY,EAAE;IAC7G,IAAI,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,EAAE,CAAC;QAC5B,OAAO,eAAe;aACnB,GAAG,CAAC,CAAC,MAA8D,EAAE,EAAE;YACtE,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;gBACxB,OAAO,kCAAkC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC5D,CAAC;YAED,OAAO,MAAM,CAAC,KAAK,CAAC;QACtB,CAAC,CAAC;aACD,IAAI,EAAc,CAAC;IACxB,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,6BAA6B,GAAG,CAC3C,UAAoC,EAAE,EACtC,kBAA4B,EAAE,EACiC,EAAE;IACjE,IAAI,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,MAAI,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,MAAM,CAAA,EAAE,CAAC;QAC/C,OAAO,OAAO;aACX,MAAM,CAAC,CAAC,UAAyE,EAAE,aAAa,EAAE,EAAE;YACnG,IAAI,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,EAAE,CAAC;gBACpB,IAAI,SAAS,IAAI,aAAa,EAAE,CAAC;oBAC/B,MAAM,cAAc,GAAG,6BAA6B,CAAC,aAAa,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;oBAE7F,IAAI,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,MAAM,EAAE,CAAC;wBAC3B,UAAU,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC;oBACrC,CAAC;gBACH,CAAC;gBAED,IAAI,OAAO,IAAI,aAAa,EAAE,CAAC;oBAC7B,IAAI,eAAe,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,KAAK,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;wBACrE,UAAU,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;oBACjC,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,UAAU,CAAC;QACpB,CAAC,EAAE,EAAE,CAAC;aACL,IAAI,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,EAAE,kCAAkC,EAAE,6BAA6B,EAAE,CAAC;AAE/F,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CPropertyFilter } from './property-filter';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/property-filter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { default as React } from 'react';
|
|
2
|
+
import { Control, FieldValues, FieldPathValue, FieldPath, RegisterOptions } from 'react-hook-form';
|
|
3
|
+
import { PropertyFilterProps } from '@cloudscape-design/components';
|
|
4
|
+
export interface ControlledPropertyFilterProps<T extends FieldValues> extends Omit<PropertyFilterProps, 'query' | 'onChange'> {
|
|
5
|
+
name: FieldPath<T>;
|
|
6
|
+
control?: Control<T>;
|
|
7
|
+
defaultValue?: FieldPathValue<T, FieldPath<T>>;
|
|
8
|
+
rules?: Omit<RegisterOptions<T, FieldPath<T>>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
9
|
+
shouldUnregister?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const CPropertyFilter: <TFieldValues extends FieldValues>(CPropertyFilterProperties: ControlledPropertyFilterProps<TFieldValues>) => React.JSX.Element;
|
|
12
|
+
export default CPropertyFilter;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import React, { useCallback } from 'react';
|
|
3
|
+
import { Controller } from 'react-hook-form';
|
|
4
|
+
import { PropertyFilter } from '@cloudscape-design/components';
|
|
5
|
+
export const CPropertyFilter = (CPropertyFilterProperties) => {
|
|
6
|
+
const { name, control, defaultValue, rules, shouldUnregister = false } = CPropertyFilterProperties, props = __rest(CPropertyFilterProperties, ["name", "control", "defaultValue", "rules", "shouldUnregister"]);
|
|
7
|
+
const handleOnChange = useCallback((formOnChange, e) => {
|
|
8
|
+
formOnChange(e.detail);
|
|
9
|
+
}, []);
|
|
10
|
+
return (React.createElement(Controller, { name: name, control: control, defaultValue: defaultValue, rules: rules, shouldUnregister: shouldUnregister, render: ({ field: { onChange, value } }) => {
|
|
11
|
+
return React.createElement(PropertyFilter, Object.assign({ onChange: handleOnChange.bind(null, onChange), query: value }, props));
|
|
12
|
+
} }));
|
|
13
|
+
};
|
|
14
|
+
export default CPropertyFilter;
|
|
15
|
+
//# sourceMappingURL=property-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-filter.js","sourceRoot":"","sources":["../../src/components/property-filter/property-filter.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAW,UAAU,EAA2D,MAAM,iBAAiB,CAAC;AAC/G,OAAO,EAAiD,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAW9G,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,yBAAsE,EACtE,EAAE;IACF,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,gBAAgB,GAAG,KAAK,KAAe,yBAAyB,EAAnC,KAAK,UAAK,yBAAyB,EAAtG,gEAA0E,CAA4B,CAAC;IAC7G,MAAM,cAAc,GAAG,WAAW,CAChC,CACE,YAAwD,EACxD,CAAsD,EACtD,EAAE;QACF,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC,EACD,EAAE,CACH,CAAC;IAEF,OAAO,CACL,oBAAC,UAAU,IACT,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE;YACzC,OAAO,oBAAC,cAAc,kBAAC,QAAQ,EAAE,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,IAAM,KAAK,EAAI,CAAC;QACpG,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CS3ResourceSelector } from './s3-resource-selector';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/s3-resource-selector/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { S3ResourceSelectorProps } from '@cloudscape-design/components';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
import { Control, FieldValues, FieldPathValue, FieldPath, RegisterOptions } from 'react-hook-form';
|
|
4
|
+
export interface ControlledS3ResourceSelectorProps<T extends FieldValues> extends Omit<S3ResourceSelectorProps, 'resource'> {
|
|
5
|
+
name: FieldPath<T>;
|
|
6
|
+
control?: Control<T>;
|
|
7
|
+
defaultValue?: FieldPathValue<T, FieldPath<T>>;
|
|
8
|
+
rules?: Omit<RegisterOptions<T, FieldPath<T>>, 'valueAsNumber' | 'valueAsDate' | 'setValueAs' | 'disabled'>;
|
|
9
|
+
shouldUnregister?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const CS3ResourceSelector: <TFieldValues extends FieldValues>({ name, control, defaultValue, rules, shouldUnregister, onChange, ...props }: ControlledS3ResourceSelectorProps<TFieldValues>) => React.ReactElement;
|
|
12
|
+
export default CS3ResourceSelector;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __rest } from "tslib";
|
|
2
|
+
import { S3ResourceSelector } from '@cloudscape-design/components';
|
|
3
|
+
import React, { useCallback } from 'react';
|
|
4
|
+
import { Controller } from 'react-hook-form';
|
|
5
|
+
export const CS3ResourceSelector = (_a) => {
|
|
6
|
+
var { name, control, defaultValue, rules, shouldUnregister = false, onChange } = _a, props = __rest(_a, ["name", "control", "defaultValue", "rules", "shouldUnregister", "onChange"]);
|
|
7
|
+
const handleOnChange = useCallback((formOnChange, e) => {
|
|
8
|
+
formOnChange(e.detail.resource);
|
|
9
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e);
|
|
10
|
+
}, [onChange]);
|
|
11
|
+
return (React.createElement(Controller, { name: name, control: control, defaultValue: defaultValue, rules: rules, shouldUnregister: shouldUnregister, render: ({ field: { ref, onChange, value } }) => (React.createElement(S3ResourceSelector, Object.assign({ ref: ref, resource: value !== null && value !== void 0 ? value : { uri: '' }, onChange: handleOnChange.bind(null, onChange) }, props))) }));
|
|
12
|
+
};
|
|
13
|
+
export default CS3ResourceSelector;
|
|
14
|
+
//# sourceMappingURL=s3-resource-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s3-resource-selector.js","sourceRoot":"","sources":["../../src/components/s3-resource-selector/s3-resource-selector.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAqD,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACtH,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAoE,MAAM,iBAAiB,CAAC;AAW/G,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAmC,EAQpB,EAAsB,EAAE;QARJ,EACpE,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,KAAK,EACL,gBAAgB,GAAG,KAAK,EACxB,QAAQ,OAEwC,EAD7C,KAAK,cAP4D,4EAQrE,CADS;IAER,MAAM,cAAc,GAAG,WAAW,CAChC,CACE,YAAkE,EAClE,CAAiE,EACjE,EAAE;QACF,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAChC,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,CAAC,CAAC,CAAC;IAChB,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,oBAAC,UAAU,IACT,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,CAAC,CAC/C,oBAAC,kBAAkB,kBACjB,GAAG,EAAE,GAAG,EACR,QAAQ,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,EAAE,GAAG,EAAE,EAAE,EAAE,EAC9B,QAAQ,EAAE,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,IACzC,KAAK,EACT,CACH,GACD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
package/package.json
CHANGED