@deneb-ui/ui 2.0.51 → 2.0.52

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.
@@ -17,8 +17,7 @@ export interface ContactActionsProps {
17
17
  style?: React.CSSProperties;
18
18
  }
19
19
  /**
20
- * Smart container that automatically renders available contact channels.
21
- * When a merchant adds phone, WhatsApp, or email in site-data.json,
22
- * the corresponding action button appears automatically with zero template code changes.
20
+ * Always-mounted contact channels so Fivora empty-state validation keeps
21
+ * the field markers clickable when values are blank.
23
22
  */
24
- export declare function ContactActions({ phone, whatsapp, email, phoneFieldPath, whatsappFieldPath, emailFieldPath, labels, size, layout, className, style, }: ContactActionsProps): React.JSX.Element | null;
23
+ export declare function ContactActions({ phone, whatsapp, email, phoneFieldPath, whatsappFieldPath, emailFieldPath, labels, size, layout, className, style, }: ContactActionsProps): React.JSX.Element;
@@ -7,17 +7,10 @@ const WhatsAppButton_1 = require("./WhatsAppButton");
7
7
  const PhoneButton_1 = require("./PhoneButton");
8
8
  const EmailButton_1 = require("./EmailButton");
9
9
  /**
10
- * Smart container that automatically renders available contact channels.
11
- * When a merchant adds phone, WhatsApp, or email in site-data.json,
12
- * the corresponding action button appears automatically with zero template code changes.
10
+ * Always-mounted contact channels so Fivora empty-state validation keeps
11
+ * the field markers clickable when values are blank.
13
12
  */
