@micromerce/formbuilder-react 1.0.982 → 1.0.983
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 +69 -0
- package/dist/components/FormBuilder/FormBuilder.d.ts +4 -1
- package/dist/formbuilder.js +73 -73
- package/dist/formbuilder.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/theme/FormBuilderThemeProvider.d.ts +17 -0
- package/dist/theme/index.d.ts +4 -0
- package/dist/theme/tokens.d.ts +72 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "./styles/theme.module.scss";
|
|
1
2
|
import FormBuilder from "./components/FormBuilder/";
|
|
2
3
|
import Select from "./components/controls/Select/";
|
|
3
4
|
import MultiSelect from "./components/controls/MultiSelect/";
|
|
@@ -15,5 +16,8 @@ import TrafficLightCardSelect from "./components/controls/TrafficLightCardSelect
|
|
|
15
16
|
import { useValueGenerator } from "./hooks/useValueGenerator/useValueGenerator";
|
|
16
17
|
import { queryControl } from "./components/QueryControl/data/defaultControls";
|
|
17
18
|
import { FormBuilderConfig } from "./types";
|
|
18
|
-
|
|
19
|
+
import { FormBuilderThemeProvider, FORM_BUILDER_TOKENS, toCssVars } from "./theme";
|
|
20
|
+
import type { FormBuilderTheme, FormBuilderThemeKey, FormBuilderThemePreset } from "./theme";
|
|
21
|
+
export type { FormBuilderTheme, FormBuilderThemeKey, FormBuilderThemePreset };
|
|
22
|
+
export { FormBuilderThemeProvider, FORM_BUILDER_TOKENS, toCssVars, FormBuilder, FormBuilderConfig, queryControl, Select, MultiSelect, Checkbox, ControlWrapper, FormFooter, Input, InputFreeSolo, FormList, FormGroup, MrnInput, PasswordInput, Textarea, TrafficLightCardSelect, useValueGenerator, };
|
|
19
23
|
export default FormBuilder;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React, { HTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import { FormBuilderTheme, FormBuilderThemePreset } from "./tokens";
|
|
3
|
+
export interface FormBuilderThemeProviderProps extends HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** A ready-made token set: "design" is the webclient design system (DESIGN.md). */
|
|
5
|
+
preset?: FormBuilderThemePreset;
|
|
6
|
+
/** Single token values; they win over the preset. */
|
|
7
|
+
theme?: FormBuilderTheme;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Themes every formbuilder component inside it. The tokens are CSS custom properties, so they
|
|
12
|
+
* cascade without a React context: providers can be nested and the inner one wins, and content
|
|
13
|
+
* MUI renders into a portal (tooltips, menus) inherits them only when the provider is an
|
|
14
|
+
* ancestor of the portal target (theme <body> for those, e.g. with toCssVars).
|
|
15
|
+
*/
|
|
16
|
+
declare const FormBuilderThemeProvider: ({ preset, theme, className, style, children, ...rest }: FormBuilderThemeProviderProps) => React.JSX.Element;
|
|
17
|
+
export default FormBuilderThemeProvider;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { default as FormBuilderThemeProvider } from "./FormBuilderThemeProvider";
|
|
2
|
+
export type { FormBuilderThemeProviderProps } from "./FormBuilderThemeProvider";
|
|
3
|
+
export { FORM_BUILDER_TOKENS, PRESET_CLASS_NAMES, toCssVars } from "./tokens";
|
|
4
|
+
export type { FormBuilderTheme, FormBuilderThemeKey, FormBuilderThemePreset } from "./tokens";
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The styling API of the formbuilder as a typed object.
|
|
3
|
+
*
|
|
4
|
+
* Every key maps to one CSS custom property (`--fb-*`, see styles/theme.module.scss). The
|
|
5
|
+
* components read those properties with their former value as fallback, so a key that is not
|
|
6
|
+
* set changes nothing. Values are any CSS value; numbers for lengths are taken as px.
|
|
7
|
+
*/
|
|
8
|
+
export declare const FORM_BUILDER_TOKENS: {
|
|
9
|
+
readonly accent: "--fb-color-accent";
|
|
10
|
+
readonly accentHover: "--fb-color-accent-hover";
|
|
11
|
+
readonly accentDark: "--fb-color-accent-dark";
|
|
12
|
+
readonly accentLight: "--fb-color-accent-light";
|
|
13
|
+
readonly primary: "--fb-color-primary";
|
|
14
|
+
readonly primaryDark: "--fb-color-primary-dark";
|
|
15
|
+
readonly primaryLight: "--fb-color-primary-light";
|
|
16
|
+
readonly primaryHover: "--fb-color-primary-hover";
|
|
17
|
+
readonly textPrimary: "--fb-color-text-primary";
|
|
18
|
+
readonly textSecondary: "--fb-color-text-secondary";
|
|
19
|
+
readonly label: "--fb-color-label";
|
|
20
|
+
readonly value: "--fb-color-value";
|
|
21
|
+
readonly fieldText: "--fb-color-field-text";
|
|
22
|
+
readonly fieldFontWeight: "--fb-field-font-weight";
|
|
23
|
+
readonly placeholder: "--fb-color-text-placeholder";
|
|
24
|
+
readonly helper: "--fb-color-helper";
|
|
25
|
+
readonly icon: "--fb-color-icon";
|
|
26
|
+
readonly iconMuted: "--fb-color-icon-muted";
|
|
27
|
+
readonly tooltipBackground: "--fb-color-tooltip-bg";
|
|
28
|
+
readonly border: "--fb-color-border";
|
|
29
|
+
readonly borderHover: "--fb-color-border-hover";
|
|
30
|
+
readonly borderFocus: "--fb-color-border-focus";
|
|
31
|
+
readonly borderLight: "--fb-color-border-light";
|
|
32
|
+
readonly checkboxOff: "--fb-color-checkbox-off";
|
|
33
|
+
readonly background: "--fb-color-bg";
|
|
34
|
+
readonly backgroundHover: "--fb-color-bg-hover";
|
|
35
|
+
readonly backgroundReadonly: "--fb-color-bg-readonly";
|
|
36
|
+
readonly backgroundMuted: "--fb-color-bg-muted";
|
|
37
|
+
readonly backgroundSubtle: "--fb-color-bg-subtle";
|
|
38
|
+
readonly error: "--fb-color-error";
|
|
39
|
+
readonly errorText: "--fb-color-error-text";
|
|
40
|
+
readonly errorBackground: "--fb-color-error-bg";
|
|
41
|
+
readonly alertText: "--fb-color-alert-text";
|
|
42
|
+
readonly alertBackground: "--fb-color-alert-bg";
|
|
43
|
+
readonly danger: "--fb-color-danger";
|
|
44
|
+
readonly success: "--fb-color-success";
|
|
45
|
+
readonly successBackground: "--fb-color-success-bg";
|
|
46
|
+
readonly fontFamily: "--fb-font-family";
|
|
47
|
+
readonly fontSize: "--fb-font-size";
|
|
48
|
+
readonly errorFontSize: "--fb-error-font-size";
|
|
49
|
+
readonly errorIcon: "--fb-error-icon";
|
|
50
|
+
readonly helperFontSize: "--fb-helper-font-size";
|
|
51
|
+
readonly radius: "--fb-radius";
|
|
52
|
+
readonly inputHeight: "--fb-input-height";
|
|
53
|
+
readonly inputPadding: "--fb-input-padding";
|
|
54
|
+
readonly labelWidth: "--fb-label-width";
|
|
55
|
+
readonly labelGap: "--fb-label-gap";
|
|
56
|
+
readonly buttonHeight: "--fb-button-height";
|
|
57
|
+
readonly buttonPadding: "--fb-button-padding";
|
|
58
|
+
readonly buttonRadius: "--fb-button-radius";
|
|
59
|
+
readonly buttonTextTransform: "--fb-button-text-transform";
|
|
60
|
+
readonly focusRing: "--fb-focus-ring";
|
|
61
|
+
};
|
|
62
|
+
export type FormBuilderThemeKey = keyof typeof FORM_BUILDER_TOKENS;
|
|
63
|
+
/** A partial set of token values; every key is optional. */
|
|
64
|
+
export type FormBuilderTheme = Partial<Record<FormBuilderThemeKey, string | number>>;
|
|
65
|
+
/** Ready-made sets of token values, applied as a class (see styles/theme.module.scss). */
|
|
66
|
+
export type FormBuilderThemePreset = "design";
|
|
67
|
+
export declare const PRESET_CLASS_NAMES: Record<FormBuilderThemePreset, string>;
|
|
68
|
+
/**
|
|
69
|
+
* The CSS custom properties for a theme, ready for a `style` prop, e.g. when the host applies
|
|
70
|
+
* the theme to an element of its own instead of using FormBuilderThemeProvider.
|
|
71
|
+
*/
|
|
72
|
+
export declare const toCssVars: (theme?: FormBuilderTheme) => Record<string, string>;
|