@amplifyup/sdk 0.1.45 → 0.1.47

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/react.mjs CHANGED
@@ -495,6 +495,10 @@ function applyPageContext(input, opts) {
495
495
  log.warn(`AmplifyUp: unknown resource field "${k}" dropped`);
496
496
  continue;
497
497
  }
498
+ if (def.passThrough) {
499
+ if (v != null) fields[k] = v;
500
+ continue;
501
+ }
498
502
  const coerced = coerceField(def, v, log);
499
503
  if (coerced !== void 0) fields[k] = coerced;
500
504
  }
@@ -2974,17 +2978,29 @@ Available Console Commands:
2974
2978
  '[data-slot-id="main"], [data-amplifyup-slot="main"] {',
2975
2979
  " min-height: 50vh !important;",
2976
2980
  "}",
2977
- /* Single empty-state hint — Slot React label uses .amplifyup-slot-placeholder */
2981
+ /* Empty-slot CTA — Slot / AmplifyPageContent EmptySlotHint */
2978
2982
  ".amplifyup-slot-placeholder {",
2979
2983
  " display: flex !important;",
2984
+ " flex-direction: column !important;",
2980
2985
  " align-items: center !important;",
2981
2986
  " justify-content: center !important;",
2987
+ " gap: 12px !important;",
2982
2988
  " min-height: inherit !important;",
2983
- " color: rgba(34, 197, 94, 0.75) !important;",
2984
- " font-size: 14px !important;",
2985
- " font-weight: 500 !important;",
2989
+ " color: rgba(22, 163, 74, 0.85) !important;",
2990
+ " font-size: 15px !important;",
2991
+ " font-weight: 600 !important;",
2986
2992
  " pointer-events: none !important;",
2987
2993
  " text-align: center !important;",
2994
+ " box-sizing: border-box !important;",
2995
+ "}",
2996
+ ".amplifyup-slot-placeholder-icon {",
2997
+ " color: inherit !important;",
2998
+ "}",
2999
+ ".amplifyup-slot-placeholder-label {",
3000
+ " color: inherit !important;",
3001
+ "}",
3002
+ ".amplifyup-slot-label {",
3003
+ " pointer-events: none !important;",
2988
3004
  "}",
2989
3005
  "[data-slot-id].amplifyup-slot-hover, [data-amplifyup-slot].amplifyup-slot-hover {",
2990
3006
  " outline-color: rgba(34, 197, 94, 1) !important;",
