dirk-cfx-react 1.1.83 → 1.1.84

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 CHANGED
@@ -3703,11 +3703,11 @@ function ConfirmModal({
3703
3703
  placeholder: confirmText,
3704
3704
  value: typed,
3705
3705
  onChange: (e) => setTyped(e.currentTarget.value),
3706
- styles: (t) => ({
3706
+ styles: (t2) => ({
3707
3707
  input: {
3708
- backgroundColor: core.alpha(t.colors.dark[7], 0.5),
3708
+ backgroundColor: core.alpha(t2.colors.dark[7], 0.5),
3709
3709
  border: `0.1vh solid ${core.alpha(
3710
- typed === confirmText ? "#ef4444" : t.colors.dark[5],
3710
+ typed === confirmText ? "#ef4444" : t2.colors.dark[5],
3711
3711
  0.5
3712
3712
  )}`,
3713
3713
  color: "rgba(255,255,255,0.85)",
@@ -6933,6 +6933,10 @@ function ScenarioSelect({
6933
6933
  }
6934
6934
  );
6935
6935
  }
6936
+ var t = (key, fallback) => {
6937
+ const v = locale(key);
6938
+ return v === key ? fallback : v;
6939
+ };
6936
6940
  function decimalToHex(color) {
6937
6941
  if (!color || color === 0) return null;
6938
6942
  return "#" + color.toString(16).padStart(6, "0");
@@ -6956,30 +6960,8 @@ function RoleOption({ role }) {
6956
6960
  /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "xs", c: "rgba(255,255,255,0.9)", children: role.name })
6957
6961
  ] });
6958
6962
  }
6959
- function NotConfiguredBanner({ label: label2 }) {
6960
- const theme2 = core.useMantineTheme();
6961
- return /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", gap: "xxs", children: [
6962
- label2 && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.55)", children: label2 }),
6963
- /* @__PURE__ */ jsxRuntime.jsxs(
6964
- core.Flex,
6965
- {
6966
- align: "center",
6967
- gap: "xs",
6968
- px: "xs",
6969
- py: "xxs",
6970
- style: {
6971
- background: "rgba(0,0,0,0.3)",
6972
- border: "0.1vh dashed rgba(255,255,255,0.12)",
6973
- borderRadius: theme2.radius.xs
6974
- },
6975
- children: [
6976
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLink, { size: "1.4vh", color: "rgba(255,255,255,0.4)" }),
6977
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", c: "rgba(255,255,255,0.55)", style: { flex: 1 }, children: locale("DiscordNotConfigured") || "Discord bot not configured \u2014 run /dirk_lib and set a bot token + guild ID." })
6978
- ]
6979
- }
6980
- )
6981
- ] });
6982
- }
6963
+ var NOT_CONFIGURED_TINT = "rgba(255,184,0,0.35)";
6964
+ var NOT_CONFIGURED_FILL = "rgba(255,184,0,0.05)";
6983
6965
  function DiscordRoleSelect(props) {
6984
6966
  const { endpoint, label: label2, size = "xs", placeholder, disabled, style, styles } = props;
6985
6967
  const [roles, setRoles] = React6.useState(null);
@@ -7019,7 +7001,53 @@ function DiscordRoleSelect(props) {
7019
7001
  return map;
7020
7002
  }, [roles]);