14
13
  function ContactActions({ phone, whatsapp, email, phoneFieldPath = 'common.business.phone', whatsappFieldPath = 'common.business.whatsapp', emailFieldPath = 'common.business.email', labels = {}, size = 'md', layout = 'row', className = '', style, }) {
15
- const hasPhone = Boolean(phone && phone.trim());
16
- const hasWhatsApp = Boolean(whatsapp && whatsapp.trim());
17
- const hasEmail = Boolean(email && email.trim());
18
- if (!hasPhone && !hasWhatsApp && !hasEmail) {
19
- return null;
20
- }
21
14
  const layoutStyles = {
22
15
  display: 'flex',
23
16
  flexDirection: layout === 'column' ? 'column' : 'row',
@@ -26,5 +19,5 @@ function ContactActions({ phone, whatsapp, email, phoneFieldPath = 'common.busin
26
19
  gap: '0.75rem',
27
20
  ...style,
28
21
  };
29
- return ((0, jsx_runtime_1.jsxs)("div", { className: `deneb-contact-actions deneb-layout-${layout} ${className}`.trim(), style: layoutStyles, children: [hasPhone && ((0, jsx_runtime_1.jsx)(PhoneButton_1.PhoneButton, { value: phone, fieldPath: phoneFieldPath, label: labels.phone || 'Call Us', size: size })), hasWhatsApp && ((0, jsx_runtime_1.jsx)(WhatsAppButton_1.WhatsAppButton, { value: whatsapp, fieldPath: whatsappFieldPath, label: labels.whatsapp || 'Chat on WhatsApp', size: size })), hasEmail && ((0, jsx_runtime_1.jsx)(EmailButton_1.EmailButton, { value: email, fieldPath: emailFieldPath, label: labels.email || 'Email Us', size: size }))] }));
22
+ return ((0, jsx_runtime_1.jsxs)("div", { className: `deneb-contact-actions deneb-layout-${layout} ${className}`.trim(), style: layoutStyles, children: [(0, jsx_runtime_1.jsx)(PhoneButton_1.PhoneButton, { value: phone ?? '', fieldPath: phoneFieldPath, label: labels.phone || 'Call Us', size: size }), (0, jsx_runtime_1.jsx)(WhatsAppButton_1.WhatsAppButton, { value: whatsapp ?? '', fieldPath: whatsappFieldPath, label: labels.whatsapp || 'Chat on WhatsApp', size: size }), (0, jsx_runtime_1.jsx)(EmailButton_1.EmailButton, { value: email ?? '', fieldPath: emailFieldPath, label: labels.email || 'Email Us', size: size })] }));
30
23
  }
@@ -5,7 +5,7 @@ exports.PhoneButton = PhoneButton;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const ContactButton_1 = require("./ContactButton");
7
7
  function PhoneButton({ phoneNumber, value, label = 'Call Us', fieldPath = 'common.business.phone', variant = 'primary', ...rest }) {
8
- const number = phoneNumber || value;
8
+ const number = phoneNumber ?? value;
9
9
  if (!number && !fieldPath)
10
10
  return null;
11
11
  return ((0, jsx_runtime_1.jsx)(ContactButton_1.ContactButton, { type: "phone", value: number, label: label, fieldPath: fieldPath, variant: variant, ...rest }));
@@ -8,4 +8,4 @@ export interface SocialButtonProps extends React.AnchorHTMLAttributes<HTMLAnchor
8
8
  variant?: 'icon' | 'pill' | 'button';
9
9
  size?: 'sm' | 'md' | 'lg';
10
10
  }
11
- export declare function SocialButton({ platform, url, href, label, fieldPath, variant, size, className, style, ...rest }: SocialButtonProps): React.JSX.Element | null;
11
+ export declare function SocialButton({ platform, url, href, label, fieldPath, variant, size, className, style, ...rest }: SocialButtonProps): React.JSX.Element;
@@ -61,11 +61,7 @@ const PLATFORM_CONFIG = {
61
61
  };
62
62
  function SocialButton({ platform, url, href, label, fieldPath, variant = 'icon', size = 'md', className = '', style, ...rest }) {
63
63
  const derivedFieldPath = fieldPath || `common.business.social.${platform}`;
64
- const hasFieldPath = Boolean(fieldPath);
65
- const targetUrl = url || href || (hasFieldPath ? '#' : '');
66
- // Don't render broken button if no valid URL and no fieldPath
67
- if (!targetUrl)
68
- return null;
64
+ const targetUrl = url ?? href ?? '#';
69
65
  const config = PLATFORM_CONFIG[platform] || PLATFORM_CONFIG.x;
70
66
  const iconSize = size === 'sm' ? 16 : size === 'lg' ? 22 : 18;
71
67
  const baseStyles = {
@@ -8,7 +8,6 @@ export interface SocialLinksProps {
8
8
  style?: React.CSSProperties;
9
9
  }
10
10
  /**
11
- * Smart container rendering active social buttons.
12
- * Automatically filters out any unconfigured or empty platforms.
11
+ * Always-mounted social buttons so empty-state preview keeps field markers.
13
12
  */
14
- export declare function SocialLinks({ social, fieldPathPrefix, variant, size, className, style, }: SocialLinksProps): React.JSX.Element | null;
13
+ export declare function SocialLinks({ social, fieldPathPrefix, variant, size, className, style, }: SocialLinksProps): React.JSX.Element;
@@ -16,17 +16,11 @@ const SUPPORTED_PLATFORMS = [
16
16
  'github',
17
17
  ];
18
18
  /**
19
- * Smart container rendering active social buttons.
20
- * Automatically filters out any unconfigured or empty platforms.
19
+ * Always-mounted social buttons so empty-state preview keeps field markers.
21
20
  */
22
21
  function SocialLinks({ social = {}, fieldPathPrefix = 'common.business.social', variant = 'icon', size = 'md', className = '', style, }) {
23
- // Find platforms with valid URLs
24
- const activePlatforms = Object.entries(social).filter(([platform, url]) => {
25
- return Boolean(url && typeof url === 'string' && url.trim().length > 0);
26
- });
27
- if (activePlatforms.length === 0) {
28
- return null;
29
- }
22
+ const platforms = SUPPORTED_PLATFORMS.filter((platform) => Object.prototype.hasOwnProperty.call(social, platform) || Object.keys(social).length === 0);
23
+ const rendered = platforms.length ? platforms : SUPPORTED_PLATFORMS;
30
24
  const containerStyles = {
31
25
  display: 'inline-flex',
32
26
  alignItems: 'center',
@@ -34,9 +28,5 @@ function SocialLinks({ social = {}, fieldPathPrefix = 'common.business.social',
34
28
  gap: '0.625rem',
35
29
  ...style,
36
30
  };
37
- return ((0, jsx_runtime_1.jsx)("div", { className: `deneb-social-links ${className}`.trim(), style: containerStyles, children: activePlatforms.map(([key, url]) => {
38
- const lowerKey = key.toLowerCase();
39
- const platform = SUPPORTED_PLATFORMS.includes(lowerKey) ? lowerKey : 'x';
40
- return ((0, jsx_runtime_1.jsx)(SocialButton_1.SocialButton, { platform: platform, url: url, fieldPath: `${fieldPathPrefix}.${key}`, variant: variant, size: size }, key));
41
- }) }));
31
+ return ((0, jsx_runtime_1.jsx)("div", { className: `deneb-social-links ${className}`.trim(), style: containerStyles, children: rendered.map((platform) => ((0, jsx_runtime_1.jsx)(SocialButton_1.SocialButton, { platform: platform, url: social[platform] ?? '', fieldPath: `${fieldPathPrefix}.${platform}`, variant: variant, size: size }, platform))) }));
42
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deneb-ui/ui",
3
- "version": "2.0.51",
3
+ "version": "2.0.52",
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",
@@ -49,7 +49,7 @@
49
49
  ],
50
50
  "license": "MIT",
51
51
  "dependencies": {
52
- "@deneb-ui/core": "^2.0.51"
52
+ "@deneb-ui/core": "^2.0.52"
53
53
  },
54
54
  "peerDependencies": {
55
55
  "react": "^18.0.0 || ^19.0.0",