@pollinations/ui 0.1.0-alpha.11 → 0.1.0-alpha.13

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.
@@ -775,7 +775,7 @@ function ErrorBanner({ children }) {
775
775
  }
776
776
  function AuthInfoCard({ title, children }) {
777
777
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(Surface, { className: "polli:space-y-3 polli:font-body", children: [
778
- title != null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "polli:font-body polli:text-sm polli:font-semibold polli:leading-5 polli:text-theme-text-strong", children: title }),
778
+ title != null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { className: "polli:flex polli:items-center polli:font-body polli:text-xs polli:font-medium polli:leading-5 polli:text-theme-text-muted", children: title }),
779
779
  children
780
780
  ] });
781
781
  }
@@ -788,36 +788,47 @@ function AuthAccessItem({
788
788
  checked = false,
789
789
  onChange,
790
790
  ariaLabel,
791
- disabled = false
791
+ disabled = false,
792
+ inputRef,
793
+ rowClassName
792
794
  }) {
793
- const Row = icon != null ? "div" : "label";
794
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
795
- "li",
796
- {
797
- className: cn(
798
- info != null && "polli:flex polli:flex-wrap polli:items-center"
799
- ),
800
- children: [
801
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
802
- Row,
803
- {
804
- className: cn(
805
- "polli:flex polli:min-h-8 polli:items-center polli:gap-3 polli:font-body polli:text-sm polli:font-semibold polli:leading-5",
806
- info != null && "polli:min-w-0",
807
- onChange && (disabled ? "polli:cursor-not-allowed" : "polli:cursor-pointer")
808
- ),
809
- children: [
810
- icon != null ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
811
- "span",
812
- {
813
- "aria-hidden": "true",
814
- className: "polli:flex polli:h-5 polli:w-5 polli:shrink-0 polli:items-center polli:justify-center polli:text-theme-text-strong polli:[&>svg]:h-4 polli:[&>svg]:w-4",
815
- children: icon
816
- }
817
- ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "polli:relative polli:flex polli:h-5 polli:w-5 polli:shrink-0", children: [
795
+ const inputId = (0, import_react3.useId)();
796
+ const Row = icon != null || info != null ? "div" : "label";
797
+ const CheckboxLabel = info != null ? "label" : "span";
798
+ const Label = icon == null && info != null ? "label" : "span";
799
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("li", { children: [
800
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
801
+ Row,
802
+ {
803
+ className: cn(
804
+ "polli:flex polli:min-h-8 polli:items-center polli:font-body polli:text-sm polli:font-semibold polli:leading-5",
805
+ info != null && icon == null ? "polli:gap-0" : "polli:gap-3",
806
+ info != null && "polli:min-w-0",
807
+ onChange && Row === "label" && (disabled ? "polli:cursor-not-allowed" : "polli:cursor-pointer"),
808
+ rowClassName
809
+ ),
810
+ children: [
811
+ icon != null ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
812
+ "span",
813
+ {
814
+ "aria-hidden": "true",
815
+ className: "polli:flex polli:h-5 polli:w-5 polli:shrink-0 polli:items-center polli:justify-center polli:text-theme-text-strong polli:[&>svg]:h-4 polli:[&>svg]:w-4",
816
+ children: icon
817
+ }
818
+ ) : /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
819
+ CheckboxLabel,
820
+ {
821
+ className: cn(
822
+ "polli:relative polli:flex polli:h-5 polli:shrink-0",
823
+ info != null ? "polli:w-8 polli:pr-3" : "polli:w-5",
824
+ onChange && (disabled ? "polli:cursor-not-allowed" : "polli:cursor-pointer")
825
+ ),
826
+ children: [
818
827
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
819
828
  "input",
820
829
  {
830
+ ref: inputRef,
831
+ id: inputId,
821
832
  type: "checkbox",
822
833
  "aria-label": ariaLabel,
823
834
  checked,
@@ -834,35 +845,30 @@ function AuthAccessItem({
834
845
  children: checked && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(CheckIcon, { className: "polli:h-3.5 polli:w-3.5" })
835
846
  }
836
847
  )
837
- ] }),
838
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
839
- "span",
840
- {
841
- className: cn(
842
- "polli:min-w-0 polli:flex-1 polli:transition-opacity",
843
- !!onChange && !checked && "polli:opacity-60"
844
- ),
845
- children
846
- }
847
- ),
848
- control != null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "polli:shrink-0", children: control })
849
- ]
850
- }
851
- ),
852
- info,
853
- details && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
854
- "div",
855
- {
856
- className: cn(
857
- "polli:pl-8 polli:font-body polli:text-xs polli:font-normal polli:leading-normal polli:text-theme-text-muted",
858
- info != null && "polli:basis-full"
848
+ ]
849
+ }
850
+ ),
851
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("span", { className: "polli:min-w-0 polli:flex-1", children: [
852
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
853
+ Label,
854
+ {
855
+ htmlFor: Label === "label" ? inputId : void 0,
856
+ className: cn(
857
+ "polli:transition-opacity",
858
+ !!onChange && !checked && "polli:opacity-60",
859
+ onChange && (disabled ? "polli:cursor-not-allowed" : "polli:cursor-pointer")
860
+ ),
861
+ children
862
+ }
859
863
  ),
860
- children: details
861
- }
862
- )
863
- ]
864
- }
865
- );
864
+ info
865
+ ] }),
866
+ control != null && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "polli:shrink-0", children: control })
867
+ ]
868
+ }
869
+ ),
870
+ details && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "polli:pl-8 polli:font-body polli:text-xs polli:font-normal polli:leading-normal polli:text-theme-text-muted", children: details })
871
+ ] });
866
872
  }
867
873
 
868
874
  // src/modules/auth/DashboardAccountMenu.tsx
@@ -1302,6 +1308,7 @@ function systemMode() {
1302
1308
  }
1303
1309
  var current = readStored() ?? systemMode();
1304
1310
  var listeners = /* @__PURE__ */ new Set();
1311
+ var systemQuery;
1305
1312
  function apply() {
1306
1313
  if (typeof document === "undefined") return;
1307
1314
  document.documentElement.classList.toggle("dark", current === "dark");
@@ -1330,16 +1337,28 @@ function handleStorage(event) {
1330
1337
  apply();
1331
1338
  emit();
1332
1339
  }
1340
+ function handleSystemChange() {
1341
+ if (readStored() !== null) return;
1342
+ const next = systemMode();
1343
+ if (next === current) return;
1344
+ current = next;
1345
+ apply();
1346
+ emit();
1347
+ }
1333
1348
  function subscribe(listener) {
1334
1349
  if (listeners.size === 0 && typeof window !== "undefined") {
1335
1350
  apply();
1336
1351
  window.addEventListener("storage", handleStorage);
1352
+ systemQuery = window.matchMedia?.("(prefers-color-scheme: dark)");
1353
+ systemQuery?.addEventListener("change", handleSystemChange);
1337
1354
  }
1338
1355
  listeners.add(listener);
1339
1356
  return () => {
1340
1357
  listeners.delete(listener);
1341
1358
  if (listeners.size === 0 && typeof window !== "undefined") {
1342
1359
  window.removeEventListener("storage", handleStorage);
1360
+ systemQuery?.removeEventListener("change", handleSystemChange);
1361
+ systemQuery = void 0;
1343
1362
  }
1344
1363
  };
1345
1364
  }