# @styleframe/theme
## 3.11.0
### Minor Changes
- [#382](https://github.com/uxfront-com/styleframe/pull/382) [`a70e8e7`](https://github.com/uxfront-com/styleframe/commit/a70e8e70330432eafdfd3533457eb3cad8bfc466) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Add a `useCardMediaRecipe` for an image at the top of a card, and make the card recipes meet the Open Components Card standard. A link in a heading inside the card header now stretches over the whole card, actions in the card stay clickable above it, and the card shows a 2px `color.focus` ring outside its border when that link has keyboard focus, through `useCardRecipe`'s setup selectors. Hover strengthens the border and underlines the heading only inside `@media (hover: hover)`, the border goes to full strength with `prefers-contrast: more` and stays a system colour in forced colours mode. The card no longer sets `overflow: hidden`, so content and the focus ring are never clipped, and it wraps long words with `overflow-wrap: break-word`. `useCardHeaderRecipe`, `useCardBodyRecipe` and `useCardFooterRecipe` pad their inline sides with `paddingInline` instead of `paddingLeft` and `paddingRight`, so cards mirror in right-to-left layouts. The media part shows above the header with `order: -1` and keeps a `16 / 9` aspect ratio. Every recipe name, axis, value and default stays the same.
- [#382](https://github.com/uxfront-com/styleframe/pull/382) [`a70e8e7`](https://github.com/uxfront-com/styleframe/commit/a70e8e70330432eafdfd3533457eb3cad8bfc466) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Bring `useTextareaRecipe` in line with the Open Components Textarea standard, and add an `autogrow` axis that defaults to `false`, so today's output stays the same. With `autogrow: true`, in browsers that support `field-sizing`, the textarea grows with its text through `field-sizing: content` and has no resize handle, up to the rows in its `data-max-rows` attribute. The nested textarea now has a `min-height` of its `rows` in lines, read with `attr()`, so resizing or growing never makes it shorter than its rows. On touch screens its text is at least 16px, so Safari on iOS doesn't zoom in on focus, and the textarea is at least 44px tall. The `vertical` resize default now also sets `resize: block`, where browsers support it, so it follows the writing mode. `useTextareaPrefixRecipe` and `useTextareaSuffixRecipe` get the Input prefix and suffix changes through the field addon builder they share.
- [#382](https://github.com/uxfront-com/styleframe/pull/382) [`a70e8e7`](https://github.com/uxfront-com/styleframe/commit/a70e8e70330432eafdfd3533457eb3cad8bfc466) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Align the tooltip recipes with the Open Components Tooltip standard. `useTooltipRecipe` and `useTooltipArrowRecipe` gain a `placement` axis (`top`, `bottom`, `start` or `end`), which defaults to `top`, the side the arrow pointed from before. On an element with the `popover` attribute, `useTooltipRecipe` now opens the tooltip in the top layer with `position: fixed`, `inset: auto` and the new `@tooltip.offset` variable as its margin, sets `position-area` from `placement` and flips it with `position-try-fallbacks: flip-block, flip-inline`. It fades and grows in as it opens, and only fades with `prefers-reduced-motion: reduce`. Every other element keeps its own positioning and the `@z-index.tooltip` layer, so tooltips you position yourself look the same. The content now wraps at `32ch` rather than `240px`, breaks long words with `overflow-wrap: anywhere`, and takes `Canvas` and a `CanvasText` border in forced colours mode. `useTooltipArrowRecipe` now draws its triangle in `color`, turns with `placement`, uses logical properties so it mirrors in right-to-left layouts, sits on the edge that faces the trigger inside a top-layer tooltip, and hides in forced colours mode. CSS can't tell which side a fallback chose, so when a tooltip flips, set the arrow's `placement` from a script.
- [#408](https://github.com/uxfront-com/styleframe/pull/408) [`9e14ea4`](https://github.com/uxfront-com/styleframe/commit/9e14ea4b9673e7861a92d8aef1842a2854c65b07) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Add icon sizes and an icon-only style to `useButtonRecipe`. Each size now sets `--button--icon--size` for the icons in `data-slot="leading"` and `data-slot="trailing"` children, and a button with `data-icon-only` and `data-size` is square, with its `data-slot="label"` child hidden from view but kept as the accessible name. Buttons without these attributes look the same as before.
- [#382](https://github.com/uxfront-com/styleframe/pull/382) [`a70e8e7`](https://github.com/uxfront-com/styleframe/commit/a70e8e70330432eafdfd3533457eb3cad8bfc466) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Add a `color.focus` token for focus rings, plus five accessibility modifiers and a `position-try-fallbacks` utility. The token is a reference to `@color.primary` in the light and dark themes, emitted as `--color--focus`, and the `focus.outline-color` default now points at it, so focus rings look the same as before. When a project replaces the default colors and defines no `focus` color, the default falls back to `@color.primary`, as before. The new modifiers are `hover-capable` (`@media (hover: hover)`) and `any-pointer-coarse` (`@media (any-pointer: coarse)`) from `useMediaPreferenceModifiers`, `aria-invalid` (`[aria-invalid="true"]`) from `useAriaStateModifiers`, `readonly-attr` (`[readonly]`) from `useFormStateModifiers` and `data-loading` (`[data-loading]`) from `useOtherStateModifiers`, each with its own composable, like `useHoverCapableModifier`. The `usePositionTryFallbacksUtility` composable is registered in `useUtilitiesPreset` as `createPositionTryFallbacksUtility` and ships without defaults. Reference colors like `focus` no longer get level, shade or tint keys in the `useDesignTokensPreset` return type, because none are generated for them.
- [#382](https://github.com/uxfront-com/styleframe/pull/382) [`a70e8e7`](https://github.com/uxfront-com/styleframe/commit/a70e8e70330432eafdfd3533457eb3cad8bfc466) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Align the popover recipes with the Open Components Popover standard. `usePopoverRecipe` and `usePopoverArrowRecipe` gain a `placement` axis (`top`, `bottom`, `start` or `end`), which defaults to `top`, the side the arrow pointed from before. On an element with the `popover` attribute, `usePopoverRecipe` now opens the popover in the top layer with `position: fixed`, `inset: auto`, no padding from the browser's own `[popover]` styles, and the new `@popover.offset` variable as its margin, sets `position-area` from `placement`, flips it with `position-try-fallbacks`, and registers the `--popover-fit`, `--popover-fit-below` and `--popover-fit-above` `@position-try` rules. It fades in only without a reduced-motion preference. Every other element keeps `position: relative`, so popovers you position yourself look the same. The container is never wider or taller than the screen less `@spacing.xl`, wraps long words, and draws a full-strength edge under `prefers-contrast: more` and a `CanvasText` edge in forced colours mode. `usePopoverBodyRecipe` scrolls when the popover can't grow, and `usePopoverHeaderRecipe` drops its top separator after a leading arrow, as it does for a first child. `usePopoverArrowRecipe` now draws its triangle in `color`, turns with `placement`, uses logical properties so it mirrors in right-to-left layouts, sits on the edge that faces the anchor inside a top-layer popover, hides in forced colours mode, and changes `@popover.arrow.size` from `6px` to `0.375rem`: the same size at a 16px root font size, but it now scales with the root font size.
- [#382](https://github.com/uxfront-com/styleframe/pull/382) [`a70e8e7`](https://github.com/uxfront-com/styleframe/commit/a70e8e70330432eafdfd3533457eb3cad8bfc466) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Align the Spinner recipes with the Open Components Spinner standard. `useSpinnerRecipe`, `useSpinnerCircleRecipe` and `useSpinnerTextRecipe` gain an `inherit` size, which makes the spinner `1em` wide and tall so it matches the text around it, and the spinner no longer shrinks in a flex row. With reduced motion, `useSpinnerCircleRecipe` swaps the turn for a pulse that fades the spinner to 40% and back every 1.6 seconds, and stops the arc from growing and shrinking. The pulse uses `!important` for its duration and iteration count, so it keeps going under the sanitize preset. The spinner has no background of its own, so in `useSpinnerRecipe` `primary` switches to `@color.primary-400` in the dark theme, where a label then reaches 4.5:1 on the page. The `light` and `dark` colors look the same in both themes, `gray-700` for light surfaces and white for dark ones, while `neutral` adapts to the theme. `useSpinnerOverlayRecipe` darkens its backdrop from 50% to 75% black, so a `dark` label on it reaches 4.5:1 too. With the `inherit` size, the spinner also sits `0.125em` below the baseline, so it centres on the text. `useSpinnerCircleRecipe` now uses the `motion-reduce` modifier, so register it first, as `useModifiersPreset` does.
### Patch Changes
- [#382](https://github.com/uxfront-com/styleframe/pull/382) [`a70e8e7`](https://github.com/uxfront-com/styleframe/commit/a70e8e70330432eafdfd3533457eb3cad8bfc466) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Make `useButtonRecipe` meet the Open Components Button standard's stylesheet rules. Every label now keeps 4.5:1 contrast at rest, on hover, when active, pressed or expanded, in both themes, so `solid` buttons darken on hover instead of lightening, apart from `warning`, which takes a dark label and still lightens, and the transparent variants use lighter levels in the dark theme. Every border keeps 3:1 against the surface it's meant for, so `subtle` borders and the `neutral` borders are darker in the light theme and lighter in the dark theme, `warning` `outline` borders are darker, and so is the light theme's `warning` `solid` border. Hover also sets the label color, so on devices that can hover, a button rendered as `` keeps it over the global link hover styles. The focus ring uses `color.focus`, the `link` variant is underlined at rest, hover styles only apply on devices that can hover, and the `&:focus` styles that copied the hover background are gone, since the focus ring shows focus. Disabled, pressed, expanded and loading are styled from `aria-disabled`, `aria-pressed`, `aria-expanded` and `data-loading` as well as `:disabled`. Disabled buttons no longer set `pointer-events: none`, so their cursor shows and clicks don't fall through, and they keep their resting colors on hover and press. Forced colors mode uses system colors for these states, and `prefers-contrast: more` draws `outline` and `subtle` borders at full strength. Each size sets a `min-height` and a matching `min-width`, labels wrap instead of staying on one line, horizontal padding is `padding-inline`, and touch screens get a 44 × 44px hit area. The `light` color is meant for dark surfaces and `dark` for light surfaces, and their `link` hovers no longer turn the text invisible. No color, variant, size or default changes.
- [#382](https://github.com/uxfront-com/styleframe/pull/382) [`a70e8e7`](https://github.com/uxfront-com/styleframe/commit/a70e8e70330432eafdfd3533457eb3cad8bfc466) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Bring `useInputRecipe`, `useInputPrefixRecipe` and `useInputSuffixRecipe` in line with the Open Components Input standard. The focus ring is `@color.focus` in every state, and an invalid field shows through its error border and a new 1px inset shadow instead of a red ring. The wrapper now also takes its invalid, read-only and disabled look from the nested input's `aria-invalid="true"`, `readonly` and `disabled` attributes. Hover styles only apply on devices that can hover, each size has a `min-height`, and on touch screens the input's text is at least 16px and its hit area at least 44px tall. Disabled fields turn `GrayText` in forced colors mode, and borders use the text color with `prefers-contrast: more`. The placeholder, prefix and suffix are now the field's text color at 75%, and the prefix and suffix use logical padding. The read-only state no longer tints the fill, and `light` and `dark` ghost fields stay transparent and keep one color in both themes, like every `light` and `dark` field. `useTextareaRecipe` and `useInputDateRecipe` share the field wrapper, so they get the same changes, except that `useInputDateRecipe` keeps its text size and height on touch screens, and `useTextareaPrefixRecipe` and `useTextareaSuffixRecipe` get the prefix and suffix changes. `useOtpCellRecipe` shares only the surface colors and states: its cells get the hover, invalid, disabled and ghost changes, and keep their own `@color.primary` focus ring.
- [#382](https://github.com/uxfront-com/styleframe/pull/382) [`a70e8e7`](https://github.com/uxfront-com/styleframe/commit/a70e8e70330432eafdfd3533457eb3cad8bfc466) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Bring `useSwitchRecipe` and `useSwitchFieldRecipe` in line with the Open Components Switch standard. Every off track now keeps 3:1 against the page in light and dark mode, with a knob at 3:1 against it: `neutral` is `gray-450` in both modes, `light` is a `gray-200` track with a `gray-500` border and a `gray-600` knob, and `dark` gets a `gray-450` border. The focus ring is `@color.focus`, and the field takes an invalid look from `aria-invalid="true"` (an error border doubled by an inset shadow) and a read-only look from `aria-readonly="true"` (a dashed border). Sizes are in `rem`, the knob is a gradient that moves to the inline end, so it mirrors in right-to-left layouts, and it jumps rather than slides with reduced motion. The wrapper label is at least 24px tall, and 44px on touch screens, so it gives the switch a large enough hit area. In forced colors mode the switch draws itself in system colors, and with `prefers-contrast: more` the off border takes the text color, except on `light` and `dark` switches, which keep their own.
- [#382](https://github.com/uxfront-com/styleframe/pull/382) [`a70e8e7`](https://github.com/uxfront-com/styleframe/commit/a70e8e70330432eafdfd3533457eb3cad8bfc466) Thanks [@alexgrozav](https://github.com/alexgrozav)! - Make `useCheckboxGroupRecipe` meet the Open Components Checkbox Group page. The group now resets its `