@phreshos/react-ui 0.1.43 → 0.1.44

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.
Files changed (2) hide show
  1. package/dist/grid-list.js +15 -18
  2. package/package.json +1 -1
package/dist/grid-list.js CHANGED
@@ -2,7 +2,6 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { createContext, forwardRef, useContext, useMemo } from "react";
3
3
  import { GridList as AriaGridList, GridListHeader as AriaGridListHeader, GridListItem as AriaGridListItem, GridListSection as AriaGridListSection } from "react-aria-components";
4
4
  import { useControlMetrics } from "./control/control.js";
5
- import { separatorColor } from "./control/field.js";
6
5
  import { itemSurface, SelectionMark } from "./control/item.js";
7
6
  import { ariaSelection } from "./control/selection.js";
8
7
  import { surfaceRender } from "./control/surface-render.js";
@@ -31,18 +30,24 @@ const GridListRootImplementation = forwardRef(function GridList(properties, ref)
31
30
  ...style
32
31
  } }) }) });
33
32
  });
34
- /** One card. It holds whatever it is given, shows its edge at rest, and a check in its corner when selected. */
33
+ /** One card. It holds whatever it is given, and shows a check in its corner when selected. */
35
34
  const GridListItemImplementation = forwardRef(function GridListItem({ children, className, color, disabled = false, style, textValue, ...properties }, ref) {
36
35
  const inherited = useGridListStyle();
37
36
  const itemColor = color ?? inherited.color;
38
37
  const { metrics } = inherited;
39
- return _jsx(AriaGridListItem, { ...properties, ref: ref, textValue: textValue ?? (typeof children === "string" ? children : undefined), className: className, isDisabled: disabled, render: surfaceRender("div", state => itemSurface(metrics.visual, itemColor, {
40
- selected: state.isSelected,
41
- hovered: state.isHovered,
42
- pressed: state.isPressed,
43
- focusVisible: state.isFocusVisible,
44
- disabled: state.isDisabled
45
- }, metrics.radius)), style: {
38
+ return _jsx(AriaGridListItem, { ...properties, ref: ref, textValue: textValue ?? (typeof children === "string" ? children : undefined), className: className, isDisabled: disabled, render: surfaceRender("div", state => ({
39
+ ...itemSurface(metrics.visual, itemColor, {
40
+ selected: state.isSelected,
41
+ hovered: state.isHovered,
42
+ pressed: state.isPressed,
43
+ focusVisible: state.isFocusVisible,
44
+ disabled: state.isDisabled
45
+ }, metrics.radius),
46
+ // Unlike a list row, a card is a whole Surface: flat, in the default color at rest, in its
47
+ // selection color once selected, with the default material in both.
48
+ ...(state.isSelected ? {} : { color: "default" }),
49
+ material: undefined
50
+ })), style: {
46
51
  position: "relative",
47
52
  display: "grid",
48
53
  alignContent: "start",
@@ -54,15 +59,7 @@ const GridListItemImplementation = forwardRef(function GridListItem({ children,
54
59
  userSelect: "none",
55
60
  outlineOffset: -1,
56
61
  ...style
57
- }, children: state => _jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", style: {
58
- position: "absolute",
59
- inset: 0,
60
- // The card's own radius: the edge sits inside the grid cell, not directly in the card.
61
- borderRadius: metrics.radius,
62
- border: `1px solid ${separatorColor(metrics)}`,
63
- opacity: state.isSelected ? 0 : 1,
64
- pointerEvents: "none"
65
- } }), typeof children === "function" ? children(state) : children, _jsx("span", { style: { position: "absolute", insetBlockStart: metrics.inset, insetInlineEnd: metrics.inset, display: "flex" }, children: _jsx(SelectionMark, { visible: state.isSelected }) })] }) });
62
+ }, children: state => _jsxs(_Fragment, { children: [typeof children === "function" ? children(state) : children, _jsx("span", { style: { position: "absolute", insetBlockStart: metrics.inset, insetInlineEnd: metrics.inset, display: "flex" }, children: _jsx(SelectionMark, { visible: state.isSelected }) })] }) });
66
63
  });
67
64
  /** A Section spans the whole grid and lays its own Items out in the same columns. */
68
65
  const GridListSectionImplementation = forwardRef(function GridListSection({ className, style, ...properties }, ref) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phreshos/react-ui",
3
- "version": "0.1.43",
3
+ "version": "0.1.44",
4
4
  "description": "React components for coherent PhreshOS Program interfaces.",
5
5
  "type": "module",
6
6
  "sideEffects": false,