@scm-manager/ui-forms 2.40.2-SNAPSHOT-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/.storybook/RemoveThemesPlugin.js +57 -0
- package/.storybook/main.js +92 -0
- package/.storybook/preview-head.html +26 -0
- package/.storybook/preview.js +72 -0
- package/.turbo/turbo-build.log +15 -0
- package/build/index.d.ts +124 -0
- package/build/index.js +639 -0
- package/build/index.mjs +602 -0
- package/package.json +50 -0
- package/src/ConfigurationForm.tsx +54 -0
- package/src/Form.stories.mdx +160 -0
- package/src/Form.tsx +164 -0
- package/src/FormRow.tsx +37 -0
- package/src/ScmFormContext.tsx +42 -0
- package/src/base/Control.tsx +34 -0
- package/src/base/Field.tsx +33 -0
- package/src/base/field-message/FieldMessage.tsx +34 -0
- package/src/base/help/Help.tsx +36 -0
- package/src/base/label/Label.tsx +33 -0
- package/src/checkbox/Checkbox.stories.mdx +26 -0
- package/src/checkbox/Checkbox.tsx +85 -0
- package/src/checkbox/CheckboxField.tsx +39 -0
- package/src/checkbox/ControlledCheckboxField.stories.mdx +36 -0
- package/src/checkbox/ControlledCheckboxField.tsx +76 -0
- package/src/index.ts +27 -0
- package/src/input/ControlledInputField.stories.mdx +36 -0
- package/src/input/ControlledInputField.tsx +77 -0
- package/src/input/ControlledSecretConfirmationField.stories.mdx +39 -0
- package/src/input/ControlledSecretConfirmationField.tsx +121 -0
- package/src/input/Input.stories.mdx +22 -0
- package/src/input/Input.tsx +46 -0
- package/src/input/InputField.stories.mdx +22 -0
- package/src/input/InputField.tsx +60 -0
- package/src/resourceHooks.ts +155 -0
- package/src/select/ControlledSelectField.tsx +77 -0
- package/src/select/Select.tsx +43 -0
- package/src/select/SelectField.tsx +59 -0
- package/src/variants.ts +27 -0
- package/tsconfig.json +3 -0
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
26
|
+
|
|
27
|
+
class RemoveThemesPlugin {
|
|
28
|
+
apply (compiler) {
|
|
29
|
+
compiler.hooks.compilation.tap('RemoveThemesPlugin', (compilation) => {
|
|
30
|
+
|
|
31
|
+
HtmlWebpackPlugin.getHooks(compilation).beforeAssetTagGeneration.tapAsync(
|
|
32
|
+
'RemoveThemesPlugin',
|
|
33
|
+
(data, cb) => {
|
|
34
|
+
|
|
35
|
+
// remove generated style-loader bundles from the page
|
|
36
|
+
// there should be a better way, which does not generate the bundles at all
|
|
37
|
+
// but for now it works
|
|
38
|
+
if (data.assets.js) {
|
|
39
|
+
data.assets.js = data.assets.js.filter(bundle => !bundle.startsWith("ui-theme-"))
|
|
40
|
+
.filter(bundle => !bundle.startsWith("runtime~ui-theme-"))
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// remove css links to avoid conflicts with the themes
|
|
44
|
+
// so we remove all and add our own via preview-head.html
|
|
45
|
+
if (data.assets.css) {
|
|
46
|
+
data.assets.css = data.assets.css.filter(css => !css.startsWith("ui-theme-"))
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Tell webpack to move on
|
|
50
|
+
cb(null, data)
|
|
51
|
+
}
|
|
52
|
+
)
|
|
53
|
+
})
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
module.exports = RemoveThemesPlugin
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
const path = require("path");
|
|
26
|
+
const fs = require("fs");
|
|
27
|
+
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
|
|
28
|
+
const RemoveThemesPlugin = require("./RemoveThemesPlugin");
|
|
29
|
+
const ReactDOM = require("react-dom");
|
|
30
|
+
|
|
31
|
+
const root = path.resolve("..");
|
|
32
|
+
|
|
33
|
+
const themedir = path.join(root, "ui-styles", "src");
|
|
34
|
+
|
|
35
|
+
ReactDOM.createPortal = (node) => node;
|
|
36
|
+
|
|
37
|
+
const themes = fs
|
|
38
|
+
.readdirSync(themedir)
|
|
39
|
+
.map((filename) => path.parse(filename))
|
|
40
|
+
.filter((p) => p.ext === ".scss")
|
|
41
|
+
.reduce((entries, current) => ({ ...entries, [`ui-theme-${current.name}`]: path.join(themedir, current.base) }), {});
|
|
42
|
+
|
|
43
|
+
module.exports = {
|
|
44
|
+
typescript: { reactDocgen: false },
|
|
45
|
+
core: {
|
|
46
|
+
builder: "webpack5",
|
|
47
|
+
},
|
|
48
|
+
stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
|
|
49
|
+
addons: [
|
|
50
|
+
"storybook-addon-i18next",
|
|
51
|
+
"storybook-addon-themes",
|
|
52
|
+
"@storybook/addon-links",
|
|
53
|
+
"@storybook/addon-essentials",
|
|
54
|
+
"@storybook/addon-interactions",
|
|
55
|
+
"@storybook/addon-a11y",
|
|
56
|
+
"storybook-addon-pseudo-states",
|
|
57
|
+
"storybook-addon-mock",
|
|
58
|
+
],
|
|
59
|
+
framework: "@storybook/react",
|
|
60
|
+
webpackFinal: async (config) => {
|
|
61
|
+
// add our themes to webpack entry points
|
|
62
|
+
config.entry = {
|
|
63
|
+
main: config.entry,
|
|
64
|
+
...themes,
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// create separate css files for our themes
|
|
68
|
+
config.plugins.push(
|
|
69
|
+
new MiniCssExtractPlugin({
|
|
70
|
+
filename: "[name].css",
|
|
71
|
+
ignoreOrder: false,
|
|
72
|
+
})
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
config.module.rules.push({
|
|
76
|
+
test: /\.scss$/,
|
|
77
|
+
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// the html-webpack-plugin adds the generated css and js files to the iframe,
|
|
81
|
+
// which overrides our manually loaded css files.
|
|
82
|
+
// So we use a custom plugin which uses a hook of html-webpack-plugin
|
|
83
|
+
// to filter our themes from the output.
|
|
84
|
+
config.plugins.push(new RemoveThemesPlugin());
|
|
85
|
+
|
|
86
|
+
// force cjs instead of esm
|
|
87
|
+
// https://github.com/tannerlinsley/react-query/issues/3513
|
|
88
|
+
config.resolve.alias["react-query/devtools"] = require.resolve("react-query/devtools");
|
|
89
|
+
|
|
90
|
+
return config;
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
MIT License
|
|
3
|
+
|
|
4
|
+
Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
|
5
|
+
|
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
in the Software without restriction, including without limitation the rights
|
|
9
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
furnished to do so, subject to the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
SOFTWARE.
|
|
23
|
+
-->
|
|
24
|
+
|
|
25
|
+
<link id="ui-theme" data-theme="light" rel="stylesheet" type="text/css" href="/ui-theme-light.css">
|
|
26
|
+
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2020-present Cloudogu GmbH and Contributors
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import React, { useEffect } from "react";
|
|
26
|
+
import { I18nextProvider, initReactI18next } from "react-i18next";
|
|
27
|
+
import i18n from "i18next";
|
|
28
|
+
|
|
29
|
+
i18n.use(initReactI18next).init({
|
|
30
|
+
whitelist: ["en", "de"],
|
|
31
|
+
lng: "en",
|
|
32
|
+
fallbackLng: "en",
|
|
33
|
+
interpolation: {
|
|
34
|
+
escapeValue: false,
|
|
35
|
+
},
|
|
36
|
+
react: {
|
|
37
|
+
useSuspense: false,
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const Decorator = ({ children, themeName }) => {
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
const link = document.querySelector("#ui-theme");
|
|
45
|
+
if (link && link["data-theme"] !== themeName) {
|
|
46
|
+
link.href = `ui-theme-${themeName}.css`;
|
|
47
|
+
link["data-theme"] = themeName;
|
|
48
|
+
}
|
|
49
|
+
}, [themeName]);
|
|
50
|
+
return <>{children}</>;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const parameters = {
|
|
54
|
+
actions: { argTypesRegex: "^on[A-Z].*" },
|
|
55
|
+
decorators: [
|
|
56
|
+
(Story) => (
|
|
57
|
+
<I18nextProvider i18n={i18n}>
|
|
58
|
+
<Story />
|
|
59
|
+
</I18nextProvider>
|
|
60
|
+
),
|
|
61
|
+
],
|
|
62
|
+
themes: {
|
|
63
|
+
Decorator,
|
|
64
|
+
clearable: false,
|
|
65
|
+
default: "light",
|
|
66
|
+
list: [
|
|
67
|
+
{ name: "light", color: "#fff" },
|
|
68
|
+
{ name: "highcontrast", color: "#050514" },
|
|
69
|
+
{ name: "dark", color: "#121212" },
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
@scm-manager/ui-forms:build: cache hit, replaying output 3885a8636aa7a21b
|
|
2
|
+
@scm-manager/ui-forms:build: $ tsup ./src/index.ts -d build --format esm,cjs --dts
|
|
3
|
+
@scm-manager/ui-forms:build: CLI Building entry: ./src/index.ts
|
|
4
|
+
@scm-manager/ui-forms:build: CLI Using tsconfig: tsconfig.json
|
|
5
|
+
@scm-manager/ui-forms:build: CLI tsup v6.2.3
|
|
6
|
+
@scm-manager/ui-forms:build: CLI Target: node14
|
|
7
|
+
@scm-manager/ui-forms:build: ESM Build start
|
|
8
|
+
@scm-manager/ui-forms:build: CJS Build start
|
|
9
|
+
@scm-manager/ui-forms:build: ESM build/index.mjs 19.33 KB
|
|
10
|
+
@scm-manager/ui-forms:build: ESM ⚡️ Build success in 38ms
|
|
11
|
+
@scm-manager/ui-forms:build: CJS build/index.js 23.14 KB
|
|
12
|
+
@scm-manager/ui-forms:build: CJS ⚡️ Build success in 31ms
|
|
13
|
+
@scm-manager/ui-forms:build: DTS Build start
|
|
14
|
+
@scm-manager/ui-forms:build: DTS ⚡️ Build success in 11203ms
|
|
15
|
+
@scm-manager/ui-forms:build: DTS build/index.d.ts 22.12 KB
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import React, { ComponentProps } from 'react';
|
|
2
|
+
import { ControllerRenderProps, Controller, Path, RegisterOptions, SubmitHandler, UseFormReturn } from 'react-hook-form';
|
|
3
|
+
import { HalRepresentation } from '@scm-manager/ui-types';
|
|
4
|
+
|
|
5
|
+
declare const Input: React.ForwardRefExoticComponent<{
|
|
6
|
+
variant?: "danger" | undefined;
|
|
7
|
+
testId?: string | undefined;
|
|
8
|
+
} & React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement>>;
|
|
9
|
+
|
|
10
|
+
declare type InputFieldProps = {
|
|
11
|
+
label: string;
|
|
12
|
+
helpText?: string;
|
|
13
|
+
error?: string;
|
|
14
|
+
type?: "text" | "password" | "email" | "tel";
|
|
15
|
+
} & Omit<React.ComponentProps<typeof Input>, "type">;
|
|
16
|
+
/**
|
|
17
|
+
* @see https://bulma.io/documentation/form/input/
|
|
18
|
+
*/
|
|
19
|
+
declare const InputField: React.ForwardRefExoticComponent<Pick<InputFieldProps, "children" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "type" | "className" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "list" | "name" | "alt" | "src" | "testId" | "disabled" | "value" | "size" | "step" | "height" | "max" | "min" | "width" | "crossOrigin" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "autoComplete" | "accept" | "capture" | "checked" | "enterKeyHint" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "error" | "helpText" | "variant"> & React.RefAttributes<HTMLInputElement>>;
|
|
20
|
+
|
|
21
|
+
declare type Props$6<T extends Record<string, unknown>> = Omit<ComponentProps<typeof InputField>, "error" | "label" | "defaultChecked" | "required" | keyof ControllerRenderProps> & {
|
|
22
|
+
rules?: ComponentProps<typeof Controller>["rules"];
|
|
23
|
+
name: Path<T>;
|
|
24
|
+
label?: string;
|
|
25
|
+
};
|
|
26
|
+
declare function ControlledInputField$1<T extends Record<string, unknown>>({ name, label, helpText, rules, className, testId, defaultValue, readOnly, ...props }: Props$6<T>): JSX.Element;
|
|
27
|
+
|
|
28
|
+
declare const CheckboxField: React.ForwardRefExoticComponent<Pick<{
|
|
29
|
+
label: string;
|
|
30
|
+
helpText?: string | undefined;
|
|
31
|
+
testId?: string | undefined;
|
|
32
|
+
} & Omit<React.InputHTMLAttributes<HTMLInputElement>, "type"> & React.RefAttributes<HTMLInputElement>, "children" | "form" | "label" | "slot" | "style" | "title" | "pattern" | "className" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "list" | "name" | "alt" | "src" | "testId" | "disabled" | "value" | "size" | "step" | "height" | "max" | "min" | "width" | "crossOrigin" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "autoComplete" | "accept" | "capture" | "checked" | "enterKeyHint" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "helpText"> & React.RefAttributes<HTMLInputElement>>;
|
|
33
|
+
|
|
34
|
+
declare type Props$5<T extends Record<string, unknown>> = Omit<ComponentProps<typeof CheckboxField>, "label" | "defaultValue" | "required" | keyof ControllerRenderProps> & {
|
|
35
|
+
name: Path<T>;
|
|
36
|
+
label?: string;
|
|
37
|
+
rules?: Pick<RegisterOptions, "deps">;
|
|
38
|
+
};
|
|
39
|
+
declare function ControlledInputField<T extends Record<string, unknown>>({ name, label, helpText, rules, className, testId, defaultChecked, readOnly, ...props }: Props$5<T>): JSX.Element;
|
|
40
|
+
|
|
41
|
+
declare type Props$4<T extends Record<string, unknown>> = Omit<ComponentProps<typeof InputField>, "error" | "label" | "defaultChecked" | "required" | keyof ControllerRenderProps> & {
|
|
42
|
+
rules?: ComponentProps<typeof Controller>["rules"];
|
|
43
|
+
name: Path<T>;
|
|
44
|
+
label?: string;
|
|
45
|
+
confirmationLabel?: string;
|
|
46
|
+
confirmationHelpText?: string;
|
|
47
|
+
confirmationErrorMessage?: string;
|
|
48
|
+
confirmationTestId?: string;
|
|
49
|
+
};
|
|
50
|
+
declare function ControlledSecretConfirmationField<T extends Record<string, unknown>>({ name, label, confirmationLabel, helpText, confirmationHelpText, rules, confirmationErrorMessage, className, testId, confirmationTestId, defaultValue, readOnly, ...props }: Props$4<T>): JSX.Element;
|
|
51
|
+
|
|
52
|
+
declare const Select: React.ForwardRefExoticComponent<{
|
|
53
|
+
variant?: "danger" | undefined;
|
|
54
|
+
testId?: string | undefined;
|
|
55
|
+
} & React.InputHTMLAttributes<HTMLSelectElement> & React.RefAttributes<HTMLSelectElement>>;
|
|
56
|
+
|
|
57
|
+
declare type Props$3 = {
|
|
58
|
+
label: string;
|
|
59
|
+
helpText?: string;
|
|
60
|
+
error?: string;
|
|
61
|
+
} & React.ComponentProps<typeof Select>;
|
|
62
|
+
/**
|
|
63
|
+
* @see https://bulma.io/documentation/form/select/
|
|
64
|
+
*/
|
|
65
|
+
declare const SelectField: React.ForwardRefExoticComponent<Pick<Props$3, "label" | "key" | "testId" | "error" | "helpText" | "variant" | keyof React.InputHTMLAttributes<HTMLSelectElement>> & React.RefAttributes<HTMLSelectElement>>;
|
|
66
|
+
|
|
67
|
+
declare type Props$2<T extends Record<string, unknown>> = Omit<ComponentProps<typeof SelectField>, "error" | "label" | "required" | keyof ControllerRenderProps> & {
|
|
68
|
+
rules?: ComponentProps<typeof Controller>["rules"];
|
|
69
|
+
name: Path<T>;
|
|
70
|
+
label?: string;
|
|
71
|
+
};
|
|
72
|
+
declare function ControlledSelectField<T extends Record<string, unknown>>({ name, label, helpText, rules, className, testId, defaultValue, readOnly, ...props }: Props$2<T>): JSX.Element;
|
|
73
|
+
|
|
74
|
+
declare type RenderProps<T extends Record<string, unknown>> = Omit<UseFormReturn<T>, "register" | "unregister" | "handleSubmit" | "control">;
|
|
75
|
+
declare type Props$1<FormType extends Record<string, unknown>, DefaultValues extends FormType> = {
|
|
76
|
+
children: ((renderProps: RenderProps<FormType>) => React.ReactNode | React.ReactNode[]) | React.ReactNode;
|
|
77
|
+
translationPath: [namespace: string, prefix: string];
|
|
78
|
+
onSubmit: SubmitHandler<FormType>;
|
|
79
|
+
defaultValues: Omit<DefaultValues, keyof HalRepresentation>;
|
|
80
|
+
readOnly?: boolean;
|
|
81
|
+
submitButtonTestId?: string;
|
|
82
|
+
};
|
|
83
|
+
/** @Beta */
|
|
84
|
+
declare function Form<FormType extends Record<string, unknown>, DefaultValues extends FormType>({ children, onSubmit, defaultValues, translationPath, readOnly, submitButtonTestId, }: Props$1<FormType, DefaultValues>): JSX.Element;
|
|
85
|
+
declare const _default: typeof Form & {
|
|
86
|
+
Row: React.ForwardRefExoticComponent<Pick<React.HTMLProps<HTMLDivElement>, "children" | "cite" | "data" | "form" | "label" | "slot" | "span" | "style" | "summary" | "title" | "pattern" | "default" | "type" | "className" | "key" | "dateTime" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "list" | "as" | "name" | "alt" | "src" | "href" | "disabled" | "action" | "download" | "hrefLang" | "media" | "rel" | "target" | "value" | "size" | "open" | "step" | "height" | "max" | "method" | "min" | "width" | "crossOrigin" | "classID" | "useMap" | "wmode" | "coords" | "shape" | "autoPlay" | "controls" | "loop" | "mediaGroup" | "muted" | "playsInline" | "preload" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "acceptCharset" | "autoComplete" | "encType" | "noValidate" | "manifest" | "allowFullScreen" | "allowTransparency" | "frameBorder" | "marginHeight" | "marginWidth" | "sandbox" | "scrolling" | "seamless" | "srcDoc" | "sizes" | "srcSet" | "async" | "accept" | "capture" | "checked" | "maxLength" | "minLength" | "multiple" | "readOnly" | "required" | "challenge" | "keyType" | "keyParams" | "htmlFor" | "integrity" | "charSet" | "content" | "httpEquiv" | "high" | "low" | "optimum" | "reversed" | "start" | "selected" | "defer" | "nonce" | "scoped" | "cellPadding" | "cellSpacing" | "colSpan" | "headers" | "rowSpan" | "scope" | "cols" | "rows" | "wrap" | "kind" | "srcLang" | "poster"> & React.RefAttributes<HTMLDivElement>>;
|
|
87
|
+
Input: typeof ControlledInputField$1;
|
|
88
|
+
Checkbox: typeof ControlledInputField;
|
|
89
|
+
SecretConfirmation: typeof ControlledSecretConfirmationField;
|
|
90
|
+
Select: typeof ControlledSelectField;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
declare type Props<T extends HalRepresentation> = Pick<ComponentProps<typeof _default<T, T>>, "translationPath" | "children"> & {
|
|
94
|
+
link: string;
|
|
95
|
+
};
|
|
96
|
+
/** @Beta */
|
|
97
|
+
declare function ConfigurationForm<T extends HalRepresentation>({ link, translationPath, children }: Props<T>): JSX.Element;
|
|
98
|
+
|
|
99
|
+
declare type QueryKeyPair = [singular: string, plural: string];
|
|
100
|
+
declare type LinkOrHalLink = string | [entity: HalRepresentation, link: string] | HalRepresentation;
|
|
101
|
+
declare type MutationResult<I, O = unknown> = {
|
|
102
|
+
submit: (resource: I) => Promise<O>;
|
|
103
|
+
isLoading: boolean;
|
|
104
|
+
error: Error | null;
|
|
105
|
+
submissionResult?: O;
|
|
106
|
+
};
|
|
107
|
+
declare type MutatingResourceOptions = {
|
|
108
|
+
contentType?: string;
|
|
109
|
+
};
|
|
110
|
+
declare type CreateResourceOptions = MutatingResourceOptions;
|
|
111
|
+
/** @Beta */
|
|
112
|
+
declare const useCreateResource: <I, O>(link: string, [entityKey, collectionName]: QueryKeyPair, idFactory: (createdResource: O) => string, { contentType }?: CreateResourceOptions) => MutationResult<I, O>;
|
|
113
|
+
declare type UpdateResourceOptions = MutatingResourceOptions & {
|
|
114
|
+
collectionName?: QueryKeyPair;
|
|
115
|
+
};
|
|
116
|
+
/** @Beta */
|
|
117
|
+
declare const useUpdateResource: <T>(link: LinkOrHalLink, idFactory: (createdResource: T) => string, { contentType, collectionName: [entityQueryKey, collectionName], }?: UpdateResourceOptions) => MutationResult<T, unknown>;
|
|
118
|
+
declare type DeleteResourceOptions = {
|
|
119
|
+
collectionName?: QueryKeyPair;
|
|
120
|
+
};
|
|
121
|
+
/** @Beta */
|
|
122
|
+
declare const useDeleteResource: <T extends HalRepresentation>(idFactory: (createdResource: T) => string, { collectionName: [entityQueryKey, collectionName] }?: DeleteResourceOptions) => MutationResult<T, unknown>;
|
|
123
|
+
|
|
124
|
+
export { ConfigurationForm, _default as Form, useCreateResource, useDeleteResource, useUpdateResource };
|