@gtivr4/a1-design-system-react 0.12.0 → 0.12.1

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": "@gtivr4/a1-design-system-react",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "description": "React components for the A1 token-driven design system.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -138,7 +138,6 @@
138
138
  display: flex;
139
139
  flex-wrap: wrap;
140
140
  gap: var(--a1-cg-gap);
141
- margin-top: var(--a1-cg-items-top-gap);
142
141
  }
143
142
 
144
143
  /* Fixed column count when --a1-cg-columns is set */
@@ -11,4 +11,11 @@ export interface StickyActionsProps extends Omit<HTMLAttributes<HTMLDivElement>,
11
11
  children?: ReactNode;
12
12
  }
13
13
 
14
+ /**
15
+ * Fixed bottom action bar for flows, wizards, and multi-step forms.
16
+ *
17
+ * Renders a position:fixed bar at the bottom of the viewport and an invisible
18
+ * spacer sibling in document flow. The spacer height is measured via ResizeObserver
19
+ * and kept in sync automatically — no manual bottom padding needed on the page.
20
+ */
14
21
  export declare function StickyActions(props: StickyActionsProps): JSX.Element;
@@ -1,9 +1,21 @@
1
+ import { useEffect, useRef, useState } from "react";
1
2
  import "./sticky-actions.css";
2
3
 
3
4
  const VALID_CONTENT_WIDTHS = ["xs", "sm", "md", "lg", "xl", "2xl"];
4
5
 
5
6
  export function StickyActions({ contentWidth, className = "", children, ...props }) {
6
7
  const resolvedWidth = VALID_CONTENT_WIDTHS.includes(contentWidth) ? contentWidth : null;
8
+ const barRef = useRef(null);
9
+ const [offset, setOffset] = useState(0);
10
+
11
+ useEffect(() => {
12
+ if (!barRef.current) return;
13
+ const ro = new ResizeObserver(([entry]) => {
14
+ setOffset(entry.borderBoxSize?.[0]?.blockSize ?? entry.contentRect.height);
15
+ });
16
+ ro.observe(barRef.current);
17
+ return () => ro.disconnect();
18
+ }, []);
7
19
 
8
20
  const innerClass = [
9
21
  "a1-sticky-actions__inner",
@@ -11,10 +23,17 @@ export function StickyActions({ contentWidth, className = "", children, ...props
11
23
  ].filter(Boolean).join(" ");
12
24
 
13
25
  return (
14
- <div className={["a1-sticky-actions", className].filter(Boolean).join(" ")} {...props}>
15
- <div className={innerClass}>
16
- {children}
26
+ <>
27
+ {/* Spacer holds the bar's height in document flow so content above is
28
+ never hidden. Height is measured and kept in sync via ResizeObserver. */}
29
+ <div style={{ height: offset }} aria-hidden="true" />
30
+ <div
31
+ ref={barRef}
32
+ className={["a1-sticky-actions", className].filter(Boolean).join(" ")}
33
+ {...props}
34
+ >
35
+ <div className={innerClass}>{children}</div>
17
36
  </div>
18
- </div>
37
+ </>
19
38
  );
20
39
  }
@@ -5,9 +5,6 @@
5
5
  z-index: var(--component-sticky-actions-z-index);
6
6
  background: var(--component-sticky-actions-background);
7
7
  border-block-start: var(--component-sticky-actions-border-width) solid var(--semantic-color-border-subtle);
8
- padding-block-start: var(--component-sticky-actions-padding-block);
9
- padding-block-end: calc(var(--component-sticky-actions-padding-block) + env(safe-area-inset-bottom, 0px));
10
- padding-inline: var(--component-sticky-actions-padding-inline);
11
8
  box-sizing: border-box;
12
9
  }
13
10
 
@@ -15,6 +12,11 @@
15
12
  display: flex;
16
13
  flex-direction: column;
17
14
  gap: var(--component-sticky-actions-gap);
15
+ /* Padding lives here so max-width + margin-inline: auto center correctly
16
+ against the full viewport width, not the outer padded content area. */
17
+ padding-inline: var(--component-sticky-actions-padding-inline);
18
+ padding-block-start: var(--component-sticky-actions-padding-block);
19
+ padding-block-end: calc(var(--component-sticky-actions-padding-block) + env(safe-area-inset-bottom, 0px));
18
20
  width: 100%;
19
21
  margin-inline: auto;
20
22
  box-sizing: border-box;