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.
@@ -971,6 +971,19 @@ type AdminPageTitleProps = {
971
971
  };
972
972
  declare function AdminPageTitle(props: AdminPageTitleProps): react_jsx_runtime.JSX.Element;
973
973
 
974
+ type SwitchPanelProps = {
975
+ label: ReactNode;
976
+ description?: ReactNode;
977
+ checked: boolean;
978
+ onChange: (v: boolean) => void;
979
+ disabled?: boolean;
980
+ /** Icon rendered on the Switch's thumb (e.g. a Lock when locked). */
981
+ thumbIcon?: ReactNode;
982
+ /** Compact variant — used for nested rows inside an editor card. */
983
+ compact?: boolean;
984
+ };
985
+ declare function SwitchPanel({ label, description, checked, onChange, disabled, thumbIcon, compact, }: SwitchPanelProps): react_jsx_runtime.JSX.Element;
986
+
974
987
  type MissingItem = {
975
988
  name: string;
976
989
  label?: string;
@@ -1041,4 +1054,4 @@ type AnimPostFxSelectProps = Omit<SelectProps, "data" | "value" | "onChange"> &
1041
1054
  };
1042
1055
  declare function AnimPostFxSelect({ value, onChange, label, size, searchable, clearable, ...rest }: AnimPostFxSelectProps): react_jsx_runtime.JSX.Element;
1043
1056
 
1044
- export { AdminPageTitle, type AdminPageTitleProps, AnimPostFxSelect, type AnimPostFxSelectProps, AsyncSaveButton, BlipColorSelect, type BlipColorSelectProps, BlipDisplaySelect, type BlipDisplaySelectProps, BlipIconSelect, type BlipIconSelectProps, BorderedIcon, type BorderedIconProps, type ButtonProps, ConfigPanel, type ConfigPanelProps, ConfirmModal, type ConfirmModalProps, ControlMultiSelect, type ControlMultiSelectProps, ControlSelect, type ControlSelectProps, Counter, type FiveMControls, FiveMKeyBindInput, FloatingParticles, type FloatingParticlesProps, GroupName, type GroupNameProps, GroupRank, type GroupRankProps, GroupSelect, type GroupSelectProps, type GroupType, type GroupValue, InfoBox, type InfoBoxProps, InputContainer, type InputContainerProps, LevelBanner, LevelPanel, MissingItemsBanner, Modal, ModalContext, type ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, type NavItem, NavigationContext, NavigationProvider, type NavigationStore, type ParticleState, PositionPicker, type PositionPickerProps, type ProgressProps, type Prompt, type PromptButton, PromptModal, type SegmentProps, SegmentedControl, type SegmentedControlProps, SegmentedProgress, SelectItem, type SelectItemProps, type StoreModalProps, TestBed, type TestBedItem, type TestBedPlacement, type TestBedProps, ThemeOverrideSection, type ThemeOverrideSectionProps, type ThemeOverrideValue, Title, type TitleProps, type TitleSize, Vector4DeleteButton, Vector4Display, type Vector4Value, WorldPositionGotoButton, WorldPositionSetButton, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore };
1057
+ export { AdminPageTitle, type AdminPageTitleProps, AnimPostFxSelect, type AnimPostFxSelectProps, AsyncSaveButton, BlipColorSelect, type BlipColorSelectProps, BlipDisplaySelect, type BlipDisplaySelectProps, BlipIconSelect, type BlipIconSelectProps, BorderedIcon, type BorderedIconProps, type ButtonProps, ConfigPanel, type ConfigPanelProps, ConfirmModal, type ConfirmModalProps, ControlMultiSelect, type ControlMultiSelectProps, ControlSelect, type ControlSelectProps, Counter, type FiveMControls, FiveMKeyBindInput, FloatingParticles, type FloatingParticlesProps, GroupName, type GroupNameProps, GroupRank, type GroupRankProps, GroupSelect, type GroupSelectProps, type GroupType, type GroupValue, InfoBox, type InfoBoxProps, InputContainer, type InputContainerProps, LevelBanner, LevelPanel, MissingItemsBanner, Modal, ModalContext, type ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, type NavItem, NavigationContext, NavigationProvider, type NavigationStore, type ParticleState, PositionPicker, type PositionPickerProps, type ProgressProps, type Prompt, type PromptButton, PromptModal, type SegmentProps, SegmentedControl, type SegmentedControlProps, SegmentedProgress, SelectItem, type SelectItemProps, type StoreModalProps, SwitchPanel, type SwitchPanelProps, TestBed, type TestBedItem, type TestBedPlacement, type TestBedProps, ThemeOverrideSection, type ThemeOverrideSectionProps, type ThemeOverrideValue, Title, type TitleProps, type TitleSize, Vector4DeleteButton, Vector4Display, type Vector4Value, WorldPositionGotoButton, WorldPositionSetButton, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore };
@@ -971,6 +971,19 @@ type AdminPageTitleProps = {
971
971
  };
