@agilant/toga-blox 1.0.93 → 1.0.94

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.
Files changed (45) hide show
  1. package/dist/components/BaseInput/BaseCheckbox.d.ts +10 -0
  2. package/dist/components/BaseInput/BaseCheckbox.js +9 -0
  3. package/dist/components/BaseInput/BaseInput.d.ts +4 -0
  4. package/dist/components/BaseInput/BaseInput.js +100 -0
  5. package/dist/components/BaseInput/BaseInput.stories.d.ts +12 -0
  6. package/dist/components/BaseInput/BaseInput.stories.js +375 -0
  7. package/dist/components/BaseInput/BaseInput.test.d.ts +1 -0
  8. package/dist/components/BaseInput/BaseInput.test.js +560 -0
  9. package/dist/components/BaseInput/BaseInput.types.d.ts +139 -0
  10. package/dist/components/BaseInput/BaseInput.types.js +1 -0
  11. package/dist/components/BaseInput/BaseMultiSelect.d.ts +33 -0
  12. package/dist/components/BaseInput/BaseMultiSelect.js +68 -0
  13. package/dist/components/BaseInput/BaseRadio.d.ts +18 -0
  14. package/dist/components/BaseInput/BaseRadio.js +7 -0
  15. package/dist/components/BaseInput/BaseSelect.d.ts +41 -0
  16. package/dist/components/BaseInput/BaseSelect.js +83 -0
  17. package/dist/components/BaseInput/BaseTextInput.d.ts +27 -0
  18. package/dist/components/BaseInput/BaseTextInput.js +45 -0
  19. package/dist/components/BaseInput/BaseTextareaInput.d.ts +27 -0
  20. package/dist/components/BaseInput/BaseTextareaInput.js +36 -0
  21. package/dist/components/BaseInput/BaseToggle.d.ts +24 -0
  22. package/dist/components/BaseInput/BaseToggle.js +8 -0
  23. package/dist/components/BaseInput/DisabledSelect.d.ts +7 -0
  24. package/dist/components/BaseInput/DisabledSelect.js +6 -0
  25. package/dist/components/BaseInput/components/BaseErrorMessage.d.ts +8 -0
  26. package/dist/components/BaseInput/components/BaseErrorMessage.js +5 -0
  27. package/dist/components/BaseInput/components/CharacterLimitMessage.d.ts +9 -0
  28. package/dist/components/BaseInput/components/CharacterLimitMessage.js +7 -0
  29. package/dist/components/BaseInput/components/DropDownIndicator.d.ts +6 -0
  30. package/dist/components/BaseInput/components/DropDownIndicator.js +5 -0
  31. package/dist/components/BaseInput/components/MultiValueRemove.d.ts +4 -0
  32. package/dist/components/BaseInput/components/MultiValueRemove.js +7 -0
  33. package/dist/components/BaseInput/components/Option.d.ts +2 -0
  34. package/dist/components/BaseInput/components/Option.js +19 -0
  35. package/dist/components/BaseInput/components/SingleValue.d.ts +4 -0
  36. package/dist/components/BaseInput/components/SingleValue.js +14 -0
  37. package/dist/components/SearchInput/SearchInput.stories.js +0 -4
  38. package/dist/components/ToggleButton/ToggleButton.js +2 -2
  39. package/dist/utils/formatePhoneNumber.d.ts +2 -0
  40. package/dist/utils/formatePhoneNumber.js +14 -0
  41. package/dist/utils/fromatTableData.d.ts +45 -0
  42. package/dist/utils/fromatTableData.js +80 -0
  43. package/dist/utils/getColSPanClass.d.ts +2 -0
  44. package/dist/utils/getColSPanClass.js +15 -0
  45. package/package.json +2 -1
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+ interface BaseCheckboxProps {
3
+ control: any;
4
+ valueKey: string;
5
+ defaultValue: boolean;
6
+ checkboxBorderColorOnChecked: string;
7
+ checkboxBackgroundColor: string;
8
+ }
9
+ declare const BaseCheckbox: React.FC<BaseCheckboxProps>;
10
+ export default BaseCheckbox;
@@ -0,0 +1,9 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Controller } from "react-hook-form";
3
+ const BaseCheckbox = (props) => {
4
+ const { control, valueKey, defaultValue, checkboxBorderColorOnChecked, checkboxBackgroundColor, } = props;
5
+ return (_jsx(Controller, { name: valueKey, control: control, defaultValue: defaultValue, render: ({ field }) => (_jsx(_Fragment, { children: _jsx("div", { className: "inline-flex items-center", children: _jsxs("label", { className: "flex items-center cursor-pointer relative", children: [_jsx("input", { type: "checkbox", className: `peer h-5 w-5 cursor-pointer transition-all appearance-none rounded border border-stroke ${checkboxBorderColorOnChecked} ${checkboxBackgroundColor} `, id: valueKey, checked: field.value, onChange: (e) => {
6
+ field.onChange(e.target.checked);
7
+ } }), _jsx("span", { className: "absolute text-white opacity-0 peer-checked:opacity-100 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2", children: _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: "h-3.5 w-3.5", viewBox: "0 0 20 20", fill: "currentColor", stroke: "currentColor", strokeWidth: "1", children: _jsx("path", { fillRule: "evenodd", d: "M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z", clipRule: "evenodd" }) }) })] }) }) })) }));
8
+ };
9
+ export default BaseCheckbox;
@@ -0,0 +1,4 @@
1
+ import React from "react";
2
+ import { BaseInputTypes } from "./BaseInput.types";
3
+ declare const BaseInput: React.FC<BaseInputTypes>;
4
+ export default BaseInput;
@@ -0,0 +1,100 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useFormContext } from "react-hook-form";
3
+ import DisabledSelect from "./DisabledSelect";
4
+ import getColSpanClass from "../../utils/getColSPanClass.js";
5
+ import BaseTextInput from "./BaseTextInput";
6
+ import BaseTextareaInput from "./BaseTextareaInput";
7
+ import BaseCheckbox from "./BaseCheckbox";
8
+ import BaseToggle from "./BaseToggle";
9
+ import BaseSelect from "./BaseSelect";
10
+ import BaseMultiSelect from "./BaseMultiSelect";
11
+ import BaseRadioInput from "./BaseRadio";
12
+ const BaseInput = ({ dataItem, field, mobileBreakpoint, inputFontColor = "text-gray-800", inputBorderColor = "border-gray-200", inputBorderHoverColor = "hover:border-1 hover:border-black", inputBorderFocusColor = "focus:border-blue-600", dropDownInputBorderFocusColor = "focus:border-blue-600", dropDownInputBorderHoverColor = "hover:border-black", dropdownIndicatorClasses = "text-lg pr-2", dropdownIndicatorColor = "text-gray-800", checkboxBackgroundColor = "checked:bg-blue-600", checkboxBorderColorOnChecked = "checked:border-blue-600", menuBackgroundColor = "bg-white", menuBorderColor, options, inputTextSize, uuid, dynamicDefaultValue, isArrayValue, onBlur, menuPlacement, hasDirtyValidation, inputAndLabelContainerClasses = "flex mb-1 w-full", labelTextClasses = "text-sm pr-2 text-left", inputContainerClasses = "text-left relative", inputHasLeftIcon, inputLabel, isRequired, showRequiredIndicator, inputClasses, valueType, valueKey, requireUuidField, hasTypeCheck, placeholder, afterInputTextClasses, afterInputText, isSearchable, useDefaultValue, inputType, characterLimit, disabledSelectContainerClasses = "border-1 rounded bg-gray-200", disabledSelectText = "Not Editable", textAreaHeight = "small", colSpan, onSearchChange, isSearchLoading, toggleTextPosition = "right", toggleTextSize = "sm", toggleActiveColorBackground = "bg-blue-600", toggleInactiveColorBackground = "bg-blue-300", toggleActiveColorBorder = "border-blue-500", toggleInactiveColorBorder = "border-blue-300", toggleActiveTextColor = "text-blue-800", toggleInactiveTextColor = "text-blue-600", toggleAdditionalClasses = `w-1/4`, toggleHasDivider = false, toggleFontFamily = "font-omnes-regular", toggleActiveLabel = "Yes", toggleInactiveLabel = "No", toggleSmallToggle = true, toggleBorderStyle = true, extraSmallTextAreaClasses = "h-28 min-h-12 max-h-16 w-full", smallTextAreaClasses = "h-32 min-h-12 max-h-36 w-full", largeTextAreaClasses = "h-72 min-h-12 max-h-72 w-full", controlClasses = `rounded border-1 bg-gray-100 w-full`, selectInputDirtyFieldClasses = "border-green-600 w-full", selectInputErrorFieldClasses = "border-crimson-500 w-full", menuClasses = "", textAreaDirtyFieldClasses = "", textAreaErrorFieldClasses = "", textDirtyFieldClasses = "", textErrorFieldClasses = "", radioBorderColorOnChecked, radioBackgroundColor, containerClasses, radioOptionTextClasses, }) => {
13
+ const input = field;
14
+ const { register, control, watch, getValues, formState: { errors, dirtyFields }, setValue, } = useFormContext();
15
+ const handleInputChange = (inputValue) => {
16
+ if (onSearchChange) {
17
+ onSearchChange(inputValue);
18
+ }
19
+ };
20
+ const getDefaultValue = (dynamicDefaultValue, valueKey) => {
21
+ const value = dynamicDefaultValue ?? getValues(valueKey);
22
+ if (value === undefined || value === null) {
23
+ return "";
24
+ }
25
+ else {
26
+ return value;
27
+ }
28
+ };
29
+ ////// TEXT AREA CLASSES //////
30
+ const textAreaInputDirtyFieldClasses = `p-1 w-full border-1 border-green-600 rounded ${inputBorderFocusColor} ${textAreaDirtyFieldClasses}`;
31
+ const textAreaInputErrorFieldClasses = `"p-1 w-full border-1 border-red-500 rounded ${inputBorderFocusColor} ${textAreaErrorFieldClasses}`;
32
+ ////// TEXT INPUT CLASSES //////
33
+ const textInputDirtyFieldClasses = `border-1 border-primary-600 rounded ${inputBorderFocusColor} ${textDirtyFieldClasses}`;
34
+ const textInputErrorFieldClasses = `border-1 border-red-500 rounded ${inputBorderFocusColor} ${textErrorFieldClasses}`;
35
+ ////// SELECT & MULTISELECT INPUT CLASSES //////
36
+ const finalMenuClasses = `rounded border-1 shadow-md ${menuBackgroundColor} ${menuBorderColor} ${menuClasses} overflow-x-hidden`;
37
+ const getInput = (input) => {
38
+ const getNestedValue = (obj, path) => {
39
+ if (!obj || !path)
40
+ return undefined;
41
+ const keys = path.split(".");
42
+ let current = obj;
43
+ for (let key of keys) {
44
+ if (current[key] === undefined)
45
+ return undefined;
46
+ current = current[key];
47
+ }
48
+ return current;
49
+ };
50
+ let isFieldError;
51
+ let errorMessage;
52
+ let isFieldDirty;
53
+ if (requireUuidField && !isArrayValue && uuid) {
54
+ isFieldError = getNestedValue(errors, uuid);
55
+ errorMessage = getNestedValue(errors, `${uuid}.message`);
56
+ isFieldDirty = getNestedValue(dirtyFields, valueKey);
57
+ }
58
+ else if (requireUuidField && isArrayValue && uuid) {
59
+ isFieldDirty = getNestedValue(dirtyFields, uuid);
60
+ isFieldError = getNestedValue(errors, `${uuid}.message`);
61
+ errorMessage = getNestedValue(errors, `${uuid}.message`);
62
+ }
63
+ else {
64
+ isFieldError = getNestedValue(errors, valueKey);
65
+ errorMessage = getNestedValue(errors, `${valueKey}.message`);
66
+ isFieldDirty = getNestedValue(dirtyFields, valueKey);
67
+ }
68
+ const validMenuPlacement = menuPlacement === "top" ||
69
+ menuPlacement === "bottom" ||
70
+ menuPlacement === "auto"
71
+ ? menuPlacement
72
+ : undefined;
73
+ return (_jsxs("div", { className: `${mobileBreakpoint} ${inputAndLabelContainerClasses} ${colSpan && getColSpanClass(colSpan)}`, children: [_jsxs("label", { htmlFor: valueKey, className: `${labelTextClasses}`, children: [inputLabel, isRequired && showRequiredIndicator && (_jsx("span", { className: "text-red-700 ml-0.5", children: "*" }))] }), (() => {
74
+ switch (inputType) {
75
+ case "text":
76
+ return (_jsx(BaseTextInput, { inputBorderColor: inputBorderColor, inputBorderHoverColor: inputBorderHoverColor, inputBorderFocusColor: inputBorderFocusColor, uuid: uuid, defaultValue: getDefaultValue(dynamicDefaultValue, valueKey), control: control, onBlur: onBlur, inputContainerClasses: inputContainerClasses, inputHasLeftIcon: inputHasLeftIcon, isRequired: isRequired, showRequiredIndicator: showRequiredIndicator, inputClasses: inputClasses, valueType: valueType, valueKey: valueKey, requireUuidField: requireUuidField, hasTypeCheck: hasTypeCheck, placeholder: placeholder, errorMessage: errorMessage, isFieldDirty: isFieldDirty, isFieldError: isFieldError, textInputDirtyFieldClasses: textInputDirtyFieldClasses, textInputErrorFieldClasses: textInputErrorFieldClasses }));
77
+ case "select":
78
+ return (_jsx(BaseSelect, { control: control, valueKey: valueKey, options: options, getValues: getValues, setValue: setValue, defaultValue: getDefaultValue(dynamicDefaultValue, valueKey), isRequired: isRequired, errorMessage: errorMessage, isFieldDirty: isFieldDirty, isFieldError: isFieldError, placeholder: placeholder, inputContainerClasses: inputContainerClasses, inputClasses: inputClasses, inputBorderColor: inputBorderColor, inputBorderHoverColor: inputBorderHoverColor, dropDownInputBorderFocusColor: dropDownInputBorderFocusColor, dropDownInputBorderHoverColor: dropDownInputBorderHoverColor, dropdownIndicatorClasses: dropdownIndicatorClasses, dropdownIndicatorColor: dropdownIndicatorColor, menuBackgroundColor: menuBackgroundColor, menuBorderColor: menuBorderColor, isSearchable: isSearchable, handleInputChange: handleInputChange, isSearchLoading: isSearchLoading, validMenuPlacement: validMenuPlacement, hasDirtyValidation: hasDirtyValidation, requireUuidField: requireUuidField }));
79
+ case "multiSelect":
80
+ return (_jsx(BaseMultiSelect, { control: control, defaultValue: getValues(valueKey), valueKey: valueKey, inputContainerClasses: inputContainerClasses, isRequired: isRequired, options: options, isSearchable: isSearchable, placeholder: placeholder, dropdownIndicatorColor: dropdownIndicatorColor, useDefaultValue: useDefaultValue, input: input, inputTextSize: inputTextSize, controlClasses: controlClasses, dropdownIndicatorClasses: dropdownIndicatorClasses, inputBorderColor: inputBorderColor, dropDownInputBorderFocusColor: dropDownInputBorderFocusColor, dropDownInputBorderHoverColor: dropDownInputBorderHoverColor, selectInputDirtyFieldClasses: selectInputDirtyFieldClasses, selectInputErrorFieldClasses: selectInputErrorFieldClasses, isFieldDirty: isFieldDirty, isFieldError: isFieldError, hasDirtyValidation: hasDirtyValidation, errorMessage: errorMessage, inputFontColor: inputFontColor, menuClasses: finalMenuClasses }));
81
+ case "toggle":
82
+ return (_jsx(BaseToggle, { control: control, valueKey: valueKey, inputContainerClasses: inputContainerClasses, defaultValue: dataItem
83
+ ? dataItem[valueKey]
84
+ : "", toggleTextPosition: toggleTextPosition, toggleTextSize: toggleTextSize, toggleActiveColorBackground: toggleActiveColorBackground, toggleInactiveColorBackground: toggleInactiveColorBackground, toggleActiveColorBorder: toggleActiveColorBorder, toggleInactiveColorBorder: toggleInactiveColorBorder, toggleActiveTextColor: toggleActiveTextColor, toggleInactiveTextColor: toggleInactiveTextColor, toggleAdditionalClasses: toggleAdditionalClasses, toggleHasDivider: toggleHasDivider, toggleFontFamily: toggleFontFamily, toggleActiveLabel: toggleActiveLabel, toggleInactiveLabel: toggleInactiveLabel, toggleSmallToggle: toggleSmallToggle, toggleBorderStyle: toggleBorderStyle }));
85
+ case "textArea":
86
+ return (_jsx(BaseTextareaInput, { input: input, inputTextSize: inputTextSize, watch: watch, control: control, defaultValue: getDefaultValue(dynamicDefaultValue, valueKey), valueKey: valueKey, errorMessage: errorMessage, isFieldDirty: isFieldDirty, isFieldError: isFieldError, placeholder: placeholder, characterLimit: characterLimit, textAreaHeight: textAreaHeight, textAreaInputDirtyFieldClasses: textAreaInputDirtyFieldClasses, textAreaInputErrorFieldClasses: textAreaInputErrorFieldClasses, smallTextAreaClasses: smallTextAreaClasses, largeTextAreaClasses: largeTextAreaClasses, extraSmallTextAreaClasses: extraSmallTextAreaClasses, inputContainerClasses: inputContainerClasses, inputFontColor: inputFontColor, inputBorderColor: inputBorderColor, inputBorderHoverColor: inputBorderHoverColor, inputBorderFocusColor: inputBorderFocusColor }));
87
+ case "disabledSelect":
88
+ return (_jsx(DisabledSelect, { disabledSelectText: disabledSelectText, containerClasses: `${inputContainerClasses} ${disabledSelectContainerClasses}`, labelTextClasses: labelTextClasses }));
89
+ case "checkbox":
90
+ return (_jsx(BaseCheckbox, { control: control, valueKey: valueKey, defaultValue: getDefaultValue(dynamicDefaultValue, valueKey), checkboxBorderColorOnChecked: checkboxBorderColorOnChecked, checkboxBackgroundColor: checkboxBackgroundColor }));
91
+ case "radio":
92
+ return (_jsx(BaseRadioInput, { control: control, valueKey: valueKey, defaultValue: getDefaultValue(dynamicDefaultValue, valueKey), radioBorderColorOnChecked: radioBorderColorOnChecked, radioBackgroundColor: radioBackgroundColor, radioOptionTextClasses: radioOptionTextClasses, containerClasses: containerClasses, options: options }));
93
+ default:
94
+ return null;
95
+ }
96
+ })(), input.afterInputText && (_jsx("div", { className: "flex items-center ml-2 text-nowrap", children: _jsx("p", { className: `${afterInputTextClasses}`, children: afterInputText }) }))] }, input.uuid));
97
+ };
98
+ return input && _jsx(_Fragment, { children: getInput(input) });
99
+ };
100
+ export default BaseInput;
@@ -0,0 +1,12 @@
1
+ import { Meta } from "@storybook/react";
2
+ declare const _default: Meta;
3
+ export default _default;
4
+ export declare const TextInput: any;
5
+ export declare const NumberInput: any;
6
+ export declare const TextAreaInput: any;
7
+ export declare const SelectInput: any;
8
+ export declare const MultiSelectInput: any;
9
+ export declare const DisabledSelectInput: any;
10
+ export declare const ToggleInput: any;
11
+ export declare const CheckboxInput: any;
12
+ export declare const RadioInput: any;
@@ -0,0 +1,375 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useForm, FormProvider } from "react-hook-form";
3
+ import BaseInput from "./BaseInput";
4
+ export default {
5
+ title: "FormInputs/Input",
6
+ component: BaseInput,
7
+ tags: ["autodocs"],
8
+ argTypes: {
9
+ inputType: {
10
+ control: {
11
+ type: "select",
12
+ options: [
13
+ "text",
14
+ "number",
15
+ "select",
16
+ "multiSelect",
17
+ "toggle",
18
+ "textArea",
19
+ "checkbox",
20
+ ],
21
+ },
22
+ description: "Specifies the type of input field.",
23
+ },
24
+ inputLabel: {
25
+ control: "text",
26
+ description: "Label for the input field.",
27
+ },
28
+ placeholder: {
29
+ control: "text",
30
+ description: "Placeholder text for the input.",
31
+ },
32
+ isRequired: {
33
+ control: "boolean",
34
+ description: "Indicates whether the field is required.",
35
+ },
36
+ showRequiredIndicator: {
37
+ control: "boolean",
38
+ description: "Displays an asterisk (*) for required fields.",
39
+ },
40
+ valueType: {
41
+ control: { type: "select", options: ["text", "number", "phone"] },
42
+ description: "Defines the expected value format.",
43
+ },
44
+ dropdownOptions: {
45
+ control: "array",
46
+ description: "Options for dropdown and multiSelect inputs.",
47
+ },
48
+ menuPlacement: {
49
+ control: { type: "select", options: ["top", "bottom", "auto"] },
50
+ description: "Controls the dropdown menu position.",
51
+ },
52
+ isSearchable: {
53
+ control: "boolean",
54
+ description: "Allows searching in select/multiSelect fields.",
55
+ },
56
+ characterLimit: {
57
+ control: "number",
58
+ description: "Limits character count for text and textarea inputs.",
59
+ },
60
+ inputBorderColor: {
61
+ control: "color",
62
+ description: "Border color of the input field.",
63
+ },
64
+ inputFontColor: {
65
+ control: "color",
66
+ description: "Text color of the input field.",
67
+ },
68
+ hasTypeCheck: {
69
+ control: { type: "select", options: ["none", "number"] },
70
+ description: "Validation type for text inputs.",
71
+ },
72
+ disabledSelectText: {
73
+ control: "text",
74
+ description: "Text displayed when disabled select is active.",
75
+ },
76
+ colSpan: {
77
+ control: "number",
78
+ description: "Defines column span for grid layouts.",
79
+ },
80
+ inputHasLeftIcon: {
81
+ control: "boolean",
82
+ description: "Indicates whether an icon is displayed inside the input.",
83
+ },
84
+ isDoubleValue: {
85
+ control: "boolean",
86
+ description: "Used in select/multiSelect for special formatting.",
87
+ },
88
+ useDefaultValue: {
89
+ control: "boolean",
90
+ description: "Pre-fills the input with a default value.",
91
+ },
92
+ toggleStatus: {
93
+ control: "boolean",
94
+ description: "Initial state for toggle button inputs.",
95
+ },
96
+ },
97
+ parameters: { layout: "centered" },
98
+ };
99
+ const Template = (args) => {
100
+ const methods = useForm(); // Create a form context
101
+ return (_jsx(FormProvider, { ...methods, children: _jsx(BaseInput, { ...args }, 1) }));
102
+ };
103
+ export const TextInput = Template.bind({});
104
+ TextInput.args = {
105
+ key: 1,
106
+ field: {
107
+ uuid: "3d",
108
+ label: "Label",
109
+ valueKey: "valueKey",
110
+ type: "text",
111
+ inputType: "text",
112
+ placeholder: "Placeholder",
113
+ colSpan: "col-span-2",
114
+ isRequired: true,
115
+ showRequiredIndicator: true,
116
+ valueType: "",
117
+ },
118
+ inputAndLabelContainerClasses: "flex flex-col items-start w-full",
119
+ placeholder: "Placeholder",
120
+ inputLabel: "Label",
121
+ valueKey: "valueKey",
122
+ hasDirtyValidation: true,
123
+ inputClasses: "w-full h-10 border-1 rounded border-transparent bg-gray-100",
124
+ inputContainerClasses: "w-full relative block",
125
+ labelTextClasses: "font-sm pb-1 pr-2",
126
+ isRequired: true,
127
+ inputType: "text",
128
+ showRequiredIndicator: true,
129
+ colSpan: "col-span-2",
130
+ valueType: "",
131
+ dropDownInputBorderFocusColor: "border-primary-600",
132
+ inputBorderFocusColor: `focus:border-1 focus:border-primary-600 focus:outline-none focus:ring-0`,
133
+ textAreaHeight: "small",
134
+ options: [],
135
+ };
136
+ export const NumberInput = Template.bind({});
137
+ NumberInput.args = {
138
+ key: 1,
139
+ field: {
140
+ uuid: "3d",
141
+ label: "Label",
142
+ valueKey: "valueKey",
143
+ type: "text",
144
+ inputType: "text",
145
+ placeholder: "Number Placeholder",
146
+ colSpan: "col-span-2",
147
+ isRequired: true,
148
+ hasTypeCheck: "number",
149
+ showRequiredIndicator: true,
150
+ valueType: "",
151
+ },
152
+ inputAndLabelContainerClasses: "flex flex-col items-start w-full",
153
+ placeholder: "Number Placeholder",
154
+ inputLabel: "Label",
155
+ valueKey: "valueKey",
156
+ hasDirtyValidation: true,
157
+ hasTypeCheck: "number",
158
+ inputClasses: "w-full h-10 border-1 rounded border-transparent bg-gray-100",
159
+ inputContainerClasses: "w-full relative block",
160
+ labelTextClasses: "font-sm pb-1 pr-2",
161
+ isRequired: true,
162
+ inputType: "text",
163
+ showRequiredIndicator: true,
164
+ colSpan: "col-span-2",
165
+ valueType: "",
166
+ dropDownInputBorderFocusColor: "border-primary-600",
167
+ inputBorderFocusColor: `focus:border-1 focus:border-primary-600 focus:outline-none focus:ring-0`,
168
+ textAreaHeight: "small",
169
+ options: [],
170
+ };
171
+ export const TextAreaInput = Template.bind({});
172
+ TextAreaInput.args = {
173
+ inputType: "textArea",
174
+ inputLabel: "Textarea Input",
175
+ placeholder: "Type here...",
176
+ key: 2,
177
+ field: {
178
+ uuid: "4d",
179
+ label: "Textarea Label",
180
+ valueKey: "valueKey",
181
+ type: "textArea",
182
+ inputType: "textArea",
183
+ placeholder: "Placeholder",
184
+ colSpan: "col-span-2",
185
+ isRequired: true,
186
+ showRequiredIndicator: true,
187
+ valueType: "",
188
+ inputClasses: "border-2",
189
+ },
190
+ label: "Textarea Label",
191
+ valueKey: "valueKey",
192
+ characterLimit: 200,
193
+ textAreaHeight: "small",
194
+ labelTextClasses: "font-sm pb-1 pr-2",
195
+ inputAndLabelContainerClasses: "flex flex-col items-start w-full",
196
+ textAreaInputDirtyFieldClasses: "p-1 w-full border-1 border-mint-600 rounded focus:border-primary-600",
197
+ textAreaInputErrorFieldClasses: "p-1 w-full border-1 border-crimson-500 rounded focus:border-primary-600",
198
+ smallTextAreaClasses: "h-28 min-h-12 max-h-16 w-full",
199
+ largeTextAreaClasses: "h-72 min-h-12 max-h-72 w-full",
200
+ extraSmallTextAreaClasses: "h-32 min-h-12 max-h-36 w-full",
201
+ inputContainerClasses: "w-full text-left relative",
202
+ inputFontColor: "text-gray-800",
203
+ inputBorderColor: "border-gray-200",
204
+ inputBorderHoverColor: "hover:border-1 hover:border-black",
205
+ inputBorderFocusColor: "focus:border-primary-600",
206
+ };
207
+ export const SelectInput = Template.bind({});
208
+ SelectInput.args = {
209
+ inputType: "select",
210
+ inputLabel: "Select Input",
211
+ options: [
212
+ { uuid: "1", name: "Option 1" },
213
+ { uuid: "2", name: "Option 2" },
214
+ ],
215
+ isSearchable: true,
216
+ key: 1,
217
+ field: {
218
+ uuid: "8d",
219
+ label: "Select Label",
220
+ valueKey: "valueKey",
221
+ type: "select",
222
+ inputType: "select",
223
+ placeholder: "Placeholder",
224
+ colSpan: "col-span-2",
225
+ isRequired: true,
226
+ showRequiredIndicator: true,
227
+ valueType: "",
228
+ },
229
+ inputAndLabelContainerClasses: "flex flex-col items-start w-full",
230
+ placeholder: "Placeholder",
231
+ valueKey: "valueKey",
232
+ hasDirtyValidation: true,
233
+ inputClasses: "w-full h-10 border-1 rounded border-transparent bg-blue-100",
234
+ inputContainerClasses: "w-40 relative block",
235
+ labelTextClasses: "font-sm pb-1 pr-2",
236
+ isRequired: true,
237
+ showRequiredIndicator: true,
238
+ colSpan: "col-span-2",
239
+ valueType: "",
240
+ dropDownInputBorderFocusColor: "border-blue-600",
241
+ inputBorderFocusColor: `focus:border-1 focus:border-blue-600 focus:outline-none focus:ring-0`,
242
+ textAreaHeight: "small",
243
+ };
244
+ export const MultiSelectInput = Template.bind({});
245
+ MultiSelectInput.args = {
246
+ inputType: "multiSelect",
247
+ inputLabel: "Multi Select Input",
248
+ options: [
249
+ { uuid: "1", name: "Option 1" },
250
+ { uuid: "2", name: "Option 2" },
251
+ { uuid: "3", name: "Option 3" },
252
+ { uuid: "4", name: "Option 4" },
253
+ ],
254
+ isSearchable: true,
255
+ key: 1,
256
+ field: {
257
+ uuid: "8d",
258
+ label: "Select Label",
259
+ valueKey: "valueKey",
260
+ type: "multiSelect",
261
+ inputType: "multiSelect",
262
+ placeholder: "Placeholder",
263
+ colSpan: "col-span-2",
264
+ isRequired: true,
265
+ showRequiredIndicator: true,
266
+ valueType: "",
267
+ },
268
+ inputAndLabelContainerClasses: "flex flex-col items-start w-full",
269
+ placeholder: "Placeholder",
270
+ valueKey: "valueKey",
271
+ hasDirtyValidation: true,
272
+ inputClasses: "w-full h-10 border-1 rounded border-transparent bg-blue-100",
273
+ inputContainerClasses: "w-40 relative block",
274
+ labelTextClasses: "font-sm pb-1 pr-2",
275
+ isRequired: true,
276
+ showRequiredIndicator: true,
277
+ colSpan: "col-span-2",
278
+ valueType: "",
279
+ dropDownInputBorderFocusColor: "border-primary-600",
280
+ inputBorderFocusColor: `focus:border-1 focus:border-primary-600 focus:outline-none focus:ring-0`,
281
+ textAreaHeight: "small",
282
+ };
283
+ export const DisabledSelectInput = Template.bind({});
284
+ DisabledSelectInput.args = {
285
+ inputType: "disabledSelect",
286
+ inputLabel: "Disabled Select",
287
+ disabledSelectText: "Not Editable",
288
+ valueKey: "valueKey",
289
+ field: {
290
+ uuid: "5d",
291
+ label: "Disabled Select",
292
+ valueKey: "valueKey",
293
+ type: "disabledSelect",
294
+ inputType: "disabledSelect",
295
+ valueType: "",
296
+ },
297
+ inputAndLabelContainerClasses: "w-full flex flex-col relative block",
298
+ labelTextClasses: "font-sm pb-1 pr-2",
299
+ disabledSelectContainerClasses: "w-full h-10 border-1 rounded border-transparent bg-gray-100",
300
+ };
301
+ export const ToggleInput = Template.bind({});
302
+ ToggleInput.args = {
303
+ inputType: "toggle",
304
+ inputLabel: "Toggle Input",
305
+ placeholder: "Type here...",
306
+ key: 2,
307
+ field: {
308
+ uuid: "7d",
309
+ label: "Toggle Label",
310
+ valueKey: "valueKey",
311
+ type: "toggle",
312
+ inputType: "toggle",
313
+ placeholder: "Placeholder",
314
+ colSpan: "col-span-2",
315
+ isRequired: true,
316
+ showRequiredIndicator: true,
317
+ valueType: "",
318
+ inputClasses: "border-2",
319
+ },
320
+ label: "Toggle Label",
321
+ valueKey: "valueKey",
322
+ characterLimit: 200,
323
+ labelTextClasses: "font-sm pb-1 pr-2",
324
+ inputAndLabelContainerClasses: "flex flex-col items-start w-full",
325
+ inputContainerClasses: "w-full text-left relative",
326
+ };
327
+ export const CheckboxInput = Template.bind({});
328
+ CheckboxInput.args = {
329
+ inputType: "checkbox",
330
+ inputLabel: "Checkbox Input",
331
+ valueKey: "valueKey",
332
+ field: {
333
+ uuid: "6d",
334
+ label: "Checkbox",
335
+ valueKey: "valueKey",
336
+ type: "checkbox",
337
+ inputType: "checkbox",
338
+ valueType: "",
339
+ },
340
+ inputAndLabelContainerClasses: "w-full flex relative block",
341
+ labelTextClasses: "font-sm pb-1 pr-2",
342
+ checkboxBackgroundColor: "bg-blue-500",
343
+ checkboxBorderColorOnChecked: "border-white",
344
+ };
345
+ export const RadioInput = Template.bind({});
346
+ RadioInput.args = {
347
+ inputType: "radio",
348
+ inputLabel: "Radio Input Label",
349
+ valueKey: "valueKey",
350
+ field: {
351
+ uuid: "6d",
352
+ label: "Radio Input Label",
353
+ valueKey: "valueKey",
354
+ type: "radio",
355
+ inputType: "radio",
356
+ valueType: "",
357
+ options: [
358
+ { value: "option1", label: "Option 1" },
359
+ { value: "option2", label: "Option 2" },
360
+ { value: "option3", label: "Option 3" },
361
+ ],
362
+ },
363
+ options: [
364
+ { value: "option1", label: "Option 1" },
365
+ { value: "option2", label: "Option 2" },
366
+ { value: "option3", label: "Option 3" },
367
+ ],
368
+ defaultValue: "option1",
369
+ radioBorderColorOnChecked: "checked:border-blue-600",
370
+ radioBackgroundColor: "checked:bg-blue-600",
371
+ radioOptionTextClasses: "text-sm text-gray-800",
372
+ containerClasses: "flex flex-col space-y-2",
373
+ inputAndLabelContainerClasses: "flex flex-col items-start w-full",
374
+ labelTextClasses: "font-sm pb-1 font-bold",
375
+ };
@@ -0,0 +1 @@
1
+ export {};