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.
package/dist/index.cjs CHANGED
@@ -1253,11 +1253,11 @@ var colorNames = {
1253
1253
  Yellow: { r: 255, g: 255, b: 0 },
1254
1254
  YellowGreen: { r: 154, g: 205, b: 50 }
1255
1255
  };
1256
- function colorWithAlpha(color, alpha10) {
1256
+ function colorWithAlpha(color, alpha11) {
1257
1257
  const lowerCasedColor = color.toLowerCase();
1258
1258
  if (colorNames[lowerCasedColor]) {
1259
1259
  const rgb = colorNames[lowerCasedColor];
1260
- return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha10})`;
1260
+ return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha11})`;
1261
1261
  }
1262
1262
  if (/^#([A-Fa-f0-9]{6})$/.test(color)) {
1263
1263
  const hex = color.slice(1);
@@ -1265,12 +1265,12 @@ function colorWithAlpha(color, alpha10) {
1265
1265
  const r = bigint >> 16 & 255;
1266
1266
  const g = bigint >> 8 & 255;
1267
1267
  const b = bigint & 255;
1268
- return `rgba(${r}, ${g}, ${b}, ${alpha10})`;
1268
+ return `rgba(${r}, ${g}, ${b}, ${alpha11})`;
1269
1269
  }
1270
1270
  if (/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/.test(color)) {
1271
1271
  const result = color.match(/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/);
1272
1272
  if (result) {
1273
- return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha10})`;
1273
+ return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha11})`;
1274
1274
  }
1275
1275
  }
1276
1276
  return color;
@@ -5861,6 +5861,45 @@ function AdminPageTitle(props) {
5861
5861
  /* @__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) })
5862
5862
  ] });
5863
5863
  }
5864
+ function SwitchPanel({ label: label2, description: description2, checked, onChange, disabled }) {
5865
+ const theme2 = core.useMantineTheme();
5866
+ const pc = theme2.colors[theme2.primaryColor];
5867
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5868
+ core.Flex,
5869
+ {
5870
+ justify: "space-between",
5871
+ align: "center",
5872
+ p: "xs",
5873
+ style: {
5874
+ background: core.alpha(theme2.colors.dark[5], 0.35),
5875
+ border: "0.1vh solid rgba(255,255,255,0.05)",
5876
+ borderRadius: theme2.radius.xs,
5877
+ opacity: disabled ? 0.5 : 1
5878
+ },
5879
+ children: [
5880
+ /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", gap: "xxs", style: { flex: 1, minWidth: 0 }, children: [
5881
+ typeof label2 === "string" ? /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", c: "rgba(255,255,255,0.85)", children: label2 }) : label2,
5882
+ description2 && (typeof description2 === "string" ? /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", c: "rgba(255,255,255,0.45)", children: description2 }) : description2)
5883
+ ] }),
5884
+ /* @__PURE__ */ jsxRuntime.jsx(
5885
+ core.Switch,
5886
+ {
5887
+ checked,
5888
+ disabled,
5889
+ onChange: (e) => onChange(e.currentTarget.checked),
5890
+ size: "md",
5891
+ styles: {
5892
+ track: {
5893
+ background: checked ? core.alpha(pc[6], 0.4) : "rgba(255,255,255,0.08)",
5894
+ borderColor: checked ? core.alpha(pc[6], 0.6) : "rgba(255,255,255,0.1)"
5895
+ }
5896
+ }
5897
+ }
5898
+ )
5899
+ ]
5900
+ }
5901
+ );
5902
+ }
5864
5903
  var placementStyle = (placement) => {
5865
5904
  switch (placement) {
5866
5905
  case "top-center":
@@ -6111,32 +6150,13 @@ function ThemeOverrideSection({
6111
6150
  color
6112
6151
  }
6113
6152
  ),
6114
- /* @__PURE__ */ jsxRuntime.jsxs(
6115
- core.Flex,
6153
+ /* @__PURE__ */ jsxRuntime.jsx(
6154
+ SwitchPanel,
6116
6155
  {
6117
- align: "center",
6118
- justify: "space-between",
6119
- p: "xs",
6120
- style: {
6121
- background: `rgba(255,255,255,${editable ? 0.04 : 0.02})`,
6122
- border: `0.1vh solid ${editable ? color : "rgba(255,255,255,0.08)"}`,
6123
- borderRadius: mantineTheme.radius.xs,
6124
- transition: "background 0.15s, border-color 0.15s"
6125
- },
6126
- children: [
6127
- /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", gap: "xxs", style: { flex: 1, minWidth: 0 }, children: [
6128
- /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", c: "rgba(255,255,255,0.9)", children: locale("OverrideGlobalTheme") || "Override global theme" }),
6129
- /* @__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." })
6130
- ] }),
6131
- /* @__PURE__ */ jsxRuntime.jsx(
6132
- core.Switch,
6133
- {
6134
- size: "md",
6135
- checked: value.useOverride,
6136
- onChange: (e) => set("useOverride", e.currentTarget.checked)
6137
- }
6138
- )
6139
- ]
6156
+ label: locale("OverrideGlobalTheme") || "Override global theme",
6157
+ 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.",
6158
+ checked: value.useOverride,
6159
+ onChange: (v) => set("useOverride", v)
6140
6160
  }
6141
6161
  ),
6142
6162
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -6945,6 +6965,7 @@ exports.PromptModal = PromptModal;
6945
6965
  exports.SegmentedControl = SegmentedControl;
6946
6966
  exports.SegmentedProgress = SegmentedProgress;
6947
6967
  exports.SelectItem = SelectItem;
6968
+ exports.SwitchPanel = SwitchPanel;
6948
6969
  exports.TestBed = TestBed;
6949
6970
  exports.ThemeOverrideSection = ThemeOverrideSection;
6950
6971
  exports.Title = Title;