@gtivr4/a1-design-system-react 0.11.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.11.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 */
@@ -0,0 +1,21 @@
1
+ import { ReactNode, HTMLAttributes } from "react";
2
+
3
+ export interface StickyActionsProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
4
+ /**
5
+ * Constrains the inner content to the same max-widths as Section's contentWidth prop.
6
+ * Match this to the contentWidth of the Section above so buttons align with page content.
7
+ * "xs" = 28.5rem · "sm" = 40rem · "md" = 50rem · "lg" = 60rem · "xl" = 70rem · "2xl" = 90rem
8
+ */
9
+ contentWidth?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
10
+ className?: string;
11
+ children?: ReactNode;
12
+ }
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
+ */
21
+ export declare function StickyActions(props: StickyActionsProps): JSX.Element;
@@ -0,0 +1,39 @@
1
+ import { useEffect, useRef, useState } from "react";
2
+ import "./sticky-actions.css";
3
+
4
+ const VALID_CONTENT_WIDTHS = ["xs", "sm", "md", "lg", "xl", "2xl"];
5
+
6
+ export function StickyActions({ contentWidth, className = "", children, ...props }) {
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
+ }, []);
19
+
20
+ const innerClass = [
21
+ "a1-sticky-actions__inner",
22
+ resolvedWidth && `a1-sticky-actions__inner--${resolvedWidth}`,
23
+ ].filter(Boolean).join(" ");
24
+
25
+ return (
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>
36
+ </div>
37
+ </>
38
+ );
39
+ }
@@ -0,0 +1,31 @@
1
+ .a1-sticky-actions {
2
+ position: fixed;
3
+ inset-block-end: 0;
4
+ inset-inline: 0;
5
+ z-index: var(--component-sticky-actions-z-index);
6
+ background: var(--component-sticky-actions-background);
7
+ border-block-start: var(--component-sticky-actions-border-width) solid var(--semantic-color-border-subtle);
8
+ box-sizing: border-box;
9
+ }
10
+
11
+ .a1-sticky-actions__inner {
12
+ display: flex;
13
+ flex-direction: column;
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));
20
+ width: 100%;
21
+ margin-inline: auto;
22
+ box-sizing: border-box;
23
+ }
24
+
25
+ /* Content width — mirrors Section's contentWidth values for visual alignment */
26
+ .a1-sticky-actions__inner--xs { max-width: 28.5rem; }
27
+ .a1-sticky-actions__inner--sm { max-width: 40rem; }
28
+ .a1-sticky-actions__inner--md { max-width: 50rem; }
29
+ .a1-sticky-actions__inner--lg { max-width: 60rem; }
30
+ .a1-sticky-actions__inner--xl { max-width: 70rem; }
31
+ .a1-sticky-actions__inner--2xl { max-width: 90rem; }
package/src/index.js CHANGED
@@ -60,3 +60,4 @@ export { DataTable } from "./components/data-table/DataTable.jsx";
60
60
  export { DataTableFilters } from "./components/data-table/DataTableFilters.jsx";
61
61
  export { Figure } from "./components/figure/Figure.jsx";
62
62
  export { Spacer } from "./components/spacer/Spacer.jsx";
63
+ export { StickyActions } from "./components/sticky-actions/StickyActions.jsx";
package/src/tokens.css CHANGED
@@ -693,6 +693,12 @@
693
693
  --component-step-tracker-active-width: 2rem;
694
694
  --component-step-tracker-active-color: #060b14;
695
695
  --component-step-tracker-gap: 0.375rem;
696
+ --component-sticky-actions-background: #ffffff;
697
+ --component-sticky-actions-border-width: 1px;
698
+ --component-sticky-actions-padding-block: 1rem;
699
+ --component-sticky-actions-padding-inline: 1rem;
700
+ --component-sticky-actions-gap: 0.75rem;
701
+ --component-sticky-actions-z-index: 150;
696
702
  --component-switch-track-width: 2.5rem;
697
703
  --component-switch-track-height: 1.375rem;
698
704
  --component-switch-thumb-size: 1rem;