@tightknitai/block-kitchen 0.8.9 → 0.8.10
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 +28 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +28 -45
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3395,12 +3395,16 @@ function AlertEditor({ block, onChange }) {
|
|
|
3395
3395
|
) })
|
|
3396
3396
|
] });
|
|
3397
3397
|
}
|
|
3398
|
-
function CardEditor({
|
|
3398
|
+
function CardEditor({
|
|
3399
|
+
block,
|
|
3400
|
+
onChange,
|
|
3401
|
+
idPrefix = "card"
|
|
3402
|
+
}) {
|
|
3399
3403
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-4", children: [
|
|
3400
|
-
/* @__PURE__ */ jsx(EditorField, { label: "Title", help: "Up to 150 characters. Supports mrkdwn formatting.", htmlFor:
|
|
3404
|
+
/* @__PURE__ */ jsx(EditorField, { label: "Title", help: "Up to 150 characters. Supports mrkdwn formatting.", htmlFor: `${idPrefix}-title`, children: /* @__PURE__ */ jsx(
|
|
3401
3405
|
Input,
|
|
3402
3406
|
{
|
|
3403
|
-
id:
|
|
3407
|
+
id: `${idPrefix}-title`,
|
|
3404
3408
|
value: block.title?.text ?? "",
|
|
3405
3409
|
maxLength: 150,
|
|
3406
3410
|
placeholder: "e.g. New launch update",
|
|
@@ -3410,10 +3414,10 @@ function CardEditor({ block, onChange }) {
|
|
|
3410
3414
|
})
|
|
3411
3415
|
}
|
|
3412
3416
|
) }),
|
|
3413
|
-
/* @__PURE__ */ jsx(EditorField, { label: "Subtitle", help: "Up to 150 characters.", htmlFor:
|
|
3417
|
+
/* @__PURE__ */ jsx(EditorField, { label: "Subtitle", help: "Up to 150 characters.", htmlFor: `${idPrefix}-subtitle`, children: /* @__PURE__ */ jsx(
|
|
3414
3418
|
Input,
|
|
3415
3419
|
{
|
|
3416
|
-
id:
|
|
3420
|
+
id: `${idPrefix}-subtitle`,
|
|
3417
3421
|
value: block.subtitle?.text ?? "",
|
|
3418
3422
|
maxLength: 150,
|
|
3419
3423
|
placeholder: "e.g. Released April 28",
|
|
@@ -3423,10 +3427,10 @@ function CardEditor({ block, onChange }) {
|
|
|
3423
3427
|
})
|
|
3424
3428
|
}
|
|
3425
3429
|
) }),
|
|
3426
|
-
/* @__PURE__ */ jsx(EditorField, { label: "Body", help: "Up to 200 characters. Supports mrkdwn formatting.", htmlFor:
|
|
3430
|
+
/* @__PURE__ */ jsx(EditorField, { label: "Body", help: "Up to 200 characters. Supports mrkdwn formatting.", htmlFor: `${idPrefix}-body`, children: /* @__PURE__ */ jsx(
|
|
3427
3431
|
Textarea,
|
|
3428
3432
|
{
|
|
3429
|
-
id:
|
|
3433
|
+
id: `${idPrefix}-body`,
|
|
3430
3434
|
value: block.body?.text ?? "",
|
|
3431
3435
|
maxLength: 200,
|
|
3432
3436
|
rows: 3,
|
|
@@ -3442,7 +3446,7 @@ function CardEditor({ block, onChange }) {
|
|
|
3442
3446
|
{
|
|
3443
3447
|
label: "Hero image",
|
|
3444
3448
|
help: "Wide image displayed at the top of the card.",
|
|
3445
|
-
idPrefix:
|
|
3449
|
+
idPrefix: `${idPrefix}-hero`,
|
|
3446
3450
|
image: block.hero_image,
|
|
3447
3451
|
onChange: (next) => onChange({ ...block, hero_image: next })
|
|
3448
3452
|
}
|
|
@@ -3452,7 +3456,7 @@ function CardEditor({ block, onChange }) {
|
|
|
3452
3456
|
{
|
|
3453
3457
|
label: "Icon",
|
|
3454
3458
|
help: "Small image shown next to the title.",
|
|
3455
|
-
idPrefix:
|
|
3459
|
+
idPrefix: `${idPrefix}-icon`,
|
|
3456
3460
|
image: block.icon,
|
|
3457
3461
|
onChange: (next) => onChange({ ...block, icon: next })
|
|
3458
3462
|
}
|
|
@@ -3460,6 +3464,7 @@ function CardEditor({ block, onChange }) {
|
|
|
3460
3464
|
/* @__PURE__ */ jsx(
|
|
3461
3465
|
ButtonsField,
|
|
3462
3466
|
{
|
|
3467
|
+
idPrefix,
|
|
3463
3468
|
buttons: block.actions ?? [],
|
|
3464
3469
|
onChange: (next) => onChange({ ...block, actions: next.length > 0 ? next : void 0 })
|
|
3465
3470
|
}
|
|
@@ -3516,7 +3521,11 @@ function ImageFields({
|
|
|
3516
3521
|
) })
|
|
3517
3522
|
] });
|
|
3518
3523
|
}
|
|
3519
|
-
function ButtonsField({
|
|
3524
|
+
function ButtonsField({
|
|
3525
|
+
buttons,
|
|
3526
|
+
onChange,
|
|
3527
|
+
idPrefix = "card"
|
|
3528
|
+
}) {
|
|
3520
3529
|
const update = (idx, change) => {
|
|
3521
3530
|
onChange(buttons.map((b, i) => i === idx ? { ...b, ...change } : b));
|
|
3522
3531
|
};
|
|
@@ -3559,10 +3568,10 @@ function ButtonsField({ buttons, onChange }) {
|
|
|
3559
3568
|
}
|
|
3560
3569
|
)
|
|
3561
3570
|
] }),
|
|
3562
|
-
/* @__PURE__ */ jsx(EditorField, { label: "Label", htmlFor:
|
|
3571
|
+
/* @__PURE__ */ jsx(EditorField, { label: "Label", htmlFor: `${idPrefix}-btn-label-${idx}`, children: /* @__PURE__ */ jsx(
|
|
3563
3572
|
Input,
|
|
3564
3573
|
{
|
|
3565
|
-
id:
|
|
3574
|
+
id: `${idPrefix}-btn-label-${idx}`,
|
|
3566
3575
|
value: label,
|
|
3567
3576
|
placeholder: "e.g. Open",
|
|
3568
3577
|
onChange: (e) => update(idx, {
|
|
@@ -3579,11 +3588,11 @@ function ButtonsField({ buttons, onChange }) {
|
|
|
3579
3588
|
{
|
|
3580
3589
|
label: "Link URL",
|
|
3581
3590
|
help: "Optional. If set, the button opens this link.",
|
|
3582
|
-
htmlFor:
|
|
3591
|
+
htmlFor: `${idPrefix}-btn-url-${idx}`,
|
|
3583
3592
|
children: /* @__PURE__ */ jsx(
|
|
3584
3593
|
Input,
|
|
3585
3594
|
{
|
|
3586
|
-
id:
|
|
3595
|
+
id: `${idPrefix}-btn-url-${idx}`,
|
|
3587
3596
|
type: "url",
|
|
3588
3597
|
value: url,
|
|
3589
3598
|
placeholder: "e.g. https://example.com",
|
|
@@ -3602,8 +3611,8 @@ function ButtonsField({ buttons, onChange }) {
|
|
|
3602
3611
|
},
|
|
3603
3612
|
className: "flex flex-row gap-3",
|
|
3604
3613
|
children: ["default", "primary", "danger"].map((s) => /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
3605
|
-
/* @__PURE__ */ jsx(RadioGroupItem, { value: s, id:
|
|
3606
|
-
/* @__PURE__ */ jsx(Label, { htmlFor:
|
|
3614
|
+
/* @__PURE__ */ jsx(RadioGroupItem, { value: s, id: `${idPrefix}-btn-style-${idx}-${s}` }),
|
|
3615
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: `${idPrefix}-btn-style-${idx}-${s}`, className: "text-xs capitalize", children: s })
|
|
3607
3616
|
] }, s))
|
|
3608
3617
|
}
|
|
3609
3618
|
) })
|
|
@@ -3652,8 +3661,8 @@ function CarouselEditor({ block, onChange }) {
|
|
|
3652
3661
|
});
|
|
3653
3662
|
};
|
|
3654
3663
|
return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3", children: [
|
|
3655
|
-
/* @__PURE__ */ jsx("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "Carousels hold 1-10 cards.
|
|
3656
|
-
elements.map((card, idx) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-
|
|
3664
|
+
/* @__PURE__ */ jsx("p", { className: "text-[11px] leading-snug text-muted-foreground", children: "Carousels hold 1-10 cards." }),
|
|
3665
|
+
elements.map((card, idx) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-3 rounded-md border bg-muted/20 p-3", children: [
|
|
3657
3666
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between", children: [
|
|
3658
3667
|
/* @__PURE__ */ jsxs("span", { className: "text-xs font-medium text-foreground", children: [
|
|
3659
3668
|
"Card ",
|
|
@@ -3671,33 +3680,7 @@ function CarouselEditor({ block, onChange }) {
|
|
|
3671
3680
|
}
|
|
3672
3681
|
)
|
|
3673
3682
|
] }),
|
|
3674
|
-
/* @__PURE__ */ jsx(
|
|
3675
|
-
Input,
|
|
3676
|
-
{
|
|
3677
|
-
id: `carousel-card-title-${idx}`,
|
|
3678
|
-
value: card.title?.text ?? "",
|
|
3679
|
-
maxLength: 150,
|
|
3680
|
-
placeholder: "e.g. Card title",
|
|
3681
|
-
onChange: (e) => updateCard(idx, {
|
|
3682
|
-
...card,
|
|
3683
|
-
title: e.target.value ? { type: "mrkdwn", text: e.target.value } : void 0
|
|
3684
|
-
})
|
|
3685
|
-
}
|
|
3686
|
-
) }),
|
|
3687
|
-
/* @__PURE__ */ jsx(EditorField, { label: "Body", htmlFor: `carousel-card-body-${idx}`, children: /* @__PURE__ */ jsx(
|
|
3688
|
-
Textarea,
|
|
3689
|
-
{
|
|
3690
|
-
id: `carousel-card-body-${idx}`,
|
|
3691
|
-
value: card.body?.text ?? "",
|
|
3692
|
-
maxLength: 200,
|
|
3693
|
-
rows: 2,
|
|
3694
|
-
placeholder: "e.g. Short card description.",
|
|
3695
|
-
onChange: (e) => updateCard(idx, {
|
|
3696
|
-
...card,
|
|
3697
|
-
body: e.target.value ? { type: "mrkdwn", text: e.target.value } : void 0
|
|
3698
|
-
})
|
|
3699
|
-
}
|
|
3700
|
-
) })
|
|
3683
|
+
/* @__PURE__ */ jsx(CardEditor, { block: card, idPrefix: `carousel-card-${idx}`, onChange: (next) => updateCard(idx, next) })
|
|
3701
3684
|
] }, idx)),
|
|
3702
3685
|
/* @__PURE__ */ jsxs(Button, { type: "button", size: "sm", onClick: addCard, disabled: elements.length >= MAX_CARDS, className: "self-start", children: [
|
|
3703
3686
|
/* @__PURE__ */ jsx(Plus, { className: "h-3.5 w-3.5" }),
|