@ckc-net/puck-extended 0.1.0 → 0.1.2
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 -194
- 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
|
});
|
|
@@ -41,7 +41,6 @@ function Label$2({ className, readOnly, children, ...props }) {
|
|
|
41
41
|
//#region src/components/Fields/Label/index.tsx
|
|
42
42
|
const Label$1 = ({ label, readOnly }) => /* @__PURE__ */ jsx(Label$2, {
|
|
43
43
|
readOnly,
|
|
44
|
-
className: "rounded-md border border-dashed border-red-500 bg-red-500/10 p-3",
|
|
45
44
|
children: label
|
|
46
45
|
});
|
|
47
46
|
var Label_default = Label$1;
|
|
@@ -87,36 +86,33 @@ const Checkbox$1 = ({ onChange, value, readOnly, field, label }) => {
|
|
|
87
86
|
label,
|
|
88
87
|
readOnly
|
|
89
88
|
}), /* @__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
|
-
})
|
|
89
|
+
className: layout === "horizontal" ? "flex w-fit flex-wrap gap-1.5" : "flex flex-col gap-3",
|
|
90
|
+
children: field.options.map((option, index) => {
|
|
91
|
+
const optionValue = option.value;
|
|
92
|
+
const key = `${String(optionValue)}-${index}`;
|
|
93
|
+
const isChecked = selectedValues.includes(optionValue);
|
|
94
|
+
if (layout === "horizontal") return /* @__PURE__ */ jsx("label", {
|
|
95
|
+
className: "flex-1",
|
|
96
|
+
children: /* @__PURE__ */ jsx(Checkbox$2, {
|
|
97
|
+
layout: "horizontal",
|
|
98
|
+
checked: isChecked,
|
|
99
|
+
onCheckedChange: (checked) => handleChange(optionValue, checked),
|
|
100
|
+
disabled: readOnly,
|
|
101
|
+
children: option.label || option.value?.toString()
|
|
102
|
+
})
|
|
103
|
+
}, key);
|
|
104
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
105
|
+
className: "flex cursor-pointer items-center gap-3",
|
|
106
|
+
children: [/* @__PURE__ */ jsx(Checkbox$2, {
|
|
107
|
+
layout: "inline",
|
|
108
|
+
checked: isChecked,
|
|
109
|
+
onCheckedChange: (checked) => handleChange(optionValue, checked),
|
|
110
|
+
disabled: readOnly
|
|
111
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
112
|
+
className: "text-sm",
|
|
113
|
+
children: option.label || option.value?.toString()
|
|
114
|
+
})]
|
|
115
|
+
}, key);
|
|
120
116
|
})
|
|
121
117
|
})] });
|
|
122
118
|
};
|
|
@@ -138,14 +134,11 @@ function Input$2({ className, size = "default", ...props }) {
|
|
|
138
134
|
const Input$1 = ({ onChange, label, field, readOnly }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
139
135
|
label,
|
|
140
136
|
readOnly: field.readOnly || readOnly
|
|
141
|
-
}), /* @__PURE__ */ jsx(
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
onChange: (e) => onChange(e.currentTarget.value),
|
|
147
|
-
readOnly: field.readOnly || readOnly
|
|
148
|
-
})
|
|
137
|
+
}), /* @__PURE__ */ jsx(Input$2, {
|
|
138
|
+
type: "text",
|
|
139
|
+
placeholder: field.placeholder,
|
|
140
|
+
onChange: (e) => onChange(e.currentTarget.value),
|
|
141
|
+
readOnly: field.readOnly || readOnly
|
|
149
142
|
})] });
|
|
150
143
|
var Input_default = Input$1;
|
|
151
144
|
|
|
@@ -462,41 +455,38 @@ const NumberUnit = ({ onChange, value, label, field, readOnly }) => {
|
|
|
462
455
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
463
456
|
label,
|
|
464
457
|
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
|
-
})
|
|
458
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
459
|
+
className: "flex",
|
|
460
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
461
|
+
className: "flex-1",
|
|
462
|
+
children: /* @__PURE__ */ jsx(Input$2, {
|
|
463
|
+
className: "rounded-r-none",
|
|
464
|
+
type: "text",
|
|
465
|
+
placeholder: field.placeholder || "Value",
|
|
466
|
+
value: currentValue.value,
|
|
467
|
+
onChange: (e) => handleInputChange(e.currentTarget.value),
|
|
468
|
+
readOnly: field.readOnly || readOnly
|
|
469
|
+
})
|
|
470
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
471
|
+
className: "w-18",
|
|
472
|
+
children: /* @__PURE__ */ jsxs(Select$2, {
|
|
473
|
+
items: field.options || [],
|
|
474
|
+
value: currentValue.unit,
|
|
475
|
+
onValueChange: handleUnitChange,
|
|
476
|
+
disabled: field.readOnly || readOnly,
|
|
477
|
+
children: [/* @__PURE__ */ jsxs(SelectTrigger, {
|
|
478
|
+
className: "rounded-l-none border-l-0",
|
|
479
|
+
children: [/* @__PURE__ */ jsx(SelectValue, {}), /* @__PURE__ */ jsx(SelectIcon, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3.5" }) })]
|
|
480
|
+
}), /* @__PURE__ */ jsx(SelectPopup, {
|
|
481
|
+
align: "end",
|
|
482
|
+
side: "bottom",
|
|
483
|
+
children: /* @__PURE__ */ jsx(SelectList, { children: (field.options || []).map((option) => /* @__PURE__ */ jsxs(SelectItem, {
|
|
484
|
+
value: option.value,
|
|
485
|
+
children: [option.label, /* @__PURE__ */ jsx(SelectItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3.5" }) })]
|
|
486
|
+
}, option.value)) })
|
|
487
|
+
})]
|
|
488
|
+
})
|
|
489
|
+
})]
|
|
500
490
|
})] });
|
|
501
491
|
};
|
|
502
492
|
var NumberUnit_default = NumberUnit;
|
|
@@ -517,25 +507,22 @@ const Select$1 = ({ onChange, value, label, field, readOnly }) => {
|
|
|
517
507
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
518
508
|
label,
|
|
519
509
|
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
|
-
})
|
|
510
|
+
}), /* @__PURE__ */ jsxs(Select$2, {
|
|
511
|
+
items: itemsWithPlaceholder,
|
|
512
|
+
value: value || null,
|
|
513
|
+
onValueChange: handleValueChange,
|
|
514
|
+
disabled: field.readOnly || readOnly,
|
|
515
|
+
children: [/* @__PURE__ */ jsxs(SelectTrigger, {
|
|
516
|
+
className: "min-w-46",
|
|
517
|
+
children: [/* @__PURE__ */ jsx(SelectValue, {}), /* @__PURE__ */ jsx(SelectIcon, { children: /* @__PURE__ */ jsx(ChevronDownIcon, { className: "size-3.5" }) })]
|
|
518
|
+
}), /* @__PURE__ */ jsx(SelectPopup, {
|
|
519
|
+
align: "center",
|
|
520
|
+
side: "bottom",
|
|
521
|
+
children: /* @__PURE__ */ jsx(SelectList, { children: field.options.map((option) => /* @__PURE__ */ jsxs(SelectItem, {
|
|
522
|
+
value: option.value,
|
|
523
|
+
children: [option.label, /* @__PURE__ */ jsx(SelectItemIndicator, { children: /* @__PURE__ */ jsx(CheckIcon, { className: "size-3" }) })]
|
|
524
|
+
}, typeof option.label === "string" ? option.label : JSON.stringify(option.value))) })
|
|
525
|
+
})]
|
|
539
526
|
})] });
|
|
540
527
|
};
|
|
541
528
|
var Select_default = Select$1;
|
|
@@ -579,38 +566,35 @@ const Radio$1 = ({ onChange, value, readOnly, field, label }) => {
|
|
|
579
566
|
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
580
567
|
label,
|
|
581
568
|
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
|
-
})
|
|
569
|
+
}), /* @__PURE__ */ jsx(RadioGroup$1, {
|
|
570
|
+
layout,
|
|
571
|
+
value: value?.toString() || "",
|
|
572
|
+
onValueChange: handleChange,
|
|
573
|
+
disabled: readOnly,
|
|
574
|
+
className: groupClassName,
|
|
575
|
+
children: field.options.map((option, index) => {
|
|
576
|
+
const optionValue = String(option.value ?? "");
|
|
577
|
+
const key = `${optionValue}-${index}`;
|
|
578
|
+
if (layout === "horizontal") return /* @__PURE__ */ jsx("label", {
|
|
579
|
+
className: "flex-1",
|
|
580
|
+
children: /* @__PURE__ */ jsx(RadioGroupItem, {
|
|
581
|
+
layout: "horizontal",
|
|
582
|
+
value: optionValue,
|
|
583
|
+
disabled: readOnly,
|
|
584
|
+
children: option.label || option.value?.toString()
|
|
585
|
+
})
|
|
586
|
+
}, key);
|
|
587
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
588
|
+
className: "flex cursor-pointer items-center gap-3",
|
|
589
|
+
children: [/* @__PURE__ */ jsx(RadioGroupItem, {
|
|
590
|
+
layout: "inline",
|
|
591
|
+
value: optionValue,
|
|
592
|
+
disabled: readOnly
|
|
593
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
594
|
+
className: "text-sm",
|
|
595
|
+
children: option.label || option.value?.toString()
|
|
596
|
+
})]
|
|
597
|
+
}, key);
|
|
614
598
|
})
|
|
615
599
|
})] });
|
|
616
600
|
};
|
|
@@ -631,13 +615,10 @@ function Textarea$1({ className, size = "default", ...props }) {
|
|
|
631
615
|
const Textarea = ({ onChange, label, field, readOnly }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, {
|
|
632
616
|
label,
|
|
633
617
|
readOnly: field.readOnly || readOnly
|
|
634
|
-
}), /* @__PURE__ */ jsx(
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
onChange: (e) => onChange(e.currentTarget.value),
|
|
639
|
-
readOnly: field.readOnly || readOnly
|
|
640
|
-
})
|
|
618
|
+
}), /* @__PURE__ */ jsx(Textarea$1, {
|
|
619
|
+
placeholder: field.placeholder,
|
|
620
|
+
onChange: (e) => onChange(e.currentTarget.value),
|
|
621
|
+
readOnly: field.readOnly || readOnly
|
|
641
622
|
})] });
|
|
642
623
|
var Textarea_default = Textarea;
|
|
643
624
|
|
|
@@ -1297,24 +1278,21 @@ const DrawerItem = ({ name, icon }) => {
|
|
|
1297
1278
|
const description = componentConfig?.metadata?.description;
|
|
1298
1279
|
const displayIcon = iconOrImage || /* @__PURE__ */ jsx(BoxIcon, { size: 16 });
|
|
1299
1280
|
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 })
|
|
1281
|
+
const drawerContent = /* @__PURE__ */ jsxs("div", {
|
|
1282
|
+
className: "hover:bg-muted group flex cursor-grab items-center justify-between gap-2 rounded-md bg-white p-0.5 transition-colors",
|
|
1283
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
1284
|
+
className: "flex items-center gap-2 truncate",
|
|
1285
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
1286
|
+
className: "border-border group-hover:border-muted rounded-sm border bg-white p-3",
|
|
1287
|
+
children: displayIcon
|
|
1288
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1289
|
+
className: "truncate text-sm font-medium",
|
|
1290
|
+
children: name
|
|
1316
1291
|
})]
|
|
1317
|
-
})
|
|
1292
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
1293
|
+
className: "text-foreground h-full flex-none rounded-sm bg-white px-1 py-3",
|
|
1294
|
+
children: /* @__PURE__ */ jsx(GripVerticalIcon, { size: 16 })
|
|
1295
|
+
})]
|
|
1318
1296
|
});
|
|
1319
1297
|
if (!hasTooltipContent) return drawerContent;
|
|
1320
1298
|
return /* @__PURE__ */ jsx(TooltipProvider, {
|
|
@@ -1344,16 +1322,10 @@ var DrawerItem_default = DrawerItem;
|
|
|
1344
1322
|
const createPuckOverridesPlugin = () => {
|
|
1345
1323
|
return { overrides: {
|
|
1346
1324
|
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
|
-
}),
|
|
1325
|
+
drawer: ({ children }) => /* @__PURE__ */ jsx(Fragment, { children }),
|
|
1351
1326
|
drawerItem: DrawerItem_default,
|
|
1352
1327
|
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
|
-
}),
|
|
1328
|
+
fieldLabel: ({ children, label }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, { label }), children] }),
|
|
1357
1329
|
fieldTypes: {
|
|
1358
1330
|
checkbox: Checkbox_default,
|
|
1359
1331
|
numberUnit: NumberUnit_default,
|
|
@@ -2265,35 +2237,32 @@ const useMediaPicker = (initialValue, onChange) => {
|
|
|
2265
2237
|
};
|
|
2266
2238
|
const MediaPicker = ({ value, onChange, mediaType }) => {
|
|
2267
2239
|
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
|
-
})
|
|
2240
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2241
|
+
className: "flex flex-col gap-y-3",
|
|
2242
|
+
children: [
|
|
2243
|
+
/* @__PURE__ */ jsx(RadioGroup$1, {
|
|
2244
|
+
value: selectedType,
|
|
2245
|
+
onValueChange: handleTypeChange,
|
|
2246
|
+
className: "border-input flex w-fit flex-wrap divide-x divide-stone-200 overflow-hidden rounded-md border",
|
|
2247
|
+
children: SOURCE_TYPE_OPTIONS.map((option) => /* @__PURE__ */ jsx("label", {
|
|
2248
|
+
className: "flex-1",
|
|
2249
|
+
children: /* @__PURE__ */ jsx(RadioGroupItem, {
|
|
2250
|
+
layout: "horizontal",
|
|
2251
|
+
value: option.value,
|
|
2252
|
+
children: option.label
|
|
2253
|
+
})
|
|
2254
|
+
}, option.value))
|
|
2255
|
+
}),
|
|
2256
|
+
selectedType === "url" && /* @__PURE__ */ jsx(UrlField, {
|
|
2257
|
+
value: currentValue.url || "",
|
|
2258
|
+
onChange: handleUrlChange
|
|
2259
|
+
}),
|
|
2260
|
+
selectedType === "media" && /* @__PURE__ */ jsx(MediaLibraryField, {
|
|
2261
|
+
value: currentValue.media || null,
|
|
2262
|
+
onChange: handleMediaChange,
|
|
2263
|
+
mediaType
|
|
2264
|
+
})
|
|
2265
|
+
]
|
|
2297
2266
|
});
|
|
2298
2267
|
};
|
|
2299
2268
|
const getMediaUrl = (value) => {
|
|
@@ -3401,12 +3370,9 @@ var ColorPicker_default = ColorPicker;
|
|
|
3401
3370
|
const textColorField = { textColor: {
|
|
3402
3371
|
type: "custom",
|
|
3403
3372
|
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
|
-
})
|
|
3373
|
+
render: ({ value, onChange, field }) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Label_default, { label: field.label }), /* @__PURE__ */ jsx(ColorPicker_default, {
|
|
3374
|
+
value,
|
|
3375
|
+
onChange
|
|
3410
3376
|
})] })
|
|
3411
3377
|
} };
|
|
3412
3378
|
function textColorToClasses(textColor) {
|