strata-react 1.0.4 → 1.0.5

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/UPGRADING.md CHANGED
@@ -16,6 +16,7 @@ Every PR that changes what an app sees adds a line here (see `CLAUDE.md`, "Chang
16
16
  React Aria Components is now the primitives layer (`react-aria-components`, installed with the
17
17
  package). `@radix-ui/react-slot` is gone.
18
18
 
19
+ - **State classes are the `tailwindcss-react-aria-components` variants** (`selected:`, `focus-visible:`, `hover:`, `disabled:`), loaded by `strata.css` (the plugin is installed with the package). A test that matched a class such as `data-[selected]:border-foreground` now matches `selected:border-foreground`; hover colours no longer apply on touch screens.
19
20
  - **`Button` has no `asChild`.** A button that navigates is a link: use a router `Link`.
20
21
  Do not rely on `@radix-ui/react-slot` arriving through Strata.
21
22
  - **`IconButton` shows `label` as a tooltip**, not a `title` attribute. New optional `hint`
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as readErrorBody, E as typeSteps, S as fieldErrorsOf, T as cn, _ as Textarea, a as toLoad, b as describeActionError, c as ColorSchemeChoice, d as useColorScheme, f as useSystemColorScheme, g as NativeSelect, h as Input, i as staleOf, l as ThemeProvider, m as Field, n as createQueryClient, o as useLoad, p as ChoiceGroup, r as fetchJson, s as COLOR_SCHEME_STORAGE_KEY, t as StrataQueryProvider, u as colorSchemeScript, v as useFieldControl, w as Tooltip, x as describeHttpError, y as HttpError } from "./query-gC6I6Cen.js";
1
+ import { C as readErrorBody, E as typeSteps, S as fieldErrorsOf, T as cn, _ as Textarea, a as toLoad, b as describeActionError, c as ColorSchemeChoice, d as useColorScheme, f as useSystemColorScheme, g as NativeSelect, h as Input, i as staleOf, l as ThemeProvider, m as Field, n as createQueryClient, o as useLoad, p as ChoiceGroup, r as fetchJson, s as COLOR_SCHEME_STORAGE_KEY, t as StrataQueryProvider, u as colorSchemeScript, v as useFieldControl, w as Tooltip, x as describeHttpError, y as HttpError } from "./query-CXlmWmrY.js";
2
2
  import * as React from "react";
3
3
  import { Autocomplete, Button as Button$1, Checkbox as Checkbox$1, Dialog as Dialog$1, DialogTrigger, Header, Heading, I18nProvider, Input as Input$1, Keyboard, Menu as Menu$1, MenuItem, MenuSection, MenuTrigger, Modal, ModalOverlay, NumberField as NumberField$1, Popover as Popover$1, SearchField, Separator, Slider as Slider$1, SliderOutput, SliderThumb, SliderTrack, SubmenuTrigger, Switch as Switch$1, Tab, TabList, TabPanel, Tabs as Tabs$1, Text, ToggleButton, ToggleButtonGroup, Toolbar as Toolbar$1, UNSTABLE_Toast, UNSTABLE_ToastContent, UNSTABLE_ToastQueue, UNSTABLE_ToastRegion, useFilter } from "react-aria-components";
4
4
  import { cva } from "class-variance-authority";
@@ -542,7 +542,7 @@ function CommandLegend({ commands, platform, label = "Keyboard shortcuts", class
542
542
  }, c.id))
543
543
  });
544
544
  }
