@timeax/form-palette 0.0.6 → 0.0.7
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.js +46 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -41905,7 +41905,7 @@ function FieldGroup({ className, ...props }) {
|
|
|
41905
41905
|
{
|
|
41906
41906
|
"data-slot": "field-group",
|
|
41907
41907
|
className: cn(
|
|
41908
|
-
"group/field-group
|
|
41908
|
+
"group/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",
|
|
41909
41909
|
className
|
|
41910
41910
|
),
|
|
41911
41911
|
...props
|
|
@@ -42456,6 +42456,22 @@ function InputField(props) {
|
|
|
42456
42456
|
}),
|
|
42457
42457
|
[layout, sublabel, description, helpText, visualError, tagsContent]
|
|
42458
42458
|
);
|
|
42459
|
+
const hasLabelSlotsAt = (placement) => {
|
|
42460
|
+
let found = false;
|
|
42461
|
+
graph.getSlotsFor("label", placement).render((slots) => {
|
|
42462
|
+
if (slots.length > 0) {
|
|
42463
|
+
found = true;
|
|
42464
|
+
}
|
|
42465
|
+
return null;
|
|
42466
|
+
});
|
|
42467
|
+
return found;
|
|
42468
|
+
};
|
|
42469
|
+
const hasLabelLeftSlots = hasLabelSlotsAt("left");
|
|
42470
|
+
const hasLabelRightSlots = hasLabelSlotsAt("right");
|
|
42471
|
+
const hasLabelAboveSlots = hasLabelSlotsAt("above");
|
|
42472
|
+
const hasLabelBelowSlots = hasLabelSlotsAt("below");
|
|
42473
|
+
const hasAnyLabelBlockContent = !!label || hasLabelLeftSlots || hasLabelRightSlots || hasLabelAboveSlots || hasLabelBelowSlots;
|
|
42474
|
+
const hasLabelRowContent = !!label || hasLabelLeftSlots || hasLabelRightSlots;
|
|
42459
42475
|
const inlineLabelSide = lp === "right" ? "right" : lp === "hidden" ? "hidden" : "left";
|
|
42460
42476
|
const inlineInputColClass = [
|
|
42461
42477
|
isCompactInline ? "flex-none" : "flex-1 min-w-0",
|
|
@@ -42503,7 +42519,7 @@ function InputField(props) {
|
|
|
42503
42519
|
)
|
|
42504
42520
|
)
|
|
42505
42521
|
] });
|
|
42506
|
-
const inlineLabelColumn = inlineLabelSide === "hidden" ? null : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
42522
|
+
const inlineLabelColumn = inlineLabelSide === "hidden" || !hasAnyLabelBlockContent ? null : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
42507
42523
|
"div",
|
|
42508
42524
|
{
|
|
42509
42525
|
className: ["flex flex-col gap-0", inlineLabelColClass].filter(Boolean).join(" "),
|
|
@@ -42513,7 +42529,7 @@ function InputField(props) {
|
|
|
42513
42529
|
(slot) => renderHelperSlot("label", slot, classes)
|
|
42514
42530
|
)
|
|
42515
42531
|
),
|
|
42516
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
42532
|
+
hasLabelRowContent && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
42517
42533
|
"div",
|
|
42518
42534
|
{
|
|
42519
42535
|
className: [
|
|
@@ -42540,7 +42556,16 @@ function InputField(props) {
|
|
|
42540
42556
|
children: /* @__PURE__ */ jsxRuntime.jsxs(FieldTitle, { children: [
|
|
42541
42557
|
label,
|
|
42542
42558
|
" ",
|
|
42543
|
-
required ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
42559
|
+
required ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
42560
|
+
"span",
|
|
42561
|
+
{
|
|
42562
|
+
className: cn(
|
|
42563
|
+
"text-destructive",
|
|
42564
|
+
classes == null ? void 0 : classes.required
|
|
42565
|
+
),
|
|
42566
|
+
children: "*"
|
|
42567
|
+
}
|
|
42568
|
+
) : ""
|
|
42544
42569
|
] })
|
|
42545
42570
|
}
|
|
42546
42571
|
),
|
|
@@ -42566,7 +42591,11 @@ function InputField(props) {
|
|
|
42566
42591
|
"flex items-start gap-2",
|
|
42567
42592
|
classes == null ? void 0 : classes.inlineRow
|
|
42568
42593
|
].filter(Boolean).join(" ");
|
|
42569
|
-
const
|
|
42594
|
+
const hasStackedLabelBlock = lp !== "hidden" && hasAnyLabelBlockContent;
|
|
42595
|
+
const stackedGroupClassName = [
|
|
42596
|
+
hasStackedLabelBlock && hasLabelRowContent ? "mt-1" : null,
|
|
42597
|
+
classes == null ? void 0 : classes.group
|
|
42598
|
+
].filter(Boolean).join(" ");
|
|
42570
42599
|
const Element2 = contain ? "div" : React54__namespace.Fragment;
|
|
42571
42600
|
const attrs = (a = "l") => contain ? a === "l" ? { className: "p-4 border-b border-input" } : { className: "px-4 pt-2 pb-4" } : {};
|
|
42572
42601
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -42602,7 +42631,7 @@ function InputField(props) {
|
|
|
42602
42631
|
) : (
|
|
42603
42632
|
// STACKED MODE
|
|
42604
42633
|
/* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
42605
|
-
|
|
42634
|
+
hasStackedLabelBlock && /* @__PURE__ */ jsxRuntime.jsxs(Element2, { ...attrs(), children: [
|
|
42606
42635
|
graph.getSlotsFor("label", "above").render(
|
|
42607
42636
|
(slots) => slots.map(
|
|
42608
42637
|
(slot) => renderHelperSlot(
|
|
@@ -42612,7 +42641,7 @@ function InputField(props) {
|
|
|
42612
42641
|
)
|
|
42613
42642
|
)
|
|
42614
42643
|
),
|
|
42615
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
42644
|
+
hasLabelRowContent && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
42616
42645
|
"div",
|
|
42617
42646
|
{
|
|
42618
42647
|
className: [
|
|
@@ -42639,7 +42668,16 @@ function InputField(props) {
|
|
|
42639
42668
|
children: /* @__PURE__ */ jsxRuntime.jsxs(FieldTitle, { children: [
|
|
42640
42669
|
label,
|
|
42641
42670
|
" ",
|
|
42642
|
-
required ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
42671
|
+
required ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
42672
|
+
"span",
|
|
42673
|
+
{
|
|
42674
|
+
className: cn(
|
|
42675
|
+
"text-destructive",
|
|
42676
|
+
classes == null ? void 0 : classes.required
|
|
42677
|
+
),
|
|
42678
|
+
children: "*"
|
|
42679
|
+
}
|
|
42680
|
+
) : ""
|
|
42643
42681
|
] })
|
|
42644
42682
|
}
|
|
42645
42683
|
),
|