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.js CHANGED
@@ -5,7 +5,7 @@ import { create, useStore, createStore } from 'zustand';
5
5
  import axios from 'axios';
6
6
  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
7
7
  import { motion, AnimatePresence, useMotionValue } from 'framer-motion';
8
- import { Info, X, AlertTriangle, Trash2, RefreshCw, ChevronDown, Check, Copy, MapPin, Crosshair, EyeOff, Eye, RotateCcw, FlaskConical, ChevronUp, Palette, ArrowLeft, Undo2, Redo2, Save, History, XCircle, Code2, ExternalLink, Search, Filter, User } from 'lucide-react';
8
+ import { Info, X, AlertTriangle, Trash2, RefreshCw, ChevronDown, Check, Copy, MapPin, Crosshair, EyeOff, Eye, RotateCcw, FlaskConical, ChevronUp, Palette, ArrowLeft, Undo2, Redo2, Save, History, XCircle, Code2, Search, Filter, User } from 'lucide-react';
9
9
  import clickSoundUrl from './click_sound-PNCRRTM4.mp3';
10
10
  import hoverSoundUrl from './hover_sound-NBUA222C.mp3';
11
11
  import { notifications } from '@mantine/notifications';
@@ -3694,11 +3694,11 @@ function ConfirmModal({
3694
3694
  placeholder: confirmText,
3695
3695
  value: typed,
3696
3696
  onChange: (e) => setTyped(e.currentTarget.value),
3697
- styles: (t) => ({
3697
+ styles: (t2) => ({
3698
3698
  input: {
3699
- backgroundColor: alpha(t.colors.dark[7], 0.5),
3699
+ backgroundColor: alpha(t2.colors.dark[7], 0.5),
3700
3700
  border: `0.1vh solid ${alpha(
3701
- typed === confirmText ? "#ef4444" : t.colors.dark[5],
3701
+ typed === confirmText ? "#ef4444" : t2.colors.dark[5],
3702
3702
  0.5
3703
3703
  )}`,
3704
3704
  color: "rgba(255,255,255,0.85)",
@@ -6924,6 +6924,10 @@ function ScenarioSelect({
6924
6924
  }
6925
6925
  );
6926
6926
  }
6927
+ var t = (key, fallback) => {
6928
+ const v = locale(key);
6929
+ return v === key ? fallback : v;
6930
+ };
6927
6931
  function decimalToHex(color) {
6928
6932
  if (!color || color === 0) return null;
6929
6933
  return "#" + color.toString(16).padStart(6, "0");
@@ -6947,30 +6951,8 @@ function RoleOption({ role }) {
6947
6951
  /* @__PURE__ */ jsx(Text, { size: "xs", c: "rgba(255,255,255,0.9)", children: role.name })
6948
6952
  ] });
6949
6953
  }
6950
- function NotConfiguredBanner({ label: label2 }) {
6951
- const theme2 = useMantineTheme();
6952
- return /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "xxs", children: [
6953
- label2 && /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.55)", children: label2 }),
6954
- /* @__PURE__ */ jsxs(
6955
- Flex,
6956
- {
6957
- align: "center",
6958
- gap: "xs",
6959
- px: "xs",
6960
- py: "xxs",
6961
- style: {
6962
- background: "rgba(0,0,0,0.3)",
6963
- border: "0.1vh dashed rgba(255,255,255,0.12)",
6964
- borderRadius: theme2.radius.xs
6965
- },
6966
- children: [
6967
- /* @__PURE__ */ jsx(ExternalLink, { size: "1.4vh", color: "rgba(255,255,255,0.4)" }),
6968
- /* @__PURE__ */ jsx(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." })
6969
- ]
6970
- }
6971
- )
6972
- ] });
6973
- }
6954
+ var NOT_CONFIGURED_TINT = "rgba(255,184,0,0.35)";
6955
+ var NOT_CONFIGURED_FILL = "rgba(255,184,0,0.05)";
6974
6956
  function DiscordRoleSelect(props) {
6975
6957
  const { endpoint, label: label2, size = "xs", placeholder, disabled, style, styles } = props;
6976
6958
  const [roles, setRoles] = useState(null);
@@ -7010,7 +6992,53 @@ function DiscordRoleSelect(props) {
7010
6992
  return map;
7011
6993
  }, [roles]);
7012
6994
  if (errorCode === "NotConfigured") {
7013
- return /* @__PURE__ */ jsx(NotConfiguredBanner, { label: label2 });
6995
+ const notConfiguredPlaceholder = t(
6996
+ "DiscordNotConfigured",
6997
+ "Not configured \u2014 set in /dirk_lib"
6998
+ );
6999
+ const notConfiguredStyles = {
7000
+ ...styles,
7001
+ input: {
7002
+ ...styles?.input ?? {},
7003
+ borderColor: NOT_CONFIGURED_TINT,
7004
+ backgroundColor: NOT_CONFIGURED_FILL
7005
+ }
7006
+ };
7007
+ const warnIcon = /* @__PURE__ */ jsx(AlertTriangle, { size: "1.2vh", color: NOT_CONFIGURED_TINT.replace(/0\.35\)$/, "0.85)") });
7008
+ if (props.multi) {
7009
+ return /* @__PURE__ */ jsx(
7010
+ MultiSelect,
7011
+ {
7012
+ label: label2,
7013
+ size,
7014
+ placeholder: notConfiguredPlaceholder,
7015
+ data: [],
7016
+ value: [],
7017
+ onChange: () => {
7018
+ },
7019
+ disabled: true,
7020
+ rightSection: warnIcon,
7021
+ style,
7022
+ styles: notConfiguredStyles
7023
+ }
7024
+ );
7025
+ }
7026
+ return /* @__PURE__ */ jsx(
7027
+ Select,
7028
+ {
7029
+ label: label2,
7030
+ size,
7031
+ placeholder: notConfiguredPlaceholder,
7032
+ data: [],
7033
+ value: null,
7034
+ onChange: () => {
7035
+ },
7036
+ disabled: true,
7037
+ rightSection: warnIcon,
7038
+ style,
7039
+ styles: notConfiguredStyles
7040
+ }
7041
+ );
7014
7042
  }
7015
7043
  const data = (roles ?? []).map((r) => ({
7016
7044
  value: r.id,
@@ -7026,7 +7054,7 @@ function DiscordRoleSelect(props) {
7026
7054
  size: "xs",
7027
7055
  variant: "subtle",
7028
7056
  onClick: refresh,
7029
- title: locale("Refresh") || "Refresh",
7057
+ title: t("Refresh", "Refresh"),
7030
7058
  loading,
7031
7059
  children: /* @__PURE__ */ jsx(RefreshCw, { size: "1.2vh" })
7032
7060
  }
@@ -7037,7 +7065,7 @@ function DiscordRoleSelect(props) {
7037
7065
  {
7038
7066
  label: label2,
7039
7067
  size,
7040
- placeholder: placeholder || locale("PickRoles") || "Pick roles...",
7068
+ placeholder: placeholder || t("PickRoles", "Pick roles..."),
7041
7069
  data,
7042
7070
  value: props.value || [],
7043
7071
  onChange: (ids) => props.onChange(ids),
@@ -7048,7 +7076,7 @@ function DiscordRoleSelect(props) {
7048
7076
  rightSection: refreshButton,
7049
7077
  style,
7050
7078
  styles,
7051
- nothingFoundMessage: errorCode ? `${locale("Error") || "Error"} (${errorCode})` : locale("NoRoles") || "No roles found"
7079
+ nothingFoundMessage: errorCode ? `${t("Error", "Error")} (${errorCode})` : t("NoRoles", "No roles found")
7052
7080
  }
7053
7081
  );
7054
7082
  }
@@ -7057,7 +7085,7 @@ function DiscordRoleSelect(props) {
7057
7085
  {
7058
7086
  label: label2,
7059
7087
  size,
7060
- placeholder: placeholder || locale("PickRole") || "Pick a role...",
7088
+ placeholder: placeholder || t("PickRole", "Pick a role..."),
7061
7089
  data,
7062
7090
  value: props.value || null,
7063
7091
  onChange: (id) => props.onChange(id),
@@ -7068,7 +7096,7 @@ function DiscordRoleSelect(props) {
7068
7096
  rightSection: refreshButton,
7069
7097
  style,
7070
7098
  styles,
7071
- nothingFoundMessage: errorCode ? `${locale("Error") || "Error"} (${errorCode})` : locale("NoRoles") || "No roles found"
7099
+ nothingFoundMessage: errorCode ? `${t("Error", "Error")} (${errorCode})` : t("NoRoles", "No roles found")
7072
7100
  }
7073
7101
  );
7074
7102
  }