@pipelex/mthds-form 0.29.0 → 0.30.0

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.
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { cn, checkedAccentClass, focusOutlineClass, linkTextClass, selectedBorderClass, selectedFillClass, fieldControlClass, ResultRoot, ResultField, FieldRenderer, enumLabeler, useFieldPresentation, ToggleGroup, ToggleGroupItem, selectedFillStrongClass, Switch, Select, SelectTrigger, SelectValue, SelectContent, SelectItem } from '../chunk-RHX7LQRL.js';
2
+ import { cn, headingClass, checkedAccentClass, focusOutlineClass, actionShadowClass, panelSurfaceClass, panelRaisedShadowClass, linkTextClass, selectedBorderClass, selectedFillClass, fieldControlClass, ResultRoot, ResultField, FieldRenderer, enumLabeler, useFieldPresentation, ToggleGroup, ToggleGroupItem, selectedFillStrongClass, Switch, Select, SelectTrigger, SelectValue, SelectContent, SelectItem, panelFlatShadowClass } from '../chunk-JCFALTTY.js';
3
3
  import '../chunk-4VAO6BDE.js';
4
4
  export { seedInputs } from '../chunk-VH5CDQDR.js';
5
5
  import '../chunk-L23R3JNQ.js';
@@ -1843,13 +1843,24 @@ function Card({
1843
1843
  props,
1844
1844
  children
1845
1845
  }) {
1846
- return /* @__PURE__ */ jsxs("div", { className: "rounded-lg border border-border bg-card p-6 text-card-foreground", children: [
1847
- props.title || props.description ? /* @__PURE__ */ jsxs("div", { className: "mb-4 space-y-1.5", children: [
1848
- props.title ? /* @__PURE__ */ jsx("h3", { className: "text-lg leading-none font-semibold", children: props.title }) : null,
1849
- props.description ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: props.description }) : null
1850
- ] }) : null,
1851
- children
1852
- ] });
1846
+ return (
1847
+ // A style's panel: a host writes the style's field fill onto `--input`
1848
+ // here, as on its own panel, so the fields inside do not sink into it.
1849
+ /* @__PURE__ */ jsxs(
1850
+ "div",
1851
+ {
1852
+ "data-style-panel": "",
1853
+ className: cn("rounded-lg p-6 text-card-foreground", panelSurfaceClass, panelFlatShadowClass),
1854
+ children: [
1855
+ props.title || props.description ? /* @__PURE__ */ jsxs("div", { className: "mb-4 space-y-1.5", children: [
1856
+ props.title ? /* @__PURE__ */ jsx("h3", { className: cn("text-lg leading-none", headingClass(600)), children: props.title }) : null,
1857
+ props.description ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: props.description }) : null
1858
+ ] }) : null,
1859
+ children
1860
+ ]
1861
+ }
1862
+ )
1863
+ );
1853
1864
  }
