@rufous/ui 0.1.63 → 0.2.0-beta.1
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 +4 -0
- package/dist/Buttons/addButton.js +1 -0
- package/dist/Buttons/cancelButton.js +1 -0
- package/dist/Buttons/index.cjs +2 -2
- package/dist/Buttons/index.js +3 -2
- package/dist/Buttons/stdButton.js +1 -0
- package/dist/Buttons/submitButton.cjs +2 -2
- package/dist/Buttons/submitButton.js +3 -2
- package/dist/CheckBoxes/CheckBox.cjs +2 -2
- package/dist/CheckBoxes/CheckBox.js +4 -25
- package/dist/Contexts/rufousThemeProvider.cjs +132 -100
- package/dist/Contexts/rufousThemeProvider.js +3 -2
- package/dist/DataGrid/DataGrid.cjs +418 -0
- package/dist/DataGrid/DataGrid.d.cts +8 -0
- package/dist/DataGrid/DataGrid.d.ts +8 -0
- package/dist/DataGrid/DataGrid.js +9 -0
- package/dist/DataGrid/index.cjs +418 -0
- package/dist/DataGrid/index.d.cts +3 -0
- package/dist/DataGrid/index.d.ts +3 -0
- package/dist/DataGrid/index.js +8 -0
- package/dist/{TextFields/FloatingInput.d.cjs → DataGrid/types.cjs} +3 -3
- package/dist/DataGrid/types.d.cts +31 -0
- package/dist/DataGrid/types.d.ts +31 -0
- package/dist/Dialogs/BaseDialog.cjs +18 -10
- package/dist/Dialogs/BaseDialog.css +8355 -162
- package/dist/Dialogs/BaseDialog.d.cts +1 -0
- package/dist/Dialogs/BaseDialog.d.ts +1 -0
- package/dist/Dialogs/BaseDialog.js +33 -25
- package/dist/Dialogs/index.cjs +18 -10
- package/dist/Dialogs/index.css +8355 -162
- package/dist/Dialogs/index.js +33 -25
- package/dist/Editors/RichTextEditor.cjs +29477 -0
- package/dist/Editors/RichTextEditor.css +7179 -0
- package/dist/Editors/RichTextEditor.d.cts +57 -0
- package/dist/Editors/RichTextEditor.d.ts +57 -0
- package/dist/Editors/RichTextEditor.js +9 -0
- package/dist/Editors/index.cjs +29477 -0
- package/dist/Editors/index.css +7179 -0
- package/dist/Editors/index.d.cts +2 -0
- package/dist/Editors/index.d.ts +2 -0
- package/dist/Editors/index.js +8 -0
- package/dist/Progress/circularProgress.cjs +2 -2
- package/dist/Progress/circularProgress.d.cts +3 -3
- package/dist/Progress/circularProgress.d.ts +3 -3
- package/dist/Progress/circularProgress.js +2 -1
- package/dist/TextFields/AddressLookup.cjs +390 -0
- package/dist/TextFields/AddressLookup.d.cts +49 -0
- package/dist/TextFields/AddressLookup.d.ts +49 -0
- package/dist/TextFields/AddressLookup.js +11 -0
- package/dist/TextFields/FloatingInput.cjs +6 -4
- package/dist/TextFields/FloatingInput.d.cts +13 -19
- package/dist/TextFields/FloatingInput.d.ts +13 -19
- package/dist/TextFields/FloatingInput.js +4 -28
- package/dist/{chunk-AQXTOTWY.js → chunk-5DAOQ2V5.js} +19 -11
- package/dist/chunk-5QEWUCKT.js +303 -0
- package/dist/chunk-66HHM7VI.js +468 -0
- package/dist/chunk-7KRG7VNW.js +0 -0
- package/dist/{chunk-YRFUVQDN.js → chunk-CTBYVXFP.js} +2 -2
- package/dist/chunk-GJGRMMAQ.js +0 -0
- package/dist/chunk-HMG3FW2Q.js +97 -0
- package/dist/chunk-J6E3UO2W.js +402 -0
- package/dist/chunk-LI4N7JWK.js +39 -0
- package/dist/chunk-NEGQXBQV.js +29 -0
- package/dist/chunk-UPCMMCPQ.js +34 -0
- package/dist/{chunk-7YKG3WYS.js → chunk-YRLN3TBF.js} +1 -1
- package/dist/chunk-YXPBXCY5.js +89 -0
- package/dist/esm-5T53WHPT.js +27362 -0
- package/dist/icons/activateUserIcon.js +1 -0
- package/dist/icons/archivedIcon.js +1 -0
- package/dist/icons/assignGroupIcon.js +1 -0
- package/dist/icons/closeIcon.js +1 -0
- package/dist/icons/copyIcon.js +1 -0
- package/dist/icons/difficultyAllIcon.js +1 -0
- package/dist/icons/difficultyEasyIcon.js +1 -0
- package/dist/icons/difficultyHardIcon.js +1 -0
- package/dist/icons/difficultyMediumIcon.js +1 -0
- package/dist/icons/dollarIcon.js +1 -0
- package/dist/icons/downloadIcon.js +1 -0
- package/dist/icons/downloadPdfIcon.js +1 -0
- package/dist/icons/editChatIcon.js +1 -0
- package/dist/icons/editIcon.js +1 -0
- package/dist/icons/engagementIcon.js +1 -0
- package/dist/icons/functionIcon.js +1 -0
- package/dist/icons/helpOutlinedIcon.js +1 -0
- package/dist/icons/hierarchyIcon.js +1 -0
- package/dist/icons/inactiveGroupIcon.js +1 -0
- package/dist/icons/index.js +48 -47
- package/dist/icons/industryIcon.js +1 -0
- package/dist/icons/invoiceIcon.js +1 -0
- package/dist/icons/locationPinIcon.js +1 -0
- package/dist/icons/logsIcon.js +1 -0
- package/dist/icons/minExperienceIcon.js +1 -0
- package/dist/icons/nineDotMenuIcon.js +1 -0
- package/dist/icons/notificationIcon.js +1 -0
- package/dist/icons/projectIcon.js +1 -0
- package/dist/icons/qualificationsIcon.js +1 -0
- package/dist/icons/questionStatusAllIcon.js +1 -0
- package/dist/icons/questionStatusPrivateIcon.js +1 -0
- package/dist/icons/questionStatusPublicIcon.js +1 -0
- package/dist/icons/questionTypeAllIcon.js +1 -0
- package/dist/icons/questionTypeCodingIcon.js +1 -0
- package/dist/icons/questionTypeDescriptiveIcon.js +1 -0
- package/dist/icons/questionTypeMultipleIcon.js +1 -0
- package/dist/icons/questionTypeSingleIcon.js +1 -0
- package/dist/icons/refreshIcon.js +1 -0
- package/dist/icons/resendInviteIcon.js +1 -0
- package/dist/icons/rolesIcon.js +1 -0
- package/dist/icons/rufousAiIcon.js +1 -0
- package/dist/icons/rufousBirdIcon.js +1 -0
- package/dist/icons/rufousLauncherBird.js +1 -0
- package/dist/icons/sidebarIcon.js +1 -0
- package/dist/icons/softSkillsIcon.js +1 -0
- package/dist/icons/subscribeIcon.js +1 -0
- package/dist/icons/suspendUserIcon.js +1 -0
- package/dist/icons/technicalSkillsIcon.js +1 -0
- package/dist/icons/tickIcon.js +1 -0
- package/dist/icons/timerIcon.js +1 -0
- package/dist/icons/trashIcon.js +1 -0
- package/dist/icons/unArchivedIcon.js +1 -0
- package/dist/icons/unsubscribeIcon.js +1 -0
- package/dist/icons/uploadIcon.js +1 -0
- package/dist/icons/userAssignIcon.js +1 -0
- package/dist/icons/viewIcon.js +1 -0
- package/dist/icons/workItemIcon.js +1 -0
- package/dist/main.cjs +30440 -222
- package/dist/main.css +8355 -162
- package/dist/main.d.cts +7 -0
- package/dist/main.d.ts +7 -0
- package/dist/main.js +82 -56
- package/dist/style.css +1068 -163
- package/dist/styles/address-lookup.css +107 -0
- package/dist/styles/address-lookup.d.cts +2 -0
- package/dist/styles/address-lookup.d.ts +2 -0
- package/dist/styles/button.css +82 -110
- package/dist/styles/checkbox.css +60 -0
- package/dist/styles/checkbox.d.cts +2 -0
- package/dist/styles/checkbox.d.ts +2 -0
- package/dist/styles/datagrid.css +531 -0
- package/dist/styles/datagrid.d.cts +2 -0
- package/dist/styles/datagrid.d.ts +2 -0
- package/dist/styles/dialog.css +78 -51
- package/dist/styles/editor.css +211 -0
- package/dist/styles/editor.d.cts +2 -0
- package/dist/styles/editor.d.ts +2 -0
- package/dist/utils/constants.cjs +75 -69
- package/dist/utils/constants.d.cts +54 -56
- package/dist/utils/constants.d.ts +54 -56
- package/dist/utils/constants.js +2 -1
- package/package.json +13 -2
- package/dist/TextFields/FloatingInput.d.d.cts +0 -23
- package/dist/TextFields/FloatingInput.d.d.ts +0 -23
- package/dist/chunk-2FHTGYR4.js +0 -83
- package/dist/chunk-BCGCLMKA.js +0 -71
- /package/dist/{TextFields/FloatingInput.d.js → DataGrid/types.js} +0 -0
|
@@ -33,7 +33,7 @@ __export(circularProgress_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(circularProgress_exports);
|
|
35
35
|
var React = __toESM(require("react"), 1);
|
|
36
|
-
var
|
|
36
|
+
var CircularProgress = ({
|
|
37
37
|
size = 50,
|
|
38
38
|
color = "#a81c08",
|
|
39
39
|
...props
|
|
@@ -57,4 +57,4 @@ var CircularProgess = ({
|
|
|
57
57
|
))
|
|
58
58
|
);
|
|
59
59
|
};
|
|
60
|
-
var circularProgress_default =
|
|
60
|
+
var circularProgress_default = CircularProgress;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface CircularProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
size?: number;
|
|
5
5
|
color?: string;
|
|
6
6
|
}
|
|
7
|
-
declare const
|
|
7
|
+
declare const CircularProgress: React.FC<CircularProgressProps>;
|
|
8
8
|
|
|
9
|
-
export { type
|
|
9
|
+
export { type CircularProgressProps, CircularProgress as default };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
interface
|
|
3
|
+
interface CircularProgressProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
size?: number;
|
|
5
5
|
color?: string;
|
|
6
6
|
}
|
|
7
|
-
declare const
|
|
7
|
+
declare const CircularProgress: React.FC<CircularProgressProps>;
|
|
8
8
|
|
|
9
|
-
export { type
|
|
9
|
+
export { type CircularProgressProps, CircularProgress as default };
|
|
@@ -0,0 +1,390 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// lib/TextFields/AddressLookup.tsx
|
|
30
|
+
var AddressLookup_exports = {};
|
|
31
|
+
__export(AddressLookup_exports, {
|
|
32
|
+
default: () => AddressLookup_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(AddressLookup_exports);
|
|
35
|
+
var import_react3 = __toESM(require("react"), 1);
|
|
36
|
+
var import_axios = __toESM(require("axios"), 1);
|
|
37
|
+
|
|
38
|
+
// lib/Contexts/rufousThemeProvider.tsx
|
|
39
|
+
var import_react = __toESM(require("react"), 1);
|
|
40
|
+
var RufousThemeContext = (0, import_react.createContext)(null);
|
|
41
|
+
var useRufousTheme = () => (0, import_react.useContext)(RufousThemeContext);
|
|
42
|
+
|
|
43
|
+
// lib/TextFields/AddressLookup.tsx
|
|
44
|
+
var import_country_state_city = require("country-state-city");
|
|
45
|
+
|
|
46
|
+
// lib/TextFields/FloatingInput.tsx
|
|
47
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
48
|
+
var FloatingInput = ({
|
|
49
|
+
label,
|
|
50
|
+
name,
|
|
51
|
+
id,
|
|
52
|
+
type = "text",
|
|
53
|
+
value,
|
|
54
|
+
onChange,
|
|
55
|
+
required = false,
|
|
56
|
+
placeholder,
|
|
57
|
+
className = "",
|
|
58
|
+
style,
|
|
59
|
+
...props
|
|
60
|
+
}) => {
|
|
61
|
+
return /* @__PURE__ */ import_react2.default.createElement("div", { className: `form__group field ${className}`, style }, /* @__PURE__ */ import_react2.default.createElement(
|
|
62
|
+
"input",
|
|
63
|
+
{
|
|
64
|
+
type,
|
|
65
|
+
className: "form__field",
|
|
66
|
+
placeholder: " ",
|
|
67
|
+
name,
|
|
68
|
+
id: id || name,
|
|
69
|
+
value,
|
|
70
|
+
onChange,
|
|
71
|
+
required,
|
|
72
|
+
...props
|
|
73
|
+
}
|
|
74
|
+
), /* @__PURE__ */ import_react2.default.createElement("label", { htmlFor: id || name, className: "form__label" }, label));
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
// lib/Progress/circularProgress.tsx
|
|
78
|
+
var React3 = __toESM(require("react"), 1);
|
|
79
|
+
var CircularProgress = ({
|
|
80
|
+
size = 50,
|
|
81
|
+
color = "#a81c08",
|
|
82
|
+
...props
|
|
83
|
+
}) => {
|
|
84
|
+
return /* @__PURE__ */ React3.createElement(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
className: "rufous-loader",
|
|
88
|
+
style: { width: size, height: size },
|
|
89
|
+
...props
|
|
90
|
+
},
|
|
91
|
+
/* @__PURE__ */ React3.createElement("svg", { viewBox: "0 0 100 100" }, /* @__PURE__ */ React3.createElement(
|
|
92
|
+
"circle",
|
|
93
|
+
{
|
|
94
|
+
className: "rufous-loader-circle",
|
|
95
|
+
cx: "50",
|
|
96
|
+
cy: "50",
|
|
97
|
+
r: "45",
|
|
98
|
+
stroke: color
|
|
99
|
+
}
|
|
100
|
+
))
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
var circularProgress_default = CircularProgress;
|
|
104
|
+
|
|
105
|
+
// lib/TextFields/AddressLookup.tsx
|
|
106
|
+
var AddressLookup = ({
|
|
107
|
+
value = {},
|
|
108
|
+
onChange = () => {
|
|
109
|
+
},
|
|
110
|
+
label = "Address",
|
|
111
|
+
error = {},
|
|
112
|
+
size = "medium",
|
|
113
|
+
sx = {},
|
|
114
|
+
layout = "stack",
|
|
115
|
+
required = false,
|
|
116
|
+
token = ""
|
|
117
|
+
}) => {
|
|
118
|
+
const { theme } = useRufousTheme();
|
|
119
|
+
const [suggestions, setSuggestions] = (0, import_react3.useState)([]);
|
|
120
|
+
const [loading, setLoading] = (0, import_react3.useState)(false);
|
|
121
|
+
const [showSuggestions, setShowSuggestions] = (0, import_react3.useState)(false);
|
|
122
|
+
const [googleFields, setGoogleFields] = (0, import_react3.useState)({
|
|
123
|
+
country: false,
|
|
124
|
+
state: false,
|
|
125
|
+
city: false,
|
|
126
|
+
pincode: false
|
|
127
|
+
});
|
|
128
|
+
const debounceTimeout = (0, import_react3.useRef)(null);
|
|
129
|
+
const containerRef = (0, import_react3.useRef)(null);
|
|
130
|
+
const apiKey = token || "";
|
|
131
|
+
const countries = import_country_state_city.Country.getAllCountries();
|
|
132
|
+
const [states, setStates] = (0, import_react3.useState)([]);
|
|
133
|
+
const [cities, setCities] = (0, import_react3.useState)([]);
|
|
134
|
+
(0, import_react3.useEffect)(() => {
|
|
135
|
+
const handleClickOutside = (event) => {
|
|
136
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
137
|
+
setShowSuggestions(false);
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
141
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
142
|
+
}, []);
|
|
143
|
+
(0, import_react3.useEffect)(() => {
|
|
144
|
+
if (value.country || value.state || value.city || value.pincode) {
|
|
145
|
+
setGoogleFields({
|
|
146
|
+
country: !!value.country,
|
|
147
|
+
state: !!value.state,
|
|
148
|
+
city: !!value.city,
|
|
149
|
+
pincode: !!value.pincode
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
}, []);
|
|
153
|
+
(0, import_react3.useEffect)(() => {
|
|
154
|
+
if (value.country) {
|
|
155
|
+
const country = countries.find((c) => c.name === value.country);
|
|
156
|
+
if (country) {
|
|
157
|
+
const stateList = import_country_state_city.State.getStatesOfCountry(country.isoCode);
|
|
158
|
+
setStates(stateList);
|
|
159
|
+
} else {
|
|
160
|
+
setStates([]);
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
setStates([]);
|
|
164
|
+
}
|
|
165
|
+
}, [value.country]);
|
|
166
|
+
(0, import_react3.useEffect)(() => {
|
|
167
|
+
if (value.state && value.country) {
|
|
168
|
+
const country = countries.find((c) => c.name === value.country);
|
|
169
|
+
if (country) {
|
|
170
|
+
const state = import_country_state_city.State.getStatesOfCountry(country.isoCode).find((s) => s.name === value.state);
|
|
171
|
+
if (state) {
|
|
172
|
+
const cityList = import_country_state_city.City.getCitiesOfState(country.isoCode, state.isoCode);
|
|
173
|
+
setCities(cityList);
|
|
174
|
+
} else {
|
|
175
|
+
setCities([]);
|
|
176
|
+
}
|
|
177
|
+
} else {
|
|
178
|
+
setCities([]);
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
setCities([]);
|
|
182
|
+
}
|
|
183
|
+
}, [value.state, value.country]);
|
|
184
|
+
const handleChange = (field, newVal) => {
|
|
185
|
+
onChange({
|
|
186
|
+
...value,
|
|
187
|
+
[field]: newVal
|
|
188
|
+
});
|
|
189
|
+
};
|
|
190
|
+
const fetchPlaceDetails = async (placeId, mainText = "") => {
|
|
191
|
+
if (!apiKey) {
|
|
192
|
+
console.warn("Google Places API Key (token) is missing.");
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
setLoading(true);
|
|
196
|
+
try {
|
|
197
|
+
const res = await import_axios.default.get(
|
|
198
|
+
`https://places.googleapis.com/v1/places/${placeId}`,
|
|
199
|
+
{
|
|
200
|
+
headers: {
|
|
201
|
+
"Content-Type": "application/json",
|
|
202
|
+
"X-Goog-Api-Key": apiKey,
|
|
203
|
+
"X-Goog-FieldMask": "addressComponents,formattedAddress"
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
);
|
|
207
|
+
const comps = res.data.addressComponents || [];
|
|
208
|
+
const findComp = (type) => comps.find((c) => c.types.includes(type))?.longText || "";
|
|
209
|
+
const city = findComp("locality") || findComp("sublocality_level_1");
|
|
210
|
+
const state = findComp("administrative_area_level_1");
|
|
211
|
+
const country = findComp("country");
|
|
212
|
+
const pincode = findComp("postal_code");
|
|
213
|
+
setGoogleFields({
|
|
214
|
+
country: !!country,
|
|
215
|
+
state: !!state,
|
|
216
|
+
city: !!city,
|
|
217
|
+
pincode: !!pincode
|
|
218
|
+
});
|
|
219
|
+
const updatedData = {
|
|
220
|
+
...value,
|
|
221
|
+
addressLine1: mainText || value.addressLine1,
|
|
222
|
+
addressLine2: res.data.formattedAddress || value.addressLine2,
|
|
223
|
+
city,
|
|
224
|
+
state,
|
|
225
|
+
country,
|
|
226
|
+
pincode
|
|
227
|
+
};
|
|
228
|
+
onChange(updatedData);
|
|
229
|
+
setShowSuggestions(false);
|
|
230
|
+
} catch (err) {
|
|
231
|
+
console.error("Error fetching place details:", err);
|
|
232
|
+
} finally {
|
|
233
|
+
setLoading(false);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
const handleQuerySuggestions = async (query) => {
|
|
237
|
+
if (!apiKey || !query || query.length < 3) {
|
|
238
|
+
setSuggestions([]);
|
|
239
|
+
setShowSuggestions(false);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
setLoading(true);
|
|
243
|
+
try {
|
|
244
|
+
const res = await import_axios.default.post(
|
|
245
|
+
`https://places.googleapis.com/v1/places:autocomplete`,
|
|
246
|
+
{ input: query },
|
|
247
|
+
{
|
|
248
|
+
headers: {
|
|
249
|
+
"Content-Type": "application/json",
|
|
250
|
+
"X-Goog-Api-Key": apiKey
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
);
|
|
254
|
+
setSuggestions(res.data.suggestions || []);
|
|
255
|
+
setShowSuggestions(true);
|
|
256
|
+
} catch (err) {
|
|
257
|
+
console.error("Autocomplete Error:", err);
|
|
258
|
+
} finally {
|
|
259
|
+
setLoading(false);
|
|
260
|
+
}
|
|
261
|
+
};
|
|
262
|
+
const handleCountryChange = (newCountry) => {
|
|
263
|
+
onChange({
|
|
264
|
+
...value,
|
|
265
|
+
country: newCountry,
|
|
266
|
+
state: "",
|
|
267
|
+
city: ""
|
|
268
|
+
});
|
|
269
|
+
setGoogleFields({ ...googleFields, country: false, state: false, city: false });
|
|
270
|
+
};
|
|
271
|
+
const handleStateChange = (newState) => {
|
|
272
|
+
onChange({
|
|
273
|
+
...value,
|
|
274
|
+
state: newState,
|
|
275
|
+
city: ""
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
return /* @__PURE__ */ import_react3.default.createElement("div", { className: "address-lookup-container", style: sx, ref: containerRef }, /* @__PURE__ */ import_react3.default.createElement("div", { className: `address-lookup-grid address-lookup-grid-${layout}` }, /* @__PURE__ */ import_react3.default.createElement("div", { className: "address-lookup-grid-item col-l1" }, /* @__PURE__ */ import_react3.default.createElement(
|
|
279
|
+
FloatingInput,
|
|
280
|
+
{
|
|
281
|
+
label,
|
|
282
|
+
name: "addressLine1",
|
|
283
|
+
value: value.addressLine1 || "",
|
|
284
|
+
required,
|
|
285
|
+
autoComplete: "off",
|
|
286
|
+
onChange: (e) => {
|
|
287
|
+
const val = e.target.value;
|
|
288
|
+
handleChange("addressLine1", val);
|
|
289
|
+
if (!val) {
|
|
290
|
+
onChange({
|
|
291
|
+
...value,
|
|
292
|
+
addressLine1: "",
|
|
293
|
+
city: "",
|
|
294
|
+
state: "",
|
|
295
|
+
country: "",
|
|
296
|
+
pincode: ""
|
|
297
|
+
});
|
|
298
|
+
setSuggestions([]);
|
|
299
|
+
setShowSuggestions(false);
|
|
300
|
+
setGoogleFields({ country: false, state: false, city: false, pincode: false });
|
|
301
|
+
} else {
|
|
302
|
+
if (debounceTimeout.current) clearTimeout(debounceTimeout.current);
|
|
303
|
+
debounceTimeout.current = setTimeout(() => {
|
|
304
|
+
handleQuerySuggestions(val);
|
|
305
|
+
}, 500);
|
|
306
|
+
}
|
|
307
|
+
},
|
|
308
|
+
onFocus: () => suggestions.length > 0 && setShowSuggestions(true)
|
|
309
|
+
}
|
|
310
|
+
), loading && /* @__PURE__ */ import_react3.default.createElement("div", { className: "loading-indicator" }, /* @__PURE__ */ import_react3.default.createElement(circularProgress_default, { size: 20 })), showSuggestions && suggestions.length > 0 && /* @__PURE__ */ import_react3.default.createElement("div", { className: "autocomplete-dropdown" }, suggestions.map((option, idx) => /* @__PURE__ */ import_react3.default.createElement(
|
|
311
|
+
"div",
|
|
312
|
+
{
|
|
313
|
+
key: idx,
|
|
314
|
+
className: "autocomplete-option",
|
|
315
|
+
onClick: () => {
|
|
316
|
+
const mainText = option?.placePrediction?.structuredFormat?.mainText?.text || "";
|
|
317
|
+
handleChange("addressLine1", mainText);
|
|
318
|
+
fetchPlaceDetails(option.placePrediction.placeId, mainText);
|
|
319
|
+
}
|
|
320
|
+
},
|
|
321
|
+
/* @__PURE__ */ import_react3.default.createElement("div", { className: "autocomplete-main-text" }, option?.placePrediction?.structuredFormat?.mainText?.text),
|
|
322
|
+
/* @__PURE__ */ import_react3.default.createElement("div", { className: "autocomplete-secondary-text" }, option?.placePrediction?.structuredFormat?.secondaryText?.text)
|
|
323
|
+
))), error.addressLine1 && /* @__PURE__ */ import_react3.default.createElement("div", { className: "field-error-text" }, error.addressLine1)), layout === "compact" && /* @__PURE__ */ import_react3.default.createElement("div", { className: "address-lookup-grid-item col-l2" }, /* @__PURE__ */ import_react3.default.createElement(
|
|
324
|
+
FloatingInput,
|
|
325
|
+
{
|
|
326
|
+
label: "Address Line 2",
|
|
327
|
+
name: "addressLine2",
|
|
328
|
+
value: value.addressLine2 || "",
|
|
329
|
+
onChange: (e) => handleChange("addressLine2", e.target.value)
|
|
330
|
+
}
|
|
331
|
+
)), layout !== "compact" && /* @__PURE__ */ import_react3.default.createElement("div", { className: "address-lookup-grid-item col-l2" }, /* @__PURE__ */ import_react3.default.createElement(
|
|
332
|
+
FloatingInput,
|
|
333
|
+
{
|
|
334
|
+
label: "Address Line 2",
|
|
335
|
+
name: "addressLine2",
|
|
336
|
+
value: value.addressLine2 || "",
|
|
337
|
+
onChange: (e) => handleChange("addressLine2", e.target.value)
|
|
338
|
+
}
|
|
339
|
+
)), /* @__PURE__ */ import_react3.default.createElement("div", { className: "address-lookup-grid-item col-country" }, /* @__PURE__ */ import_react3.default.createElement(
|
|
340
|
+
FloatingInput,
|
|
341
|
+
{
|
|
342
|
+
label: "Country",
|
|
343
|
+
name: "country",
|
|
344
|
+
value: value.country || "",
|
|
345
|
+
required,
|
|
346
|
+
className: googleFields.country && value.country ? "field-disabled" : "",
|
|
347
|
+
readOnly: googleFields.country && !!value.country,
|
|
348
|
+
onChange: (e) => handleCountryChange(e.target.value),
|
|
349
|
+
list: "countries-list"
|
|
350
|
+
}
|
|
351
|
+
), /* @__PURE__ */ import_react3.default.createElement("datalist", { id: "countries-list" }, countries.map((c) => /* @__PURE__ */ import_react3.default.createElement("option", { key: c.isoCode, value: c.name }))), error.country && /* @__PURE__ */ import_react3.default.createElement("div", { className: "field-error-text" }, error.country)), /* @__PURE__ */ import_react3.default.createElement("div", { className: "address-lookup-grid-item col-state" }, /* @__PURE__ */ import_react3.default.createElement(
|
|
352
|
+
FloatingInput,
|
|
353
|
+
{
|
|
354
|
+
label: "State",
|
|
355
|
+
name: "state",
|
|
356
|
+
value: value.state || "",
|
|
357
|
+
required,
|
|
358
|
+
disabled: !value.country,
|
|
359
|
+
className: googleFields.state && value.state ? "field-disabled" : "",
|
|
360
|
+
readOnly: googleFields.state && !!value.state,
|
|
361
|
+
onChange: (e) => handleStateChange(e.target.value),
|
|
362
|
+
list: "states-list"
|
|
363
|
+
}
|
|
364
|
+
), /* @__PURE__ */ import_react3.default.createElement("datalist", { id: "states-list" }, states.map((s) => /* @__PURE__ */ import_react3.default.createElement("option", { key: s.isoCode, value: s.name }))), error.state && /* @__PURE__ */ import_react3.default.createElement("div", { className: "field-error-text" }, error.state)), /* @__PURE__ */ import_react3.default.createElement("div", { className: "address-lookup-grid-item col-city" }, /* @__PURE__ */ import_react3.default.createElement(
|
|
365
|
+
FloatingInput,
|
|
366
|
+
{
|
|
367
|
+
label: "City",
|
|
368
|
+
name: "city",
|
|
369
|
+
value: value.city || "",
|
|
370
|
+
required,
|
|
371
|
+
disabled: !value.state,
|
|
372
|
+
className: googleFields.city && value.city ? "field-disabled" : "",
|
|
373
|
+
readOnly: googleFields.city && !!value.city,
|
|
374
|
+
onChange: (e) => handleChange("city", e.target.value),
|
|
375
|
+
list: "cities-list"
|
|
376
|
+
}
|
|
377
|
+
), /* @__PURE__ */ import_react3.default.createElement("datalist", { id: "cities-list" }, cities.map((c, i) => /* @__PURE__ */ import_react3.default.createElement("option", { key: i, value: c.name }))), error.city && /* @__PURE__ */ import_react3.default.createElement("div", { className: "field-error-text" }, error.city)), /* @__PURE__ */ import_react3.default.createElement("div", { className: "address-lookup-grid-item col-pin" }, /* @__PURE__ */ import_react3.default.createElement(
|
|
378
|
+
FloatingInput,
|
|
379
|
+
{
|
|
380
|
+
label: "Pincode",
|
|
381
|
+
name: "pincode",
|
|
382
|
+
value: value.pincode || "",
|
|
383
|
+
required,
|
|
384
|
+
className: googleFields.pincode && value.pincode ? "field-disabled" : "",
|
|
385
|
+
readOnly: googleFields.pincode && !!value.pincode,
|
|
386
|
+
onChange: (e) => handleChange("pincode", e.target.value)
|
|
387
|
+
}
|
|
388
|
+
), error.pincode && /* @__PURE__ */ import_react3.default.createElement("div", { className: "field-error-text" }, error.pincode))));
|
|
389
|
+
};
|
|
390
|
+
var AddressLookup_default = AddressLookup;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React__default, { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
interface AddressValue {
|
|
4
|
+
addressLine1?: string;
|
|
5
|
+
addressLine2?: string;
|
|
6
|
+
city?: string;
|
|
7
|
+
state?: string;
|
|
8
|
+
country?: string;
|
|
9
|
+
pincode?: string;
|
|
10
|
+
}
|
|
11
|
+
interface AddressError {
|
|
12
|
+
addressLine1?: string;
|
|
13
|
+
addressLine2?: string;
|
|
14
|
+
city?: string;
|
|
15
|
+
state?: string;
|
|
16
|
+
country?: string;
|
|
17
|
+
pincode?: string;
|
|
18
|
+
}
|
|
19
|
+
interface AddressLookupProps {
|
|
20
|
+
/** Current address value object */
|
|
21
|
+
value?: AddressValue;
|
|
22
|
+
/** Callback fired when any address field changes */
|
|
23
|
+
onChange?: (value: AddressValue) => void;
|
|
24
|
+
/** Label for the primary address search field */
|
|
25
|
+
label?: string;
|
|
26
|
+
/** Validation error messages per field */
|
|
27
|
+
error?: AddressError;
|
|
28
|
+
/** Size variant */
|
|
29
|
+
size?: "small" | "medium" | "large";
|
|
30
|
+
/** Inline style overrides for the container */
|
|
31
|
+
sx?: CSSProperties;
|
|
32
|
+
/** Layout mode: "stack" | "compact" | "grid" */
|
|
33
|
+
layout?: "stack" | "compact" | "grid";
|
|
34
|
+
/** Whether address fields are required */
|
|
35
|
+
required?: boolean;
|
|
36
|
+
/** Google Places API Key */
|
|
37
|
+
token?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* AddressLookup Component (MUI-Free Version)
|
|
41
|
+
* @param value - { addressLine1, addressLine2, city, state, country, pincode }
|
|
42
|
+
* @param onChange - Returns the full updated object
|
|
43
|
+
* @param layout - "stack" | "compact" | "grid"
|
|
44
|
+
* @param sx - Style overrides for the container
|
|
45
|
+
* @param token - Google Places API Key
|
|
46
|
+
*/
|
|
47
|
+
declare const AddressLookup: ({ value, onChange, label, error, size, sx, layout, required, token, }: AddressLookupProps) => React__default.JSX.Element;
|
|
48
|
+
|
|
49
|
+
export { type AddressError, type AddressLookupProps, type AddressValue, AddressLookup as default };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React__default, { CSSProperties } from 'react';
|
|
2
|
+
|
|
3
|
+
interface AddressValue {
|
|
4
|
+
addressLine1?: string;
|
|
5
|
+
addressLine2?: string;
|
|
6
|
+
city?: string;
|
|
7
|
+
state?: string;
|
|
8
|
+
country?: string;
|
|
9
|
+
pincode?: string;
|
|
10
|
+
}
|
|
11
|
+
interface AddressError {
|
|
12
|
+
addressLine1?: string;
|
|
13
|
+
addressLine2?: string;
|
|
14
|
+
city?: string;
|
|
15
|
+
state?: string;
|
|
16
|
+
country?: string;
|
|
17
|
+
pincode?: string;
|
|
18
|
+
}
|
|
19
|
+
interface AddressLookupProps {
|
|
20
|
+
/** Current address value object */
|
|
21
|
+
value?: AddressValue;
|
|
22
|
+
/** Callback fired when any address field changes */
|
|
23
|
+
onChange?: (value: AddressValue) => void;
|
|
24
|
+
/** Label for the primary address search field */
|
|
25
|
+
label?: string;
|
|
26
|
+
/** Validation error messages per field */
|
|
27
|
+
error?: AddressError;
|
|
28
|
+
/** Size variant */
|
|
29
|
+
size?: "small" | "medium" | "large";
|
|
30
|
+
/** Inline style overrides for the container */
|
|
31
|
+
sx?: CSSProperties;
|
|
32
|
+
/** Layout mode: "stack" | "compact" | "grid" */
|
|
33
|
+
layout?: "stack" | "compact" | "grid";
|
|
34
|
+
/** Whether address fields are required */
|
|
35
|
+
required?: boolean;
|
|
36
|
+
/** Google Places API Key */
|
|
37
|
+
token?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* AddressLookup Component (MUI-Free Version)
|
|
41
|
+
* @param value - { addressLine1, addressLine2, city, state, country, pincode }
|
|
42
|
+
* @param onChange - Returns the full updated object
|
|
43
|
+
* @param layout - "stack" | "compact" | "grid"
|
|
44
|
+
* @param sx - Style overrides for the container
|
|
45
|
+
* @param token - Google Places API Key
|
|
46
|
+
*/
|
|
47
|
+
declare const AddressLookup: ({ value, onChange, label, error, size, sx, layout, required, token, }: AddressLookupProps) => React__default.JSX.Element;
|
|
48
|
+
|
|
49
|
+
export { type AddressError, type AddressLookupProps, type AddressValue, AddressLookup as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AddressLookup_default
|
|
3
|
+
} from "../chunk-5QEWUCKT.js";
|
|
4
|
+
import "../chunk-UPCMMCPQ.js";
|
|
5
|
+
import "../chunk-HMG3FW2Q.js";
|
|
6
|
+
import "../chunk-YXPBXCY5.js";
|
|
7
|
+
import "../chunk-CTBYVXFP.js";
|
|
8
|
+
import "../chunk-LI4N7JWK.js";
|
|
9
|
+
export {
|
|
10
|
+
AddressLookup_default as default
|
|
11
|
+
};
|
|
@@ -26,7 +26,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
));
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
|
|
29
|
-
// lib/TextFields/FloatingInput.
|
|
29
|
+
// lib/TextFields/FloatingInput.tsx
|
|
30
30
|
var FloatingInput_exports = {};
|
|
31
31
|
__export(FloatingInput_exports, {
|
|
32
32
|
FloatingInput: () => FloatingInput
|
|
@@ -43,19 +43,21 @@ var FloatingInput = ({
|
|
|
43
43
|
required = false,
|
|
44
44
|
placeholder,
|
|
45
45
|
className = "",
|
|
46
|
+
style,
|
|
46
47
|
...props
|
|
47
48
|
}) => {
|
|
48
|
-
return /* @__PURE__ */ import_react.default.createElement("div", { className: `form__group field ${className}`,
|
|
49
|
+
return /* @__PURE__ */ import_react.default.createElement("div", { className: `form__group field ${className}`, style }, /* @__PURE__ */ import_react.default.createElement(
|
|
49
50
|
"input",
|
|
50
51
|
{
|
|
51
52
|
type,
|
|
52
53
|
className: "form__field",
|
|
53
|
-
placeholder:
|
|
54
|
+
placeholder: " ",
|
|
54
55
|
name,
|
|
55
56
|
id: id || name,
|
|
56
57
|
value,
|
|
57
58
|
onChange,
|
|
58
|
-
required
|
|
59
|
+
required,
|
|
60
|
+
...props
|
|
59
61
|
}
|
|
60
62
|
), /* @__PURE__ */ import_react.default.createElement("label", { htmlFor: id || name, className: "form__label" }, label));
|
|
61
63
|
};
|
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React__default, { InputHTMLAttributes, CSSProperties } from 'react';
|
|
2
2
|
|
|
3
|
-
interface FloatingInputProps
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
/** Placeholder text (defaults to label if not provided) */
|
|
15
|
-
placeholder?: string;
|
|
16
|
-
|
|
17
|
-
/** Optional class name to apply to the outer wrapper */
|
|
18
|
-
className?: string;
|
|
3
|
+
interface FloatingInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
4
|
+
/** Label text shown above the input */
|
|
5
|
+
label: string;
|
|
6
|
+
/** Name attribute for the input (used for forms) */
|
|
7
|
+
name: string;
|
|
8
|
+
/** ID for the input and label (defaults to `name` if not provided) */
|
|
9
|
+
id?: string;
|
|
10
|
+
/** Optional class name to apply to the outer wrapper */
|
|
11
|
+
className?: string;
|
|
12
|
+
/** Inline style overrides for the wrapper */
|
|
13
|
+
style?: CSSProperties;
|
|
19
14
|
}
|
|
20
|
-
|
|
21
|
-
declare const FloatingInput: React.FC<FloatingInputProps>;
|
|
15
|
+
declare const FloatingInput: React__default.FC<FloatingInputProps>;
|
|
22
16
|
|
|
23
17
|
export { FloatingInput, type FloatingInputProps };
|