@kosdev-code/kos-ddk-story-containers 0.1.0-dev.40 → 0.1.0-dev.50
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/components/storybook/dashboard-story-container/dashboard-story-container.d.ts +25 -0
- package/components/storybook/dashboard-story-container/dashboard-story-container.d.ts.map +1 -0
- package/components/storybook/dashboard-story-container/index.d.ts +3 -0
- package/components/storybook/dashboard-story-container/index.d.ts.map +1 -0
- package/components/storybook/dashboard-story-container/use-dashboard-card-model.d.ts +11 -0
- package/components/storybook/dashboard-story-container/use-dashboard-card-model.d.ts.map +1 -0
- package/components/storybook/holder-story-container/holder-story-container.d.ts +25 -0
- package/components/storybook/holder-story-container/holder-story-container.d.ts.map +1 -0
- package/components/storybook/holder-story-container/index.d.ts +2 -0
- package/components/storybook/holder-story-container/index.d.ts.map +1 -0
- package/components/storybook/index.d.ts +3 -0
- package/components/storybook/index.d.ts.map +1 -1
- package/components/storybook/trouble-action-story-container/index.d.ts +2 -0
- package/components/storybook/trouble-action-story-container/index.d.ts.map +1 -0
- package/components/storybook/trouble-action-story-container/trouble-action-story-container.d.ts +16 -0
- package/components/storybook/trouble-action-story-container/trouble-action-story-container.d.ts.map +1 -0
- package/index.cjs +141 -0
- package/index.cjs.map +1 -1
- package/index.js +143 -2
- package/index.js.map +1 -1
- package/package.json +7 -3
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AssemblyModel } from '@kosdev-code/kos-dispense-sdk';
|
|
2
|
+
import { IKosDataModel } from '@kosdev-code/kos-ui-sdk';
|
|
3
|
+
import { ReactNode } from 'react';
|
|
4
|
+
export interface DashboardCardStoryProps {
|
|
5
|
+
dashboardKey: string;
|
|
6
|
+
assembly?: AssemblyModel;
|
|
7
|
+
cardModel?: IKosDataModel;
|
|
8
|
+
onComplete: () => void;
|
|
9
|
+
}
|
|
10
|
+
interface DashboardStoryContainerProps {
|
|
11
|
+
/** The contribution's dashboardKey: an assembly (or FreestyleAssembly) property. */
|
|
12
|
+
dashboardKey: string;
|
|
13
|
+
title: string;
|
|
14
|
+
children: (props: DashboardCardStoryProps) => ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/** A dashboard summary story, framed as the host frames the card body. */
|
|
17
|
+
export declare const DashboardSummaryStoryContainer: (({ dashboardKey, title, children }: DashboardStoryContainerProps) => import("@emotion/react/jsx-runtime").JSX.Element) & {
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
20
|
+
/** A dashboard detail story, in the modal the host opens from the card. */
|
|
21
|
+
export declare const DashboardDetailStoryContainer: (({ dashboardKey, title, children }: DashboardStoryContainerProps) => import("@emotion/react/jsx-runtime").JSX.Element) & {
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=dashboard-story-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard-story-container.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ddk-story-containers/src/components/storybook/dashboard-story-container/dashboard-story-container.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,UAAU,4BAA4B;IACpC,oFAAoF;IACpF,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,SAAS,CAAC;CACzD;AASD,0EAA0E;AAC1E,eAAO,MAAM,8BAA8B,uCACL,4BAA4B;;CAgBjE,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,6BAA6B,uCACJ,4BAA4B;;CAuBjE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ddk-story-containers/src/components/storybook/dashboard-story-container/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IKosDataModel } from '@kosdev-code/kos-ui-sdk';
|
|
2
|
+
/**
|
|
3
|
+
* The assembly and the first active model a dashboard card renders for
|
|
4
|
+
* `dashboardKey`, found the way the host dashboard finds them: the assembly
|
|
5
|
+
* property, then the FreestyleAssembly companion's; a container yields its items.
|
|
6
|
+
*/
|
|
7
|
+
export declare const useDashboardCardModel: (dashboardKey: string) => {
|
|
8
|
+
assembly: import('@kosdev-code/kos-dispense-sdk').AssemblyModel<any, any> | undefined;
|
|
9
|
+
cardModel: IKosDataModel | undefined;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=use-dashboard-card-model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-dashboard-card-model.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ddk-story-containers/src/components/storybook/dashboard-story-container/use-dashboard-card-model.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,aAAa,EACnB,MAAM,yBAAyB,CAAC;AAEjC;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,cAAc,MAAM;;;CAsBzD,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { HolderModel } from '@kosdev-code/kos-dispense-sdk';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface HolderStoryProps {
|
|
4
|
+
holder: HolderModel;
|
|
5
|
+
}
|
|
6
|
+
interface HolderStoryContainerProps {
|
|
7
|
+
/** The contribution's dashboardKey. */
|
|
8
|
+
dashboardKey: string;
|
|
9
|
+
title: string;
|
|
10
|
+
children: (props: HolderStoryProps) => ReactNode;
|
|
11
|
+
}
|
|
12
|
+
/** A pump detail story, in the holder modal the host opens. */
|
|
13
|
+
export declare const PumpDetailStoryContainer: (({ dashboardKey, title, children }: HolderStoryContainerProps) => import("@emotion/react/jsx-runtime").JSX.Element) & {
|
|
14
|
+
displayName: string;
|
|
15
|
+
};
|
|
16
|
+
/** A macro summary story: the body the host shows on a macro holder card. */
|
|
17
|
+
export declare const MacroSummaryStoryContainer: (({ dashboardKey, children }: HolderStoryContainerProps) => import("@emotion/react/jsx-runtime").JSX.Element) & {
|
|
18
|
+
displayName: string;
|
|
19
|
+
};
|
|
20
|
+
/** A pump summary story: the body the host shows on the holder's dashboard card. */
|
|
21
|
+
export declare const PumpSummaryStoryContainer: (({ dashboardKey, children }: HolderStoryContainerProps) => import("@emotion/react/jsx-runtime").JSX.Element) & {
|
|
22
|
+
displayName: string;
|
|
23
|
+
};
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=holder-story-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"holder-story-container.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ddk-story-containers/src/components/storybook/holder-story-container/holder-story-container.tsx"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,+BAA+B,CAAC;AAGvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,UAAU,yBAAyB;IACjC,uCAAuC;IACvC,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,SAAS,CAAC;CAClD;AAuBD,+DAA+D;AAC/D,eAAO,MAAM,wBAAwB,uCACC,yBAAyB;;CAkB9D,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,0BAA0B,gCACR,yBAAyB;;CAKvD,CAAC;AAEF,oFAAoF;AACpF,eAAO,MAAM,yBAAyB,gCACP,yBAAyB;;CAWvD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ddk-story-containers/src/components/storybook/holder-story-container/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
export * from './control-pour-story-container';
|
|
2
2
|
export * from './cui-story-container';
|
|
3
|
+
export * from './dashboard-story-container';
|
|
4
|
+
export * from './holder-story-container';
|
|
3
5
|
export * from './nav-story-container';
|
|
4
6
|
export * from './setting-story-container';
|
|
5
7
|
export * from './setup-step-story-container';
|
|
8
|
+
export * from './trouble-action-story-container';
|
|
6
9
|
export * from './utility-story-container';
|
|
7
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ddk-story-containers/src/components/storybook/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,2BAA2B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/kos-ddk-story-containers/src/components/storybook/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uBAAuB,CAAC;AACtC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kCAAkC,CAAC;AACjD,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ddk-story-containers/src/components/storybook/trouble-action-story-container/index.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC"}
|
package/components/storybook/trouble-action-story-container/trouble-action-story-container.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { TroubleModel } from '@kosdev-code/kos-ui-sdk';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface TroubleActionStoryProps {
|
|
4
|
+
trouble: TroubleModel;
|
|
5
|
+
}
|
|
6
|
+
interface TroubleActionStoryContainerProps {
|
|
7
|
+
/** The contribution's troubleType: the exact type the device raises. */
|
|
8
|
+
troubleType: string;
|
|
9
|
+
children: (props: TroubleActionStoryProps) => ReactNode;
|
|
10
|
+
}
|
|
11
|
+
/** A trouble action story, given the device's active trouble of `troubleType`. */
|
|
12
|
+
export declare const TroubleActionStoryContainer: (({ troubleType, children }: TroubleActionStoryContainerProps) => import("@emotion/react/jsx-runtime").JSX.Element) & {
|
|
13
|
+
displayName: string;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=trouble-action-story-container.d.ts.map
|
package/components/storybook/trouble-action-story-container/trouble-action-story-container.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trouble-action-story-container.d.ts","sourceRoot":"","sources":["../../../../../../packages/kos-ddk-story-containers/src/components/storybook/trouble-action-story-container/trouble-action-story-container.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,YAAY,CAAC;CACvB;AAED,UAAU,gCAAgC;IACxC,wEAAwE;IACxE,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,SAAS,CAAC;CACzD;AAED,kFAAkF;AAClF,eAAO,MAAM,2BAA2B,+BACV,gCAAgC;;CAa7D,CAAC"}
|
package/index.cjs
CHANGED
|
@@ -2,6 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("@emotion/react/jsx-runtime");
|
|
4
4
|
const kosDdkComponents = require("@kosdev-code/kos-ddk-components");
|
|
5
|
+
const kosUiSdk = require("@kosdev-code/kos-ui-sdk");
|
|
6
|
+
const kosDispenseSdk = require("@kosdev-code/kos-dispense-sdk");
|
|
7
|
+
const kosFreestyleSdk = require("@kosdev-code/kos-freestyle-sdk");
|
|
8
|
+
const kosDdkModels = require("@kosdev-code/kos-ddk-models");
|
|
5
9
|
const ControlPourStoryContainer = ({
|
|
6
10
|
children
|
|
7
11
|
}) => children;
|
|
@@ -29,6 +33,122 @@ const CUIStoryContainer = ({ children }) => {
|
|
|
29
33
|
}
|
|
30
34
|
);
|
|
31
35
|
};
|
|
36
|
+
const useDashboardCardModel = (dashboardKey) => {
|
|
37
|
+
const { model: assembly } = kosDispenseSdk.useAssemblyContext();
|
|
38
|
+
let modelRef = assembly?.[dashboardKey];
|
|
39
|
+
if (!modelRef && assembly) {
|
|
40
|
+
const freestyle = kosUiSdk.getKosCompanionModel(
|
|
41
|
+
assembly,
|
|
42
|
+
kosFreestyleSdk.FreestyleAssembly.type
|
|
43
|
+
);
|
|
44
|
+
modelRef = freestyle?.[dashboardKey];
|
|
45
|
+
}
|
|
46
|
+
const models = modelRef ? Array.isArray(modelRef.data) ? modelRef.data : [modelRef] : [];
|
|
47
|
+
const cardModel = models.find(
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
|
+
(model) => typeof model?.active === "boolean" ? model.active : true
|
|
50
|
+
);
|
|
51
|
+
return { assembly, cardModel };
|
|
52
|
+
};
|
|
53
|
+
const noModel = (dashboardKey) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
54
|
+
'No active "',
|
|
55
|
+
dashboardKey,
|
|
56
|
+
'" model on the assembly. Start the simulator with a dispenser that has one.'
|
|
57
|
+
] });
|
|
58
|
+
const DashboardSummaryStoryContainer = kosUiSdk.kosComponent(
|
|
59
|
+
({ dashboardKey, title, children }) => {
|
|
60
|
+
const { assembly, cardModel } = useDashboardCardModel(dashboardKey);
|
|
61
|
+
if (!cardModel) return noModel(dashboardKey);
|
|
62
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
63
|
+
kosDdkComponents.AgitatorDashboardCard,
|
|
64
|
+
{
|
|
65
|
+
cardId: dashboardKey,
|
|
66
|
+
title,
|
|
67
|
+
body: children({
|
|
68
|
+
dashboardKey,
|
|
69
|
+
assembly,
|
|
70
|
+
cardModel,
|
|
71
|
+
onComplete: () => void 0
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
const DashboardDetailStoryContainer = kosUiSdk.kosComponent(
|
|
78
|
+
({ dashboardKey, title, children }) => {
|
|
79
|
+
const { componentModeOverride } = kosDdkComponents.useComponentConfigurationContext();
|
|
80
|
+
const { assembly, cardModel } = useDashboardCardModel(dashboardKey);
|
|
81
|
+
if (!cardModel) return noModel(dashboardKey);
|
|
82
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(kosDdkComponents.Modal, { contain: componentModeOverride !== "compact", show: true, children: [
|
|
83
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
84
|
+
kosDdkComponents.Header,
|
|
85
|
+
{
|
|
86
|
+
CloseButton: componentModeOverride === "compact" ? kosDdkComponents.BackButton : void 0,
|
|
87
|
+
contain: componentModeOverride === "compact",
|
|
88
|
+
showCloseButton: true,
|
|
89
|
+
title
|
|
90
|
+
}
|
|
91
|
+
),
|
|
92
|
+
children({
|
|
93
|
+
dashboardKey,
|
|
94
|
+
assembly,
|
|
95
|
+
cardModel,
|
|
96
|
+
onComplete: () => void 0
|
|
97
|
+
})
|
|
98
|
+
] });
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
const useStoryHolder = (dashboardKey, matchName) => {
|
|
102
|
+
const { model } = kosDispenseSdk.useHolderContainer();
|
|
103
|
+
return model?.holders.data.find(
|
|
104
|
+
(holder) => matchName && holder.name === dashboardKey || kosDdkModels.executeDashboardKeyFactory(holder) === dashboardKey
|
|
105
|
+
);
|
|
106
|
+
};
|
|
107
|
+
const noHolder = (dashboardKey) => /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
108
|
+
'No holder matches dashboard key "',
|
|
109
|
+
dashboardKey,
|
|
110
|
+
'". Start the simulator with a dispenser that has one.'
|
|
111
|
+
] });
|
|
112
|
+
const PumpDetailStoryContainer = kosUiSdk.kosComponent(
|
|
113
|
+
({ dashboardKey, title, children }) => {
|
|
114
|
+
const { componentModeOverride } = kosDdkComponents.useComponentConfigurationContext();
|
|
115
|
+
const holder = useStoryHolder(dashboardKey, false);
|
|
116
|
+
if (!holder) return noHolder(dashboardKey);
|
|
117
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(kosDdkComponents.Modal, { contain: componentModeOverride !== "compact", show: true, children: [
|
|
118
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
119
|
+
kosDdkComponents.Header,
|
|
120
|
+
{
|
|
121
|
+
CloseButton: componentModeOverride === "compact" ? kosDdkComponents.BackButton : void 0,
|
|
122
|
+
contain: componentModeOverride === "compact",
|
|
123
|
+
showCloseButton: true,
|
|
124
|
+
title
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
children({ holder })
|
|
128
|
+
] });
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
const MacroSummaryStoryContainer = kosUiSdk.kosComponent(
|
|
132
|
+
({ dashboardKey, children }) => {
|
|
133
|
+
const holder = useStoryHolder(dashboardKey, true);
|
|
134
|
+
if (!holder) return noHolder(dashboardKey);
|
|
135
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children({ holder }) });
|
|
136
|
+
}
|
|
137
|
+
);
|
|
138
|
+
const PumpSummaryStoryContainer = kosUiSdk.kosComponent(
|
|
139
|
+
({ dashboardKey, children }) => {
|
|
140
|
+
const holder = useStoryHolder(dashboardKey, false);
|
|
141
|
+
if (!holder) return noHolder(dashboardKey);
|
|
142
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
143
|
+
kosDdkComponents.HolderDashboardCard,
|
|
144
|
+
{
|
|
145
|
+
cardId: holder.path,
|
|
146
|
+
avatar: holder.name,
|
|
147
|
+
body: children({ holder })
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
}
|
|
151
|
+
);
|
|
32
152
|
const NavStoryContainer = ({ children }) => children;
|
|
33
153
|
const SettingStoryContainer = ({
|
|
34
154
|
children
|
|
@@ -62,13 +182,34 @@ const SetupStepStoryContainer = ({
|
|
|
62
182
|
}
|
|
63
183
|
);
|
|
64
184
|
};
|
|
185
|
+
const TroubleActionStoryContainer = kosUiSdk.kosComponent(
|
|
186
|
+
({ troubleType, children }) => {
|
|
187
|
+
const { model } = kosUiSdk.useTroubleContainerModel();
|
|
188
|
+
const trouble = model?.troubles.getIndexByKey("byType", troubleType)[0];
|
|
189
|
+
if (!trouble) {
|
|
190
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
|
|
191
|
+
'No active "',
|
|
192
|
+
troubleType,
|
|
193
|
+
'" trouble. Raise one on the simulator to see this experience.'
|
|
194
|
+
] });
|
|
195
|
+
}
|
|
196
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: children({ trouble }) });
|
|
197
|
+
}
|
|
198
|
+
);
|
|
65
199
|
const UtilityStoryContainer = ({
|
|
66
200
|
children
|
|
67
201
|
}) => children;
|
|
68
202
|
exports.CUIStoryContainer = CUIStoryContainer;
|
|
69
203
|
exports.ControlPourStoryContainer = ControlPourStoryContainer;
|
|
204
|
+
exports.DashboardDetailStoryContainer = DashboardDetailStoryContainer;
|
|
205
|
+
exports.DashboardSummaryStoryContainer = DashboardSummaryStoryContainer;
|
|
206
|
+
exports.MacroSummaryStoryContainer = MacroSummaryStoryContainer;
|
|
70
207
|
exports.NavStoryContainer = NavStoryContainer;
|
|
208
|
+
exports.PumpDetailStoryContainer = PumpDetailStoryContainer;
|
|
209
|
+
exports.PumpSummaryStoryContainer = PumpSummaryStoryContainer;
|
|
71
210
|
exports.SettingStoryContainer = SettingStoryContainer;
|
|
72
211
|
exports.SetupStepStoryContainer = SetupStepStoryContainer;
|
|
212
|
+
exports.TroubleActionStoryContainer = TroubleActionStoryContainer;
|
|
73
213
|
exports.UtilityStoryContainer = UtilityStoryContainer;
|
|
214
|
+
exports.useDashboardCardModel = useDashboardCardModel;
|
|
74
215
|
//# sourceMappingURL=index.cjs.map
|
package/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../packages/kos-ddk-story-containers/src/components/storybook/control-pour-story-container/control-pour-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/cui-story-container/cui-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/nav-story-container/nav-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/setting-story-container/setting-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/setup-step-story-container/setup-step-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/utility-story-container/utility-story-container.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\ninterface ControlPourStoryContainerProps {\n children: ReactNode;\n}\n\nexport const ControlPourStoryContainer = ({\n children,\n}: ControlPourStoryContainerProps) => children;\n","import {\n BackButton,\n Header,\n Modal,\n useComponentConfigurationContext,\n} from \"@kosdev-code/kos-ddk-components\";\nimport type { ReactNode } from \"react\";\n\ninterface CUIStoryContainerProps {\n children: ReactNode;\n}\n\nexport const CUIStoryContainer = ({ children }: CUIStoryContainerProps) => {\n const { componentModeOverride } = useComponentConfigurationContext();\n\n return (\n <Modal\n contain={componentModeOverride !== \"compact\"}\n mode=\"maximized\"\n show={true}\n >\n <>\n <Header\n CloseButton={\n componentModeOverride === \"compact\" ? BackButton : undefined\n }\n contain={componentModeOverride === \"compact\"}\n showCloseButton={true}\n showOpenButton={false}\n title=\"CUI\"\n />\n {children}\n </>\n </Modal>\n );\n};\n","import type { ReactNode } from \"react\";\n\ninterface NavStoryContainerProps {\n children: ReactNode;\n}\n\nexport const NavStoryContainer = ({ children }: NavStoryContainerProps) =>\n children;\n","import {\n SettingsSubheading,\n TabContainer,\n} from \"@kosdev-code/kos-ddk-components\";\nimport type { ReactNode } from \"react\";\n\ninterface SettingStoryContainerProps {\n children: ReactNode;\n}\n\nexport const SettingStoryContainer = ({\n children,\n}: SettingStoryContainerProps) => (\n <TabContainer>\n <SettingsSubheading>Setting</SettingsSubheading>\n {children}\n </TabContainer>\n);\n","import {\n BackButton,\n Header,\n Modal,\n useComponentConfigurationContext,\n} from \"@kosdev-code/kos-ddk-components\";\nimport type { ReactNode } from \"react\";\n\ninterface SetupStepStoryContainerProps {\n children: ReactNode;\n}\n\nexport const SetupStepStoryContainer = ({\n children,\n}: SetupStepStoryContainerProps) => {\n const { componentModeOverride } = useComponentConfigurationContext();\n\n return (\n <Modal\n contain={componentModeOverride !== \"compact\"}\n mode=\"maximized\"\n show={true}\n >\n <>\n <Header\n CloseButton={\n componentModeOverride === \"compact\" ? BackButton : undefined\n }\n contain={componentModeOverride === \"compact\"}\n showCloseButton={true}\n showOpenButton={true}\n title=\"Setup Step\"\n />\n {children}\n </>\n </Modal>\n );\n};\n","import type { ReactNode } from \"react\";\n\ninterface UtilityStoryContainerProps {\n children: ReactNode;\n}\n\nexport const UtilityStoryContainer = ({\n children,\n}: UtilityStoryContainerProps) => children;\n"],"names":["useComponentConfigurationContext","jsx","Modal","jsxs","Fragment","Header","BackButton","TabContainer","SettingsSubheading"],"mappings":";;;;AAMO,MAAM,4BAA4B,CAAC;AAAA,EACxC;AACF,MAAsC;ACI/B,MAAM,oBAAoB,CAAC,EAAE,eAAuC;AACzE,QAAM,EAAE,sBAAA,IAA0BA,kDAAA;AAElC,SACEC,2BAAAA;AAAAA,IAACC,iBAAAA;AAAAA,IAAA;AAAA,MACC,SAAS,0BAA0B;AAAA,MACnC,MAAK;AAAA,MACL,MAAM;AAAA,MAEN,UAAAC,2BAAAA,KAAAC,qBAAA,EACE,UAAA;AAAA,QAAAH,2BAAAA;AAAAA,UAACI,iBAAAA;AAAAA,UAAA;AAAA,YACC,aACE,0BAA0B,YAAYC,iBAAAA,aAAa;AAAA,YAErD,SAAS,0BAA0B;AAAA,YACnC,iBAAiB;AAAA,YACjB,gBAAgB;AAAA,YAChB,OAAM;AAAA,UAAA;AAAA,QAAA;AAAA,QAEP;AAAA,MAAA,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;AC7BO,MAAM,oBAAoB,CAAC,EAAE,eAClC;ACGK,MAAM,wBAAwB,CAAC;AAAA,EACpC;AACF,sCACGC,+BAAA,EACC,UAAA;AAAA,EAAAN,2BAAAA,IAACO,iBAAAA,sBAAmB,UAAA,UAAA,CAAO;AAAA,EAC1B;AAAA,EAAA,CACH;ACJK,MAAM,0BAA0B,CAAC;AAAA,EACtC;AACF,MAAoC;AAClC,QAAM,EAAE,sBAAA,IAA0BR,kDAAA;AAElC,SACEC,2BAAAA;AAAAA,IAACC,iBAAAA;AAAAA,IAAA;AAAA,MACC,SAAS,0BAA0B;AAAA,MACnC,MAAK;AAAA,MACL,MAAM;AAAA,MAEN,UAAAC,2BAAAA,KAAAC,qBAAA,EACE,UAAA;AAAA,QAAAH,2BAAAA;AAAAA,UAACI,iBAAAA;AAAAA,UAAA;AAAA,YACC,aACE,0BAA0B,YAAYC,iBAAAA,aAAa;AAAA,YAErD,SAAS,0BAA0B;AAAA,YACnC,iBAAiB;AAAA,YACjB,gBAAgB;AAAA,YAChB,OAAM;AAAA,UAAA;AAAA,QAAA;AAAA,QAEP;AAAA,MAAA,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;AC/BO,MAAM,wBAAwB,CAAC;AAAA,EACpC;AACF,MAAkC;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../packages/kos-ddk-story-containers/src/components/storybook/control-pour-story-container/control-pour-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/cui-story-container/cui-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/dashboard-story-container/use-dashboard-card-model.ts","../../../packages/kos-ddk-story-containers/src/components/storybook/dashboard-story-container/dashboard-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/holder-story-container/holder-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/nav-story-container/nav-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/setting-story-container/setting-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/setup-step-story-container/setup-step-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/trouble-action-story-container/trouble-action-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/utility-story-container/utility-story-container.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\ninterface ControlPourStoryContainerProps {\n children: ReactNode;\n}\n\nexport const ControlPourStoryContainer = ({\n children,\n}: ControlPourStoryContainerProps) => children;\n","import {\n BackButton,\n Header,\n Modal,\n useComponentConfigurationContext,\n} from \"@kosdev-code/kos-ddk-components\";\nimport type { ReactNode } from \"react\";\n\ninterface CUIStoryContainerProps {\n children: ReactNode;\n}\n\nexport const CUIStoryContainer = ({ children }: CUIStoryContainerProps) => {\n const { componentModeOverride } = useComponentConfigurationContext();\n\n return (\n <Modal\n contain={componentModeOverride !== \"compact\"}\n mode=\"maximized\"\n show={true}\n >\n <>\n <Header\n CloseButton={\n componentModeOverride === \"compact\" ? BackButton : undefined\n }\n contain={componentModeOverride === \"compact\"}\n showCloseButton={true}\n showOpenButton={false}\n title=\"CUI\"\n />\n {children}\n </>\n </Modal>\n );\n};\n","import { useAssemblyContext } from \"@kosdev-code/kos-dispense-sdk\";\nimport { FreestyleAssembly } from \"@kosdev-code/kos-freestyle-sdk\";\nimport {\n getKosCompanionModel,\n type IKosDataModel,\n} from \"@kosdev-code/kos-ui-sdk\";\n\n/**\n * The assembly and the first active model a dashboard card renders for\n * `dashboardKey`, found the way the host dashboard finds them: the assembly\n * property, then the FreestyleAssembly companion's; a container yields its items.\n */\nexport const useDashboardCardModel = (dashboardKey: string) => {\n const { model: assembly } = useAssemblyContext();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let modelRef: any = (assembly as any)?.[dashboardKey];\n if (!modelRef && assembly) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const freestyle: any = getKosCompanionModel(\n assembly,\n FreestyleAssembly.type\n );\n modelRef = freestyle?.[dashboardKey];\n }\n const models: IKosDataModel[] = modelRef\n ? Array.isArray(modelRef.data)\n ? modelRef.data\n : [modelRef]\n : [];\n const cardModel = models.find(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (model: any) => (typeof model?.active === \"boolean\" ? model.active : true)\n );\n return { assembly, cardModel };\n};\n","import {\n AgitatorDashboardCard,\n BackButton,\n Header,\n Modal,\n useComponentConfigurationContext,\n} from \"@kosdev-code/kos-ddk-components\";\nimport type { AssemblyModel } from \"@kosdev-code/kos-dispense-sdk\";\nimport { kosComponent, type IKosDataModel } from \"@kosdev-code/kos-ui-sdk\";\nimport type { ReactNode } from \"react\";\nimport { useDashboardCardModel } from \"./use-dashboard-card-model\";\n\nexport interface DashboardCardStoryProps {\n dashboardKey: string;\n assembly?: AssemblyModel;\n cardModel?: IKosDataModel;\n onComplete: () => void;\n}\n\ninterface DashboardStoryContainerProps {\n /** The contribution's dashboardKey: an assembly (or FreestyleAssembly) property. */\n dashboardKey: string;\n title: string;\n children: (props: DashboardCardStoryProps) => ReactNode;\n}\n\nconst noModel = (dashboardKey: string) => (\n <div>\n No active \"{dashboardKey}\" model on the assembly. Start the simulator with a\n dispenser that has one.\n </div>\n);\n\n/** A dashboard summary story, framed as the host frames the card body. */\nexport const DashboardSummaryStoryContainer = kosComponent(\n ({ dashboardKey, title, children }: DashboardStoryContainerProps) => {\n const { assembly, cardModel } = useDashboardCardModel(dashboardKey);\n if (!cardModel) return noModel(dashboardKey);\n return (\n <AgitatorDashboardCard\n cardId={dashboardKey}\n title={title}\n body={children({\n dashboardKey,\n assembly,\n cardModel,\n onComplete: () => undefined,\n })}\n />\n );\n }\n);\n\n/** A dashboard detail story, in the modal the host opens from the card. */\nexport const DashboardDetailStoryContainer = kosComponent(\n ({ dashboardKey, title, children }: DashboardStoryContainerProps) => {\n const { componentModeOverride } = useComponentConfigurationContext();\n const { assembly, cardModel } = useDashboardCardModel(dashboardKey);\n if (!cardModel) return noModel(dashboardKey);\n return (\n <Modal contain={componentModeOverride !== \"compact\"} show={true}>\n <Header\n CloseButton={\n componentModeOverride === \"compact\" ? BackButton : undefined\n }\n contain={componentModeOverride === \"compact\"}\n showCloseButton={true}\n title={title}\n />\n {children({\n dashboardKey,\n assembly,\n cardModel,\n onComplete: () => undefined,\n })}\n </Modal>\n );\n }\n);\n","import {\n BackButton,\n Header,\n HolderDashboardCard,\n Modal,\n useComponentConfigurationContext,\n} from \"@kosdev-code/kos-ddk-components\";\nimport {\n useHolderContainer,\n type HolderModel,\n} from \"@kosdev-code/kos-dispense-sdk\";\nimport { executeDashboardKeyFactory } from \"@kosdev-code/kos-ddk-models\";\nimport { kosComponent } from \"@kosdev-code/kos-ui-sdk\";\nimport type { ReactNode } from \"react\";\n\nexport interface HolderStoryProps {\n holder: HolderModel;\n}\n\ninterface HolderStoryContainerProps {\n /** The contribution's dashboardKey. */\n dashboardKey: string;\n title: string;\n children: (props: HolderStoryProps) => ReactNode;\n}\n\n/**\n * The first holder a contribution with `dashboardKey` renders for. Pump detail and\n * pump summary match the dashboard key factory (default: the holder's first pump\n * type); macro summary tries holder.name first.\n */\nconst useStoryHolder = (dashboardKey: string, matchName: boolean) => {\n const { model } = useHolderContainer();\n return model?.holders.data.find(\n (holder: HolderModel) =>\n (matchName && holder.name === dashboardKey) ||\n executeDashboardKeyFactory(holder) === dashboardKey\n );\n};\n\nconst noHolder = (dashboardKey: string) => (\n <div>\n No holder matches dashboard key \"{dashboardKey}\". Start the simulator with a\n dispenser that has one.\n </div>\n);\n\n/** A pump detail story, in the holder modal the host opens. */\nexport const PumpDetailStoryContainer = kosComponent(\n ({ dashboardKey, title, children }: HolderStoryContainerProps) => {\n const { componentModeOverride } = useComponentConfigurationContext();\n const holder = useStoryHolder(dashboardKey, false);\n if (!holder) return noHolder(dashboardKey);\n return (\n <Modal contain={componentModeOverride !== \"compact\"} show={true}>\n <Header\n CloseButton={\n componentModeOverride === \"compact\" ? BackButton : undefined\n }\n contain={componentModeOverride === \"compact\"}\n showCloseButton={true}\n title={title}\n />\n {children({ holder })}\n </Modal>\n );\n }\n);\n\n/** A macro summary story: the body the host shows on a macro holder card. */\nexport const MacroSummaryStoryContainer = kosComponent(\n ({ dashboardKey, children }: HolderStoryContainerProps) => {\n const holder = useStoryHolder(dashboardKey, true);\n if (!holder) return noHolder(dashboardKey);\n return <>{children({ holder })}</>;\n }\n);\n\n/** A pump summary story: the body the host shows on the holder's dashboard card. */\nexport const PumpSummaryStoryContainer = kosComponent(\n ({ dashboardKey, children }: HolderStoryContainerProps) => {\n const holder = useStoryHolder(dashboardKey, false);\n if (!holder) return noHolder(dashboardKey);\n return (\n <HolderDashboardCard\n cardId={holder.path}\n avatar={holder.name}\n body={children({ holder })}\n />\n );\n }\n);\n","import type { ReactNode } from \"react\";\n\ninterface NavStoryContainerProps {\n children: ReactNode;\n}\n\nexport const NavStoryContainer = ({ children }: NavStoryContainerProps) =>\n children;\n","import {\n SettingsSubheading,\n TabContainer,\n} from \"@kosdev-code/kos-ddk-components\";\nimport type { ReactNode } from \"react\";\n\ninterface SettingStoryContainerProps {\n children: ReactNode;\n}\n\nexport const SettingStoryContainer = ({\n children,\n}: SettingStoryContainerProps) => (\n <TabContainer>\n <SettingsSubheading>Setting</SettingsSubheading>\n {children}\n </TabContainer>\n);\n","import {\n BackButton,\n Header,\n Modal,\n useComponentConfigurationContext,\n} from \"@kosdev-code/kos-ddk-components\";\nimport type { ReactNode } from \"react\";\n\ninterface SetupStepStoryContainerProps {\n children: ReactNode;\n}\n\nexport const SetupStepStoryContainer = ({\n children,\n}: SetupStepStoryContainerProps) => {\n const { componentModeOverride } = useComponentConfigurationContext();\n\n return (\n <Modal\n contain={componentModeOverride !== \"compact\"}\n mode=\"maximized\"\n show={true}\n >\n <>\n <Header\n CloseButton={\n componentModeOverride === \"compact\" ? BackButton : undefined\n }\n contain={componentModeOverride === \"compact\"}\n showCloseButton={true}\n showOpenButton={true}\n title=\"Setup Step\"\n />\n {children}\n </>\n </Modal>\n );\n};\n","import {\n kosComponent,\n useTroubleContainerModel,\n type TroubleModel,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport type { ReactNode } from \"react\";\n\nexport interface TroubleActionStoryProps {\n trouble: TroubleModel;\n}\n\ninterface TroubleActionStoryContainerProps {\n /** The contribution's troubleType: the exact type the device raises. */\n troubleType: string;\n children: (props: TroubleActionStoryProps) => ReactNode;\n}\n\n/** A trouble action story, given the device's active trouble of `troubleType`. */\nexport const TroubleActionStoryContainer = kosComponent(\n ({ troubleType, children }: TroubleActionStoryContainerProps) => {\n const { model } = useTroubleContainerModel();\n const trouble = model?.troubles.getIndexByKey(\"byType\", troubleType)[0];\n if (!trouble) {\n return (\n <div>\n No active \"{troubleType}\" trouble. Raise one on the simulator to see\n this experience.\n </div>\n );\n }\n return <>{children({ trouble })}</>;\n }\n);\n","import type { ReactNode } from \"react\";\n\ninterface UtilityStoryContainerProps {\n children: ReactNode;\n}\n\nexport const UtilityStoryContainer = ({\n children,\n}: UtilityStoryContainerProps) => children;\n"],"names":["useComponentConfigurationContext","jsx","Modal","jsxs","Fragment","Header","BackButton","useAssemblyContext","getKosCompanionModel","FreestyleAssembly","kosComponent","AgitatorDashboardCard","useHolderContainer","executeDashboardKeyFactory","HolderDashboardCard","TabContainer","SettingsSubheading","useTroubleContainerModel"],"mappings":";;;;;;;;AAMO,MAAM,4BAA4B,CAAC;AAAA,EACxC;AACF,MAAsC;ACI/B,MAAM,oBAAoB,CAAC,EAAE,eAAuC;AACzE,QAAM,EAAE,sBAAA,IAA0BA,kDAAA;AAElC,SACEC,2BAAAA;AAAAA,IAACC,iBAAAA;AAAAA,IAAA;AAAA,MACC,SAAS,0BAA0B;AAAA,MACnC,MAAK;AAAA,MACL,MAAM;AAAA,MAEN,UAAAC,2BAAAA,KAAAC,qBAAA,EACE,UAAA;AAAA,QAAAH,2BAAAA;AAAAA,UAACI,iBAAAA;AAAAA,UAAA;AAAA,YACC,aACE,0BAA0B,YAAYC,iBAAAA,aAAa;AAAA,YAErD,SAAS,0BAA0B;AAAA,YACnC,iBAAiB;AAAA,YACjB,gBAAgB;AAAA,YAChB,OAAM;AAAA,UAAA;AAAA,QAAA;AAAA,QAEP;AAAA,MAAA,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;ACvBO,MAAM,wBAAwB,CAAC,iBAAyB;AAC7D,QAAM,EAAE,OAAO,SAAA,IAAaC,kCAAA;AAE5B,MAAI,WAAiB,WAAmB,YAAY;AACpD,MAAI,CAAC,YAAY,UAAU;AAEzB,UAAM,YAAiBC,SAAAA;AAAAA,MACrB;AAAA,MACAC,kCAAkB;AAAA,IAAA;AAEpB,eAAW,YAAY,YAAY;AAAA,EACrC;AACA,QAAM,SAA0B,WAC5B,MAAM,QAAQ,SAAS,IAAI,IACzB,SAAS,OACT,CAAC,QAAQ,IACX,CAAA;AACJ,QAAM,YAAY,OAAO;AAAA;AAAA,IAEvB,CAAC,UAAgB,OA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,CAAS,GAAE;AAAA,EAClC;AACF;AC1BO,MAAM,wBAAwB,CAAC;AAAA,EACpC;AACF,MAAkC;;;;;;;;;;;;;;"}
|
package/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "@emotion/react/jsx-runtime";
|
|
2
|
-
import { useComponentConfigurationContext, Modal, Header, BackButton, TabContainer, SettingsSubheading } from "@kosdev-code/kos-ddk-components";
|
|
2
|
+
import { useComponentConfigurationContext, Modal, Header, BackButton, AgitatorDashboardCard, HolderDashboardCard, TabContainer, SettingsSubheading } from "@kosdev-code/kos-ddk-components";
|
|
3
|
+
import { getKosCompanionModel, kosComponent, useTroubleContainerModel } from "@kosdev-code/kos-ui-sdk";
|
|
4
|
+
import { useAssemblyContext, useHolderContainer } from "@kosdev-code/kos-dispense-sdk";
|
|
5
|
+
import { FreestyleAssembly } from "@kosdev-code/kos-freestyle-sdk";
|
|
6
|
+
import { executeDashboardKeyFactory } from "@kosdev-code/kos-ddk-models";
|
|
3
7
|
const ControlPourStoryContainer = ({
|
|
4
8
|
children
|
|
5
9
|
}) => children;
|
|
@@ -27,6 +31,122 @@ const CUIStoryContainer = ({ children }) => {
|
|
|
27
31
|
}
|
|
28
32
|
);
|
|
29
33
|
};
|
|
34
|
+
const useDashboardCardModel = (dashboardKey) => {
|
|
35
|
+
const { model: assembly } = useAssemblyContext();
|
|
36
|
+
let modelRef = assembly?.[dashboardKey];
|
|
37
|
+
if (!modelRef && assembly) {
|
|
38
|
+
const freestyle = getKosCompanionModel(
|
|
39
|
+
assembly,
|
|
40
|
+
FreestyleAssembly.type
|
|
41
|
+
);
|
|
42
|
+
modelRef = freestyle?.[dashboardKey];
|
|
43
|
+
}
|
|
44
|
+
const models = modelRef ? Array.isArray(modelRef.data) ? modelRef.data : [modelRef] : [];
|
|
45
|
+
const cardModel = models.find(
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
47
|
+
(model) => typeof model?.active === "boolean" ? model.active : true
|
|
48
|
+
);
|
|
49
|
+
return { assembly, cardModel };
|
|
50
|
+
};
|
|
51
|
+
const noModel = (dashboardKey) => /* @__PURE__ */ jsxs("div", { children: [
|
|
52
|
+
'No active "',
|
|
53
|
+
dashboardKey,
|
|
54
|
+
'" model on the assembly. Start the simulator with a dispenser that has one.'
|
|
55
|
+
] });
|
|
56
|
+
const DashboardSummaryStoryContainer = kosComponent(
|
|
57
|
+
({ dashboardKey, title, children }) => {
|
|
58
|
+
const { assembly, cardModel } = useDashboardCardModel(dashboardKey);
|
|
59
|
+
if (!cardModel) return noModel(dashboardKey);
|
|
60
|
+
return /* @__PURE__ */ jsx(
|
|
61
|
+
AgitatorDashboardCard,
|
|
62
|
+
{
|
|
63
|
+
cardId: dashboardKey,
|
|
64
|
+
title,
|
|
65
|
+
body: children({
|
|
66
|
+
dashboardKey,
|
|
67
|
+
assembly,
|
|
68
|
+
cardModel,
|
|
69
|
+
onComplete: () => void 0
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
const DashboardDetailStoryContainer = kosComponent(
|
|
76
|
+
({ dashboardKey, title, children }) => {
|
|
77
|
+
const { componentModeOverride } = useComponentConfigurationContext();
|
|
78
|
+
const { assembly, cardModel } = useDashboardCardModel(dashboardKey);
|
|
79
|
+
if (!cardModel) return noModel(dashboardKey);
|
|
80
|
+
return /* @__PURE__ */ jsxs(Modal, { contain: componentModeOverride !== "compact", show: true, children: [
|
|
81
|
+
/* @__PURE__ */ jsx(
|
|
82
|
+
Header,
|
|
83
|
+
{
|
|
84
|
+
CloseButton: componentModeOverride === "compact" ? BackButton : void 0,
|
|
85
|
+
contain: componentModeOverride === "compact",
|
|
86
|
+
showCloseButton: true,
|
|
87
|
+
title
|
|
88
|
+
}
|
|
89
|
+
),
|
|
90
|
+
children({
|
|
91
|
+
dashboardKey,
|
|
92
|
+
assembly,
|
|
93
|
+
cardModel,
|
|
94
|
+
onComplete: () => void 0
|
|
95
|
+
})
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
const useStoryHolder = (dashboardKey, matchName) => {
|
|
100
|
+
const { model } = useHolderContainer();
|
|
101
|
+
return model?.holders.data.find(
|
|
102
|
+
(holder) => matchName && holder.name === dashboardKey || executeDashboardKeyFactory(holder) === dashboardKey
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
const noHolder = (dashboardKey) => /* @__PURE__ */ jsxs("div", { children: [
|
|
106
|
+
'No holder matches dashboard key "',
|
|
107
|
+
dashboardKey,
|
|
108
|
+
'". Start the simulator with a dispenser that has one.'
|
|
109
|
+
] });
|
|
110
|
+
const PumpDetailStoryContainer = kosComponent(
|
|
111
|
+
({ dashboardKey, title, children }) => {
|
|
112
|
+
const { componentModeOverride } = useComponentConfigurationContext();
|
|
113
|
+
const holder = useStoryHolder(dashboardKey, false);
|
|
114
|
+
if (!holder) return noHolder(dashboardKey);
|
|
115
|
+
return /* @__PURE__ */ jsxs(Modal, { contain: componentModeOverride !== "compact", show: true, children: [
|
|
116
|
+
/* @__PURE__ */ jsx(
|
|
117
|
+
Header,
|
|
118
|
+
{
|
|
119
|
+
CloseButton: componentModeOverride === "compact" ? BackButton : void 0,
|
|
120
|
+
contain: componentModeOverride === "compact",
|
|
121
|
+
showCloseButton: true,
|
|
122
|
+
title
|
|
123
|
+
}
|
|
124
|
+
),
|
|
125
|
+
children({ holder })
|
|
126
|
+
] });
|
|
127
|
+
}
|
|
128
|
+
);
|
|
129
|
+
const MacroSummaryStoryContainer = kosComponent(
|
|
130
|
+
({ dashboardKey, children }) => {
|
|
131
|
+
const holder = useStoryHolder(dashboardKey, true);
|
|
132
|
+
if (!holder) return noHolder(dashboardKey);
|
|
133
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children({ holder }) });
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
const PumpSummaryStoryContainer = kosComponent(
|
|
137
|
+
({ dashboardKey, children }) => {
|
|
138
|
+
const holder = useStoryHolder(dashboardKey, false);
|
|
139
|
+
if (!holder) return noHolder(dashboardKey);
|
|
140
|
+
return /* @__PURE__ */ jsx(
|
|
141
|
+
HolderDashboardCard,
|
|
142
|
+
{
|
|
143
|
+
cardId: holder.path,
|
|
144
|
+
avatar: holder.name,
|
|
145
|
+
body: children({ holder })
|
|
146
|
+
}
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
);
|
|
30
150
|
const NavStoryContainer = ({ children }) => children;
|
|
31
151
|
const SettingStoryContainer = ({
|
|
32
152
|
children
|
|
@@ -60,15 +180,36 @@ const SetupStepStoryContainer = ({
|
|
|
60
180
|
}
|
|
61
181
|
);
|
|
62
182
|
};
|
|
183
|
+
const TroubleActionStoryContainer = kosComponent(
|
|
184
|
+
({ troubleType, children }) => {
|
|
185
|
+
const { model } = useTroubleContainerModel();
|
|
186
|
+
const trouble = model?.troubles.getIndexByKey("byType", troubleType)[0];
|
|
187
|
+
if (!trouble) {
|
|
188
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
189
|
+
'No active "',
|
|
190
|
+
troubleType,
|
|
191
|
+
'" trouble. Raise one on the simulator to see this experience.'
|
|
192
|
+
] });
|
|
193
|
+
}
|
|
194
|
+
return /* @__PURE__ */ jsx(Fragment, { children: children({ trouble }) });
|
|
195
|
+
}
|
|
196
|
+
);
|
|
63
197
|
const UtilityStoryContainer = ({
|
|
64
198
|
children
|
|
65
199
|
}) => children;
|
|
66
200
|
export {
|
|
67
201
|
CUIStoryContainer,
|
|
68
202
|
ControlPourStoryContainer,
|
|
203
|
+
DashboardDetailStoryContainer,
|
|
204
|
+
DashboardSummaryStoryContainer,
|
|
205
|
+
MacroSummaryStoryContainer,
|
|
69
206
|
NavStoryContainer,
|
|
207
|
+
PumpDetailStoryContainer,
|
|
208
|
+
PumpSummaryStoryContainer,
|
|
70
209
|
SettingStoryContainer,
|
|
71
210
|
SetupStepStoryContainer,
|
|
72
|
-
|
|
211
|
+
TroubleActionStoryContainer,
|
|
212
|
+
UtilityStoryContainer,
|
|
213
|
+
useDashboardCardModel
|
|
73
214
|
};
|
|
74
215
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../packages/kos-ddk-story-containers/src/components/storybook/control-pour-story-container/control-pour-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/cui-story-container/cui-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/nav-story-container/nav-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/setting-story-container/setting-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/setup-step-story-container/setup-step-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/utility-story-container/utility-story-container.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\ninterface ControlPourStoryContainerProps {\n children: ReactNode;\n}\n\nexport const ControlPourStoryContainer = ({\n children,\n}: ControlPourStoryContainerProps) => children;\n","import {\n BackButton,\n Header,\n Modal,\n useComponentConfigurationContext,\n} from \"@kosdev-code/kos-ddk-components\";\nimport type { ReactNode } from \"react\";\n\ninterface CUIStoryContainerProps {\n children: ReactNode;\n}\n\nexport const CUIStoryContainer = ({ children }: CUIStoryContainerProps) => {\n const { componentModeOverride } = useComponentConfigurationContext();\n\n return (\n <Modal\n contain={componentModeOverride !== \"compact\"}\n mode=\"maximized\"\n show={true}\n >\n <>\n <Header\n CloseButton={\n componentModeOverride === \"compact\" ? BackButton : undefined\n }\n contain={componentModeOverride === \"compact\"}\n showCloseButton={true}\n showOpenButton={false}\n title=\"CUI\"\n />\n {children}\n </>\n </Modal>\n );\n};\n","import type { ReactNode } from \"react\";\n\ninterface NavStoryContainerProps {\n children: ReactNode;\n}\n\nexport const NavStoryContainer = ({ children }: NavStoryContainerProps) =>\n children;\n","import {\n SettingsSubheading,\n TabContainer,\n} from \"@kosdev-code/kos-ddk-components\";\nimport type { ReactNode } from \"react\";\n\ninterface SettingStoryContainerProps {\n children: ReactNode;\n}\n\nexport const SettingStoryContainer = ({\n children,\n}: SettingStoryContainerProps) => (\n <TabContainer>\n <SettingsSubheading>Setting</SettingsSubheading>\n {children}\n </TabContainer>\n);\n","import {\n BackButton,\n Header,\n Modal,\n useComponentConfigurationContext,\n} from \"@kosdev-code/kos-ddk-components\";\nimport type { ReactNode } from \"react\";\n\ninterface SetupStepStoryContainerProps {\n children: ReactNode;\n}\n\nexport const SetupStepStoryContainer = ({\n children,\n}: SetupStepStoryContainerProps) => {\n const { componentModeOverride } = useComponentConfigurationContext();\n\n return (\n <Modal\n contain={componentModeOverride !== \"compact\"}\n mode=\"maximized\"\n show={true}\n >\n <>\n <Header\n CloseButton={\n componentModeOverride === \"compact\" ? BackButton : undefined\n }\n contain={componentModeOverride === \"compact\"}\n showCloseButton={true}\n showOpenButton={true}\n title=\"Setup Step\"\n />\n {children}\n </>\n </Modal>\n );\n};\n","import type { ReactNode } from \"react\";\n\ninterface UtilityStoryContainerProps {\n children: ReactNode;\n}\n\nexport const UtilityStoryContainer = ({\n children,\n}: UtilityStoryContainerProps) => children;\n"],"names":[],"mappings":";;AAMO,MAAM,4BAA4B,CAAC;AAAA,EACxC;AACF,MAAsC;ACI/B,MAAM,oBAAoB,CAAC,EAAE,eAAuC;AACzE,QAAM,EAAE,sBAAA,IAA0B,iCAAA;AAElC,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS,0BAA0B;AAAA,MACnC,MAAK;AAAA,MACL,MAAM;AAAA,MAEN,UAAA,qBAAA,UAAA,EACE,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,aACE,0BAA0B,YAAY,aAAa;AAAA,YAErD,SAAS,0BAA0B;AAAA,YACnC,iBAAiB;AAAA,YACjB,gBAAgB;AAAA,YAChB,OAAM;AAAA,UAAA;AAAA,QAAA;AAAA,QAEP;AAAA,MAAA,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;AC7BO,MAAM,oBAAoB,CAAC,EAAE,eAClC;ACGK,MAAM,wBAAwB,CAAC;AAAA,EACpC;AACF,2BACG,cAAA,EACC,UAAA;AAAA,EAAA,oBAAC,sBAAmB,UAAA,UAAA,CAAO;AAAA,EAC1B;AAAA,EAAA,CACH;ACJK,MAAM,0BAA0B,CAAC;AAAA,EACtC;AACF,MAAoC;AAClC,QAAM,EAAE,sBAAA,IAA0B,iCAAA;AAElC,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS,0BAA0B;AAAA,MACnC,MAAK;AAAA,MACL,MAAM;AAAA,MAEN,UAAA,qBAAA,UAAA,EACE,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,aACE,0BAA0B,YAAY,aAAa;AAAA,YAErD,SAAS,0BAA0B;AAAA,YACnC,iBAAiB;AAAA,YACjB,gBAAgB;AAAA,YAChB,OAAM;AAAA,UAAA;AAAA,QAAA;AAAA,QAEP;AAAA,MAAA,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;AC/BO,MAAM,wBAAwB,CAAC;AAAA,EACpC;AACF,MAAkC;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../packages/kos-ddk-story-containers/src/components/storybook/control-pour-story-container/control-pour-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/cui-story-container/cui-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/dashboard-story-container/use-dashboard-card-model.ts","../../../packages/kos-ddk-story-containers/src/components/storybook/dashboard-story-container/dashboard-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/holder-story-container/holder-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/nav-story-container/nav-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/setting-story-container/setting-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/setup-step-story-container/setup-step-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/trouble-action-story-container/trouble-action-story-container.tsx","../../../packages/kos-ddk-story-containers/src/components/storybook/utility-story-container/utility-story-container.tsx"],"sourcesContent":["import type { ReactNode } from \"react\";\n\ninterface ControlPourStoryContainerProps {\n children: ReactNode;\n}\n\nexport const ControlPourStoryContainer = ({\n children,\n}: ControlPourStoryContainerProps) => children;\n","import {\n BackButton,\n Header,\n Modal,\n useComponentConfigurationContext,\n} from \"@kosdev-code/kos-ddk-components\";\nimport type { ReactNode } from \"react\";\n\ninterface CUIStoryContainerProps {\n children: ReactNode;\n}\n\nexport const CUIStoryContainer = ({ children }: CUIStoryContainerProps) => {\n const { componentModeOverride } = useComponentConfigurationContext();\n\n return (\n <Modal\n contain={componentModeOverride !== \"compact\"}\n mode=\"maximized\"\n show={true}\n >\n <>\n <Header\n CloseButton={\n componentModeOverride === \"compact\" ? BackButton : undefined\n }\n contain={componentModeOverride === \"compact\"}\n showCloseButton={true}\n showOpenButton={false}\n title=\"CUI\"\n />\n {children}\n </>\n </Modal>\n );\n};\n","import { useAssemblyContext } from \"@kosdev-code/kos-dispense-sdk\";\nimport { FreestyleAssembly } from \"@kosdev-code/kos-freestyle-sdk\";\nimport {\n getKosCompanionModel,\n type IKosDataModel,\n} from \"@kosdev-code/kos-ui-sdk\";\n\n/**\n * The assembly and the first active model a dashboard card renders for\n * `dashboardKey`, found the way the host dashboard finds them: the assembly\n * property, then the FreestyleAssembly companion's; a container yields its items.\n */\nexport const useDashboardCardModel = (dashboardKey: string) => {\n const { model: assembly } = useAssemblyContext();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let modelRef: any = (assembly as any)?.[dashboardKey];\n if (!modelRef && assembly) {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const freestyle: any = getKosCompanionModel(\n assembly,\n FreestyleAssembly.type\n );\n modelRef = freestyle?.[dashboardKey];\n }\n const models: IKosDataModel[] = modelRef\n ? Array.isArray(modelRef.data)\n ? modelRef.data\n : [modelRef]\n : [];\n const cardModel = models.find(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (model: any) => (typeof model?.active === \"boolean\" ? model.active : true)\n );\n return { assembly, cardModel };\n};\n","import {\n AgitatorDashboardCard,\n BackButton,\n Header,\n Modal,\n useComponentConfigurationContext,\n} from \"@kosdev-code/kos-ddk-components\";\nimport type { AssemblyModel } from \"@kosdev-code/kos-dispense-sdk\";\nimport { kosComponent, type IKosDataModel } from \"@kosdev-code/kos-ui-sdk\";\nimport type { ReactNode } from \"react\";\nimport { useDashboardCardModel } from \"./use-dashboard-card-model\";\n\nexport interface DashboardCardStoryProps {\n dashboardKey: string;\n assembly?: AssemblyModel;\n cardModel?: IKosDataModel;\n onComplete: () => void;\n}\n\ninterface DashboardStoryContainerProps {\n /** The contribution's dashboardKey: an assembly (or FreestyleAssembly) property. */\n dashboardKey: string;\n title: string;\n children: (props: DashboardCardStoryProps) => ReactNode;\n}\n\nconst noModel = (dashboardKey: string) => (\n <div>\n No active \"{dashboardKey}\" model on the assembly. Start the simulator with a\n dispenser that has one.\n </div>\n);\n\n/** A dashboard summary story, framed as the host frames the card body. */\nexport const DashboardSummaryStoryContainer = kosComponent(\n ({ dashboardKey, title, children }: DashboardStoryContainerProps) => {\n const { assembly, cardModel } = useDashboardCardModel(dashboardKey);\n if (!cardModel) return noModel(dashboardKey);\n return (\n <AgitatorDashboardCard\n cardId={dashboardKey}\n title={title}\n body={children({\n dashboardKey,\n assembly,\n cardModel,\n onComplete: () => undefined,\n })}\n />\n );\n }\n);\n\n/** A dashboard detail story, in the modal the host opens from the card. */\nexport const DashboardDetailStoryContainer = kosComponent(\n ({ dashboardKey, title, children }: DashboardStoryContainerProps) => {\n const { componentModeOverride } = useComponentConfigurationContext();\n const { assembly, cardModel } = useDashboardCardModel(dashboardKey);\n if (!cardModel) return noModel(dashboardKey);\n return (\n <Modal contain={componentModeOverride !== \"compact\"} show={true}>\n <Header\n CloseButton={\n componentModeOverride === \"compact\" ? BackButton : undefined\n }\n contain={componentModeOverride === \"compact\"}\n showCloseButton={true}\n title={title}\n />\n {children({\n dashboardKey,\n assembly,\n cardModel,\n onComplete: () => undefined,\n })}\n </Modal>\n );\n }\n);\n","import {\n BackButton,\n Header,\n HolderDashboardCard,\n Modal,\n useComponentConfigurationContext,\n} from \"@kosdev-code/kos-ddk-components\";\nimport {\n useHolderContainer,\n type HolderModel,\n} from \"@kosdev-code/kos-dispense-sdk\";\nimport { executeDashboardKeyFactory } from \"@kosdev-code/kos-ddk-models\";\nimport { kosComponent } from \"@kosdev-code/kos-ui-sdk\";\nimport type { ReactNode } from \"react\";\n\nexport interface HolderStoryProps {\n holder: HolderModel;\n}\n\ninterface HolderStoryContainerProps {\n /** The contribution's dashboardKey. */\n dashboardKey: string;\n title: string;\n children: (props: HolderStoryProps) => ReactNode;\n}\n\n/**\n * The first holder a contribution with `dashboardKey` renders for. Pump detail and\n * pump summary match the dashboard key factory (default: the holder's first pump\n * type); macro summary tries holder.name first.\n */\nconst useStoryHolder = (dashboardKey: string, matchName: boolean) => {\n const { model } = useHolderContainer();\n return model?.holders.data.find(\n (holder: HolderModel) =>\n (matchName && holder.name === dashboardKey) ||\n executeDashboardKeyFactory(holder) === dashboardKey\n );\n};\n\nconst noHolder = (dashboardKey: string) => (\n <div>\n No holder matches dashboard key \"{dashboardKey}\". Start the simulator with a\n dispenser that has one.\n </div>\n);\n\n/** A pump detail story, in the holder modal the host opens. */\nexport const PumpDetailStoryContainer = kosComponent(\n ({ dashboardKey, title, children }: HolderStoryContainerProps) => {\n const { componentModeOverride } = useComponentConfigurationContext();\n const holder = useStoryHolder(dashboardKey, false);\n if (!holder) return noHolder(dashboardKey);\n return (\n <Modal contain={componentModeOverride !== \"compact\"} show={true}>\n <Header\n CloseButton={\n componentModeOverride === \"compact\" ? BackButton : undefined\n }\n contain={componentModeOverride === \"compact\"}\n showCloseButton={true}\n title={title}\n />\n {children({ holder })}\n </Modal>\n );\n }\n);\n\n/** A macro summary story: the body the host shows on a macro holder card. */\nexport const MacroSummaryStoryContainer = kosComponent(\n ({ dashboardKey, children }: HolderStoryContainerProps) => {\n const holder = useStoryHolder(dashboardKey, true);\n if (!holder) return noHolder(dashboardKey);\n return <>{children({ holder })}</>;\n }\n);\n\n/** A pump summary story: the body the host shows on the holder's dashboard card. */\nexport const PumpSummaryStoryContainer = kosComponent(\n ({ dashboardKey, children }: HolderStoryContainerProps) => {\n const holder = useStoryHolder(dashboardKey, false);\n if (!holder) return noHolder(dashboardKey);\n return (\n <HolderDashboardCard\n cardId={holder.path}\n avatar={holder.name}\n body={children({ holder })}\n />\n );\n }\n);\n","import type { ReactNode } from \"react\";\n\ninterface NavStoryContainerProps {\n children: ReactNode;\n}\n\nexport const NavStoryContainer = ({ children }: NavStoryContainerProps) =>\n children;\n","import {\n SettingsSubheading,\n TabContainer,\n} from \"@kosdev-code/kos-ddk-components\";\nimport type { ReactNode } from \"react\";\n\ninterface SettingStoryContainerProps {\n children: ReactNode;\n}\n\nexport const SettingStoryContainer = ({\n children,\n}: SettingStoryContainerProps) => (\n <TabContainer>\n <SettingsSubheading>Setting</SettingsSubheading>\n {children}\n </TabContainer>\n);\n","import {\n BackButton,\n Header,\n Modal,\n useComponentConfigurationContext,\n} from \"@kosdev-code/kos-ddk-components\";\nimport type { ReactNode } from \"react\";\n\ninterface SetupStepStoryContainerProps {\n children: ReactNode;\n}\n\nexport const SetupStepStoryContainer = ({\n children,\n}: SetupStepStoryContainerProps) => {\n const { componentModeOverride } = useComponentConfigurationContext();\n\n return (\n <Modal\n contain={componentModeOverride !== \"compact\"}\n mode=\"maximized\"\n show={true}\n >\n <>\n <Header\n CloseButton={\n componentModeOverride === \"compact\" ? BackButton : undefined\n }\n contain={componentModeOverride === \"compact\"}\n showCloseButton={true}\n showOpenButton={true}\n title=\"Setup Step\"\n />\n {children}\n </>\n </Modal>\n );\n};\n","import {\n kosComponent,\n useTroubleContainerModel,\n type TroubleModel,\n} from \"@kosdev-code/kos-ui-sdk\";\nimport type { ReactNode } from \"react\";\n\nexport interface TroubleActionStoryProps {\n trouble: TroubleModel;\n}\n\ninterface TroubleActionStoryContainerProps {\n /** The contribution's troubleType: the exact type the device raises. */\n troubleType: string;\n children: (props: TroubleActionStoryProps) => ReactNode;\n}\n\n/** A trouble action story, given the device's active trouble of `troubleType`. */\nexport const TroubleActionStoryContainer = kosComponent(\n ({ troubleType, children }: TroubleActionStoryContainerProps) => {\n const { model } = useTroubleContainerModel();\n const trouble = model?.troubles.getIndexByKey(\"byType\", troubleType)[0];\n if (!trouble) {\n return (\n <div>\n No active \"{troubleType}\" trouble. Raise one on the simulator to see\n this experience.\n </div>\n );\n }\n return <>{children({ trouble })}</>;\n }\n);\n","import type { ReactNode } from \"react\";\n\ninterface UtilityStoryContainerProps {\n children: ReactNode;\n}\n\nexport const UtilityStoryContainer = ({\n children,\n}: UtilityStoryContainerProps) => children;\n"],"names":[],"mappings":";;;;;;AAMO,MAAM,4BAA4B,CAAC;AAAA,EACxC;AACF,MAAsC;ACI/B,MAAM,oBAAoB,CAAC,EAAE,eAAuC;AACzE,QAAM,EAAE,sBAAA,IAA0B,iCAAA;AAElC,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS,0BAA0B;AAAA,MACnC,MAAK;AAAA,MACL,MAAM;AAAA,MAEN,UAAA,qBAAA,UAAA,EACE,UAAA;AAAA,QAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,aACE,0BAA0B,YAAY,aAAa;AAAA,YAErD,SAAS,0BAA0B;AAAA,YACnC,iBAAiB;AAAA,YACjB,gBAAgB;AAAA,YAChB,OAAM;AAAA,UAAA;AAAA,QAAA;AAAA,QAEP;AAAA,MAAA,EAAA,CACH;AAAA,IAAA;AAAA,EAAA;AAGN;ACvBO,MAAM,wBAAwB,CAAC,iBAAyB;AAC7D,QAAM,EAAE,OAAO,SAAA,IAAa,mBAAA;AAE5B,MAAI,WAAiB,WAAmB,YAAY;AACpD,MAAI,CAAC,YAAY,UAAU;AAE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AAkC;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kosdev-code/kos-ddk-story-containers",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.50",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"types": "./index.d.ts",
|
|
6
6
|
"exports": {
|
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
}
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@kosdev-code/kos-ddk-components": "0.1.0-dev.
|
|
14
|
+
"@kosdev-code/kos-ddk-components": "0.1.0-dev.50",
|
|
15
|
+
"@kosdev-code/kos-ddk-models": "0.1.0-dev.50",
|
|
16
|
+
"@kosdev-code/kos-dispense-sdk": "~3.0.0",
|
|
17
|
+
"@kosdev-code/kos-freestyle-sdk": "~3.0.0",
|
|
18
|
+
"@kosdev-code/kos-ui-sdk": "~3.0.0"
|
|
15
19
|
},
|
|
16
20
|
"peerDependencies": {
|
|
17
21
|
"react": "^18.0.0",
|
|
@@ -19,7 +23,7 @@
|
|
|
19
23
|
},
|
|
20
24
|
"kos": {
|
|
21
25
|
"build": {
|
|
22
|
-
"gitHash": "
|
|
26
|
+
"gitHash": "5c0550a81c2146c1101f8fec1c166f945a4a8202"
|
|
23
27
|
}
|
|
24
28
|
},
|
|
25
29
|
"publishConfig": {
|