@geomak/ui 6.11.0 → 6.12.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/index.cjs +82 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +64 -1
- package/dist/index.d.ts +64 -1
- package/dist/index.js +82 -7
- package/dist/index.js.map +1 -1
- package/dist/styles.css +8 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2154,6 +2154,81 @@ function Calendar2({
|
|
|
2154
2154
|
}) })
|
|
2155
2155
|
] });
|
|
2156
2156
|
}
|
|
2157
|
+
var defaultFormat = (v) => `${v < 0 ? "-" : ""}$${Math.abs(v).toFixed(2)}`;
|
|
2158
|
+
var Stepper = ({
|
|
2159
|
+
quantity,
|
|
2160
|
+
max,
|
|
2161
|
+
onChange
|
|
2162
|
+
}) => {
|
|
2163
|
+
const btn = "flex h-7 w-7 items-center justify-center text-foreground-secondary hover:bg-surface-raised disabled:opacity-40 disabled:hover:bg-transparent focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-inset transition-colors";
|
|
2164
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-flex items-center rounded-md border border-border overflow-hidden", children: [
|
|
2165
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": "Decrease quantity", disabled: quantity <= 1, onClick: () => onChange?.(quantity - 1), className: btn, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-3.5 w-3.5", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", d: "M5 12h14" }) }) }),
|
|
2166
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "w-8 text-center text-sm tabular-nums text-foreground select-none", children: quantity }),
|
|
2167
|
+
/* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", "aria-label": "Increase quantity", disabled: max != null && quantity >= max, onClick: () => onChange?.(quantity + 1), className: btn, children: /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, className: "h-3.5 w-3.5", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", d: "M12 5v14M5 12h14" }) }) })
|
|
2168
|
+
] });
|
|
2169
|
+
};
|
|
2170
|
+
function Cart({
|
|
2171
|
+
items,
|
|
2172
|
+
onQuantityChange,
|
|
2173
|
+
onRemove,
|
|
2174
|
+
summaryRows = [],
|
|
2175
|
+
formatPrice = defaultFormat,
|
|
2176
|
+
checkoutLabel = "Checkout",
|
|
2177
|
+
onCheckout,
|
|
2178
|
+
emptyState,
|
|
2179
|
+
className = "",
|
|
2180
|
+
style
|
|
2181
|
+
}) {
|
|
2182
|
+
const subtotal = items.reduce((sum, it) => sum + it.price * it.quantity, 0);
|
|
2183
|
+
const total = subtotal + summaryRows.reduce((sum, r) => sum + r.value, 0);
|
|
2184
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ["flex flex-col rounded-xl border border-border bg-surface", className].filter(Boolean).join(" "), style, children: [
|
|
2185
|
+
items.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-8 text-center text-sm text-foreground-muted", children: emptyState ?? "Your cart is empty." }) : /* @__PURE__ */ jsxRuntime.jsx("ul", { className: "divide-y divide-border", children: items.map((it) => /* @__PURE__ */ jsxRuntime.jsxs("li", { className: "flex items-center gap-3 p-3", children: [
|
|
2186
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-14 w-14 flex-shrink-0 overflow-hidden rounded-md bg-surface-raised", children: it.image && /* @__PURE__ */ jsxRuntime.jsx("img", { src: it.image, alt: "", className: "h-full w-full object-cover" }) }),
|
|
2187
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
2188
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-sm font-medium text-foreground", children: it.name }),
|
|
2189
|
+
it.meta && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "truncate text-xs text-foreground-muted mt-0.5", children: it.meta }),
|
|
2190
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-1.5 flex items-center gap-3", children: [
|
|
2191
|
+
/* @__PURE__ */ jsxRuntime.jsx(Stepper, { quantity: it.quantity, max: it.max, onChange: (q) => onQuantityChange?.(it.id, Math.max(1, q)) }),
|
|
2192
|
+
onRemove && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2193
|
+
"button",
|
|
2194
|
+
{
|
|
2195
|
+
type: "button",
|
|
2196
|
+
onClick: () => onRemove(it.id),
|
|
2197
|
+
className: "text-xs text-foreground-muted hover:text-status-error transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-accent rounded px-1",
|
|
2198
|
+
children: "Remove"
|
|
2199
|
+
}
|
|
2200
|
+
)
|
|
2201
|
+
] })
|
|
2202
|
+
] }),
|
|
2203
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-shrink-0 text-sm font-semibold text-foreground tabular-nums", children: formatPrice(it.price * it.quantity) })
|
|
2204
|
+
] }, it.id)) }),
|
|
2205
|
+
items.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "border-t border-border p-4", children: [
|
|
2206
|
+
/* @__PURE__ */ jsxRuntime.jsxs("dl", { className: "space-y-1.5", children: [
|
|
2207
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
2208
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: "text-foreground-secondary", children: "Subtotal" }),
|
|
2209
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { className: "tabular-nums text-foreground", children: formatPrice(subtotal) })
|
|
2210
|
+
] }),
|
|
2211
|
+
summaryRows.map((r, i) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-sm", children: [
|
|
2212
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: r.muted ? "text-foreground-muted" : "text-foreground-secondary", children: r.label }),
|
|
2213
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { className: `tabular-nums ${r.value < 0 ? "text-status-success" : "text-foreground"}`, children: formatPrice(r.value) })
|
|
2214
|
+
] }, i)),
|
|
2215
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between border-t border-border pt-2 mt-1 text-base font-semibold", children: [
|
|
2216
|
+
/* @__PURE__ */ jsxRuntime.jsx("dt", { className: "text-foreground", children: "Total" }),
|
|
2217
|
+
/* @__PURE__ */ jsxRuntime.jsx("dd", { className: "tabular-nums text-foreground", children: formatPrice(total) })
|
|
2218
|
+
] })
|
|
2219
|
+
] }),
|
|
2220
|
+
onCheckout && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2221
|
+
"button",
|
|
2222
|
+
{
|
|
2223
|
+
type: "button",
|
|
2224
|
+
onClick: onCheckout,
|
|
2225
|
+
className: "mt-4 w-full rounded-lg bg-accent px-4 py-2.5 text-sm font-semibold text-accent-fg transition-colors hover:bg-accent-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-accent focus-visible:ring-offset-2",
|
|
2226
|
+
children: checkoutLabel
|
|
2227
|
+
}
|
|
2228
|
+
)
|
|
2229
|
+
] })
|
|
2230
|
+
] });
|
|
2231
|
+
}
|
|
2157
2232
|
var NotificationContext = React19.createContext({
|
|
2158
2233
|
open: () => void 0,
|
|
2159
2234
|
close: () => void 0
|
|
@@ -5827,7 +5902,7 @@ function addMonths2(d, n) {
|
|
|
5827
5902
|
c.setMonth(c.getMonth() + n);
|
|
5828
5903
|
return c;
|
|
5829
5904
|
}
|
|
5830
|
-
function
|
|
5905
|
+
function defaultFormat2(d) {
|
|
5831
5906
|
const y = d.getFullYear().toString().padStart(4, "0");
|
|
5832
5907
|
const m = (d.getMonth() + 1).toString().padStart(2, "0");
|
|
5833
5908
|
const day = d.getDate().toString().padStart(2, "0");
|
|
@@ -5861,7 +5936,7 @@ function DatePicker({
|
|
|
5861
5936
|
min,
|
|
5862
5937
|
max,
|
|
5863
5938
|
style,
|
|
5864
|
-
format =
|
|
5939
|
+
format = defaultFormat2,
|
|
5865
5940
|
weekStartsOn = 0,
|
|
5866
5941
|
clearable = true,
|
|
5867
5942
|
size = "md",
|
|
@@ -5883,7 +5958,7 @@ function DatePicker({
|
|
|
5883
5958
|
}, [open, value]);
|
|
5884
5959
|
React19.useEffect(() => {
|
|
5885
5960
|
if (!open) return;
|
|
5886
|
-
const cell = gridRef.current?.querySelector(`[data-day="${
|
|
5961
|
+
const cell = gridRef.current?.querySelector(`[data-day="${defaultFormat2(focusDate)}"]`);
|
|
5887
5962
|
cell?.focus();
|
|
5888
5963
|
}, [open, focusDate]);
|
|
5889
5964
|
const weekdays = React19.useMemo(() => {
|
|
@@ -6095,8 +6170,8 @@ function DatePicker({
|
|
|
6095
6170
|
type: "button",
|
|
6096
6171
|
disabled: dis,
|
|
6097
6172
|
tabIndex: focused ? 0 : -1,
|
|
6098
|
-
"data-day":
|
|
6099
|
-
"aria-label":
|
|
6173
|
+
"data-day": defaultFormat2(date),
|
|
6174
|
+
"aria-label": defaultFormat2(date),
|
|
6100
6175
|
"aria-selected": sel || void 0,
|
|
6101
6176
|
onClick: () => selectDate(date),
|
|
6102
6177
|
className: [
|
|
@@ -6107,7 +6182,7 @@ function DatePicker({
|
|
|
6107
6182
|
].join(" "),
|
|
6108
6183
|
children: date.getDate()
|
|
6109
6184
|
}
|
|
6110
|
-
) },
|
|
6185
|
+
) }, defaultFormat2(date));
|
|
6111
6186
|
}) }, ri)) })
|
|
6112
6187
|
]
|
|
6113
6188
|
}
|
|
@@ -7881,6 +7956,7 @@ exports.CARD_BRANDS = CARD_BRANDS;
|
|
|
7881
7956
|
exports.Calendar = Calendar2;
|
|
7882
7957
|
exports.Card = Card_default;
|
|
7883
7958
|
exports.CardCarousel = CardCarousel;
|
|
7959
|
+
exports.Cart = Cart;
|
|
7884
7960
|
exports.Catalog = Catalog;
|
|
7885
7961
|
exports.CatalogCarousel = CatalogCarousel;
|
|
7886
7962
|
exports.CatalogGrid = CatalogGrid;
|