@giddaa-housing/ui 1.1.0 → 2.0.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.
Files changed (47) hide show
  1. package/css/generated/shared.css +1 -1
  2. package/css/giddaa.css +12 -2
  3. package/dist/badge.js +1 -1
  4. package/dist/bullet-chart.d.ts +8 -4
  5. package/dist/bullet-chart.js +10 -6
  6. package/dist/button.js +1 -1
  7. package/dist/card.js +1 -1
  8. package/dist/chart.d.ts +33 -5
  9. package/dist/chart.js +210 -13
  10. package/dist/checkbox.js +1 -1
  11. package/dist/data-table.d.ts +7 -3
  12. package/dist/data-table.js +8 -5
  13. package/dist/dialog-nesting.d.ts +9 -0
  14. package/dist/dialog-nesting.js +27 -0
  15. package/dist/dialog.js +9 -5
  16. package/dist/file-upload.d.ts +43 -0
  17. package/dist/file-upload.js +154 -0
  18. package/dist/funnel-chart.d.ts +11 -7
  19. package/dist/funnel-chart.js +11 -8
  20. package/dist/input-group.js +1 -1
  21. package/dist/input-otp.d.ts +23 -0
  22. package/dist/input-otp.js +56 -0
  23. package/dist/input.js +1 -1
  24. package/dist/line-chart.d.ts +113 -41
  25. package/dist/line-chart.js +217 -30
  26. package/dist/list-item.d.ts +22 -0
  27. package/dist/list-item.js +84 -0
  28. package/dist/number-input.js +20 -17
  29. package/dist/pie-chart.d.ts +83 -52
  30. package/dist/pie-chart.js +85 -43
  31. package/dist/purchase-option-card.d.ts +79 -0
  32. package/dist/purchase-option-card.js +176 -0
  33. package/dist/radio-group.js +1 -1
  34. package/dist/select.js +1 -1
  35. package/dist/sheet.d.ts +4 -2
  36. package/dist/sheet.js +22 -11
  37. package/dist/sparkline.d.ts +28 -15
  38. package/dist/sparkline.js +131 -37
  39. package/dist/styles.css +831 -119
  40. package/dist/switch.js +1 -1
  41. package/dist/table.js +6 -2
  42. package/dist/tabs.d.ts +21 -5
  43. package/dist/tabs.js +55 -12
  44. package/dist/textarea.js +1 -1
  45. package/dist/tree-map.d.ts +14 -14
  46. package/dist/tree-map.js +14 -15
  47. package/package.json +17 -1
package/dist/pie-chart.js CHANGED
@@ -1,9 +1,21 @@
1
1
  "use client";
2
2
  import { t as cn } from "./cn-BI_4DMBf.js";
3
- import { useComponentSize } from "./size-context.js";
3
+ import { SizeProvider, useComponentSize } from "./size-context.js";
4
+ import { ChartContainer } from "./chart.js";
4
5
  import { jsx, jsxs } from "react/jsx-runtime";
5
6
  import { cva } from "class-variance-authority";
7
+ import { Pie, PieChart as PieChart$1 } from "recharts";
6
8
  //#region src/pie-chart.tsx
