@deneb-ui/ui 2.0.96 → 2.0.98

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.
@@ -4,6 +4,7 @@ export interface ProductItem {
4
4
  id?: string | number;
5
5
  name?: string;
6
6
  title?: string;
7
+ isPriceRange?: boolean;
7
8
  productName?: string;
8
9
  itemTitle?: string;
9
10
  brand?: string;
@@ -78,12 +78,26 @@ function EditableProductCard({ itemPath, product: productProp, item: itemProp, c
78
78
  const basePriceNum = typeof rawPriceCandidate === 'number'
79
79
  ? rawPriceCandidate
80
80
  : parseFloat(String(rawPriceCandidate || '').replace(/[^0-9.]/g, '')) || 0;
81
- const baseFormattedPrice = rawPriceCandidate !== undefined && rawPriceCandidate !== null && String(rawPriceCandidate).trim() !== ''
81
+ const isRange = Boolean(product?.isPriceRange ||
82
+ (product?.minPrice !== undefined && product?.maxPrice !== undefined) ||
83
+ product?.priceRange);
84
+ let rangePriceString = '';
85
+ if (isRange) {
86
+ if (product?.priceRange) {
87
+ rangePriceString = String(product.priceRange);
88
+ }
89
+ else {
90
+ const minNum = typeof product?.minPrice === 'number' ? product.minPrice : parseFloat(String(product?.minPrice || '').replace(/[^0-9.]/g, '')) || 0;
91
+ const maxNum = typeof product?.maxPrice === 'number' ? product.maxPrice : parseFloat(String(product?.maxPrice || '').replace(/[^0-9.]/g, '')) || 0;
92
+ rangePriceString = `${(0, useCart_1.formatCurrency)(minNum, currency)} – ${(0, useCart_1.formatCurrency)(maxNum, currency)}`;
93
+ }
94
+ }
95
+ const baseFormattedPrice = rangePriceString || (rawPriceCandidate !== undefined && rawPriceCandidate !== null && String(rawPriceCandidate).trim() !== ''
82
96
  ? typeof rawPriceCandidate === 'string' &&
83
97
  (rawPriceCandidate.includes('LKR') || rawPriceCandidate.includes('-') || rawPriceCandidate.includes('–'))
84
98
  ? rawPriceCandidate
85
99
  : (0, useCart_1.formatCurrency)(basePriceNum, currency)
86
- : '';
100
+ : '');
87
101
  const displayPrice = resolvedPrice.formattedPrice || baseFormattedPrice;
88
102
  const hasPrice = showPrice && Boolean(displayPrice && displayPrice.trim() !== '');
89
103
  const priceKey = 'cost' in (product || {}) && !('price' in (product || {}) && product.price !== undefined)
@@ -6,7 +6,11 @@ export interface EditableSectionProps extends React.HTMLAttributes<HTMLElement>
6
6
  * Required fivora design section identifier (e.g. "home-hero", "home-features", "products", "testimonials").
7
7
  * Automatically sets `data-design-section`, `data-section-id`, and `id` for full editor targeting.
8
8
  */
9
- name: string;
9
+ name?: string;
10
+ /**
11
+ * Alias for name (e.g. "hero", "services", "contact").
12
+ */
13
+ sectionId?: string;
10
14
  /**
11
15
  * Vertical section padding ("none" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" or custom CSS).
12
16
  */
@@ -35,6 +39,7 @@ export interface EditableSectionProps extends React.HTMLAttributes<HTMLElement>
35
39
  * Quick toggle to center all content and text horizontally.
36
40
  */
37
41
  center?: boolean;
42
+ centered?: boolean;
38
43
  /**
39
44
  * Whether this section is hidden or deleted.
40
45
  */
@@ -57,4 +62,5 @@ export interface EditableSectionProps extends React.HTMLAttributes<HTMLElement>
57
62
  * `data-design-section` and `data-section-id` markers for 100% fivora contract compliance,
58
63
  * with first-class support for section deletion/hiding and instant centering.
59
64
  */
60
- export declare function EditableSection({ as: Component, name, padding, bg, color, maxWidth, border, align, center, hidden, order, container, containerClassName, className, style, id, children, ...props }: EditableSectionProps): React.JSX.Element;
65
+ export declare function EditableSection({ as: Component, name, sectionId, padding, bg, color, maxWidth, border, align, center, centered, hidden, order, container, containerClassName, className, style, id, children, ...props }: EditableSectionProps): React.JSX.Element;
66
+ export default EditableSection;
@@ -10,16 +10,18 @@ const SECTION_PADDING_MAP = responsive_1.RESPONSIVE_SECTION_PADDING;
10
10
  * `data-design-section` and `data-section-id` markers for 100% fivora contract compliance,
11
11
  * with first-class support for section deletion/hiding and instant centering.
12
12
  */
13
- function EditableSection({ as: Component = "section", name, padding = "lg", bg, color, maxWidth, border, align, center, hidden, order, container, containerClassName = "", className = "", style, id, children, ...props }) {
13
+ function EditableSection({ as: Component = "section", name, sectionId, padding = "lg", bg, color, maxWidth, border, align, center, centered, hidden, order, container, containerClassName = "", className = "", style, id, children, ...props }) {
14
+ const resolvedSectionKey = sectionId || name || "section";
14
15
  const resolvedPadding = padding !== undefined ? (SECTION_PADDING_MAP[String(padding)] || String(padding)) : undefined;
15
16
  const resolvedBorder = border === true
16
17
  ? "1px solid var(--border-color, rgba(226, 232, 240, 0.8))"
17
18
  : typeof border === "string"
18
19
  ? border
19
20
  : undefined;
20
- const stylePath = `${name}.section`;
21
+ const stylePath = `${resolvedSectionKey}.section`;
21
22
  const { cssVars: styleVars } = (0, useComponentStyle_1.useComponentStyle)(stylePath, "section");
22
- const resolvedAlign = align || (center ? "center" : undefined);
23
+ const isCentered = centered ?? center;
24
+ const resolvedAlign = align || (isCentered ? "center" : undefined);
23
25
  const sectionStyle = {
24
26
  ...(resolvedPadding ? { padding: resolvedPadding } : {}),
25
27
  ...(bg ? { background: bg } : {}),
@@ -40,5 +42,6 @@ function EditableSection({ as: Component = "section", name, padding = "lg", bg,
40
42
  paddingRight: "1rem",
41
43
  ...(resolvedAlign === "center" ? { display: "flex", flexDirection: "column", alignItems: "center" } : {}),
42
44
  }, children: children })) : (children);
43
- return ((0, jsx_runtime_1.jsx)(Component, { id: id || name, "data-design-section": name, "data-section-id": name, "data-section-visible": hidden ? "false" : "true", "data-preview-style-target": stylePath, "data-preview-style-type": "section", className: `deneb-section editable-section ${className}`.trim(), style: sectionStyle, ...props, children: content }));
45
+ return ((0, jsx_runtime_1.jsx)(Component, { id: id || resolvedSectionKey, "data-design-section": resolvedSectionKey, "data-section-id": resolvedSectionKey, "data-section-visible": hidden ? "false" : "true", "data-preview-style-target": stylePath, "data-preview-style-type": "section", className: `deneb-section editable-section ${isCentered ? "is-centered" : ""} ${className}`.trim(), style: sectionStyle, ...props, children: content }));
44
46
  }
47
+ exports.default = EditableSection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deneb-ui/ui",
3
- "version": "2.0.96",
3
+ "version": "2.0.98",
4
4
  "description": "Visual-first React component library for editable commerce storefronts. Built for Next.js and Fivora.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -50,7 +50,7 @@
50
50
  ],
51
51
  "license": "MIT",
52
52
  "dependencies": {
53
- "@deneb-ui/core": "^2.0.96"
53
+ "@deneb-ui/core": "^2.0.98"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "react": "^18.0.0 || ^19.0.0",