@discourser/design-system 0.15.0 → 0.15.1
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/{chunk-QC44JPCA.cjs → chunk-ABC7N32K.cjs} +316 -10
- package/dist/chunk-ABC7N32K.cjs.map +1 -0
- package/dist/{chunk-F7LHARS4.js → chunk-GD6Q2FUE.js} +446 -6
- package/dist/chunk-GD6Q2FUE.js.map +1 -0
- package/dist/{chunk-M7J7WKJY.js → chunk-SBKRSXSZ.js} +317 -11
- package/dist/chunk-SBKRSXSZ.js.map +1 -0
- package/dist/{chunk-QP4EJI3G.cjs → chunk-UNWXE6UB.cjs} +450 -2
- package/dist/chunk-UNWXE6UB.cjs.map +1 -0
- package/dist/components/Breadcrumb.d.ts +9 -0
- package/dist/components/Breadcrumb.d.ts.map +1 -0
- package/dist/components/Checkbox.d.ts +6 -6
- package/dist/components/Icons/ClockIcon.d.ts +6 -0
- package/dist/components/Icons/ClockIcon.d.ts.map +1 -0
- package/dist/components/Icons/GripDotsVerticalIcon.d.ts +6 -0
- package/dist/components/Icons/GripDotsVerticalIcon.d.ts.map +1 -0
- package/dist/components/Icons/index.d.ts +3 -0
- package/dist/components/Icons/index.d.ts.map +1 -0
- package/dist/components/ScenarioQueue/AddScenarioDialog.d.ts +16 -0
- package/dist/components/ScenarioQueue/AddScenarioDialog.d.ts.map +1 -0
- package/dist/components/ScenarioQueue/ScenarioCard.d.ts +10 -0
- package/dist/components/ScenarioQueue/ScenarioCard.d.ts.map +1 -0
- package/dist/components/ScenarioQueue/ScenarioCardDraggable.d.ts +15 -0
- package/dist/components/ScenarioQueue/ScenarioCardDraggable.d.ts.map +1 -0
- package/dist/components/ScenarioQueue/ScenarioQueue.d.ts +3 -0
- package/dist/components/ScenarioQueue/ScenarioQueue.d.ts.map +1 -0
- package/dist/components/ScenarioQueue/index.d.ts +6 -0
- package/dist/components/ScenarioQueue/index.d.ts.map +1 -0
- package/dist/components/ScenarioQueue/types.d.ts +56 -0
- package/dist/components/ScenarioQueue/types.d.ts.map +1 -0
- package/dist/components/index.cjs +65 -33
- package/dist/components/index.d.ts +4 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/index.cjs +69 -37
- package/dist/index.js +2 -2
- package/dist/preset/index.cjs +2 -2
- package/dist/preset/index.d.ts.map +1 -1
- package/dist/preset/index.js +1 -1
- package/dist/preset/recipes/avatar.d.ts.map +1 -1
- package/dist/preset/recipes/breadcrumb.d.ts +2 -0
- package/dist/preset/recipes/breadcrumb.d.ts.map +1 -0
- package/dist/preset/recipes/checkbox.d.ts.map +1 -1
- package/dist/preset/recipes/field.d.ts.map +1 -1
- package/dist/preset/recipes/index.d.ts +3 -0
- package/dist/preset/recipes/index.d.ts.map +1 -1
- package/dist/preset/recipes/progress.d.ts.map +1 -1
- package/dist/preset/recipes/radio-group.d.ts.map +1 -1
- package/dist/preset/recipes/scenario-card.d.ts +2 -0
- package/dist/preset/recipes/scenario-card.d.ts.map +1 -0
- package/dist/preset/recipes/scenario-queue.d.ts +2 -0
- package/dist/preset/recipes/scenario-queue.d.ts.map +1 -0
- package/dist/preset/recipes/steps.d.ts.map +1 -1
- package/dist/preset/recipes/toast.d.ts.map +1 -1
- package/dist/preset/recipes/tooltip.d.ts.map +1 -1
- package/dist/preset/semantic-tokens.d.ts +12 -0
- package/dist/preset/semantic-tokens.d.ts.map +1 -1
- package/package.json +10 -1
- package/src/components/Breadcrumb.tsx +34 -0
- package/src/components/Icons/ClockIcon.tsx +40 -0
- package/src/components/Icons/GripDotsVerticalIcon.tsx +26 -0
- package/src/components/Icons/index.ts +2 -0
- package/src/components/ScenarioQueue/AddScenarioDialog.tsx +137 -0
- package/src/components/ScenarioQueue/ScenarioCard.tsx +120 -0
- package/src/components/ScenarioQueue/ScenarioCardDraggable.tsx +41 -0
- package/src/components/ScenarioQueue/ScenarioQueue.test.tsx +398 -0
- package/src/components/ScenarioQueue/ScenarioQueue.tsx +162 -0
- package/src/components/ScenarioQueue/index.ts +11 -0
- package/src/components/ScenarioQueue/types.ts +86 -0
- package/src/components/index.ts +19 -0
- package/src/preset/index.ts +9 -0
- package/src/preset/recipes/avatar.ts +1 -2
- package/src/preset/recipes/breadcrumb.ts +77 -0
- package/src/preset/recipes/checkbox.ts +1 -2
- package/src/preset/recipes/field.ts +1 -2
- package/src/preset/recipes/index.ts +7 -0
- package/src/preset/recipes/progress.ts +1 -2
- package/src/preset/recipes/radio-group.ts +1 -2
- package/src/preset/recipes/scenario-card.ts +151 -0
- package/src/preset/recipes/scenario-queue.ts +99 -0
- package/src/preset/recipes/steps.ts +1 -2
- package/src/preset/recipes/toast.ts +1 -2
- package/src/preset/recipes/tooltip.ts +1 -2
- package/src/preset/semantic-tokens.ts +4 -0
- package/src/test/setup.ts +12 -0
- package/dist/chunk-F7LHARS4.js.map +0 -1
- package/dist/chunk-M7J7WKJY.js.map +0 -1
- package/dist/chunk-QC44JPCA.cjs.map +0 -1
- package/dist/chunk-QP4EJI3G.cjs.map +0 -1
|
@@ -25,6 +25,8 @@ var progress = require('@ark-ui/react/progress');
|
|
|
25
25
|
var popover = require('@ark-ui/react/popover');
|
|
26
26
|
var tooltip = require('@ark-ui/react/tooltip');
|
|
27
27
|
var steps = require('@ark-ui/react/steps');
|
|
28
|
+
var react$2 = require('@dnd-kit/react');
|
|
29
|
+
var sortable = require('@dnd-kit/react/sortable');
|
|
28
30
|
|
|
29
31
|
// src/components/Group.tsx
|
|
30
32
|
var Group_exports = {};
|
|
@@ -782,6 +784,102 @@ var Tooltip = react$1.forwardRef(function Tooltip2(props, ref) {
|
|
|
782
784
|
] }) }) })
|
|
783
785
|
] });
|
|
784
786
|
});
|
|
787
|
+
var StyledSvg = jsx.styled(factory.ark.svg);
|
|
788
|
+
var GripDotsVerticalIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
789
|
+
StyledSvg,
|
|
790
|
+
{
|
|
791
|
+
viewBox: "0 0 24 24",
|
|
792
|
+
fill: "none",
|
|
793
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
794
|
+
width: "1em",
|
|
795
|
+
height: "1em",
|
|
796
|
+
...props,
|
|
797
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
798
|
+
"path",
|
|
799
|
+
{
|
|
800
|
+
d: "M9 6H9.01M15 6H15.01M15 12H15.01M9 12H9.01M9 18H9.01M15 18H15.01M10 6C10 6.55228 9.55228 7 9 7C8.44772 7 8 6.55228 8 6C8 5.44772 8.44772 5 9 5C9.55228 5 10 5.44772 10 6ZM16 6C16 6.55228 15.5523 7 15 7C14.4477 7 14 6.55228 14 6C14 5.44772 14.4477 5 15 5C15.5523 5 16 5.44772 16 6ZM10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11C9.55228 11 10 11.4477 10 12ZM16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11C15.5523 11 16 11.4477 16 12ZM10 18C10 18.5523 9.55228 19 9 19C8.44772 19 8 18.5523 8 18C8 17.4477 8.44772 17 9 17C9.55228 17 10 17.4477 10 18ZM16 18C16 18.5523 15.5523 19 15 19C14.4477 19 14 18.5523 14 18C14 17.4477 14.4477 17 15 17C15.5523 17 16 17.4477 16 18Z",
|
|
801
|
+
stroke: "currentColor",
|
|
802
|
+
strokeWidth: "2",
|
|
803
|
+
strokeLinecap: "round",
|
|
804
|
+
strokeLinejoin: "round"
|
|
805
|
+
}
|
|
806
|
+
)
|
|
807
|
+
}
|
|
808
|
+
);
|
|
809
|
+
var StyledSvg2 = jsx.styled(factory.ark.svg);
|
|
810
|
+
var ClockIcon = (props) => /* @__PURE__ */ jsxRuntime.jsxs(
|
|
811
|
+
StyledSvg2,
|
|
812
|
+
{
|
|
813
|
+
viewBox: "0 0 24 24",
|
|
814
|
+
fill: "none",
|
|
815
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
816
|
+
width: "1em",
|
|
817
|
+
height: "1em",
|
|
818
|
+
...props,
|
|
819
|
+
children: [
|
|
820
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
821
|
+
"path",
|
|
822
|
+
{
|
|
823
|
+
d: "M12 21C16.9706 21 21 16.9706 21 12C21 7.02944 16.9706 3 12 3C7.02944 3 3 7.02944 3 12C3 16.9706 7.02944 21 12 21Z",
|
|
824
|
+
stroke: "currentColor",
|
|
825
|
+
strokeWidth: "1.5",
|
|
826
|
+
strokeLinecap: "round",
|
|
827
|
+
strokeLinejoin: "round"
|
|
828
|
+
}
|
|
829
|
+
),
|
|
830
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
831
|
+
"path",
|
|
832
|
+
{
|
|
833
|
+
d: "M12 6V12",
|
|
834
|
+
stroke: "currentColor",
|
|
835
|
+
strokeWidth: "1.5",
|
|
836
|
+
strokeLinecap: "round",
|
|
837
|
+
strokeLinejoin: "round"
|
|
838
|
+
}
|
|
839
|
+
),
|
|
840
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
841
|
+
"path",
|
|
842
|
+
{
|
|
843
|
+
d: "M16.24 16.24L12 12",
|
|
844
|
+
stroke: "currentColor",
|
|
845
|
+
strokeWidth: "1.5",
|
|
846
|
+
strokeLinecap: "round",
|
|
847
|
+
strokeLinejoin: "round"
|
|
848
|
+
}
|
|
849
|
+
)
|
|
850
|
+
]
|
|
851
|
+
}
|
|
852
|
+
);
|
|
853
|
+
|
|
854
|
+
// src/components/Breadcrumb.tsx
|
|
855
|
+
var Breadcrumb_exports = {};
|
|
856
|
+
chunkEARF7VDF_cjs.__export(Breadcrumb_exports, {
|
|
857
|
+
Ellipsis: () => Ellipsis,
|
|
858
|
+
Item: () => Item4,
|
|
859
|
+
Link: () => Link,
|
|
860
|
+
List: () => List3,
|
|
861
|
+
Root: () => Root17,
|
|
862
|
+
Separator: () => Separator
|
|
863
|
+
});
|
|
864
|
+
var ChevronRightIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "m9 18 6-6-6-6" }) });
|
|
865
|
+
var { withProvider: withProvider12, withContext: withContext16 } = jsx.createStyleContext(recipes.breadcrumb);
|
|
866
|
+
var Root17 = withProvider12(factory.ark.nav, "root", { defaultProps: { "aria-label": "breadcrumb" } });
|
|
867
|
+
var List3 = withContext16(factory.ark.ol, "list");
|
|
868
|
+
var Item4 = withContext16(factory.ark.li, "item");
|
|
869
|
+
var Link = withContext16(factory.ark.a, "link");
|
|
870
|
+
var Ellipsis = withContext16(factory.ark.li, "ellipsis", {
|
|
871
|
+
defaultProps: {
|
|
872
|
+
role: "presentation",
|
|
873
|
+
"aria-hidden": true,
|
|
874
|
+
children: "..."
|
|
875
|
+
}
|
|
876
|
+
});
|
|
877
|
+
var Separator = withContext16(factory.ark.li, "separator", {
|
|
878
|
+
defaultProps: {
|
|
879
|
+
"aria-hidden": true,
|
|
880
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(ChevronRightIcon, {})
|
|
881
|
+
}
|
|
882
|
+
});
|
|
785
883
|
var CustomSeparator = ({ index, className }) => {
|
|
786
884
|
const stepsContext = steps.useStepsContext();
|
|
787
885
|
const currentStepIndex = stepsContext.value;
|
|
@@ -865,18 +963,364 @@ var Stepper = Object.assign(StepperRoot, {
|
|
|
865
963
|
PrevTrigger: steps.Steps.PrevTrigger,
|
|
866
964
|
NextTrigger: steps.Steps.NextTrigger
|
|
867
965
|
});
|
|
966
|
+
var dialogContentClass = css.css({
|
|
967
|
+
width: "full",
|
|
968
|
+
maxWidth: "560px",
|
|
969
|
+
maxHeight: "80vh",
|
|
970
|
+
display: "flex",
|
|
971
|
+
flexDirection: "column"
|
|
972
|
+
});
|
|
973
|
+
var dialogBodyClass = css.css({
|
|
974
|
+
flex: "1",
|
|
975
|
+
overflowY: "auto",
|
|
976
|
+
py: "0",
|
|
977
|
+
px: "6"
|
|
978
|
+
});
|
|
979
|
+
var footerLinkClass = css.css({
|
|
980
|
+
display: "inline-flex",
|
|
981
|
+
alignItems: "center",
|
|
982
|
+
gap: "1",
|
|
983
|
+
fontSize: "sm",
|
|
984
|
+
color: "primary.solid.bg",
|
|
985
|
+
fontWeight: "medium",
|
|
986
|
+
textDecoration: "none",
|
|
987
|
+
cursor: "pointer",
|
|
988
|
+
bg: "transparent",
|
|
989
|
+
border: "none",
|
|
990
|
+
p: "0",
|
|
991
|
+
_hover: { textDecoration: "underline" },
|
|
992
|
+
_focusVisible: { focusVisibleRing: "outside" }
|
|
993
|
+
});
|
|
994
|
+
function AddScenarioDialog({
|
|
995
|
+
open,
|
|
996
|
+
onClose,
|
|
997
|
+
renderContent,
|
|
998
|
+
onBrowseMore,
|
|
999
|
+
onBuildCustom
|
|
1000
|
+
}) {
|
|
1001
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(Root4, { open, onOpenChange: ({ open: isOpen }) => !isOpen && onClose(), children: [
|
|
1002
|
+
/* @__PURE__ */ jsxRuntime.jsx(Backdrop, {}),
|
|
1003
|
+
/* @__PURE__ */ jsxRuntime.jsx(Positioner, { children: /* @__PURE__ */ jsxRuntime.jsxs(Content, { className: dialogContentClass, children: [
|
|
1004
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Header2, { children: [
|
|
1005
|
+
/* @__PURE__ */ jsxRuntime.jsx(Title3, { children: "Add Scenario" }),
|
|
1006
|
+
/* @__PURE__ */ jsxRuntime.jsx(CloseTrigger2, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1007
|
+
"button",
|
|
1008
|
+
{
|
|
1009
|
+
"aria-label": "Close",
|
|
1010
|
+
className: css.css({
|
|
1011
|
+
display: "flex",
|
|
1012
|
+
alignItems: "center",
|
|
1013
|
+
justifyContent: "center",
|
|
1014
|
+
borderRadius: "l1",
|
|
1015
|
+
w: "6",
|
|
1016
|
+
h: "6",
|
|
1017
|
+
color: "fg.muted",
|
|
1018
|
+
bg: "transparent",
|
|
1019
|
+
border: "none",
|
|
1020
|
+
cursor: "pointer",
|
|
1021
|
+
fontSize: "lg",
|
|
1022
|
+
_hover: { bg: "neutral.subtle.bg", color: "fg.default" }
|
|
1023
|
+
}),
|
|
1024
|
+
children: "\u2715"
|
|
1025
|
+
}
|
|
1026
|
+
) })
|
|
1027
|
+
] }),
|
|
1028
|
+
/* @__PURE__ */ jsxRuntime.jsx(Body2, { className: dialogBodyClass, children: renderContent ? renderContent({ onClose }) : (
|
|
1029
|
+
// Storybook placeholder
|
|
1030
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1031
|
+
"div",
|
|
1032
|
+
{
|
|
1033
|
+
className: css.css({
|
|
1034
|
+
display: "flex",
|
|
1035
|
+
alignItems: "center",
|
|
1036
|
+
justifyContent: "center",
|
|
1037
|
+
minH: "48",
|
|
1038
|
+
borderRadius: "l2",
|
|
1039
|
+
bg: "neutral.subtle.bg",
|
|
1040
|
+
color: "fg.muted",
|
|
1041
|
+
fontSize: "sm",
|
|
1042
|
+
borderWidth: "1px",
|
|
1043
|
+
borderStyle: "dashed",
|
|
1044
|
+
borderColor: "border.default"
|
|
1045
|
+
}),
|
|
1046
|
+
children: "Scenario collection renders here"
|
|
1047
|
+
}
|
|
1048
|
+
)
|
|
1049
|
+
) }),
|
|
1050
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Footer2, { children: [
|
|
1051
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1052
|
+
"button",
|
|
1053
|
+
{
|
|
1054
|
+
type: "button",
|
|
1055
|
+
className: footerLinkClass,
|
|
1056
|
+
onClick: () => {
|
|
1057
|
+
onBrowseMore?.();
|
|
1058
|
+
onClose();
|
|
1059
|
+
},
|
|
1060
|
+
children: "Browse More Scenarios \u2192"
|
|
1061
|
+
}
|
|
1062
|
+
),
|
|
1063
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1064
|
+
"button",
|
|
1065
|
+
{
|
|
1066
|
+
type: "button",
|
|
1067
|
+
className: footerLinkClass,
|
|
1068
|
+
onClick: () => {
|
|
1069
|
+
onBuildCustom?.();
|
|
1070
|
+
onClose();
|
|
1071
|
+
},
|
|
1072
|
+
children: "Build Custom Scenario \u2192"
|
|
1073
|
+
}
|
|
1074
|
+
)
|
|
1075
|
+
] })
|
|
1076
|
+
] }) })
|
|
1077
|
+
] });
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
// src/components/ScenarioQueue/types.ts
|
|
1081
|
+
var difficultyColorMap = {
|
|
1082
|
+
beginner: "primary",
|
|
1083
|
+
intermediate: "secondary",
|
|
1084
|
+
advanced: "tertiary"
|
|
1085
|
+
};
|
|
1086
|
+
var difficultyLabel = {
|
|
1087
|
+
beginner: "Beginner",
|
|
1088
|
+
intermediate: "Intermediate",
|
|
1089
|
+
advanced: "Advanced"
|
|
1090
|
+
};
|
|
1091
|
+
var ScenarioCard = react$1.forwardRef(
|
|
1092
|
+
function ScenarioCard2({
|
|
1093
|
+
scenario,
|
|
1094
|
+
position,
|
|
1095
|
+
isActive,
|
|
1096
|
+
showRequeueSwitch = false,
|
|
1097
|
+
onRequeue,
|
|
1098
|
+
isRepeat = false,
|
|
1099
|
+
isDragging = false,
|
|
1100
|
+
rootRef,
|
|
1101
|
+
handleRef,
|
|
1102
|
+
className: _className,
|
|
1103
|
+
...rest
|
|
1104
|
+
}, _ref) {
|
|
1105
|
+
const styles = recipes.scenarioCard({ isActive, isDragging });
|
|
1106
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1107
|
+
Root3,
|
|
1108
|
+
{
|
|
1109
|
+
ref: rootRef,
|
|
1110
|
+
className: styles.root,
|
|
1111
|
+
variant: "elevated",
|
|
1112
|
+
css: {
|
|
1113
|
+
boxShadow: "0px 2px 8px 0px rgba(167, 139, 250, 0.15)",
|
|
1114
|
+
// neutral.surface.bg resolves to white in light mode; Figma uses neutral/99 (#FDFCF5)
|
|
1115
|
+
bg: "neutral.1"
|
|
1116
|
+
},
|
|
1117
|
+
...rest,
|
|
1118
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs(jsx.VStack, { gap: "2.5", pl: "5", pr: "3", py: "2.5", alignItems: "flex-start", children: [
|
|
1119
|
+
!showRequeueSwitch && /* @__PURE__ */ jsxRuntime.jsxs(jsx.HStack, { justify: "space-between", alignItems: "flex-start", w: "full", py: "2", pr: "2.5", children: [
|
|
1120
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1121
|
+
jsx.Box,
|
|
1122
|
+
{
|
|
1123
|
+
ref: handleRef,
|
|
1124
|
+
className: styles.dragHandle,
|
|
1125
|
+
"aria-label": "Drag to reorder",
|
|
1126
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(GripDotsVerticalIcon, { w: "9", h: "10", "aria-hidden": "true" })
|
|
1127
|
+
}
|
|
1128
|
+
),
|
|
1129
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1130
|
+
jsx.Circle,
|
|
1131
|
+
{
|
|
1132
|
+
size: isActive ? "12" : "11",
|
|
1133
|
+
className: styles.positionBadge,
|
|
1134
|
+
"aria-label": `Position ${position}`,
|
|
1135
|
+
children: position
|
|
1136
|
+
}
|
|
1137
|
+
)
|
|
1138
|
+
] }),
|
|
1139
|
+
/* @__PURE__ */ jsxRuntime.jsx(jsx.Box, { px: "1", py: "1.5", w: "full", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: styles.title, children: scenario.title }) }),
|
|
1140
|
+
/* @__PURE__ */ jsxRuntime.jsxs(jsx.VStack, { gap: "3", alignItems: "flex-start", py: "2.5", children: [
|
|
1141
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1142
|
+
jsx.Box,
|
|
1143
|
+
{
|
|
1144
|
+
className: styles.difficultyBadge,
|
|
1145
|
+
"data-difficulty": scenario.difficulty,
|
|
1146
|
+
children: difficultyLabel[scenario.difficulty]
|
|
1147
|
+
}
|
|
1148
|
+
),
|
|
1149
|
+
/* @__PURE__ */ jsxRuntime.jsxs(jsx.Box, { className: styles.durationBadge, "data-difficulty": scenario.difficulty, children: [
|
|
1150
|
+
/* @__PURE__ */ jsxRuntime.jsx(ClockIcon, { w: "3", h: "3", "aria-hidden": "true" }),
|
|
1151
|
+
scenario.duration
|
|
1152
|
+
] }),
|
|
1153
|
+
isRepeat && /* @__PURE__ */ jsxRuntime.jsx(jsx.Box, { className: styles.durationBadge, "data-difficulty": scenario.difficulty, children: "Repeat" })
|
|
1154
|
+
] }),
|
|
1155
|
+
showRequeueSwitch && /* @__PURE__ */ jsxRuntime.jsxs(jsx.HStack, { className: styles.switchRow, justify: "space-between", children: [
|
|
1156
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: styles.switchLabel, children: "Re-queue" }),
|
|
1157
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1158
|
+
Root5,
|
|
1159
|
+
{
|
|
1160
|
+
size: "sm",
|
|
1161
|
+
defaultChecked: true,
|
|
1162
|
+
onCheckedChange: (details) => {
|
|
1163
|
+
if (!details.checked) onRequeue?.(scenario.id);
|
|
1164
|
+
},
|
|
1165
|
+
"aria-label": `Re-queue ${scenario.title}`,
|
|
1166
|
+
children: [
|
|
1167
|
+
/* @__PURE__ */ jsxRuntime.jsx(HiddenInput, {}),
|
|
1168
|
+
/* @__PURE__ */ jsxRuntime.jsx(Control, { css: { _checked: { bg: "secondary.6" } } })
|
|
1169
|
+
]
|
|
1170
|
+
}
|
|
1171
|
+
)
|
|
1172
|
+
] })
|
|
1173
|
+
] })
|
|
1174
|
+
}
|
|
1175
|
+
);
|
|
1176
|
+
}
|
|
1177
|
+
);
|
|
1178
|
+
function ScenarioCardDraggable({
|
|
1179
|
+
scenario,
|
|
1180
|
+
index,
|
|
1181
|
+
position,
|
|
1182
|
+
isActive,
|
|
1183
|
+
isRepeat
|
|
1184
|
+
}) {
|
|
1185
|
+
const { ref, handleRef, isDragging } = sortable.useSortable({
|
|
1186
|
+
id: scenario.id,
|
|
1187
|
+
index
|
|
1188
|
+
});
|
|
1189
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1190
|
+
ScenarioCard,
|
|
1191
|
+
{
|
|
1192
|
+
scenario,
|
|
1193
|
+
position,
|
|
1194
|
+
isActive,
|
|
1195
|
+
isDragging,
|
|
1196
|
+
isRepeat,
|
|
1197
|
+
rootRef: ref,
|
|
1198
|
+
handleRef
|
|
1199
|
+
}
|
|
1200
|
+
);
|
|
1201
|
+
}
|
|
1202
|
+
function arrayMove(array, from, to) {
|
|
1203
|
+
const next = [...array];
|
|
1204
|
+
const [item] = next.splice(from, 1);
|
|
1205
|
+
next.splice(to, 0, item);
|
|
1206
|
+
return next;
|
|
1207
|
+
}
|
|
1208
|
+
function ScenarioQueue({
|
|
1209
|
+
scenarios,
|
|
1210
|
+
onReorder,
|
|
1211
|
+
onRequeue,
|
|
1212
|
+
onRemove: _onRemove,
|
|
1213
|
+
renderAddScenarioContent,
|
|
1214
|
+
onBrowseMore,
|
|
1215
|
+
onBuildCustom
|
|
1216
|
+
}) {
|
|
1217
|
+
const queuedRaw = scenarios.filter((s) => s.status === "queued");
|
|
1218
|
+
const completed = scenarios.filter((s) => s.status === "completed");
|
|
1219
|
+
const [localQueue, setLocalQueue] = react$1.useState(queuedRaw);
|
|
1220
|
+
react$1.useEffect(() => {
|
|
1221
|
+
setLocalQueue(queuedRaw);
|
|
1222
|
+
}, [scenarios]);
|
|
1223
|
+
const [dialogOpen, setDialogOpen] = react$1.useState(false);
|
|
1224
|
+
const totalCount = localQueue.length + completed.length;
|
|
1225
|
+
const handleDragEnd = (event) => {
|
|
1226
|
+
if (event.canceled) return;
|
|
1227
|
+
const source = event.operation?.source;
|
|
1228
|
+
if (!source) return;
|
|
1229
|
+
const oldIndex = source.initialIndex;
|
|
1230
|
+
const newIndex = source.index;
|
|
1231
|
+
if (oldIndex === newIndex) return;
|
|
1232
|
+
const next = arrayMove(localQueue, oldIndex, newIndex);
|
|
1233
|
+
setLocalQueue(next);
|
|
1234
|
+
onReorder?.(next.map((s) => s.id));
|
|
1235
|
+
};
|
|
1236
|
+
const styles = recipes.scenarioQueue();
|
|
1237
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsx.Box, { className: styles.root, children: [
|
|
1238
|
+
/* @__PURE__ */ jsxRuntime.jsxs(jsx.Box, { className: styles.header, children: [
|
|
1239
|
+
/* @__PURE__ */ jsxRuntime.jsx(jsx.Box, { className: styles.title, children: "Scenario Queue" }),
|
|
1240
|
+
/* @__PURE__ */ jsxRuntime.jsxs(jsx.Box, { className: styles.count, children: [
|
|
1241
|
+
totalCount,
|
|
1242
|
+
" scenario",
|
|
1243
|
+
totalCount !== 1 ? "s" : ""
|
|
1244
|
+
] })
|
|
1245
|
+
] }),
|
|
1246
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1247
|
+
Root8,
|
|
1248
|
+
{
|
|
1249
|
+
defaultValue: "queue",
|
|
1250
|
+
variant: "line",
|
|
1251
|
+
size: "md",
|
|
1252
|
+
colorPalette: "primary",
|
|
1253
|
+
className: styles.tabsInner,
|
|
1254
|
+
children: [
|
|
1255
|
+
/* @__PURE__ */ jsxRuntime.jsx(jsx.Box, { className: styles.tabList, children: /* @__PURE__ */ jsxRuntime.jsxs(List, { className: css.css({ borderBottomWidth: "0" }), children: [
|
|
1256
|
+
/* @__PURE__ */ jsxRuntime.jsx(Trigger3, { value: "queue", children: "In Queue" }),
|
|
1257
|
+
/* @__PURE__ */ jsxRuntime.jsx(Trigger3, { value: "completed", children: "Completed" }),
|
|
1258
|
+
/* @__PURE__ */ jsxRuntime.jsx(Indicator2, {})
|
|
1259
|
+
] }) }),
|
|
1260
|
+
/* @__PURE__ */ jsxRuntime.jsx(Content3, { value: "queue", className: styles.tabsContent, children: localQueue.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsx.Center, { className: styles.emptyState, children: "No scenarios in queue" }) : /* @__PURE__ */ jsxRuntime.jsx(react$2.DragDropProvider, { onDragEnd: handleDragEnd, children: /* @__PURE__ */ jsxRuntime.jsx(jsx.Box, { className: styles.scrollArea, children: localQueue.map((scenario, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1261
|
+
ScenarioCardDraggable,
|
|
1262
|
+
{
|
|
1263
|
+
scenario,
|
|
1264
|
+
index,
|
|
1265
|
+
position: index + 1,
|
|
1266
|
+
isActive: index === 0,
|
|
1267
|
+
isRepeat: scenario.wasRequeued ?? false
|
|
1268
|
+
},
|
|
1269
|
+
scenario.id
|
|
1270
|
+
)) }) }) }),
|
|
1271
|
+
/* @__PURE__ */ jsxRuntime.jsx(Content3, { value: "completed", className: styles.tabsContent, children: completed.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(jsx.Center, { className: styles.emptyState, children: "No completed scenarios" }) : /* @__PURE__ */ jsxRuntime.jsx(jsx.Box, { className: styles.scrollArea, children: completed.map((scenario, index) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1272
|
+
ScenarioCard,
|
|
1273
|
+
{
|
|
1274
|
+
scenario,
|
|
1275
|
+
position: index + 1,
|
|
1276
|
+
isActive: false,
|
|
1277
|
+
showRequeueSwitch: true,
|
|
1278
|
+
onRequeue
|
|
1279
|
+
},
|
|
1280
|
+
scenario.id
|
|
1281
|
+
)) }) })
|
|
1282
|
+
]
|
|
1283
|
+
}
|
|
1284
|
+
),
|
|
1285
|
+
/* @__PURE__ */ jsxRuntime.jsx(jsx.Box, { className: styles.addButtonArea, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1286
|
+
Button,
|
|
1287
|
+
{
|
|
1288
|
+
variant: "outline",
|
|
1289
|
+
colorPalette: "primary",
|
|
1290
|
+
size: "md",
|
|
1291
|
+
className: styles.addButton,
|
|
1292
|
+
onClick: () => setDialogOpen(true),
|
|
1293
|
+
children: "+ Add Scenario"
|
|
1294
|
+
}
|
|
1295
|
+
) }),
|
|
1296
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1297
|
+
AddScenarioDialog,
|
|
1298
|
+
{
|
|
1299
|
+
open: dialogOpen,
|
|
1300
|
+
onClose: () => setDialogOpen(false),
|
|
1301
|
+
renderContent: renderAddScenarioContent,
|
|
1302
|
+
onBrowseMore,
|
|
1303
|
+
onBuildCustom
|
|
1304
|
+
}
|
|
1305
|
+
)
|
|
1306
|
+
] });
|
|
1307
|
+
}
|
|
868
1308
|
|
|
869
1309
|
exports.AbsoluteCenter_exports = AbsoluteCenter_exports;
|
|
870
1310
|
exports.Accordion_exports = Accordion_exports;
|
|
1311
|
+
exports.AddScenarioDialog = AddScenarioDialog;
|
|
871
1312
|
exports.Avatar_exports = Avatar_exports;
|
|
872
1313
|
exports.Badge = Badge;
|
|
1314
|
+
exports.Breadcrumb_exports = Breadcrumb_exports;
|
|
873
1315
|
exports.Button = Button;
|
|
874
1316
|
exports.ButtonGroup = ButtonGroup;
|
|
875
1317
|
exports.Card_exports = Card_exports;
|
|
876
1318
|
exports.Checkbox_exports = Checkbox_exports;
|
|
1319
|
+
exports.ClockIcon = ClockIcon;
|
|
877
1320
|
exports.CloseButton_exports = CloseButton_exports;
|
|
878
1321
|
exports.Dialog_exports = Dialog_exports;
|
|
879
1322
|
exports.Drawer_exports = Drawer_exports;
|
|
1323
|
+
exports.GripDotsVerticalIcon = GripDotsVerticalIcon;
|
|
880
1324
|
exports.Group_exports = Group_exports;
|
|
881
1325
|
exports.Heading = Heading;
|
|
882
1326
|
exports.IconButton = IconButton;
|
|
@@ -887,6 +1331,8 @@ exports.InputGroup = InputGroup2;
|
|
|
887
1331
|
exports.Popover_exports = Popover_exports;
|
|
888
1332
|
exports.Progress_exports = Progress_exports;
|
|
889
1333
|
exports.RadioGroup_exports = RadioGroup_exports;
|
|
1334
|
+
exports.ScenarioCard = ScenarioCard;
|
|
1335
|
+
exports.ScenarioQueue = ScenarioQueue;
|
|
890
1336
|
exports.Select_exports = Select_exports;
|
|
891
1337
|
exports.Skeleton_exports = Skeleton_exports;
|
|
892
1338
|
exports.Slider_exports = Slider_exports;
|
|
@@ -897,6 +1343,8 @@ exports.Tabs_exports = Tabs_exports;
|
|
|
897
1343
|
exports.Textarea = Textarea;
|
|
898
1344
|
exports.Toaster = Toaster;
|
|
899
1345
|
exports.Tooltip_exports = Tooltip_exports;
|
|
1346
|
+
exports.difficultyColorMap = difficultyColorMap;
|
|
1347
|
+
exports.difficultyLabel = difficultyLabel;
|
|
900
1348
|
exports.toaster = toaster;
|
|
901
|
-
//# sourceMappingURL=chunk-
|
|
902
|
-
//# sourceMappingURL=chunk-
|
|
1349
|
+
//# sourceMappingURL=chunk-UNWXE6UB.cjs.map
|
|
1350
|
+
//# sourceMappingURL=chunk-UNWXE6UB.cjs.map
|