@microbit/ui 0.1.0-alpha.10 → 0.1.0-alpha.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microbit/ui",
3
- "version": "0.1.0-alpha.10",
3
+ "version": "0.1.0-alpha.11",
4
4
  "description": "micro:bit design-system primitives: react-aria-components + Panda CSS with a design language ported from Chakra UI v2. Ships as source; see README for the consumption setup.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -42,11 +42,15 @@ export const ButtonGroup = forwardRef<HTMLDivElement, ButtonGroupProps>(
42
42
  // :first-child/:last-child, not :first-of-type: attached
43
43
  // groups can mix element types (e.g. select + button), and
44
44
  // -of-type matches per element type.
45
+ // marginEnd -1px (Chakra parity): overlaps adjacent borders
46
+ // so two 1px inner edges read as a single 1px seam.
45
47
  "& > *:first-child:not(:last-child)": {
46
48
  borderEndRadius: 0,
49
+ marginEnd: "-1px",
47
50
  },
48
51
  "& > *:not(:first-child):not(:last-child)": {
49
52
  borderRadius: 0,
53
+ marginEnd: "-1px",
50
54
  },
51
55
  "& > *:not(:first-child):last-child": {
52
56
  borderStartRadius: 0,
package/src/Divider.tsx CHANGED
@@ -15,33 +15,66 @@ const StyledDivider = styled("hr", {
15
15
  variants: {
16
16
  orientation: {
17
17
  horizontal: {
18
- borderBottomWidth: "1px",
19
18
  borderBottomStyle: "solid",
20
19
  width: "100%",
21
20
  },
22
21
  vertical: {
23
- borderLeftWidth: "1px",
24
22
  borderLeftStyle: "solid",
25
23
  height: "100%",
26
24
  },
27
25
  },
26
+ // Rule weight, on the orientation's drawn edge (see compoundVariants).
27
+ // Semantic rather than a raw border width so call sites don't need to
28
+ // know which edge an orientation draws with.
29
+ thickness: {
30
+ thin: {},
31
+ thick: {},
32
+ },
28
33
  },
29
- defaultVariants: { orientation: "horizontal" },
34
+ compoundVariants: [
35
+ {
36
+ orientation: "horizontal",
37
+ thickness: "thin",
38
+ css: { borderBottomWidth: "1px" },
39
+ },
40
+ {
41
+ orientation: "horizontal",
42
+ thickness: "thick",
43
+ css: { borderBottomWidth: "2px" },
44
+ },
45
+ {
46
+ orientation: "vertical",
47
+ thickness: "thin",
48
+ css: { borderLeftWidth: "1px" },
49
+ },
50
+ {
51
+ orientation: "vertical",
52
+ thickness: "thick",
53
+ css: { borderLeftWidth: "2px" },
54
+ },
55
+ ],
56
+ defaultVariants: { orientation: "horizontal", thickness: "thin" },
30
57
  });
31
58
 
32
59
  export interface DividerProps extends ComponentProps<typeof StyledDivider> {}
33
60
 
34
61
  /**
35
62
  * Divider — a hairline rule matching Chakra's <Divider> (60% opacity; set
36
- * `borderColor` to tint). `orientation="vertical"` needs a height from the
37
- * layout, e.g. a stretched flex row (Chakra's vertical divider likewise
38
- * relied on `height: 100%`).
63
+ * `borderColor` to tint, `thickness="thick"` for a 2px rule).
64
+ * `orientation="vertical"` needs a height from the layout, e.g. a stretched
65
+ * flex row (Chakra's vertical divider likewise relied on `height: 100%`).
66
+ *
67
+ * Decorative by default: hidden from assistive tech, since a visual rule
68
+ * between sections is noise as an announced separator (and every call site
69
+ * was opting out by hand). Pass `aria-hidden={false}` for a divider that
70
+ * should be exposed as a semantic separator.
39
71
  */
40
72
  export const Divider = forwardRef<HTMLHRElement, DividerProps>(
41
73
  function Divider(props, ref) {
42
74
  return (
43
75
  <StyledDivider
44
76
  ref={ref}
77
+ aria-hidden
45
78
  aria-orientation={
46
79
  props.orientation === "vertical" ? "vertical" : "horizontal"
47
80
  }