545
- var itemClass = cn("flex min-h-(--control-h-sm) cursor-pointer items-center gap-2 rounded-control px-2 type-body-sm outline-none", "data-[focused]:bg-muted data-[disabled]:cursor-not-allowed data-[disabled]:text-muted-foreground data-[disabled]:opacity-70", "data-[open]:bg-muted");
545
+ var itemClass = cn("flex min-h-(--control-h-sm) cursor-pointer items-center gap-2 rounded-control px-2 type-body-sm outline-none", "focus:bg-muted disabled:cursor-not-allowed disabled:text-muted-foreground disabled:opacity-70", "open:bg-muted");
546
546
  function Item({ command, platform }) {
547
547
  const Icon = command.icon ?? (command.destructive ? Trash2 : void 0);
548
548
  const shortcut = commandShortcut(command, platform);
@@ -809,7 +809,7 @@ function ToolbarSeparator({ className }) {
809
809
  return /* @__PURE__ */ jsx(Separator, { className: cn("mx-1 h-5 w-px self-center border-0 bg-border", className) });
810
810
  }
811
811
  // src/components/toggle.tsx
812
- var base = "inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-control border type-label transition-state press [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border-input bg-background text-muted-foreground data-[hovered]:bg-muted data-[hovered]:text-foreground data-[selected]:border-foreground data-[selected]:bg-muted data-[selected]:text-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50";
812
+ var base = "inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 whitespace-nowrap rounded-control border type-label transition-state press [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 border-input bg-background text-muted-foreground hover:bg-muted hover:text-foreground selected:border-foreground selected:bg-muted selected:text-foreground disabled:pointer-events-none disabled:opacity-50";
813
813
  var sizes$1 = {
814
814
  default: "h-(--control-h)",
815
815
  sm: "h-(--control-h-sm)"
@@ -858,7 +858,7 @@ function ToggleGroup({ label, options, value, onChange, size = "default", classN
858
858
  const item = /* @__PURE__ */ jsx(ToggleButton, {
859
859
  id: o.value,
860
860
  "aria-label": iconOnly ? o.label : void 0,
861
- className: cn(base, "border-transparent bg-transparent data-[selected]:border-foreground", sizes$1[size], iconOnly ? size === "sm" ? "size-(--control-h-sm)" : "size-(--control-h)" : "px-3"),
861
+ className: cn(base, "border-transparent bg-transparent selected:border-foreground", sizes$1[size], iconOnly ? size === "sm" ? "size-(--control-h-sm)" : "size-(--control-h)" : "px-3"),
862
862
  children: /* @__PURE__ */ jsx(Face, {
863
863
  label: o.label,
864
864
  icon: o.icon,
@@ -881,13 +881,13 @@ function Switch({ label, detail, on, defaultOn, onChange, disabled, className })
881
881
  defaultSelected: defaultOn,
882
882
  onChange,
883
883
  isDisabled: disabled,
884
- className: cn("group inline-flex min-h-6 cursor-pointer items-start gap-3 data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50", className),
884
+ className: cn("group inline-flex min-h-6 cursor-pointer items-start gap-3 disabled:cursor-not-allowed disabled:opacity-50", className),
885
885
  children: [/* @__PURE__ */ jsx("span", {
886
886
  "aria-hidden": true,
887
- className: cn("mt-0.5 flex h-5 w-9 shrink-0 items-center rounded-pill border border-input bg-muted p-0.5 transition-state", "group-data-[selected]:border-primary group-data-[selected]:bg-primary", "group-data-[focus-visible]:outline-2 group-data-[focus-visible]:outline-offset-2 group-data-[focus-visible]:outline-ring"),
887
+ className: cn("mt-0.5 flex h-5 w-9 shrink-0 items-center rounded-pill border border-input bg-muted p-0.5 transition-state", "group-selected:border-primary group-selected:bg-primary", "group-focus-visible:outline-2 group-focus-visible:outline-offset-2 group-focus-visible:outline-ring"),
888
888
  children: /* @__PURE__ */ jsx("span", {
889
- className: "grid size-3.5 place-items-center rounded-pill bg-background text-primary group-data-[selected]:translate-x-4",
890
- children: /* @__PURE__ */ jsx("span", { className: "hidden size-1.5 rounded-pill bg-primary group-data-[selected]:block" })
889
+ className: "grid size-3.5 place-items-center rounded-pill bg-background text-primary group-selected:translate-x-4",
890
+ children: /* @__PURE__ */ jsx("span", { className: "hidden size-1.5 rounded-pill bg-primary group-selected:block" })
891
891
  })
892
892
  }), /* @__PURE__ */ jsxs("span", {
893
893
  className: "grid",
@@ -1082,7 +1082,7 @@ function Checkbox({ label, hideLabel = false, detail, checked, onCheckedChange,
1082
1082
  className: cn("group inline-flex min-h-6 min-w-6 items-start gap-3", hideLabel && "items-center justify-center", disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer", className),
1083
1083
  children: ({ isSelected, isIndeterminate }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("span", {
1084
1084
  "aria-hidden": true,
1085
- className: cn("grid size-4.5 shrink-0 place-items-center rounded-control border border-input bg-background transition-state", "group-data-[focus-visible]:outline-2 group-data-[focus-visible]:outline-offset-2 group-data-[focus-visible]:outline-ring", (isSelected || isIndeterminate) && "border-primary bg-primary text-primary-foreground", !hideLabel && "mt-0.5"),
1085
+ className: cn("grid size-4.5 shrink-0 place-items-center rounded-control border border-input bg-background transition-state", "group-focus-visible:outline-2 group-focus-visible:outline-offset-2 group-focus-visible:outline-ring", (isSelected || isIndeterminate) && "border-primary bg-primary text-primary-foreground", !hideLabel && "mt-0.5"),
1086
1086
  children: isIndeterminate ? /* @__PURE__ */ jsx(Minus, {
1087
1087
  className: "size-3.5",
1088
1088
  strokeWidth: 3
@@ -1680,7 +1680,7 @@ function contrastRatio(a, b) {
1680
1680
  return (hi + .05) / (lo + .05);
1681
1681
  }
1682
1682
  // src/components/value-controls.tsx
1683
- var box = "flex h-(--control-h) w-full min-w-0 items-center rounded-control border border-input bg-background px-3 type-body text-foreground transition-state data-[disabled]:cursor-not-allowed data-[disabled]:bg-muted data-[disabled]:opacity-70 has-[input:disabled]:cursor-not-allowed has-[input:disabled]:bg-muted has-[input:disabled]:opacity-70 aria-invalid:border-danger has-[input:focus-visible]:outline-2 has-[input:focus-visible]:outline-offset-2 has-[input:focus-visible]:outline-ring";
1683
+ var box = "flex h-(--control-h) w-full min-w-0 items-center rounded-control border border-input bg-background px-3 type-body text-foreground transition-state disabled:cursor-not-allowed disabled:bg-muted disabled:opacity-70 has-[input:disabled]:cursor-not-allowed has-[input:disabled]:bg-muted has-[input:disabled]:opacity-70 aria-invalid:border-danger has-[input:focus-visible]:outline-2 has-[input:focus-visible]:outline-offset-2 has-[input:focus-visible]:outline-ring";
1684
1684
  /** A number with its unit joined by a non-breaking space; `%` and `°` stay attached. */
1685
1685
  function withUnit(text, unit) {
1686
1686
  if (!unit) return text;
@@ -1824,7 +1824,7 @@ function Slider({ value, onChange, min, max, step = 1, unit, locale = format.loc
1824
1824
  "aria-describedby": field?.describedBy,
1825
1825
  className: cn("flex min-w-0 items-center gap-3", className),
1826
1826
  children: [/* @__PURE__ */ jsx(SliderTrack, {
1827
- className: "relative flex h-(--control-h) min-w-0 flex-1 cursor-pointer items-center data-[disabled]:cursor-not-allowed data-[disabled]:opacity-50",
1827
+ className: "relative flex h-(--control-h) min-w-0 flex-1 cursor-pointer items-center disabled:cursor-not-allowed disabled:opacity-50",
1828
1828
  children: ({ state }) => /* @__PURE__ */ jsxs(Fragment, { children: [
1829
1829
  /* @__PURE__ */ jsx("span", {
1830
1830
  "aria-hidden": true,
@@ -1835,7 +1835,7 @@ function Slider({ value, onChange, min, max, step = 1, unit, locale = format.loc
1835
1835
  className: "absolute left-0 h-1.5 rounded-pill bg-primary",
1836
1836
  style: { width: `${state.getThumbPercent(0) * 100}%` }
1837
1837
  }),
1838
- /* @__PURE__ */ jsx(SliderThumb, { className: "top-1/2 size-5 rounded-pill border-2 border-primary bg-background data-[focus-visible]:outline-2 data-[focus-visible]:outline-offset-2 data-[focus-visible]:outline-ring" })
1838
+ /* @__PURE__ */ jsx(SliderThumb, { className: "top-1/2 size-5 rounded-pill border-2 border-primary bg-background focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring" })
1839
1839
  ] })
1840
1840
  }), editable ? /* @__PURE__ */ jsx(NumberField, {
1841
1841
  className: "w-28 shrink-0",
@@ -2056,7 +2056,7 @@ function StrataToastRegion({ label = "Notifications", className }) {
2056
2056
  className: cn("layer-bar fixed inset-x-4 top-4 grid justify-items-end gap-2 outline-none sm:inset-x-auto sm:top-auto sm:right-4 sm:bottom-4", className),
2057
2057
  children: ({ toast: t }) => /* @__PURE__ */ jsxs(UNSTABLE_Toast, {
2058
2058
  toast: t,
2059
- className: cn("flex w-full max-w-sm items-start gap-3 p-3 outline-none data-[focus-visible]:outline-2 data-[focus-visible]:outline-ring", overlaySurface),
2059
+ className: cn("flex w-full max-w-sm items-start gap-3 p-3 outline-none focus-visible:outline-2 focus-visible:outline-ring", overlaySurface),
2060
2060
  children: [
2061
2061
  (() => {
2062
2062
  const { icon: Icon, color } = marks[t.content.tone ?? "info"];
@@ -2088,7 +2088,7 @@ function StrataToastRegion({ label = "Notifications", className }) {
2088
2088
  /* @__PURE__ */ jsx(Button$1, {
2089
2089
  slot: "close",
2090
2090
  "aria-label": "Dismiss",
2091
- className: "grid size-6 shrink-0 cursor-pointer place-items-center rounded-control text-muted-foreground transition-state data-[hovered]:bg-muted data-[hovered]:text-foreground",
2091
+ className: "grid size-6 shrink-0 cursor-pointer place-items-center rounded-control text-muted-foreground transition-state hover:bg-muted hover:text-foreground",
2092
2092
  children: /* @__PURE__ */ jsx(X, {
2093
2093
  "aria-hidden": true,
2094
2094
  className: "size-4"
@@ -3005,7 +3005,7 @@ function Tile({ name, chosen, disabled, onChange, aspect, image, detail, index }
3005
3005
  "aria-label": name,
3006
3006
  onChange: (on) => onChange(on, shift.take()),
3007
3007
  "data-index": index,
3008
- className: cn("group relative grid min-w-0 gap-1.5 rounded-surface border border-transparent p-1.5 select-none transition-state", "data-[focus-visible]:outline-2 data-[focus-visible]:outline-offset-2 data-[focus-visible]:outline-ring", chosen && "border-primary bg-surface-sunken", disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-surface-sunken"),
3008
+ className: cn("group relative grid min-w-0 gap-1.5 rounded-surface border border-transparent p-1.5 select-none transition-state", "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring", chosen && "border-primary bg-surface-sunken", disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer hover:bg-surface-sunken"),
3009
3009
  children: [
3010
3010
  /* @__PURE__ */ jsx("span", {
3011
3011
  className: cn("block overflow-hidden rounded-control bg-muted *:size-full *:object-cover", aspectClass[aspect]),
@@ -3875,7 +3875,7 @@ function Tabs({ param, items, label, children, className }) {
3875
3875
  className: "flex gap-4 overflow-x-auto border-b border-border",
3876
3876
  children: items.map((item) => /* @__PURE__ */ jsx(Tab, {
3877
3877
  id: item.value,
3878
- className: cn("-mb-px cursor-pointer border-b-2 py-2 type-label whitespace-nowrap transition-state", "border-transparent text-muted-foreground hover:text-foreground", "data-[selected]:border-foreground data-[selected]:font-semibold data-[selected]:text-foreground"),
3878
+ className: cn("-mb-px cursor-pointer border-b-2 py-2 type-label whitespace-nowrap transition-state", "border-transparent text-muted-foreground hover:text-foreground", "selected:border-foreground selected:font-semibold selected:text-foreground"),
3879
3879
  children: item.label
3880
3880
  }, item.value))
3881
3881
  }), /* @__PURE__ */ jsx(TabPanel, {
@@ -4594,7 +4594,7 @@ function Compare({ label, a, b, blind, missing, mode, onModeChange, modes = ALL_
4594
4594
  children: /* @__PURE__ */ jsx(SliderTrack, {
4595
4595
  className: "pointer-events-none h-full w-full",
4596
4596
  children: /* @__PURE__ */ jsxs(SliderThumb, {
4597
- className: "pointer-events-auto grid h-full w-8 cursor-ew-resize place-items-center data-[focus-visible]:outline-2 data-[focus-visible]:outline-ring",
4597
+ className: "pointer-events-auto grid h-full w-8 cursor-ew-resize place-items-center focus-visible:outline-2 focus-visible:outline-ring",
4598
4598
  style: { top: "50%" },
4599
4599
  children: [/* @__PURE__ */ jsx("span", {
4600
4600
  "aria-hidden": true,