@sustaina/shared-ui 1.15.0 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +42 -18
- package/dist/index.d.ts +42 -18
- package/dist/index.js +368 -134
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +367 -134
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -850,7 +850,7 @@ function SelectTrigger({
|
|
|
850
850
|
"data-slot": "select-trigger",
|
|
851
851
|
"data-size": size,
|
|
852
852
|
className: cn(
|
|
853
|
-
"border-input data-
|
|
853
|
+
"border-input data-placeholder:text-gray-00 [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:hover:bg-input/50 flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap shadow-xs transition-[color,box-shadow] outline-none disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 data-[state=open]:border-ring data-[state=open]:[&_svg]:text-foreground",
|
|
854
854
|
className
|
|
855
855
|
),
|
|
856
856
|
...props,
|
|
@@ -872,7 +872,7 @@ function SelectContent({
|
|
|
872
872
|
{
|
|
873
873
|
"data-slot": "select-content",
|
|
874
874
|
className: cn(
|
|
875
|
-
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-
|
|
875
|
+
"bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 relative z-50 max-h-(--radix-select-content-available-height) min-w-32 origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border shadow-md",
|
|
876
876
|
position === "popper" && "data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
|
|
877
877
|
className
|
|
878
878
|
),
|
|
@@ -885,7 +885,7 @@ function SelectContent({
|
|
|
885
885
|
{
|
|
886
886
|
className: cn(
|
|
887
887
|
"m-1",
|
|
888
|
-
position === "popper" && "h-
|
|
888
|
+
position === "popper" && "h-(--radix-select-trigger-height) w-full min-w-(--radix-select-trigger-width) scroll-my-1"
|
|
889
889
|
),
|
|
890
890
|
children
|
|
891
891
|
}
|
|
@@ -915,7 +915,7 @@ function SelectItem({
|
|
|
915
915
|
{
|
|
916
916
|
"data-slot": "select-item",
|
|
917
917
|
className: cn(
|
|
918
|
-
"hover:bg-[#EAF5EE] hover:text-[#379A2A] [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-
|
|
918
|
+
"hover:bg-[#EAF5EE] hover:text-[#379A2A] [&_svg:not([class*='text-'])]:text-muted-foreground relative flex w-full cursor-default items-center gap-2 py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2 ",
|
|
919
919
|
className
|
|
920
920
|
),
|
|
921
921
|
...props,
|
|
@@ -4911,127 +4911,130 @@ function Button2({
|
|
|
4911
4911
|
}
|
|
4912
4912
|
|
|
4913
4913
|
// src/components/dialog-alert/lib/constants.ts
|
|
4914
|
-
var
|
|
4914
|
+
var DIALOG_ALERT_I18N_SUBNAMESPACE = "dialog_alert";
|
|
4915
|
+
var i18nPrefix = `translation:${DIALOG_ALERT_I18N_SUBNAMESPACE}.`;
|
|
4915
4916
|
|
|
4916
4917
|
// src/components/dialog-alert/locale/default.ts
|
|
4917
4918
|
var defaultResource = {
|
|
4918
4919
|
sharedui: {
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4925
|
-
|
|
4926
|
-
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
|
|
4930
|
-
|
|
4931
|
-
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
|
|
4937
|
-
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
|
|
4955
|
-
|
|
4956
|
-
|
|
4957
|
-
|
|
4958
|
-
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4999
|
-
|
|
5000
|
-
|
|
5001
|
-
|
|
5002
|
-
|
|
5003
|
-
|
|
5004
|
-
|
|
5005
|
-
|
|
5006
|
-
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5034
|
-
|
|
4920
|
+
translation: {
|
|
4921
|
+
[DIALOG_ALERT_I18N_SUBNAMESPACE]: {
|
|
4922
|
+
cancel: "Cancel",
|
|
4923
|
+
close: "Close",
|
|
4924
|
+
"success.saved": {
|
|
4925
|
+
title: "Successfully",
|
|
4926
|
+
description: "Data has been successfully saved"
|
|
4927
|
+
},
|
|
4928
|
+
"success.deleted": {
|
|
4929
|
+
title: "Successfully",
|
|
4930
|
+
description: "Data has been successfully deleted"
|
|
4931
|
+
},
|
|
4932
|
+
"success.removed": {
|
|
4933
|
+
title: "Successfully",
|
|
4934
|
+
description: "Data has been successfully removed"
|
|
4935
|
+
},
|
|
4936
|
+
"error.api_db_error": {
|
|
4937
|
+
title: "API/Database Error",
|
|
4938
|
+
description: "Failed to connect to the system. Please check API or database connection."
|
|
4939
|
+
},
|
|
4940
|
+
"error.permission_denied": {
|
|
4941
|
+
title: "Permission Denied",
|
|
4942
|
+
description: "You do not have permission to delete this data.",
|
|
4943
|
+
confirm_text: "Discard"
|
|
4944
|
+
},
|
|
4945
|
+
"error.session_expired": {
|
|
4946
|
+
title: "Session Expired",
|
|
4947
|
+
description: "Your session has expired or you have been logged out. Please sign in again.",
|
|
4948
|
+
confirm_text: "Logout"
|
|
4949
|
+
},
|
|
4950
|
+
"error.user_not_found": {
|
|
4951
|
+
title: "User Not Found",
|
|
4952
|
+
description: "The system could not locate the user account.",
|
|
4953
|
+
confirm_text: "Logout"
|
|
4954
|
+
},
|
|
4955
|
+
"error.data_not_found": {
|
|
4956
|
+
title: "Data Not Found",
|
|
4957
|
+
description: "The data has already been deleted or does not exist in the system."
|
|
4958
|
+
},
|
|
4959
|
+
"error.data_restrict_editing": {
|
|
4960
|
+
title: "Data Status Restricts Editing",
|
|
4961
|
+
description: "Data status does not allow editing."
|
|
4962
|
+
},
|
|
4963
|
+
"error.network_timeout_error": {
|
|
4964
|
+
title: "Network Error / Timeout",
|
|
4965
|
+
description: "The system could not connect to the network or the request took too long to process."
|
|
4966
|
+
},
|
|
4967
|
+
"error.queue_full": {
|
|
4968
|
+
title: "Queue Full",
|
|
4969
|
+
description: "The notification queue has reached its limit. Please try again later."
|
|
4970
|
+
},
|
|
4971
|
+
"error.invalid_data_format": {
|
|
4972
|
+
title: "Invalid Data Format",
|
|
4973
|
+
description: "Data creation failed due to invalid or incorrectly formatted data."
|
|
4974
|
+
},
|
|
4975
|
+
"error.data_linked_to_system_data": {
|
|
4976
|
+
title: "Data Linked to System Data",
|
|
4977
|
+
description: "Cannot delete data because they are linked to existing system data."
|
|
4978
|
+
},
|
|
4979
|
+
"error.pending_workflow_conflict": {
|
|
4980
|
+
title: "Pending Workflow Conflict ",
|
|
4981
|
+
description: "The data is currently involved in a pending workflow or approval process and cannot be deactivated."
|
|
4982
|
+
},
|
|
4983
|
+
"error.invalid_incomplete_data": {
|
|
4984
|
+
title: "Invalid or Incomplete Data",
|
|
4985
|
+
description: "Data status cannot be changed due to incomplete or invalid information."
|
|
4986
|
+
},
|
|
4987
|
+
"error.client_side_error": {
|
|
4988
|
+
title: "Client-Side Error",
|
|
4989
|
+
description: "An error occurred on the client side. Please refresh the page or try again."
|
|
4990
|
+
},
|
|
4991
|
+
"error.system_limitation": {
|
|
4992
|
+
title: "System Limitation",
|
|
4993
|
+
description: "The search cannot be completed due to system limitations. Please simplify your query."
|
|
4994
|
+
},
|
|
4995
|
+
"error.timeout": {
|
|
4996
|
+
title: "Timeout",
|
|
4997
|
+
description: "Request failed due to a system error or timeout. Please try again."
|
|
4998
|
+
},
|
|
4999
|
+
"error.duplicate_data": {
|
|
5000
|
+
title: "Duplicate Data",
|
|
5001
|
+
description: "The data you entered already exists in the system."
|
|
5002
|
+
},
|
|
5003
|
+
"error.something_went_wrong": {
|
|
5004
|
+
title: "Something Went Wrong",
|
|
5005
|
+
description: "An unknown error occurred."
|
|
5006
|
+
},
|
|
5007
|
+
"confirm.delete": {
|
|
5008
|
+
title: "Confirmation",
|
|
5009
|
+
description: "Are you sure you want to delete this item?",
|
|
5010
|
+
confirm_text: "Delete"
|
|
5011
|
+
},
|
|
5012
|
+
"confirm.inactive": {
|
|
5013
|
+
title: "Confirmation",
|
|
5014
|
+
description: "Are you sure you want to inactive this item?",
|
|
5015
|
+
confirm_text: "Inactive"
|
|
5016
|
+
},
|
|
5017
|
+
"confirm.active": {
|
|
5018
|
+
variant: "confirm-green",
|
|
5019
|
+
title: "Confirmation",
|
|
5020
|
+
description: "Are you sure you want to active this item?",
|
|
5021
|
+
confirm_text: "Active"
|
|
5022
|
+
},
|
|
5023
|
+
"confirm.leave_page": {
|
|
5024
|
+
title: "Confirmation",
|
|
5025
|
+
description: "Unsaved changes. Do you want to leave this page?",
|
|
5026
|
+
confirm_text: "Leave"
|
|
5027
|
+
},
|
|
5028
|
+
"confirm.remove": {
|
|
5029
|
+
title: "Confirmation",
|
|
5030
|
+
description: "Are you sure you want to remove this item?",
|
|
5031
|
+
confirm_text: "Remove"
|
|
5032
|
+
},
|
|
5033
|
+
"confirm.logout": {
|
|
5034
|
+
title: "Confirmation",
|
|
5035
|
+
description: "Do you want to log out?",
|
|
5036
|
+
confirm_text: "Logout"
|
|
5037
|
+
}
|
|
5035
5038
|
}
|
|
5036
5039
|
}
|
|
5037
5040
|
}
|
|
@@ -5042,7 +5045,7 @@ i18n.use(initReactI18next).init({
|
|
|
5042
5045
|
resources: defaultResource,
|
|
5043
5046
|
lng: "sharedui",
|
|
5044
5047
|
fallbackLng: "sharedui",
|
|
5045
|
-
defaultNS:
|
|
5048
|
+
defaultNS: "translation",
|
|
5046
5049
|
interpolation: {
|
|
5047
5050
|
escapeValue: false
|
|
5048
5051
|
// react already safes from xss
|
|
@@ -5073,7 +5076,7 @@ function DialogAlert({
|
|
|
5073
5076
|
persistent = false
|
|
5074
5077
|
}) {
|
|
5075
5078
|
const alignClass = align === "start" ? "justify-start" : align === "end" ? "justify-end" : "justify-center";
|
|
5076
|
-
const { t } = useTranslation(
|
|
5079
|
+
const { t } = useTranslation();
|
|
5077
5080
|
const handleCancel = useCallback(() => {
|
|
5078
5081
|
onCancel?.();
|
|
5079
5082
|
onOpenChange(false);
|
|
@@ -5268,6 +5271,10 @@ var useDialogAlertStore = create((set, get) => ({
|
|
|
5268
5271
|
let templateVal;
|
|
5269
5272
|
if (payload?.template) {
|
|
5270
5273
|
templateVal = getDialogTemplates({ setOpen: get().setOpen })[payload.template];
|
|
5274
|
+
templateVal.title = templateVal.title ? i18nPrefix + templateVal.title : void 0;
|
|
5275
|
+
templateVal.description = templateVal.description ? i18nPrefix + templateVal.description : void 0;
|
|
5276
|
+
templateVal.confirmText = templateVal.confirmText ? i18nPrefix + templateVal.confirmText : void 0;
|
|
5277
|
+
templateVal.cancelText = templateVal.cancelText ? i18nPrefix + templateVal.cancelText : void 0;
|
|
5271
5278
|
}
|
|
5272
5279
|
get().setDialogProps({ ...templateVal, ...payload?.props });
|
|
5273
5280
|
get().setOpen(true);
|
|
@@ -5285,17 +5292,16 @@ var DialogAlertProvider = ({ children, i18nResource, i18nLang }) => {
|
|
|
5285
5292
|
i18n_default.changeLanguage("sharedui");
|
|
5286
5293
|
return;
|
|
5287
5294
|
}
|
|
5288
|
-
|
|
5289
|
-
|
|
5290
|
-
|
|
5291
|
-
lang,
|
|
5292
|
-
|
|
5293
|
-
|
|
5294
|
-
|
|
5295
|
-
|
|
5296
|
-
|
|
5295
|
+
try {
|
|
5296
|
+
const langs = Object.keys(i18nResource);
|
|
5297
|
+
for (const lang of langs) {
|
|
5298
|
+
i18n_default.addResourceBundle(lang, "translation", i18nResource[lang]["translation"], false, true);
|
|
5299
|
+
}
|
|
5300
|
+
i18n_default.changeLanguage(i18nLang);
|
|
5301
|
+
} catch {
|
|
5302
|
+
i18n_default.changeLanguage("sharedui");
|
|
5303
|
+
return;
|
|
5297
5304
|
}
|
|
5298
|
-
i18n_default.changeLanguage(i18nLang);
|
|
5299
5305
|
}, [i18nLang, i18nResource]);
|
|
5300
5306
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5301
5307
|
children,
|
|
@@ -5738,6 +5744,233 @@ var useGridSettingsStore = create(
|
|
|
5738
5744
|
})
|
|
5739
5745
|
);
|
|
5740
5746
|
var useGridSettingsStore_default = useGridSettingsStore;
|
|
5747
|
+
function LoadingOverlay({
|
|
5748
|
+
className,
|
|
5749
|
+
fullscreen = true,
|
|
5750
|
+
spinnerClassName,
|
|
5751
|
+
...props
|
|
5752
|
+
}) {
|
|
5753
|
+
return /* @__PURE__ */ jsx(
|
|
5754
|
+
"div",
|
|
5755
|
+
{
|
|
5756
|
+
"data-slot": "loading-overlay",
|
|
5757
|
+
className: cn(
|
|
5758
|
+
fullscreen ? "fixed z-100" : "absolute z-10",
|
|
5759
|
+
"inset-0 flex items-center justify-center transition-opacity duration-300",
|
|
5760
|
+
className
|
|
5761
|
+
),
|
|
5762
|
+
...props,
|
|
5763
|
+
children: /* @__PURE__ */ jsx(Spinner, { className: cn("size-50", spinnerClassName) })
|
|
5764
|
+
}
|
|
5765
|
+
);
|
|
5766
|
+
}
|
|
5767
|
+
var DEVICE_SIZES = [320, 420, 640, 768, 1024, 1280, 1536, 1920];
|
|
5768
|
+
var IMAGE_SIZES = [16, 32, 48, 64, 96, 128, 256, 384];
|
|
5769
|
+
var defaultLoader = ({ src }) => src;
|
|
5770
|
+
function toNumber(value) {
|
|
5771
|
+
if (typeof value === "number") {
|
|
5772
|
+
return Number.isFinite(value) ? value : void 0;
|
|
5773
|
+
}
|
|
5774
|
+
if (typeof value === "string") {
|
|
5775
|
+
const parsed = parseInt(value, 10);
|
|
5776
|
+
return Number.isFinite(parsed) ? parsed : void 0;
|
|
5777
|
+
}
|
|
5778
|
+
return void 0;
|
|
5779
|
+
}
|
|
5780
|
+
function formatDimension(value) {
|
|
5781
|
+
if (typeof value === "number") {
|
|
5782
|
+
return `${value}px`;
|
|
5783
|
+
}
|
|
5784
|
+
return value;
|
|
5785
|
+
}
|
|
5786
|
+
function matchClosestSize(target) {
|
|
5787
|
+
for (const size of IMAGE_SIZES) {
|
|
5788
|
+
if (size >= target) {
|
|
5789
|
+
return size;
|
|
5790
|
+
}
|
|
5791
|
+
}
|
|
5792
|
+
return DEVICE_SIZES[DEVICE_SIZES.length - 1];
|
|
5793
|
+
}
|
|
5794
|
+
function getCandidateWidths({
|
|
5795
|
+
width,
|
|
5796
|
+
sizes,
|
|
5797
|
+
fill
|
|
5798
|
+
}) {
|
|
5799
|
+
if (fill || sizes) {
|
|
5800
|
+
return DEVICE_SIZES;
|
|
5801
|
+
}
|
|
5802
|
+
if (typeof width === "number" && width > 0) {
|
|
5803
|
+
const targets = /* @__PURE__ */ new Set([width, width * 2]);
|
|
5804
|
+
return Array.from(targets).map((target) => matchClosestSize(target)).sort((a, b) => a - b);
|
|
5805
|
+
}
|
|
5806
|
+
return DEVICE_SIZES;
|
|
5807
|
+
}
|
|
5808
|
+
var Image2 = React4.forwardRef(function Image3({
|
|
5809
|
+
src,
|
|
5810
|
+
alt,
|
|
5811
|
+
width,
|
|
5812
|
+
height,
|
|
5813
|
+
fill = false,
|
|
5814
|
+
sizes,
|
|
5815
|
+
quality = 75,
|
|
5816
|
+
priority = false,
|
|
5817
|
+
placeholder: placeholder2 = "empty",
|
|
5818
|
+
blurDataURL,
|
|
5819
|
+
loader = defaultLoader,
|
|
5820
|
+
unoptimized = false,
|
|
5821
|
+
wrapperClassName,
|
|
5822
|
+
className,
|
|
5823
|
+
objectFit,
|
|
5824
|
+
objectPosition,
|
|
5825
|
+
onLoadingComplete,
|
|
5826
|
+
style,
|
|
5827
|
+
...imgProps
|
|
5828
|
+
}, ref) {
|
|
5829
|
+
const {
|
|
5830
|
+
loading: loadingProp,
|
|
5831
|
+
fetchPriority: fetchPriorityProp,
|
|
5832
|
+
decoding: decodingProp,
|
|
5833
|
+
onLoad: onLoadProp,
|
|
5834
|
+
...restImgProps
|
|
5835
|
+
} = imgProps;
|
|
5836
|
+
const widthNumber = toNumber(width);
|
|
5837
|
+
const heightNumber = toNumber(height);
|
|
5838
|
+
React4.useEffect(() => {
|
|
5839
|
+
if (!fill && (!widthNumber || !heightNumber)) {
|
|
5840
|
+
console.warn(
|
|
5841
|
+
"[Image] When `fill` is false you should provide both `width` and `height` to prevent layout shifts."
|
|
5842
|
+
);
|
|
5843
|
+
}
|
|
5844
|
+
}, [fill, heightNumber, widthNumber]);
|
|
5845
|
+
const candidateWidths = React4.useMemo(
|
|
5846
|
+
() => getCandidateWidths({ width: widthNumber, sizes, fill }),
|
|
5847
|
+
[fill, sizes, widthNumber]
|
|
5848
|
+
);
|
|
5849
|
+
const largestWidth = candidateWidths[candidateWidths.length - 1] ?? widthNumber ?? DEVICE_SIZES[DEVICE_SIZES.length - 1];
|
|
5850
|
+
const computedSrc = React4.useMemo(() => {
|
|
5851
|
+
if (unoptimized) {
|
|
5852
|
+
return src;
|
|
5853
|
+
}
|
|
5854
|
+
return loader({ src, width: largestWidth, quality });
|
|
5855
|
+
}, [largestWidth, loader, quality, src, unoptimized]);
|
|
5856
|
+
const computedSrcSet = React4.useMemo(() => {
|
|
5857
|
+
if (unoptimized) {
|
|
5858
|
+
return void 0;
|
|
5859
|
+
}
|
|
5860
|
+
return candidateWidths.map((currentWidth) => `${loader({ src, width: currentWidth, quality })} ${currentWidth}w`).join(", ");
|
|
5861
|
+
}, [candidateWidths, loader, quality, src, unoptimized]);
|
|
5862
|
+
const sizesValue = sizes ?? (fill ? "100vw" : widthNumber ? `${widthNumber}px` : void 0);
|
|
5863
|
+
const [isLoaded, setIsLoaded] = React4.useState(false);
|
|
5864
|
+
const internalRef = React4.useRef(null);
|
|
5865
|
+
const setRefs = React4.useCallback(
|
|
5866
|
+
(node) => {
|
|
5867
|
+
internalRef.current = node;
|
|
5868
|
+
if (!ref) {
|
|
5869
|
+
return;
|
|
5870
|
+
}
|
|
5871
|
+
if (typeof ref === "function") {
|
|
5872
|
+
ref(node);
|
|
5873
|
+
} else {
|
|
5874
|
+
ref.current = node;
|
|
5875
|
+
}
|
|
5876
|
+
},
|
|
5877
|
+
[ref]
|
|
5878
|
+
);
|
|
5879
|
+
React4.useEffect(() => {
|
|
5880
|
+
const image = internalRef.current;
|
|
5881
|
+
if (!image) {
|
|
5882
|
+
return;
|
|
5883
|
+
}
|
|
5884
|
+
if (image.complete && image.naturalWidth > 0) {
|
|
5885
|
+
setIsLoaded(true);
|
|
5886
|
+
onLoadingComplete?.(image);
|
|
5887
|
+
} else {
|
|
5888
|
+
setIsLoaded(false);
|
|
5889
|
+
}
|
|
5890
|
+
}, [onLoadingComplete, src]);
|
|
5891
|
+
const handleLoad = React4.useCallback(
|
|
5892
|
+
(event) => {
|
|
5893
|
+
setIsLoaded(true);
|
|
5894
|
+
onLoadProp?.(event);
|
|
5895
|
+
onLoadingComplete?.(event.currentTarget);
|
|
5896
|
+
},
|
|
5897
|
+
[onLoadProp, onLoadingComplete]
|
|
5898
|
+
);
|
|
5899
|
+
const loading = priority ? "eager" : loadingProp ?? "lazy";
|
|
5900
|
+
const fetchPriority = priority ? "high" : fetchPriorityProp;
|
|
5901
|
+
const decoding = decodingProp ?? "async";
|
|
5902
|
+
const resolvedObjectFit = objectFit ?? (fill ? "cover" : void 0);
|
|
5903
|
+
const wrapperStyle = React4.useMemo(
|
|
5904
|
+
() => ({
|
|
5905
|
+
position: "relative",
|
|
5906
|
+
display: fill ? "block" : "inline-block",
|
|
5907
|
+
overflow: "hidden",
|
|
5908
|
+
width: fill ? "100%" : formatDimension(width) ?? void 0,
|
|
5909
|
+
height: fill ? "100%" : formatDimension(height) ?? void 0
|
|
5910
|
+
}),
|
|
5911
|
+
[fill, height, width]
|
|
5912
|
+
);
|
|
5913
|
+
const imageStyle = React4.useMemo(
|
|
5914
|
+
() => ({
|
|
5915
|
+
width: fill ? "100%" : formatDimension(width) ?? void 0,
|
|
5916
|
+
height: fill ? "100%" : formatDimension(height) ?? void 0,
|
|
5917
|
+
position: fill ? "absolute" : void 0,
|
|
5918
|
+
inset: fill ? 0 : void 0,
|
|
5919
|
+
objectFit: resolvedObjectFit,
|
|
5920
|
+
objectPosition,
|
|
5921
|
+
...style
|
|
5922
|
+
}),
|
|
5923
|
+
[fill, height, objectPosition, resolvedObjectFit, style, width]
|
|
5924
|
+
);
|
|
5925
|
+
const shouldShowLoadingOverlay = placeholder2 === "blur";
|
|
5926
|
+
return /* @__PURE__ */ jsxs(
|
|
5927
|
+
"span",
|
|
5928
|
+
{
|
|
5929
|
+
"data-slot": "image",
|
|
5930
|
+
className: cn("relative overflow-hidden", fill ? "block" : "inline-block", wrapperClassName),
|
|
5931
|
+
style: wrapperStyle,
|
|
5932
|
+
children: [
|
|
5933
|
+
shouldShowLoadingOverlay && /* @__PURE__ */ jsx(
|
|
5934
|
+
LoadingOverlay,
|
|
5935
|
+
{
|
|
5936
|
+
"aria-hidden": true,
|
|
5937
|
+
fullscreen: false,
|
|
5938
|
+
spinnerClassName: "size-6",
|
|
5939
|
+
className: cn(
|
|
5940
|
+
// "bg-white/75!",
|
|
5941
|
+
isLoaded ? "opacity-0 pointer-events-none" : "opacity-100"
|
|
5942
|
+
)
|
|
5943
|
+
}
|
|
5944
|
+
),
|
|
5945
|
+
/* @__PURE__ */ jsx(
|
|
5946
|
+
"img",
|
|
5947
|
+
{
|
|
5948
|
+
ref: setRefs,
|
|
5949
|
+
className: cn(
|
|
5950
|
+
"block transition-opacity duration-300",
|
|
5951
|
+
fill && "absolute inset-0 size-full",
|
|
5952
|
+
shouldShowLoadingOverlay && !isLoaded ? "opacity-0" : "opacity-100",
|
|
5953
|
+
className
|
|
5954
|
+
),
|
|
5955
|
+
src: computedSrc,
|
|
5956
|
+
srcSet: computedSrcSet,
|
|
5957
|
+
sizes: sizesValue,
|
|
5958
|
+
width: fill ? void 0 : widthNumber,
|
|
5959
|
+
height: fill ? void 0 : heightNumber,
|
|
5960
|
+
alt,
|
|
5961
|
+
loading,
|
|
5962
|
+
fetchPriority,
|
|
5963
|
+
decoding,
|
|
5964
|
+
onLoad: handleLoad,
|
|
5965
|
+
style: imageStyle,
|
|
5966
|
+
...restImgProps
|
|
5967
|
+
}
|
|
5968
|
+
)
|
|
5969
|
+
]
|
|
5970
|
+
}
|
|
5971
|
+
);
|
|
5972
|
+
});
|
|
5973
|
+
Image2.displayName = "Image";
|
|
5741
5974
|
var ListTable = ({ onTableReady, children }) => {
|
|
5742
5975
|
React4.useEffect(() => {
|
|
5743
5976
|
if (onTableReady) {
|
|
@@ -8446,6 +8679,6 @@ var CropperModal = ({
|
|
|
8446
8679
|
);
|
|
8447
8680
|
};
|
|
8448
8681
|
|
|
8449
|
-
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AdvanceSearch_default as AdvanceSearch, arrow_default as ArrowIcon, Button, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, CropperModal, CropperModalError,
|
|
8682
|
+
export { Accordion, AccordionContent, AccordionItem, AccordionTrigger, AdvanceSearch_default as AdvanceSearch, arrow_default as ArrowIcon, Button, Checkbox, Collapsible, CollapsibleContent2 as CollapsibleContent, CollapsibleTrigger2 as CollapsibleTrigger, CropperModal, CropperModalError, DIALOG_ALERT_I18N_SUBNAMESPACE, DataTable_default as DataTable, DatePicker2 as DatePicker, Dialog, DialogAlert, DialogAlertProvider, DialogContent, DialogDescription, DialogFooter, DialogTitle, DialogTrigger, ErrorCompression, ErrorCreateCanvas, ErrorGeneratingBlob, ErrorInvalidSVG, ErrorSVGExceedSize, Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage, GridSettingsModal_default as GridSettingsModal, HeaderCell_default as HeaderCell, Image2 as Image, Input, Label2 as Label, List_default as List, container_default as ListContainer, header_default as ListHeader, table_default as ListTable, LookupSelect, MonthPicker2 as MonthPicker, navbar_default as Navbar, not_found_default as NotFoundIcon, Popover, PopoverAnchor, PopoverArrow, PopoverContent, PopoverTrigger, PreventPageLeave_default as PreventPageLeave, RadioGroupItem, RadioGroupRoot, RadioLabel, RichText, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator2 as Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarLayout, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, Skeleton, Spinner, calendar_default as SuiCalendarIcon, check_default as SuiCheckIcon, dots_vertical_default as SuiDotsVerticalIcon, empty_data_default as SuiEmptyDataIcon, expand_default as SuiExpandIcon, filter_default as SuiFilterIcon, setting_default as SuiSettingIcon, triangle_down_default as SuiTriangleDownIcon, warning_default as SuiWarningIcon, Switch, Textarea, Tooltip, TooltipArrow, TooltipContent, TooltipProvider, TooltipTrigger, ui_exports as UI, booleanToSelectValue, buttonVariants, cn, compareAlphanumeric, debounce, formatISODate, getDialogAlertControls, getDialogTemplates, inputVariants, isDefined, isEmptyObject, selectValueToBoolean, spinnerVariants, stripNullishObject, throttle, useFormField, useGridSettingsStore_default as useGridSettingsStore, useHover_default as useHover, useIntersectionObserver_default as useIntersectionObserver, useMediaQuery_default as useMediaQuery, usePreventPageLeave_default as usePreventPageLeave, usePreventPageLeaveStore_default as usePreventPageLeaveStore, useScreenSize_default as useScreenSize, useSidebar, useTruncated_default as useTruncated };
|
|
8450
8683
|
//# sourceMappingURL=index.mjs.map
|
|
8451
8684
|
//# sourceMappingURL=index.mjs.map
|