@pollinations/ui 0.1.0-alpha.31 → 0.1.0-alpha.33
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/README.md +1 -1
- package/dist/{chunk-2BI7XJMG.js → chunk-ZQGGDZVD.js} +21 -22
- package/dist/chunk-ZQGGDZVD.js.map +1 -0
- package/dist/connect.js +5 -5
- package/dist/connect.js.map +1 -1
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/index.d.ts +17 -8
- package/dist/index.js +21 -25
- package/dist/index.js.map +1 -1
- package/dist/markdown.js +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/chunk-2BI7XJMG.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -229,20 +229,21 @@ type ContentHeaderProps = {
|
|
|
229
229
|
/** Shared page/section heading rhythm with an optional trailing action. */
|
|
230
230
|
declare function ContentHeader({ eyebrow, title, subtitle, action, variant, className, }: ContentHeaderProps): react_jsx_runtime.JSX.Element;
|
|
231
231
|
|
|
232
|
-
/** The copy state as an icon: a clipboard, then
|
|
233
|
-
|
|
232
|
+
/** The copy state as an icon: a clipboard, then an amber check once copied.
|
|
233
|
+
* The icon is the only thing a copy changes: labels and colours stay put. */
|
|
234
|
+
declare function CopyStateIcon({ copied, className, ...props }: IconProps & {
|
|
234
235
|
copied: boolean;
|
|
235
236
|
}): react_jsx_runtime.JSX.Element;
|
|
236
237
|
type CopyValue = string | (() => string | Promise<string>);
|
|
237
238
|
type CopyButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children" | "className" | "onClick" | "type" | "value"> & {
|
|
238
239
|
value: CopyValue;
|
|
239
240
|
children: ReactNode | ((copied: boolean) => ReactNode);
|
|
240
|
-
|
|
241
|
+
/** Extra hover content, e.g. the full value behind a short label. Copy
|
|
242
|
+
* buttons don't need one to say "copy": the icon does. */
|
|
241
243
|
tooltip?: ReactNode;
|
|
242
244
|
tooltipAlign?: "start" | "center";
|
|
243
245
|
tooltipClampToViewport?: boolean;
|
|
244
246
|
tooltipMaxWidth?: number;
|
|
245
|
-
copiedTooltip?: ReactNode;
|
|
246
247
|
tooltipClassName?: string;
|
|
247
248
|
className?: string | ((copied: boolean) => string);
|
|
248
249
|
variant?: "plain" | "button";
|
|
@@ -251,20 +252,28 @@ type CopyButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"
|
|
|
251
252
|
onCopied?: () => void;
|
|
252
253
|
onCopyError?: (error: unknown) => void;
|
|
253
254
|
};
|
|
254
|
-
declare function CopyButton({ value, children,
|
|
255
|
+
declare function CopyButton({ value, children, tooltip, tooltipAlign, tooltipClampToViewport, tooltipMaxWidth, tooltipClassName, className, variant, intent, onCopied, onCopyError, ...buttonProps }: CopyButtonProps): react_jsx_runtime.JSX.Element;
|
|
255
256
|
|
|
256
|
-
|
|
257
|
+
declare const sizeClasses$1: {
|
|
258
|
+
readonly md: "polli:min-h-10 polli:gap-3 polli:rounded-lg polli:border polli:border-divider polli:bg-theme-bg-pale polli:px-3 polli:py-2 polli:text-theme-text-base polli:hover:text-theme-text-strong";
|
|
259
|
+
readonly sm: "polli:min-h-7 polli:gap-2 polli:rounded-[0.875rem] polli:bg-theme-bg-subtle polli:px-3 polli:py-1 polli:text-theme-text-base polli:hover:bg-theme-text-muted/25 polli:hover:text-theme-text-strong";
|
|
260
|
+
};
|
|
261
|
+
type CopyFieldProps = Pick<CopyButtonProps, "value" | "onCopied" | "onCopyError"> & {
|
|
257
262
|
/** Accessible name, e.g. "Copy secret key". */
|
|
258
263
|
label: string;
|
|
259
264
|
/** What to show; defaults to a string value or the label for lazy values. */
|
|
260
265
|
display?: ReactNode;
|
|
266
|
+
/** `md` (default) looks like a field; `sm` like a small button. */
|
|
267
|
+
size?: keyof typeof sizeClasses$1;
|
|
261
268
|
className?: string;
|
|
262
269
|
};
|
|
263
270
|
/**
|
|
264
271
|
* A value the user copies but never edits: looks like a field, behaves like a
|
|
265
|
-
* button. The whole surface copies on click; the end icon confirms
|
|
272
|
+
* button. The whole surface copies on click; only the end icon confirms, so
|
|
273
|
+
* the value stays put. The focus ring is for keyboard focus only, not the
|
|
274
|
+
* click that copied.
|
|
266
275
|
*/
|
|
267
|
-
declare function CopyField({ value, label, display, className, ...copy }: CopyFieldProps): react_jsx_runtime.JSX.Element;
|
|
276
|
+
declare function CopyField({ value, label, display, size, className, ...copy }: CopyFieldProps): react_jsx_runtime.JSX.Element;
|
|
268
277
|
|
|
269
278
|
type InputProps = React.ComponentPropsWithoutRef<"input"> & {
|
|
270
279
|
error?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
CopyButton,
|
|
39
39
|
CopyStateIcon,
|
|
40
40
|
Tooltip
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-ZQGGDZVD.js";
|
|
42
42
|
import {
|
|
43
43
|
Heading,
|
|
44
44
|
Text
|
|
@@ -729,10 +729,15 @@ function ContentHeader({
|
|
|
729
729
|
|
|
730
730
|
// src/compositions/CopyField.tsx
|
|
731
731
|
import { Fragment as Fragment3, jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
732
|
+
var sizeClasses2 = {
|
|
733
|
+
md: "polli:min-h-10 polli:gap-3 polli:rounded-lg polli:border polli:border-divider polli:bg-theme-bg-pale polli:px-3 polli:py-2 polli:text-theme-text-base polli:hover:text-theme-text-strong",
|
|
734
|
+
sm: "polli:min-h-7 polli:gap-2 polli:rounded-[0.875rem] polli:bg-theme-bg-subtle polli:px-3 polli:py-1 polli:text-theme-text-base polli:hover:bg-theme-text-muted/25 polli:hover:text-theme-text-strong"
|
|
735
|
+
};
|
|
732
736
|
function CopyField({
|
|
733
737
|
value,
|
|
734
738
|
label,
|
|
735
739
|
display,
|
|
740
|
+
size = "md",
|
|
736
741
|
className,
|
|
737
742
|
...copy
|
|
738
743
|
}) {
|
|
@@ -741,20 +746,23 @@ function CopyField({
|
|
|
741
746
|
{
|
|
742
747
|
...copy,
|
|
743
748
|
value,
|
|
744
|
-
tooltip: null,
|
|
745
749
|
"aria-label": label,
|
|
746
|
-
className:
|
|
747
|
-
"polli
|
|
748
|
-
|
|
750
|
+
className: cn(
|
|
751
|
+
"polli:flex polli:w-full polli:cursor-pointer polli:items-center polli:text-left polli:font-mono polli:text-xs polli:transition-colors",
|
|
752
|
+
sizeClasses2[size],
|
|
753
|
+
"polli:outline-none polli:focus-visible:outline-2 polli:focus-visible:-outline-offset-1 polli:focus-visible:outline-[var(--polli-color-focus)]",
|
|
749
754
|
className
|
|
750
755
|
),
|
|
751
756
|
children: (copied) => /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
752
|
-
/* @__PURE__ */ jsx12("span", { className: "polli:min-w-0 polli:flex-1 polli:
|
|
757
|
+
/* @__PURE__ */ jsx12("span", { className: "polli:min-w-0 polli:flex-1 polli:wrap-anywhere", children: display ?? (typeof value === "string" ? value : label) }),
|
|
753
758
|
/* @__PURE__ */ jsx12(
|
|
754
759
|
"span",
|
|
755
760
|
{
|
|
756
761
|
"aria-hidden": "true",
|
|
757
|
-
className:
|
|
762
|
+
className: cn(
|
|
763
|
+
"polli:flex polli:shrink-0 polli:[&>svg]:size-full",
|
|
764
|
+
size === "sm" ? "polli:size-3.5" : "polli:size-4"
|
|
765
|
+
),
|
|
758
766
|
children: /* @__PURE__ */ jsx12(CopyStateIcon, { copied })
|
|
759
767
|
}
|
|
760
768
|
)
|
|
@@ -1203,7 +1211,7 @@ var variantHoverClasses = {
|
|
|
1203
1211
|
tile: "polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover",
|
|
1204
1212
|
ghost: "polli:hover:bg-transparent polli:hover:text-theme-text-soft"
|
|
1205
1213
|
};
|
|
1206
|
-
var
|
|
1214
|
+
var sizeClasses3 = {
|
|
1207
1215
|
sm: "polli:h-6 polli:w-6 polli:rounded",
|
|
1208
1216
|
md: "polli:h-9 polli:w-9 polli:rounded-full"
|
|
1209
1217
|
};
|
|
@@ -1231,7 +1239,7 @@ var IconButton = forwardRef5(
|
|
|
1231
1239
|
className: cn(
|
|
1232
1240
|
"polli-control polli:inline-flex polli:items-center polli:justify-center polli:transition-colors",
|
|
1233
1241
|
disabled ? "polli:cursor-not-allowed polli:opacity-50" : "polli:cursor-pointer",
|
|
1234
|
-
|
|
1242
|
+
sizeClasses3[size],
|
|
1235
1243
|
intent ? intentClasses[intent] : variantClasses[variant],
|
|
1236
1244
|
!disabled && (intent ? intentHoverClasses[intent] : variantHoverClasses[variant]),
|
|
1237
1245
|
className
|
|
@@ -1524,24 +1532,12 @@ function KeyChip({
|
|
|
1524
1532
|
CopyButton,
|
|
1525
1533
|
{
|
|
1526
1534
|
value,
|
|
1527
|
-
tooltip: null,
|
|
1528
1535
|
"aria-label": label,
|
|
1529
1536
|
className: "polli:inline-flex polli:cursor-pointer polli:rounded-lg",
|
|
1530
|
-
children: (copied) => /* @__PURE__ */ jsxs15(
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
className: cn(
|
|
1535
|
-
chipClassName,
|
|
1536
|
-
"polli:transition-colors",
|
|
1537
|
-
className
|
|
1538
|
-
),
|
|
1539
|
-
children: [
|
|
1540
|
-
/* @__PURE__ */ jsx21(CopyStateIcon, { copied, "aria-hidden": "true" }),
|
|
1541
|
-
copied ? "Copied" : text
|
|
1542
|
-
]
|
|
1543
|
-
}
|
|
1544
|
-
)
|
|
1537
|
+
children: (copied) => /* @__PURE__ */ jsxs15(Chip, { intent: "neutral", className: cn(chipClassName, className), children: [
|
|
1538
|
+
/* @__PURE__ */ jsx21(CopyStateIcon, { copied, "aria-hidden": "true" }),
|
|
1539
|
+
text
|
|
1540
|
+
] })
|
|
1545
1541
|
}
|
|
1546
1542
|
);
|
|
1547
1543
|
}
|