@pollinations/ui 0.1.0-alpha.12 → 0.1.0-alpha.14

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.cts CHANGED
@@ -345,6 +345,7 @@ type FieldStackProps = {
345
345
  helperClassName?: string;
346
346
  errorClassName?: string;
347
347
  };
348
+ /** Use one text control per field; group multiple controls separately. */
348
349
  declare function FieldStack({ label, children, helper, action, error, alignLabelRow, orientation, className, labelClassName, helperClassName, errorClassName, }: FieldStackProps): react_jsx_runtime.JSX.Element;
349
350
 
350
351
  type RejectReason = "type" | "size" | "count";
@@ -690,7 +691,7 @@ declare const ChevronIcon: FC<ChevronIconProps>;
690
691
  * document head, reading the same key) to avoid a flash of light before React
691
692
  * mounts; this store is the source of truth after hydration.
692
693
  *
693
- * Side-effect-free on import: the <html> sync and the cross-tab listener are
694
+ * Side-effect-free on import: the <html> sync and browser listeners are
694
695
  * attached lazily on first subscribe, so importing this module (e.g. via the
695
696
  * package barrel) never mutates the DOM on its own.
696
697
  */
package/dist/index.d.ts CHANGED
@@ -345,6 +345,7 @@ type FieldStackProps = {
345
345
  helperClassName?: string;
346
346
  errorClassName?: string;
347
347
  };
348
+ /** Use one text control per field; group multiple controls separately. */
348
349
  declare function FieldStack({ label, children, helper, action, error, alignLabelRow, orientation, className, labelClassName, helperClassName, errorClassName, }: FieldStackProps): react_jsx_runtime.JSX.Element;
349
350
 
350
351
  type RejectReason = "type" | "size" | "count";
@@ -690,7 +691,7 @@ declare const ChevronIcon: FC<ChevronIconProps>;
690
691
  * document head, reading the same key) to avoid a flash of light before React
691
692
  * mounts; this store is the source of truth after hydration.
692
693
  *
693
- * Side-effect-free on import: the <html> sync and the cross-tab listener are
694
+ * Side-effect-free on import: the <html> sync and browser listeners are
694
695
  * attached lazily on first subscribe, so importing this module (e.g. via the
695
696
  * package barrel) never mutates the DOM on its own.
696
697
  */
package/dist/index.js CHANGED
@@ -1417,13 +1417,19 @@ import {
1417
1417
 
1418
1418
  // src/primitives/Textarea.tsx
1419
1419
  import { forwardRef as forwardRef3 } from "react";
1420
+
1421
+ // src/primitives/Field.tsx
1422
+ import { Field } from "@ark-ui/react/field";
1423
+
1424
+ // src/primitives/Textarea.tsx
1420
1425
  import { jsx as jsx15 } from "react/jsx-runtime";
1421
1426
  var Textarea = forwardRef3(
1422
1427
  ({ className, error, rows = 4, ...props }, ref) => /* @__PURE__ */ jsx15(
1423
- "textarea",
1428
+ Field.Textarea,
1424
1429
  {
1425
1430
  ref,
1426
1431
  rows,
1432
+ "aria-invalid": error || void 0,
1427
1433
  "data-error": error ? "true" : void 0,
1428
1434
  className: cn(
1429
1435
  "polli-textarea polli:w-full polli:rounded-lg polli:border polli:px-3 polli:py-2",
@@ -1692,8 +1698,10 @@ var Tooltip = ({
1692
1698
  });
1693
1699
  }
1694
1700
  };
1701
+ const isControl = triggerAs === "button" || tapEnabled;
1695
1702
  const triggerClassName = cn(
1696
- "polli-control polli:relative polli:cursor-help polli:text-left polli:inline-flex polli:items-center",
1703
+ isControl && "polli-control",
1704
+ "polli:relative polli:cursor-help polli:text-left polli:inline-flex polli:items-center",
1697
1705
  className
1698
1706
  );
1699
1707
  const cursorClass = displayContents ? "polli:contents" : "polli:cursor-inherit";
@@ -2369,9 +2377,10 @@ import { forwardRef as forwardRef5 } from "react";
2369
2377
  import { jsx as jsx27 } from "react/jsx-runtime";
2370
2378
  var Input = forwardRef5(
2371
2379
  ({ className, error, hideNumberSteppers, ...props }, ref) => /* @__PURE__ */ jsx27(
2372
- "input",
2380
+ Field.Input,
2373
2381
  {
2374
2382
  ref,
2383
+ "aria-invalid": error || void 0,
2375
2384
  "data-error": error ? "true" : void 0,
2376
2385
  className: cn(
2377
2386
  "polli-input polli:px-3 polli:py-2 polli:border polli:rounded-lg",
@@ -2639,9 +2648,6 @@ function ExternalLinkButton(props) {
2639
2648
  );
2640
2649
  }
2641
2650
 
2642
- // src/primitives/Field.tsx
2643
- import { Field } from "@ark-ui/react/field";
2644
-
2645
2651
  // src/compositions/FieldStack.tsx
2646
2652
  import { jsx as jsx31, jsxs as jsxs21 } from "react/jsx-runtime";
2647
2653
  var orientationClasses = {
@@ -4517,6 +4523,7 @@ function systemMode() {
4517
4523
  }
4518
4524
  var current = readStored() ?? systemMode();
4519
4525
  var listeners = /* @__PURE__ */ new Set();
4526
+ var systemQuery;
4520
4527
  function apply() {
4521
4528
  if (typeof document === "undefined") return;
4522
4529
  document.documentElement.classList.toggle("dark", current === "dark");
@@ -4545,16 +4552,28 @@ function handleStorage(event) {
4545
4552
  apply();
4546
4553
  emit();
4547
4554
  }
4555
+ function handleSystemChange() {
4556
+ if (readStored() !== null) return;
4557
+ const next = systemMode();
4558
+ if (next === current) return;
4559
+ current = next;
4560
+ apply();
4561
+ emit();
4562
+ }
4548
4563
  function subscribe(listener) {
4549
4564
  if (listeners.size === 0 && typeof window !== "undefined") {
4550
4565
  apply();
4551
4566
  window.addEventListener("storage", handleStorage);
4567
+ systemQuery = window.matchMedia?.("(prefers-color-scheme: dark)");
4568
+ systemQuery?.addEventListener("change", handleSystemChange);
4552
4569
  }
4553
4570
  listeners.add(listener);
4554
4571
  return () => {
4555
4572
  listeners.delete(listener);
4556
4573
  if (listeners.size === 0 && typeof window !== "undefined") {
4557
4574
  window.removeEventListener("storage", handleStorage);
4575
+ systemQuery?.removeEventListener("change", handleSystemChange);
4576
+ systemQuery = void 0;
4558
4577
  }
4559
4578
  };
4560
4579
  }