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.
@@ -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,
@@ -6305,9 +6333,16 @@ function DiscordRoleSelect(props) {
6305
6333
  {
6306
6334
  size: "xs",
6307
6335
  variant: "subtle",
6308
- onClick: refresh,
6309
- title: locale("Refresh") || "Refresh",
6336
+ onMouseDown: (e) => {
6337
+ e.stopPropagation();
6338
+ },
6339
+ onClick: (e) => {
6340
+ e.stopPropagation();
6341
+ refresh();
6342
+ },
6343
+ title: t("Refresh", "Refresh"),
6310
6344
  loading,
6345
+ "aria-label": t("Refresh", "Refresh"),
6311
6346
  children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RefreshCw, { size: "1.2vh" })
6312
6347
  }
6313
6348
  );
@@ -6317,7 +6352,7 @@ function DiscordRoleSelect(props) {
6317
6352
  {
6318
6353
  label,
6319
6354
  size,
6320
- placeholder: placeholder || locale("PickRoles") || "Pick roles...",
6355
+ placeholder: placeholder || t("PickRoles", "Pick roles..."),
6321
6356
  data,
6322
6357
  value: props.value || [],
6323
6358
  onChange: (ids) => props.onChange(ids),
@@ -6326,9 +6361,10 @@ function DiscordRoleSelect(props) {
6326
6361
  clearable: true,
6327
6362
  disabled: disabled || loading && !roles,
6328
6363
  rightSection: refreshButton,
6364
+ rightSectionPointerEvents: "all",
6329
6365
  style,
6330
6366
  styles,
6331
- nothingFoundMessage: errorCode ? `${locale("Error") || "Error"} (${errorCode})` : locale("NoRoles") || "No roles found"
6367
+ nothingFoundMessage: errorCode ? `${t("Error", "Error")} (${errorCode})` : t("NoRoles", "No roles found")
6332
6368
  }
6333
6369
  );
6334
6370
  }
@@ -6337,7 +6373,7 @@ function DiscordRoleSelect(props) {
6337
6373
  {
6338
6374
  label,
6339
6375
  size,
6340
- placeholder: placeholder || locale("PickRole") || "Pick a role...",
6376
+ placeholder: placeholder || t("PickRole", "Pick a role..."),
6341
6377
  data,
6342
6378
  value: props.value || null,
6343
6379
  onChange: (id) => props.onChange(id),
@@ -6346,9 +6382,10 @@ function DiscordRoleSelect(props) {
6346
6382
  clearable: true,
6347
6383
  disabled: disabled || loading && !roles,
6348
6384
  rightSection: refreshButton,
6385
+ rightSectionPointerEvents: "all",
6349
6386
  style,
6350
6387
  styles,
6351
- nothingFoundMessage: errorCode ? `${locale("Error") || "Error"} (${errorCode})` : locale("NoRoles") || "No roles found"
6388
+ nothingFoundMessage: errorCode ? `${t("Error", "Error")} (${errorCode})` : t("NoRoles", "No roles found")
6352
6389
  }
6353
6390
  );
6354
6391
  }