@pubflow/react 0.3.1 → 0.3.3

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.esm.js CHANGED
@@ -8559,6 +8559,68 @@ function BridgeList({ renderItem, showPagination = true, showSearch = true, show
8559
8559
  }) })), renderPagination()] })] })] }));
8560
8560
  }
8561
8561
 
8562
+ /**
8563
+ * Asset Utilities for Pubflow React
8564
+ *
8565
+ * Utilities for handling assets like logos, images, and other media files
8566
+ * Supports both external URLs and internal assets with proper Vite/bundler integration
8567
+ */
8568
+ /**
8569
+ * Process asset URL - supports both external URLs and internal assets
8570
+ *
8571
+ * @param assetUrl - The asset URL to process
8572
+ * @returns Processed URL ready for use in src attributes
8573
+ */
8574
+ function processAssetUrl(assetUrl) {
8575
+ // Return non-string values as-is (React components, null, undefined)
8576
+ if (!assetUrl || typeof assetUrl !== 'string') {
8577
+ return assetUrl;
8578
+ }
8579
+ // Return empty string as-is (no logo case)
8580
+ if (assetUrl.trim() === '') {
8581
+ return '';
8582
+ }
8583
+ // Check if it's an external URL (starts with http:// or https://)
8584
+ if (assetUrl.startsWith('http://') || assetUrl.startsWith('https://')) {
8585
+ return assetUrl;
8586
+ }
8587
+ // Check if it's a data URL (base64 encoded image)
8588
+ if (assetUrl.startsWith('data:')) {
8589
+ return assetUrl;
8590
+ }
8591
+ // Check if it's already a processed Vite asset (starts with /)
8592
+ if (assetUrl.startsWith('/')) {
8593
+ return assetUrl;
8594
+ }
8595
+ // Check if it's a blob URL
8596
+ if (assetUrl.startsWith('blob:')) {
8597
+ return assetUrl;
8598
+ }
8599
+ // For relative paths or simple filenames, assume they're in the public directory
8600
+ // This handles cases like 'logo.svg', './logo.png', '../assets/logo.jpg', etc.
8601
+ if (assetUrl.includes('.')) {
8602
+ // Remove leading ./ if present
8603
+ const cleanPath = assetUrl.replace(/^\.\//, '');
8604
+ // If it starts with ../, keep it as is (relative to current directory)
8605
+ if (assetUrl.startsWith('../')) {
8606
+ return assetUrl;
8607
+ }
8608
+ // For simple filenames or paths, prepend with /
8609
+ return `/${cleanPath}`;
8610
+ }
8611
+ // Return as-is for any other cases
8612
+ return assetUrl;
8613
+ }
8614
+ /**
8615
+ * Process logo URL specifically - alias for processAssetUrl with better naming
8616
+ *
8617
+ * @param logoUrl - The logo URL to process
8618
+ * @returns Processed URL ready for use in img src
8619
+ */
8620
+ function processLogoUrl(logoUrl) {
8621
+ return processAssetUrl(logoUrl);
8622
+ }
8623
+
8562
8624
  /**
8563
8625
  * Professional login form component
8564
8626
  */
@@ -8739,7 +8801,7 @@ function LoginForm({ config = {}, onSuccess, onError, onPasswordReset, onAccount
8739
8801
  textAlign: 'center'
8740
8802
  }
8741
8803
  };
8742
- return (jsxs("div", { className: className, style: styles.container, children: [jsxs("div", { style: styles.logoSection, children: [logo && (typeof logo === 'string' ? (jsx("img", { src: logo, alt: `${appName} Logo`, style: styles.logo })) : (logo)), jsxs("h1", { style: styles.welcomeText, children: ["Welcome to ", appName] }), jsx("p", { style: styles.subtitleText, children: "Sign in to your account" })] }), jsxs("form", { onSubmit: handleSubmit, children: [error && (jsxs("div", { style: styles.errorContainer, children: [jsx("span", { style: { color: '#ff4757', fontSize: '20px' }, children: "\u26A0" }), jsx("span", { style: styles.errorText, children: error })] })), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "Email Address" }), jsxs("div", { style: styles.inputContainer, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\u2709" }), jsx("input", { type: "email", style: styles.input, placeholder: "Enter your email", value: email, onChange: (e) => setEmail(e.target.value), autoCapitalize: "none", autoComplete: "email", disabled: isLoading, required: true })] })] }), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "Password" }), jsxs("div", { style: styles.inputContainer, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\uD83D\uDD12" }), jsx("input", { type: showPassword ? 'text' : 'password', style: styles.input, placeholder: "Enter your password", value: password, onChange: (e) => setPassword(e.target.value), autoComplete: "current-password", disabled: isLoading, required: true }), jsx("button", { type: "button", style: styles.eyeButton, onClick: () => setShowPassword(!showPassword), disabled: isLoading, children: showPassword ? '👁' : '👁‍🗨' })] })] }), jsxs("div", { style: styles.checkboxContainer, children: [jsxs("label", { style: { display: 'flex', alignItems: 'center', fontSize: '14px', color: '#666' }, children: [jsx("input", { type: "checkbox", checked: rememberMe, onChange: (e) => setRememberMe(e.target.checked), style: { marginRight: '8px' } }), "Remember me"] }), showPasswordReset && (jsx("button", { type: "button", style: { ...styles.linkButton, fontSize: '14px' }, onClick: onPasswordReset, disabled: isLoading, children: "Forgot password?" }))] }), jsx("button", { type: "submit", style: {
8804
+ return (jsxs("div", { className: className, style: styles.container, children: [jsxs("div", { style: styles.logoSection, children: [logo && (typeof logo === 'string' ? (jsx("img", { src: processLogoUrl(logo), alt: `${appName} Logo`, style: styles.logo })) : (logo)), jsxs("h1", { style: styles.welcomeText, children: ["Welcome to ", appName] }), jsx("p", { style: styles.subtitleText, children: "Sign in to your account" })] }), jsxs("form", { onSubmit: handleSubmit, children: [error && (jsxs("div", { style: styles.errorContainer, children: [jsx("span", { style: { color: '#ff4757', fontSize: '20px' }, children: "\u26A0" }), jsx("span", { style: styles.errorText, children: error })] })), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "Email Address" }), jsxs("div", { style: styles.inputContainer, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\u2709" }), jsx("input", { type: "email", style: styles.input, placeholder: "Enter your email", value: email, onChange: (e) => setEmail(e.target.value), autoCapitalize: "none", autoComplete: "email", disabled: isLoading, required: true })] })] }), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "Password" }), jsxs("div", { style: styles.inputContainer, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\uD83D\uDD12" }), jsx("input", { type: showPassword ? 'text' : 'password', style: styles.input, placeholder: "Enter your password", value: password, onChange: (e) => setPassword(e.target.value), autoComplete: "current-password", disabled: isLoading, required: true }), jsx("button", { type: "button", style: styles.eyeButton, onClick: () => setShowPassword(!showPassword), disabled: isLoading, children: showPassword ? '👁' : '👁‍🗨' })] })] }), jsxs("div", { style: styles.checkboxContainer, children: [jsxs("label", { style: { display: 'flex', alignItems: 'center', fontSize: '14px', color: '#666' }, children: [jsx("input", { type: "checkbox", checked: rememberMe, onChange: (e) => setRememberMe(e.target.checked), style: { marginRight: '8px' } }), "Remember me"] }), showPasswordReset && (jsx("button", { type: "button", style: { ...styles.linkButton, fontSize: '14px' }, onClick: onPasswordReset, disabled: isLoading, children: "Forgot password?" }))] }), jsx("button", { type: "submit", style: {
8743
8805
  ...styles.loginButton,
8744
8806
  opacity: isLoading ? 0.8 : 1,
8745
8807
  cursor: isLoading ? 'not-allowed' : 'pointer'
@@ -8989,7 +9051,7 @@ function PasswordResetForm({ config = {}, onSuccess, onError, onBackToLogin, res
8989
9051
  const renderStep = () => {
8990
9052
  switch (step) {
8991
9053
  case 'request':
8992
- return (jsxs(Fragment, { children: [jsxs("div", { style: styles.logoSection, children: [logo && (typeof logo === 'string' ? (jsx("img", { src: logo, alt: `${appName} Logo`, style: styles.logo })) : (logo)), jsx("h1", { style: styles.title, children: "Reset Password" }), jsx("p", { style: styles.subtitle, children: "Enter your email to receive reset instructions" })] }), jsxs("form", { onSubmit: handleRequestReset, children: [error && (jsxs("div", { style: styles.errorContainer, children: [jsx("span", { style: { color: '#ff4757', fontSize: '20px' }, children: "\u26A0" }), jsx("span", { style: styles.errorText, children: error })] })), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "Email Address" }), jsxs("div", { style: styles.inputContainer, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\u2709" }), jsx("input", { type: "email", style: styles.input, placeholder: "Enter your email", value: email, onChange: (e) => setEmail(e.target.value), autoCapitalize: "none", autoComplete: "email", disabled: isLoading, required: true })] })] }), jsx("button", { type: "submit", style: {
9054
+ return (jsxs(Fragment, { children: [jsxs("div", { style: styles.logoSection, children: [logo && (typeof logo === 'string' ? (jsx("img", { src: processLogoUrl(logo), alt: `${appName} Logo`, style: styles.logo })) : (logo)), jsx("h1", { style: styles.title, children: "Reset Password" }), jsx("p", { style: styles.subtitle, children: "Enter your email to receive reset instructions" })] }), jsxs("form", { onSubmit: handleRequestReset, children: [error && (jsxs("div", { style: styles.errorContainer, children: [jsx("span", { style: { color: '#ff4757', fontSize: '20px' }, children: "\u26A0" }), jsx("span", { style: styles.errorText, children: error })] })), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "Email Address" }), jsxs("div", { style: styles.inputContainer, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\u2709" }), jsx("input", { type: "email", style: styles.input, placeholder: "Enter your email", value: email, onChange: (e) => setEmail(e.target.value), autoCapitalize: "none", autoComplete: "email", disabled: isLoading, required: true })] })] }), jsx("button", { type: "submit", style: {
8993
9055
  ...styles.button,
8994
9056
  opacity: isLoading ? 0.8 : 1,
8995
9057
  cursor: isLoading ? 'not-allowed' : 'pointer'
@@ -9253,7 +9315,7 @@ function AccountCreationForm({ config = {}, onSuccess, onError, onBackToLogin })
9253
9315
  const renderStep = () => {
9254
9316
  switch (step) {
9255
9317
  case 'form':
9256
- return (jsxs(Fragment, { children: [jsxs("div", { style: styles.logoSection, children: [logo && (typeof logo === 'string' ? (jsx("img", { src: logo, alt: `${appName} Logo`, style: styles.logo })) : (logo)), jsx("h1", { style: styles.title, children: "Create Account" }), jsxs("p", { style: styles.subtitle, children: ["Join ", appName, " today"] })] }), jsxs("form", { onSubmit: handleSubmit, children: [errors.general && (jsxs("div", { style: { ...styles.successContainer, backgroundColor: '#fef2f2', borderColor: '#fecaca' }, children: [jsx("span", { style: { color: '#ff4757', fontSize: '20px' }, children: "\u26A0" }), jsx("span", { style: { ...styles.successText, color: '#dc2626' }, children: errors.general })] })), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "First Name *" }), jsxs("div", { style: { ...styles.inputContainer, ...(errors.name ? styles.inputError : {}) }, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\uD83D\uDC64" }), jsx("input", { type: "text", style: styles.input, placeholder: "Enter your first name", value: formData.name, onChange: (e) => updateField('name', e.target.value), autoComplete: "given-name", disabled: isLoading, required: true })] }), errors.name && jsx("div", { style: styles.errorText, children: errors.name })] }), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "Last Name *" }), jsxs("div", { style: { ...styles.inputContainer, ...(errors.lastName ? styles.inputError : {}) }, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\uD83D\uDC64" }), jsx("input", { type: "text", style: styles.input, placeholder: "Enter your last name", value: formData.lastName, onChange: (e) => updateField('lastName', e.target.value), autoComplete: "family-name", disabled: isLoading, required: true })] }), errors.lastName && jsx("div", { style: styles.errorText, children: errors.lastName })] }), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "Email Address *" }), jsxs("div", { style: { ...styles.inputContainer, ...(errors.email ? styles.inputError : {}) }, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\u2709" }), jsx("input", { type: "email", style: styles.input, placeholder: "Enter your email", value: formData.email, onChange: (e) => updateField('email', e.target.value), autoCapitalize: "none", autoComplete: "email", disabled: isLoading, required: true })] }), errors.email && jsx("div", { style: styles.errorText, children: errors.email })] }), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "Password *" }), jsxs("div", { style: { ...styles.inputContainer, ...(errors.password ? styles.inputError : {}) }, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\uD83D\uDD12" }), jsx("input", { type: showPassword ? 'text' : 'password', style: styles.input, placeholder: "Create a password", value: formData.password, onChange: (e) => updateField('password', e.target.value), autoComplete: "new-password", disabled: isLoading, required: true }), jsx("button", { type: "button", style: styles.eyeButton, onClick: () => setShowPassword(!showPassword), disabled: isLoading, children: showPassword ? '👁' : '👁‍🗨' })] }), errors.password && jsx("div", { style: styles.errorText, children: errors.password })] }), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "Confirm Password *" }), jsxs("div", { style: { ...styles.inputContainer, ...(errors.confirmPassword ? styles.inputError : {}) }, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\uD83D\uDD12" }), jsx("input", { type: showConfirmPassword ? 'text' : 'password', style: styles.input, placeholder: "Confirm your password", value: formData.confirmPassword, onChange: (e) => updateField('confirmPassword', e.target.value), autoComplete: "new-password", disabled: isLoading, required: true }), jsx("button", { type: "button", style: styles.eyeButton, onClick: () => setShowConfirmPassword(!showConfirmPassword), disabled: isLoading, children: showConfirmPassword ? '👁' : '👁‍🗨' })] }), errors.confirmPassword && jsx("div", { style: styles.errorText, children: errors.confirmPassword })] }), jsx("button", { type: "submit", style: {
9318
+ return (jsxs(Fragment, { children: [jsxs("div", { style: styles.logoSection, children: [logo && (typeof logo === 'string' ? (jsx("img", { src: processLogoUrl(logo), alt: `${appName} Logo`, style: styles.logo })) : (logo)), jsx("h1", { style: styles.title, children: "Create Account" }), jsxs("p", { style: styles.subtitle, children: ["Join ", appName, " today"] })] }), jsxs("form", { onSubmit: handleSubmit, children: [errors.general && (jsxs("div", { style: { ...styles.successContainer, backgroundColor: '#fef2f2', borderColor: '#fecaca' }, children: [jsx("span", { style: { color: '#ff4757', fontSize: '20px' }, children: "\u26A0" }), jsx("span", { style: { ...styles.successText, color: '#dc2626' }, children: errors.general })] })), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "First Name *" }), jsxs("div", { style: { ...styles.inputContainer, ...(errors.name ? styles.inputError : {}) }, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\uD83D\uDC64" }), jsx("input", { type: "text", style: styles.input, placeholder: "Enter your first name", value: formData.name, onChange: (e) => updateField('name', e.target.value), autoComplete: "given-name", disabled: isLoading, required: true })] }), errors.name && jsx("div", { style: styles.errorText, children: errors.name })] }), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "Last Name *" }), jsxs("div", { style: { ...styles.inputContainer, ...(errors.lastName ? styles.inputError : {}) }, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\uD83D\uDC64" }), jsx("input", { type: "text", style: styles.input, placeholder: "Enter your last name", value: formData.lastName, onChange: (e) => updateField('lastName', e.target.value), autoComplete: "family-name", disabled: isLoading, required: true })] }), errors.lastName && jsx("div", { style: styles.errorText, children: errors.lastName })] }), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "Email Address *" }), jsxs("div", { style: { ...styles.inputContainer, ...(errors.email ? styles.inputError : {}) }, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\u2709" }), jsx("input", { type: "email", style: styles.input, placeholder: "Enter your email", value: formData.email, onChange: (e) => updateField('email', e.target.value), autoCapitalize: "none", autoComplete: "email", disabled: isLoading, required: true })] }), errors.email && jsx("div", { style: styles.errorText, children: errors.email })] }), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "Password *" }), jsxs("div", { style: { ...styles.inputContainer, ...(errors.password ? styles.inputError : {}) }, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\uD83D\uDD12" }), jsx("input", { type: showPassword ? 'text' : 'password', style: styles.input, placeholder: "Create a password", value: formData.password, onChange: (e) => updateField('password', e.target.value), autoComplete: "new-password", disabled: isLoading, required: true }), jsx("button", { type: "button", style: styles.eyeButton, onClick: () => setShowPassword(!showPassword), disabled: isLoading, children: showPassword ? '👁' : '👁‍🗨' })] }), errors.password && jsx("div", { style: styles.errorText, children: errors.password })] }), jsxs("div", { style: styles.inputGroup, children: [jsx("label", { style: styles.inputLabel, children: "Confirm Password *" }), jsxs("div", { style: { ...styles.inputContainer, ...(errors.confirmPassword ? styles.inputError : {}) }, children: [jsx("span", { style: { marginRight: '12px', opacity: 0.7, color: '#666' }, children: "\uD83D\uDD12" }), jsx("input", { type: showConfirmPassword ? 'text' : 'password', style: styles.input, placeholder: "Confirm your password", value: formData.confirmPassword, onChange: (e) => updateField('confirmPassword', e.target.value), autoComplete: "new-password", disabled: isLoading, required: true }), jsx("button", { type: "button", style: styles.eyeButton, onClick: () => setShowConfirmPassword(!showConfirmPassword), disabled: isLoading, children: showConfirmPassword ? '👁' : '👁‍🗨' })] }), errors.confirmPassword && jsx("div", { style: styles.errorText, children: errors.confirmPassword })] }), jsx("button", { type: "submit", style: {
9257
9319
  ...styles.button,
9258
9320
  opacity: isLoading ? 0.8 : 1,
9259
9321
  cursor: isLoading ? 'not-allowed' : 'pointer'