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.
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,67 @@ 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({
5865
+ label: label2,
5866
+ description: description2,
5867
+ checked,
5868
+ onChange,
5869
+ disabled,
5870
+ thumbIcon,
5871
+ compact
5872
+ }) {
5873
+ const theme2 = core.useMantineTheme();
5874
+ const pc = theme2.colors[theme2.primaryColor];
5875
+ const bg = compact ? core.alpha(theme2.colors.dark[6], 0.5) : core.alpha(theme2.colors.dark[5], 0.35);
5876
+ const border = compact ? "0.1vh solid rgba(255,255,255,0.04)" : "0.1vh solid rgba(255,255,255,0.05)";
5877
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5878
+ core.Flex,
5879
+ {
5880
+ justify: "space-between",
5881
+ align: "center",
5882
+ px: compact ? "xs" : "xs",
5883
+ py: compact ? "xxs" : "xs",
5884
+ style: {
5885
+ background: bg,
5886
+ border,
5887
+ borderRadius: theme2.radius.xs,
5888
+ opacity: disabled ? 0.5 : 1
5889
+ },
5890
+ children: [
5891
+ /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", gap: "xxs", style: { flex: 1, minWidth: 0 }, children: [
5892
+ typeof label2 === "string" ? compact ? /* @__PURE__ */ jsxRuntime.jsx(
5893
+ core.Text,
5894
+ {
5895
+ ff: "Akrobat Bold",
5896
+ size: "xxs",
5897
+ c: "rgba(255,255,255,0.85)",
5898
+ tt: "uppercase",
5899
+ lts: "0.05em",
5900
+ children: label2
5901
+ }
5902
+ ) : /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xs", c: "rgba(255,255,255,0.85)", children: label2 }) : label2,
5903
+ description2 && (typeof description2 === "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: description2 }) : description2)
5904
+ ] }),
5905
+ /* @__PURE__ */ jsxRuntime.jsx(
5906
+ core.Switch,
5907
+ {
5908
+ checked,
5909
+ disabled,
5910
+ onChange: (e) => onChange(e.currentTarget.checked),
5911
+ size: compact ? "sm" : "md",
5912
+ thumbIcon,
5913
+ styles: {
5914
+ track: {
5915
+ background: checked ? core.alpha(pc[6], 0.4) : "rgba(255,255,255,0.08)",
5916
+ borderColor: checked ? core.alpha(pc[6], 0.6) : "rgba(255,255,255,0.1)"
5917
+ }
5918
+ }
5919
+ }
5920
+ )
5921
+ ]
5922
+ }
5923
+ );
5924
+ }
5864
5925
  var placementStyle = (placement) => {
5865
5926
  switch (placement) {
5866
5927
  case "top-center":
@@ -6111,32 +6172,13 @@ function ThemeOverrideSection({
6111
6172
  color
6112
6173
  }
6113
6174
  ),
6114
- /* @__PURE__ */ jsxRuntime.jsxs(
6115
- core.Flex,
6175
+ /* @__PURE__ */ jsxRuntime.jsx(
6176
+ SwitchPanel,
6116
6177
  {
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
- ]
6178
+ label: locale("OverrideGlobalTheme") || "Override global theme",
6179
+ 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.",
6180
+ checked: value.useOverride,
6181
+ onChange: (v) => set("useOverride", v)
6140
6182
  }
6141
6183
  ),
6142
6184
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -6945,6 +6987,7 @@ exports.PromptModal = PromptModal;
6945
6987
  exports.SegmentedControl = SegmentedControl;
6946
6988
  exports.SegmentedProgress = SegmentedProgress;
6947
6989
  exports.SelectItem = SelectItem;
6990
+ exports.SwitchPanel = SwitchPanel;
6948
6991
  exports.TestBed = TestBed;
6949
6992
  exports.ThemeOverrideSection = ThemeOverrideSection;
6950
6993
  exports.Title = Title;