dirk-cfx-react 1.1.83 → 1.1.85

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,
@@ -7034,9 +7062,16 @@ function DiscordRoleSelect(props) {
7034
7062
  {
7035
7063
  size: "xs",
7036
7064
  variant: "subtle",
7037
- onClick: refresh,
7038
- title: locale("Refresh") || "Refresh",
7065
+ onMouseDown: (e) => {
7066
+ e.stopPropagation();
7067
+ },
7068
+ onClick: (e) => {
7069
+ e.stopPropagation();
7070
+ refresh();
7071
+ },
7072
+ title: t("Refresh", "Refresh"),
7039
7073
  loading,
7074
+ "aria-label": t("Refresh", "Refresh"),
7040
7075
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { size: "1.2vh" })
7041
7076
  }
7042
7077
  );
@@ -7046,7 +7081,7 @@ function DiscordRoleSelect(props) {
7046
7081
  {
7047
7082
  label: label2,
7048
7083
  size,
7049
- placeholder: placeholder || locale("PickRoles") || "Pick roles...",
7084
+ placeholder: placeholder || t("PickRoles", "Pick roles..."),
7050
7085
  data,
7051
7086
  value: props.value || [],
7052
7087
  onChange: (ids) => props.onChange(ids),
@@ -7055,9 +7090,10 @@ function DiscordRoleSelect(props) {
7055
7090
  clearable: true,
7056
7091
  disabled: disabled || loading && !roles,
7057
7092
  rightSection: refreshButton,
7093
+ rightSectionPointerEvents: "all",
7058
7094
  style,
7059
7095
  styles,
7060
- nothingFoundMessage: errorCode ? `${locale("Error") || "Error"} (${errorCode})` : locale("NoRoles") || "No roles found"
7096
+ nothingFoundMessage: errorCode ? `${t("Error", "Error")} (${errorCode})` : t("NoRoles", "No roles found")
7061
7097
  }
7062
7098
  );
7063
7099
  }
@@ -7066,7 +7102,7 @@ function DiscordRoleSelect(props) {
7066
7102
  {
7067
7103
  label: label2,
7068
7104
  size,
7069
- placeholder: placeholder || locale("PickRole") || "Pick a role...",
7105
+ placeholder: placeholder || t("PickRole", "Pick a role..."),
7070
7106
  data,
7071
7107
  value: props.value || null,
7072
7108
  onChange: (id) => props.onChange(id),
@@ -7075,9 +7111,10 @@ function DiscordRoleSelect(props) {
7075
7111
  clearable: true,
7076
7112
  disabled: disabled || loading && !roles,
7077
7113
  rightSection: refreshButton,
7114
+ rightSectionPointerEvents: "all",
7078
7115
  style,
7079
7116
  styles,
7080
- nothingFoundMessage: errorCode ? `${locale("Error") || "Error"} (${errorCode})` : locale("NoRoles") || "No roles found"
7117
+ nothingFoundMessage: errorCode ? `${t("Error", "Error")} (${errorCode})` : t("NoRoles", "No roles found")
7081
7118
  }
7082
7119
  );
7083
7120
  }