@@ -3308,6 +3324,100 @@ function getSDK(adapter) {
3308
3324
  var trackContentView = (contentId, contentType, properties) => getSDK().trackContentView(contentId, contentType, properties);
3309
3325
  var refreshEventTracking = () => getSDK().refreshEventTracking();
3310
3326
  getSDK();
3327
+ function AddComponentIcon({ size = 28 }) {
3328
+ return /* @__PURE__ */ jsxs(
3329
+ "svg",
3330
+ {
3331
+ width: size,
3332
+ height: size,
3333
+ viewBox: "0 0 24 24",
3334
+ fill: "none",
3335
+ xmlns: "http://www.w3.org/2000/svg",
3336
+ "aria-hidden": "true",
3337
+ focusable: "false",
3338
+ children: [
3339
+ /* @__PURE__ */ jsx(
3340
+ "rect",
3341
+ {
3342
+ x: "3",
3343
+ y: "3",
3344
+ width: "18",
3345
+ height: "18",
3346
+ rx: "4",
3347
+ stroke: "currentColor",
3348
+ strokeWidth: "1.75"
3349
+ }
3350
+ ),
3351
+ /* @__PURE__ */ jsx(
3352
+ "path",
3353
+ {
3354
+ d: "M12 8v8M8 12h8",
3355
+ stroke: "currentColor",
3356
+ strokeWidth: "1.75",
3357
+ strokeLinecap: "round"
3358
+ }
3359
+ )
3360
+ ]
3361
+ }
3362
+ );
3363
+ }
3364
+ function EmptySlotHint({
3365
+ label = "Click here to Add Component",
3366
+ compact = false
3367
+ }) {
3368
+ const iconSize = compact ? 20 : 28;
3369
+ return /* @__PURE__ */ jsxs(
3370
+ "div",
3371
+ {
3372
+ className: "amplifyup-slot-placeholder",
3373
+ style: {
3374
+ display: "flex",
3375
+ flexDirection: "column",
3376
+ alignItems: "center",
3377
+ justifyContent: "center",
3378
+ gap: compact ? 8 : 12,
3379
+ minHeight: compact ? 60 : void 0,
3380
+ width: "100%",
3381
+ pointerEvents: "none",
3382
+ textAlign: "center",
3383
+ boxSizing: "border-box",
3384
+ padding: compact ? "12px 8px" : "24px 16px"
3385
+ },
3386
+ children: [
3387
+ /* @__PURE__ */ jsx(
3388
+ "span",
3389
+ {
3390
+ className: "amplifyup-slot-placeholder-icon",
3391
+ style: {
3392
+ display: "inline-flex",
3393
+ alignItems: "center",
3394
+ justifyContent: "center",
3395
+ width: compact ? 36 : 48,
3396
+ height: compact ? 36 : 48,
3397
+ borderRadius: 12,
3398
+ border: "1.5px dashed currentColor",
3399
+ opacity: 0.9
3400
+ },
3401
+ children: /* @__PURE__ */ jsx(AddComponentIcon, { size: iconSize })
3402
+ }
3403
+ ),
3404
+ /* @__PURE__ */ jsx(
3405
+ "span",
3406
+ {
3407
+ className: "amplifyup-slot-placeholder-label",
3408
+ style: {
3409
+ fontSize: compact ? 13 : 15,
3410
+ fontWeight: 600,
3411
+ lineHeight: 1.3,
3412
+ letterSpacing: "0.01em"
3413
+ },
3414
+ children: label
3415
+ }
3416
+ )
3417
+ ]
3418
+ }
3419
+ );
3420
+ }
3311
3421
  var ComponentContext = createContext(null);
3312
3422
  function useLiveComposerProps(layoutNodeId, props) {
3313
3423
  const [live, setLive] = useState(props);
@@ -3452,7 +3562,7 @@ function Slot({
3452
3562
  // Only add position relative for overlay positioning in editor mode
3453
3563
  position: isEditorMode ? "relative" : void 0
3454
3564
  },
3455
- children: isEmpty ? /* @__PURE__ */ jsx(
3565
+ children: isEmpty ? isEditorMode ? /* @__PURE__ */ jsx(EmptySlotHint, { compact: true }) : /* @__PURE__ */ jsx(
3456
3566
  "div",
3457
3567
  {
3458
3568
  className: "amplifyup-slot-placeholder",
@@ -3462,13 +3572,13 @@ function Slot({
3462
3572
  fontSize: "14px",
3463
3573
  pointerEvents: "none"
3464
3574
  },
3465
- children: isEditorMode ? `Drop components here` : `Empty slot: ${name}`
3575
+ children: `Empty slot: ${name}`
3466
3576
  }
3467
3577
  ) : /* @__PURE__ */ jsxs(Fragment, { children: [
3468
3578
  isEditorMode && /* @__PURE__ */ jsxs(
3469
3579
  "div",
3470
3580
  {
3471
- className: "amplifyup-slot-placeholder",
3581
+ className: "amplifyup-slot-label",
3472
3582
  style: {
3473
3583
  position: "absolute",
3474
3584
  top: "4px",
@@ -3476,8 +3586,7 @@ function Slot({
3476
3586
  fontSize: "10px",
3477
3587
  color: "#9ca3af",
3478
3588
  pointerEvents: "none",
3479
- zIndex: 1,
3480
- minHeight: "auto"
3589
+ zIndex: 1
3481
3590
  },
3482
3591
  children: [
3483
3592
  "Slot: ",
@@ -4437,7 +4546,7 @@ function defaultPreviewCanvas() {
4437
4546
  "data-slot-source": "page",
4438
4547
  "data-slot-empty": "true",
4439
4548
  style: { minHeight: "50vh", width: "100%", display: "block", position: "relative" },
4440
- children: /* @__PURE__ */ jsx("div", { className: "amplifyup-slot-placeholder", children: "Drop components here" })
4549
+ children: /* @__PURE__ */ jsx(EmptySlotHint, {})
4441
4550
  }
4442
4551
  );
4443
4552
  }