9
+ /**
10
+ * Categorical segment palette — the theme-aware `chart-1`…`chart-3` tokens.
11
+ * Assign colours in this fixed slot order, never cycled: a fourth category folds
12
+ * into "Other". Override per segment with a `Cell` `fill`.
13
+ */
14
+ const PIE_CHART_PALETTE = [
15
+ "var(--color-chart-1)",
16
+ "var(--color-chart-2)",
17
+ "var(--color-chart-3)"
18
+ ];
7
19
  const PIE_CHART_LAYOUT = {
8
20
  sm: {
9
21
  size: 132,
@@ -34,52 +46,53 @@ const PIE_CHART_LAYOUT = {
34
46
  }
35
47
  };
36
48
  /**
37
- * Categorical palette for pie/donut segments, ordered by share. Giddaa has no
38
- * `chart-1`…`chart-N` tokens yet, so these map to the brand scales: forest
39
- * brass moss clay stone. Assign by index, or override per `Cell`.
40
- */
41
- const PIE_CHART_PALETTE = [
42
- "var(--color-forest-700)",
43
- "var(--color-brass-500)",
44
- "var(--color-moss-600)",
45
- "var(--color-clay-500)",
46
- "var(--color-stone-500)"
47
- ];
48
- /**
49
- * Resolve the pie-chart layout for an explicit or inherited component size and
50
- * chart `type`. The returned object groups the giddaa defaults by the recharts
51
- * component they belong to — spread `container` onto `ChartContainer` and `pie`
52
- * onto `Pie`, then pass the data-specific props (`data`, `dataKey`, `nameKey`)
53
- * directly afterwards. `type="pie"` collapses the donut hole (`innerRadius` 0).
49
+ * Plot root wraps the shared `ChartContainer` (tooltip/legend theming,
50
+ * responsive box) around the recharts `PieChart` in a fixed square box from
51
+ * `PIE_CHART_LAYOUT` (unlike the cartesian roots, a pie's width is not
52
+ * parent-driven). `size` flows to the child primitives through `SizeProvider`.
54
53
  */
55
- function usePieChartLayout({ size, type = "donut" } = {}) {
56
- const layout = PIE_CHART_LAYOUT[useComponentSize(size)];
57
- return {
58
- container: {
59
- className: "aspect-square shrink-0",
54
+ function PieChart({ config = {}, size, className, children, ...props }) {
55
+ const resolvedSize = useComponentSize(size);
56
+ const layout = PIE_CHART_LAYOUT[resolvedSize];
57
+ return /* @__PURE__ */ jsx(SizeProvider, {
58
+ size: resolvedSize,
59
+ children: /* @__PURE__ */ jsx(ChartContainer, {
60
+ config,
61
+ className: cn("aspect-square shrink-0", className),
60
62
  style: {
61
63
  width: layout.size,
62
64
  height: layout.size
63
- }
64
- },
65
- pie: {
66
- innerRadius: type === "pie" ? 0 : layout.innerRadius,
67
- outerRadius: layout.outerRadius,
68
- paddingAngle: type === "pie" ? 0 : layout.paddingAngle,
69
- cornerRadius: layout.cornerRadius,
70
- strokeWidth: 0
71
- },
72
- label: {
73
- totalFontSize: layout.totalFontSize,
74
- captionFontSize: layout.captionFontSize
75
- }
76
- };
65
+ },
66
+ children: /* @__PURE__ */ jsx(PieChart$1, {
67
+ accessibilityLayer: true,
68
+ ...props,
69
+ children
70
+ })
71
+ })
72
+ });
73
+ }
74
+ /**
75
+ * One data series — recharts `Pie` with the giddaa mark spec: size-scaled
76
+ * radii, a small inter-segment gap, and no stroke. Pass `Cell` children for
77
+ * per-segment colours and a `Label` for the donut center. Each numeric prop is
78
+ * defaulted from the layout and still wins when passed directly.
79
+ */
80
+ function PieChartSeries({ type = "donut", size, innerRadius, outerRadius, paddingAngle, cornerRadius, strokeWidth, ...props }) {
81
+ const layout = PIE_CHART_LAYOUT[useComponentSize(size)];
82
+ return /* @__PURE__ */ jsx(Pie, {
83
+ innerRadius: innerRadius ?? (type === "pie" ? 0 : layout.innerRadius),
84
+ outerRadius: outerRadius ?? layout.outerRadius,
85
+ paddingAngle: paddingAngle ?? (type === "pie" ? 0 : layout.paddingAngle),
86
+ cornerRadius: cornerRadius ?? layout.cornerRadius,
87
+ strokeWidth: strokeWidth ?? 0,
88
+ ...props
89
+ });
77
90
  }
78
91
  function PieCenterLabel({ total, caption, size, viewBox }) {
79
- const { label } = usePieChartLayout({ size });
92
+ const layout = PIE_CHART_LAYOUT[useComponentSize(size)];
80
93
  if (!viewBox || viewBox.cx == null || viewBox.cy == null) return null;
81
94
  const { cx, cy } = viewBox;
82
- const captionY = cy + label.totalFontSize * .72;
95
+ const captionY = cy + layout.totalFontSize * .72;
83
96
  return /* @__PURE__ */ jsxs("text", {
84
97
  x: cx,
85
98
  y: cy,
@@ -87,15 +100,15 @@ function PieCenterLabel({ total, caption, size, viewBox }) {
87
100
  dominantBaseline: "central",
88
101
  children: [/* @__PURE__ */ jsx("tspan", {
89
102
  x: cx,
90
- y: caption == null ? cy : cy - label.captionFontSize * .5,
103
+ y: caption == null ? cy : cy - layout.captionFontSize * .5,
91
104
  className: "fill-fg-primary font-extrabold tabular-nums",
92
- style: { fontSize: label.totalFontSize },
105
+ style: { fontSize: layout.totalFontSize },
93
106
  children: total
94
107
  }), caption != null && /* @__PURE__ */ jsx("tspan", {
95
108
  x: cx,
96
109
  y: captionY,
97
110
  className: "fill-fg-secondary font-medium",
98
- style: { fontSize: label.captionFontSize },
111
+ style: { fontSize: layout.captionFontSize },
99
112
  children: caption
100
113
  })]
101
114
  });
@@ -145,5 +158,34 @@ function PieChartLegend({ items, size, className, ...props }) {
145
158
  }, item.label))
146
159
  });
147
160
  }
161
+ /**
162
+ * @deprecated Compose the `<PieChart>`/`<PieChartSeries>` primitives instead —
163
+ * see the module example. This layout hook predates recharts 3 wrapping support
164
+ * and will be removed in the next major. It returns prop bags to spread onto raw
165
+ * recharts elements.
166
+ */
167
+ function usePieChartLayout({ size, type = "donut" } = {}) {
168
+ const layout = PIE_CHART_LAYOUT[useComponentSize(size)];
169
+ return {
170
+ container: {
171
+ className: "aspect-square shrink-0",
172
+ style: {
173
+ width: layout.size,
174
+ height: layout.size
175
+ }
176
+ },
177
+ pie: {
178
+ innerRadius: type === "pie" ? 0 : layout.innerRadius,
179
+ outerRadius: layout.outerRadius,
180
+ paddingAngle: type === "pie" ? 0 : layout.paddingAngle,
181
+ cornerRadius: layout.cornerRadius,
182
+ strokeWidth: 0
183
+ },
184
+ label: {
185
+ totalFontSize: layout.totalFontSize,
186
+ captionFontSize: layout.captionFontSize
187
+ }
188
+ };
189
+ }
148
190
  //#endregion