972
972
  declare function AdminPageTitle(props: AdminPageTitleProps): react_jsx_runtime.JSX.Element;
973
973
 
974
+ type SwitchPanelProps = {
975
+ label: ReactNode;
976
+ description?: ReactNode;
977
+ checked: boolean;
978
+ onChange: (v: boolean) => void;
979
+ disabled?: boolean;
980
+ /** Icon rendered on the Switch's thumb (e.g. a Lock when locked). */
981
+ thumbIcon?: ReactNode;
982
+ /** Compact variant — used for nested rows inside an editor card. */
983
+ compact?: boolean;
984
+ };
985
+ declare function SwitchPanel({ label, description, checked, onChange, disabled, thumbIcon, compact, }: SwitchPanelProps): react_jsx_runtime.JSX.Element;
986
+
974
987
  type MissingItem = {
975
988
  name: string;
976
989
  label?: string;
@@ -1041,4 +1054,4 @@ type AnimPostFxSelectProps = Omit<SelectProps, "data" | "value" | "onChange"> &
1041
1054
  };
1042
1055
  declare function AnimPostFxSelect({ value, onChange, label, size, searchable, clearable, ...rest }: AnimPostFxSelectProps): react_jsx_runtime.JSX.Element;
1043
1056
 
1044
- export { AdminPageTitle, type AdminPageTitleProps, AnimPostFxSelect, type AnimPostFxSelectProps, AsyncSaveButton, BlipColorSelect, type BlipColorSelectProps, BlipDisplaySelect, type BlipDisplaySelectProps, BlipIconSelect, type BlipIconSelectProps, BorderedIcon, type BorderedIconProps, type ButtonProps, ConfigPanel, type ConfigPanelProps, ConfirmModal, type ConfirmModalProps, ControlMultiSelect, type ControlMultiSelectProps, ControlSelect, type ControlSelectProps, Counter, type FiveMControls, FiveMKeyBindInput, FloatingParticles, type FloatingParticlesProps, GroupName, type GroupNameProps, GroupRank, type GroupRankProps, GroupSelect, type GroupSelectProps, type GroupType, type GroupValue, InfoBox, type InfoBoxProps, InputContainer, type InputContainerProps, LevelBanner, LevelPanel, MissingItemsBanner, Modal, ModalContext, type ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, type NavItem, NavigationContext, NavigationProvider, type NavigationStore, type ParticleState, PositionPicker, type PositionPickerProps, type ProgressProps, type Prompt, type PromptButton, PromptModal, type SegmentProps, SegmentedControl, type SegmentedControlProps, SegmentedProgress, SelectItem, type SelectItemProps, type StoreModalProps, TestBed, type TestBedItem, type TestBedPlacement, type TestBedProps, ThemeOverrideSection, type ThemeOverrideSectionProps, type ThemeOverrideValue, Title, type TitleProps, type TitleSize, Vector4DeleteButton, Vector4Display, type Vector4Value, WorldPositionGotoButton, WorldPositionSetButton, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore };
1057
+ export { AdminPageTitle, type AdminPageTitleProps, AnimPostFxSelect, type AnimPostFxSelectProps, AsyncSaveButton, BlipColorSelect, type BlipColorSelectProps, BlipDisplaySelect, type BlipDisplaySelectProps, BlipIconSelect, type BlipIconSelectProps, BorderedIcon, type BorderedIconProps, type ButtonProps, ConfigPanel, type ConfigPanelProps, ConfirmModal, type ConfirmModalProps, ControlMultiSelect, type ControlMultiSelectProps, ControlSelect, type ControlSelectProps, Counter, type FiveMControls, FiveMKeyBindInput, FloatingParticles, type FloatingParticlesProps, GroupName, type GroupNameProps, GroupRank, type GroupRankProps, GroupSelect, type GroupSelectProps, type GroupType, type GroupValue, InfoBox, type InfoBoxProps, InputContainer, type InputContainerProps, LevelBanner, LevelPanel, MissingItemsBanner, Modal, ModalContext, type ModalProps, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, type NavItem, NavigationContext, NavigationProvider, type NavigationStore, type ParticleState, PositionPicker, type PositionPickerProps, type ProgressProps, type Prompt, type PromptButton, PromptModal, type SegmentProps, SegmentedControl, type SegmentedControlProps, SegmentedProgress, SelectItem, type SelectItemProps, type StoreModalProps, SwitchPanel, type SwitchPanelProps, TestBed, type TestBedItem, type TestBedPlacement, type TestBedProps, ThemeOverrideSection, type ThemeOverrideSectionProps, type ThemeOverrideValue, Title, type TitleProps, type TitleSize, Vector4DeleteButton, Vector4Display, type Vector4Value, WorldPositionGotoButton, WorldPositionSetButton, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore };
@@ -1,4 +1,4 @@
1
- import { Flex, Text, Image, TextInput, Select, Box, useMantineTheme, Tooltip, alpha, Progress, RingProgress, Portal, Button, NumberInput, MultiSelect, Loader, ActionIcon, Stack, Switch, ColorInput, Popover, Group, JsonInput } from '@mantine/core';
1
+ import { Flex, Text, Image, TextInput, Select, Box, useMantineTheme, Tooltip, alpha, Progress, RingProgress, Portal, Button, NumberInput, MultiSelect, Loader, Switch, ActionIcon, Stack, ColorInput, Popover, Group, JsonInput } from '@mantine/core';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { createContext, useContext, useRef, useState, useEffect, useCallback, useMemo } from 'react';
4
4
  import { create, useStore, createStore } from 'zustand';
