@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.mjs CHANGED
@@ -362,6 +362,14 @@ var FLOPAY_KEYFRAMES = `
362
362
  function FloPayKeyframes() {
363
363
  return /* @__PURE__ */ jsx4("style", { children: FLOPAY_KEYFRAMES });
364
364
  }
365
+ function toCssSize(value) {
366
+ if (typeof value === "number") return `${value}px`;
367
+ return value;
368
+ }
369
+ function toCssWeight(value) {
370
+ if (typeof value === "number" || typeof value === "string") return value;
371
+ return void 0;
372
+ }
365
373
  function ProcessingOverlay({ status, errorMessage }) {
366
374
  return /* @__PURE__ */ jsx4("div", { style: {
367
375
  position: "fixed",
@@ -1163,23 +1171,58 @@ function SplitCardFormInner({
1163
1171
  const cardInputBg = isButtons ? bStyles.cardInputBackground ?? "white" : "white";
1164
1172
  const hideBackButtonLabel = isEmptySlotContent(cardBackButtonContent);
1165
1173
  const hideTitle = isEmptySlotContent(cardTitleContent);
1166
- const stripeElementStyle = isButtons && (bStyles.cardInputColor || bStyles.cardInputPlaceholderColor || bStyles.cardInputFontSize) ? {
1174
+ const nameInputOverrides = isButtons ? bStyles.nameInput : void 0;
1175
+ const resolvedInputFontSize = bStyles.cardInputFontSize ?? toCssSize(nameInputOverrides?.fontSize) ?? "16px";
1176
+ const resolvedInputFontFamily = typeof nameInputOverrides?.fontFamily === "string" ? nameInputOverrides.fontFamily : "Poppins, sans-serif";
1177
+ const resolvedInputFontWeight = toCssWeight(nameInputOverrides?.fontWeight) ?? 400;
1178
+ const resolvedInputColor = bStyles.cardInputColor ?? (typeof nameInputOverrides?.color === "string" ? nameInputOverrides.color : void 0) ?? "#262833";
1179
+ const resolvedPlaceholderColor = bStyles.cardInputPlaceholderColor ?? "#9ca3af";
1180
+ const sharedInputTypography = {
1181
+ fontSize: resolvedInputFontSize,
1182
+ fontFamily: resolvedInputFontFamily,
1183
+ fontWeight: resolvedInputFontWeight,
1184
+ color: resolvedInputColor,
1185
+ WebkitFontSmoothing: "antialiased",
1186
+ MozOsxFontSmoothing: "grayscale"
1187
+ };
1188
+ const sharedInputPlaceholderVars = {
1189
+ "--flopay-input-placeholder-color": resolvedPlaceholderColor,
1190
+ "--flopay-input-font-size": resolvedInputFontSize,
1191
+ "--flopay-input-font-family": resolvedInputFontFamily,
1192
+ "--flopay-input-font-weight": String(resolvedInputFontWeight)
1193
+ };
1194
+ const stripeElementStyle = {
1167
1195
  style: {
1168
1196
  base: {
1169
- ...bStyles.cardInputColor ? { color: bStyles.cardInputColor } : {},
1170
- ...bStyles.cardInputFontSize ? { fontSize: bStyles.cardInputFontSize } : {},
1171
- ...bStyles.cardInputPlaceholderColor ? { "::placeholder": { color: bStyles.cardInputPlaceholderColor } } : {}
1197
+ ...sharedInputTypography,
1198
+ fontSmoothing: "antialiased",
1199
+ "::placeholder": {
1200
+ color: resolvedPlaceholderColor,
1201
+ fontSize: resolvedInputFontSize,
1202
+ fontFamily: resolvedInputFontFamily,
1203
+ fontWeight: resolvedInputFontWeight
1204
+ }
1172
1205
  },
1173
1206
  invalid: { color: "#ef4444" }
1174
1207
  }
1175
- } : {};
1208
+ };
1176
1209
  const cardFormBlock = /* @__PURE__ */ jsxs2("div", { style: {
1177
1210
  backgroundColor: cardBg,
1178
1211
  borderRadius: "8px",
1179
1212
  padding: isButtons ? "0" : "1rem",
1180
1213
  ...isButtons ? bStyles.cardFormContainer : {},
1181
- ...isButtons ? { padding: bStyles.cardFormContainer?.padding ?? "0" } : {}
1214
+ ...isButtons ? { padding: bStyles.cardFormContainer?.padding ?? "0" } : {},
1215
+ ...sharedInputPlaceholderVars
1182
1216
  }, children: [
1217
+ /* @__PURE__ */ jsx4("style", { children: `
1218
+ .flopay-shared-input::placeholder {
1219
+ color: var(--flopay-input-placeholder-color);
1220
+ opacity: 1;
1221
+ font-size: var(--flopay-input-font-size);
1222
+ font-family: var(--flopay-input-font-family);
1223
+ font-weight: var(--flopay-input-font-weight);
1224
+ }
1225
+ ` }),
1183
1226
  isButtons && showCardForm && /* @__PURE__ */ jsxs2("div", { style: {
1184
1227
  display: "flex",
1185
1228
  alignItems: "center",
@@ -1268,6 +1311,7 @@ function SplitCardFormInner({
1268
1311
  }, children: /* @__PURE__ */ jsx4(
1269
1312
  "input",
1270
1313
  {
1314
+ className: "flopay-shared-input",
1271
1315
  placeholder: "Full Name on Card",
1272
1316
  autoComplete: "cc-name",
1273
1317
  value: fullName,
@@ -1279,9 +1323,7 @@ function SplitCardFormInner({
1279
1323
  border: "none",
1280
1324
  outline: "none",
1281
1325
  background: "transparent",
1282
- fontSize: bStyles.cardInputFontSize ?? "16px",
1283
- fontFamily: "Poppins, sans-serif",
1284
- color: bStyles.cardInputColor ?? "#262833",
1326
+ ...sharedInputTypography,
1285
1327
  ...isButtons && bStyles.nameInput ? bStyles.nameInput : {}
1286
1328
  }
1287
1329
  }
@@ -1316,9 +1358,7 @@ function SplitCardFormInner({
1316
1358
  border: "none",
1317
1359
  outline: "none",
1318
1360
  background: "transparent",
1319
- fontSize: bStyles.cardInputFontSize ?? "16px",
1320
- fontFamily: "Poppins, sans-serif",
1321
- color: bStyles.cardInputColor ?? "#262833",
1361
+ ...sharedInputTypography,
1322
1362
  cursor: "pointer",
1323
1363
  ...isButtons && bStyles.nameInput ? bStyles.nameInput : {}
1324
1364
  },
@@ -1339,6 +1379,7 @@ function SplitCardFormInner({
1339
1379
  }, children: /* @__PURE__ */ jsx4(
1340
1380
  "input",
1341
1381
  {
1382
+ className: "flopay-shared-input",
1342
1383
  placeholder: getPostalCodeLabel(selectedCountry),
1343
1384
  autoComplete: "postal-code",
1344
1385
  value: zipCode,
@@ -1355,9 +1396,7 @@ function SplitCardFormInner({
1355
1396
  border: "none",
1356
1397
  outline: "none",
1357
1398
  background: "transparent",
1358
- fontSize: bStyles.cardInputFontSize ?? "16px",
1359
- fontFamily: "Poppins, sans-serif",
1360
- color: bStyles.cardInputColor ?? "#262833",
1399
+ ...sharedInputTypography,
1361
1400
  ...isButtons && bStyles.nameInput ? bStyles.nameInput : {}
1362
1401
  }
1363
1402
  }