@growth-operations/ui-shared 1.6.2 → 1.6.3
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/package.json +1 -1
- package/src/forms/OptionSelect.jsx +18 -1
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
|
-
import { Select, LoadingSpinner, Alert, Flex, Text } from "@hubspot/ui-extensions";
|
|
2
|
+
import { Select, LoadingSpinner, Alert, Flex, Text, Link } from "@hubspot/ui-extensions";
|
|
3
3
|
import { useToken } from "../sdk/index";
|
|
4
4
|
import { getForms } from "../sdk/hubspot/forms";
|
|
5
5
|
import { getLists } from "../sdk/hubspot/lists";
|
|
@@ -55,6 +55,12 @@ export function OptionSelect({
|
|
|
55
55
|
label = "Select",
|
|
56
56
|
description,
|
|
57
57
|
placeholder = "Choose…",
|
|
58
|
+
// Optional action links rendered beside the dropdown (e.g. "Create new list",
|
|
59
|
+
// "Edit form") — the affordances the per-app FormSelector/SegmentSelector used
|
|
60
|
+
// to have. Each: { label, url }. Rendered as external links (new tab). When a
|
|
61
|
+
// url is null/absent the link is skipped, so callers can pass an "Edit" action
|
|
62
|
+
// gated on a selected value.
|
|
63
|
+
actions = [],
|
|
58
64
|
// Extra source args (pipelineId/objectType for pipelineStages, query for lists)
|
|
59
65
|
...opts
|
|
60
66
|
}) {
|
|
@@ -100,6 +106,8 @@ export function OptionSelect({
|
|
|
100
106
|
);
|
|
101
107
|
}
|
|
102
108
|
|
|
109
|
+
const actionLinks = (actions || []).filter((a) => a && a.url);
|
|
110
|
+
|
|
103
111
|
return (
|
|
104
112
|
<Flex direction="column" gap="extra-small">
|
|
105
113
|
<Select
|
|
@@ -110,6 +118,15 @@ export function OptionSelect({
|
|
|
110
118
|
value={value ?? ""}
|
|
111
119
|
onChange={(v) => onChange?.(v)}
|
|
112
120
|
/>
|
|
121
|
+
{actionLinks.length > 0 && (
|
|
122
|
+
<Flex direction="row" gap="small">
|
|
123
|
+
{actionLinks.map((a) => (
|
|
124
|
+
<Link key={a.label} href={{ url: a.url, external: true }}>
|
|
125
|
+
{a.label}
|
|
126
|
+
</Link>
|
|
127
|
+
))}
|
|
128
|
+
</Flex>
|
|
129
|
+
)}
|
|
113
130
|
</Flex>
|
|
114
131
|
);
|
|
115
132
|
}
|