@flopay/react 0.3.13 → 0.3.14

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 CHANGED
@@ -406,6 +406,14 @@ var FLOPAY_KEYFRAMES = `
406
406
  function FloPayKeyframes() {
407
407
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: FLOPAY_KEYFRAMES });
408
408
  }
409
+ function toCssSize(value) {
410
+ if (typeof value === "number") return `${value}px`;
411
+ return value;
412
+ }
413
+ function toCssWeight(value) {
414
+ if (typeof value === "number" || typeof value === "string") return value;
415
+ return void 0;
416
+ }
409
417
  function ProcessingOverlay({ status, errorMessage }) {
410
418
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { style: {
411
419
  position: "fixed",
@@ -1207,23 +1215,58 @@ function SplitCardFormInner({
1207
1215
  const cardInputBg = isButtons ? bStyles.cardInputBackground ?? "white" : "white";
1208
1216
  const hideBackButtonLabel = isEmptySlotContent(cardBackButtonContent);
1209
1217
  const hideTitle = isEmptySlotContent(cardTitleContent);
1210
- const stripeElementStyle = isButtons && (bStyles.cardInputColor || bStyles.cardInputPlaceholderColor || bStyles.cardInputFontSize) ? {
1218
+ const nameInputOverrides = isButtons ? bStyles.nameInput : void 0;
1219
+ const resolvedInputFontSize = bStyles.cardInputFontSize ?? toCssSize(nameInputOverrides?.fontSize) ?? "16px";
1220
+ const resolvedInputFontFamily = typeof nameInputOverrides?.fontFamily === "string" ? nameInputOverrides.fontFamily : "Poppins, sans-serif";
1221
+ const resolvedInputFontWeight = toCssWeight(nameInputOverrides?.fontWeight) ?? 400;
1222
+ const resolvedInputColor = bStyles.cardInputColor ?? (typeof nameInputOverrides?.color === "string" ? nameInputOverrides.color : void 0) ?? "#262833";
1223
+ const resolvedPlaceholderColor = bStyles.cardInputPlaceholderColor ?? "#9ca3af";
1224
+ const sharedInputTypography = {
1225
+ fontSize: resolvedInputFontSize,
1226
+ fontFamily: resolvedInputFontFamily,
1227
+ fontWeight: resolvedInputFontWeight,
1228
+ color: resolvedInputColor,
1229
+ WebkitFontSmoothing: "antialiased",
1230
+ MozOsxFontSmoothing: "grayscale"
1231
+ };
1232
+ const sharedInputPlaceholderVars = {
1233
+ "--flopay-input-placeholder-color": resolvedPlaceholderColor,
1234
+ "--flopay-input-font-size": resolvedInputFontSize,
1235
+ "--flopay-input-font-family": resolvedInputFontFamily,
1236
+ "--flopay-input-font-weight": String(resolvedInputFontWeight)
1237
+ };
1238
+ const stripeElementStyle = {
1211
1239
  style: {
1212
1240
  base: {
1213
- ...bStyles.cardInputColor ? { color: bStyles.cardInputColor } : {},
1214
- ...bStyles.cardInputFontSize ? { fontSize: bStyles.cardInputFontSize } : {},
1215
- ...bStyles.cardInputPlaceholderColor ? { "::placeholder": { color: bStyles.cardInputPlaceholderColor } } : {}
1241
+ ...sharedInputTypography,
1242
+ fontSmoothing: "antialiased",
1243
+ "::placeholder": {
1244
+ color: resolvedPlaceholderColor,
1245
+ fontSize: resolvedInputFontSize,
1246
+ fontFamily: resolvedInputFontFamily,
1247
+ fontWeight: resolvedInputFontWeight
1248
+ }
1216
1249
  },
1217
1250
  invalid: { color: "#ef4444" }
1218
1251
  }
1219
- } : {};
1252
+ };
1220
1253
  const cardFormBlock = /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: {
1221
1254
  backgroundColor: cardBg,
1222
1255
  borderRadius: "8px",
1223
1256
  padding: isButtons ? "0" : "1rem",
1224
1257
  ...isButtons ? bStyles.cardFormContainer : {},
1225
- ...isButtons ? { padding: bStyles.cardFormContainer?.padding ?? "0" } : {}
1258
+ ...isButtons ? { padding: bStyles.cardFormContainer?.padding ?? "0" } : {},
1259
+ ...sharedInputPlaceholderVars
1226
1260
  }, children: [
1261
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("style", { children: `
1262
+ .flopay-shared-input::placeholder {
1263
+ color: var(--flopay-input-placeholder-color);
1264
+ opacity: 1;
1265
+ font-size: var(--flopay-input-font-size);
1266
+ font-family: var(--flopay-input-font-family);
1267
+ font-weight: var(--flopay-input-font-weight);
1268
+ }
1269
+ ` }),
1227
1270
  isButtons && showCardForm && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { style: {
1228
1271
  display: "flex",
1229
1272
  alignItems: "center",
@@ -1312,6 +1355,7 @@ function SplitCardFormInner({
1312
1355
  }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1313
1356
  "input",
1314
1357
  {
1358
+ className: "flopay-shared-input",
1315
1359
  placeholder: "Full Name on Card",
1316
1360
  autoComplete: "cc-name",
1317
1361
  value: fullName,
@@ -1323,9 +1367,7 @@ function SplitCardFormInner({
1323
1367
  border: "none",
1324
1368
  outline: "none",
1325
1369
  background: "transparent",
1326
- fontSize: bStyles.cardInputFontSize ?? "16px",
1327
- fontFamily: "Poppins, sans-serif",
1328
- color: bStyles.cardInputColor ?? "#262833",
1370
+ ...sharedInputTypography,
1329
1371
  ...isButtons && bStyles.nameInput ? bStyles.nameInput : {}
1330
1372
  }
1331
1373
  }
@@ -1360,9 +1402,7 @@ function SplitCardFormInner({
1360
1402
  border: "none",
1361
1403
  outline: "none",
1362
1404
  background: "transparent",
1363
- fontSize: bStyles.cardInputFontSize ?? "16px",
1364
- fontFamily: "Poppins, sans-serif",
1365
- color: bStyles.cardInputColor ?? "#262833",
1405
+ ...sharedInputTypography,
1366
1406
  cursor: "pointer",
1367
1407
  ...isButtons && bStyles.nameInput ? bStyles.nameInput : {}
1368
1408
  },
@@ -1383,6 +1423,7 @@ function SplitCardFormInner({
1383
1423
  }, children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
1384
1424
  "input",
1385
1425
  {
1426
+ className: "flopay-shared-input",
1386
1427
  placeholder: (0, import_shared4.getPostalCodeLabel)(selectedCountry),
1387
1428
  autoComplete: "postal-code",
1388
1429
  value: zipCode,
@@ -1399,9 +1440,7 @@ function SplitCardFormInner({
1399
1440
  border: "none",
1400
1441
  outline: "none",
1401
1442
  background: "transparent",
1402
- fontSize: bStyles.cardInputFontSize ?? "16px",
1403
- fontFamily: "Poppins, sans-serif",
1404
- color: bStyles.cardInputColor ?? "#262833",
1443
+ ...sharedInputTypography,
1405
1444
  ...isButtons && bStyles.nameInput ? bStyles.nameInput : {}
1406
1445
  }
1407
1446
  }