@algenium/blocks 1.4.0 → 1.5.0-rc.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/dist/index.cjs +95 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +33 -1
- package/dist/index.d.ts +33 -1
- package/dist/index.js +92 -32
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -3794,6 +3794,90 @@ var defaultLabels2 = {
|
|
|
3794
3794
|
staging: "Staging",
|
|
3795
3795
|
development: "Development"
|
|
3796
3796
|
};
|
|
3797
|
+
function getEnvironmentDotClass(env) {
|
|
3798
|
+
switch (env) {
|
|
3799
|
+
case "production":
|
|
3800
|
+
return "bg-emerald-500";
|
|
3801
|
+
case "staging":
|
|
3802
|
+
return "bg-orange-500";
|
|
3803
|
+
case "development":
|
|
3804
|
+
return "bg-amber-400";
|
|
3805
|
+
default:
|
|
3806
|
+
return "bg-muted-foreground";
|
|
3807
|
+
}
|
|
3808
|
+
}
|
|
3809
|
+
function getEnvironmentLabel(env, labels) {
|
|
3810
|
+
switch (env) {
|
|
3811
|
+
case "production":
|
|
3812
|
+
return labels.live;
|
|
3813
|
+
case "staging":
|
|
3814
|
+
return labels.staging;
|
|
3815
|
+
case "development":
|
|
3816
|
+
return labels.development;
|
|
3817
|
+
default:
|
|
3818
|
+
return env;
|
|
3819
|
+
}
|
|
3820
|
+
}
|
|
3821
|
+
function abbreviateEnvironment(env) {
|
|
3822
|
+
switch (env) {
|
|
3823
|
+
case "production":
|
|
3824
|
+
return "Prod";
|
|
3825
|
+
case "staging":
|
|
3826
|
+
return "Stg";
|
|
3827
|
+
case "development":
|
|
3828
|
+
return "Dev";
|
|
3829
|
+
default:
|
|
3830
|
+
return env;
|
|
3831
|
+
}
|
|
3832
|
+
}
|
|
3833
|
+
var environmentDotSizeClasses = {
|
|
3834
|
+
xs: "size-1.5",
|
|
3835
|
+
sm: "size-2",
|
|
3836
|
+
md: "size-2.5"
|
|
3837
|
+
};
|
|
3838
|
+
function EnvironmentDot({
|
|
3839
|
+
env,
|
|
3840
|
+
size = "sm",
|
|
3841
|
+
className
|
|
3842
|
+
}) {
|
|
3843
|
+
const sizeClass = environmentDotSizeClasses[size];
|
|
3844
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
3845
|
+
"span",
|
|
3846
|
+
{
|
|
3847
|
+
className: cn(
|
|
3848
|
+
"rounded-full shrink-0 ring-1 ring-background",
|
|
3849
|
+
sizeClass,
|
|
3850
|
+
getEnvironmentDotClass(env),
|
|
3851
|
+
className
|
|
3852
|
+
),
|
|
3853
|
+
"aria-hidden": true
|
|
3854
|
+
}
|
|
3855
|
+
);
|
|
3856
|
+
}
|
|
3857
|
+
function EnvironmentMiniBadge({
|
|
3858
|
+
className,
|
|
3859
|
+
environment: propEnvironment,
|
|
3860
|
+
labels: userLabels,
|
|
3861
|
+
abbreviated = true
|
|
3862
|
+
}) {
|
|
3863
|
+
const ctx = useEnvironmentContext();
|
|
3864
|
+
const labels = { ...defaultLabels2, ...userLabels };
|
|
3865
|
+
const environment = propEnvironment ?? ctx?.environment ?? "production";
|
|
3866
|
+
const text = abbreviated ? abbreviateEnvironment(environment) : getEnvironmentLabel(environment, labels);
|
|
3867
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
3868
|
+
"span",
|
|
3869
|
+
{
|
|
3870
|
+
className: cn(
|
|
3871
|
+
"inline-flex max-w-[4.5rem] items-center gap-1 rounded-full border border-border bg-muted/60 px-1.5 py-0.5 text-[10px] font-semibold tabular-nums text-foreground",
|
|
3872
|
+
className
|
|
3873
|
+
),
|
|
3874
|
+
children: [
|
|
3875
|
+
/* @__PURE__ */ jsxRuntime.jsx(EnvironmentDot, { env: environment, size: "xs" }),
|
|
3876
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "min-w-0 truncate", children: text })
|
|
3877
|
+
]
|
|
3878
|
+
}
|
|
3879
|
+
);
|
|
3880
|
+
}
|
|
3797
3881
|
var sizeClasses3 = {
|
|
3798
3882
|
sm: {
|
|
3799
3883
|
container: "h-7 p-0.5 text-xs",
|
|
@@ -3821,30 +3905,6 @@ var shapeClasses3 = {
|
|
|
3821
3905
|
rounded: "rounded-md",
|
|
3822
3906
|
pill: "rounded-full"
|
|
3823
3907
|
};
|
|
3824
|
-
function envDotClass(env) {
|
|
3825
|
-
switch (env) {
|
|
3826
|
-
case "production":
|
|
3827
|
-
return "bg-emerald-500";
|
|
3828
|
-
case "staging":
|
|
3829
|
-
return "bg-orange-500";
|
|
3830
|
-
case "development":
|
|
3831
|
-
return "bg-amber-400";
|
|
3832
|
-
default:
|
|
3833
|
-
return "bg-muted-foreground";
|
|
3834
|
-
}
|
|
3835
|
-
}
|
|
3836
|
-
function labelForEnv(env, labels) {
|
|
3837
|
-
switch (env) {
|
|
3838
|
-
case "production":
|
|
3839
|
-
return labels.live;
|
|
3840
|
-
case "staging":
|
|
3841
|
-
return labels.staging;
|
|
3842
|
-
case "development":
|
|
3843
|
-
return labels.development;
|
|
3844
|
-
default:
|
|
3845
|
-
return env;
|
|
3846
|
-
}
|
|
3847
|
-
}
|
|
3848
3908
|
function EnvironmentSwitcher({
|
|
3849
3909
|
className,
|
|
3850
3910
|
environment: propEnvironment,
|
|
@@ -3895,12 +3955,12 @@ function EnvironmentSwitcher({
|
|
|
3895
3955
|
className: cn(
|
|
3896
3956
|
"rounded-full shrink-0 ring-1 ring-background",
|
|
3897
3957
|
sizes.dot,
|
|
3898
|
-
|
|
3958
|
+
getEnvironmentDotClass(environment)
|
|
3899
3959
|
),
|
|
3900
3960
|
"aria-hidden": true
|
|
3901
3961
|
}
|
|
3902
3962
|
),
|
|
3903
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-w-[5.5rem] truncate", children:
|
|
3963
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "max-w-[5.5rem] truncate", children: getEnvironmentLabel(environment, labels) })
|
|
3904
3964
|
]
|
|
3905
3965
|
}
|
|
3906
3966
|
) }) }),
|
|
@@ -3929,12 +3989,12 @@ function EnvironmentSwitcher({
|
|
|
3929
3989
|
className: cn(
|
|
3930
3990
|
"rounded-full shrink-0 ring-1 ring-background",
|
|
3931
3991
|
sizes.dot,
|
|
3932
|
-
|
|
3992
|
+
getEnvironmentDotClass(env)
|
|
3933
3993
|
),
|
|
3934
3994
|
"aria-hidden": true
|
|
3935
3995
|
}
|
|
3936
3996
|
),
|
|
3937
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children:
|
|
3997
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: getEnvironmentLabel(env, labels) })
|
|
3938
3998
|
]
|
|
3939
3999
|
},
|
|
3940
4000
|
env
|
|
@@ -3965,7 +4025,7 @@ function EnvironmentSwitcher({
|
|
|
3965
4025
|
"button",
|
|
3966
4026
|
{
|
|
3967
4027
|
type: "button",
|
|
3968
|
-
"aria-label":
|
|
4028
|
+
"aria-label": getEnvironmentLabel(env, labels),
|
|
3969
4029
|
"aria-pressed": isActive,
|
|
3970
4030
|
className: cn(
|
|
3971
4031
|
"relative min-w-0 font-semibold capitalize",
|
|
@@ -3999,12 +4059,12 @@ function EnvironmentSwitcher({
|
|
|
3999
4059
|
className: cn(
|
|
4000
4060
|
"rounded-full shrink-0 ring-1 ring-background",
|
|
4001
4061
|
"h-1.5 w-1.5",
|
|
4002
|
-
|
|
4062
|
+
getEnvironmentDotClass(env)
|
|
4003
4063
|
),
|
|
4004
4064
|
"aria-hidden": true
|
|
4005
4065
|
}
|
|
4006
4066
|
),
|
|
4007
|
-
|
|
4067
|
+
getEnvironmentLabel(env, labels)
|
|
4008
4068
|
]
|
|
4009
4069
|
}
|
|
4010
4070
|
)
|
|
@@ -7340,6 +7400,8 @@ exports.DropdownMenuSubTrigger = DropdownMenuSubTrigger;
|
|
|
7340
7400
|
exports.DropdownMenuTrigger = DropdownMenuTrigger;
|
|
7341
7401
|
exports.EnvironmentBanner = EnvironmentBanner;
|
|
7342
7402
|
exports.EnvironmentContext = EnvironmentContext;
|
|
7403
|
+
exports.EnvironmentDot = EnvironmentDot;
|
|
7404
|
+
exports.EnvironmentMiniBadge = EnvironmentMiniBadge;
|
|
7343
7405
|
exports.EnvironmentSwitcher = EnvironmentSwitcher;
|
|
7344
7406
|
exports.EventDialog = EventDialog;
|
|
7345
7407
|
exports.EventRsvpBadge = EventRsvpBadge;
|
|
@@ -7365,6 +7427,8 @@ exports.UpcomingEvents = UpcomingEvents;
|
|
|
7365
7427
|
exports.buttonVariants = buttonVariants;
|
|
7366
7428
|
exports.cn = cn;
|
|
7367
7429
|
exports.defaultLanguages = defaultLanguages;
|
|
7430
|
+
exports.getEnvironmentDotClass = getEnvironmentDotClass;
|
|
7431
|
+
exports.getEnvironmentLabel = getEnvironmentLabel;
|
|
7368
7432
|
exports.isBlocksDataEnvironment = isBlocksDataEnvironment;
|
|
7369
7433
|
exports.toggleVariants = toggleVariants;
|
|
7370
7434
|
exports.useCalendarContext = useCalendarContext;
|