dirk-cfx-react 1.1.65 → 1.1.67
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 +106 -0
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +39 -1
- package/dist/components/index.d.ts +39 -1
- package/dist/components/index.js +104 -1
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +179 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +109 -3
- package/dist/index.js.map +1 -1
- package/dist/utils/index.cjs +19 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +29 -1
- package/dist/utils/index.d.ts +29 -1
- package/dist/utils/index.js +18 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1360,6 +1360,20 @@ registerInitialFetch("FETCH_ALL_ITEMS", null, {
|
|
|
1360
1360
|
useItems.setState(fetchedItems);
|
|
1361
1361
|
}).catch(() => {
|
|
1362
1362
|
});
|
|
1363
|
+
var useFrameworkGroups = zustand.create(() => ({
|
|
1364
|
+
jobs: [],
|
|
1365
|
+
gangs: [],
|
|
1366
|
+
loaded: false
|
|
1367
|
+
}));
|
|
1368
|
+
registerInitialFetch("GET_FRAMEWORK_GROUPS", void 0).then((data) => {
|
|
1369
|
+
useFrameworkGroups.setState({
|
|
1370
|
+
jobs: Array.isArray(data?.jobs) ? data.jobs : [],
|
|
1371
|
+
gangs: Array.isArray(data?.gangs) ? data.gangs : [],
|
|
1372
|
+
loaded: true
|
|
1373
|
+
});
|
|
1374
|
+
}).catch(() => {
|
|
1375
|
+
useFrameworkGroups.setState({ loaded: true });
|
|
1376
|
+
});
|
|
1363
1377
|
|
|
1364
1378
|
// src/utils/inputMapper.ts
|
|
1365
1379
|
var INPUT_MAPPER_PRIMARY_OPTIONS = [
|
|
@@ -4018,6 +4032,7 @@ function SelectItem(props) {
|
|
|
4018
4032
|
data: formattedItems,
|
|
4019
4033
|
allowDeselect: false,
|
|
4020
4034
|
searchable: true,
|
|
4035
|
+
comboboxProps: { withinPortal: true, zIndex: 2e3 },
|
|
4021
4036
|
leftSectionWidth: "4vh",
|
|
4022
4037
|
leftSection: props.value ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
4023
4038
|
core.Image,
|
|
@@ -4261,6 +4276,94 @@ function PickerButton({
|
|
|
4261
4276
|
}
|
|
4262
4277
|
) });
|
|
4263
4278
|
}
|
|
4279
|
+
var GroupSelectContext = react.createContext(null);
|
|
4280
|
+
function GroupSelect({
|
|
4281
|
+
value,
|
|
4282
|
+
onChange,
|
|
4283
|
+
type,
|
|
4284
|
+
children,
|
|
4285
|
+
style
|
|
4286
|
+
}) {
|
|
4287
|
+
return /* @__PURE__ */ jsxRuntime.jsx(GroupSelectContext.Provider, { value: { value, onChange, type }, children: /* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.4vh", ...style }, children }) });
|
|
4288
|
+
}
|
|
4289
|
+
function filterByType(jobs, gangs, type) {
|
|
4290
|
+
if (type === "job") return jobs;
|
|
4291
|
+
if (type === "gang") return gangs;
|
|
4292
|
+
return [...jobs, ...gangs];
|
|
4293
|
+
}
|
|
4294
|
+
function GroupName(props) {
|
|
4295
|
+
const ctx = react.useContext(GroupSelectContext);
|
|
4296
|
+
const jobs = useFrameworkGroups((s) => s.jobs);
|
|
4297
|
+
const gangs = useFrameworkGroups((s) => s.gangs);
|
|
4298
|
+
const inCompound = ctx !== null;
|
|
4299
|
+
const currentValue = inCompound ? ctx.value.name : props.value;
|
|
4300
|
+
const filterType = inCompound ? ctx.type : props.type;
|
|
4301
|
+
const list = filterByType(jobs, gangs, filterType);
|
|
4302
|
+
const data = filterType === void 0 ? [
|
|
4303
|
+
{ group: locale("Jobs") || "Jobs", items: jobs.map((g) => ({ value: g.name, label: g.label })) },
|
|
4304
|
+
{ group: locale("Gangs") || "Gangs", items: gangs.map((g) => ({ value: g.name, label: g.label })) }
|
|
4305
|
+
] : list.map((g) => ({ value: g.name, label: g.label }));
|
|
4306
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4307
|
+
core.Select,
|
|
4308
|
+
{
|
|
4309
|
+
label: props.label,
|
|
4310
|
+
description: props.description,
|
|
4311
|
+
placeholder: props.placeholder ?? (locale("SelectGroup") || "Select\u2026"),
|
|
4312
|
+
size: props.size ?? "xs",
|
|
4313
|
+
disabled: props.disabled,
|
|
4314
|
+
style: props.style,
|
|
4315
|
+
data,
|
|
4316
|
+
value: currentValue ?? null,
|
|
4317
|
+
searchable: true,
|
|
4318
|
+
onChange: (v) => {
|
|
4319
|
+
const name = v ?? "";
|
|
4320
|
+
if (inCompound) {
|
|
4321
|
+
ctx.onChange({ name: name || void 0, grade: void 0 });
|
|
4322
|
+
} else if (props.onChange) {
|
|
4323
|
+
props.onChange(name);
|
|
4324
|
+
}
|
|
4325
|
+
},
|
|
4326
|
+
allowDeselect: false
|
|
4327
|
+
}
|
|
4328
|
+
);
|
|
4329
|
+
}
|
|
4330
|
+
function GroupRank(props) {
|
|
4331
|
+
const ctx = react.useContext(GroupSelectContext);
|
|
4332
|
+
if (ctx === null) {
|
|
4333
|
+
throw new Error("<GroupRank> must be a child of <GroupSelect>");
|
|
4334
|
+
}
|
|
4335
|
+
const jobs = useFrameworkGroups((s) => s.jobs);
|
|
4336
|
+
const gangs = useFrameworkGroups((s) => s.gangs);
|
|
4337
|
+
const all = [...jobs, ...gangs];
|
|
4338
|
+
const selectedGroup = all.find((g) => g.name === ctx.value.name) ?? null;
|
|
4339
|
+
const grades = selectedGroup?.grades ?? [];
|
|
4340
|
+
const data = grades.map((g) => ({
|
|
4341
|
+
value: String(g.grade),
|
|
4342
|
+
label: `${g.grade} \u2014 ${g.label || g.name}${g.isBoss ? " (boss)" : ""}`
|
|
4343
|
+
}));
|
|
4344
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4345
|
+
core.Select,
|
|
4346
|
+
{
|
|
4347
|
+
label: props.label,
|
|
4348
|
+
description: props.description,
|
|
4349
|
+
placeholder: props.placeholder ?? (locale("SelectGrade") || "Select grade\u2026"),
|
|
4350
|
+
size: props.size ?? "xs",
|
|
4351
|
+
style: props.style,
|
|
4352
|
+
data,
|
|
4353
|
+
value: ctx.value.grade != null ? String(ctx.value.grade) : null,
|
|
4354
|
+
onChange: (v) => {
|
|
4355
|
+
ctx.onChange({
|
|
4356
|
+
...ctx.value,
|
|
4357
|
+
grade: v != null ? Number(v) : void 0
|
|
4358
|
+
});
|
|
4359
|
+
},
|
|
4360
|
+
disabled: !selectedGroup || grades.length === 0,
|
|
4361
|
+
allowDeselect: false
|
|
4362
|
+
}
|
|
4363
|
+
);
|
|
4364
|
+
}
|
|
4365
|
+
GroupSelect.Name = GroupName;
|
|
4366
|
+
GroupSelect.Rank = GroupRank;
|
|
4264
4367
|
var KeyBindContext = react.createContext(null);
|
|
4265
4368
|
function useKeyBindContext() {
|
|
4266
4369
|
const ctx = react.useContext(KeyBindContext);
|
|
@@ -4555,6 +4658,9 @@ exports.ConfirmModal = ConfirmModal;
|
|
|
4555
4658
|
exports.Counter = Counter;
|
|
4556
4659
|
exports.FiveMKeyBindInput = FiveMKeyBindInput;
|
|
4557
4660
|
exports.FloatingParticles = FloatingParticles;
|
|
4661
|
+
exports.GroupName = GroupName;
|
|
4662
|
+
exports.GroupRank = GroupRank;
|
|
4663
|
+
exports.GroupSelect = GroupSelect;
|
|
4558
4664
|
exports.InfoBox = InfoBox;
|
|
4559
4665
|
exports.InputContainer = InputContainer;
|
|
4560
4666
|
exports.LevelBanner = LevelBanner;
|