@volksverpetzer/ui-web 0.3.0 → 0.4.0

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/dist/Badge.js CHANGED
@@ -2,6 +2,8 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import "./Badge.css";
3
3
  /** Small pill label — category tags, status markers, counts. */
4
4
  export function Badge({ variant = "neutral", className, children, ...rest }) {
5
- const classes = ["vvp-ui-badge", `vvp-ui-badge--${variant}`, className].filter(Boolean).join(" ");
5
+ const classes = ["vvp-ui-badge", `vvp-ui-badge--${variant}`, className]
6
+ .filter(Boolean)
7
+ .join(" ");
6
8
  return (_jsx("span", { className: classes, ...rest, children: children }));
7
9
  }
package/dist/Button.d.ts CHANGED
@@ -13,4 +13,4 @@ export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
13
13
  * responsible for loading a brand's token CSS (or SCSS, for Divi) before
14
14
  * this renders.
15
15
  */
16
- export declare function Button({ variant, size, className, children, ...rest }: ButtonProps): import("react").JSX.Element;
16
+ export declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
package/dist/Button.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from "react";
2
3
  import "./Button.css";
3
4
  /**
4
5
  * Shared brand button. Styled entirely off the `--vvp-*` custom properties
@@ -6,9 +7,14 @@ import "./Button.css";
6
7
  * responsible for loading a brand's token CSS (or SCSS, for Divi) before
7
8
  * this renders.
8
9
  */
9
- export function Button({ variant = "primary", size = "md", className, children, ...rest }) {
10
- const classes = ["vvp-ui-btn", `vvp-ui-btn--${variant}`, `vvp-ui-btn--${size}`, className]
10
+ export const Button = forwardRef(function Button({ variant = "primary", size = "md", className, children, ...rest }, ref) {
11
+ const classes = [
12
+ "vvp-ui-btn",
13
+ `vvp-ui-btn--${variant}`,
14
+ `vvp-ui-btn--${size}`,
15
+ className,
16
+ ]
11
17
  .filter(Boolean)
12
18
  .join(" ");
13
- return (_jsx("button", { className: classes, ...rest, children: children }));
14
- }
19
+ return (_jsx("button", { ref: ref, className: classes, ...rest, children: children }));
20
+ });
package/dist/Card.js CHANGED
@@ -2,6 +2,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import "./Card.css";
3
3
  /** Generic content surface — section grouping, list items, form containers. */
4
4
  export function Card({ bordered = false, className, children, ...rest }) {
5
- const classes = ["vvp-ui-card", bordered && "vvp-ui-card--bordered", className].filter(Boolean).join(" ");
5
+ const classes = [
6
+ "vvp-ui-card",
7
+ bordered && "vvp-ui-card--bordered",
8
+ className,
9
+ ]
10
+ .filter(Boolean)
11
+ .join(" ");
6
12
  return (_jsx("div", { className: classes, ...rest, children: children }));
7
13
  }
@@ -1,6 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import "./ProgressBar.css";
3
- const formatEuro = (value) => value.toLocaleString("de-DE", { minimumFractionDigits: 0, maximumFractionDigits: 0 }) + " €";
3
+ const formatEuro = (value) => value.toLocaleString("de-DE", {
4
+ minimumFractionDigits: 0,
5
+ maximumFractionDigits: 0,
6
+ }) + " €";
4
7
  /**
5
8
  * Campaign donation progress bar — one segment by default (0 to `goal`), or
6
9
  * multiple stacked segments when `milestones` has more than one entry.
@@ -8,7 +11,9 @@ const formatEuro = (value) => value.toLocaleString("de-DE", { minimumFractionDig
8
11
  * `@volksverpetzer/design-tokens`, same as the other components here.
9
12
  */
10
13
  export function ProgressBar({ total, goal, milestones, className, ...rest }) {
11
- const steps = milestones && milestones.length > 1 ? [...milestones].sort((a, b) => a.value - b.value) : [{ value: goal, label: "" }];
14
+ const steps = milestones && milestones.length > 1
15
+ ? [...milestones].sort((a, b) => a.value - b.value)
16
+ : [{ value: goal, label: "" }];
12
17
  const isSingleStep = steps.length === 1;
13
18
  const target = steps[steps.length - 1].value;
14
19
  const segments = steps.map((step, index) => {
@@ -22,7 +27,11 @@ export function ProgressBar({ total, goal, milestones, className, ...rest }) {
22
27
  const classes = ["vvp-ui-progress", className].filter(Boolean).join(" ");
23
28
  return (_jsxs("div", { className: classes, ...rest, children: [isSingleStep ? (_jsxs("div", { className: "vvp-ui-progress__amounts", children: [_jsx("span", { className: "vvp-ui-progress__total", children: formatEuro(total) }), _jsxs("span", { className: "vvp-ui-progress__goal", children: [" von ", formatEuro(goal)] })] })) : null, _jsx("div", { className: "vvp-ui-progress__track-row", role: "group", "aria-label": "Spendenfortschritt", children: segments.map((segment, index) => {
24
29
  const valueNow = Math.min(Math.max(total, segment.start), segment.value);
25
- return (_jsxs("div", { className: "vvp-ui-progress__step", style: { flexBasis: `${segment.width}%`, flexGrow: segment.width, flexShrink: 0 }, children: [_jsx("div", { className: "vvp-ui-progress__track", role: "progressbar", "aria-valuemin": segment.start, "aria-valuemax": segment.value, "aria-valuenow": valueNow, "aria-valuetext": isSingleStep
30
+ return (_jsxs("div", { className: "vvp-ui-progress__step", style: {
31
+ flexBasis: `${segment.width}%`,
32
+ flexGrow: segment.width,
33
+ flexShrink: 0,
34
+ }, children: [_jsx("div", { className: "vvp-ui-progress__track", role: "progressbar", "aria-valuemin": segment.start, "aria-valuemax": segment.value, "aria-valuenow": valueNow, "aria-valuetext": isSingleStep
26
35
  ? `${formatEuro(total)} von ${formatEuro(goal)}`
27
36
  : `${formatEuro(total)} insgesamt gesammelt, ${formatEuro(segment.filled)} von ${formatEuro(segment.range)} für „${segment.label}“`, "aria-label": isSingleStep
28
37
  ? `${formatEuro(total)} von ${formatEuro(goal)} gesammelt`
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { Button, type ButtonProps, type ButtonVariant, type ButtonSize } from "./Button";
1
+ export { Button, type ButtonProps, type ButtonVariant, type ButtonSize, } from "./Button";
2
2
  export { Badge, type BadgeProps, type BadgeVariant } from "./Badge";
3
3
  export { Card, type CardProps } from "./Card";
4
- export { ProgressBar, type ProgressBarProps, type ProgressBarMilestone } from "./ProgressBar";
4
+ export { ProgressBar, type ProgressBarProps, type ProgressBarMilestone, } from "./ProgressBar";
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { Button } from "./Button";
1
+ export { Button, } from "./Button";
2
2
  export { Badge } from "./Badge";
3
3
  export { Card } from "./Card";
4
- export { ProgressBar } from "./ProgressBar";
4
+ export { ProgressBar, } from "./ProgressBar";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volksverpetzer/ui-web",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Shared brand-visible React components (Button, Badge, Card) for vvp_link_shortener, vvp_divi5_extensions, and crowdfunding. Plain, hand-scoped CSS (vvp-ui-* class prefix) consuming the --vvp-* custom properties emitted by @volksverpetzer/design-tokens — no Tailwind classes, so it drops into a Tailwind app and Divi's WordPress-embedded CSS alike.",
5
5
  "type": "module",
6
6
  "repository": {