dirk-cfx-react 1.1.65 → 1.1.66
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 +105 -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 +103 -1
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +178 -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 +108 -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
|
@@ -853,6 +853,44 @@ type PositionPickerProps = {
|
|
|
853
853
|
};
|
|
854
854
|
declare function PositionPicker(props: PositionPickerProps): react_jsx_runtime.JSX.Element;
|
|
855
855
|
|
|
856
|
+
type GroupValue = {
|
|
857
|
+
name?: string;
|
|
858
|
+
grade?: number;
|
|
859
|
+
};
|
|
860
|
+
type GroupType = "job" | "gang";
|
|
861
|
+
type GroupSelectProps = {
|
|
862
|
+
value: GroupValue;
|
|
863
|
+
onChange: (next: GroupValue) => void;
|
|
864
|
+
type?: GroupType;
|
|
865
|
+
children: React__default.ReactNode;
|
|
866
|
+
style?: React__default.CSSProperties;
|
|
867
|
+
};
|
|
868
|
+
declare function GroupSelect({ value, onChange, type, children, style, }: GroupSelectProps): react_jsx_runtime.JSX.Element;
|
|
869
|
+
declare namespace GroupSelect {
|
|
870
|
+
var Name: typeof GroupName;
|
|
871
|
+
var Rank: typeof GroupRank;
|
|
872
|
+
}
|
|
873
|
+
type GroupNameProps = {
|
|
874
|
+
value?: string;
|
|
875
|
+
onChange?: (name: string) => void;
|
|
876
|
+
type?: GroupType;
|
|
877
|
+
label?: string;
|
|
878
|
+
description?: string;
|
|
879
|
+
placeholder?: string;
|
|
880
|
+
size?: string;
|
|
881
|
+
disabled?: boolean;
|
|
882
|
+
style?: React__default.CSSProperties;
|
|
883
|
+
};
|
|
884
|
+
declare function GroupName(props: GroupNameProps): react_jsx_runtime.JSX.Element;
|
|
885
|
+
type GroupRankProps = {
|
|
886
|
+
label?: string;
|
|
887
|
+
description?: string;
|
|
888
|
+
placeholder?: string;
|
|
889
|
+
size?: string;
|
|
890
|
+
style?: React__default.CSSProperties;
|
|
891
|
+
};
|
|
892
|
+
declare function GroupRank(props: GroupRankProps): react_jsx_runtime.JSX.Element;
|
|
893
|
+
|
|
856
894
|
type FiveMControls = {
|
|
857
895
|
_type: string;
|
|
858
896
|
_key: string;
|
|
@@ -907,4 +945,4 @@ interface TestBedProps {
|
|
|
907
945
|
}
|
|
908
946
|
declare function TestBed({ items, storageKey, disablePersistence, title, }: TestBedProps): react_jsx_runtime.JSX.Element | null;
|
|
909
947
|
|
|
910
|
-
export { AdminPageTitle, type AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, type BlipColorSelectProps, BlipDisplaySelect, type BlipDisplaySelectProps, BlipIconSelect, type BlipIconSelectProps, BorderedIcon, type BorderedIconProps, type ButtonProps, ConfigPanel, type ConfigPanelProps, ConfirmModal, type ConfirmModalProps, Counter, type FiveMControls, FiveMKeyBindInput, FloatingParticles, type FloatingParticlesProps, InfoBox, type InfoBoxProps, InputContainer, type InputContainerProps, LevelBanner, LevelPanel, 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 TestBedProps, Title, type TitleProps, type Vector4Value, useModal, useModalActions, useNavigation, useNavigationStore };
|
|
948
|
+
export { AdminPageTitle, type AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, type BlipColorSelectProps, BlipDisplaySelect, type BlipDisplaySelectProps, BlipIconSelect, type BlipIconSelectProps, BorderedIcon, type BorderedIconProps, type ButtonProps, ConfigPanel, type ConfigPanelProps, ConfirmModal, type ConfirmModalProps, 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, 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 TestBedProps, Title, type TitleProps, type Vector4Value, useModal, useModalActions, useNavigation, useNavigationStore };
|
|
@@ -853,6 +853,44 @@ type PositionPickerProps = {
|
|
|
853
853
|
};
|
|
854
854
|
declare function PositionPicker(props: PositionPickerProps): react_jsx_runtime.JSX.Element;
|
|
855
855
|
|
|
856
|
+
type GroupValue = {
|
|
857
|
+
name?: string;
|
|
858
|
+
grade?: number;
|
|
859
|
+
};
|
|
860
|
+
type GroupType = "job" | "gang";
|
|
861
|
+
type GroupSelectProps = {
|
|
862
|
+
value: GroupValue;
|
|
863
|
+
onChange: (next: GroupValue) => void;
|
|
864
|
+
type?: GroupType;
|
|
865
|
+
children: React__default.ReactNode;
|
|
866
|
+
style?: React__default.CSSProperties;
|
|
867
|
+
};
|
|
868
|
+
declare function GroupSelect({ value, onChange, type, children, style, }: GroupSelectProps): react_jsx_runtime.JSX.Element;
|
|
869
|
+
declare namespace GroupSelect {
|
|
870
|
+
var Name: typeof GroupName;
|
|
871
|
+
var Rank: typeof GroupRank;
|
|
872
|
+
}
|
|
873
|
+
type GroupNameProps = {
|
|
874
|
+
value?: string;
|
|
875
|
+
onChange?: (name: string) => void;
|
|
876
|
+
type?: GroupType;
|
|
877
|
+
label?: string;
|
|
878
|
+
description?: string;
|
|
879
|
+
placeholder?: string;
|
|
880
|
+
size?: string;
|
|
881
|
+
disabled?: boolean;
|
|
882
|
+
style?: React__default.CSSProperties;
|
|
883
|
+
};
|
|
884
|
+
declare function GroupName(props: GroupNameProps): react_jsx_runtime.JSX.Element;
|
|
885
|
+
type GroupRankProps = {
|
|
886
|
+
label?: string;
|
|
887
|
+
description?: string;
|
|
888
|
+
placeholder?: string;
|
|
889
|
+
size?: string;
|
|
890
|
+
style?: React__default.CSSProperties;
|
|
891
|
+
};
|
|
892
|
+
declare function GroupRank(props: GroupRankProps): react_jsx_runtime.JSX.Element;
|
|
893
|
+
|
|
856
894
|
type FiveMControls = {
|
|
857
895
|
_type: string;
|
|
858
896
|
_key: string;
|
|
@@ -907,4 +945,4 @@ interface TestBedProps {
|
|
|
907
945
|
}
|
|
908
946
|
declare function TestBed({ items, storageKey, disablePersistence, title, }: TestBedProps): react_jsx_runtime.JSX.Element | null;
|
|
909
947
|
|
|
910
|
-
export { AdminPageTitle, type AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, type BlipColorSelectProps, BlipDisplaySelect, type BlipDisplaySelectProps, BlipIconSelect, type BlipIconSelectProps, BorderedIcon, type BorderedIconProps, type ButtonProps, ConfigPanel, type ConfigPanelProps, ConfirmModal, type ConfirmModalProps, Counter, type FiveMControls, FiveMKeyBindInput, FloatingParticles, type FloatingParticlesProps, InfoBox, type InfoBoxProps, InputContainer, type InputContainerProps, LevelBanner, LevelPanel, 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 TestBedProps, Title, type TitleProps, type Vector4Value, useModal, useModalActions, useNavigation, useNavigationStore };
|
|
948
|
+
export { AdminPageTitle, type AdminPageTitleProps, AsyncSaveButton, BlipColorSelect, type BlipColorSelectProps, BlipDisplaySelect, type BlipDisplaySelectProps, BlipIconSelect, type BlipIconSelectProps, BorderedIcon, type BorderedIconProps, type ButtonProps, ConfigPanel, type ConfigPanelProps, ConfirmModal, type ConfirmModalProps, 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, 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 TestBedProps, Title, type TitleProps, type Vector4Value, useModal, useModalActions, useNavigation, useNavigationStore };
|
package/dist/components/index.js
CHANGED
|
@@ -1353,6 +1353,20 @@ registerInitialFetch("FETCH_ALL_ITEMS", null, {
|
|
|
1353
1353
|
useItems.setState(fetchedItems);
|
|
1354
1354
|
}).catch(() => {
|
|
1355
1355
|
});
|
|
1356
|
+
var useFrameworkGroups = create(() => ({
|
|
1357
|
+
jobs: [],
|
|
1358
|
+
gangs: [],
|
|
1359
|
+
loaded: false
|
|
1360
|
+
}));
|
|
1361
|
+
registerInitialFetch("GET_FRAMEWORK_GROUPS", void 0).then((data) => {
|
|
1362
|
+
useFrameworkGroups.setState({
|
|
1363
|
+
jobs: Array.isArray(data?.jobs) ? data.jobs : [],
|
|
1364
|
+
gangs: Array.isArray(data?.gangs) ? data.gangs : [],
|
|
1365
|
+
loaded: true
|
|
1366
|
+
});
|
|
1367
|
+
}).catch(() => {
|
|
1368
|
+
useFrameworkGroups.setState({ loaded: true });
|
|
1369
|
+
});
|
|
1356
1370
|
|
|
1357
1371
|
// src/utils/inputMapper.ts
|
|
1358
1372
|
var INPUT_MAPPER_PRIMARY_OPTIONS = [
|
|
@@ -4254,6 +4268,94 @@ function PickerButton({
|
|
|
4254
4268
|
}
|
|
4255
4269
|
) });
|
|
4256
4270
|
}
|
|
4271
|
+
var GroupSelectContext = createContext(null);
|
|
4272
|
+
function GroupSelect({
|
|
4273
|
+
value,
|
|
4274
|
+
onChange,
|
|
4275
|
+
type,
|
|
4276
|
+
children,
|
|
4277
|
+
style
|
|
4278
|
+
}) {
|
|
4279
|
+
return /* @__PURE__ */ jsx(GroupSelectContext.Provider, { value: { value, onChange, type }, children: /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: "0.4vh", ...style }, children }) });
|
|
4280
|
+
}
|
|
4281
|
+
function filterByType(jobs, gangs, type) {
|
|
4282
|
+
if (type === "job") return jobs;
|
|
4283
|
+
if (type === "gang") return gangs;
|
|
4284
|
+
return [...jobs, ...gangs];
|
|
4285
|
+
}
|
|
4286
|
+
function GroupName(props) {
|
|
4287
|
+
const ctx = useContext(GroupSelectContext);
|
|
4288
|
+
const jobs = useFrameworkGroups((s) => s.jobs);
|
|
4289
|
+
const gangs = useFrameworkGroups((s) => s.gangs);
|
|
4290
|
+
const inCompound = ctx !== null;
|
|
4291
|
+
const currentValue = inCompound ? ctx.value.name : props.value;
|
|
4292
|
+
const filterType = inCompound ? ctx.type : props.type;
|
|
4293
|
+
const list = filterByType(jobs, gangs, filterType);
|
|
4294
|
+
const data = filterType === void 0 ? [
|
|
4295
|
+
{ group: locale("Jobs") || "Jobs", items: jobs.map((g) => ({ value: g.name, label: g.label })) },
|
|
4296
|
+
{ group: locale("Gangs") || "Gangs", items: gangs.map((g) => ({ value: g.name, label: g.label })) }
|
|
4297
|
+
] : list.map((g) => ({ value: g.name, label: g.label }));
|
|
4298
|
+
return /* @__PURE__ */ jsx(
|
|
4299
|
+
Select,
|
|
4300
|
+
{
|
|
4301
|
+
label: props.label,
|
|
4302
|
+
description: props.description,
|
|
4303
|
+
placeholder: props.placeholder ?? (locale("SelectGroup") || "Select\u2026"),
|
|
4304
|
+
size: props.size ?? "xs",
|
|
4305
|
+
disabled: props.disabled,
|
|
4306
|
+
style: props.style,
|
|
4307
|
+
data,
|
|
4308
|
+
value: currentValue ?? null,
|
|
4309
|
+
searchable: true,
|
|
4310
|
+
onChange: (v) => {
|
|
4311
|
+
const name = v ?? "";
|
|
4312
|
+
if (inCompound) {
|
|
4313
|
+
ctx.onChange({ name: name || void 0, grade: void 0 });
|
|
4314
|
+
} else if (props.onChange) {
|
|
4315
|
+
props.onChange(name);
|
|
4316
|
+
}
|
|
4317
|
+
},
|
|
4318
|
+
allowDeselect: false
|
|
4319
|
+
}
|
|
4320
|
+
);
|
|
4321
|
+
}
|
|
4322
|
+
function GroupRank(props) {
|
|
4323
|
+
const ctx = useContext(GroupSelectContext);
|
|
4324
|
+
if (ctx === null) {
|
|
4325
|
+
throw new Error("<GroupRank> must be a child of <GroupSelect>");
|
|
4326
|
+
}
|
|
4327
|
+
const jobs = useFrameworkGroups((s) => s.jobs);
|
|
4328
|
+
const gangs = useFrameworkGroups((s) => s.gangs);
|
|
4329
|
+
const all = [...jobs, ...gangs];
|
|
4330
|
+
const selectedGroup = all.find((g) => g.name === ctx.value.name) ?? null;
|
|
4331
|
+
const grades = selectedGroup?.grades ?? [];
|
|
4332
|
+
const data = grades.map((g) => ({
|
|
4333
|
+
value: String(g.grade),
|
|
4334
|
+
label: `${g.grade} \u2014 ${g.label || g.name}${g.isBoss ? " (boss)" : ""}`
|
|
4335
|
+
}));
|
|
4336
|
+
return /* @__PURE__ */ jsx(
|
|
4337
|
+
Select,
|
|
4338
|
+
{
|
|
4339
|
+
label: props.label,
|
|
4340
|
+
description: props.description,
|
|
4341
|
+
placeholder: props.placeholder ?? (locale("SelectGrade") || "Select grade\u2026"),
|
|
4342
|
+
size: props.size ?? "xs",
|
|
4343
|
+
style: props.style,
|
|
4344
|
+
data,
|
|
4345
|
+
value: ctx.value.grade != null ? String(ctx.value.grade) : null,
|
|
4346
|
+
onChange: (v) => {
|
|
4347
|
+
ctx.onChange({
|
|
4348
|
+
...ctx.value,
|
|
4349
|
+
grade: v != null ? Number(v) : void 0
|
|
4350
|
+
});
|
|
4351
|
+
},
|
|
4352
|
+
disabled: !selectedGroup || grades.length === 0,
|
|
4353
|
+
allowDeselect: false
|
|
4354
|
+
}
|
|
4355
|
+
);
|
|
4356
|
+
}
|
|
4357
|
+
GroupSelect.Name = GroupName;
|
|
4358
|
+
GroupSelect.Rank = GroupRank;
|
|
4257
4359
|
var KeyBindContext = createContext(null);
|
|
4258
4360
|
function useKeyBindContext() {
|
|
4259
4361
|
const ctx = useContext(KeyBindContext);
|
|
@@ -4537,6 +4639,6 @@ function TestBed({
|
|
|
4537
4639
|
);
|
|
4538
4640
|
}
|
|
4539
4641
|
|
|
4540
|
-
export { AdminPageTitle, AsyncSaveButton, BlipColorSelect, BlipDisplaySelect, BlipIconSelect, BorderedIcon, ConfigPanel, ConfirmModal, Counter, FiveMKeyBindInput, FloatingParticles, InfoBox, InputContainer, LevelBanner, LevelPanel, Modal, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, PositionPicker, PromptModal, SegmentedControl, SegmentedProgress, SelectItem, TestBed, Title, useModal, useModalActions, useNavigation, useNavigationStore };
|
|
4642
|
+
export { AdminPageTitle, AsyncSaveButton, BlipColorSelect, BlipDisplaySelect, BlipIconSelect, BorderedIcon, ConfigPanel, ConfirmModal, Counter, FiveMKeyBindInput, FloatingParticles, GroupName, GroupRank, GroupSelect, InfoBox, InputContainer, LevelBanner, LevelPanel, Modal, ModalContext, ModalProvider, MotionFlex, MotionIcon, MotionImage, MotionText, NavBar, NavigationContext, NavigationProvider, PositionPicker, PromptModal, SegmentedControl, SegmentedProgress, SelectItem, TestBed, Title, useModal, useModalActions, useNavigation, useNavigationStore };
|
|
4541
4643
|
//# sourceMappingURL=index.js.map
|
|
4542
4644
|
//# sourceMappingURL=index.js.map
|