pixelon 0.3.30 → 0.3.31
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.
|
@@ -9,3 +9,4 @@ export { BadgeDisplay } from './BadgeDisplay/BadgeDisplay';
|
|
|
9
9
|
export { TimeInputWithConfirm } from './TimeInputWithConfirm/TimeInputWithConfirm';
|
|
10
10
|
export { ReactiveForm } from './ReactiveForm/ReactiveForm';
|
|
11
11
|
export { CarouselDisplay } from './CarouselDisplay/CarouselDisplay';
|
|
12
|
+
export { ActionMenu } from './ActionMenu/ActionMenu';
|
package/dist/index.esm.js
CHANGED
|
@@ -5147,6 +5147,42 @@ const CarouselDisplay = ({
|
|
|
5147
5147
|
] });
|
|
5148
5148
|
};
|
|
5149
5149
|
|
|
5150
|
+
const ActionMenu = ({
|
|
5151
|
+
component,
|
|
5152
|
+
eventBus,
|
|
5153
|
+
assistantMessageId = ""
|
|
5154
|
+
}) => {
|
|
5155
|
+
const { emitInteraction, isConfirmed } = useComponentInteraction({
|
|
5156
|
+
eventBus,
|
|
5157
|
+
fieldName: component.props.field_name || "action_menu",
|
|
5158
|
+
componentType: component.type,
|
|
5159
|
+
assistantMessageId
|
|
5160
|
+
});
|
|
5161
|
+
if (isConfirmed) return null;
|
|
5162
|
+
const label = component.props.label;
|
|
5163
|
+
const actions = component.actions ?? [];
|
|
5164
|
+
if (actions.length === 0) return null;
|
|
5165
|
+
return /* @__PURE__ */ jsxs(
|
|
5166
|
+
"div",
|
|
5167
|
+
{
|
|
5168
|
+
className: "px-chat-action-menu",
|
|
5169
|
+
style: { display: "flex", flexDirection: "column", gap: "8px" },
|
|
5170
|
+
children: [
|
|
5171
|
+
label && /* @__PURE__ */ jsx("div", { style: { fontWeight: 500 }, children: label }),
|
|
5172
|
+
/* @__PURE__ */ jsx("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" }, children: actions.map((a) => /* @__PURE__ */ jsx(
|
|
5173
|
+
Button$1,
|
|
5174
|
+
{
|
|
5175
|
+
variant: a.intent === "primary" ? "primary" : "secondary",
|
|
5176
|
+
onClick: () => emitInteraction(a.value ?? a.id, a.label, a.id),
|
|
5177
|
+
children: a.label
|
|
5178
|
+
},
|
|
5179
|
+
a.id
|
|
5180
|
+
)) })
|
|
5181
|
+
]
|
|
5182
|
+
}
|
|
5183
|
+
);
|
|
5184
|
+
};
|
|
5185
|
+
|
|
5150
5186
|
const COMPONENT_MAP = {
|
|
5151
5187
|
select: SelectWithConfirm,
|
|
5152
5188
|
select_multiple: SelectMultipleWithConfirm,
|
|
@@ -5157,7 +5193,8 @@ const COMPONENT_MAP = {
|
|
|
5157
5193
|
card: CardDisplay,
|
|
5158
5194
|
badge: BadgeDisplay,
|
|
5159
5195
|
reactive_form: ReactiveForm,
|
|
5160
|
-
carousel: CarouselDisplay
|
|
5196
|
+
carousel: CarouselDisplay,
|
|
5197
|
+
action_menu: ActionMenu
|
|
5161
5198
|
};
|
|
5162
5199
|
function renderComponent(props) {
|
|
5163
5200
|
const { component } = props;
|
package/dist/index.js
CHANGED
|
@@ -5168,6 +5168,42 @@ const CarouselDisplay = ({
|
|
|
5168
5168
|
] });
|
|
5169
5169
|
};
|
|
5170
5170
|
|
|
5171
|
+
const ActionMenu = ({
|
|
5172
|
+
component,
|
|
5173
|
+
eventBus,
|
|
5174
|
+
assistantMessageId = ""
|
|
5175
|
+
}) => {
|
|
5176
|
+
const { emitInteraction, isConfirmed } = useComponentInteraction({
|
|
5177
|
+
eventBus,
|
|
5178
|
+
fieldName: component.props.field_name || "action_menu",
|
|
5179
|
+
componentType: component.type,
|
|
5180
|
+
assistantMessageId
|
|
5181
|
+
});
|
|
5182
|
+
if (isConfirmed) return null;
|
|
5183
|
+
const label = component.props.label;
|
|
5184
|
+
const actions = component.actions ?? [];
|
|
5185
|
+
if (actions.length === 0) return null;
|
|
5186
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5187
|
+
"div",
|
|
5188
|
+
{
|
|
5189
|
+
className: "px-chat-action-menu",
|
|
5190
|
+
style: { display: "flex", flexDirection: "column", gap: "8px" },
|
|
5191
|
+
children: [
|
|
5192
|
+
label && /* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontWeight: 500 }, children: label }),
|
|
5193
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { display: "flex", gap: "8px", flexWrap: "wrap" }, children: actions.map((a) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
5194
|
+
Button$1,
|
|
5195
|
+
{
|
|
5196
|
+
variant: a.intent === "primary" ? "primary" : "secondary",
|
|
5197
|
+
onClick: () => emitInteraction(a.value ?? a.id, a.label, a.id),
|
|
5198
|
+
children: a.label
|
|
5199
|
+
},
|
|
5200
|
+
a.id
|
|
5201
|
+
)) })
|
|
5202
|
+
]
|
|
5203
|
+
}
|
|
5204
|
+
);
|
|
5205
|
+
};
|
|
5206
|
+
|
|
5171
5207
|
const COMPONENT_MAP = {
|
|
5172
5208
|
select: SelectWithConfirm,
|
|
5173
5209
|
select_multiple: SelectMultipleWithConfirm,
|
|
@@ -5178,7 +5214,8 @@ const COMPONENT_MAP = {
|
|
|
5178
5214
|
card: CardDisplay,
|
|
5179
5215
|
badge: BadgeDisplay,
|
|
5180
5216
|
reactive_form: ReactiveForm,
|
|
5181
|
-
carousel: CarouselDisplay
|
|
5217
|
+
carousel: CarouselDisplay,
|
|
5218
|
+
action_menu: ActionMenu
|
|
5182
5219
|
};
|
|
5183
5220
|
function renderComponent(props) {
|
|
5184
5221
|
const { component } = props;
|