tycho-components 0.25.1 → 0.25.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/dist/common/AppForm/AppForm.js +1 -1
- package/dist/common/AppForm/AppFormField.d.ts +1 -0
- package/dist/common/AppSwitchGroup/AppSwitchGroup.d.ts +12 -0
- package/dist/common/AppSwitchGroup/AppSwitchGroup.js +8 -0
- package/dist/common/AppSwitchGroup/index.d.ts +2 -0
- package/dist/common/AppSwitchGroup/index.js +2 -0
- package/dist/common/AppSwitchGroup/style.scss +18 -0
- package/dist/common/index.d.ts +1 -0
- package/dist/common/index.js +1 -0
- package/dist/configs/types/Corpus.d.ts +1 -0
- package/package.json +2 -2
|
@@ -49,7 +49,7 @@ export default function AppForm({ fields, form, prefix, onChangeFunctions = {},
|
|
|
49
49
|
return (_jsx(CheckboxField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled }, name));
|
|
50
50
|
}
|
|
51
51
|
if (field.type === 'switch') {
|
|
52
|
-
return (_jsx(SwitchField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled }, name));
|
|
52
|
+
return (_jsx(SwitchField, { attr: name, label: field.name, createdForm: form, disabled: field.disabled, onChange: (value) => handleChange?.(value) }, name));
|
|
53
53
|
}
|
|
54
54
|
if (field.type === 'datepicker') {
|
|
55
55
|
const handleBlur = getOnBlurFn(field.attr);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { UseFormReturn } from 'react-hook-form';
|
|
2
|
+
import { AppFormField } from '../AppForm/AppFormField';
|
|
3
|
+
import './style.scss';
|
|
4
|
+
type Props = {
|
|
5
|
+
fields: AppFormField[];
|
|
6
|
+
form: UseFormReturn<any, any, any>;
|
|
7
|
+
onToggle: (attr: string, value: boolean) => void;
|
|
8
|
+
hasRole?: (role: string) => boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
};
|
|
11
|
+
export default function AppSwitchGroup({ fields, form, onToggle, hasRole, className, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Icon, SwitchField, Tooltip } from 'tycho-storybook';
|
|
3
|
+
import FormUtils from '../../functions/FormUtils';
|
|
4
|
+
import './style.scss';
|
|
5
|
+
export default function AppSwitchGroup({ fields, form, onToggle, hasRole = () => true, className, }) {
|
|
6
|
+
const visibleFields = FormUtils.filterFieldsByUserRole(fields, hasRole).filter((field) => field.type === 'switch');
|
|
7
|
+
return (_jsx("div", { className: `app-switch-group-container ${className || ''}`, children: visibleFields.map((field) => (_jsxs("div", { className: "app-switch-group-row", children: [_jsx(SwitchField, { attr: field.attr, label: field.name, createdForm: form, disabled: field.disabled, onChange: (value) => onToggle(field.attr, value) }), field.tooltip && field.tooltipText && (_jsx(Tooltip, { title: field.tooltipText, children: _jsx("span", { className: "app-switch-group-tooltip", children: _jsx(Icon, { name: "help", size: "x-small" }) }) }))] }, field.attr))) }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.app-switch-group-container {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--spacing-200);
|
|
5
|
+
|
|
6
|
+
.app-switch-group-row {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
align-items: center;
|
|
10
|
+
gap: var(--spacing-100);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.app-switch-group-tooltip {
|
|
14
|
+
display: inline-flex;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
color: var(--icon-secondary);
|
|
17
|
+
}
|
|
18
|
+
}
|
package/dist/common/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export type { FieldOperations, FormField } from './AppEditable/FormField';
|
|
|
12
12
|
export { default as AppForm } from './AppForm/AppForm';
|
|
13
13
|
export { default as AppFormInfo } from './AppForm/AppFormInfo';
|
|
14
14
|
export type { AppFormField } from './AppForm/AppFormField';
|
|
15
|
+
export { default as AppSwitchGroup } from './AppSwitchGroup';
|
|
15
16
|
export { convertEnum, convertList } from './AppEditable/FormFieldOption';
|
|
16
17
|
export type { FormFieldOption } from './AppEditable/FormFieldOption';
|
|
17
18
|
export { default as AppKeyboard } from './AppKeyboard';
|
package/dist/common/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export { default as AppEditable } from './AppEditable';
|
|
|
8
8
|
export { validateFormField } from './AppEditable/FormField';
|
|
9
9
|
export { default as AppForm } from './AppForm/AppForm';
|
|
10
10
|
export { default as AppFormInfo } from './AppForm/AppFormInfo';
|
|
11
|
+
export { default as AppSwitchGroup } from './AppSwitchGroup';
|
|
11
12
|
export { convertEnum, convertList } from './AppEditable/FormFieldOption';
|
|
12
13
|
export { default as AppKeyboard } from './AppKeyboard';
|
|
13
14
|
export { default as AppLoading } from './AppLoading';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tycho-components",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.25.
|
|
4
|
+
"version": "0.25.2",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"exports": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"react-i18next": "^13.0.2",
|
|
83
83
|
"react-router-dom": "^6.14.2",
|
|
84
84
|
"react-toastify": "^9.1.3",
|
|
85
|
-
"tycho-storybook": "0.9.
|
|
85
|
+
"tycho-storybook": "0.9.3",
|
|
86
86
|
"wavesurfer-react": "^2.2.2",
|
|
87
87
|
"wavesurfer.js": "^6.6.3"
|
|
88
88
|
},
|