123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657 |
- exports.id = 37013;
- exports.ids = [37013];
- exports.modules = {
- /***/ 88426:
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689);
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
- var _path;
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
- var SvgStar = function SvgStar(props) {
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({
- width: 15,
- height: 15,
- viewBox: "0 0 15 15",
- fill: "none",
- xmlns: "http://www.w3.org/2000/svg"
- }, props), _path || (_path = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", {
- d: "m6.98 1.252-.022.05L5.588 4.6a.3.3 0 0 1-.253.184l-3.561.286-.055.004-.331.027-.3.024a.3.3 0 0 0-.172.527l.23.196.252.216.041.036 2.713 2.324a.3.3 0 0 1 .097.297l-.83 3.475-.012.053-.077.323-.07.294a.3.3 0 0 0 .448.326l.258-.158.284-.173.046-.028 3.049-1.863a.3.3 0 0 1 .312 0l3.049 1.863.046.028.284.173.258.158a.3.3 0 0 0 .448-.326l-.07-.293-.077-.324-.013-.053-.829-3.475a.3.3 0 0 1 .097-.297L13.562 6.1l.041-.036.253-.216.23-.196a.3.3 0 0 0-.172-.527l-.3-.024-.332-.027-.055-.004-3.56-.286a.3.3 0 0 1-.254-.184L8.042 1.302l-.021-.05-.128-.307-.116-.279a.3.3 0 0 0-.554 0l-.116.279-.128.307Zm.52 1.352-.99 2.38a1.3 1.3 0 0 1-1.096.797l-2.57.206 1.958 1.677a1.3 1.3 0 0 1 .418 1.29l-.598 2.507 2.2-1.344a1.3 1.3 0 0 1 1.356 0l2.2 1.344-.598-2.508a1.3 1.3 0 0 1 .418-1.289l1.958-1.677-2.57-.206a1.3 1.3 0 0 1-1.096-.797l-.99-2.38Z",
- fill: "currentColor",
- fillRule: "evenodd",
- clipRule: "evenodd"
- })));
- };
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SvgStar);
- /***/ }),
- /***/ 99815:
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689);
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
- var _path;
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
- var SvgStarFilled = function SvgStarFilled(props) {
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("svg", _extends({
- width: 15,
- height: 15,
- viewBox: "0 0 15 15",
- fill: "none",
- xmlns: "http://www.w3.org/2000/svg"
- }, props), _path || (_path = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("path", {
- d: "M7.223.666a.3.3 0 0 1 .554 0L9.413 4.6a.3.3 0 0 0 .253.184l4.248.34a.3.3 0 0 1 .171.528L10.85 8.424a.3.3 0 0 0-.097.297l.99 4.145a.3.3 0 0 1-.45.326L7.657 10.97a.3.3 0 0 0-.312 0l-3.637 2.222a.3.3 0 0 1-.448-.326l.989-4.145a.3.3 0 0 0-.097-.297L.915 5.652a.3.3 0 0 1 .171-.527l4.248-.34a.3.3 0 0 0 .253-.185L7.223.666Z",
- fill: "currentColor"
- })));
- };
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SvgStarFilled);
- /***/ }),
- /***/ 37282:
- /***/ ((module) => {
- // Exports
- module.exports = {
- "container": "FormBuilder_container__7H_38",
- "inputContainer": "FormBuilder_inputContainer__v4ceB",
- "errorText": "FormBuilder_errorText__1uSsu",
- "submitButton": "FormBuilder_submitButton__4Wo4u"
- };
- /***/ }),
- /***/ 50794:
- /***/ ((module) => {
- // Exports
- module.exports = {
- "container": "Root_container__CQEHR"
- };
- /***/ }),
- /***/ 25162:
- /***/ ((module) => {
- // Exports
- module.exports = {
- "starButton": "Star_starButton__UeMsd",
- "selected": "Star_selected__M87yb"
- };
- /***/ }),
- /***/ 16926:
- /***/ ((module) => {
- // Exports
- module.exports = {
- "container": "TextArea_container__7anjD",
- "disabled": "TextArea_disabled__hBW2r",
- "error": "TextArea_error__JceFQ",
- "success": "TextArea_success__cfxk5",
- "warning": "TextArea_warning__fUWyl",
- "main": "TextArea_main__KBxzB",
- "input": "TextArea_input__SDMp4",
- "label": "TextArea_label__VLY9r"
- };
- /***/ }),
- /***/ 37013:
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(59003);
- /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var react_hook_form__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(45641);
- /* harmony import */ var _buildReactHookFormRules__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(32807);
- /* harmony import */ var _FormBuilder_module_scss__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(37282);
- /* harmony import */ var _FormBuilder_module_scss__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(_FormBuilder_module_scss__WEBPACK_IMPORTED_MODULE_10__);
- /* harmony import */ var _dls_Button_Button__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(50497);
- /* harmony import */ var _dls_Forms_Checkbox_Checkbox__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(42752);
- /* harmony import */ var _dls_Forms_Input__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(91308);
- /* harmony import */ var _dls_Forms_StarRating__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(19662);
- /* harmony import */ var _dls_Forms_TextArea__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(482);
- /* harmony import */ var _types_FormField__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(3840);
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([react_hook_form__WEBPACK_IMPORTED_MODULE_2__, _dls_Button_Button__WEBPACK_IMPORTED_MODULE_4__, _dls_Forms_Checkbox_Checkbox__WEBPACK_IMPORTED_MODULE_5__, _dls_Forms_Input__WEBPACK_IMPORTED_MODULE_6__, _dls_Forms_StarRating__WEBPACK_IMPORTED_MODULE_7__]);
- ([react_hook_form__WEBPACK_IMPORTED_MODULE_2__, _dls_Button_Button__WEBPACK_IMPORTED_MODULE_4__, _dls_Forms_Checkbox_Checkbox__WEBPACK_IMPORTED_MODULE_5__, _dls_Forms_Input__WEBPACK_IMPORTED_MODULE_6__, _dls_Forms_StarRating__WEBPACK_IMPORTED_MODULE_7__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
- /**
- * {@see https://legacy.reactjs.org/docs/jsx-in-depth.html#choosing-the-type-at-runtime}
- */ const FormFieldTypeToComponentMap = {
- [_types_FormField__WEBPACK_IMPORTED_MODULE_9__/* .FormFieldType.TextArea */ .E.TextArea]: _dls_Forms_TextArea__WEBPACK_IMPORTED_MODULE_8__/* ["default"] */ .ZP,
- [_types_FormField__WEBPACK_IMPORTED_MODULE_9__/* .FormFieldType.Text */ .E.Text]: _dls_Forms_Input__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .ZP,
- [_types_FormField__WEBPACK_IMPORTED_MODULE_9__/* .FormFieldType.Password */ .E.Password]: _dls_Forms_Input__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .ZP,
- [_types_FormField__WEBPACK_IMPORTED_MODULE_9__/* .FormFieldType.Phone */ .E.Phone]: _dls_Forms_Input__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .ZP,
- [_types_FormField__WEBPACK_IMPORTED_MODULE_9__/* .FormFieldType.Number */ .E.Number]: _dls_Forms_Input__WEBPACK_IMPORTED_MODULE_6__/* ["default"] */ .ZP,
- [_types_FormField__WEBPACK_IMPORTED_MODULE_9__/* .FormFieldType.Checkbox */ .E.Checkbox]: _dls_Forms_Checkbox_Checkbox__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z,
- [_types_FormField__WEBPACK_IMPORTED_MODULE_9__/* .FormFieldType.StarRating */ .E.StarRating]: _dls_Forms_StarRating__WEBPACK_IMPORTED_MODULE_7__/* ["default"] */ .Z
- };
- const isFieldTextInput = (type)=>{
- return [
- _types_FormField__WEBPACK_IMPORTED_MODULE_9__/* .FormFieldType.Text */ .E.Text,
- _types_FormField__WEBPACK_IMPORTED_MODULE_9__/* .FormFieldType.Password */ .E.Password,
- _types_FormField__WEBPACK_IMPORTED_MODULE_9__/* .FormFieldType.Phone */ .E.Phone,
- _types_FormField__WEBPACK_IMPORTED_MODULE_9__/* .FormFieldType.Number */ .E.Number,
- ].includes(type);
- };
- const FormBuilder = ({ formFields , onSubmit , actionText , actionProps ={} , isSubmitting , renderAction })=>{
- const { handleSubmit , control , setError } = (0,react_hook_form__WEBPACK_IMPORTED_MODULE_2__.useForm)({
- mode: "onBlur"
- });
- const internalOnSubmit = (data)=>{
- const onSubmitPromise = onSubmit(data);
- if (onSubmitPromise) {
- onSubmitPromise.then((errorData)=>{
- if (errorData && errorData?.errors) {
- Object.entries(errorData.errors).forEach(([field, errorMessage])=>{
- setError(field, {
- type: "manual",
- message: errorMessage
- });
- });
- }
- });
- }
- };
- return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("form", {
- className: (_FormBuilder_module_scss__WEBPACK_IMPORTED_MODULE_10___default().container),
- onSubmit: handleSubmit(internalOnSubmit),
- children: [
- formFields?.map((formField)=>{
- return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(react_hook_form__WEBPACK_IMPORTED_MODULE_2__.Controller, {
- control: control,
- defaultValue: formField.defaultValue,
- rules: (0,_buildReactHookFormRules__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z)(formField),
- name: formField.field,
- render: ({ field , fieldState: { error } })=>{
- const inputFieldProps = {
- key: formField.field,
- value: field.value,
- id: formField.field,
- name: formField.field,
- containerClassName: formField.containerClassName,
- fieldSetLegend: formField.fieldSetLegend,
- label: formField.label,
- placeholder: formField.placeholder,
- onChange: (val)=>{
- field.onChange(val);
- if (formField?.onChange) {
- formField.onChange(val);
- }
- },
- ...isFieldTextInput(formField.type) && {
- htmlType: formField.type,
- fixedWidth: false
- },
- ...formField.type === _types_FormField__WEBPACK_IMPORTED_MODULE_9__/* .FormFieldType.Checkbox */ .E.Checkbox && typeof formField.checked !== "undefined" && {
- checked: formField.checked
- }
- };
- const InputField = FormFieldTypeToComponentMap[formField.type];
- return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("div", {
- className: classnames__WEBPACK_IMPORTED_MODULE_1___default()((_FormBuilder_module_scss__WEBPACK_IMPORTED_MODULE_10___default().inputContainer), formField.containerClassName),
- children: [
- /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(InputField, {
- ...inputFieldProps
- }),
- error && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("span", {
- className: (_FormBuilder_module_scss__WEBPACK_IMPORTED_MODULE_10___default().errorText),
- children: error.message
- }),
- formField.extraSection && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
- children: formField.extraSection
- })
- ]
- });
- }
- }, formField.field);
- }),
- renderAction ? renderAction({
- htmlType: "submit",
- isLoading: isSubmitting,
- onClick: (e)=>{
- e.stopPropagation();
- }
- }) : /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_dls_Button_Button__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .ZP, {
- ...actionProps,
- htmlType: "submit",
- isLoading: isSubmitting,
- onClick: (e)=>{
- e.stopPropagation();
- },
- className: classnames__WEBPACK_IMPORTED_MODULE_1___default()((_FormBuilder_module_scss__WEBPACK_IMPORTED_MODULE_10___default().submitButton), actionProps.className),
- children: actionText
- })
- ]
- });
- };
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FormBuilder);
- __webpack_async_result__();
- } catch(e) { __webpack_async_result__(e); } });
- /***/ }),
- /***/ 32807:
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- /* harmony import */ var types_FieldRule__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(98213);
- /* eslint-disable react-func/max-lines-per-function */
- /**
- * 1) Check if the formField contains a `required` rule. If so, add a `required` rule to the React Hook Form rules
- * 2) Check if the formField contains `regex` rule. If so, try to test the regex against the `value` one by one
- * if one of test regex test fails, return the error message
- *
- * Note: The error message returned by this function is already translated using `t(validation.$errorId)`
- *
- * @param {FormField} formField
- * @returns {UseControllerProps['rules']} rules
- */ const buildReactHookFormRules = (formField)=>{
- const rules = {};
- const requiredRule = formField.rules?.find((rule)=>rule.type === types_FieldRule__WEBPACK_IMPORTED_MODULE_0__/* .RuleType.Required */ .S.Required && rule.value === true);
- // if contains a rule with type `required`
- if (requiredRule) {
- rules.required = {
- message: requiredRule.errorMessage,
- value: true
- };
- }
- const maximumLengthRule = formField.rules?.find((rule)=>rule.type === types_FieldRule__WEBPACK_IMPORTED_MODULE_0__/* .RuleType.MaximumLength */ .S.MaximumLength);
- if (maximumLengthRule) {
- rules.maxLength = {
- message: maximumLengthRule.errorMessage,
- value: maximumLengthRule.value
- };
- }
- const minimumLength = formField.rules?.find((rule)=>rule.type === types_FieldRule__WEBPACK_IMPORTED_MODULE_0__/* .RuleType.MinimumLength */ .S.MinimumLength);
- if (minimumLength) {
- rules.minLength = {
- message: minimumLength.errorMessage,
- value: minimumLength.value
- };
- }
- const regexValidations = formField.rules?.filter((rule)=>rule.type === types_FieldRule__WEBPACK_IMPORTED_MODULE_0__/* .RuleType.Regex */ .S.Regex);
- // if contains a rule with type `regex`
- if (regexValidations && regexValidations.length > 0) {
- rules.validate = {
- regex: (value)=>{
- const failedRule = regexValidations.find((rule)=>{
- const regex = new RegExp(rule.value);
- const isTestSucceed = regex.test(value);
- return !isTestSucceed;
- });
- if (failedRule) return failedRule.errorMessage;
- return null;
- }
- };
- }
- return rules;
- };
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (buildReactHookFormRules);
- /***/ }),
- /***/ 90568:
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- /* unused harmony export RadioRootOrientation */
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _radix_ui_react_radio_group__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(4086);
- /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(59003);
- /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _Root_module_scss__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(50794);
- /* harmony import */ var _Root_module_scss__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_Root_module_scss__WEBPACK_IMPORTED_MODULE_5__);
- /* harmony import */ var _hooks_useDirection__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(64365);
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_radix_ui_react_radio_group__WEBPACK_IMPORTED_MODULE_2__]);
- _radix_ui_react_radio_group__WEBPACK_IMPORTED_MODULE_2__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
- var RadioRootOrientation;
- (function(RadioRootOrientation) {
- RadioRootOrientation["Horizontal"] = "horizontal";
- RadioRootOrientation["Vertical"] = "vertical";
- })(RadioRootOrientation || (RadioRootOrientation = {}));
- const Root = ({ className , onChange , defaultValue , value , name , required , children , })=>{
- const direction = (0,_hooks_useDirection__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z)();
- return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_radix_ui_react_radio_group__WEBPACK_IMPORTED_MODULE_2__.Root, {
- className: classnames__WEBPACK_IMPORTED_MODULE_3___default()((_Root_module_scss__WEBPACK_IMPORTED_MODULE_5___default().container), className),
- dir: direction,
- ...onChange && {
- onValueChange: onChange
- },
- ...defaultValue && {
- defaultValue
- },
- ...value && {
- value
- },
- ...name && {
- name
- },
- ...required && {
- required
- },
- children: children
- });
- };
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Root);
- __webpack_async_result__();
- } catch(e) { __webpack_async_result__(e); } });
- /***/ }),
- /***/ 16599:
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _radix_ui_react_radio_group__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4086);
- /* harmony import */ var _radix_ui_react_visually_hidden__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(28560);
- /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(59003);
- /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__);
- /* harmony import */ var _Star_module_scss__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(25162);
- /* harmony import */ var _Star_module_scss__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(_Star_module_scss__WEBPACK_IMPORTED_MODULE_6__);
- /* harmony import */ var _icons_star_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(88426);
- /* harmony import */ var _icons_star_filled_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(99815);
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_radix_ui_react_radio_group__WEBPACK_IMPORTED_MODULE_1__, _radix_ui_react_visually_hidden__WEBPACK_IMPORTED_MODULE_2__]);
- ([_radix_ui_react_radio_group__WEBPACK_IMPORTED_MODULE_1__, _radix_ui_react_visually_hidden__WEBPACK_IMPORTED_MODULE_2__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
- const Star = ({ className , ...props })=>{
- const { value , currentValue } = props;
- const starValue = Number(value);
- const isCurrentStarSelected = starValue <= Number(currentValue);
- return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(_radix_ui_react_radio_group__WEBPACK_IMPORTED_MODULE_1__.Item, {
- className: classnames__WEBPACK_IMPORTED_MODULE_3___default()((_Star_module_scss__WEBPACK_IMPORTED_MODULE_6___default().starButton), className, {
- [(_Star_module_scss__WEBPACK_IMPORTED_MODULE_6___default().selected)]: isCurrentStarSelected
- }),
- ...props,
- children: [
- /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_radix_ui_react_visually_hidden__WEBPACK_IMPORTED_MODULE_2__.VisuallyHidden, {
- children: `${starValue} ${starValue === 1 ? "star" : "stars"}`
- }),
- isCurrentStarSelected ? /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_icons_star_filled_svg__WEBPACK_IMPORTED_MODULE_5__/* ["default"] */ .Z, {
- width: "30",
- height: "30"
- }) : /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_icons_star_svg__WEBPACK_IMPORTED_MODULE_4__/* ["default"] */ .Z, {
- width: "30",
- height: "30"
- })
- ]
- });
- };
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Star);
- __webpack_async_result__();
- } catch(e) { __webpack_async_result__(e); } });
- /***/ }),
- /***/ 19662:
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _Root__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(90568);
- /* harmony import */ var _Star__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(16599);
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_Root__WEBPACK_IMPORTED_MODULE_2__, _Star__WEBPACK_IMPORTED_MODULE_3__]);
- ([_Root__WEBPACK_IMPORTED_MODULE_2__, _Star__WEBPACK_IMPORTED_MODULE_3__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
- const StarRating = ({ maximumRating =5 , disabled =false , defaultValue ="1" , value , ...props })=>{
- return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_Root__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
- defaultValue: defaultValue,
- ...props,
- children: Array.from({
- length: maximumRating
- }, (_, index)=>{
- const starValue = index + 1;
- const starValueString = `${starValue}`;
- return /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx(_Star__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z, {
- currentValue: value,
- // @ts-ignore
- value: starValue,
- id: starValueString,
- disabled: disabled === true
- }, starValueString);
- })
- });
- };
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StarRating);
- __webpack_async_result__();
- } catch(e) { __webpack_async_result__(e); } });
- /***/ }),
- /***/ 482:
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "ZP": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- /* unused harmony exports TextAreaSize, TextAreaType, TextAreaVariant */
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(20997);
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16689);
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(59003);
- /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__);
- /* harmony import */ var _TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(16926);
- /* harmony import */ var _TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3__);
- var TextAreaSize;
- (function(TextAreaSize) {
- TextAreaSize["Small"] = "small";
- TextAreaSize["Medium"] = "medium";
- TextAreaSize["Large"] = "large";
- })(TextAreaSize || (TextAreaSize = {}));
- const SIZE_TO_COLS = {
- [TextAreaSize.Small]: 5,
- [TextAreaSize.Medium]: 10,
- [TextAreaSize.Large]: 25
- };
- var TextAreaType;
- (function(TextAreaType) {
- TextAreaType["Error"] = "error";
- TextAreaType["Warning"] = "warning";
- TextAreaType["Success"] = "success";
- })(TextAreaType || (TextAreaType = {}));
- var TextAreaVariant;
- (function(TextAreaVariant) {
- TextAreaVariant["Default"] = "default";
- TextAreaVariant["Main"] = "main";
- })(TextAreaVariant || (TextAreaVariant = {}));
- const TextArea = ({ id , name , label , placeholder , disabled =false , type , variant , onChange , value ="" , shouldFlipOnRTL =true , containerClassName , isRequired , inputRef , size =TextAreaSize.Medium , fieldSetLegend =null , })=>{
- const { 0: inputValue , 1: setTextAreaValue } = (0,react__WEBPACK_IMPORTED_MODULE_1__.useState)(value);
- // listen to any change in value in-case the value gets populated after an API call.
- (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(()=>{
- setTextAreaValue(value);
- }, [
- value
- ]);
- const onValueChange = (event)=>{
- const newValue = event.target.value;
- setTextAreaValue(newValue);
- if (onChange) {
- onChange(newValue);
- }
- };
- const content = /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.Fragment, {
- children: [
- label && /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("p", {
- className: (_TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3___default().label),
- children: label
- }),
- /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("div", {
- className: classnames__WEBPACK_IMPORTED_MODULE_2___default()((_TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3___default().container), containerClassName, {
- [(_TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3___default().disabled)]: disabled,
- [(_TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3___default().error)]: type === TextAreaType.Error,
- [(_TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3___default().success)]: type === TextAreaType.Success,
- [(_TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3___default().warning)]: type === TextAreaType.Warning,
- [(_TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3___default().main)]: variant === TextAreaVariant.Main
- }),
- children: /*#__PURE__*/ react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx("textarea", {
- className: classnames__WEBPACK_IMPORTED_MODULE_2___default()((_TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3___default().input), {
- [(_TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3___default().error)]: type === TextAreaType.Error,
- [(_TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3___default().success)]: type === TextAreaType.Success,
- [(_TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3___default().warning)]: type === TextAreaType.Warning,
- [(_TextArea_module_scss__WEBPACK_IMPORTED_MODULE_3___default().rtlTextArea)]: shouldFlipOnRTL
- }),
- required: isRequired,
- dir: "auto",
- id: id,
- rows: SIZE_TO_COLS[size],
- ref: inputRef,
- disabled: disabled,
- onChange: onValueChange,
- value: inputValue,
- ...placeholder && {
- placeholder
- },
- ...name && {
- name
- }
- })
- })
- ]
- });
- if (fieldSetLegend) {
- return /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("fieldset", {
- children: [
- /*#__PURE__*/ (0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsxs)("legend", {
- children: [
- " ",
- fieldSetLegend,
- " "
- ]
- }),
- content
- ]
- });
- }
- return content;
- };
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (TextArea);
- /***/ }),
- /***/ 98213:
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "S": () => (/* binding */ RuleType)
- /* harmony export */ });
- var RuleType;
- (function(RuleType) {
- RuleType["Required"] = "required";
- RuleType["Regex"] = "regex";
- RuleType["MaximumLength"] = "maxLength";
- RuleType["MinimumLength"] = "minLength";
- })(RuleType || (RuleType = {}));
- /***/ }),
- /***/ 3840:
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
- "use strict";
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "E": () => (/* binding */ FormFieldType)
- /* harmony export */ });
- var FormFieldType;
- (function(FormFieldType) {
- FormFieldType["Text"] = "text";
- FormFieldType["Password"] = "password";
- FormFieldType["Phone"] = "phone";
- FormFieldType["Number"] = "number";
- FormFieldType["TextArea"] = "textarea";
- FormFieldType["Checkbox"] = "checkbox";
- FormFieldType["StarRating"] = "starRating";
- })(FormFieldType || (FormFieldType = {}));
- /***/ })
- };
- ;
- //# sourceMappingURL=37013.js.map
|