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.
@@ -3091,11 +3091,11 @@ function ConfirmModal({
3091
3091
  placeholder: confirmText,
3092
3092
  value: typed,
3093
3093
  onChange: (e) => setTyped(e.currentTarget.value),
3094
- styles: (t) => ({
3094
+ styles: (t2) => ({
3095
3095
  input: {
3096
- backgroundColor: core.alpha(t.colors.dark[7], 0.5),
3096
+ backgroundColor: core.alpha(t2.colors.dark[7], 0.5),
3097
3097
  border: `0.1vh solid ${core.alpha(
3098
- typed === confirmText ? "#ef4444" : t.colors.dark[5],
3098
+ typed === confirmText ? "#ef4444" : t2.colors.dark[5],
3099
3099
  0.5
3100
3100
  )}`,
3101
3101
  color: "rgba(255,255,255,0.85)",
@@ -6204,6 +6204,10 @@ function ScenarioSelect({
6204
6204
  }
6205
6205
  );
6206
6206
  }
6207
+ var t = (key, fallback) => {
6208
+ const v = locale(key);
6209
+ return v === key ? fallback : v;
6210
+ };
6207
6211
  function decimalToHex(color) {
6208
6212
  if (!color || color === 0) return null;
6209
6213
  return "#" + color.toString(16).padStart(6, "0");
@@ -6227,30 +6231,8 @@ function RoleOption({ role }) {
6227
6231
  /* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "xs", c: "rgba(255,255,255,0.9)", children: role.name })
6228
6232
  ] });
6229
6233
  }
6230
- function NotConfiguredBanner({ label }) {
6231
- const theme = core.useMantineTheme();
6232
- return /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", gap: "xxs", children: [
6233
- label && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.05em", c: "rgba(255,255,255,0.55)", children: label }),
6234
- /* @__PURE__ */ jsxRuntime.jsxs(
6235
- core.Flex,
6236
- {
6237
- align: "center",
6238
- gap: "xs",
6239
- px: "xs",
6240
- py: "xxs",
6241
- style: {
6242
- background: "rgba(0,0,0,0.3)",
6243
- border: "0.1vh dashed rgba(255,255,255,0.12)",
6244
- borderRadius: theme.radius.xs
6245
- },
6246
- children: [
6247
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ExternalLink, { size: "1.4vh", color: "rgba(255,255,255,0.4)" }),
6248
- /* @__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." })
6249
- ]
6250
- }
6251
- )
6252
- ] });
6253
- }
6234
+ var NOT_CONFIGURED_TINT = "rgba(255,184,0,0.35)";
6235
+ var NOT_CONFIGURED_FILL = "rgba(255,184,0,0.05)";
6254
6236
  function DiscordRoleSelect(props) {
6255
6237
  const { endpoint, label, size = "xs", placeholder, disabled, style, styles } = props;
6256
6238
  const [roles, setRoles] = react.useState(null);
@@ -6290,7 +6272,53 @@ function DiscordRoleSelect(props) {
6290
6272
  return map;
6291
6273
  }, [roles]);
6292
6274
  if (errorCode === "NotConfigured") {
6293
- return /* @__PURE__ */ jsxRuntime.jsx(NotConfiguredBanner, { label });
6275
+ const notConfiguredPlaceholder = t(
6276
+ "DiscordNotConfigured",
6277
+ "Not configured \u2014 set in /dirk_lib"
6278
+ );
6279
+ const notConfiguredStyles = {
6280
+ ...styles,
6281
+ input: {
6282
+ ...styles?.input ?? {},
6283
+ borderColor: NOT_CONFIGURED_TINT,
6284
+ backgroundColor: NOT_CONFIGURED_FILL
6285
+ }
6286
+ };
6287
+ const warnIcon = /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertTriangle, { size: "1.2vh", color: NOT_CONFIGURED_TINT.replace(/0\.35\)$/, "0.85)") });
6288
+ if (props.multi) {
6289
+ return /* @__PURE__ */ jsxRuntime.jsx(
6290
+ core.MultiSelect,
6291
+ {
6292
+ label,
6293
+ size,
6294
+ placeholder: notConfiguredPlaceholder,
6295
+ data: [],
6296
+ value: [],
6297
+ onChange: () => {
6298
+ },
6299
+ disabled: true,
6300
+ rightSection: warnIcon,
6301
+ style,
6302
+ styles: notConfiguredStyles
6303
+ }
6304
+ );
6305
+ }
6306
+ return /* @__PURE__ */ jsxRuntime.jsx(
6307
+ core.Select,
6308
+ {
6309
+ label,
6310
+ size,
6311
+ placeholder: notConfiguredPlaceholder,
6312
+ data: [],
6313
+ value: null,
6314
+ onChange: () => {
6315
+ },
6316
+ disabled: true,
6317
+ rightSection: warnIcon,
6318
+ style,
6319
+ styles: notConfiguredStyles
6320
+ }
6321
+ );
6294
6322
  }
6295
6323
  const data = (roles ?? []).map((r) => ({
6296
6324
  value: r.id,
@@ -6306,7 +6334,7 @@ function DiscordRoleSelect(props) {
6306
6334
  size: "xs",
6307
6335
  variant: "subtle",
6308
6336
  onClick: refresh,
6309
- title: locale("Refresh") || "Refresh",
6337
+ title: t("Refresh", "Refresh"),
6310
6338
  loading,
6311
6339
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { size: "1.2vh" })
6312
6340
  }
@@ -6317,7 +6345,7 @@ function DiscordRoleSelect(props) {
6317
6345
  {
6318
6346
  label,
6319
6347
  size,
6320
- placeholder: placeholder || locale("PickRoles") || "Pick roles...",
6348
+ placeholder: placeholder || t("PickRoles", "Pick roles..."),
6321
6349
  data,
6322
6350
  value: props.value || [],
6323
6351
  onChange: (ids) => props.onChange(ids),
@@ -6328,7 +6356,7 @@ function DiscordRoleSelect(props) {
6328
6356
  rightSection: refreshButton,
6329
6357
  style,
6330
6358
  styles,
6331
- nothingFoundMessage: errorCode ? `${locale("Error") || "Error"} (${errorCode})` : locale("NoRoles") || "No roles found"
6359
+ nothingFoundMessage: errorCode ? `${t("Error", "Error")} (${errorCode})` : t("NoRoles", "No roles found")
6332
6360
  }
6333
6361
  );
6334
6362
  }
@@ -6337,7 +6365,7 @@ function DiscordRoleSelect(props) {
6337
6365
  {
6338
6366
  label,
6339
6367
  size,
6340
- placeholder: placeholder || locale("PickRole") || "Pick a role...",
6368
+ placeholder: placeholder || t("PickRole", "Pick a role..."),
6341
6369
  data,
6342
6370
  value: props.value || null,
6343
6371
  onChange: (id) => props.onChange(id),
@@ -6348,7 +6376,7 @@ function DiscordRoleSelect(props) {
6348
6376
  rightSection: refreshButton,
6349
6377
  style,
6350
6378
  styles,
6351
- nothingFoundMessage: errorCode ? `${locale("Error") || "Error"} (${errorCode})` : locale("NoRoles") || "No roles found"
6379
+ nothingFoundMessage: errorCode ? `${t("Error", "Error")} (${errorCode})` : t("NoRoles", "No roles found")
6352
6380
  }
6353
6381
  );
6354
6382
  }