1854
1865
  var GAP = {
1855
1866
  none: "gap-0",
@@ -1936,10 +1947,10 @@ function Collapsible({
1936
1947
  );
1937
1948
  }
1938
1949
  var HEADING = {
1939
- h1: "text-3xl font-bold tracking-tight",
1940
- h2: "text-2xl font-semibold tracking-tight",
1941
- h3: "text-lg font-semibold",
1942
- h4: "text-base font-semibold"
1950
+ h1: cn("text-3xl", headingClass(700, true)),
1951
+ h2: cn("text-2xl", headingClass(600, true)),
1952
+ h3: cn("text-lg", headingClass(600)),
1953
+ h4: cn("text-base", headingClass(600))
1943
1954
  };
1944
1955
  function Heading({
1945
1956
  props
@@ -2116,7 +2127,8 @@ function Textarea({
2116
2127
  /* @__PURE__ */ jsx(FieldError, { message: field.error })
2117
2128
  ] });
2118
2129
  }
2119
- var NATIVE_CHECK = cn("size-4", checkedAccentClass, focusOutlineClass);
2130
+ var NATIVE_CHECK = cn("size-4 shrink-0", checkedAccentClass, focusOutlineClass);
2131
+ var NATIVE_CHECK_ROW = "flex items-center gap-2 text-sm max-sm:min-h-11";
2120
2132
  function Radio({
2121
2133
  props,
2122
2134
  bindings,
@@ -2127,7 +2139,7 @@ function Radio({
2127
2139
  const labelOf = enumLabeler(props.options ?? [], useFieldPresentation());
2128
2140
  return /* @__PURE__ */ jsxs("fieldset", { className: "space-y-2", "aria-invalid": field.error ? true : void 0, children: [
2129
2141
  /* @__PURE__ */ jsx("legend", { className: LABEL, children: props.label }),
2130
- /* @__PURE__ */ jsx("div", { className: "space-y-2", children: (props.options ?? []).map((option, index) => /* @__PURE__ */ jsxs("label", { className: "flex items-center gap-2 text-sm", children: [
2142
+ /* @__PURE__ */ jsx("div", { className: "space-y-2 max-sm:space-y-0", children: (props.options ?? []).map((option, index) => /* @__PURE__ */ jsxs("label", { className: NATIVE_CHECK_ROW, children: [
2131
2143
  /* @__PURE__ */ jsx(
2132
2144
  "input",
2133
2145
  {
@@ -2156,7 +2168,7 @@ function Checkbox({
2156
2168
  const id = useControlId(props.name);
2157
2169
  const field = useBoundField(props.checked, bindings?.checked, false, props);
2158
2170
  return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
2159
- /* @__PURE__ */ jsxs("label", { htmlFor: id, className: "flex items-center gap-2 text-sm", children: [
2171
+ /* @__PURE__ */ jsxs("label", { htmlFor: id, className: NATIVE_CHECK_ROW, children: [
2160
2172
  /* @__PURE__ */ jsx(
2161
2173
  "input",
2162
2174
  {
@@ -2337,7 +2349,7 @@ function AccessibleSelect({ props, bindings, emit }) {
2337
2349
  emit("change");
2338
2350
  },
2339
2351
  children: [
2340
- /* @__PURE__ */ jsx(SelectTrigger, { id, className: "w-full", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: props.placeholder ?? "Select..." }) }),
2352
+ /* @__PURE__ */ jsx(SelectTrigger, { id, className: "h-11 w-full", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: props.placeholder ?? "Select..." }) }),
2341
2353
  /* @__PURE__ */ jsx(SelectContent, { children: (props.options ?? []).map((option, index) => /* @__PURE__ */ jsx(SelectItem, { value: option, children: labelOf(option) }, `${index}-${option}`)) })
2342
2354
  ]
2343
2355
  }
@@ -2431,11 +2443,11 @@ function Tabs({ props, children }) {
2431
2443
  const panels = React3.Children.toArray(children);
2432
2444
  const [value, setValue] = React3.useState(tabs[0]?.value ?? "");
2433
2445
  return /* @__PURE__ */ jsxs(TabsPrimitive.Root, { value, onValueChange: setValue, className: "w-full", children: [
2434
- /* @__PURE__ */ jsx(TabsPrimitive.List, { className: "inline-flex h-10 items-center justify-start rounded-md bg-muted p-1 text-muted-foreground", children: tabs.map((tab) => /* @__PURE__ */ jsx(
2446
+ /* @__PURE__ */ jsx(TabsPrimitive.List, { className: "inline-flex h-10 items-center justify-start rounded-md bg-muted p-1 text-muted-foreground max-sm:h-auto max-sm:flex-wrap", children: tabs.map((tab) => /* @__PURE__ */ jsx(
2435
2447
  TabsPrimitive.Trigger,
2436
2448
  {
2437
2449
  value: tab.value,
2438
- className: "inline-flex items-center justify-center rounded-sm px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-hidden data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm",
2450
+ className: "inline-flex items-center justify-center rounded-sm px-3 py-1.5 text-sm font-medium whitespace-nowrap transition-all focus-visible:ring-2 focus-visible:ring-ring focus-visible:outline-hidden data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm max-sm:min-h-11 max-sm:min-w-11",
2439
2451
  children: tab.label
2440
2452
  },
2441
2453
  tab.value
@@ -2451,7 +2463,7 @@ function Tabs({ props, children }) {
2451
2463
  ))
2452
2464
  ] });
2453
2465
  }
2454
- var BUTTON_BASE = "inline-flex h-10 items-center justify-center rounded-md px-4 text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50";
2466
+ var BUTTON_BASE = "inline-flex min-h-11 items-center justify-center rounded-md px-4 text-sm font-medium transition-colors focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50";
2455
2467
  var PRIMARY_BUTTON = cn(BUTTON_BASE, "bg-primary text-primary-foreground hover:bg-primary/90");
2456
2468
  var SECONDARY_BUTTON = cn(
2457
2469
  BUTTON_BASE,
@@ -2615,7 +2627,7 @@ function Segmented({ props, bindings, emit }) {
2615
2627
  value: option,
2616
2628
  variant: "outline",
2617
2629
  size: "sm",
2618
- className: "rounded-full px-3.5 data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground",
2630
+ className: "rounded-full px-3.5 data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground max-sm:h-11 max-sm:min-w-11",
2619
2631
  children: labelOf(option)
2620
2632
  },
2621
2633
  option
@@ -2655,7 +2667,7 @@ function NumberInput({ props, bindings, emit }) {
2655
2667
  },
2656
2668
  className: cn(
2657
2669
  fieldControlClass,
2658
- "h-10 px-3 tabular-nums [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none"
2670
+ "h-11 px-3 tabular-nums [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none"
2659
2671
  )
2660
2672
  }
2661
2673
  ),
@@ -2773,7 +2785,16 @@ function Hero({ props }) {
2773
2785
  children: props.eyebrow
2774
2786
  }
2775
2787
  ) : null,
2776
- /* @__PURE__ */ jsx("h1", { className: "max-w-2xl text-4xl font-bold tracking-tight text-foreground sm:text-[44px] sm:leading-[1.15]", children: props.headline }),
2788
+ /* @__PURE__ */ jsx(
2789
+ "h1",
2790
+ {
2791
+ className: cn(
2792
+ "max-w-2xl text-4xl text-foreground sm:text-[44px] sm:leading-[1.15]",
2793
+ headingClass(700, true)
2794
+ ),
2795
+ children: props.headline
2796
+ }
2797
+ ),
2777
2798
  props.lede ? /* @__PURE__ */ jsx("p", { className: "mt-4 max-w-2xl text-[17px] leading-relaxed text-muted-foreground", children: props.lede }) : null
2778
2799
  ] });
2779
2800
  }
@@ -2811,7 +2832,7 @@ function ResultPanel() {
2811
2832
  const slot = useResultSlot();
2812
2833
  if (!slot?.content) return null;
2813
2834
  return /* @__PURE__ */ jsxs("section", { className: "border-t border-border py-9", "data-testid": "result-panel", "aria-live": "polite", children: [
2814
- /* @__PURE__ */ jsx("h2", { className: "mb-6 text-xl font-semibold tracking-tight text-foreground", children: slot.title ?? "Result" }),
2835
+ /* @__PURE__ */ jsx("h2", { className: cn("mb-6 text-xl text-foreground", headingClass(600, true)), children: slot.title ?? "Result" }),
2815
2836
  slot.content
2816
2837
  ] });
2817
2838
  }
@@ -2820,7 +2841,7 @@ function Section({ props, children }) {
2820
2841
  /* @__PURE__ */ jsxs("div", { className: "mb-6", children: [
2821
2842
  /* @__PURE__ */ jsxs("div", { className: "flex items-baseline gap-3", children: [
2822
2843
  props.number ? /* @__PURE__ */ jsx("span", { className: cn("font-mono text-[12px]", linkTextClass), children: props.number }) : null,
2823
- /* @__PURE__ */ jsx("h2", { className: "text-xl font-semibold tracking-tight text-foreground", children: props.title })
2844
+ /* @__PURE__ */ jsx("h2", { className: cn("text-xl text-foreground", headingClass(600, true)), children: props.title })
2824
2845
  ] }),
2825
2846
  props.lede ? /* @__PURE__ */ jsx("p", { className: "mt-1.5 text-sm text-muted-foreground", children: props.lede }) : null
2826
2847
  ] }),
@@ -2833,10 +2854,21 @@ function Rail({ props, children }) {
2833
2854
  // the `@theme inline` mapping and does not inherit its fallback - it has to
2834
2855
  // carry its own, or a host that defines no tokens loses the declaration
2835
2856
  // outright. See src/styles/tailwind-entry.css.
2836
- /* @__PURE__ */ jsxs("div", { className: "rounded-[calc(var(--radius,0.5rem)*1.5)] border border-border bg-card p-7 text-card-foreground shadow-xl", children: [
2837
- /* @__PURE__ */ jsx("h2", { className: "text-[11px] font-semibold tracking-[0.15em] text-muted-foreground uppercase", children: props.title }),
2838
- /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col", children })
2839
- ] })
2857
+ /* @__PURE__ */ jsxs(
2858
+ "div",
2859
+ {
2860
+ "data-style-panel": "",
2861
+ className: cn(
2862
+ "rounded-[calc(var(--radius,0.5rem)*1.5)] p-7 text-card-foreground",
2863
+ panelSurfaceClass,
2864
+ panelRaisedShadowClass
2865
+ ),
2866
+ children: [
2867
+ /* @__PURE__ */ jsx("h2", { className: "text-[11px] font-semibold tracking-[0.15em] text-muted-foreground uppercase", children: props.title }),
2868
+ /* @__PURE__ */ jsx("div", { className: "mt-4 flex flex-col", children })
2869
+ ]
2870
+ }
2871
+ )
2840
2872
  );
2841
2873
  }
2842
2874
  function present(value) {
@@ -2857,10 +2889,12 @@ function Cta({ props, emit }) {
2857
2889
  type: "button",
2858
2890
  onClick: () => emit("press"),
2859
2891
  className: cn(
2860
- "inline-flex h-12 w-full items-center justify-center rounded-lg bg-primary px-6 text-sm font-semibold text-primary-foreground",
2861
- // The fallback is not decoration here either - see Rail above.
2862
- "shadow-[0_0_28px_color-mix(in_oklab,var(--primary,hsl(240_5.9%_10%))_35%,transparent)] transition-all hover:bg-primary/90 hover:shadow-[0_0_44px_color-mix(in_oklab,var(--primary,hsl(240_5.9%_10%))_50%,transparent)]",
2863
- "focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background focus-visible:outline-hidden"
2892
+ "inline-flex h-12 w-full items-center justify-center rounded-lg bg-primary px-6 text-sm font-semibold text-primary-foreground transition-all hover:bg-primary/90",
2893
+ // The page's call-to-action shadow, or the glow in the button colour
2894
+ // it had. Focus is an outline, which no shadow a style sets can
2895
+ // replace or hide.
2896
+ actionShadowClass,
2897
+ focusOutlineClass
2864
2898
  ),
2865
2899
  children: props.label
2866
2900
  }