7021
7003
  if (errorCode === "NotConfigured") {
7022
- return /* @__PURE__ */ jsxRuntime.jsx(NotConfiguredBanner, { label: label2 });
7004
+ const notConfiguredPlaceholder = t(
7005
+ "DiscordNotConfigured",
7006
+ "Not configured \u2014 set in /dirk_lib"
7007
+ );
7008
+ const notConfiguredStyles = {
7009
+ ...styles,
7010
+ input: {
7011
+ ...styles?.input ?? {},
7012
+ borderColor: NOT_CONFIGURED_TINT,
7013
+ backgroundColor: NOT_CONFIGURED_FILL
7014
+ }
7015
+ };
7016
+ const warnIcon = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { size: "1.2vh", color: NOT_CONFIGURED_TINT.replace(/0\.35\)$/, "0.85)") });
7017
+ if (props.multi) {
7018
+ return /* @__PURE__ */ jsxRuntime.jsx(
7019
+ core.MultiSelect,
7020
+ {
7021
+ label: label2,
7022
+ size,
7023
+ placeholder: notConfiguredPlaceholder,
7024
+ data: [],
7025
+ value: [],
7026
+ onChange: () => {
7027
+ },
7028
+ disabled: true,
7029
+ rightSection: warnIcon,
7030
+ style,
7031
+ styles: notConfiguredStyles
7032
+ }
7033
+ );
7034
+ }
7035
+ return /* @__PURE__ */ jsxRuntime.jsx(
7036
+ core.Select,
7037
+ {
7038
+ label: label2,
7039
+ size,
7040
+ placeholder: notConfiguredPlaceholder,
7041
+ data: [],
7042
+ value: null,
7043
+ onChange: () => {
7044
+ },
7045
+ disabled: true,
7046
+ rightSection: warnIcon,
7047
+ style,
7048
+ styles: notConfiguredStyles
7049
+ }
7050
+ );
7023
7051
  }
7024
7052
  const data = (roles ?? []).map((r) => ({
7025
7053
  value: r.id,
@@ -7035,7 +7063,7 @@ function DiscordRoleSelect(props) {
7035
7063
  size: "xs",
7036
7064
  variant: "subtle",
7037
7065
  onClick: refresh,
7038
- title: locale("Refresh") || "Refresh",
7066
+ title: t("Refresh", "Refresh"),
7039
7067
  loading,
7040
7068
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { size: "1.2vh" })
7041
7069
  }
@@ -7046,7 +7074,7 @@ function DiscordRoleSelect(props) {
7046
7074
  {
7047
7075
  label: label2,
7048
7076
  size,
7049
- placeholder: placeholder || locale("PickRoles") || "Pick roles...",
7077
+ placeholder: placeholder || t("PickRoles", "Pick roles..."),
7050
7078
  data,
7051
7079
  value: props.value || [],
7052
7080
  onChange: (ids) => props.onChange(ids),
@@ -7057,7 +7085,7 @@ function DiscordRoleSelect(props) {
7057
7085
  rightSection: refreshButton,
7058
7086
  style,
7059
7087
  styles,
7060
- nothingFoundMessage: errorCode ? `${locale("Error") || "Error"} (${errorCode})` : locale("NoRoles") || "No roles found"
7088
+ nothingFoundMessage: errorCode ? `${t("Error", "Error")} (${errorCode})` : t("NoRoles", "No roles found")
7061
7089
  }
7062
7090
  );
7063
7091
  }
@@ -7066,7 +7094,7 @@ function DiscordRoleSelect(props) {
7066
7094
  {
7067
7095
  label: label2,
7068
7096
  size,
7069
- placeholder: placeholder || locale("PickRole") || "Pick a role...",
7097
+ placeholder: placeholder || t("PickRole", "Pick a role..."),
7070
7098
  data,
7071
7099
  value: props.value || null,
7072
7100
  onChange: (id) => props.onChange(id),
@@ -7077,7 +7105,7 @@ function DiscordRoleSelect(props) {
7077
7105
  rightSection: refreshButton,
7078
7106
  style,
7079
7107
  styles,
7080
- nothingFoundMessage: errorCode ? `${locale("Error") || "Error"} (${errorCode})` : locale("NoRoles") || "No roles found"
7108
+ nothingFoundMessage: errorCode ? `${t("Error", "Error")} (${errorCode})` : t("NoRoles", "No roles found")
7081
7109
  }
7082
7110
  );
7083
7111
  }