@uxf/form 11.74.0 → 11.74.2
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/_code-generator/form-code-generator.d.ts +16 -0
- package/_code-generator/form-code-generator.js +69 -0
- package/avatar-file-input/avatar-file-input.d.ts +14 -0
- package/avatar-file-input/avatar-file-input.js +42 -0
- package/avatar-file-input/avatar-file-input.stories.d.ts +8 -0
- package/avatar-file-input/avatar-file-input.stories.js +23 -0
- package/avatar-file-input/index.d.ts +1 -0
- package/avatar-file-input/index.js +17 -0
- package/avatar-file-input/translations.d.ts +13 -0
- package/avatar-file-input/translations.js +14 -0
- package/bin/form-code-generator.d.ts +2 -0
- package/bin/form-code-generator.js +55 -0
- package/checkbox-button/checkbox-button.d.ts +14 -0
- package/checkbox-button/checkbox-button.js +42 -0
- package/checkbox-button/checkbox-button.stories.d.ts +8 -0
- package/checkbox-button/checkbox-button.stories.js +24 -0
- package/checkbox-button/index.d.ts +1 -0
- package/checkbox-button/index.js +17 -0
- package/checkbox-button/translations.d.ts +13 -0
- package/checkbox-button/translations.js +14 -0
- package/checkbox-input/checkbox-input.d.ts +14 -0
- package/checkbox-input/checkbox-input.js +42 -0
- package/checkbox-input/checkbox-input.stories.d.ts +8 -0
- package/checkbox-input/checkbox-input.stories.js +24 -0
- package/checkbox-input/index.d.ts +1 -0
- package/checkbox-input/index.js +17 -0
- package/checkbox-input/translations.d.ts +13 -0
- package/checkbox-input/translations.js +14 -0
- package/checkbox-list/checkbox-list.d.ts +19 -0
- package/checkbox-list/checkbox-list.js +40 -0
- package/checkbox-list/checkbox-list.stories.d.ts +2 -0
- package/checkbox-list/checkbox-list.stories.js +22 -0
- package/checkbox-list/index.d.ts +1 -0
- package/checkbox-list/index.js +17 -0
- package/checkbox-list/translations.d.ts +13 -0
- package/checkbox-list/translations.js +14 -0
- package/color-radio-group/color-radio-group.d.ts +13 -0
- package/color-radio-group/color-radio-group.js +42 -0
- package/color-radio-group/color-radio-group.stories.d.ts +8 -0
- package/color-radio-group/color-radio-group.stories.js +62 -0
- package/color-radio-group/index.d.ts +1 -0
- package/color-radio-group/index.js +17 -0
- package/color-radio-group/translations.d.ts +13 -0
- package/color-radio-group/translations.js +14 -0
- package/combobox/combobox.d.ts +13 -0
- package/combobox/combobox.js +48 -0
- package/combobox/combobox.stories.d.ts +8 -0
- package/combobox/combobox.stories.js +30 -0
- package/combobox/index.d.ts +1 -0
- package/combobox/index.js +17 -0
- package/combobox/translations.d.ts +13 -0
- package/combobox/translations.js +14 -0
- package/components.d.ts +127 -0
- package/components.js +154 -0
- package/date-picker-input/date-picker-input.d.ts +15 -0
- package/date-picker-input/date-picker-input.js +102 -0
- package/date-picker-input/date-picker-input.stories.d.ts +8 -0
- package/date-picker-input/date-picker-input.stories.js +31 -0
- package/date-picker-input/index.d.ts +1 -0
- package/date-picker-input/index.js +17 -0
- package/date-picker-input/translations.d.ts +31 -0
- package/date-picker-input/translations.js +32 -0
- package/date-range-picker-input/date-range-picker-input.d.ts +12 -0
- package/date-range-picker-input/date-range-picker-input.js +115 -0
- package/date-range-picker-input/date-range-picker-input.stories.d.ts +8 -0
- package/date-range-picker-input/date-range-picker-input.stories.js +25 -0
- package/date-range-picker-input/index.d.ts +1 -0
- package/date-range-picker-input/index.js +17 -0
- package/date-range-picker-input/translations.d.ts +25 -0
- package/date-range-picker-input/translations.js +26 -0
- package/datetime-picker-input/datetime-picker-input.d.ts +15 -0
- package/datetime-picker-input/datetime-picker-input.js +103 -0
- package/datetime-picker-input/datetime-picker-input.stories.d.ts +2 -0
- package/datetime-picker-input/datetime-picker-input.stories.js +28 -0
- package/datetime-picker-input/index.d.ts +1 -0
- package/datetime-picker-input/index.js +17 -0
- package/datetime-picker-input/translations.d.ts +31 -0
- package/datetime-picker-input/translations.js +32 -0
- package/dropzone/dropzone-input.d.ts +13 -0
- package/dropzone/dropzone-input.js +67 -0
- package/dropzone/dropzone-list.d.ts +11 -0
- package/dropzone/dropzone-list.js +23 -0
- package/dropzone/dropzone.stories.d.ts +2 -0
- package/dropzone/dropzone.stories.js +50 -0
- package/dropzone/index.d.ts +9 -0
- package/dropzone/index.js +6 -0
- package/dropzone/translations.d.ts +31 -0
- package/dropzone/translations.js +32 -0
- package/file-input/file-input.d.ts +14 -0
- package/file-input/file-input.js +42 -0
- package/file-input/file-input.stories.d.ts +8 -0
- package/file-input/file-input.stories.js +31 -0
- package/file-input/index.d.ts +1 -0
- package/file-input/index.js +17 -0
- package/file-input/translations.d.ts +13 -0
- package/file-input/translations.js +14 -0
- package/form/form.d.ts +19 -0
- package/form/form.js +25 -0
- package/form/form.stories.d.ts +8 -0
- package/form/form.stories.js +24 -0
- package/form/index.d.ts +1 -0
- package/form/index.js +17 -0
- package/form-id-context/form-context.d.ts +7 -0
- package/form-id-context/form-context.js +12 -0
- package/form-id-context/form-id-context.d.ts +2 -0
- package/form-id-context/form-id-context.js +7 -0
- package/form-id-context/index.d.ts +1 -0
- package/form-id-context/index.js +17 -0
- package/form-renderer/big-test-schema.d.ts +33 -0
- package/form-renderer/big-test-schema.js +295 -0
- package/form-renderer/field/base-field.d.ts +4 -0
- package/form-renderer/field/base-field.js +72 -0
- package/form-renderer/field/embedded.d.ts +4 -0
- package/form-renderer/field/embedded.js +19 -0
- package/form-renderer/field/one-to-many.d.ts +4 -0
- package/form-renderer/field/one-to-many.js +52 -0
- package/form-renderer/form-renderer.d.ts +16 -0
- package/form-renderer/form-renderer.js +28 -0
- package/form-renderer/form-renderer.stories.d.ts +2 -0
- package/form-renderer/form-renderer.stories.js +23 -0
- package/form-renderer/index.d.ts +2 -0
- package/form-renderer/index.js +18 -0
- package/form-renderer/mapper.d.ts +2 -0
- package/form-renderer/mapper.js +30 -0
- package/form-renderer/translations.d.ts +33 -0
- package/form-renderer/translations.js +34 -0
- package/form-renderer/types.d.ts +39 -0
- package/form-renderer/types.js +2 -0
- package/gps-input/gps-input.d.ts +20 -0
- package/gps-input/gps-input.js +156 -0
- package/gps-input/gps-input.stories.d.ts +8 -0
- package/gps-input/gps-input.stories.js +22 -0
- package/gps-input/index.d.ts +1 -0
- package/gps-input/index.js +17 -0
- package/gps-input/translations.d.ts +31 -0
- package/gps-input/translations.js +32 -0
- package/money-input/index.d.ts +1 -0
- package/money-input/index.js +17 -0
- package/money-input/money-input.d.ts +24 -0
- package/money-input/money-input.js +112 -0
- package/money-input/money-input.stories.d.ts +2 -0
- package/money-input/money-input.stories.js +15 -0
- package/money-input/translations.d.ts +13 -0
- package/money-input/translations.js +14 -0
- package/multi-combobox/index.d.ts +1 -0
- package/multi-combobox/index.js +17 -0
- package/multi-combobox/multi-combobox.d.ts +13 -0
- package/multi-combobox/multi-combobox.js +48 -0
- package/multi-combobox/multi-combobox.stories.d.ts +8 -0
- package/multi-combobox/multi-combobox.stories.js +54 -0
- package/multi-combobox/translations.d.ts +13 -0
- package/multi-combobox/translations.js +14 -0
- package/multi-select/index.d.ts +1 -0
- package/multi-select/index.js +17 -0
- package/multi-select/multi-select.d.ts +13 -0
- package/multi-select/multi-select.js +43 -0
- package/multi-select/multi-select.stories.d.ts +8 -0
- package/multi-select/multi-select.stories.js +47 -0
- package/multi-select/translations.d.ts +13 -0
- package/multi-select/translations.js +14 -0
- package/number-input/index.d.ts +1 -0
- package/number-input/index.js +17 -0
- package/number-input/number-input.d.ts +17 -0
- package/number-input/number-input.js +87 -0
- package/number-input/number-input.stories.d.ts +8 -0
- package/number-input/number-input.stories.js +24 -0
- package/number-input/translations.d.ts +25 -0
- package/number-input/translations.js +26 -0
- package/package.json +3 -3
- package/password-input/index.d.ts +1 -0
- package/password-input/index.js +17 -0
- package/password-input/password-input.d.ts +15 -0
- package/password-input/password-input.js +108 -0
- package/password-input/password-input.stories.d.ts +8 -0
- package/password-input/password-input.stories.js +23 -0
- package/password-input/translations.d.ts +19 -0
- package/password-input/translations.js +20 -0
- package/radio-group/index.d.ts +1 -0
- package/radio-group/index.js +17 -0
- package/radio-group/radio-group.d.ts +13 -0
- package/radio-group/radio-group.js +42 -0
- package/radio-group/radio-group.stories.d.ts +8 -0
- package/radio-group/radio-group.stories.js +38 -0
- package/radio-group/translations.d.ts +13 -0
- package/radio-group/translations.js +14 -0
- package/readmes.d.ts +28 -0
- package/readmes.js +59 -0
- package/select/index.d.ts +1 -0
- package/select/index.js +17 -0
- package/select/select.d.ts +13 -0
- package/select/select.js +41 -0
- package/select/select.stories.d.ts +8 -0
- package/select/select.stories.js +44 -0
- package/select/translations.d.ts +13 -0
- package/select/translations.js +14 -0
- package/storybook/form-data-printer.d.ts +6 -0
- package/storybook/form-data-printer.js +12 -0
- package/storybook/storybook-form.d.ts +8 -0
- package/storybook/storybook-form.js +42 -0
- package/text-input/index.d.ts +1 -0
- package/text-input/index.js +17 -0
- package/text-input/text-input.d.ts +33 -0
- package/text-input/text-input.js +75 -0
- package/text-input/text-input.stories.d.ts +8 -0
- package/text-input/text-input.stories.js +26 -0
- package/text-input/translations.d.ts +31 -0
- package/text-input/translations.js +32 -0
- package/textarea/index.d.ts +1 -0
- package/textarea/index.js +17 -0
- package/textarea/textarea.d.ts +13 -0
- package/textarea/textarea.js +62 -0
- package/textarea/textarea.stories.d.ts +8 -0
- package/textarea/textarea.stories.js +22 -0
- package/textarea/translations.d.ts +13 -0
- package/textarea/translations.js +14 -0
- package/time-picker-input/index.d.ts +1 -0
- package/time-picker-input/index.js +17 -0
- package/time-picker-input/time-picker-input.d.ts +14 -0
- package/time-picker-input/time-picker-input.js +84 -0
- package/time-picker-input/time-picker-input.stories.d.ts +8 -0
- package/time-picker-input/time-picker-input.stories.js +25 -0
- package/time-picker-input/translations.d.ts +19 -0
- package/time-picker-input/translations.js +20 -0
- package/toggle/index.d.ts +1 -0
- package/toggle/index.js +17 -0
- package/toggle/toggle.d.ts +14 -0
- package/toggle/toggle.js +40 -0
- package/toggle/toggle.stories.d.ts +8 -0
- package/toggle/toggle.stories.js +23 -0
- package/toggle/translations.d.ts +13 -0
- package/toggle/translations.js +14 -0
- package/translations/cs.json +148 -0
- package/translations/de.json +148 -0
- package/translations/en.json +148 -0
- package/translations/sk.json +148 -0
- package/types.d.ts +4 -0
- package/types.js +2 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Default = Default;
|
|
7
|
+
const button_1 = require("@uxf/ui/button");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const storybook_form_1 = require("../storybook/storybook-form");
|
|
10
|
+
const checkbox_list_1 = require("./checkbox-list");
|
|
11
|
+
const CHECKBOX_LIST_OPTIONS = [
|
|
12
|
+
{ id: "1", label: "Option1" },
|
|
13
|
+
{ id: "2", label: "Option2" },
|
|
14
|
+
{ id: "3", label: "Option3" },
|
|
15
|
+
];
|
|
16
|
+
function Default() {
|
|
17
|
+
return (react_1.default.createElement(storybook_form_1.StorybookForm, null, ({ control }) => (react_1.default.createElement("div", { className: "space-y-2 p-20" },
|
|
18
|
+
react_1.default.createElement(checkbox_list_1.CheckboxList, { control: control, label: "CheckboxList default", name: "checkboxList1", options: CHECKBOX_LIST_OPTIONS }),
|
|
19
|
+
react_1.default.createElement(checkbox_list_1.CheckboxList, { control: control, isRequired: true, label: "CheckboxList required", name: "checkboxList2", options: CHECKBOX_LIST_OPTIONS }),
|
|
20
|
+
react_1.default.createElement(checkbox_list_1.CheckboxList, { control: control, hiddenLabel: true, label: "CheckboxList with hidden label", name: "checkboxList3", options: CHECKBOX_LIST_OPTIONS }),
|
|
21
|
+
react_1.default.createElement(button_1.Button, { type: "submit" }, "Submit")))));
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./checkbox-list";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./checkbox-list"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
"uxf-form-checkbox-list": {
|
|
5
|
+
validation: {
|
|
6
|
+
required: {
|
|
7
|
+
cs: "Toto pole je povinné",
|
|
8
|
+
en: "This field is required",
|
|
9
|
+
sk: "Toto pole je povinné",
|
|
10
|
+
de: "Dieses Feld ist erforderlich",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ColorRadioGroupProps as UIColorRadioGroupProps } from "@uxf/ui/color-radio-group";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FieldValues } from "react-hook-form";
|
|
4
|
+
import { ControlProps } from "../types";
|
|
5
|
+
export type ColorRadioGroupProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIColorRadioGroupProps, "isFocused" | "isInvalid" | "name" | "onChange" | "value"> & {
|
|
6
|
+
onChange?: UIColorRadioGroupProps["onChange"];
|
|
7
|
+
requiredMessage?: string;
|
|
8
|
+
};
|
|
9
|
+
export type ColorRadioGroupValue = `#${string}` | null;
|
|
10
|
+
export declare function ColorRadioGroup<FormData extends Record<string, any>>(props: ColorRadioGroupProps<FormData>): React.JSX.Element;
|
|
11
|
+
export declare namespace ColorRadioGroup {
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.ColorRadioGroup = ColorRadioGroup;
|
|
8
|
+
const translations_1 = require("@uxf/core-react/translations");
|
|
9
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
10
|
+
const color_radio_group_1 = require("@uxf/ui/color-radio-group");
|
|
11
|
+
const react_1 = __importDefault(require("react"));
|
|
12
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
13
|
+
const form_context_1 = require("../form-id-context/form-context");
|
|
14
|
+
function ColorRadioGroup(props) {
|
|
15
|
+
var _a, _b, _c, _d;
|
|
16
|
+
const formContext = (0, form_context_1.useFormContext)();
|
|
17
|
+
const t = (0, translations_1.useUxfTranslation)();
|
|
18
|
+
const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formContext.formId}__${props.name}`;
|
|
19
|
+
const { field, fieldState } = (0, react_hook_form_1.useController)({
|
|
20
|
+
control: props.control,
|
|
21
|
+
name: props.name,
|
|
22
|
+
rules: {
|
|
23
|
+
required: props.isRequired
|
|
24
|
+
? props.requiredMessage || t("uxf-form-color-radio-group:validation.required")
|
|
25
|
+
: undefined,
|
|
26
|
+
...props.rules,
|
|
27
|
+
},
|
|
28
|
+
shouldUnregister: props.shouldUnregister,
|
|
29
|
+
});
|
|
30
|
+
const onBlur = (event) => {
|
|
31
|
+
var _a;
|
|
32
|
+
field.onBlur();
|
|
33
|
+
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
34
|
+
};
|
|
35
|
+
const onChange = (value, event) => {
|
|
36
|
+
var _a;
|
|
37
|
+
field.onChange(value);
|
|
38
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, value, event);
|
|
39
|
+
};
|
|
40
|
+
return (react_1.default.createElement(color_radio_group_1.ColorRadioGroup, { className: props.className, helperText: (_c = (_b = fieldState.error) === null || _b === void 0 ? void 0 : _b.message) !== null && _c !== void 0 ? _c : props.helperText, hiddenLabel: props.hiddenLabel, id: id, isDisabled: props.options.length === 0 || formContext.isFormDisabled || props.isDisabled, isInvalid: (0, is_not_nil_1.isNotNil)(fieldState.error), isReadOnly: formContext.isFormReadOnly || props.isReadOnly, isRequired: props.isRequired, label: props.label, name: field.name, onBlur: onBlur, onChange: onChange, onFocus: props.onFocus, options: props.options, ref: field.ref, style: props.style, value: (_d = field.value) !== null && _d !== void 0 ? _d : null }));
|
|
41
|
+
}
|
|
42
|
+
ColorRadioGroup.displayName = "UxfFormColorRadioGroup";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Default = Default;
|
|
7
|
+
const button_1 = require("@uxf/ui/button");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const storybook_form_1 = require("../storybook/storybook-form");
|
|
10
|
+
const index_1 = require("./index");
|
|
11
|
+
exports.default = {
|
|
12
|
+
title: "Form/ColorRadioGroup",
|
|
13
|
+
component: index_1.ColorRadioGroup,
|
|
14
|
+
};
|
|
15
|
+
const options = [
|
|
16
|
+
{
|
|
17
|
+
value: "#ff0000",
|
|
18
|
+
label: "Red",
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
value: "#00ff00",
|
|
22
|
+
label: "Green",
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
value: "#ff00ff",
|
|
26
|
+
label: "Purple",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
value: "#000000",
|
|
30
|
+
label: "Red",
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
value: "#ffff00",
|
|
34
|
+
label: "Green",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
value: "#00ffff",
|
|
38
|
+
label: "Purple",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
value: "#cccccc",
|
|
42
|
+
label: "Red",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
value: "#3b1298",
|
|
46
|
+
label: "Green",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
value: "#0000ff",
|
|
50
|
+
label: "Purple",
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
function Default() {
|
|
54
|
+
const storyFormColorRadioGroup = (control) => (react_1.default.createElement("div", { className: "space-y-4" },
|
|
55
|
+
react_1.default.createElement(index_1.ColorRadioGroup, { control: control, id: "color-radio-group", label: "Color radio group form", name: "color-radio-group", options: options }),
|
|
56
|
+
react_1.default.createElement(index_1.ColorRadioGroup, { control: control, id: "color-radio-group", isDisabled: true, label: "Color radio group form disabled", name: "color-radio-group-disabled", options: options }),
|
|
57
|
+
react_1.default.createElement(index_1.ColorRadioGroup, { control: control, helperText: "Choose one option", id: "color-radio-group", label: "Color radio group form with helper text", name: "color-radio-group-helper-text", options: options }),
|
|
58
|
+
react_1.default.createElement(index_1.ColorRadioGroup, { control: control, id: "color-radio-group", label: "Color radio group form with variant button", name: "color-radio-group-button", options: options }),
|
|
59
|
+
react_1.default.createElement(button_1.Button, { type: "submit" }, "Submit")));
|
|
60
|
+
return (react_1.default.createElement(storybook_form_1.StorybookForm, null, ({ control }) => (react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
|
|
61
|
+
react_1.default.createElement("div", { className: "space-y-2 p-20 lg:w-1/2" }, storyFormColorRadioGroup(control))))));
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./color-radio-group";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./color-radio-group"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
"uxf-form-color-radio-group": {
|
|
5
|
+
validation: {
|
|
6
|
+
required: {
|
|
7
|
+
cs: "Toto pole je povinné",
|
|
8
|
+
en: "This field is required",
|
|
9
|
+
sk: "Toto pole je povinné",
|
|
10
|
+
de: "Dieses Feld ist erforderlich",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComboboxValueId, ComboboxProps as UIComboboxProps, ComboboxValue as UIComboboxValue } from "@uxf/ui/combobox";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FieldValues } from "react-hook-form";
|
|
4
|
+
import { ControlProps } from "../types";
|
|
5
|
+
export type ComboProps<FormData extends FieldValues> = ControlProps<FormData> & Omit<UIComboboxProps, "inputGroupRef" | "inputRef" | "inputWrapperRef" | "isFocused" | "isInvalid" | "name" | "onChange" | "value"> & {
|
|
6
|
+
onChange?: UIComboboxProps["onChange"];
|
|
7
|
+
requiredMessage?: string;
|
|
8
|
+
};
|
|
9
|
+
export type ComboboxValue<Id extends ComboboxValueId> = UIComboboxValue<Id> | null;
|
|
10
|
+
export declare function Combobox<FormData extends Record<string, any>>(props: ComboProps<FormData>): React.JSX.Element;
|
|
11
|
+
export declare namespace Combobox {
|
|
12
|
+
var displayName: string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Combobox = Combobox;
|
|
8
|
+
const translations_1 = require("@uxf/core-react/translations");
|
|
9
|
+
const empty_array_1 = require("@uxf/core/constants/empty-array");
|
|
10
|
+
const is_empty_1 = require("@uxf/core/utils/is-empty");
|
|
11
|
+
const is_nil_1 = require("@uxf/core/utils/is-nil");
|
|
12
|
+
const is_not_nil_1 = require("@uxf/core/utils/is-not-nil");
|
|
13
|
+
const combobox_1 = require("@uxf/ui/combobox");
|
|
14
|
+
const react_1 = __importDefault(require("react"));
|
|
15
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
16
|
+
const form_context_1 = require("../form-id-context/form-context");
|
|
17
|
+
function Combobox(props) {
|
|
18
|
+
var _a, _b, _c, _d, _e;
|
|
19
|
+
const formContext = (0, form_context_1.useFormContext)();
|
|
20
|
+
const t = (0, translations_1.useUxfTranslation)();
|
|
21
|
+
const id = (_a = props.id) !== null && _a !== void 0 ? _a : `${formContext.formId}__${props.name}`;
|
|
22
|
+
const { field, fieldState } = (0, react_hook_form_1.useController)({
|
|
23
|
+
control: props.control,
|
|
24
|
+
name: props.name,
|
|
25
|
+
rules: {
|
|
26
|
+
required: props.isRequired
|
|
27
|
+
? props.requiredMessage || t("uxf-form-combobox:validation.required")
|
|
28
|
+
: undefined,
|
|
29
|
+
...props.rules,
|
|
30
|
+
},
|
|
31
|
+
shouldUnregister: props.shouldUnregister,
|
|
32
|
+
});
|
|
33
|
+
const onBlur = (event) => {
|
|
34
|
+
var _a;
|
|
35
|
+
field.onBlur();
|
|
36
|
+
(_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, event);
|
|
37
|
+
};
|
|
38
|
+
const onChange = (value, event) => {
|
|
39
|
+
var _a;
|
|
40
|
+
field.onChange(value);
|
|
41
|
+
(_a = props.onChange) === null || _a === void 0 ? void 0 : _a.call(props, value, event);
|
|
42
|
+
};
|
|
43
|
+
const isDisabled = ((0, is_nil_1.isNil)(props.loadOptions) && (0, is_empty_1.isEmpty)((_b = props.options) !== null && _b !== void 0 ? _b : empty_array_1.EMPTY_ARRAY)) ||
|
|
44
|
+
formContext.isFormDisabled ||
|
|
45
|
+
props.isDisabled;
|
|
46
|
+
return (react_1.default.createElement(combobox_1.Combobox, { className: props.className, dropdownClassName: props.dropdownClassName, dropdownMatchesInputWidth: props.dropdownMatchesInputWidth, dropdownMaxHeight: props.dropdownMaxHeight, dropdownPlacement: props.dropdownPlacement, dropdownStrategy: props.dropdownStrategy, form: props.form, helperText: (_d = (_c = fieldState.error) === null || _c === void 0 ? void 0 : _c.message) !== null && _d !== void 0 ? _d : props.helperText, hiddenLabel: props.hiddenLabel, iconName: props.iconName, id: id, inputArrow: props.inputArrow, inputRef: field.ref, isClearable: props.isClearable, isDisabled: isDisabled, isInvalid: (0, is_not_nil_1.isNotNil)(fieldState.error), isReadOnly: formContext.isFormReadOnly || props.isReadOnly, isRequired: props.isRequired, keyExtractor: props.keyExtractor, label: props.label, leftAddon: props.leftAddon, leftElement: props.leftElement, loadOptions: props.loadOptions, name: field.name, noOptionsMessage: props.noOptionsMessage, noQueryMessage: props.noQueryMessage, notFoundMessage: props.notFoundMessage, onBlur: onBlur, onChange: onChange, onFocus: props.onFocus, options: props.options, placeholder: props.placeholder, renderOption: props.renderOption, rightAddon: props.rightAddon, rightElement: props.rightElement, size: props.size, style: props.style, value: (_e = field.value) !== null && _e !== void 0 ? _e : null, variant: props.variant }));
|
|
47
|
+
}
|
|
48
|
+
Combobox.displayName = "UxfFormCombobox";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Default = Default;
|
|
7
|
+
const button_1 = require("@uxf/ui/button");
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const storybook_form_1 = require("../storybook/storybook-form");
|
|
10
|
+
const combobox_1 = require("./combobox");
|
|
11
|
+
exports.default = {
|
|
12
|
+
title: "Form/Combobox",
|
|
13
|
+
component: combobox_1.Combobox,
|
|
14
|
+
};
|
|
15
|
+
const options = [
|
|
16
|
+
{ id: "one", label: "Option one" },
|
|
17
|
+
{ id: "two", label: "Option two" },
|
|
18
|
+
{ id: "three", label: "Option three" },
|
|
19
|
+
];
|
|
20
|
+
function Default() {
|
|
21
|
+
const storyFormComboboxes = (control) => (react_1.default.createElement("div", { className: "space-y-8" },
|
|
22
|
+
react_1.default.createElement(combobox_1.Combobox, { control: control, helperText: "Za\u010Dn\u011Bte ps\u00E1t pro vyhled\u00E1v\u00E1n\u00ED...", id: "form-combobox", label: "Combobox form", name: "firstname", options: options, placeholder: "Placeholder" }),
|
|
23
|
+
react_1.default.createElement(combobox_1.Combobox, { control: control, helperText: "Za\u010Dn\u011Bte ps\u00E1t pro vyhled\u00E1v\u00E1n\u00ED...", id: "form-combobox", isRequired: true, label: "Combobox form required", name: "combobox-required", options: options, placeholder: "Placeholder" }),
|
|
24
|
+
react_1.default.createElement(combobox_1.Combobox, { control: control, id: "form-combobox", isDisabled: true, label: "Combobox form disabled", name: "combobox-disabled", options: options, placeholder: "Placeholder" }),
|
|
25
|
+
react_1.default.createElement(combobox_1.Combobox, { control: control, dropdownPlacement: "top", id: "form-combobox", label: "Combobox form with dropdown top", name: "select-dropdown-top", options: options, placeholder: "Placeholder" }),
|
|
26
|
+
react_1.default.createElement(combobox_1.Combobox, { control: control, dropdownPlacement: "top", id: "form-combobox", isClearable: true, label: "Combobox async", loadOptions: (query) => Promise.resolve(options.filter((option) => !query || option.label.toLowerCase().includes(query.toLowerCase()))), name: "select-dropdown-async", placeholder: "Placeholder" }),
|
|
27
|
+
react_1.default.createElement(button_1.Button, { type: "submit" }, "Submit")));
|
|
28
|
+
return (react_1.default.createElement(storybook_form_1.StorybookForm, { defaultValues: { "select-dropdown-async": { id: "one", label: "Option one" } } }, ({ control }) => (react_1.default.createElement("div", { className: "flex flex-col lg:flex-row" },
|
|
29
|
+
react_1.default.createElement("div", { className: "space-y-2 p-20 lg:w-1/2" }, storyFormComboboxes(control))))));
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./combobox";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./combobox"), exports);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = {
|
|
4
|
+
"uxf-form-combobox": {
|
|
5
|
+
validation: {
|
|
6
|
+
required: {
|
|
7
|
+
cs: "Toto pole je povinné",
|
|
8
|
+
en: "This field is required",
|
|
9
|
+
sk: "Toto pole je povinné",
|
|
10
|
+
de: "Dieses Feld ist erforderlich",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
};
|
package/components.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import * as avatarFileInputStories from "./avatar-file-input/avatar-file-input.stories";
|
|
2
|
+
import * as checkboxButtonStories from "./checkbox-button/checkbox-button.stories";
|
|
3
|
+
import * as checkboxInputStories from "./checkbox-input/checkbox-input.stories";
|
|
4
|
+
import * as checkboxListStories from "./checkbox-list/checkbox-list.stories";
|
|
5
|
+
import * as colorRadioGroupStories from "./color-radio-group/color-radio-group.stories";
|
|
6
|
+
import * as comboboxStories from "./combobox/combobox.stories";
|
|
7
|
+
import * as datePickerInputStories from "./date-picker-input/date-picker-input.stories";
|
|
8
|
+
import * as dateRangePickerInputStories from "./date-range-picker-input/date-range-picker-input.stories";
|
|
9
|
+
import * as datetimePickerInputStories from "./datetime-picker-input/datetime-picker-input.stories";
|
|
10
|
+
import * as dropzoneStories from "./dropzone/dropzone.stories";
|
|
11
|
+
import * as fileInputStories from "./file-input/file-input.stories";
|
|
12
|
+
import * as formStories from "./form/form.stories";
|
|
13
|
+
import * as formRendererStories from "./form-renderer/form-renderer.stories";
|
|
14
|
+
import * as gpsInputStories from "./gps-input/gps-input.stories";
|
|
15
|
+
import * as moneyInputStories from "./money-input/money-input.stories";
|
|
16
|
+
import * as multiComboboxStories from "./multi-combobox/multi-combobox.stories";
|
|
17
|
+
import * as multiSelectStories from "./multi-select/multi-select.stories";
|
|
18
|
+
import * as numberInputStories from "./number-input/number-input.stories";
|
|
19
|
+
import * as passwordInputStories from "./password-input/password-input.stories";
|
|
20
|
+
import * as radioGroupStories from "./radio-group/radio-group.stories";
|
|
21
|
+
import * as selectStories from "./select/select.stories";
|
|
22
|
+
import * as textInputStories from "./text-input/text-input.stories";
|
|
23
|
+
import * as textareaStories from "./textarea/textarea.stories";
|
|
24
|
+
import * as timePickerInputStories from "./time-picker-input/time-picker-input.stories";
|
|
25
|
+
import * as toggleStories from "./toggle/toggle.stories";
|
|
26
|
+
export declare const components: {
|
|
27
|
+
readonly "avatar-file-input": {
|
|
28
|
+
readonly title: "AvatarFileInput";
|
|
29
|
+
readonly stories: typeof avatarFileInputStories;
|
|
30
|
+
};
|
|
31
|
+
readonly "checkbox-button": {
|
|
32
|
+
readonly title: "CheckboxButton";
|
|
33
|
+
readonly stories: typeof checkboxButtonStories;
|
|
34
|
+
};
|
|
35
|
+
readonly "checkbox-input": {
|
|
36
|
+
readonly title: "CheckboxInput";
|
|
37
|
+
readonly stories: typeof checkboxInputStories;
|
|
38
|
+
};
|
|
39
|
+
readonly "checkbox-list": {
|
|
40
|
+
readonly title: "CheckboxList";
|
|
41
|
+
readonly stories: typeof checkboxListStories;
|
|
42
|
+
};
|
|
43
|
+
readonly "color-radio-group": {
|
|
44
|
+
readonly title: "ColorRadioGroup";
|
|
45
|
+
readonly stories: typeof colorRadioGroupStories;
|
|
46
|
+
};
|
|
47
|
+
readonly combobox: {
|
|
48
|
+
readonly title: "Combobox";
|
|
49
|
+
readonly stories: typeof comboboxStories;
|
|
50
|
+
};
|
|
51
|
+
readonly "date-picker-input": {
|
|
52
|
+
readonly title: "DatePickerInput";
|
|
53
|
+
readonly stories: typeof datePickerInputStories;
|
|
54
|
+
};
|
|
55
|
+
readonly "date-range-picker-input": {
|
|
56
|
+
readonly title: "DateRangePickerInput";
|
|
57
|
+
readonly stories: typeof dateRangePickerInputStories;
|
|
58
|
+
};
|
|
59
|
+
readonly "datetime-picker-input": {
|
|
60
|
+
readonly title: "DatetimePickerInput";
|
|
61
|
+
readonly stories: typeof datetimePickerInputStories;
|
|
62
|
+
};
|
|
63
|
+
readonly dropzone: {
|
|
64
|
+
readonly title: "Dropzone";
|
|
65
|
+
readonly stories: typeof dropzoneStories;
|
|
66
|
+
};
|
|
67
|
+
readonly "file-input": {
|
|
68
|
+
readonly title: "FileInput";
|
|
69
|
+
readonly stories: typeof fileInputStories;
|
|
70
|
+
};
|
|
71
|
+
readonly form: {
|
|
72
|
+
readonly title: "Form";
|
|
73
|
+
readonly stories: typeof formStories;
|
|
74
|
+
};
|
|
75
|
+
readonly "form-renderer": {
|
|
76
|
+
readonly title: "FormRenderer";
|
|
77
|
+
readonly stories: typeof formRendererStories;
|
|
78
|
+
};
|
|
79
|
+
readonly "gps-input": {
|
|
80
|
+
readonly title: "GpsInput";
|
|
81
|
+
readonly stories: typeof gpsInputStories;
|
|
82
|
+
};
|
|
83
|
+
readonly "money-input": {
|
|
84
|
+
readonly title: "MoneyInput";
|
|
85
|
+
readonly stories: typeof moneyInputStories;
|
|
86
|
+
};
|
|
87
|
+
readonly "multi-combobox": {
|
|
88
|
+
readonly title: "MultiCombobox";
|
|
89
|
+
readonly stories: typeof multiComboboxStories;
|
|
90
|
+
};
|
|
91
|
+
readonly "multi-select": {
|
|
92
|
+
readonly title: "MultiSelect";
|
|
93
|
+
readonly stories: typeof multiSelectStories;
|
|
94
|
+
};
|
|
95
|
+
readonly "number-input": {
|
|
96
|
+
readonly title: "NumberInput";
|
|
97
|
+
readonly stories: typeof numberInputStories;
|
|
98
|
+
};
|
|
99
|
+
readonly "password-input": {
|
|
100
|
+
readonly title: "PasswordInput";
|
|
101
|
+
readonly stories: typeof passwordInputStories;
|
|
102
|
+
};
|
|
103
|
+
readonly "radio-group": {
|
|
104
|
+
readonly title: "RadioGroup";
|
|
105
|
+
readonly stories: typeof radioGroupStories;
|
|
106
|
+
};
|
|
107
|
+
readonly select: {
|
|
108
|
+
readonly title: "Select";
|
|
109
|
+
readonly stories: typeof selectStories;
|
|
110
|
+
};
|
|
111
|
+
readonly "text-input": {
|
|
112
|
+
readonly title: "TextInput";
|
|
113
|
+
readonly stories: typeof textInputStories;
|
|
114
|
+
};
|
|
115
|
+
readonly textarea: {
|
|
116
|
+
readonly title: "Textarea";
|
|
117
|
+
readonly stories: typeof textareaStories;
|
|
118
|
+
};
|
|
119
|
+
readonly "time-picker-input": {
|
|
120
|
+
readonly title: "TimePickerInput";
|
|
121
|
+
readonly stories: typeof timePickerInputStories;
|
|
122
|
+
};
|
|
123
|
+
readonly toggle: {
|
|
124
|
+
readonly title: "Toggle";
|
|
125
|
+
readonly stories: typeof toggleStories;
|
|
126
|
+
};
|
|
127
|
+
};
|