myoperator-ui 0.0.195 → 0.0.197
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/index.js +51 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1941,6 +1941,10 @@ export interface ReadableFieldProps
|
|
|
1941
1941
|
headerAction?: {
|
|
1942
1942
|
label: string;
|
|
1943
1943
|
onClick: () => void;
|
|
1944
|
+
/** When true, button is shown but non-interactive */
|
|
1945
|
+
disabled?: boolean;
|
|
1946
|
+
/** Tooltip text shown on hover when disabled */
|
|
1947
|
+
disabledTooltip?: string;
|
|
1944
1948
|
};
|
|
1945
1949
|
/** Callback when value is copied */
|
|
1946
1950
|
onValueCopy?: (value: string) => void;
|
|
@@ -2041,13 +2045,31 @@ export const ReadableField = React.forwardRef<HTMLDivElement, ReadableFieldProps
|
|
|
2041
2045
|
{label}
|
|
2042
2046
|
</span>
|
|
2043
2047
|
{headerAction && (
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2048
|
+
headerAction.disabled ? (
|
|
2049
|
+
<span className="relative group/regen-action">
|
|
2050
|
+
<button
|
|
2051
|
+
type="button"
|
|
2052
|
+
disabled
|
|
2053
|
+
className="text-sm font-semibold text-semantic-text-muted tracking-[0.014px] opacity-50 cursor-not-allowed rounded"
|
|
2054
|
+
>
|
|
2055
|
+
{headerAction.label}
|
|
2056
|
+
</button>
|
|
2057
|
+
{headerAction.disabledTooltip && (
|
|
2058
|
+
<span className="pointer-events-none absolute bottom-full right-0 mb-2 whitespace-nowrap rounded bg-semantic-primary px-2 py-1 text-xs text-semantic-text-inverted opacity-0 transition-opacity group-hover/regen-action:opacity-100 z-10">
|
|
2059
|
+
{headerAction.disabledTooltip}
|
|
2060
|
+
<span className="absolute top-full right-2 border-4 border-transparent border-t-semantic-primary" />
|
|
2061
|
+
</span>
|
|
2062
|
+
)}
|
|
2063
|
+
</span>
|
|
2064
|
+
) : (
|
|
2065
|
+
<button
|
|
2066
|
+
type="button"
|
|
2067
|
+
onClick={headerAction.onClick}
|
|
2068
|
+
className="text-sm font-semibold text-semantic-text-muted tracking-[0.014px] hover:text-semantic-text-primary focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-semantic-text-primary rounded transition-colors"
|
|
2069
|
+
>
|
|
2070
|
+
{headerAction.label}
|
|
2071
|
+
</button>
|
|
2072
|
+
)
|
|
2051
2073
|
)}
|
|
2052
2074
|
</div>
|
|
2053
2075
|
|
|
@@ -7607,6 +7629,12 @@ export interface EndpointDetailsProps
|
|
|
7607
7629
|
onValueCopy?: (field: string, value: string) => void;
|
|
7608
7630
|
/** Callback when regenerate is clicked for a field */
|
|
7609
7631
|
onRegenerate?: (field: "authToken" | "secretKey") => void;
|
|
7632
|
+
/** When false, regenerate buttons are hidden entirely */
|
|
7633
|
+
showRegenerate?: boolean;
|
|
7634
|
+
/** When false, regenerate buttons are visible but disabled */
|
|
7635
|
+
canRegenerate?: boolean;
|
|
7636
|
+
/** Tooltip text shown on hover when regenerate is disabled. Only used when canRegenerate is false */
|
|
7637
|
+
regenerateDisabledTooltip?: string;
|
|
7610
7638
|
/** Callback when revoke access is clicked - only used in calling variant */
|
|
7611
7639
|
onRevokeAccess?: () => void;
|
|
7612
7640
|
/** Whether to show the revoke access section - only used in calling variant */
|
|
@@ -7664,6 +7692,9 @@ export const EndpointDetails = React.forwardRef<
|
|
|
7664
7692
|
apiKey,
|
|
7665
7693
|
onValueCopy,
|
|
7666
7694
|
onRegenerate,
|
|
7695
|
+
showRegenerate = true,
|
|
7696
|
+
canRegenerate = true,
|
|
7697
|
+
regenerateDisabledTooltip = "You are not allowed to regenerate this token",
|
|
7667
7698
|
onRevokeAccess,
|
|
7668
7699
|
showRevokeSection = true,
|
|
7669
7700
|
revokeTitle = "Revoke API Access",
|
|
@@ -7679,6 +7710,16 @@ export const EndpointDetails = React.forwardRef<
|
|
|
7679
7710
|
onValueCopy?.(field, value);
|
|
7680
7711
|
};
|
|
7681
7712
|
|
|
7713
|
+
const buildRegenerateAction = (field: "authToken" | "secretKey") => {
|
|
7714
|
+
if (!showRegenerate) return undefined;
|
|
7715
|
+
return {
|
|
7716
|
+
label: "Regenerate",
|
|
7717
|
+
onClick: () => onRegenerate?.(field),
|
|
7718
|
+
disabled: !canRegenerate,
|
|
7719
|
+
disabledTooltip: !canRegenerate ? regenerateDisabledTooltip : undefined,
|
|
7720
|
+
};
|
|
7721
|
+
};
|
|
7722
|
+
|
|
7682
7723
|
// Collect non-secret visible fields for the top rows
|
|
7683
7724
|
const topFields: Array<{ label: string; value: string; field: string }> =
|
|
7684
7725
|
[];
|
|
@@ -7746,10 +7787,7 @@ export const EndpointDetails = React.forwardRef<
|
|
|
7746
7787
|
value={authToken}
|
|
7747
7788
|
secret
|
|
7748
7789
|
helperText="Used for client-side integrations."
|
|
7749
|
-
headerAction={
|
|
7750
|
-
label: "Regenerate",
|
|
7751
|
-
onClick: () => onRegenerate?.("authToken"),
|
|
7752
|
-
}}
|
|
7790
|
+
headerAction={buildRegenerateAction("authToken")}
|
|
7753
7791
|
onValueCopy={handleCopy("authToken")}
|
|
7754
7792
|
/>
|
|
7755
7793
|
{secretKey && (
|
|
@@ -7758,10 +7796,7 @@ export const EndpointDetails = React.forwardRef<
|
|
|
7758
7796
|
value={secretKey}
|
|
7759
7797
|
secret
|
|
7760
7798
|
helperText="Never share this key or expose it in client-side code."
|
|
7761
|
-
headerAction={
|
|
7762
|
-
label: "Regenerate",
|
|
7763
|
-
onClick: () => onRegenerate?.("secretKey"),
|
|
7764
|
-
}}
|
|
7799
|
+
headerAction={buildRegenerateAction("secretKey")}
|
|
7765
7800
|
onValueCopy={handleCopy("secretKey")}
|
|
7766
7801
|
/>
|
|
7767
7802
|
)}
|
|
@@ -7772,10 +7807,7 @@ export const EndpointDetails = React.forwardRef<
|
|
|
7772
7807
|
label="Authentication"
|
|
7773
7808
|
value={authToken}
|
|
7774
7809
|
secret
|
|
7775
|
-
headerAction={
|
|
7776
|
-
label: "Regenerate",
|
|
7777
|
-
onClick: () => onRegenerate?.("authToken"),
|
|
7778
|
-
}}
|
|
7810
|
+
headerAction={buildRegenerateAction("authToken")}
|
|
7779
7811
|
onValueCopy={handleCopy("authToken")}
|
|
7780
7812
|
/>
|
|
7781
7813
|
)}
|