dirk-cfx-react 1.1.79 → 1.1.80

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.
@@ -1237,11 +1237,11 @@ var colorNames = {
1237
1237
  Yellow: { r: 255, g: 255, b: 0 },
1238
1238
  YellowGreen: { r: 154, g: 205, b: 50 }
1239
1239
  };
1240
- function colorWithAlpha(color, alpha10) {
1240
+ function colorWithAlpha(color, alpha11) {
1241
1241
  const lowerCasedColor = color.toLowerCase();
1242
1242
  if (colorNames[lowerCasedColor]) {
1243
1243
  const rgb = colorNames[lowerCasedColor];
1244
- return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha10})`;
1244
+ return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha11})`;
1245
1245
  }
1246
1246
  if (/^#([A-Fa-f0-9]{6})$/.test(color)) {
1247
1247
  const hex = color.slice(1);
@@ -1249,12 +1249,12 @@ function colorWithAlpha(color, alpha10) {
1249
1249
  const r = bigint >> 16 & 255;
1250
1250
  const g = bigint >> 8 & 255;
1251
1251
  const b = bigint & 255;
1252
- return `rgba(${r}, ${g}, ${b}, ${alpha10})`;
1252
+ return `rgba(${r}, ${g}, ${b}, ${alpha11})`;
1253
1253
  }
1254
1254
  if (/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/.test(color)) {
1255
1255
  const result = color.match(/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/);
1256
1256
  if (result) {
1257
- return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha10})`;
1257
+ return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha11})`;
1258
1258
  }
1259
1259
  }
1260
1260
  return color;
@@ -5132,6 +5132,45 @@ function AdminPageTitle(props) {
5132
5132
  /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", tt: "uppercase", lts: "0.1em", size: "sm", c: "rgba(255,255,255,0.6)", children: locale(props.title) })
5133
5133
  ] });
5134
5134
  }
5135
+ function SwitchPanel({ label, description, checked, onChange, disabled }) {
5136
+ const theme = core.useMantineTheme();
5137
+ const pc = theme.colors[theme.primaryColor];
5138
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5139
+ core.Flex,
5140
+ {
5141
+ justify: "space-between",
5142
+ align: "center",
5143
+ p: "xs",
5144
+ style: {
5145
+ background: core.alpha(theme.colors.dark[5], 0.35),
5146
+ border: "0.1vh solid rgba(255,255,255,0.05)",
5147
+ borderRadius: theme.radius.xs,
5148
+ opacity: disabled ? 0.5 : 1
5149
+ },
5150
+ children: [
5151
+ /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", gap: "xxs", style: { flex: 1, minWidth: 0 }, children: [
5152
+ typeof label === "string" ? /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", c: "rgba(255,255,255,0.85)", children: label }) : label,
5153
+ description && (typeof description === "string" ? /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", c: "rgba(255,255,255,0.45)", children: description }) : description)
5154
+ ] }),
5155
+ /* @__PURE__ */ jsxRuntime.jsx(
5156
+ core.Switch,
5157
+ {
5158
+ checked,
5159
+ disabled,
5160
+ onChange: (e) => onChange(e.currentTarget.checked),
5161
+ size: "md",
5162
+ styles: {
5163
+ track: {
5164
+ background: checked ? core.alpha(pc[6], 0.4) : "rgba(255,255,255,0.08)",
5165
+ borderColor: checked ? core.alpha(pc[6], 0.6) : "rgba(255,255,255,0.1)"
5166
+ }
5167
+ }
5168
+ }
5169
+ )
5170
+ ]
5171
+ }
5172
+ );
5173
+ }
5135
5174
  var placementStyle = (placement) => {
5136
5175
  switch (placement) {
5137
5176
  case "top-center":
@@ -5382,32 +5421,13 @@ function ThemeOverrideSection({
5382
5421
  color
5383
5422
  }
5384
5423
  ),
5385
- /* @__PURE__ */ jsxRuntime.jsxs(
5386
- core.Flex,
5424
+ /* @__PURE__ */ jsxRuntime.jsx(
5425
+ SwitchPanel,
5387
5426
  {
5388
- align: "center",
5389
- justify: "space-between",
5390
- p: "xs",
5391
- style: {
5392
- background: `rgba(255,255,255,${editable ? 0.04 : 0.02})`,
5393
- border: `0.1vh solid ${editable ? color : "rgba(255,255,255,0.08)"}`,
5394
- borderRadius: mantineTheme.radius.xs,
5395
- transition: "background 0.15s, border-color 0.15s"
5396
- },
5397
- children: [
5398
- /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", gap: "xxs", style: { flex: 1, minWidth: 0 }, children: [
5399
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", c: "rgba(255,255,255,0.9)", children: locale("OverrideGlobalTheme") || "Override global theme" }),
5400
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", c: "rgba(255,255,255,0.4)", children: locale("OverrideGlobalThemeDesc") || "When on, this resource uses its own primary colour and palette instead of dirk_lib's. Turn off to fall back to the global theme \u2014 your custom palette is kept." })
5401
- ] }),
5402
- /* @__PURE__ */ jsxRuntime.jsx(
5403
- core.Switch,
5404
- {
5405
- size: "md",
5406
- checked: value.useOverride,
5407
- onChange: (e) => set("useOverride", e.currentTarget.checked)
5408
- }
5409
- )
5410
- ]
5427
+ label: locale("OverrideGlobalTheme") || "Override global theme",
5428
+ description: locale("OverrideGlobalThemeDesc") || "When on, this resource uses its own primary colour and palette instead of dirk_lib's. Turn off to fall back to the global theme \u2014 your custom palette is kept.",
5429
+ checked: value.useOverride,
5430
+ onChange: (v) => set("useOverride", v)
5411
5431
  }
5412
5432
  ),
5413
5433
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -5851,6 +5871,7 @@ exports.PromptModal = PromptModal;
5851
5871
  exports.SegmentedControl = SegmentedControl;
5852
5872
  exports.SegmentedProgress = SegmentedProgress;
5853
5873
  exports.SelectItem = SelectItem;
5874
+ exports.SwitchPanel = SwitchPanel;
5854
5875
  exports.TestBed = TestBed;
5855
5876
  exports.ThemeOverrideSection = ThemeOverrideSection;
5856
5877
  exports.Title = Title;