@rufous/ui 0.2.0-beta.0 → 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/CheckBoxes/CheckBox.cjs +1 -1
- package/dist/CheckBoxes/CheckBox.js +1 -1
- package/dist/Contexts/rufousThemeProvider.cjs +65 -13
- package/dist/Contexts/rufousThemeProvider.js +2 -2
- package/dist/Dialogs/BaseDialog.css +240 -132
- package/dist/Dialogs/BaseDialog.js +14 -13
- package/dist/Dialogs/index.css +240 -132
- package/dist/Dialogs/index.js +14 -13
- package/dist/TextFields/AddressLookup.js +6 -299
- package/dist/{chunk-TYTZEAV5.js → chunk-5DAOQ2V5.js} +1 -1
- package/dist/chunk-5QEWUCKT.js +303 -0
- package/dist/{chunk-WNZLBFLQ.js → chunk-HMG3FW2Q.js} +34 -10
- package/dist/{chunk-X357WQOT.js → chunk-NEGQXBQV.js} +1 -1
- package/dist/{chunk-QGXXOQJF.js → chunk-YXPBXCY5.js} +32 -4
- package/dist/icons/index.js +16 -16
- package/dist/main.cjs +452 -108
- package/dist/main.css +240 -132
- package/dist/main.d.cts +2 -1
- package/dist/main.d.ts +2 -1
- package/dist/main.js +33 -29
- package/dist/style.css +132 -132
- 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 +16 -16
- package/dist/styles/checkbox.css +9 -9
- package/dist/styles/datagrid.css +83 -83
- package/dist/styles/dialog.css +7 -7
- package/dist/styles/editor.css +7 -7
- package/dist/utils/constants.cjs +32 -4
- package/dist/utils/constants.d.cts +20 -0
- package/dist/utils/constants.d.ts +20 -0
- package/dist/utils/constants.js +1 -1
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -28638,6 +28638,7 @@ __export(main_exports, {
|
|
|
28638
28638
|
APP_THEMES: () => APP_THEMES,
|
|
28639
28639
|
ActivateUserIcon: () => activateUserIcon_default,
|
|
28640
28640
|
AddButton: () => addButton_default,
|
|
28641
|
+
AddressLookup: () => AddressLookup_default,
|
|
28641
28642
|
ArchivedIcon: () => archivedIcon_default,
|
|
28642
28643
|
AssignGroupIcon: () => assignGroupIcon_default,
|
|
28643
28644
|
BaseDialog: () => BaseDialog_default,
|
|
@@ -28721,7 +28722,14 @@ var APP_THEMES = {
|
|
|
28721
28722
|
border: "#e0e0e0",
|
|
28722
28723
|
hover: "#fff5f5",
|
|
28723
28724
|
selection: "#fce4ec",
|
|
28724
|
-
icon: "#a41b06"
|
|
28725
|
+
icon: "#a41b06",
|
|
28726
|
+
get customStyles() {
|
|
28727
|
+
return {
|
|
28728
|
+
iconColor: this.icon,
|
|
28729
|
+
primaryColor: this.primary,
|
|
28730
|
+
secondaryColor: this.secondary
|
|
28731
|
+
};
|
|
28732
|
+
}
|
|
28725
28733
|
},
|
|
28726
28734
|
dark: {
|
|
28727
28735
|
primary: "#dc2626",
|
|
@@ -28733,7 +28741,14 @@ var APP_THEMES = {
|
|
|
28733
28741
|
border: "#333333",
|
|
28734
28742
|
hover: "#2d1a1a",
|
|
28735
28743
|
selection: "#4a1212",
|
|
28736
|
-
icon: "#dc2626"
|
|
28744
|
+
icon: "#dc2626",
|
|
28745
|
+
get customStyles() {
|
|
28746
|
+
return {
|
|
28747
|
+
iconColor: this.icon,
|
|
28748
|
+
primaryColor: this.primary,
|
|
28749
|
+
secondaryColor: this.secondary
|
|
28750
|
+
};
|
|
28751
|
+
}
|
|
28737
28752
|
}
|
|
28738
28753
|
},
|
|
28739
28754
|
slate: {
|
|
@@ -28748,7 +28763,14 @@ var APP_THEMES = {
|
|
|
28748
28763
|
border: "#e2e8f0",
|
|
28749
28764
|
hover: "#f1f5f9",
|
|
28750
28765
|
selection: "#e0f2fe",
|
|
28751
|
-
icon: "#334155"
|
|
28766
|
+
icon: "#334155",
|
|
28767
|
+
get customStyles() {
|
|
28768
|
+
return {
|
|
28769
|
+
iconColor: this.icon,
|
|
28770
|
+
primaryColor: this.primary,
|
|
28771
|
+
secondaryColor: this.secondary
|
|
28772
|
+
};
|
|
28773
|
+
}
|
|
28752
28774
|
},
|
|
28753
28775
|
dark: {
|
|
28754
28776
|
primary: "#94a3b8",
|
|
@@ -28760,7 +28782,14 @@ var APP_THEMES = {
|
|
|
28760
28782
|
border: "#334155",
|
|
28761
28783
|
hover: "#1e293b",
|
|
28762
28784
|
selection: "#0c4a6e",
|
|
28763
|
-
icon: "#94a3b8"
|
|
28785
|
+
icon: "#94a3b8",
|
|
28786
|
+
get customStyles() {
|
|
28787
|
+
return {
|
|
28788
|
+
iconColor: this.icon,
|
|
28789
|
+
primaryColor: this.primary,
|
|
28790
|
+
secondaryColor: this.secondary
|
|
28791
|
+
};
|
|
28792
|
+
}
|
|
28764
28793
|
}
|
|
28765
28794
|
}
|
|
28766
28795
|
};
|
|
@@ -29888,26 +29917,45 @@ var RufousThemeProvider = ({ children }) => {
|
|
|
29888
29917
|
const themeVars = (0, import_react14.useMemo)(() => {
|
|
29889
29918
|
const config = APP_THEMES[colorScheme][mode];
|
|
29890
29919
|
return {
|
|
29920
|
+
"--rufous-primary-color": config.primary,
|
|
29921
|
+
"--rufous-secondary-color": config.secondary,
|
|
29922
|
+
"--rufous-background-color": config.background,
|
|
29923
|
+
"--rufous-surface-color": config.surface,
|
|
29924
|
+
"--rufous-text-color": config.text,
|
|
29925
|
+
"--rufous-text-secondary": config.textSecondary,
|
|
29926
|
+
"--rufous-border-color": config.border,
|
|
29927
|
+
"--rufous-hover-color": config.hover,
|
|
29928
|
+
"--rufous-selection-color": config.selection,
|
|
29929
|
+
"--rufous-icon-color": config.icon,
|
|
29930
|
+
// Keep legacy variables for backward compatibility during transition
|
|
29891
29931
|
"--primary-color": config.primary,
|
|
29892
|
-
"--secondary-color": config.secondary,
|
|
29893
29932
|
"--background-color": config.background,
|
|
29894
|
-
"--surface-color": config.surface,
|
|
29895
29933
|
"--text-color": config.text,
|
|
29896
|
-
"--text-secondary": config.textSecondary,
|
|
29897
29934
|
"--border-color": config.border,
|
|
29898
|
-
"--
|
|
29899
|
-
"--selection-color": config.selection,
|
|
29900
|
-
"--icon-color": config.icon
|
|
29935
|
+
"--surface-color": config.surface
|
|
29901
29936
|
};
|
|
29902
29937
|
}, [colorScheme, mode]);
|
|
29903
29938
|
const toggleMode = () => {
|
|
29904
29939
|
const newMode = mode === "light" ? "dark" : "light";
|
|
29905
29940
|
setMode(newMode);
|
|
29906
|
-
localStorage.setItem("themeMode", newMode);
|
|
29907
29941
|
};
|
|
29908
29942
|
const changeScheme = (scheme) => {
|
|
29909
|
-
|
|
29910
|
-
|
|
29943
|
+
if (APP_THEMES[scheme]) {
|
|
29944
|
+
setColorScheme(scheme);
|
|
29945
|
+
}
|
|
29946
|
+
};
|
|
29947
|
+
const saveTheme = () => {
|
|
29948
|
+
localStorage.setItem("colorScheme", colorScheme);
|
|
29949
|
+
localStorage.setItem("themeMode", mode);
|
|
29950
|
+
};
|
|
29951
|
+
const updateSettings = (settings) => {
|
|
29952
|
+
if (!settings) return;
|
|
29953
|
+
if (settings.theme && APP_THEMES[settings.theme]) {
|
|
29954
|
+
setColorScheme(settings.theme);
|
|
29955
|
+
}
|
|
29956
|
+
if (settings.mode) {
|
|
29957
|
+
setMode(settings.mode);
|
|
29958
|
+
}
|
|
29911
29959
|
};
|
|
29912
29960
|
return /* @__PURE__ */ import_react14.default.createElement(
|
|
29913
29961
|
RufousThemeContext.Provider,
|
|
@@ -29917,6 +29965,11 @@ var RufousThemeProvider = ({ children }) => {
|
|
|
29917
29965
|
mode,
|
|
29918
29966
|
toggleMode,
|
|
29919
29967
|
changeScheme,
|
|
29968
|
+
previewTheme: changeScheme,
|
|
29969
|
+
updateSettings,
|
|
29970
|
+
saveTheme,
|
|
29971
|
+
theme: APP_THEMES[colorScheme][mode],
|
|
29972
|
+
// Direct access to current theme config
|
|
29920
29973
|
themeConfig: APP_THEMES[colorScheme][mode]
|
|
29921
29974
|
}
|
|
29922
29975
|
},
|
|
@@ -29932,7 +29985,7 @@ var RufousThemeProvider = ({ children }) => {
|
|
|
29932
29985
|
};
|
|
29933
29986
|
var useRufousTheme = () => (0, import_react14.useContext)(RufousThemeContext);
|
|
29934
29987
|
|
|
29935
|
-
// lib/CheckBoxes/CheckBox.
|
|
29988
|
+
// lib/CheckBoxes/CheckBox.tsx
|
|
29936
29989
|
var import_react15 = __toESM(require("react"), 1);
|
|
29937
29990
|
var Checkbox = ({
|
|
29938
29991
|
id,
|
|
@@ -29989,8 +30042,298 @@ var FloatingInput = ({
|
|
|
29989
30042
|
), /* @__PURE__ */ import_react16.default.createElement("label", { htmlFor: id || name, className: "form__label" }, label));
|
|
29990
30043
|
};
|
|
29991
30044
|
|
|
29992
|
-
// lib/
|
|
30045
|
+
// lib/TextFields/AddressLookup.tsx
|
|
29993
30046
|
var import_react17 = __toESM(require("react"), 1);
|
|
30047
|
+
var import_axios = __toESM(require("axios"), 1);
|
|
30048
|
+
var import_country_state_city = require("country-state-city");
|
|
30049
|
+
var AddressLookup = ({
|
|
30050
|
+
value = {},
|
|
30051
|
+
onChange = () => {
|
|
30052
|
+
},
|
|
30053
|
+
label = "Address",
|
|
30054
|
+
error: error2 = {},
|
|
30055
|
+
size: size3 = "medium",
|
|
30056
|
+
sx = {},
|
|
30057
|
+
layout = "stack",
|
|
30058
|
+
required: required3 = false,
|
|
30059
|
+
token = ""
|
|
30060
|
+
}) => {
|
|
30061
|
+
const { theme } = useRufousTheme();
|
|
30062
|
+
const [suggestions, setSuggestions] = (0, import_react17.useState)([]);
|
|
30063
|
+
const [loading, setLoading] = (0, import_react17.useState)(false);
|
|
30064
|
+
const [showSuggestions, setShowSuggestions] = (0, import_react17.useState)(false);
|
|
30065
|
+
const [googleFields, setGoogleFields] = (0, import_react17.useState)({
|
|
30066
|
+
country: false,
|
|
30067
|
+
state: false,
|
|
30068
|
+
city: false,
|
|
30069
|
+
pincode: false
|
|
30070
|
+
});
|
|
30071
|
+
const debounceTimeout = (0, import_react17.useRef)(null);
|
|
30072
|
+
const containerRef = (0, import_react17.useRef)(null);
|
|
30073
|
+
const apiKey = token || "";
|
|
30074
|
+
const countries = import_country_state_city.Country.getAllCountries();
|
|
30075
|
+
const [states2, setStates] = (0, import_react17.useState)([]);
|
|
30076
|
+
const [cities, setCities] = (0, import_react17.useState)([]);
|
|
30077
|
+
(0, import_react17.useEffect)(() => {
|
|
30078
|
+
const handleClickOutside = (event) => {
|
|
30079
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
30080
|
+
setShowSuggestions(false);
|
|
30081
|
+
}
|
|
30082
|
+
};
|
|
30083
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
30084
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
30085
|
+
}, []);
|
|
30086
|
+
(0, import_react17.useEffect)(() => {
|
|
30087
|
+
if (value.country || value.state || value.city || value.pincode) {
|
|
30088
|
+
setGoogleFields({
|
|
30089
|
+
country: !!value.country,
|
|
30090
|
+
state: !!value.state,
|
|
30091
|
+
city: !!value.city,
|
|
30092
|
+
pincode: !!value.pincode
|
|
30093
|
+
});
|
|
30094
|
+
}
|
|
30095
|
+
}, []);
|
|
30096
|
+
(0, import_react17.useEffect)(() => {
|
|
30097
|
+
if (value.country) {
|
|
30098
|
+
const country = countries.find((c) => c.name === value.country);
|
|
30099
|
+
if (country) {
|
|
30100
|
+
const stateList = import_country_state_city.State.getStatesOfCountry(country.isoCode);
|
|
30101
|
+
setStates(stateList);
|
|
30102
|
+
} else {
|
|
30103
|
+
setStates([]);
|
|
30104
|
+
}
|
|
30105
|
+
} else {
|
|
30106
|
+
setStates([]);
|
|
30107
|
+
}
|
|
30108
|
+
}, [value.country]);
|
|
30109
|
+
(0, import_react17.useEffect)(() => {
|
|
30110
|
+
if (value.state && value.country) {
|
|
30111
|
+
const country = countries.find((c) => c.name === value.country);
|
|
30112
|
+
if (country) {
|
|
30113
|
+
const state = import_country_state_city.State.getStatesOfCountry(country.isoCode).find((s) => s.name === value.state);
|
|
30114
|
+
if (state) {
|
|
30115
|
+
const cityList = import_country_state_city.City.getCitiesOfState(country.isoCode, state.isoCode);
|
|
30116
|
+
setCities(cityList);
|
|
30117
|
+
} else {
|
|
30118
|
+
setCities([]);
|
|
30119
|
+
}
|
|
30120
|
+
} else {
|
|
30121
|
+
setCities([]);
|
|
30122
|
+
}
|
|
30123
|
+
} else {
|
|
30124
|
+
setCities([]);
|
|
30125
|
+
}
|
|
30126
|
+
}, [value.state, value.country]);
|
|
30127
|
+
const handleChange = (field, newVal) => {
|
|
30128
|
+
onChange({
|
|
30129
|
+
...value,
|
|
30130
|
+
[field]: newVal
|
|
30131
|
+
});
|
|
30132
|
+
};
|
|
30133
|
+
const fetchPlaceDetails = async (placeId, mainText = "") => {
|
|
30134
|
+
if (!apiKey) {
|
|
30135
|
+
console.warn("Google Places API Key (token) is missing.");
|
|
30136
|
+
return;
|
|
30137
|
+
}
|
|
30138
|
+
setLoading(true);
|
|
30139
|
+
try {
|
|
30140
|
+
const res = await import_axios.default.get(
|
|
30141
|
+
`https://places.googleapis.com/v1/places/${placeId}`,
|
|
30142
|
+
{
|
|
30143
|
+
headers: {
|
|
30144
|
+
"Content-Type": "application/json",
|
|
30145
|
+
"X-Goog-Api-Key": apiKey,
|
|
30146
|
+
"X-Goog-FieldMask": "addressComponents,formattedAddress"
|
|
30147
|
+
}
|
|
30148
|
+
}
|
|
30149
|
+
);
|
|
30150
|
+
const comps = res.data.addressComponents || [];
|
|
30151
|
+
const findComp = (type) => comps.find((c) => c.types.includes(type))?.longText || "";
|
|
30152
|
+
const city = findComp("locality") || findComp("sublocality_level_1");
|
|
30153
|
+
const state = findComp("administrative_area_level_1");
|
|
30154
|
+
const country = findComp("country");
|
|
30155
|
+
const pincode = findComp("postal_code");
|
|
30156
|
+
setGoogleFields({
|
|
30157
|
+
country: !!country,
|
|
30158
|
+
state: !!state,
|
|
30159
|
+
city: !!city,
|
|
30160
|
+
pincode: !!pincode
|
|
30161
|
+
});
|
|
30162
|
+
const updatedData = {
|
|
30163
|
+
...value,
|
|
30164
|
+
addressLine1: mainText || value.addressLine1,
|
|
30165
|
+
addressLine2: res.data.formattedAddress || value.addressLine2,
|
|
30166
|
+
city,
|
|
30167
|
+
state,
|
|
30168
|
+
country,
|
|
30169
|
+
pincode
|
|
30170
|
+
};
|
|
30171
|
+
onChange(updatedData);
|
|
30172
|
+
setShowSuggestions(false);
|
|
30173
|
+
} catch (err) {
|
|
30174
|
+
console.error("Error fetching place details:", err);
|
|
30175
|
+
} finally {
|
|
30176
|
+
setLoading(false);
|
|
30177
|
+
}
|
|
30178
|
+
};
|
|
30179
|
+
const handleQuerySuggestions = async (query) => {
|
|
30180
|
+
if (!apiKey || !query || query.length < 3) {
|
|
30181
|
+
setSuggestions([]);
|
|
30182
|
+
setShowSuggestions(false);
|
|
30183
|
+
return;
|
|
30184
|
+
}
|
|
30185
|
+
setLoading(true);
|
|
30186
|
+
try {
|
|
30187
|
+
const res = await import_axios.default.post(
|
|
30188
|
+
`https://places.googleapis.com/v1/places:autocomplete`,
|
|
30189
|
+
{ input: query },
|
|
30190
|
+
{
|
|
30191
|
+
headers: {
|
|
30192
|
+
"Content-Type": "application/json",
|
|
30193
|
+
"X-Goog-Api-Key": apiKey
|
|
30194
|
+
}
|
|
30195
|
+
}
|
|
30196
|
+
);
|
|
30197
|
+
setSuggestions(res.data.suggestions || []);
|
|
30198
|
+
setShowSuggestions(true);
|
|
30199
|
+
} catch (err) {
|
|
30200
|
+
console.error("Autocomplete Error:", err);
|
|
30201
|
+
} finally {
|
|
30202
|
+
setLoading(false);
|
|
30203
|
+
}
|
|
30204
|
+
};
|
|
30205
|
+
const handleCountryChange = (newCountry) => {
|
|
30206
|
+
onChange({
|
|
30207
|
+
...value,
|
|
30208
|
+
country: newCountry,
|
|
30209
|
+
state: "",
|
|
30210
|
+
city: ""
|
|
30211
|
+
});
|
|
30212
|
+
setGoogleFields({ ...googleFields, country: false, state: false, city: false });
|
|
30213
|
+
};
|
|
30214
|
+
const handleStateChange = (newState) => {
|
|
30215
|
+
onChange({
|
|
30216
|
+
...value,
|
|
30217
|
+
state: newState,
|
|
30218
|
+
city: ""
|
|
30219
|
+
});
|
|
30220
|
+
};
|
|
30221
|
+
return /* @__PURE__ */ import_react17.default.createElement("div", { className: "address-lookup-container", style: sx, ref: containerRef }, /* @__PURE__ */ import_react17.default.createElement("div", { className: `address-lookup-grid address-lookup-grid-${layout}` }, /* @__PURE__ */ import_react17.default.createElement("div", { className: "address-lookup-grid-item col-l1" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
30222
|
+
FloatingInput,
|
|
30223
|
+
{
|
|
30224
|
+
label,
|
|
30225
|
+
name: "addressLine1",
|
|
30226
|
+
value: value.addressLine1 || "",
|
|
30227
|
+
required: required3,
|
|
30228
|
+
autoComplete: "off",
|
|
30229
|
+
onChange: (e) => {
|
|
30230
|
+
const val2 = e.target.value;
|
|
30231
|
+
handleChange("addressLine1", val2);
|
|
30232
|
+
if (!val2) {
|
|
30233
|
+
onChange({
|
|
30234
|
+
...value,
|
|
30235
|
+
addressLine1: "",
|
|
30236
|
+
city: "",
|
|
30237
|
+
state: "",
|
|
30238
|
+
country: "",
|
|
30239
|
+
pincode: ""
|
|
30240
|
+
});
|
|
30241
|
+
setSuggestions([]);
|
|
30242
|
+
setShowSuggestions(false);
|
|
30243
|
+
setGoogleFields({ country: false, state: false, city: false, pincode: false });
|
|
30244
|
+
} else {
|
|
30245
|
+
if (debounceTimeout.current) clearTimeout(debounceTimeout.current);
|
|
30246
|
+
debounceTimeout.current = setTimeout(() => {
|
|
30247
|
+
handleQuerySuggestions(val2);
|
|
30248
|
+
}, 500);
|
|
30249
|
+
}
|
|
30250
|
+
},
|
|
30251
|
+
onFocus: () => suggestions.length > 0 && setShowSuggestions(true)
|
|
30252
|
+
}
|
|
30253
|
+
), loading && /* @__PURE__ */ import_react17.default.createElement("div", { className: "loading-indicator" }, /* @__PURE__ */ import_react17.default.createElement(circularProgress_default, { size: 20 })), showSuggestions && suggestions.length > 0 && /* @__PURE__ */ import_react17.default.createElement("div", { className: "autocomplete-dropdown" }, suggestions.map((option, idx) => /* @__PURE__ */ import_react17.default.createElement(
|
|
30254
|
+
"div",
|
|
30255
|
+
{
|
|
30256
|
+
key: idx,
|
|
30257
|
+
className: "autocomplete-option",
|
|
30258
|
+
onClick: () => {
|
|
30259
|
+
const mainText = option?.placePrediction?.structuredFormat?.mainText?.text || "";
|
|
30260
|
+
handleChange("addressLine1", mainText);
|
|
30261
|
+
fetchPlaceDetails(option.placePrediction.placeId, mainText);
|
|
30262
|
+
}
|
|
30263
|
+
},
|
|
30264
|
+
/* @__PURE__ */ import_react17.default.createElement("div", { className: "autocomplete-main-text" }, option?.placePrediction?.structuredFormat?.mainText?.text),
|
|
30265
|
+
/* @__PURE__ */ import_react17.default.createElement("div", { className: "autocomplete-secondary-text" }, option?.placePrediction?.structuredFormat?.secondaryText?.text)
|
|
30266
|
+
))), error2.addressLine1 && /* @__PURE__ */ import_react17.default.createElement("div", { className: "field-error-text" }, error2.addressLine1)), layout === "compact" && /* @__PURE__ */ import_react17.default.createElement("div", { className: "address-lookup-grid-item col-l2" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
30267
|
+
FloatingInput,
|
|
30268
|
+
{
|
|
30269
|
+
label: "Address Line 2",
|
|
30270
|
+
name: "addressLine2",
|
|
30271
|
+
value: value.addressLine2 || "",
|
|
30272
|
+
onChange: (e) => handleChange("addressLine2", e.target.value)
|
|
30273
|
+
}
|
|
30274
|
+
)), layout !== "compact" && /* @__PURE__ */ import_react17.default.createElement("div", { className: "address-lookup-grid-item col-l2" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
30275
|
+
FloatingInput,
|
|
30276
|
+
{
|
|
30277
|
+
label: "Address Line 2",
|
|
30278
|
+
name: "addressLine2",
|
|
30279
|
+
value: value.addressLine2 || "",
|
|
30280
|
+
onChange: (e) => handleChange("addressLine2", e.target.value)
|
|
30281
|
+
}
|
|
30282
|
+
)), /* @__PURE__ */ import_react17.default.createElement("div", { className: "address-lookup-grid-item col-country" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
30283
|
+
FloatingInput,
|
|
30284
|
+
{
|
|
30285
|
+
label: "Country",
|
|
30286
|
+
name: "country",
|
|
30287
|
+
value: value.country || "",
|
|
30288
|
+
required: required3,
|
|
30289
|
+
className: googleFields.country && value.country ? "field-disabled" : "",
|
|
30290
|
+
readOnly: googleFields.country && !!value.country,
|
|
30291
|
+
onChange: (e) => handleCountryChange(e.target.value),
|
|
30292
|
+
list: "countries-list"
|
|
30293
|
+
}
|
|
30294
|
+
), /* @__PURE__ */ import_react17.default.createElement("datalist", { id: "countries-list" }, countries.map((c) => /* @__PURE__ */ import_react17.default.createElement("option", { key: c.isoCode, value: c.name }))), error2.country && /* @__PURE__ */ import_react17.default.createElement("div", { className: "field-error-text" }, error2.country)), /* @__PURE__ */ import_react17.default.createElement("div", { className: "address-lookup-grid-item col-state" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
30295
|
+
FloatingInput,
|
|
30296
|
+
{
|
|
30297
|
+
label: "State",
|
|
30298
|
+
name: "state",
|
|
30299
|
+
value: value.state || "",
|
|
30300
|
+
required: required3,
|
|
30301
|
+
disabled: !value.country,
|
|
30302
|
+
className: googleFields.state && value.state ? "field-disabled" : "",
|
|
30303
|
+
readOnly: googleFields.state && !!value.state,
|
|
30304
|
+
onChange: (e) => handleStateChange(e.target.value),
|
|
30305
|
+
list: "states-list"
|
|
30306
|
+
}
|
|
30307
|
+
), /* @__PURE__ */ import_react17.default.createElement("datalist", { id: "states-list" }, states2.map((s) => /* @__PURE__ */ import_react17.default.createElement("option", { key: s.isoCode, value: s.name }))), error2.state && /* @__PURE__ */ import_react17.default.createElement("div", { className: "field-error-text" }, error2.state)), /* @__PURE__ */ import_react17.default.createElement("div", { className: "address-lookup-grid-item col-city" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
30308
|
+
FloatingInput,
|
|
30309
|
+
{
|
|
30310
|
+
label: "City",
|
|
30311
|
+
name: "city",
|
|
30312
|
+
value: value.city || "",
|
|
30313
|
+
required: required3,
|
|
30314
|
+
disabled: !value.state,
|
|
30315
|
+
className: googleFields.city && value.city ? "field-disabled" : "",
|
|
30316
|
+
readOnly: googleFields.city && !!value.city,
|
|
30317
|
+
onChange: (e) => handleChange("city", e.target.value),
|
|
30318
|
+
list: "cities-list"
|
|
30319
|
+
}
|
|
30320
|
+
), /* @__PURE__ */ import_react17.default.createElement("datalist", { id: "cities-list" }, cities.map((c, i) => /* @__PURE__ */ import_react17.default.createElement("option", { key: i, value: c.name }))), error2.city && /* @__PURE__ */ import_react17.default.createElement("div", { className: "field-error-text" }, error2.city)), /* @__PURE__ */ import_react17.default.createElement("div", { className: "address-lookup-grid-item col-pin" }, /* @__PURE__ */ import_react17.default.createElement(
|
|
30321
|
+
FloatingInput,
|
|
30322
|
+
{
|
|
30323
|
+
label: "Pincode",
|
|
30324
|
+
name: "pincode",
|
|
30325
|
+
value: value.pincode || "",
|
|
30326
|
+
required: required3,
|
|
30327
|
+
className: googleFields.pincode && value.pincode ? "field-disabled" : "",
|
|
30328
|
+
readOnly: googleFields.pincode && !!value.pincode,
|
|
30329
|
+
onChange: (e) => handleChange("pincode", e.target.value)
|
|
30330
|
+
}
|
|
30331
|
+
), error2.pincode && /* @__PURE__ */ import_react17.default.createElement("div", { className: "field-error-text" }, error2.pincode))));
|
|
30332
|
+
};
|
|
30333
|
+
var AddressLookup_default = AddressLookup;
|
|
30334
|
+
|
|
30335
|
+
// lib/DataGrid/DataGrid.tsx
|
|
30336
|
+
var import_react18 = __toESM(require("react"), 1);
|
|
29994
30337
|
var import_lucide_react = require("lucide-react");
|
|
29995
30338
|
function DataGrid({
|
|
29996
30339
|
columns: initialColumns,
|
|
@@ -30000,33 +30343,33 @@ function DataGrid({
|
|
|
30000
30343
|
pageSizeOptions = [5, 10, 25, 50],
|
|
30001
30344
|
title
|
|
30002
30345
|
}) {
|
|
30003
|
-
const [columns, setColumns] = (0,
|
|
30004
|
-
const [columnWidths, setColumnWidths] = (0,
|
|
30346
|
+
const [columns, setColumns] = (0, import_react18.useState)(initialColumns);
|
|
30347
|
+
const [columnWidths, setColumnWidths] = (0, import_react18.useState)(() => {
|
|
30005
30348
|
const widths = {};
|
|
30006
30349
|
initialColumns.forEach((col) => {
|
|
30007
30350
|
widths[String(col.key)] = parseInt(col.width || "200");
|
|
30008
30351
|
});
|
|
30009
30352
|
return widths;
|
|
30010
30353
|
});
|
|
30011
|
-
const [pageSize, setPageSize] = (0,
|
|
30012
|
-
const [sortKey, setSortKey] = (0,
|
|
30013
|
-
const [sortDirection, setSortDirection] = (0,
|
|
30014
|
-
const [filterText, setFilterText] = (0,
|
|
30015
|
-
const [currentPage, setCurrentPage] = (0,
|
|
30016
|
-
const [columnFilters, setColumnFilters] = (0,
|
|
30017
|
-
const [resizingColumn, setResizingColumn] = (0,
|
|
30018
|
-
const [startX, setStartX] = (0,
|
|
30019
|
-
const [startWidth, setStartWidth] = (0,
|
|
30020
|
-
const [activeMenu, setActiveMenu] = (0,
|
|
30021
|
-
const [menuPosition, setMenuPosition] = (0,
|
|
30022
|
-
const menuRef = (0,
|
|
30023
|
-
const [showManageColumns, setShowManageColumns] = (0,
|
|
30024
|
-
const [showAdvancedFilter, setShowAdvancedFilter] = (0,
|
|
30025
|
-
const [advancedFilters, setAdvancedFilters] = (0,
|
|
30354
|
+
const [pageSize, setPageSize] = (0, import_react18.useState)(initialPageSize);
|
|
30355
|
+
const [sortKey, setSortKey] = (0, import_react18.useState)(null);
|
|
30356
|
+
const [sortDirection, setSortDirection] = (0, import_react18.useState)(null);
|
|
30357
|
+
const [filterText, setFilterText] = (0, import_react18.useState)("");
|
|
30358
|
+
const [currentPage, setCurrentPage] = (0, import_react18.useState)(1);
|
|
30359
|
+
const [columnFilters, setColumnFilters] = (0, import_react18.useState)({});
|
|
30360
|
+
const [resizingColumn, setResizingColumn] = (0, import_react18.useState)(null);
|
|
30361
|
+
const [startX, setStartX] = (0, import_react18.useState)(0);
|
|
30362
|
+
const [startWidth, setStartWidth] = (0, import_react18.useState)(0);
|
|
30363
|
+
const [activeMenu, setActiveMenu] = (0, import_react18.useState)(null);
|
|
30364
|
+
const [menuPosition, setMenuPosition] = (0, import_react18.useState)({ top: 0, left: 0 });
|
|
30365
|
+
const menuRef = (0, import_react18.useRef)(null);
|
|
30366
|
+
const [showManageColumns, setShowManageColumns] = (0, import_react18.useState)(false);
|
|
30367
|
+
const [showAdvancedFilter, setShowAdvancedFilter] = (0, import_react18.useState)(false);
|
|
30368
|
+
const [advancedFilters, setAdvancedFilters] = (0, import_react18.useState)([
|
|
30026
30369
|
{ column: String(initialColumns[0].key), operator: "contains", value: "", logic: "AND" }
|
|
30027
30370
|
]);
|
|
30028
|
-
const [colSearch, setColSearch] = (0,
|
|
30029
|
-
(0,
|
|
30371
|
+
const [colSearch, setColSearch] = (0, import_react18.useState)("");
|
|
30372
|
+
(0, import_react18.useEffect)(() => {
|
|
30030
30373
|
const handleMouseMove = (e) => {
|
|
30031
30374
|
if (!resizingColumn) return;
|
|
30032
30375
|
const col = columns.find((c) => String(c.key) === resizingColumn);
|
|
@@ -30046,7 +30389,7 @@ function DataGrid({
|
|
|
30046
30389
|
document.removeEventListener("mouseup", handleMouseUp);
|
|
30047
30390
|
};
|
|
30048
30391
|
}, [resizingColumn, startX, startWidth, columns]);
|
|
30049
|
-
(0,
|
|
30392
|
+
(0, import_react18.useEffect)(() => {
|
|
30050
30393
|
const handleClickOutside = (e) => {
|
|
30051
30394
|
if (menuRef.current && !menuRef.current.contains(e.target)) {
|
|
30052
30395
|
setActiveMenu(null);
|
|
@@ -30083,7 +30426,7 @@ function DataGrid({
|
|
|
30083
30426
|
));
|
|
30084
30427
|
setActiveMenu(null);
|
|
30085
30428
|
};
|
|
30086
|
-
const filteredData = (0,
|
|
30429
|
+
const filteredData = (0, import_react18.useMemo)(() => {
|
|
30087
30430
|
return data.filter((item) => {
|
|
30088
30431
|
const matchesGlobal = !filterText || Object.values(item).some(
|
|
30089
30432
|
(val2) => String(val2).toLowerCase().includes(filterText.toLowerCase())
|
|
@@ -30121,7 +30464,7 @@ function DataGrid({
|
|
|
30121
30464
|
return matchesGlobal && matchesAdvanced;
|
|
30122
30465
|
});
|
|
30123
30466
|
}, [data, filterText, advancedFilters]);
|
|
30124
|
-
const sortedData = (0,
|
|
30467
|
+
const sortedData = (0, import_react18.useMemo)(() => {
|
|
30125
30468
|
if (!sortKey || !sortDirection) return filteredData;
|
|
30126
30469
|
return [...filteredData].sort((a, b) => {
|
|
30127
30470
|
const aVal = a[sortKey];
|
|
@@ -30132,7 +30475,7 @@ function DataGrid({
|
|
|
30132
30475
|
});
|
|
30133
30476
|
}, [filteredData, sortKey, sortDirection]);
|
|
30134
30477
|
const totalPages = Math.max(1, Math.ceil(sortedData.length / pageSize));
|
|
30135
|
-
const paginatedData = (0,
|
|
30478
|
+
const paginatedData = (0, import_react18.useMemo)(() => {
|
|
30136
30479
|
const start = (currentPage - 1) * pageSize;
|
|
30137
30480
|
return sortedData.slice(start, start + pageSize);
|
|
30138
30481
|
}, [sortedData, currentPage, pageSize]);
|
|
@@ -30157,7 +30500,7 @@ function DataGrid({
|
|
|
30157
30500
|
setMenuPosition({ top: rect.bottom + 4, left: rect.left });
|
|
30158
30501
|
setActiveMenu(key);
|
|
30159
30502
|
};
|
|
30160
|
-
const visibleColumns = (0,
|
|
30503
|
+
const visibleColumns = (0, import_react18.useMemo)(() => {
|
|
30161
30504
|
const left = columns.filter((c) => !c.hidden && c.pinned === "left");
|
|
30162
30505
|
const mid = columns.filter((c) => !c.hidden && !c.pinned);
|
|
30163
30506
|
const right = columns.filter((c) => !c.hidden && c.pinned === "right");
|
|
@@ -30174,7 +30517,7 @@ function DataGrid({
|
|
|
30174
30517
|
return offset2;
|
|
30175
30518
|
};
|
|
30176
30519
|
const hasActiveFilters = advancedFilters.some((f) => f.value);
|
|
30177
|
-
return /* @__PURE__ */
|
|
30520
|
+
return /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-root" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-header" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-header-info" }, /* @__PURE__ */ import_react18.default.createElement("h2", null, title), /* @__PURE__ */ import_react18.default.createElement("p", null, filteredData.length, " total records")), /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-header-actions" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-search-wrap" }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.Search, { size: 15 }), /* @__PURE__ */ import_react18.default.createElement(
|
|
30178
30521
|
"input",
|
|
30179
30522
|
{
|
|
30180
30523
|
className: "dg-search",
|
|
@@ -30185,51 +30528,51 @@ function DataGrid({
|
|
|
30185
30528
|
setCurrentPage(1);
|
|
30186
30529
|
}
|
|
30187
30530
|
}
|
|
30188
|
-
)), /* @__PURE__ */
|
|
30531
|
+
)), /* @__PURE__ */ import_react18.default.createElement(
|
|
30189
30532
|
"button",
|
|
30190
30533
|
{
|
|
30191
30534
|
className: `dg-icon-btn ${hasActiveFilters ? "active" : ""}`,
|
|
30192
30535
|
onClick: () => setShowAdvancedFilter(true),
|
|
30193
30536
|
title: "Filters"
|
|
30194
30537
|
},
|
|
30195
|
-
/* @__PURE__ */
|
|
30196
|
-
), /* @__PURE__ */
|
|
30538
|
+
/* @__PURE__ */ import_react18.default.createElement(import_lucide_react.Filter, { size: 16 })
|
|
30539
|
+
), /* @__PURE__ */ import_react18.default.createElement(
|
|
30197
30540
|
"button",
|
|
30198
30541
|
{
|
|
30199
30542
|
className: "dg-icon-btn",
|
|
30200
30543
|
onClick: () => setShowManageColumns(true),
|
|
30201
30544
|
title: "Manage Columns"
|
|
30202
30545
|
},
|
|
30203
|
-
/* @__PURE__ */
|
|
30204
|
-
), /* @__PURE__ */
|
|
30546
|
+
/* @__PURE__ */ import_react18.default.createElement(import_lucide_react.Columns, { size: 16 })
|
|
30547
|
+
), /* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-action-btn", onClick: handleExport }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.Download, { size: 14 }), " Export CSV"))), /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-table-wrap" }, /* @__PURE__ */ import_react18.default.createElement("table", { className: "dg-table" }, /* @__PURE__ */ import_react18.default.createElement("thead", null, /* @__PURE__ */ import_react18.default.createElement("tr", null, visibleColumns.map((col, idx) => {
|
|
30205
30548
|
const colKey = String(col.key);
|
|
30206
30549
|
const width = columnWidths[colKey] || 200;
|
|
30207
30550
|
const leftOffset = getLeftOffset(col, idx);
|
|
30208
30551
|
const isSorted = sortKey === col.key;
|
|
30209
|
-
return /* @__PURE__ */
|
|
30552
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
30210
30553
|
"th",
|
|
30211
30554
|
{
|
|
30212
30555
|
key: colKey,
|
|
30213
30556
|
className: `dg-thead-cell${col.pinned === "left" ? " pinned-left" : col.pinned === "right" ? " pinned-right" : ""}`,
|
|
30214
30557
|
style: { width, minWidth: width, left: leftOffset }
|
|
30215
30558
|
},
|
|
30216
|
-
/* @__PURE__ */
|
|
30559
|
+
/* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-th-inner" }, /* @__PURE__ */ import_react18.default.createElement(
|
|
30217
30560
|
"div",
|
|
30218
30561
|
{
|
|
30219
30562
|
className: `dg-th-label${col.sortable === false ? " no-sort" : ""}`,
|
|
30220
30563
|
onClick: () => col.sortable !== false && handleSort(col.key)
|
|
30221
30564
|
},
|
|
30222
30565
|
col.header,
|
|
30223
|
-
isSorted && sortDirection === "asc" && /* @__PURE__ */
|
|
30224
|
-
isSorted && sortDirection === "desc" && /* @__PURE__ */
|
|
30225
|
-
), /* @__PURE__ */
|
|
30566
|
+
isSorted && sortDirection === "asc" && /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.ChevronUp, { size: 12 }),
|
|
30567
|
+
isSorted && sortDirection === "desc" && /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.ChevronDown, { size: 12 })
|
|
30568
|
+
), /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-th-actions" }, /* @__PURE__ */ import_react18.default.createElement(
|
|
30226
30569
|
"button",
|
|
30227
30570
|
{
|
|
30228
30571
|
className: "dg-th-menu-btn",
|
|
30229
30572
|
onClick: (e) => handleMenuOpen(e, colKey)
|
|
30230
30573
|
},
|
|
30231
|
-
/* @__PURE__ */
|
|
30232
|
-
), /* @__PURE__ */
|
|
30574
|
+
/* @__PURE__ */ import_react18.default.createElement(import_lucide_react.MoreVertical, { size: 13 })
|
|
30575
|
+
), /* @__PURE__ */ import_react18.default.createElement(
|
|
30233
30576
|
"div",
|
|
30234
30577
|
{
|
|
30235
30578
|
className: `dg-resizer${resizingColumn === colKey ? " resizing" : ""}`,
|
|
@@ -30242,11 +30585,11 @@ function DataGrid({
|
|
|
30242
30585
|
}
|
|
30243
30586
|
)))
|
|
30244
30587
|
);
|
|
30245
|
-
}), actions && /* @__PURE__ */
|
|
30588
|
+
}), actions && /* @__PURE__ */ import_react18.default.createElement("th", { style: { width: 0, padding: 0 } }))), /* @__PURE__ */ import_react18.default.createElement("tbody", null, paginatedData.length === 0 ? /* @__PURE__ */ import_react18.default.createElement("tr", null, /* @__PURE__ */ import_react18.default.createElement("td", { colSpan: visibleColumns.length + (actions ? 1 : 0), className: "dg-empty" }, "No records found")) : paginatedData.map((item) => /* @__PURE__ */ import_react18.default.createElement("tr", { key: item.id, className: "dg-tbody-row" }, visibleColumns.map((col, idx) => {
|
|
30246
30589
|
const colKey = String(col.key);
|
|
30247
30590
|
const width = columnWidths[colKey] || 200;
|
|
30248
30591
|
const leftOffset = getLeftOffset(col, idx);
|
|
30249
|
-
return /* @__PURE__ */
|
|
30592
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
30250
30593
|
"td",
|
|
30251
30594
|
{
|
|
30252
30595
|
key: `${item.id}-${colKey}`,
|
|
@@ -30255,7 +30598,7 @@ function DataGrid({
|
|
|
30255
30598
|
},
|
|
30256
30599
|
col.render ? col.render(item[col.key], item) : String(item[col.key] ?? "")
|
|
30257
30600
|
);
|
|
30258
|
-
}), actions && /* @__PURE__ */
|
|
30601
|
+
}), actions && /* @__PURE__ */ import_react18.default.createElement("td", { className: "dg-row-actions-cell" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-row-actions" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-action-group" }, actions.map((action, i) => /* @__PURE__ */ import_react18.default.createElement(
|
|
30259
30602
|
"button",
|
|
30260
30603
|
{
|
|
30261
30604
|
key: i,
|
|
@@ -30265,7 +30608,7 @@ function DataGrid({
|
|
|
30265
30608
|
title: action.label
|
|
30266
30609
|
},
|
|
30267
30610
|
action.icon
|
|
30268
|
-
)))))))))), /* @__PURE__ */
|
|
30611
|
+
)))))))))), /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-pagination" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-page-info" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-per-page" }, /* @__PURE__ */ import_react18.default.createElement("span", null, "Rows per page:"), /* @__PURE__ */ import_react18.default.createElement(
|
|
30269
30612
|
"select",
|
|
30270
30613
|
{
|
|
30271
30614
|
value: pageSize,
|
|
@@ -30274,30 +30617,30 @@ function DataGrid({
|
|
|
30274
30617
|
setCurrentPage(1);
|
|
30275
30618
|
}
|
|
30276
30619
|
},
|
|
30277
|
-
pageSizeOptions.map((o) => /* @__PURE__ */
|
|
30278
|
-
)), /* @__PURE__ */
|
|
30620
|
+
pageSizeOptions.map((o) => /* @__PURE__ */ import_react18.default.createElement("option", { key: o, value: o }, o))
|
|
30621
|
+
)), /* @__PURE__ */ import_react18.default.createElement("span", null, (currentPage - 1) * pageSize + 1, "\u2013", Math.min(currentPage * pageSize, filteredData.length), " of ", filteredData.length)), /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-page-nav" }, /* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-page-btn", disabled: currentPage === 1, onClick: () => setCurrentPage((p) => p - 1) }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.ChevronLeft, { size: 15 })), /* @__PURE__ */ import_react18.default.createElement("span", { className: "dg-page-fraction" }, currentPage, " / ", totalPages), /* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-page-btn", disabled: currentPage === totalPages, onClick: () => setCurrentPage((p) => p + 1) }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.ChevronRight, { size: 15 })))), activeMenu && /* @__PURE__ */ import_react18.default.createElement(
|
|
30279
30622
|
"div",
|
|
30280
30623
|
{
|
|
30281
30624
|
ref: menuRef,
|
|
30282
30625
|
className: "dg-menu",
|
|
30283
30626
|
style: { top: menuPosition.top, left: menuPosition.left }
|
|
30284
30627
|
},
|
|
30285
|
-
/* @__PURE__ */
|
|
30286
|
-
/* @__PURE__ */
|
|
30287
|
-
/* @__PURE__ */
|
|
30288
|
-
/* @__PURE__ */
|
|
30289
|
-
/* @__PURE__ */
|
|
30290
|
-
/* @__PURE__ */
|
|
30291
|
-
/* @__PURE__ */
|
|
30628
|
+
/* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-menu-item", onClick: () => handleSort(activeMenu, "asc") }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.ArrowUp, { size: 14 }), " Sort ascending"),
|
|
30629
|
+
/* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-menu-item", onClick: () => handleSort(activeMenu, "desc") }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.ArrowDown, { size: 14 }), " Sort descending"),
|
|
30630
|
+
/* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-menu-divider" }),
|
|
30631
|
+
/* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-menu-item", onClick: () => togglePin(activeMenu, "left") }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.Pin, { size: 14, style: { transform: "rotate(45deg)" } }), " Pin left"),
|
|
30632
|
+
/* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-menu-item", onClick: () => togglePin(activeMenu, "right") }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.Pin, { size: 14, style: { transform: "rotate(-45deg)" } }), " Pin right"),
|
|
30633
|
+
/* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-menu-divider" }),
|
|
30634
|
+
/* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-menu-item", onClick: () => {
|
|
30292
30635
|
setShowAdvancedFilter(true);
|
|
30293
30636
|
setActiveMenu(null);
|
|
30294
|
-
} }, /* @__PURE__ */
|
|
30295
|
-
/* @__PURE__ */
|
|
30296
|
-
/* @__PURE__ */
|
|
30637
|
+
} }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.Filter, { size: 14 }), " Filter\u2026"),
|
|
30638
|
+
/* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-menu-item", onClick: () => toggleHide(activeMenu) }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.EyeOff, { size: 14 }), " Hide column"),
|
|
30639
|
+
/* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-menu-item", onClick: () => {
|
|
30297
30640
|
setShowManageColumns(true);
|
|
30298
30641
|
setActiveMenu(null);
|
|
30299
|
-
} }, /* @__PURE__ */
|
|
30300
|
-
), showManageColumns && /* @__PURE__ */
|
|
30642
|
+
} }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.Columns, { size: 14 }), " Manage columns")
|
|
30643
|
+
), showManageColumns && /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-modal-overlay", onClick: () => setShowManageColumns(false) }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-modal", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-modal-header" }, /* @__PURE__ */ import_react18.default.createElement("h3", null, "Manage Columns"), /* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-icon-btn", onClick: () => setShowManageColumns(false) }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.X, { size: 18 }))), /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-modal-body" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-search-wrap", style: { marginBottom: 8 } }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.Search, { size: 14 }), /* @__PURE__ */ import_react18.default.createElement(
|
|
30301
30644
|
"input",
|
|
30302
30645
|
{
|
|
30303
30646
|
className: "dg-search",
|
|
@@ -30306,42 +30649,42 @@ function DataGrid({
|
|
|
30306
30649
|
value: colSearch,
|
|
30307
30650
|
onChange: (e) => setColSearch(e.target.value)
|
|
30308
30651
|
}
|
|
30309
|
-
)), columns.filter((c) => c.header.toLowerCase().includes(colSearch.toLowerCase())).map((col) => /* @__PURE__ */
|
|
30652
|
+
)), columns.filter((c) => c.header.toLowerCase().includes(colSearch.toLowerCase())).map((col) => /* @__PURE__ */ import_react18.default.createElement("div", { key: String(col.key), className: "dg-col-row" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-col-label" }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-col-dot", style: { background: col.hidden ? "var(--border-color)" : "var(--primary-color)" } }), col.header), /* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-icon-btn", onClick: () => toggleHide(String(col.key)) }, col.hidden ? /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.EyeOff, { size: 14 }) : /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.EyeOff, { size: 14, style: { opacity: 0.4 } }))))), /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-modal-footer" }, /* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-action-btn", onClick: () => setColumns((p) => p.map((c) => ({ ...c, hidden: false }))) }, "Show All"), /* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-action-btn", onClick: () => setColumns((p) => p.map((c) => ({ ...c, hidden: true }))) }, "Hide All")))), showAdvancedFilter && /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-modal-overlay", onClick: () => setShowAdvancedFilter(false) }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-modal dg-modal-wide", onClick: (e) => e.stopPropagation() }, /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-modal-header" }, /* @__PURE__ */ import_react18.default.createElement("h3", null, "Filters"), /* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-icon-btn", onClick: () => setShowAdvancedFilter(false) }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.X, { size: 18 }))), /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-modal-body" }, advancedFilters.map((f, idx) => /* @__PURE__ */ import_react18.default.createElement("div", { key: idx }, idx > 0 && /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-filter-logic" }, /* @__PURE__ */ import_react18.default.createElement(
|
|
30310
30653
|
"button",
|
|
30311
30654
|
{
|
|
30312
30655
|
className: `dg-logic-btn${f.logic === "AND" ? " active" : ""}`,
|
|
30313
30656
|
onClick: () => setAdvancedFilters((p) => p.map((fi, i) => i === idx ? { ...fi, logic: "AND" } : fi))
|
|
30314
30657
|
},
|
|
30315
30658
|
"AND"
|
|
30316
|
-
), /* @__PURE__ */
|
|
30659
|
+
), /* @__PURE__ */ import_react18.default.createElement(
|
|
30317
30660
|
"button",
|
|
30318
30661
|
{
|
|
30319
30662
|
className: `dg-logic-btn${f.logic === "OR" ? " active" : ""}`,
|
|
30320
30663
|
onClick: () => setAdvancedFilters((p) => p.map((fi, i) => i === idx ? { ...fi, logic: "OR" } : fi))
|
|
30321
30664
|
},
|
|
30322
30665
|
"OR"
|
|
30323
|
-
)), /* @__PURE__ */
|
|
30666
|
+
)), /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-filter-row" }, advancedFilters.length > 1 && /* @__PURE__ */ import_react18.default.createElement("button", { className: "dg-icon-btn", onClick: () => setAdvancedFilters((p) => p.filter((_, i) => i !== idx)) }, /* @__PURE__ */ import_react18.default.createElement(import_lucide_react.X, { size: 14 })), /* @__PURE__ */ import_react18.default.createElement(
|
|
30324
30667
|
"select",
|
|
30325
30668
|
{
|
|
30326
30669
|
className: "dg-filter-select",
|
|
30327
30670
|
value: f.column,
|
|
30328
30671
|
onChange: (e) => setAdvancedFilters((p) => p.map((fi, i) => i === idx ? { ...fi, column: e.target.value } : fi))
|
|
30329
30672
|
},
|
|
30330
|
-
columns.map((c) => /* @__PURE__ */
|
|
30331
|
-
), /* @__PURE__ */
|
|
30673
|
+
columns.map((c) => /* @__PURE__ */ import_react18.default.createElement("option", { key: String(c.key), value: String(c.key) }, c.header))
|
|
30674
|
+
), /* @__PURE__ */ import_react18.default.createElement(
|
|
30332
30675
|
"select",
|
|
30333
30676
|
{
|
|
30334
30677
|
className: "dg-filter-select dg-filter-select-sm",
|
|
30335
30678
|
value: f.operator,
|
|
30336
30679
|
onChange: (e) => setAdvancedFilters((p) => p.map((fi, i) => i === idx ? { ...fi, operator: e.target.value } : fi))
|
|
30337
30680
|
},
|
|
30338
|
-
/* @__PURE__ */
|
|
30339
|
-
/* @__PURE__ */
|
|
30340
|
-
/* @__PURE__ */
|
|
30341
|
-
/* @__PURE__ */
|
|
30342
|
-
/* @__PURE__ */
|
|
30343
|
-
/* @__PURE__ */
|
|
30344
|
-
), /* @__PURE__ */
|
|
30681
|
+
/* @__PURE__ */ import_react18.default.createElement("option", { value: "contains" }, "contains"),
|
|
30682
|
+
/* @__PURE__ */ import_react18.default.createElement("option", { value: "equals" }, "equals"),
|
|
30683
|
+
/* @__PURE__ */ import_react18.default.createElement("option", { value: "starts with" }, "starts with"),
|
|
30684
|
+
/* @__PURE__ */ import_react18.default.createElement("option", { value: "ends with" }, "ends with"),
|
|
30685
|
+
/* @__PURE__ */ import_react18.default.createElement("option", { value: "is empty" }, "is empty"),
|
|
30686
|
+
/* @__PURE__ */ import_react18.default.createElement("option", { value: "is not empty" }, "is not empty")
|
|
30687
|
+
), /* @__PURE__ */ import_react18.default.createElement(
|
|
30345
30688
|
"input",
|
|
30346
30689
|
{
|
|
30347
30690
|
className: "dg-filter-input",
|
|
@@ -30349,28 +30692,28 @@ function DataGrid({
|
|
|
30349
30692
|
value: f.value,
|
|
30350
30693
|
onChange: (e) => setAdvancedFilters((p) => p.map((fi, i) => i === idx ? { ...fi, value: e.target.value } : fi))
|
|
30351
30694
|
}
|
|
30352
|
-
)))), /* @__PURE__ */
|
|
30695
|
+
)))), /* @__PURE__ */ import_react18.default.createElement(
|
|
30353
30696
|
"button",
|
|
30354
30697
|
{
|
|
30355
30698
|
className: "dg-action-btn",
|
|
30356
30699
|
style: { alignSelf: "flex-start", marginTop: 4 },
|
|
30357
30700
|
onClick: () => setAdvancedFilters((p) => [...p, { column: String(columns[0].key), operator: "contains", value: "", logic: "AND" }])
|
|
30358
30701
|
},
|
|
30359
|
-
/* @__PURE__ */
|
|
30702
|
+
/* @__PURE__ */ import_react18.default.createElement(import_lucide_react.Plus, { size: 14 }),
|
|
30360
30703
|
" Add Filter"
|
|
30361
|
-
)), /* @__PURE__ */
|
|
30704
|
+
)), /* @__PURE__ */ import_react18.default.createElement("div", { className: "dg-modal-footer" }, /* @__PURE__ */ import_react18.default.createElement(
|
|
30362
30705
|
"button",
|
|
30363
30706
|
{
|
|
30364
30707
|
className: "dg-action-btn",
|
|
30365
30708
|
onClick: () => setAdvancedFilters([{ column: String(columns[0].key), operator: "contains", value: "", logic: "AND" }])
|
|
30366
30709
|
},
|
|
30367
|
-
/* @__PURE__ */
|
|
30710
|
+
/* @__PURE__ */ import_react18.default.createElement(import_lucide_react.Trash2, { size: 14 }),
|
|
30368
30711
|
" Reset"
|
|
30369
|
-
), /* @__PURE__ */
|
|
30712
|
+
), /* @__PURE__ */ import_react18.default.createElement("button", { className: "submit-btn", onClick: () => setShowAdvancedFilter(false) }, "Apply")))));
|
|
30370
30713
|
}
|
|
30371
30714
|
|
|
30372
30715
|
// lib/Editors/RichTextEditor.tsx
|
|
30373
|
-
var
|
|
30716
|
+
var import_react19 = __toESM(require("react"), 1);
|
|
30374
30717
|
var import_jodit_react = __toESM(require("jodit-react"), 1);
|
|
30375
30718
|
var MOBILE_BREAKPOINT = 768;
|
|
30376
30719
|
var TODO_STATES = [
|
|
@@ -30453,18 +30796,18 @@ function RichTextEditor({
|
|
|
30453
30796
|
className = "",
|
|
30454
30797
|
style
|
|
30455
30798
|
}) {
|
|
30456
|
-
const editorRef = (0,
|
|
30457
|
-
const containerRef = (0,
|
|
30458
|
-
const [isMobile, setIsMobile] = (0,
|
|
30459
|
-
const [showAll, setShowAll] = (0,
|
|
30460
|
-
const [isListening, setIsListening] = (0,
|
|
30461
|
-
const [speechText, setSpeechText] = (0,
|
|
30462
|
-
const [speechVisible, setSpeechVisible] = (0,
|
|
30463
|
-
const [speechPos, setSpeechPos] = (0,
|
|
30464
|
-
const recognitionRef = (0,
|
|
30465
|
-
const silenceTimer = (0,
|
|
30466
|
-
const interimSpanRef = (0,
|
|
30467
|
-
(0,
|
|
30799
|
+
const editorRef = (0, import_react19.useRef)(null);
|
|
30800
|
+
const containerRef = (0, import_react19.useRef)(null);
|
|
30801
|
+
const [isMobile, setIsMobile] = (0, import_react19.useState)(false);
|
|
30802
|
+
const [showAll, setShowAll] = (0, import_react19.useState)(true);
|
|
30803
|
+
const [isListening, setIsListening] = (0, import_react19.useState)(false);
|
|
30804
|
+
const [speechText, setSpeechText] = (0, import_react19.useState)("");
|
|
30805
|
+
const [speechVisible, setSpeechVisible] = (0, import_react19.useState)(false);
|
|
30806
|
+
const [speechPos, setSpeechPos] = (0, import_react19.useState)({ top: 0, left: 0 });
|
|
30807
|
+
const recognitionRef = (0, import_react19.useRef)(null);
|
|
30808
|
+
const silenceTimer = (0, import_react19.useRef)(null);
|
|
30809
|
+
const interimSpanRef = (0, import_react19.useRef)(null);
|
|
30810
|
+
(0, import_react19.useEffect)(() => {
|
|
30468
30811
|
const check = () => {
|
|
30469
30812
|
const mobile = window.innerWidth <= MOBILE_BREAKPOINT;
|
|
30470
30813
|
setIsMobile(mobile);
|
|
@@ -30474,7 +30817,7 @@ function RichTextEditor({
|
|
|
30474
30817
|
window.addEventListener("resize", check);
|
|
30475
30818
|
return () => window.removeEventListener("resize", check);
|
|
30476
30819
|
}, []);
|
|
30477
|
-
(0,
|
|
30820
|
+
(0, import_react19.useEffect)(() => {
|
|
30478
30821
|
let cursorTimeout;
|
|
30479
30822
|
Promise.resolve().then(() => (init_esm(), esm_exports)).then(({ Jodit: Jodit4 }) => {
|
|
30480
30823
|
Jodit4.plugins.add("rteKeyLogger", (jodit) => {
|
|
@@ -30679,7 +31022,7 @@ function RichTextEditor({
|
|
|
30679
31022
|
iconURL: showAll ? "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIj48Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBmaWxsPSJub25lIi8+PHBvbHlsaW5lIHBvaW50cz0iOCAxNCAxMiAxMCAxNiAxNCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=" : "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIj48Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBmaWxsPSJub25lIi8+PHBvbHlsaW5lIHBvaW50cz0iOCAxMCAxMiAxNCAxNiAxMCIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJibGFjayIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=",
|
|
30680
31023
|
exec: () => setShowAll((prev) => !prev)
|
|
30681
31024
|
};
|
|
30682
|
-
const config =
|
|
31025
|
+
const config = import_react19.default.useMemo(() => {
|
|
30683
31026
|
let uploadConfig = {};
|
|
30684
31027
|
if (uploadUrl) {
|
|
30685
31028
|
const uploadData = {};
|
|
@@ -30795,14 +31138,14 @@ function RichTextEditor({
|
|
|
30795
31138
|
safePluginList: ["changecase", "rteKeyLogger"]
|
|
30796
31139
|
};
|
|
30797
31140
|
}, [isMobile, showAll, isListening, disabled, aiSupport, licenseKey, translationKey, token, uploadUrl, mentions?.arr?.length, height, width, allowResizeY, fullSize, placeholder2]);
|
|
30798
|
-
return /* @__PURE__ */
|
|
31141
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
30799
31142
|
"div",
|
|
30800
31143
|
{
|
|
30801
31144
|
ref: containerRef,
|
|
30802
31145
|
className: `rte-wrapper ${isListening ? "rte-listening" : ""} ${className}`,
|
|
30803
31146
|
style
|
|
30804
31147
|
},
|
|
30805
|
-
/* @__PURE__ */
|
|
31148
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
30806
31149
|
import_jodit_react.default,
|
|
30807
31150
|
{
|
|
30808
31151
|
ref: editorRef,
|
|
@@ -30813,7 +31156,7 @@ function RichTextEditor({
|
|
|
30813
31156
|
onBlur: (v) => onBlur?.(v)
|
|
30814
31157
|
}
|
|
30815
31158
|
),
|
|
30816
|
-
/* @__PURE__ */
|
|
31159
|
+
/* @__PURE__ */ import_react19.default.createElement(
|
|
30817
31160
|
"div",
|
|
30818
31161
|
{
|
|
30819
31162
|
className: "rte-speech-popup",
|
|
@@ -30825,10 +31168,10 @@ function RichTextEditor({
|
|
|
30825
31168
|
pointerEvents: "none"
|
|
30826
31169
|
}
|
|
30827
31170
|
},
|
|
30828
|
-
/* @__PURE__ */
|
|
30829
|
-
/* @__PURE__ */
|
|
31171
|
+
/* @__PURE__ */ import_react19.default.createElement("span", { className: "rte-speech-dot" }),
|
|
31172
|
+
/* @__PURE__ */ import_react19.default.createElement("span", null, speechText || "\u2026")
|
|
30830
31173
|
),
|
|
30831
|
-
error2 && /* @__PURE__ */
|
|
31174
|
+
error2 && /* @__PURE__ */ import_react19.default.createElement("p", { className: "rte-error" }, error2)
|
|
30832
31175
|
);
|
|
30833
31176
|
}
|
|
30834
31177
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -30836,6 +31179,7 @@ function RichTextEditor({
|
|
|
30836
31179
|
APP_THEMES,
|
|
30837
31180
|
ActivateUserIcon,
|
|
30838
31181
|
AddButton,
|
|
31182
|
+
AddressLookup,
|
|
30839
31183
|
ArchivedIcon,
|
|
30840
31184
|
AssignGroupIcon,
|
|
30841
31185
|
BaseDialog,
|