@@ -1230,11 +1230,11 @@ var colorNames = {
1230
1230
  Yellow: { r: 255, g: 255, b: 0 },
1231
1231
  YellowGreen: { r: 154, g: 205, b: 50 }
1232
1232
  };
1233
- function colorWithAlpha(color, alpha10) {
1233
+ function colorWithAlpha(color, alpha11) {
1234
1234
  const lowerCasedColor = color.toLowerCase();
1235
1235
  if (colorNames[lowerCasedColor]) {
1236
1236
  const rgb = colorNames[lowerCasedColor];
1237
- return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha10})`;
1237
+ return `rgba(${rgb.r}, ${rgb.g}, ${rgb.b}, ${alpha11})`;
1238
1238
  }
1239
1239
  if (/^#([A-Fa-f0-9]{6})$/.test(color)) {
1240
1240
  const hex = color.slice(1);
@@ -1242,12 +1242,12 @@ function colorWithAlpha(color, alpha10) {
1242
1242
  const r = bigint >> 16 & 255;
1243
1243
  const g = bigint >> 8 & 255;
1244
1244
  const b = bigint & 255;
1245
- return `rgba(${r}, ${g}, ${b}, ${alpha10})`;
1245
+ return `rgba(${r}, ${g}, ${b}, ${alpha11})`;
1246
1246
  }
1247
1247
  if (/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/.test(color)) {
1248
1248
  const result = color.match(/^rgb\((\d{1,3}), (\d{1,3}), (\d{1,3})\)$/);
1249
1249
  if (result) {
1250
- return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha10})`;
1250
+ return `rgba(${result[1]}, ${result[2]}, ${result[3]}, ${alpha11})`;
1251
1251
  }
1252
1252
  }
1253
1253
  return color;
@@ -5125,6 +5125,67 @@ function AdminPageTitle(props) {
5125
5125
  /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", tt: "uppercase", lts: "0.1em", size: "sm", c: "rgba(255,255,255,0.6)", children: locale(props.title) })
5126
5126
  ] });
5127
5127
  }