149
- export { PIE_CHART_LAYOUT, PIE_CHART_PALETTE, PieCenterLabel, PieChartLegend, usePieChartLayout };
191
+ export { PIE_CHART_LAYOUT, PIE_CHART_PALETTE, PieCenterLabel, PieChart, PieChartLegend, PieChartSeries, usePieChartLayout };
@@ -0,0 +1,79 @@
1
+ import { useRender } from "@base-ui/react/use-render";
2
+ import { VariantProps } from "class-variance-authority";
3
+ import * as React from "react";
4
+ //#region src/purchase-option-card.d.ts
5
+ declare const purchaseOptionCardVariants: (props?: ({
6
+ selected?: boolean | null | undefined;
7
+ disabled?: boolean | null | undefined;
8
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
+ type PurchaseOptionCardProps = useRender.ComponentProps<"article"> & VariantProps<typeof purchaseOptionCardVariants>;
10
+ /**
11
+ * Root surface for a single purchase / mortgage option. Composable — assemble
12
+ * it from the header, grid, and footer parts so the actions can vary per use.
13
+ *
14
+ * `disabled` is propagated to descendants via a `data-disabled` group flag, so
15
+ * the header/grid text mutes automatically. Footer buttons are supplied by the
16
+ * consumer, so pass `disabled` to them too.
17
+ *
18
+ * <PurchaseOptionCard>
19
+ * <PurchaseOptionCardHeader>
20
+ * <PurchaseOptionCardMeta>
21
+ * <PurchaseOptionCardLabel>Mortgage Plan</PurchaseOptionCardLabel>
22
+ * <Badge variant="default" border={false} shape="round" size="sm">
23
+ * 20% Interest Rate
24
+ * </Badge>
25
+ * </PurchaseOptionCardMeta>
26
+ * <div>
27
+ * <PurchaseOptionCardAmount>₦1,200,000</PurchaseOptionCardAmount>
28
+ * <PurchaseOptionCardCadence>Per Month</PurchaseOptionCardCadence>
29
+ * </div>
30
+ * </PurchaseOptionCardHeader>
31
+ * <PurchaseOptionCardGrid>
32
+ * <PurchaseOptionCardItem label="Initial Deposit">₦5,000,000</PurchaseOptionCardItem>
33
+ * <PurchaseOptionCardItem label="Max Loan Amount">₦80,000,000</PurchaseOptionCardItem>
34
+ * <PurchaseOptionCardItem label="Max Payment Period" wide>20 Years</PurchaseOptionCardItem>
35
+ * </PurchaseOptionCardGrid>
36
+ * <PurchaseOptionCardFooter>
37
+ * <Button variant="primary-outline" size="md" className="flex-1">View Details</Button>
38
+ * <Button variant="primary" size="md" className="flex-1">Apply Now</Button>
39
+ * </PurchaseOptionCardFooter>
40
+ * </PurchaseOptionCard>
41
+ */
42
+ declare function PurchaseOptionCard({ className, disabled, render, selected, ...props }: PurchaseOptionCardProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
43
+ /**
44
+ * Top section wrapper. Stacks the meta row and the headline figure, and draws
45
+ * the divider that separates the header from the grid.
46
+ */
47
+ declare function PurchaseOptionCardHeader({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
48
+ /**
49
+ * Row inside the header that balances the plan label against the interest-rate
50
+ * badge (or any other trailing content).
51
+ */
52
+ declare function PurchaseOptionCardMeta({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
53
+ /** Eyebrow label naming the plan type. */
54
+ declare function PurchaseOptionCardLabel({ className, render, ...props }: useRender.ComponentProps<"span">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
55
+ /** Headline figure — the plan's payment amount. */
56
+ declare function PurchaseOptionCardAmount({ className, render, ...props }: useRender.ComponentProps<"h3">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
57
+ /** Supporting cadence line beneath the headline figure. */
58
+ declare function PurchaseOptionCardCadence({ className, render, ...props }: useRender.ComponentProps<"p">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
59
+ /** Two-column grid holding the option's detail items. */
60
+ declare function PurchaseOptionCardGrid({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
61
+ type PurchaseOptionCardItemProps = useRender.ComponentProps<"div"> & {
62
+ /** Caption rendered beneath the value. */
63
+ label: React.ReactNode;
64
+ /** Span both grid columns. */
65
+ wide?: boolean;
66
+ };
67
+ /**
68
+ * A single labelled detail cell in the grid. The value is passed as `children`,
69
+ * the caption via `label`. Use `wide` to span the full row.
70
+ */
71
+ declare function PurchaseOptionCardItem({ children, className, label, render, wide, ...props }: PurchaseOptionCardItemProps): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
72
+ /**
73
+ * Action row at the foot of the card. Wraps the consumer-supplied buttons and
74
+ * draws the divider above them. Give each button `className="flex-1"` to share
75
+ * the row evenly.
76
+ */
77
+ declare function PurchaseOptionCardFooter({ className, render, ...props }: useRender.ComponentProps<"div">): React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
78
+ //#endregion
79
+ export { PurchaseOptionCard, PurchaseOptionCardAmount, PurchaseOptionCardCadence, PurchaseOptionCardFooter, PurchaseOptionCardGrid, PurchaseOptionCardHeader, PurchaseOptionCardItem, type PurchaseOptionCardItemProps, PurchaseOptionCardLabel, PurchaseOptionCardMeta, type PurchaseOptionCardProps, purchaseOptionCardVariants };
@@ -0,0 +1,176 @@
1
+ import { t as cn } from "./cn-BI_4DMBf.js";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
+ import { mergeProps } from "@base-ui/react/merge-props";
4
+ import { useRender } from "@base-ui/react/use-render";
5
+ import { cva } from "class-variance-authority";
6
+ //#region src/purchase-option-card.tsx
7
+ const purchaseOptionCardVariants = cva("group/purchase-option-card relative flex w-full min-w-0 flex-col gap-3.5 rounded-2xl border bg-surface-overlay px-6 py-5 shadow-1 transition-[background-color,border-color,box-shadow]", {
8
+ variants: {
9
+ selected: {
10
+ true: "border-line-focus bg-surface-brand-subtle inset-ring-1 inset-ring-line-focus",
11
+ false: "border-line-subtle hover:border-line hover:shadow-2"
12
+ },
13
+ disabled: {
14
+ true: "border-line-subtle bg-surface shadow-none hover:border-line-subtle hover:shadow-none",
15
+ false: ""
16
+ }
17
+ },
18
+ compoundVariants: [{
19
+ selected: true,
20
+ disabled: true,
21
+ class: "border-line-subtle bg-surface shadow-none inset-ring-0 hover:border-line-subtle hover:shadow-none"
22
+ }],
23
+ defaultVariants: {
24
+ selected: false,
25
+ disabled: false
26
+ }
27
+ });
28
+ /**
29
+ * Root surface for a single purchase / mortgage option. Composable — assemble
30
+ * it from the header, grid, and footer parts so the actions can vary per use.
31
+ *
32
+ * `disabled` is propagated to descendants via a `data-disabled` group flag, so
33
+ * the header/grid text mutes automatically. Footer buttons are supplied by the
34
+ * consumer, so pass `disabled` to them too.
35
+ *
36
+ * <PurchaseOptionCard>
37
+ * <PurchaseOptionCardHeader>
38
+ * <PurchaseOptionCardMeta>
39
+ * <PurchaseOptionCardLabel>Mortgage Plan</PurchaseOptionCardLabel>
40
+ * <Badge variant="default" border={false} shape="round" size="sm">
41
+ * 20% Interest Rate
42
+ * </Badge>
43
+ * </PurchaseOptionCardMeta>
44
+ * <div>
45
+ * <PurchaseOptionCardAmount>₦1,200,000</PurchaseOptionCardAmount>
46
+ * <PurchaseOptionCardCadence>Per Month</PurchaseOptionCardCadence>
47
+ * </div>
48
+ * </PurchaseOptionCardHeader>
49
+ * <PurchaseOptionCardGrid>
50
+ * <PurchaseOptionCardItem label="Initial Deposit">₦5,000,000</PurchaseOptionCardItem>
51
+ * <PurchaseOptionCardItem label="Max Loan Amount">₦80,000,000</PurchaseOptionCardItem>
52
+ * <PurchaseOptionCardItem label="Max Payment Period" wide>20 Years</PurchaseOptionCardItem>
53
+ * </PurchaseOptionCardGrid>
54
+ * <PurchaseOptionCardFooter>
55
+ * <Button variant="primary-outline" size="md" className="flex-1">View Details</Button>
56
+ * <Button variant="primary" size="md" className="flex-1">Apply Now</Button>
57
+ * </PurchaseOptionCardFooter>
58
+ * </PurchaseOptionCard>
59
+ */
60
+ function PurchaseOptionCard({ className, disabled = false, render, selected = false, ...props }) {
61
+ return useRender({
62
+ defaultTagName: "article",
63
+ props: mergeProps({
64
+ "data-disabled": disabled || void 0,
65
+ className: cn(purchaseOptionCardVariants({
66
+ selected: !disabled && selected,
67
+ disabled
68
+ }), className)
69
+ }, props),
70
+ render,
71
+ state: {
72
+ disabled,
73
+ selected,
74
+ slot: "purchase-option-card"
75
+ }
76
+ });
77
+ }
78
+ /**
79
+ * Top section wrapper. Stacks the meta row and the headline figure, and draws
80
+ * the divider that separates the header from the grid.
81
+ */
82
+ function PurchaseOptionCardHeader({ className, render, ...props }) {
83
+ return useRender({
84
+ defaultTagName: "div",
85
+ props: mergeProps({ className: cn("flex min-w-0 flex-col gap-3.5 border-line border-b pb-3.5", className) }, props),
86
+ render,
87
+ state: { slot: "purchase-option-card-header" }
88
+ });
89
+ }
90
+ /**
91
+ * Row inside the header that balances the plan label against the interest-rate
92
+ * badge (or any other trailing content).
93
+ */
94
+ function PurchaseOptionCardMeta({ className, render, ...props }) {
95
+ return useRender({
96
+ defaultTagName: "div",
97
+ props: mergeProps({ className: cn("flex items-start justify-between gap-4", className) }, props),
98
+ render,
99
+ state: { slot: "purchase-option-card-meta" }
100
+ });
101
+ }
102
+ /** Eyebrow label naming the plan type. */
103
+ function PurchaseOptionCardLabel({ className, render, ...props }) {
104
+ return useRender({
105
+ defaultTagName: "span",
106
+ props: mergeProps({ className: cn("text-gdt-capitalized font-semibold text-fg-secondary uppercase group-data-disabled/purchase-option-card:text-fg-caption-placeholder", className) }, props),
107
+ render,
108
+ state: { slot: "purchase-option-card-label" }
109
+ });
110
+ }
111
+ /** Headline figure — the plan's payment amount. */
112
+ function PurchaseOptionCardAmount({ className, render, ...props }) {
113
+ return useRender({
114
+ defaultTagName: "h3",
115
+ props: mergeProps({ className: cn("text-gdt-h3 font-extrabold text-fg-primary group-data-disabled/purchase-option-card:text-fg-caption-placeholder", className) }, props),
116
+ render,
117
+ state: { slot: "purchase-option-card-amount" }
118
+ });
119
+ }
120
+ /** Supporting cadence line beneath the headline figure. */
121
+ function PurchaseOptionCardCadence({ className, render, ...props }) {
122
+ return useRender({
123
+ defaultTagName: "p",
124
+ props: mergeProps({ className: cn("text-gdt-sm leading-none text-fg-secondary group-data-disabled/purchase-option-card:text-fg-caption-placeholder", className) }, props),
125
+ render,
126
+ state: { slot: "purchase-option-card-cadence" }
127
+ });
128
+ }
129
+ /** Two-column grid holding the option's detail items. */
130
+ function PurchaseOptionCardGrid({ className, render, ...props }) {
131
+ return useRender({
132
+ defaultTagName: "div",
133
+ props: mergeProps({ className: cn("grid grid-cols-2 gap-x-4 gap-y-6", className) }, props),
134
+ render,
135
+ state: { slot: "purchase-option-card-grid" }
136
+ });
137
+ }
138
+ /**
139
+ * A single labelled detail cell in the grid. The value is passed as `children`,
140
+ * the caption via `label`. Use `wide` to span the full row.
141
+ */
142
+ function PurchaseOptionCardItem({ children, className, label, render, wide = false, ...props }) {
143
+ return useRender({
144
+ defaultTagName: "div",
145
+ props: mergeProps({
146
+ children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("p", {
147
+ className: "text-gdt-sm font-semibold text-fg-primary group-data-disabled/purchase-option-card:text-fg-caption-placeholder",
148
+ children
149
+ }), /* @__PURE__ */ jsx("p", {
150
+ className: "text-gdt-xs text-fg-secondary group-data-disabled/purchase-option-card:text-fg-caption-placeholder",
151
+ children: label
152
+ })] }),
153
+ className: cn("flex flex-col gap-1", wide && "col-span-2", className)
154
+ }, props),
155
+ render,
156
+ state: {
157
+ slot: "purchase-option-card-item",
158
+ wide
159
+ }
160
+ });
161
+ }
162
+ /**
163
+ * Action row at the foot of the card. Wraps the consumer-supplied buttons and
164
+ * draws the divider above them. Give each button `className="flex-1"` to share
165
+ * the row evenly.
166
+ */
167
+ function PurchaseOptionCardFooter({ className, render, ...props }) {
168
+ return useRender({
169
+ defaultTagName: "div",
170
+ props: mergeProps({ className: cn("flex items-center gap-3 border-line border-t pt-3.5", className) }, props),
171
+ render,
172
+ state: { slot: "purchase-option-card-footer" }
173
+ });
174
+ }
175
+ //#endregion
176
+ export { PurchaseOptionCard, PurchaseOptionCardAmount, PurchaseOptionCardCadence, PurchaseOptionCardFooter, PurchaseOptionCardGrid, PurchaseOptionCardHeader, PurchaseOptionCardItem, PurchaseOptionCardLabel, PurchaseOptionCardMeta, purchaseOptionCardVariants };
@@ -13,7 +13,7 @@ function RadioGroup({ className, ...props }) {
13
13
  ...props
14
14
  });
15
15
  }
16
- const radioVariants = cva("group/radio-group-item peer relative flex aspect-square shrink-0 rounded-full border-2 bg-transparent text-transparent outline-none transition-[background-color,border-color,box-shadow,color] after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-line-focus focus-visible:shadow-[0px_0px_0px_2px_var(--color-line-focus)] aria-invalid:border-line-danger aria-invalid:ring-3 aria-invalid:ring-destructive/20 border-line-strong data-checked:border-action-primary data-checked:text-action-primary data-disabled:cursor-not-allowed data-disabled:border-line-subtle data-disabled:bg-surface data-disabled:text-fg-caption-placeholder size-5 [--radio-dot-size:0.75rem] group-data-[size=sm]/field:size-4 group-data-[size=sm]/field:[--radio-dot-size:0.625rem] group-data-[size=md]/field:size-5 group-data-[size=md]/field:[--radio-dot-size:0.75rem] group-data-[size=lg]/field:size-6 group-data-[size=lg]/field:[--radio-dot-size:0.875rem]", { variants: { size: {
16
+ const radioVariants = cva("group/radio-group-item peer relative flex aspect-square shrink-0 rounded-full border-2 bg-transparent text-transparent outline-none transition-[background-color,border-color,box-shadow,color] after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-line-focus focus-visible:shadow-[0px_0px_0px_2px_var(--color-line-focus)] aria-invalid:border-line-danger aria-invalid:ring-3 aria-invalid:ring-line-danger/20 aria-invalid:focus-visible:border-line-danger aria-invalid:focus-visible:shadow-[0px_0px_0px_2px_var(--color-line-danger)] border-line-strong data-checked:border-action-primary data-checked:text-action-primary data-disabled:cursor-not-allowed data-disabled:border-line-subtle data-disabled:bg-surface data-disabled:text-fg-caption-placeholder size-5 [--radio-dot-size:0.75rem] group-data-[size=sm]/field:size-4 group-data-[size=sm]/field:[--radio-dot-size:0.625rem] group-data-[size=md]/field:size-5 group-data-[size=md]/field:[--radio-dot-size:0.75rem] group-data-[size=lg]/field:size-6 group-data-[size=lg]/field:[--radio-dot-size:0.875rem]", { variants: { size: {
17
17
  sm: "size-4 [--radio-dot-size:0.625rem]",
18
18
  md: "size-5 [--radio-dot-size:0.75rem]",
19
19
  lg: "size-6 [--radio-dot-size:0.875rem]"
package/dist/select.js CHANGED
@@ -21,7 +21,7 @@ function Select({ multiple, children, size, ...props }) {
21
21
  })
22
22
  });
23
23
  }
24
- const selectTriggerVariants = cva("group/select-trigger flex w-fit min-w-0 items-center justify-between rounded-full border border-line bg-canvas text-left font-normal whitespace-nowrap text-fg-primary shadow-none outline-none transition-[background-color,border-color,border-radius,box-shadow,color] select-none hover:border-line-strong focus-visible:border-line-focus focus-visible:inset-ring-1 focus-visible:inset-ring-line-focus data-focused:border-line-focus data-focused:inset-ring-1 data-focused:inset-ring-line-focus data-popup-open:rounded-2xl data-popup-open:border-line-focus data-popup-open:inset-ring-1 data-popup-open:inset-ring-line-focus disabled:pointer-events-none disabled:cursor-not-allowed disabled:border-line-subtle disabled:bg-surface disabled:text-fg-caption-placeholder data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:border-line-subtle data-disabled:bg-surface data-disabled:text-fg-caption-placeholder data-placeholder:text-fg-caption-placeholder aria-invalid:border-line-danger aria-invalid:text-fg-danger aria-invalid:shadow-none data-[invalid=true]:border-line-danger data-[invalid=true]:text-fg-danger *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:min-w-0 *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
24
+ const selectTriggerVariants = cva("group/select-trigger flex w-fit min-w-0 items-center justify-between rounded-full border border-line bg-canvas text-left font-normal whitespace-nowrap text-fg-primary shadow-none outline-none transition-[background-color,border-color,border-radius,box-shadow,color] select-none hover:border-line-strong focus-visible:border-line-focus focus-visible:inset-ring-1 focus-visible:inset-ring-line-focus data-focused:border-line-focus data-focused:inset-ring-1 data-focused:inset-ring-line-focus data-popup-open:rounded-2xl data-popup-open:border-line-focus data-popup-open:inset-ring-1 data-popup-open:inset-ring-line-focus disabled:pointer-events-none disabled:cursor-not-allowed disabled:border-line-subtle disabled:bg-surface disabled:text-fg-caption-placeholder data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-disabled:border-line-subtle data-disabled:bg-surface data-disabled:text-fg-caption-placeholder data-placeholder:text-fg-caption-placeholder aria-invalid:border-line-danger aria-invalid:text-fg-danger aria-invalid:shadow-none data-[invalid=true]:border-line-danger data-[invalid=true]:text-fg-danger data-[invalid=true]:focus-visible:border-line-danger data-[invalid=true]:focus-visible:inset-ring-line-danger data-[invalid=true]:data-focused:border-line-danger data-[invalid=true]:data-focused:inset-ring-line-danger data-[invalid=true]:data-popup-open:border-line-danger data-[invalid=true]:data-popup-open:inset-ring-line-danger *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:min-w-0 *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0", {
25
25
  variants: { size: {
26
26
  sm: "h-8 gap-2 px-3 text-gdt-xs [&_svg:not([class*='size-'])]:size-3.5",
27
27
  md: "h-10 gap-2 px-3.5 text-gdt-sm [&_svg:not([class*='size-'])]:size-4",
package/dist/sheet.d.ts CHANGED
@@ -8,6 +8,7 @@ declare function SheetClose({ ...props }: Dialog.Close.Props): React.JSX.Element
8
8
  type SheetContentProps = Dialog.Popup.Props & {
9
9
  side?: SheetSide;
10
10
  showCloseButton?: boolean;
11
+ showOverlay?: boolean;
11
12
  } & ({
12
13
  side: "top" | "bottom";
13
14
  size?: "fullscreen";
@@ -15,10 +16,11 @@ type SheetContentProps = Dialog.Popup.Props & {
15
16
  side?: "left" | "right";
16
17
  size?: "sm" | "md" | "lg";
17
18
  });
18
- declare function SheetContent({ className, children, side, size, showCloseButton, ...props }: SheetContentProps): React.JSX.Element;
19
+ declare function SheetContent({ className, children, side, size, showCloseButton, showOverlay, ...props }: SheetContentProps): React.JSX.Element;
19
20
  declare function SheetHeader({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
21
+ declare function SheetBody({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
20
22
  declare function SheetFooter({ className, ...props }: React.ComponentProps<"div">): React.JSX.Element;
21
23
  declare function SheetTitle({ className, ...props }: Dialog.Title.Props): React.JSX.Element;
22
24
  declare function SheetDescription({ className, ...props }: Dialog.Description.Props): React.JSX.Element;
23
25
  //#endregion
24
- export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger };
26
+ export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger };
package/dist/sheet.js CHANGED
@@ -2,16 +2,17 @@
2
2
  import { t as cn } from "./cn-BI_4DMBf.js";
3
3
  import { SizeProvider } from "./size-context.js";
4
4
  import { Button } from "./button.js";
5
+ import { DialogNestingProvider, useDialogNestingDepth } from "./dialog-nesting.js";
5
6
  import { XIcon } from "lucide-react";
6
7
  import { jsx, jsxs } from "react/jsx-runtime";
7
8
  import { cva } from "class-variance-authority";
8
9
  import { Dialog } from "@base-ui/react/dialog";
9
10
  //#region src/sheet.tsx
10
11
  function Sheet({ ...props }) {
11
- return /* @__PURE__ */ jsx(Dialog.Root, {
12
+ return /* @__PURE__ */ jsx(DialogNestingProvider, { children: /* @__PURE__ */ jsx(Dialog.Root, {
12
13
  "data-slot": "sheet",
13
14
  ...props
14
- });
15
+ }) });
15
16
  }
16
17
  function SheetTrigger({ ...props }) {
17
18
  return /* @__PURE__ */ jsx(Dialog.Trigger, {
@@ -32,13 +33,16 @@ function SheetPortal({ ...props }) {
32
33
  });
33
34
  }
34
35
  function SheetOverlay({ className, ...props }) {
36
+ const nested = useDialogNestingDepth() > 1;
35
37
  return /* @__PURE__ */ jsx(Dialog.Backdrop, {
38
+ forceRender: true,
36
39
  "data-slot": "sheet-overlay",
37
- className: cn("fixed inset-0 z-50 bg-black/55 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xl", className),
40
+ "data-nested": nested || void 0,
41
+ className: cn("fixed inset-0 z-50 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0", nested ? "bg-black/25" : "bg-black/55 supports-backdrop-filter:backdrop-blur-xl", className),
38
42
  ...props
39
43
  });
40
44
  }
41
- const sheetContentVariants = cva("group/sheet-content fixed z-50 flex flex-col gap-0 overflow-visible rounded-2xl border border-line-subtle bg-surface-overlay bg-clip-padding text-fg-primary shadow-(--elevation-e2-shadow) transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 [--sheet-padding-x:1rem] [--sheet-padding-top:1rem] data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:w-full data-[side=bottom]:rounded-b-none data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:w-full data-[side=top]:rounded-t-none data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:rounded-l-none data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:rounded-r-none data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] px-(--sheet-padding-x) **:data-[slot=tabs]:has-data-[variant=underline]:-mx-(--sheet-padding-x) **:has-data-[variant=underline]:*:px-(--sheet-padding-x)", {
45
+ const sheetContentVariants = cva("group/sheet-content fixed z-50 flex flex-col gap-0 overflow-visible rounded-2xl border border-line-subtle bg-surface-overlay bg-clip-padding text-fg-primary shadow-(--elevation-e2-shadow) transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 [--sheet-padding-x:1rem] [--sheet-padding-top:1rem] data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:w-full data-[side=bottom]:rounded-b-none data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:w-full data-[side=top]:rounded-t-none data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:rounded-l-none data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:rounded-r-none data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=bottom]:data-[nested-dialog-open]:translate-y-[calc(var(--nested-dialogs)*-1.5rem)] data-[side=top]:data-[nested-dialog-open]:translate-y-[calc(var(--nested-dialogs)*1.5rem)] data-[side=left]:data-[nested-dialog-open]:translate-x-[calc(var(--nested-dialogs)*1.5rem)] data-[side=right]:data-[nested-dialog-open]:translate-x-[calc(var(--nested-dialogs)*-1.5rem)] data-[side=bottom]:data-[nested-dialog-open]:scale-x-[calc(1_-_var(--nested-dialogs)*0.05)] data-[side=top]:data-[nested-dialog-open]:scale-x-[calc(1_-_var(--nested-dialogs)*0.05)]", {
42
46
  variants: { size: {
43
47
  sm: "sm:[--sheet-padding-top:1.5rem] sm:[--sheet-padding-x:1.5rem] w-90 max-w-[calc(100vw-2.5rem)] [--sheet-title:var(--text-gdt-h5)]",
44
48
  md: "sm:[--sheet-padding-top:1.5rem] sm:[--sheet-padding-x:2rem] xl:[--sheet-padding-x:2.5rem] w-120 max-w-[calc(100vw-2.5rem)] [--sheet-title:var(--text-gdt-h4)]",
@@ -47,9 +51,9 @@ const sheetContentVariants = cva("group/sheet-content fixed z-50 flex flex-col g
47
51
  } },
48
52
  defaultVariants: { size: "md" }
49
53
  });
50
- function SheetContent({ className, children, side = "left", size = "md", showCloseButton = true, ...props }) {
54
+ function SheetContent({ className, children, side = "left", size = "md", showCloseButton = true, showOverlay = true, ...props }) {
51
55
  const resolvedSize = side === "top" || side === "bottom" ? "fullscreen" : size !== "fullscreen" ? size : "md";
52
- return /* @__PURE__ */ jsxs(SheetPortal, { children: [/* @__PURE__ */ jsx(SheetOverlay, {}), /* @__PURE__ */ jsx(SizeProvider, {
56
+ return /* @__PURE__ */ jsxs(SheetPortal, { children: [showOverlay && /* @__PURE__ */ jsx(SheetOverlay, {}), /* @__PURE__ */ jsx(SizeProvider, {
53
57
  size: resolvedSize === "fullscreen" ? "lg" : resolvedSize,
54
58
  children: /* @__PURE__ */ jsxs(Dialog.Popup, {
55
59
  "data-slot": "sheet-content",
@@ -61,8 +65,8 @@ function SheetContent({ className, children, side = "left", size = "md", showClo
61
65
  "data-slot": "sheet-close",
62
66
  render: /* @__PURE__ */ jsxs(Button, {
63
67
  variant: "ghost",
64
- className: "absolute z-10 size-8 border border-line bg-surface p-0 text-fg-primary shadow-(--elevation-e1-shadow) hover:bg-surface-raised group-data-[side=bottom]/sheet-content:-top-10 group-data-[side=bottom]/sheet-content:right-4 group-data-[side=top]/sheet-content:-bottom-10 group-data-[side=top]/sheet-content:right-4 group-data-[side=left]/sheet-content:-right-10 group-data-[side=left]/sheet-content:top-4 group-data-[side=right]/sheet-content:-left-10 group-data-[side=right]/sheet-content:top-4",
65
- size: "icon-sm",
68
+ className: "absolute z-10 size-7 border border-line bg-surface p-0 text-fg-primary shadow-(--elevation-e1-shadow) hover:bg-surface-raised group-data-[nested-dialog-open]/sheet-content:hidden group-data-[side=bottom]/sheet-content:-top-9 group-data-[side=bottom]/sheet-content:right-4 group-data-[side=top]/sheet-content:-bottom-9 group-data-[side=top]/sheet-content:right-4 group-data-[side=left]/sheet-content:-right-9 group-data-[side=left]/sheet-content:top-4 group-data-[side=right]/sheet-content:-left-9 group-data-[side=right]/sheet-content:top-4",
69
+ size: "icon-xs",
66
70
  children: [/* @__PURE__ */ jsx(XIcon, {}), /* @__PURE__ */ jsx("span", {
67
71
  className: "sr-only",
68
72
  children: "Close"
@@ -75,14 +79,21 @@ function SheetContent({ className, children, side = "left", size = "md", showClo
75
79
  function SheetHeader({ className, ...props }) {
76
80
  return /* @__PURE__ */ jsx("div", {
77
81
  "data-slot": "sheet-header",
78
- className: cn("flex flex-col gap-1 -mx-(--sheet-padding-x) px-(--sheet-padding-x) pt-(--sheet-padding-top) pb-4 border-b border-line-subtle group-has-[[data-slot=tabs-list][data-variant=underline]]/sheet-content:border-b-0 group-has-[[data-slot=tabs-list][data-variant=underline]]/sheet-content:pb-2", className),
82
+ className: cn("flex flex-col gap-1 px-(--sheet-padding-x) pt-(--sheet-padding-top) pb-4 border-b border-line-subtle", className),
83
+ ...props
84
+ });
85
+ }
86
+ function SheetBody({ className, ...props }) {
87
+ return /* @__PURE__ */ jsx("div", {
88
+ "data-slot": "sheet-body",
89
+ className: cn("flex-1 overflow-y-auto px-(--sheet-padding-x) py-4", className),
79
90
  ...props
80
91
  });
81
92
  }
82
93
  function SheetFooter({ className, ...props }) {
83
94
  return /* @__PURE__ */ jsx("div", {
84
95
  "data-slot": "sheet-footer",
85
- className: cn("mt-auto flex items-center justify-end gap-2 border-t border-line-subtle -mx-(--sheet-padding-x) px-(--sheet-padding-x) py-4", className),
96
+ className: cn("mt-auto flex items-center justify-end gap-2 border-t border-line-subtle px-(--sheet-padding-x) py-4", className),
86
97
  ...props
87
98
  });
88
99
  }
@@ -101,4 +112,4 @@ function SheetDescription({ className, ...props }) {
101
112
  });
102
113
  }
103
114
  //#endregion
104
- export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger };
115
+ export { Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger };