dirk-cfx-react 1.1.79 → 1.1.81

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,67 @@ 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({
5136
+ label,
5137
+ description,
5138
+ checked,
5139
+ onChange,
5140
+ disabled,
5141
+ thumbIcon,
5142
+ compact
5143
+ }) {
5144
+ const theme = core.useMantineTheme();
5145
+ const pc = theme.colors[theme.primaryColor];
5146
+ const bg = compact ? core.alpha(theme.colors.dark[6], 0.5) : core.alpha(theme.colors.dark[5], 0.35);
5147
+ const border = compact ? "0.1vh solid rgba(255,255,255,0.04)" : "0.1vh solid rgba(255,255,255,0.05)";
5148
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5149
+ core.Flex,
5150
+ {
5151
+ justify: "space-between",
5152
+ align: "center",
5153
+ px: compact ? "xs" : "xs",
5154
+ py: compact ? "xxs" : "xs",
5155
+ style: {
5156
+ background: bg,
5157
+ border,
5158
+ borderRadius: theme.radius.xs,
5159
+ opacity: disabled ? 0.5 : 1
5160
+ },
5161
+ children: [
5162
+ /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", gap: "xxs", style: { flex: 1, minWidth: 0 }, children: [
5163
+ typeof label === "string" ? compact ? /* @__PURE__ */ jsxRuntime.jsx(
5164
+ core.Text,
5165
+ {
5166
+ ff: "Akrobat Bold",
5167
+ size: "xxs",
5168
+ c: "rgba(255,255,255,0.85)",
5169
+ tt: "uppercase",
5170
+ lts: "0.05em",
5171
+ children: label
5172
+ }
5173
+ ) : /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", c: "rgba(255,255,255,0.85)", children: label }) : label,
5174
+ description && (typeof description === "string" ? /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", c: compact ? "rgba(255,255,255,0.4)" : "rgba(255,255,255,0.45)", children: description }) : description)
5175
+ ] }),
5176
+ /* @__PURE__ */ jsxRuntime.jsx(
5177
+ core.Switch,
5178
+ {
5179
+ checked,
5180
+ disabled,
5181
+ onChange: (e) => onChange(e.currentTarget.checked),
5182
+ size: compact ? "sm" : "md",
5183
+ thumbIcon,
5184
+ styles: {
5185
+ track: {
5186
+ background: checked ? core.alpha(pc[6], 0.4) : "rgba(255,255,255,0.08)",
5187
+ borderColor: checked ? core.alpha(pc[6], 0.6) : "rgba(255,255,255,0.1)"
5188
+ }
5189
+ }
5190
+ }
5191
+ )
5192
+ ]
5193
+ }
5194
+ );
5195
+ }
5135
5196
  var placementStyle = (placement) => {
5136
5197
  switch (placement) {
5137
5198
  case "top-center":
@@ -5382,32 +5443,13 @@ function ThemeOverrideSection({
5382
5443
  color
5383
5444
  }
5384
5445
  ),
5385
- /* @__PURE__ */ jsxRuntime.jsxs(
5386
- core.Flex,
5446
+ /* @__PURE__ */ jsxRuntime.jsx(
5447
+ SwitchPanel,
5387
5448
  {
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
- ]
5449
+ label: locale("OverrideGlobalTheme") || "Override global theme",
5450
+ 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.",
5451
+ checked: value.useOverride,
5452
+ onChange: (v) => set("useOverride", v)
5411
5453
  }
5412
5454
  ),
5413
5455
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -5851,6 +5893,7 @@ exports.PromptModal = PromptModal;
5851
5893
  exports.SegmentedControl = SegmentedControl;
5852
5894
  exports.SegmentedProgress = SegmentedProgress;
5853
5895
  exports.SelectItem = SelectItem;
5896
+ exports.SwitchPanel = SwitchPanel;
5854
5897
  exports.TestBed = TestBed;
5855
5898
  exports.ThemeOverrideSection = ThemeOverrideSection;
5856
5899
  exports.Title = Title;