dirk-cfx-react 1.1.72 → 1.1.75
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/components/index.cjs +369 -60
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +32 -2
- package/dist/components/index.d.ts +32 -2
- package/dist/components/index.js +371 -63
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.cjs +5 -1
- package/dist/hooks/index.cjs.map +1 -1
- package/dist/hooks/index.js +5 -1
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.cjs +387 -60
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -1
- package/dist/index.d.ts +34 -1
- package/dist/index.js +386 -63
- package/dist/index.js.map +1 -1
- package/dist/providers/index.cjs +11 -1
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.js +11 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/utils/index.cjs +5 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +5 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +5 -1
|
@@ -11,6 +11,7 @@ var clickSoundUrl = require('../click_sound-PNCRRTM4.mp3');
|
|
|
11
11
|
var hoverSoundUrl = require('../hover_sound-NBUA222C.mp3');
|
|
12
12
|
var notifications = require('@mantine/notifications');
|
|
13
13
|
var reactQuery = require('@tanstack/react-query');
|
|
14
|
+
var colorsGenerator = require('@mantine/colors-generator');
|
|
14
15
|
|
|
15
16
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
16
17
|
|
|
@@ -1299,7 +1300,11 @@ async function fetchNui(eventName, data, mockData) {
|
|
|
1299
1300
|
return {};
|
|
1300
1301
|
}
|
|
1301
1302
|
const overrideResourceName = useSettings.getState().overideResourceName;
|
|
1302
|
-
const
|
|
1303
|
+
const hasResourceContext = typeof window.GetParentResourceName === "function" || !!overrideResourceName;
|
|
1304
|
+
if (!hasResourceContext) {
|
|
1305
|
+
return mockData ?? {};
|
|
1306
|
+
}
|
|
1307
|
+
const resourceName = window.GetParentResourceName ? window.GetParentResourceName() : overrideResourceName;
|
|
1303
1308
|
try {
|
|
1304
1309
|
const resp = await fetch(`https://${resourceName}/${eventName}`, options);
|
|
1305
1310
|
return await resp.json();
|
|
@@ -2472,9 +2477,25 @@ function SegmentedProgress(props) {
|
|
|
2472
2477
|
}
|
|
2473
2478
|
);
|
|
2474
2479
|
}
|
|
2480
|
+
function getSizePreset(size, themeMdFontSize) {
|
|
2481
|
+
switch (size) {
|
|
2482
|
+
case "xs":
|
|
2483
|
+
return { iconFontSize: "1.2vh", iconPadding: "xxs", titleSize: "xxs", titleLineHeight: "1.2vh", descriptionSize: "xxs", innerGap: "xs", bottomPad: "xs" };
|
|
2484
|
+
case "sm":
|
|
2485
|
+
return { iconFontSize: "1.6vh", iconPadding: "xxs", titleSize: "xs", titleLineHeight: "1.6vh", descriptionSize: "xxs", innerGap: "xs", bottomPad: "xs" };
|
|
2486
|
+
case "lg":
|
|
2487
|
+
return { iconFontSize: "2.6vh", iconPadding: "sm", titleSize: "md", titleLineHeight: "2.6vh", descriptionSize: "sm", innerGap: "sm", bottomPad: "sm" };
|
|
2488
|
+
case "xl":
|
|
2489
|
+
return { iconFontSize: "3.2vh", iconPadding: "sm", titleSize: "lg", titleLineHeight: "3.2vh", descriptionSize: "md", innerGap: "md", bottomPad: "md" };
|
|
2490
|
+
case "md":
|
|
2491
|
+
default:
|
|
2492
|
+
return { iconFontSize: themeMdFontSize, iconPadding: "xs", titleSize: "sm", titleLineHeight: themeMdFontSize, descriptionSize: "xs", innerGap: "sm", bottomPad: "sm" };
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2475
2495
|
function Title(props) {
|
|
2476
2496
|
const game = useSettings((state) => state.game);
|
|
2477
2497
|
const theme = core.useMantineTheme();
|
|
2498
|
+
const preset = getSizePreset(props.size ?? "md", theme.fontSizes.md);
|
|
2478
2499
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
2479
2500
|
core.Flex,
|
|
2480
2501
|
{
|
|
@@ -2483,71 +2504,50 @@ function Title(props) {
|
|
|
2483
2504
|
gap: "xs",
|
|
2484
2505
|
w: props.w || "100%",
|
|
2485
2506
|
p: props.p || "unset",
|
|
2486
|
-
pb: !props.p ?
|
|
2507
|
+
pb: !props.p ? preset.bottomPad : props.p,
|
|
2487
2508
|
style: {
|
|
2488
2509
|
userSelect: "none",
|
|
2489
2510
|
borderBottom: props.removeBorder ? "none" : `0.3vh solid ${props.borderColor || colorWithAlpha(theme.colors[theme.primaryColor][9], 0.5)}`
|
|
2490
2511
|
},
|
|
2491
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2492
|
-
core.Flex,
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2512
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { align: "center", justify: "center", children: [
|
|
2513
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { align: "center", gap: preset.innerGap, pr: "xs", children: [
|
|
2514
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2515
|
+
BorderedIcon,
|
|
2516
|
+
{
|
|
2517
|
+
icon: props.icon,
|
|
2518
|
+
fontSize: preset.iconFontSize,
|
|
2519
|
+
color: props.iconColor,
|
|
2520
|
+
p: preset.iconPadding
|
|
2521
|
+
}
|
|
2522
|
+
),
|
|
2523
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", gap: "0.25vh", children: [
|
|
2524
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2525
|
+
core.Text,
|
|
2499
2526
|
{
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
color: props.iconColor
|
|
2510
|
-
}
|
|
2511
|
-
),
|
|
2512
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
2513
|
-
core.Flex,
|
|
2514
|
-
{
|
|
2515
|
-
direction: "column",
|
|
2516
|
-
gap: "0.25vh",
|
|
2517
|
-
children: [
|
|
2518
|
-
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { p: "0", size: "sm", style: {
|
|
2519
|
-
lineHeight: theme.fontSizes.md,
|
|
2520
|
-
fontFamily: game == "fivem" ? "Akrobat Bold" : "Red Dead",
|
|
2521
|
-
letterSpacing: "0.05em",
|
|
2522
|
-
textTransform: "uppercase"
|
|
2523
|
-
}, children: props.title }),
|
|
2524
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2525
|
-
core.Text,
|
|
2526
|
-
{
|
|
2527
|
-
size: "xs",
|
|
2528
|
-
c: "grey",
|
|
2529
|
-
style: { whiteSpace: "normal", wordWrap: "break-word" },
|
|
2530
|
-
children: props.description
|
|
2531
|
-
}
|
|
2532
|
-
)
|
|
2533
|
-
]
|
|
2534
|
-
}
|
|
2535
|
-
)
|
|
2536
|
-
]
|
|
2527
|
+
p: "0",
|
|
2528
|
+
size: preset.titleSize,
|
|
2529
|
+
style: {
|
|
2530
|
+
lineHeight: preset.titleLineHeight,
|
|
2531
|
+
fontFamily: game == "fivem" ? "Akrobat Bold" : "Red Dead",
|
|
2532
|
+
letterSpacing: "0.05em",
|
|
2533
|
+
textTransform: "uppercase"
|
|
2534
|
+
},
|
|
2535
|
+
children: props.title
|
|
2537
2536
|
}
|
|
2538
2537
|
),
|
|
2539
2538
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2540
|
-
core.
|
|
2539
|
+
core.Text,
|
|
2541
2540
|
{
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
children: props.
|
|
2541
|
+
size: preset.descriptionSize,
|
|
2542
|
+
c: "grey",
|
|
2543
|
+
style: { whiteSpace: "normal", wordWrap: "break-word" },
|
|
2544
|
+
children: props.description
|
|
2546
2545
|
}
|
|
2547
2546
|
)
|
|
2548
|
-
]
|
|
2549
|
-
}
|
|
2550
|
-
|
|
2547
|
+
] })
|
|
2548
|
+
] }),
|
|
2549
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Flex, { ml: "auto", align: "center", gap: "xs", children: props.rightSection })
|
|
2550
|
+
] })
|
|
2551
2551
|
}
|
|
2552
2552
|
);
|
|
2553
2553
|
}
|
|
@@ -3714,6 +3714,13 @@ function useForm() {
|
|
|
3714
3714
|
}, [state.values, state.initialValues]);
|
|
3715
3715
|
return { ...state, changedFields, changedCount: changedFields.length };
|
|
3716
3716
|
}
|
|
3717
|
+
function useFormField(path) {
|
|
3718
|
+
const store = react.useContext(FormContext);
|
|
3719
|
+
if (!store) {
|
|
3720
|
+
throw new Error("useFormField must be used inside <FormProvider>");
|
|
3721
|
+
}
|
|
3722
|
+
return zustand.useStore(store, (s) => getNested(s.values, path));
|
|
3723
|
+
}
|
|
3717
3724
|
function useFormActions() {
|
|
3718
3725
|
const store = react.useContext(FormContext);
|
|
3719
3726
|
if (!store) {
|
|
@@ -4100,7 +4107,22 @@ function ConfigPanelInner({
|
|
|
4100
4107
|
if (result?.success) {
|
|
4101
4108
|
const { store } = getScriptConfigInstance();
|
|
4102
4109
|
form.reinitialize(cloneConfig(store.getState()));
|
|
4110
|
+
notifications.notifications.show({
|
|
4111
|
+
color: "green",
|
|
4112
|
+
title: locale("ConfigResetSuccessTitle"),
|
|
4113
|
+
message: locale("ConfigResetSuccessBody"),
|
|
4114
|
+
autoClose: 3e3
|
|
4115
|
+
});
|
|
4116
|
+
return;
|
|
4103
4117
|
}
|
|
4118
|
+
const err = result?._error || "Unknown";
|
|
4119
|
+
console.warn(`[ConfigPanel] config reset failed: ${err}`);
|
|
4120
|
+
notifications.notifications.show({
|
|
4121
|
+
color: "red",
|
|
4122
|
+
title: locale("ConfigResetFailedTitle"),
|
|
4123
|
+
message: locale("ConfigResetFailedBody", err),
|
|
4124
|
+
autoClose: 6e3
|
|
4125
|
+
});
|
|
4104
4126
|
},
|
|
4105
4127
|
onClose: () => setResetOpen(false),
|
|
4106
4128
|
zIndex: 300
|
|
@@ -4168,8 +4190,8 @@ function ConfigPanelInner({
|
|
|
4168
4190
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ArrowLeft, { size: "1.4vh", color })
|
|
4169
4191
|
}
|
|
4170
4192
|
),
|
|
4171
|
-
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", style: { minWidth: 0, lineHeight: 1 }, children: [
|
|
4172
|
-
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "
|
|
4193
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { direction: "column", style: { minWidth: 0, flex: 1, lineHeight: 1, overflow: "hidden" }, children: [
|
|
4194
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { size: "md", ff: "Akrobat Bold", tt: "uppercase", lts: "0.04em", truncate: true, children: title }),
|
|
4173
4195
|
subtitle && /* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.08em", c: color, truncate: true, children: subtitle })
|
|
4174
4196
|
] })
|
|
4175
4197
|
] }),
|
|
@@ -5110,6 +5132,17 @@ function AdminPageTitle(props) {
|
|
|
5110
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) })
|
|
5111
5133
|
] });
|
|
5112
5134
|
}
|
|
5135
|
+
var placementStyle = (placement) => {
|
|
5136
|
+
switch (placement) {
|
|
5137
|
+
case "top-center":
|
|
5138
|
+
return { top: "1vh", left: "50%", transform: "translateX(-50%)" };
|
|
5139
|
+
case "top-right":
|
|
5140
|
+
return { top: "1vh", right: "1vh" };
|
|
5141
|
+
case "top-left":
|
|
5142
|
+
default:
|
|
5143
|
+
return { top: "1vh", left: "1vh" };
|
|
5144
|
+
}
|
|
5145
|
+
};
|
|
5113
5146
|
var loadPersistedState = (storageKey) => {
|
|
5114
5147
|
try {
|
|
5115
5148
|
const raw = localStorage.getItem(storageKey);
|
|
@@ -5128,7 +5161,8 @@ function TestBed({
|
|
|
5128
5161
|
items,
|
|
5129
5162
|
storageKey = "testbed:open-state",
|
|
5130
5163
|
disablePersistence = false,
|
|
5131
|
-
title = "TestBed"
|
|
5164
|
+
title = "TestBed",
|
|
5165
|
+
placement = "top-left"
|
|
5132
5166
|
}) {
|
|
5133
5167
|
const [open, setOpen] = react.useState(false);
|
|
5134
5168
|
const itemsRef = react.useRef(items);
|
|
@@ -5158,8 +5192,7 @@ function TestBed({
|
|
|
5158
5192
|
{
|
|
5159
5193
|
style: {
|
|
5160
5194
|
position: "fixed",
|
|
5161
|
-
|
|
5162
|
-
left: "1vh",
|
|
5195
|
+
...placementStyle(placement),
|
|
5163
5196
|
zIndex: 2147483647,
|
|
5164
5197
|
pointerEvents: "auto",
|
|
5165
5198
|
fontSize: "1.4vh"
|
|
@@ -5264,6 +5297,281 @@ function TestBed({
|
|
|
5264
5297
|
}
|
|
5265
5298
|
);
|
|
5266
5299
|
}
|
|
5300
|
+
var MANTINE_COLOR_OPTIONS = [
|
|
5301
|
+
"dirk",
|
|
5302
|
+
"red",
|
|
5303
|
+
"pink",
|
|
5304
|
+
"grape",
|
|
5305
|
+
"violet",
|
|
5306
|
+
"indigo",
|
|
5307
|
+
"blue",
|
|
5308
|
+
"cyan",
|
|
5309
|
+
"teal",
|
|
5310
|
+
"green",
|
|
5311
|
+
"lime",
|
|
5312
|
+
"yellow",
|
|
5313
|
+
"orange"
|
|
5314
|
+
].map((value) => ({ value, label: value }));
|
|
5315
|
+
var DEFAULT_PALETTE = [
|
|
5316
|
+
"#f0f4ff",
|
|
5317
|
+
"#d9e3ff",
|
|
5318
|
+
"#bfcfff",
|
|
5319
|
+
"#a6bbff",
|
|
5320
|
+
"#8ca7ff",
|
|
5321
|
+
"#7393ff",
|
|
5322
|
+
"#5a7fff",
|
|
5323
|
+
"#406bff",
|
|
5324
|
+
"#2547ff",
|
|
5325
|
+
"#0b33ff"
|
|
5326
|
+
];
|
|
5327
|
+
var DEFAULT_VALUE = {
|
|
5328
|
+
useOverride: false,
|
|
5329
|
+
primaryColor: "dirk",
|
|
5330
|
+
primaryShade: 5,
|
|
5331
|
+
customTheme: DEFAULT_PALETTE
|
|
5332
|
+
};
|
|
5333
|
+
function GroupLabel({ label }) {
|
|
5334
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { align: "center", gap: "xs", mt: "xxs", children: [
|
|
5335
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Text, { ff: "Akrobat Bold", size: "xxs", tt: "uppercase", lts: "0.07em", c: "rgba(255,255,255,0.2)", children: label }),
|
|
5336
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { flex: 1, height: "0.05vh", background: "rgba(255,255,255,0.06)" } })
|
|
5337
|
+
] });
|
|
5338
|
+
}
|
|
5339
|
+
function ThemeOverrideSection({
|
|
5340
|
+
schemaKey = "theme",
|
|
5341
|
+
title
|
|
5342
|
+
}) {
|
|
5343
|
+
const mantineTheme = core.useMantineTheme();
|
|
5344
|
+
const color = mantineTheme.colors[mantineTheme.primaryColor][5];
|
|
5345
|
+
const raw = useFormField(schemaKey);
|
|
5346
|
+
const value = {
|
|
5347
|
+
useOverride: raw?.useOverride ?? DEFAULT_VALUE.useOverride,
|
|
5348
|
+
primaryColor: raw?.primaryColor ?? DEFAULT_VALUE.primaryColor,
|
|
5349
|
+
primaryShade: raw?.primaryShade ?? DEFAULT_VALUE.primaryShade,
|
|
5350
|
+
customTheme: Array.isArray(raw?.customTheme) && raw.customTheme.length === 10 ? raw.customTheme : DEFAULT_VALUE.customTheme
|
|
5351
|
+
};
|
|
5352
|
+
const { setValue } = useFormActions();
|
|
5353
|
+
const set = (key, val) => setValue(schemaKey, { ...value, [key]: val });
|
|
5354
|
+
const useCustom = value.primaryColor === "custom";
|
|
5355
|
+
const editable = value.useOverride;
|
|
5356
|
+
const setSwatch = (index, hex) => {
|
|
5357
|
+
const next = [...value.customTheme];
|
|
5358
|
+
next[index] = hex;
|
|
5359
|
+
set("customTheme", next);
|
|
5360
|
+
};
|
|
5361
|
+
const generateFromBase = (hex) => {
|
|
5362
|
+
try {
|
|
5363
|
+
const generated = colorsGenerator.generateColors(hex);
|
|
5364
|
+
set("customTheme", generated);
|
|
5365
|
+
} catch {
|
|
5366
|
+
}
|
|
5367
|
+
};
|
|
5368
|
+
const resetPalette = () => set("customTheme", DEFAULT_PALETTE);
|
|
5369
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5370
|
+
core.Flex,
|
|
5371
|
+
{
|
|
5372
|
+
direction: "column",
|
|
5373
|
+
gap: "xs",
|
|
5374
|
+
p: "sm",
|
|
5375
|
+
style: { flex: 1, minHeight: 0, overflowY: "auto" },
|
|
5376
|
+
children: [
|
|
5377
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5378
|
+
AdminPageTitle,
|
|
5379
|
+
{
|
|
5380
|
+
icon: lucideReact.Palette,
|
|
5381
|
+
title: title || locale("Theme") || "Theme",
|
|
5382
|
+
color
|
|
5383
|
+
}
|
|
5384
|
+
),
|
|
5385
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5386
|
+
core.Flex,
|
|
5387
|
+
{
|
|
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
|
+
]
|
|
5411
|
+
}
|
|
5412
|
+
),
|
|
5413
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5414
|
+
"div",
|
|
5415
|
+
{
|
|
5416
|
+
style: {
|
|
5417
|
+
opacity: editable ? 1 : 0.4,
|
|
5418
|
+
pointerEvents: editable ? "auto" : "none",
|
|
5419
|
+
transition: "opacity 0.15s"
|
|
5420
|
+
},
|
|
5421
|
+
children: [
|
|
5422
|
+
/* @__PURE__ */ jsxRuntime.jsx(GroupLabel, { label: locale("PrimaryColor") || "Primary Colour" }),
|
|
5423
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5424
|
+
core.Switch,
|
|
5425
|
+
{
|
|
5426
|
+
label: locale("UseCustomPalette") || "Use custom palette",
|
|
5427
|
+
size: "md",
|
|
5428
|
+
checked: useCustom,
|
|
5429
|
+
onChange: (e) => set("primaryColor", e.currentTarget.checked ? "custom" : "dirk"),
|
|
5430
|
+
styles: {
|
|
5431
|
+
label: {
|
|
5432
|
+
fontFamily: "Akrobat Bold",
|
|
5433
|
+
fontSize: "0.65em",
|
|
5434
|
+
letterSpacing: "0.06em",
|
|
5435
|
+
textTransform: "uppercase",
|
|
5436
|
+
color: "rgba(255,255,255,0.35)"
|
|
5437
|
+
}
|
|
5438
|
+
}
|
|
5439
|
+
}
|
|
5440
|
+
),
|
|
5441
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { gap: "xs", mt: "xs", children: [
|
|
5442
|
+
!useCustom && /* @__PURE__ */ jsxRuntime.jsx(
|
|
5443
|
+
core.Select,
|
|
5444
|
+
{
|
|
5445
|
+
label: locale("MantinePalette") || "Mantine palette",
|
|
5446
|
+
size: "xs",
|
|
5447
|
+
style: { flex: 1 },
|
|
5448
|
+
value: value.primaryColor,
|
|
5449
|
+
data: MANTINE_COLOR_OPTIONS,
|
|
5450
|
+
allowDeselect: false,
|
|
5451
|
+
onChange: (v) => v && set("primaryColor", v)
|
|
5452
|
+
}
|
|
5453
|
+
),
|
|
5454
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5455
|
+
core.NumberInput,
|
|
5456
|
+
{
|
|
5457
|
+
label: locale("Shade") || "Shade",
|
|
5458
|
+
size: "xs",
|
|
5459
|
+
style: { flex: 1 },
|
|
5460
|
+
min: 0,
|
|
5461
|
+
max: 9,
|
|
5462
|
+
value: value.primaryShade,
|
|
5463
|
+
onChange: (v) => set("primaryShade", Number(v))
|
|
5464
|
+
}
|
|
5465
|
+
)
|
|
5466
|
+
] }),
|
|
5467
|
+
useCustom && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
5468
|
+
/* @__PURE__ */ jsxRuntime.jsxs(core.Flex, { align: "center", justify: "space-between", mt: "sm", children: [
|
|
5469
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5470
|
+
core.Text,
|
|
5471
|
+
{
|
|
5472
|
+
ff: "Akrobat Bold",
|
|
5473
|
+
size: "xxs",
|
|
5474
|
+
tt: "uppercase",
|
|
5475
|
+
lts: "0.07em",
|
|
5476
|
+
c: "rgba(255,255,255,0.2)",
|
|
5477
|
+
children: locale("CustomPalette") || "Custom palette"
|
|
5478
|
+
}
|
|
5479
|
+
),
|
|
5480
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5481
|
+
core.ActionIcon,
|
|
5482
|
+
{
|
|
5483
|
+
size: "sm",
|
|
5484
|
+
variant: "subtle",
|
|
5485
|
+
onClick: resetPalette,
|
|
5486
|
+
title: locale("ResetPalette") || "Reset palette",
|
|
5487
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { size: "1.4vh" })
|
|
5488
|
+
}
|
|
5489
|
+
)
|
|
5490
|
+
] }),
|
|
5491
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5492
|
+
core.ColorInput,
|
|
5493
|
+
{
|
|
5494
|
+
label: locale("BaseColor") || "Base colour",
|
|
5495
|
+
size: "xs",
|
|
5496
|
+
value: value.customTheme[value.primaryShade] ?? value.customTheme[5] ?? "#000000",
|
|
5497
|
+
onChange: generateFromBase,
|
|
5498
|
+
eyeDropperIcon: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
|
|
5499
|
+
}
|
|
5500
|
+
),
|
|
5501
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Flex, { gap: "xxs", mt: "xxs", children: value.customTheme.map((swatch, i) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5502
|
+
SwatchTile,
|
|
5503
|
+
{
|
|
5504
|
+
index: i,
|
|
5505
|
+
value: swatch,
|
|
5506
|
+
isPrimary: i === value.primaryShade,
|
|
5507
|
+
onChange: (v) => setSwatch(i, v)
|
|
5508
|
+
},
|
|
5509
|
+
i
|
|
5510
|
+
)) })
|
|
5511
|
+
] })
|
|
5512
|
+
]
|
|
5513
|
+
}
|
|
5514
|
+
)
|
|
5515
|
+
]
|
|
5516
|
+
}
|
|
5517
|
+
);
|
|
5518
|
+
}
|
|
5519
|
+
function SwatchTile({
|
|
5520
|
+
index,
|
|
5521
|
+
value,
|
|
5522
|
+
isPrimary,
|
|
5523
|
+
onChange
|
|
5524
|
+
}) {
|
|
5525
|
+
const [opened, setOpened] = react.useState(false);
|
|
5526
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(core.Popover, { opened, onChange: setOpened, position: "bottom", withArrow: true, zIndex: 1e4, children: [
|
|
5527
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Popover.Target, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5528
|
+
"button",
|
|
5529
|
+
{
|
|
5530
|
+
onClick: () => setOpened((o) => !o),
|
|
5531
|
+
title: `${index} \xB7 ${value}`,
|
|
5532
|
+
style: {
|
|
5533
|
+
flex: 1,
|
|
5534
|
+
aspectRatio: "1 / 1",
|
|
5535
|
+
background: value,
|
|
5536
|
+
border: isPrimary ? "0.2vh solid rgba(255,255,255,0.85)" : "0.1vh solid rgba(255,255,255,0.15)",
|
|
5537
|
+
borderRadius: "0.4vh",
|
|
5538
|
+
cursor: "pointer",
|
|
5539
|
+
padding: 0,
|
|
5540
|
+
display: "flex",
|
|
5541
|
+
alignItems: "flex-end",
|
|
5542
|
+
justifyContent: "flex-end",
|
|
5543
|
+
position: "relative"
|
|
5544
|
+
},
|
|
5545
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5546
|
+
"span",
|
|
5547
|
+
{
|
|
5548
|
+
style: {
|
|
5549
|
+
fontFamily: "Akrobat Bold",
|
|
5550
|
+
fontSize: "0.9vh",
|
|
5551
|
+
lineHeight: 1,
|
|
5552
|
+
padding: "0.2vh 0.3vh",
|
|
5553
|
+
color: "rgba(0,0,0,0.55)",
|
|
5554
|
+
background: "rgba(255,255,255,0.55)",
|
|
5555
|
+
borderRadius: "0.25vh",
|
|
5556
|
+
margin: "0.2vh"
|
|
5557
|
+
},
|
|
5558
|
+
children: index
|
|
5559
|
+
}
|
|
5560
|
+
)
|
|
5561
|
+
}
|
|
5562
|
+
) }),
|
|
5563
|
+
/* @__PURE__ */ jsxRuntime.jsx(core.Popover.Dropdown, { p: "xs", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5564
|
+
core.ColorInput,
|
|
5565
|
+
{
|
|
5566
|
+
size: "xs",
|
|
5567
|
+
value,
|
|
5568
|
+
onChange,
|
|
5569
|
+
format: "hex",
|
|
5570
|
+
eyeDropperIcon: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
|
|
5571
|
+
}
|
|
5572
|
+
) })
|
|
5573
|
+
] });
|
|
5574
|
+
}
|
|
5267
5575
|
|
|
5268
5576
|
exports.AdminPageTitle = AdminPageTitle;
|
|
5269
5577
|
exports.AsyncSaveButton = AsyncSaveButton;
|
|
@@ -5302,6 +5610,7 @@ exports.SegmentedControl = SegmentedControl;
|
|
|
5302
5610
|
exports.SegmentedProgress = SegmentedProgress;
|
|
5303
5611
|
exports.SelectItem = SelectItem;
|
|
5304
5612
|
exports.TestBed = TestBed;
|
|
5613
|
+
exports.ThemeOverrideSection = ThemeOverrideSection;
|
|
5305
5614
|
exports.Title = Title;
|
|
5306
5615
|
exports.Vector4DeleteButton = Vector4DeleteButton;
|
|
5307
5616
|
exports.Vector4Display = Vector4Display;
|