5128
+ function SwitchPanel({
5129
+ label,
5130
+ description,
5131
+ checked,
5132
+ onChange,
5133
+ disabled,
5134
+ thumbIcon,
5135
+ compact
5136
+ }) {
5137
+ const theme = useMantineTheme();
5138
+ const pc = theme.colors[theme.primaryColor];
5139
+ const bg = compact ? alpha(theme.colors.dark[6], 0.5) : alpha(theme.colors.dark[5], 0.35);
5140
+ const border = compact ? "0.1vh solid rgba(255,255,255,0.04)" : "0.1vh solid rgba(255,255,255,0.05)";
5141
+ return /* @__PURE__ */ jsxs(
5142
+ Flex,
5143
+ {
5144
+ justify: "space-between",
5145
+ align: "center",
5146
+ px: compact ? "xs" : "xs",
5147
+ py: compact ? "xxs" : "xs",
5148
+ style: {
5149
+ background: bg,
5150
+ border,
5151
+ borderRadius: theme.radius.xs,
5152
+ opacity: disabled ? 0.5 : 1
5153
+ },
5154
+ children: [
5155
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "xxs", style: { flex: 1, minWidth: 0 }, children: [
5156
+ typeof label === "string" ? compact ? /* @__PURE__ */ jsx(
5157
+ Text,
5158
+ {
5159
+ ff: "Akrobat Bold",
5160
+ size: "xxs",
5161
+ c: "rgba(255,255,255,0.85)",
5162
+ tt: "uppercase",
5163
+ lts: "0.05em",
5164
+ children: label
5165
+ }
5166
+ ) : /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xs", c: "rgba(255,255,255,0.85)", children: label }) : label,
5167
+ description && (typeof description === "string" ? /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xxs", c: compact ? "rgba(255,255,255,0.4)" : "rgba(255,255,255,0.45)", children: description }) : description)
5168
+ ] }),
5169
+ /* @__PURE__ */ jsx(
5170
+ Switch,
5171
+ {
5172
+ checked,
5173
+ disabled,
5174
+ onChange: (e) => onChange(e.currentTarget.checked),
5175
+ size: compact ? "sm" : "md",
5176
+ thumbIcon,
5177
+ styles: {
5178
+ track: {
5179
+ background: checked ? alpha(pc[6], 0.4) : "rgba(255,255,255,0.08)",
5180
+ borderColor: checked ? alpha(pc[6], 0.6) : "rgba(255,255,255,0.1)"
5181
+ }
5182
+ }
5183
+ }
5184
+ )
5185
+ ]
5186
+ }
5187
+ );
5188
+ }
5128
5189
  var placementStyle = (placement) => {
5129
5190
  switch (placement) {
5130
5191
  case "top-center":
@@ -5375,32 +5436,13 @@ function ThemeOverrideSection({
5375
5436
  color
5376
5437
  }
5377
5438
  ),
5378
- /* @__PURE__ */ jsxs(
5379
- Flex,
5439
+ /* @__PURE__ */ jsx(
5440
+ SwitchPanel,
5380
5441
  {
5381
- align: "center",
5382
- justify: "space-between",
5383
- p: "xs",
5384
- style: {
5385
- background: `rgba(255,255,255,${editable ? 0.04 : 0.02})`,
5386
- border: `0.1vh solid ${editable ? color : "rgba(255,255,255,0.08)"}`,
5387
- borderRadius: mantineTheme.radius.xs,
5388
- transition: "background 0.15s, border-color 0.15s"
5389
- },
5390
- children: [
5391
- /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: "xxs", style: { flex: 1, minWidth: 0 }, children: [
5392
- /* @__PURE__ */ jsx(Text, { ff: "Akrobat Bold", size: "xs", c: "rgba(255,255,255,0.9)", children: locale("OverrideGlobalTheme") || "Override global theme" }),
5393
- /* @__PURE__ */ jsx(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." })
5394
- ] }),
5395
- /* @__PURE__ */ jsx(
5396
- Switch,
5397
- {
5398
- size: "md",
5399
- checked: value.useOverride,
5400
- onChange: (e) => set("useOverride", e.currentTarget.checked)
5401
- }
5402
- )
5403
- ]
5442
+ label: locale("OverrideGlobalTheme") || "Override global theme",
5443
+ 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.",
5444
+ checked: value.useOverride,
5445
+ onChange: (v) => set("useOverride", v)
5404
5446
  }
5405
5447
  ),
5406
5448
  /* @__PURE__ */ jsxs(
@@ -5807,6 +5849,6 @@ function AnimPostFxSelect({
5807
5849
  );
5808
5850
  }
5809
5851
 
5810
- export { AdminPageTitle, AnimPostFxSelect, AsyncSaveButton, BlipColorSelect, BlipDisplaySelect, BlipIconSelect, BorderedIcon, ConfigPanel, ConfirmModal, ControlMultiSelect, ControlSelect, Counter, FiveMKeyBindInput, FloatingParticles, GroupName, GroupRank, GroupSelect, InfoBox, InputContainer, LevelBanner, LevelPanel, MissingItemsBanner, Modal, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, PositionPicker, PromptModal, SegmentedControl, SegmentedProgress, SelectItem, TestBed, ThemeOverrideSection, Title, Vector4DeleteButton, Vector4Display, WorldPositionGotoButton, WorldPositionSetButton, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore };
5852
+ export { AdminPageTitle, AnimPostFxSelect, AsyncSaveButton, BlipColorSelect, BlipDisplaySelect, BlipIconSelect, BorderedIcon, ConfigPanel, ConfirmModal, ControlMultiSelect, ControlSelect, Counter, FiveMKeyBindInput, FloatingParticles, GroupName, GroupRank, GroupSelect, InfoBox, InputContainer, LevelBanner, LevelPanel, MissingItemsBanner, Modal, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, PositionPicker, PromptModal, SegmentedControl, SegmentedProgress, SelectItem, SwitchPanel, TestBed, ThemeOverrideSection, Title, Vector4DeleteButton, Vector4Display, WorldPositionGotoButton, WorldPositionSetButton, useMissingItemsAudit, useModal, useModalActions, useNavigation, useNavigationStore };
5811
5853
  //# sourceMappingURL=index.js.map
5812
5854
  //# sourceMappingURL=index.js.map