@asgardeo/react 0.6.4 → 0.6.6
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/cjs/index.js +179 -124
- package/dist/cjs/index.js.map +4 -4
- package/dist/components/adapters/SelectInput.d.ts +24 -0
- package/dist/index.js +56 -1
- package/dist/index.js.map +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
import { FC } from 'react';
|
|
19
|
+
import { BaseSignUpOptionProps } from '../presentation/SignUp/SignUpOptionFactory';
|
|
20
|
+
/**
|
|
21
|
+
* Select input component for sign-up forms.
|
|
22
|
+
*/
|
|
23
|
+
declare const SelectInput: FC<BaseSignUpOptionProps>;
|
|
24
|
+
export default SelectInput;
|
package/dist/index.js
CHANGED
|
@@ -7032,6 +7032,25 @@ var convertSimpleInputToComponent = (input, t) => {
|
|
|
7032
7032
|
if (input.name.toLowerCase().includes("password") && input.type.toLowerCase() === "string") {
|
|
7033
7033
|
fieldType = "password";
|
|
7034
7034
|
}
|
|
7035
|
+
if (input.type.toLowerCase() === "dropdown") {
|
|
7036
|
+
const label2 = getInputLabel(input.name, fieldType, t);
|
|
7037
|
+
const placeholder2 = getInputPlaceholder(input.name, fieldType, t);
|
|
7038
|
+
return {
|
|
7039
|
+
id: generateId("select"),
|
|
7040
|
+
type: EmbeddedFlowComponentType2.Select,
|
|
7041
|
+
variant: "SELECT",
|
|
7042
|
+
config: {
|
|
7043
|
+
type: fieldType,
|
|
7044
|
+
label: label2,
|
|
7045
|
+
placeholder: placeholder2,
|
|
7046
|
+
required: input.required,
|
|
7047
|
+
identifier: input.name,
|
|
7048
|
+
hint: "",
|
|
7049
|
+
options: input.options || []
|
|
7050
|
+
},
|
|
7051
|
+
components: []
|
|
7052
|
+
};
|
|
7053
|
+
}
|
|
7035
7054
|
const variant = getInputVariant(fieldType, input.name);
|
|
7036
7055
|
const label = getInputLabel(input.name, fieldType, t);
|
|
7037
7056
|
const placeholder = getInputPlaceholder(input.name, fieldType, t);
|
|
@@ -7040,7 +7059,7 @@ var convertSimpleInputToComponent = (input, t) => {
|
|
|
7040
7059
|
type: EmbeddedFlowComponentType2.Input,
|
|
7041
7060
|
variant,
|
|
7042
7061
|
config: {
|
|
7043
|
-
type:
|
|
7062
|
+
type: fieldType,
|
|
7044
7063
|
label,
|
|
7045
7064
|
placeholder,
|
|
7046
7065
|
required: input.required,
|
|
@@ -8070,6 +8089,40 @@ var TextInput = ({
|
|
|
8070
8089
|
};
|
|
8071
8090
|
var TextInput_default = TextInput;
|
|
8072
8091
|
|
|
8092
|
+
// src/components/adapters/SelectInput.tsx
|
|
8093
|
+
import { FieldType as FieldType14 } from "@asgardeo/browser";
|
|
8094
|
+
var SelectInput = ({
|
|
8095
|
+
component,
|
|
8096
|
+
formValues,
|
|
8097
|
+
touchedFields,
|
|
8098
|
+
formErrors,
|
|
8099
|
+
onInputChange,
|
|
8100
|
+
inputClassName
|
|
8101
|
+
}) => {
|
|
8102
|
+
const config = component.config || {};
|
|
8103
|
+
const fieldName = config["identifier"] || config["name"] || component.id;
|
|
8104
|
+
const value = formValues[fieldName] || "";
|
|
8105
|
+
const error = touchedFields[fieldName] ? formErrors[fieldName] : void 0;
|
|
8106
|
+
const rawOptions = config["options"] || [];
|
|
8107
|
+
const options = rawOptions.map((option) => ({
|
|
8108
|
+
label: option,
|
|
8109
|
+
value: option
|
|
8110
|
+
}));
|
|
8111
|
+
return createField({
|
|
8112
|
+
type: FieldType14.Select,
|
|
8113
|
+
name: fieldName,
|
|
8114
|
+
label: config["label"] || "",
|
|
8115
|
+
placeholder: config["placeholder"] || "",
|
|
8116
|
+
required: config["required"] || false,
|
|
8117
|
+
value,
|
|
8118
|
+
error,
|
|
8119
|
+
options,
|
|
8120
|
+
onChange: (newValue) => onInputChange(fieldName, newValue),
|
|
8121
|
+
className: inputClassName
|
|
8122
|
+
});
|
|
8123
|
+
};
|
|
8124
|
+
var SelectInput_default = SelectInput;
|
|
8125
|
+
|
|
8073
8126
|
// src/components/adapters/Typography.tsx
|
|
8074
8127
|
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
8075
8128
|
var TypographyComponent = ({ component }) => {
|
|
@@ -8179,6 +8232,8 @@ var createSignUpComponent = ({ component, onSubmit, ...rest }) => {
|
|
|
8179
8232
|
}
|
|
8180
8233
|
case EmbeddedFlowComponentType4.Form:
|
|
8181
8234
|
return /* @__PURE__ */ jsx66(FormContainer_default, { component, onSubmit, ...rest });
|
|
8235
|
+
case EmbeddedFlowComponentType4.Select:
|
|
8236
|
+
return /* @__PURE__ */ jsx66(SelectInput_default, { component, onSubmit, ...rest });
|
|
8182
8237
|
case EmbeddedFlowComponentType4.Divider:
|
|
8183
8238
|
return /* @__PURE__ */ jsx66(DividerComponent_default, { component, onSubmit, ...rest });
|
|
8184
8239
|
case EmbeddedFlowComponentType4.Image:
|