@ckc-net/puck-extended 0.1.0 → 0.1.1
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.d.ts +17 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +160 -193
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
|
3
3
|
import { Checkbox } from "@base-ui/react/checkbox";
|
|
4
4
|
import { Radio } from "@base-ui/react/radio";
|
|
5
5
|
import { RadioGroup } from "@base-ui/react/radio-group";
|
|
6
|
-
import * as
|
|
7
|
-
import { Fields } from "@
|
|
6
|
+
import * as _puckeditor_core0 from "@puckeditor/core";
|
|
7
|
+
import { Fields } from "@puckeditor/core";
|
|
8
8
|
|
|
9
9
|
//#region src/components/ui/checkbox.d.ts
|
|
10
10
|
type CheckboxLayout = "horizontal" | "inline";
|
|
@@ -88,9 +88,9 @@ declare const createPuckOverridesPlugin: () => {
|
|
|
88
88
|
readOnly,
|
|
89
89
|
field,
|
|
90
90
|
label
|
|
91
|
-
}: (
|
|
91
|
+
}: (_puckeditor_core0.FieldProps<_puckeditor_core0.Field<any>> & {
|
|
92
92
|
name: string;
|
|
93
|
-
field:
|
|
93
|
+
field: _puckeditor_core0.Field<any> & {
|
|
94
94
|
options?: ReadonlyArray<{
|
|
95
95
|
label: React.ReactNode;
|
|
96
96
|
value: any;
|
|
@@ -119,9 +119,9 @@ declare const createPuckOverridesPlugin: () => {
|
|
|
119
119
|
readOnly,
|
|
120
120
|
field,
|
|
121
121
|
label
|
|
122
|
-
}: (
|
|
122
|
+
}: (_puckeditor_core0.FieldProps<_puckeditor_core0.Field<any>> & {
|
|
123
123
|
name: string;
|
|
124
|
-
field:
|
|
124
|
+
field: _puckeditor_core0.Field<any> & {
|
|
125
125
|
options?: ReadonlyArray<{
|
|
126
126
|
label: React.ReactNode;
|
|
127
127
|
value: any;
|
|
@@ -234,15 +234,15 @@ declare const TablePagination: ({
|
|
|
234
234
|
//#endregion
|
|
235
235
|
//#region src/utils/display.d.ts
|
|
236
236
|
type DisplayTraitProps = {
|
|
237
|
-
display?:
|
|
237
|
+
display?: "hidden" | "inline" | "inline-block" | "block" | "flex" | "inline-flex";
|
|
238
238
|
};
|
|
239
239
|
declare const displayField: Fields;
|
|
240
|
-
declare function displayToClasses(display?:
|
|
240
|
+
declare function displayToClasses(display?: "hidden" | "inline" | "inline-block" | "block" | "flex" | "inline-flex"): string;
|
|
241
241
|
declare const displayDefaultProps: DisplayTraitProps;
|
|
242
242
|
//#endregion
|
|
243
243
|
//#region src/utils/fontWeight.d.ts
|
|
244
244
|
type FontWeightTraitProps = {
|
|
245
|
-
fontWeight?:
|
|
245
|
+
fontWeight?: "" | "thin" | "extralight" | "light" | "normal" | "medium" | "semibold" | "bold" | "extrabold" | "black";
|
|
246
246
|
};
|
|
247
247
|
declare const fontWeightField: Fields;
|
|
248
248
|
declare function fontWeightToClasses(fontWeight?: string): string;
|
|
@@ -285,8 +285,8 @@ type PaddingValue = {
|
|
|
285
285
|
unit: string;
|
|
286
286
|
};
|
|
287
287
|
type PaddingItem = {
|
|
288
|
-
breakpoint?:
|
|
289
|
-
direction:
|
|
288
|
+
breakpoint?: "xs" | "sm" | "md" | "lg" | "xl" | "2xl";
|
|
289
|
+
direction: "all" | "top" | "right" | "bottom" | "left" | "x" | "y";
|
|
290
290
|
padding: PaddingValue;
|
|
291
291
|
};
|
|
292
292
|
type PaddingsTraitProps = {
|
|
@@ -300,7 +300,7 @@ declare const paddingsDefaultProps: {
|
|
|
300
300
|
//#endregion
|
|
301
301
|
//#region src/utils/position.d.ts
|
|
302
302
|
type PositionTraitProps = {
|
|
303
|
-
position?:
|
|
303
|
+
position?: "static" | "relative" | "absolute" | "fixed" | "sticky";
|
|
304
304
|
top?: string;
|
|
305
305
|
right?: string;
|
|
306
306
|
bottom?: string;
|
|
@@ -308,7 +308,7 @@ type PositionTraitProps = {
|
|
|
308
308
|
zIndex?: number;
|
|
309
309
|
};
|
|
310
310
|
declare const positionField: Fields;
|
|
311
|
-
declare function positionToClasses(position?:
|
|
311
|
+
declare function positionToClasses(position?: "static" | "relative" | "absolute" | "fixed" | "sticky", top?: string, right?: string, bottom?: string, left?: string, zIndex?: number): string;
|
|
312
312
|
declare const positionDefaultProps: PositionTraitProps;
|
|
313
313
|
//#endregion
|
|
314
314
|
//#region src/utils/size.d.ts
|
|
@@ -331,8 +331,8 @@ declare const sizeDefaultProps: SizeTraitProps;
|
|
|
331
331
|
//#region src/utils/spacing.d.ts
|
|
332
332
|
type SpacingTraitProps = MarginsTraitProps & PaddingsTraitProps;
|
|
333
333
|
declare const spacingFields: {
|
|
334
|
-
[x: string]:
|
|
335
|
-
[x: number]:
|
|
334
|
+
[x: string]: _puckeditor_core0.Field<any, {}>;
|
|
335
|
+
[x: number]: _puckeditor_core0.Field<any, {}>;
|
|
336
336
|
};
|
|
337
337
|
declare const spacingDefaultProps: {
|
|
338
338
|
paddings: Array<PaddingItem>;
|
|
@@ -398,8 +398,8 @@ declare const textTransformDefaultProps: {
|
|
|
398
398
|
//#region src/utils/typography.d.ts
|
|
399
399
|
type TypographyTraitProps = TextAlignTraitProps & TextTransformTraitProps & TextDecorationTraitProps & TextSizeTraitProps & TextColorTraitProps & LineHeightTraitProps & FontWeightTraitProps;
|
|
400
400
|
declare const typographyFields: {
|
|
401
|
-
[x: string]:
|
|
402
|
-
[x: number]:
|
|
401
|
+
[x: string]: _puckeditor_core0.Field<any, {}>;
|
|
402
|
+
[x: number]: _puckeditor_core0.Field<any, {}>;
|
|
403
403
|
};
|
|
404
404
|
declare const typographyDefaultProps: {
|
|
405
405
|
fontWeight: "";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/components/ui/checkbox.tsx","../src/components/Fields/NumberUnit/index.tsx","../src/components/ui/radio.tsx","../src/overrides/plugin.tsx","../src/components/Fields/Label/index.tsx","../src/components/MediaPicker/index.tsx","../src/components/Pagination/index.tsx","../src/utils/display.tsx","../src/utils/fontWeight.tsx","../src/utils/lineHeight.tsx","../src/utils/margins.tsx","../src/utils/paddings.tsx","../src/utils/position.tsx","../src/utils/size.tsx","../src/utils/spacing.tsx","../src/utils/spacingOptions.ts","../src/utils/textAlign.tsx","../src/utils/textColor.tsx","../src/utils/textDecoration.tsx","../src/utils/textSize.tsx","../src/utils/textTransform.tsx","../src/utils/typography.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;KAOK,cAAA;;;KCOO,eAAA;;;;;;KCPP,WAAA;;;cCIC;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/components/ui/checkbox.tsx","../src/components/Fields/NumberUnit/index.tsx","../src/components/ui/radio.tsx","../src/overrides/plugin.tsx","../src/components/Fields/Label/index.tsx","../src/components/MediaPicker/index.tsx","../src/components/Pagination/index.tsx","../src/utils/display.tsx","../src/utils/fontWeight.tsx","../src/utils/lineHeight.tsx","../src/utils/margins.tsx","../src/utils/paddings.tsx","../src/utils/position.tsx","../src/utils/size.tsx","../src/utils/spacing.tsx","../src/utils/spacingOptions.ts","../src/utils/textAlign.tsx","../src/utils/textColor.tsx","../src/utils/textDecoration.tsx","../src/utils/textSize.tsx","../src/utils/textTransform.tsx","../src/utils/typography.tsx"],"sourcesContent":[],"mappings":";;;;;;;;;KAOK,cAAA;;;KCOO,eAAA;;;;;;KCPP,WAAA;;;cCIC;;;;;;;;;8BAmBS;mBAAA,MAAA,CAEV;;;;;;;QHzBA,QAAc,kBAAA;;;;MCOP,KAAA,EAAA,CAAA;QAAe;OAAA,EAAA;;;;;;QCPtB,QAAW,kBAAA;;;;ICIV,MAAA,EAAA,CAAA;MAAA;KAAA,EAAA;gBAIyC,KAAA,CAAM;UAAW,kBAAA,CAAA,GAAA,CAAA;;;;;MA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;;;KChBD,wBAAA;mBACS;;cAKR,qBAAqB;iBAelB,uBAAA,kBACK;cA6BR,4BAA4B;;;KCzD7B,kBAAA;;;cAkBC,eAAe;iBAyBZ,iBAAA;cAKH;;;;;KC3CD,uBAAA;;;cAIC,oBAAoB;iBAajB,sBAAA;cAKH;;;;;KCoBD,oBAAA,GAAuB,sBAC/B,0BACA,2BACA,qBACA,sBACA,uBACA;cAES;eAQZ,iBAAA,CAAA;EnB5DI,CAAA,CAAA,EAAA,MAAA,CAAA,EmB4DJ,iBAAA,CAAA,KnB5De,CAAA,GAAA,EAAA,CAAA,CAAA,CAAA;;cmB8DH;;ElB1DP,UAAA,EAAA,EAAA;;;mBkBkEL;elB/Cc,EAAA,MAAA;EAAA,SAEV,EAAA,MAAA;;iBkB+CW,mBAAA,QACL,QAAQ;cAeN"}
|
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { Radio } from "@base-ui/react/radio";
|
|
|
10
10
|
import { RadioGroup } from "@base-ui/react/radio-group";
|
|
11
11
|
import { Field } from "@base-ui/react/field";
|
|
12
12
|
import { mergeProps } from "@base-ui/react/merge-props";
|
|
13
|
-
import { createUsePuck } from "@
|
|
13
|
+
import { createUsePuck } from "@puckeditor/core";
|
|
14
14
|
import { Tabs } from "@base-ui/react/tabs";
|
|
15
15
|
import { Accordion } from "@base-ui/react/accordion";
|
|
16
16
|
import { Tooltip } from "@base-ui/react/tooltip";
|
|
@@ -31,7 +31,7 @@ function Label$2({ className, readOnly, children, ...props }) {
|
|
|
31
31
|
return /* @__PURE__ */ jsxs("label", {
|
|
32
32
|
"data-slot": "label",
|
|
33
33
|
"data-readonly": readOnly ? "" : void 0,
|
|
34
|
-
className: cn("text-foreground mb-
|
|
34
|
+
className: cn("text-foreground mb-3 flex items-center justify-between gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50", className),
|
|
35
35
|
...props,
|
|
36
36
|
children: [children, readOnly && /* @__PURE__ */ jsx(LockIcon, { className: "size-4" })]
|
|
37
37
|
});
|
|
@@ -87,36 +87,33 @@ const Checkbox$1 = ({ onChange, value, readOnly, field, label }) => {
|
|
|
87
87
|
label,
|
|
88
88
|
readOnly
|
|
89
89
|
}), /* @__PURE__ */ jsx("div", {
|
|
90
|
-
className: "
|
|
91
|
-
children:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
})]
|
|
118
|
-
}, key);
|
|
119
|
-
})
|
|
90
|
+
className: layout === "horizontal" ? "flex w-fit flex-wrap gap-1.5" : "flex flex-col gap-3",
|
|
91
|
+
children: field.options.map((option, index) => {
|
|
92
|
+
const optionValue = option.value;
|
|
93
|
+
const key = `${String(optionValue)}-${index}`;
|
|
94
|
+
const isChecked = selectedValues.includes(optionValue);
|
|
95
|
+
if (layout === "horizontal") return /* @__PURE__ */ jsx("label", {
|
|
96
|
+
className: "flex-1",
|
|
97
|
+
children: /* @__PURE__ */ jsx(Checkbox$2, {
|
|
98
|
+
layout: "horizontal",
|
|
99
|
+
checked: isChecked,
|
|
100
|
+
onCheckedChange: (checked) => handleChange(optionValue, checked),
|
|
101
|
+
disabled: readOnly,
|
|
102
|
+
children: option.label || option.value?.toString()
|
|
103
|
+
})
|
|
104
|
+
}, key);
|
|
105
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
106
|
+
className: "flex cursor-pointer items-center gap-3",
|
|
107
|
+
children: [/* @__PURE__ */ jsx(Checkbox$2, {
|
|
108
|
+
layout: "inline",
|
|
109
|
+
checked: isChecked,
|
|
110
|
+
onCheckedChange: (checked) => handleChange(optionValue, checked),
|
|
111
|
+
disabled: readOnly
|
|
112
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
113
|
+
className: "text-sm",
|
|
114
|
+
children: option.label || option.value?.toString()
|
|
115
|
+
})]
|
|
116
|
+
}, key);
|
|
120
117
|
})
|
|
121
118
|
})] });
|
|
122
119
|
};
|
|
@@ -138,14 +135,11 @@ function Input$2({ className, size = "default", ...props }) {
|
|
|
138
135
|
const Input$1 = ({ onChange, label, field, readOnly }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
139
136
|
label,
|
|
140
137
|
readOnly: field.readOnly || readOnly
|
|
141
|
-
}), /* @__PURE__ */ jsx(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
onChange: (e) => onChange(e.currentTarget.value),
|
|
147
|
-
readOnly: field.readOnly || readOnly
|
|
148
|
-
})
|
|
138
|
+
}), /* @__PURE__ */ jsx(Input$2, {
|
|
139
|
+
type: "text",
|
|
140
|
+
placeholder: field.placeholder,
|
|
141
|
+
onChange: (e) => onChange(e.currentTarget.value),
|
|
142
|
+
readOnly: field.readOnly || readOnly
|
|
149
143
|
})] });
|
|
150
144
|
var Input_default = Input$1;
|
|
151
145
|
|
|
@@ -462,41 +456,38 @@ const NumberUnit = ({ onChange, value, label, field, readOnly }) => {
|
|
|
462
456
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
463
457
|
label,
|
|
464
458
|
readOnly: field.readOnly || readOnly
|
|
465
|
-
}), /* @__PURE__ */
|
|
466
|
-
className: "
|
|
467
|
-
children: /* @__PURE__ */
|
|
468
|
-
className: "flex",
|
|
469
|
-
children:
|
|
470
|
-
className: "
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
children: [/* @__PURE__ */
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
children: /* @__PURE__ */ jsx(
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
})
|
|
498
|
-
})]
|
|
499
|
-
})
|
|
459
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
460
|
+
className: "flex",
|
|
461
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
462
|
+
className: "flex-1",
|
|
463
|
+
children: /* @__PURE__ */ jsx(Input$2, {
|
|
464
|
+
className: "rounded-r-none",
|
|
465
|
+
type: "text",
|
|
466
|
+
placeholder: field.placeholder || "Value",
|
|
467
|
+
value: currentValue.value,
|
|
468
|
+
onChange: (e) => handleInputChange(e.currentTarget.value),
|
|
469
|
+
readOnly: field.readOnly || readOnly
|
|
470
|
+
})
|
|
471
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
472
|
+
className: "w-18",
|
|
473
|
+
children: /* @__PURE__ */ jsxs(Select$2, {
|
|
474
|
+
items: field.options || [],
|
|
475
|
+
value: currentValue.unit,
|
|
476
|
+
onValueChange: handleUnitChange,
|
|
477
|
+
disabled: field.readOnly || readOnly,
|
|
478
|
+
children: [/* @__PURE__ */ jsxs(SelectTrigger, {
|
|
479
|
+
className: "rounded-l-none border-l-0",
|
|
480
|
+
children: [/* @__PURE__ */ jsx(SelectValue, {}), /* @__PURE__ */ jsx(SelectIcon, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3.5" }) })]
|
|
481
|
+
}), /* @__PURE__ */ jsx(SelectPopup, {
|
|
482
|
+
align: "end",
|
|
483
|
+
side: "bottom",
|
|
484
|
+
children: /* @__PURE__ */ jsx(SelectList, { children: (field.options || []).map((option) => /* @__PURE__ */ jsxs(SelectItem, {
|
|
485
|
+
value: option.value,
|
|
486
|
+
children: [option.label, /* @__PURE__ */ jsx(SelectItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" }) })]
|
|
487
|
+
}, option.value)) })
|
|
488
|
+
})]
|
|
489
|
+
})
|
|
490
|
+
})]
|
|
500
491
|
})] });
|
|
501
492
|
};
|
|
502
493
|
var NumberUnit_default = NumberUnit;
|
|
@@ -517,25 +508,22 @@ const Select$1 = ({ onChange, value, label, field, readOnly }) => {
|
|
|
517
508
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
518
509
|
label,
|
|
519
510
|
readOnly: field.readOnly || readOnly
|
|
520
|
-
}), /* @__PURE__ */
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
children: [/* @__PURE__ */
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
children: /* @__PURE__ */ jsx(
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
}, typeof option.label === "string" ? option.label : JSON.stringify(option.value))) })
|
|
537
|
-
})]
|
|
538
|
-
})
|
|
511
|
+
}), /* @__PURE__ */ jsxs(Select$2, {
|
|
512
|
+
items: itemsWithPlaceholder,
|
|
513
|
+
value: value || null,
|
|
514
|
+
onValueChange: handleValueChange,
|
|
515
|
+
disabled: field.readOnly || readOnly,
|
|
516
|
+
children: [/* @__PURE__ */ jsxs(SelectTrigger, {
|
|
517
|
+
className: "min-w-46",
|
|
518
|
+
children: [/* @__PURE__ */ jsx(SelectValue, {}), /* @__PURE__ */ jsx(SelectIcon, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3.5" }) })]
|
|
519
|
+
}), /* @__PURE__ */ jsx(SelectPopup, {
|
|
520
|
+
align: "center",
|
|
521
|
+
side: "bottom",
|
|
522
|
+
children: /* @__PURE__ */ jsx(SelectList, { children: field.options.map((option) => /* @__PURE__ */ jsxs(SelectItem, {
|
|
523
|
+
value: option.value,
|
|
524
|
+
children: [option.label, /* @__PURE__ */ jsx(SelectItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3" }) })]
|
|
525
|
+
}, typeof option.label === "string" ? option.label : JSON.stringify(option.value))) })
|
|
526
|
+
})]
|
|
539
527
|
})] });
|
|
540
528
|
};
|
|
541
529
|
var Select_default = Select$1;
|
|
@@ -579,38 +567,35 @@ const Radio$1 = ({ onChange, value, readOnly, field, label }) => {
|
|
|
579
567
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
580
568
|
label,
|
|
581
569
|
readOnly
|
|
582
|
-
}), /* @__PURE__ */ jsx(
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
})]
|
|
612
|
-
}, key);
|
|
613
|
-
})
|
|
570
|
+
}), /* @__PURE__ */ jsx(RadioGroup$1, {
|
|
571
|
+
layout,
|
|
572
|
+
value: value?.toString() || "",
|
|
573
|
+
onValueChange: handleChange,
|
|
574
|
+
disabled: readOnly,
|
|
575
|
+
className: groupClassName,
|
|
576
|
+
children: field.options.map((option, index) => {
|
|
577
|
+
const optionValue = String(option.value ?? "");
|
|
578
|
+
const key = `${optionValue}-${index}`;
|
|
579
|
+
if (layout === "horizontal") return /* @__PURE__ */ jsx("label", {
|
|
580
|
+
className: "flex-1",
|
|
581
|
+
children: /* @__PURE__ */ jsx(RadioGroupItem, {
|
|
582
|
+
layout: "horizontal",
|
|
583
|
+
value: optionValue,
|
|
584
|
+
disabled: readOnly,
|
|
585
|
+
children: option.label || option.value?.toString()
|
|
586
|
+
})
|
|
587
|
+
}, key);
|
|
588
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
589
|
+
className: "flex cursor-pointer items-center gap-3",
|
|
590
|
+
children: [/* @__PURE__ */ jsx(RadioGroupItem, {
|
|
591
|
+
layout: "inline",
|
|
592
|
+
value: optionValue,
|
|
593
|
+
disabled: readOnly
|
|
594
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
595
|
+
className: "text-sm",
|
|
596
|
+
children: option.label || option.value?.toString()
|
|
597
|
+
})]
|
|
598
|
+
}, key);
|
|
614
599
|
})
|
|
615
600
|
})] });
|
|
616
601
|
};
|
|
@@ -631,13 +616,10 @@ function Textarea$1({ className, size = "default", ...props }) {
|
|
|
631
616
|
const Textarea = ({ onChange, label, field, readOnly }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
632
617
|
label,
|
|
633
618
|
readOnly: field.readOnly || readOnly
|
|
634
|
-
}), /* @__PURE__ */ jsx(
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
onChange: (e) => onChange(e.currentTarget.value),
|
|
639
|
-
readOnly: field.readOnly || readOnly
|
|
640
|
-
})
|
|
619
|
+
}), /* @__PURE__ */ jsx(Textarea$1, {
|
|
620
|
+
placeholder: field.placeholder,
|
|
621
|
+
onChange: (e) => onChange(e.currentTarget.value),
|
|
622
|
+
readOnly: field.readOnly || readOnly
|
|
641
623
|
})] });
|
|
642
624
|
var Textarea_default = Textarea;
|
|
643
625
|
|
|
@@ -1297,24 +1279,21 @@ const DrawerItem = ({ name, icon }) => {
|
|
|
1297
1279
|
const description = componentConfig?.metadata?.description;
|
|
1298
1280
|
const displayIcon = iconOrImage || /* @__PURE__ */ jsx(BoxIcon, { size: 16 });
|
|
1299
1281
|
const hasTooltipContent = imageUrl || description;
|
|
1300
|
-
const drawerContent = /* @__PURE__ */
|
|
1301
|
-
className: "
|
|
1302
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
1303
|
-
className: "
|
|
1304
|
-
children: [/* @__PURE__ */
|
|
1305
|
-
className: "
|
|
1306
|
-
children:
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
className: "truncate text-sm font-medium",
|
|
1311
|
-
children: name
|
|
1312
|
-
})]
|
|
1313
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
1314
|
-
className: "text-foreground h-full flex-none rounded-sm bg-white px-1 py-3",
|
|
1315
|
-
children: /* @__PURE__ */ jsx(GripVerticalIcon, { size: 16 })
|
|
1282
|
+
const drawerContent = /* @__PURE__ */ jsxs("div", {
|
|
1283
|
+
className: "hover:bg-muted group flex cursor-grab items-center justify-between gap-2 rounded-md bg-white p-0.5 transition-colors",
|
|
1284
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1285
|
+
className: "flex items-center gap-2 truncate",
|
|
1286
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1287
|
+
className: "border-border group-hover:border-muted rounded-sm border bg-white p-3",
|
|
1288
|
+
children: displayIcon
|
|
1289
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1290
|
+
className: "truncate text-sm font-medium",
|
|
1291
|
+
children: name
|
|
1316
1292
|
})]
|
|
1317
|
-
})
|
|
1293
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1294
|
+
className: "text-foreground h-full flex-none rounded-sm bg-white px-1 py-3",
|
|
1295
|
+
children: /* @__PURE__ */ jsx(GripVerticalIcon, { size: 16 })
|
|
1296
|
+
})]
|
|
1318
1297
|
});
|
|
1319
1298
|
if (!hasTooltipContent) return drawerContent;
|
|
1320
1299
|
return /* @__PURE__ */ jsx(TooltipProvider, {
|
|
@@ -1344,16 +1323,10 @@ var DrawerItem_default = DrawerItem;
|
|
|
1344
1323
|
const createPuckOverridesPlugin = () => {
|
|
1345
1324
|
return { overrides: {
|
|
1346
1325
|
actionBar: ActionBar_default,
|
|
1347
|
-
drawer: ({ children }) => /* @__PURE__ */ jsx(
|
|
1348
|
-
className: "rounded-md border border-dashed border-green-500 bg-green-500/10 p-3",
|
|
1349
|
-
children
|
|
1350
|
-
}),
|
|
1326
|
+
drawer: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
|
|
1351
1327
|
drawerItem: DrawerItem_default,
|
|
1352
1328
|
fields: FieldGroups_default,
|
|
1353
|
-
fieldLabel: ({ children, label }) => /* @__PURE__ */ jsxs(
|
|
1354
|
-
className: "rounded-md border border-dashed border-blue-500 bg-blue-500/10 p-3",
|
|
1355
|
-
children: [/* @__PURE__ */ jsx(Label_default, { label }), children]
|
|
1356
|
-
}),
|
|
1329
|
+
fieldLabel: ({ children, label }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, { label }), children] }),
|
|
1357
1330
|
fieldTypes: {
|
|
1358
1331
|
checkbox: Checkbox_default,
|
|
1359
1332
|
numberUnit: NumberUnit_default,
|
|
@@ -2265,35 +2238,32 @@ const useMediaPicker = (initialValue, onChange) => {
|
|
|
2265
2238
|
};
|
|
2266
2239
|
const MediaPicker = ({ value, onChange, mediaType }) => {
|
|
2267
2240
|
const { currentValue, selectedType, handleTypeChange, handleUrlChange, handleMediaChange } = useMediaPicker(value, onChange);
|
|
2268
|
-
return /* @__PURE__ */
|
|
2269
|
-
className: "
|
|
2270
|
-
children:
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
className: "
|
|
2277
|
-
children:
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
})
|
|
2295
|
-
]
|
|
2296
|
-
})
|
|
2241
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2242
|
+
className: "flex flex-col gap-y-3",
|
|
2243
|
+
children: [
|
|
2244
|
+
/* @__PURE__ */ jsx(RadioGroup$1, {
|
|
2245
|
+
value: selectedType,
|
|
2246
|
+
onValueChange: handleTypeChange,
|
|
2247
|
+
className: "border-input flex w-fit flex-wrap divide-x divide-stone-200 overflow-hidden rounded-md border",
|
|
2248
|
+
children: SOURCE_TYPE_OPTIONS.map((option) => /* @__PURE__ */ jsx("label", {
|
|
2249
|
+
className: "flex-1",
|
|
2250
|
+
children: /* @__PURE__ */ jsx(RadioGroupItem, {
|
|
2251
|
+
layout: "horizontal",
|
|
2252
|
+
value: option.value,
|
|
2253
|
+
children: option.label
|
|
2254
|
+
})
|
|
2255
|
+
}, option.value))
|
|
2256
|
+
}),
|
|
2257
|
+
selectedType === "url" && /* @__PURE__ */ jsx(UrlField, {
|
|
2258
|
+
value: currentValue.url || "",
|
|
2259
|
+
onChange: handleUrlChange
|
|
2260
|
+
}),
|
|
2261
|
+
selectedType === "media" && /* @__PURE__ */ jsx(MediaLibraryField, {
|
|
2262
|
+
value: currentValue.media || null,
|
|
2263
|
+
onChange: handleMediaChange,
|
|
2264
|
+
mediaType
|
|
2265
|
+
})
|
|
2266
|
+
]
|
|
2297
2267
|
});
|
|
2298
2268
|
};
|
|
2299
2269
|
const getMediaUrl = (value) => {
|
|
@@ -3401,12 +3371,9 @@ var ColorPicker_default = ColorPicker;
|
|
|
3401
3371
|
const textColorField = { textColor: {
|
|
3402
3372
|
type: "custom",
|
|
3403
3373
|
label: "Text color",
|
|
3404
|
-
render: ({ value, onChange, field }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, { label: field.label }), /* @__PURE__ */ jsx(
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
value,
|
|
3408
|
-
onChange
|
|
3409
|
-
})
|
|
3374
|
+
render: ({ value, onChange, field }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, { label: field.label }), /* @__PURE__ */ jsx(ColorPicker_default, {
|
|
3375
|
+
value,
|
|
3376
|
+
onChange
|
|
3410
3377
|
})] })
|
|
3411
3378
|
} };
|
|
3412
3379
|
function textColorToClasses(textColor) {
|