@pollinations/ui 0.1.0-alpha.30 → 0.1.0-alpha.32

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.d.ts CHANGED
@@ -253,18 +253,26 @@ type CopyButtonProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"
253
253
  };
254
254
  declare function CopyButton({ value, children, copiedTimeoutMs, tooltip, tooltipAlign, tooltipClampToViewport, tooltipMaxWidth, copiedTooltip, tooltipClassName, className, variant, intent, onCopied, onCopyError, ...buttonProps }: CopyButtonProps): react_jsx_runtime.JSX.Element;
255
255
 
256
+ declare const sizeClasses$1: {
257
+ 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";
258
+ 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";
259
+ };
256
260
  type CopyFieldProps = Pick<CopyButtonProps, "value" | "onCopied" | "onCopyError" | "copiedTimeoutMs"> & {
257
261
  /** Accessible name, e.g. "Copy secret key". */
258
262
  label: string;
259
263
  /** What to show; defaults to a string value or the label for lazy values. */
260
264
  display?: ReactNode;
265
+ /** `md` (default) looks like a field; `sm` like a small button. */
266
+ size?: keyof typeof sizeClasses$1;
261
267
  className?: string;
262
268
  };
263
269
  /**
264
270
  * 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.
271
+ * button. The whole surface copies on click; only the end icon confirms, so
272
+ * the value stays put. The focus ring is for keyboard focus only, not the
273
+ * click that copied.
266
274
  */
267
- declare function CopyField({ value, label, display, className, ...copy }: CopyFieldProps): react_jsx_runtime.JSX.Element;
275
+ declare function CopyField({ value, label, display, size, className, ...copy }: CopyFieldProps): react_jsx_runtime.JSX.Element;
268
276
 
269
277
  type InputProps = React.ComponentPropsWithoutRef<"input"> & {
270
278
  error?: boolean;
package/dist/index.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  Switch,
13
13
  setColorMode,
14
14
  useColorMode
15
- } from "./chunk-FRHLA7LM.js";
15
+ } from "./chunk-DLKKLAD7.js";
16
16
  import {
17
17
  AccountIdentity,
18
18
  AccountIdentityLink,
@@ -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
  }) {
@@ -743,21 +748,26 @@ function CopyField({
743
748
  value,
744
749
  tooltip: null,
745
750
  "aria-label": label,
746
- className: (copied) => cn(
747
- "polli-input-shell polli:flex polli:min-h-10 polli:w-full polli:cursor-pointer polli:items-center polli:gap-3 polli:rounded-lg polli:border polli:px-3 polli:py-2 polli:text-left polli:font-mono polli:text-xs polli:transition-colors",
748
- copied ? "polli:text-intent-success-text" : "polli:text-theme-text-base polli:hover:text-theme-text-strong",
751
+ className: cn(
752
+ "polli:flex polli:w-full polli:cursor-pointer polli:items-center polli:text-left polli:font-mono polli:text-xs polli:transition-colors",
753
+ sizeClasses2[size],
754
+ "polli:outline-none polli:focus-visible:outline-2 polli:focus-visible:-outline-offset-1 polli:focus-visible:outline-[var(--polli-color-focus)]",
749
755
  className
750
756
  ),
751
757
  children: (copied) => /* @__PURE__ */ jsxs10(Fragment3, { children: [
752
- /* @__PURE__ */ jsx12("span", { className: "polli:min-w-0 polli:flex-1 polli:select-all polli:break-all", children: copied ? "Copied" : display ?? (typeof value === "string" ? value : label) }),
758
+ /* @__PURE__ */ jsx12("span", { className: "polli:min-w-0 polli:flex-1 polli:wrap-anywhere", children: display ?? (typeof value === "string" ? value : label) }),
753
759
  /* @__PURE__ */ jsx12(
754
760
  "span",
755
761
  {
756
762
  "aria-hidden": "true",
757
- className: "polli:flex polli:size-4 polli:shrink-0 polli:[&>svg]:size-full",
763
+ className: cn(
764
+ "polli:flex polli:shrink-0 polli:[&>svg]:size-full",
765
+ size === "sm" ? "polli:size-3.5" : "polli:size-4"
766
+ ),
758
767
  children: /* @__PURE__ */ jsx12(CopyStateIcon, { copied })
759
768
  }
760
- )
769
+ ),
770
+ /* @__PURE__ */ jsx12("span", { className: "polli:sr-only", "aria-live": "polite", children: copied ? "Copied" : "" })
761
771
  ] })
762
772
  }
763
773
  );
@@ -1203,7 +1213,7 @@ var variantHoverClasses = {
1203
1213
  tile: "polli:hover:bg-theme-bg-hover polli:hover:text-theme-text-hover",
1204
1214
  ghost: "polli:hover:bg-transparent polli:hover:text-theme-text-soft"
1205
1215
  };
1206
- var sizeClasses2 = {
1216
+ var sizeClasses3 = {
1207
1217
  sm: "polli:h-6 polli:w-6 polli:rounded",
1208
1218
  md: "polli:h-9 polli:w-9 polli:rounded-full"
1209
1219
  };
@@ -1231,7 +1241,7 @@ var IconButton = forwardRef5(
1231
1241
  className: cn(
1232
1242
  "polli-control polli:inline-flex polli:items-center polli:justify-center polli:transition-colors",
1233
1243
  disabled ? "polli:cursor-not-allowed polli:opacity-50" : "polli:cursor-pointer",
1234
- sizeClasses2[size],
1244
+ sizeClasses3[size],
1235
1245
  intent ? intentClasses[intent] : variantClasses[variant],
1236
1246
  !disabled && (intent ? intentHoverClasses[intent] : variantHoverClasses[variant]),
1237
1247
  className