@timeax/form-palette 0.0.5 → 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.d.mts +85 -1
- package/dist/index.d.ts +85 -1
- 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 +2 -2
package/dist/index.mjs
CHANGED
|
@@ -41884,7 +41884,7 @@ function FieldGroup({ className, ...props }) {
|
|
|
41884
41884
|
{
|
|
41885
41885
|
"data-slot": "field-group",
|
|
41886
41886
|
className: cn(
|
|
41887
|
-
"group/field-group
|
|
41887
|
+
"group/field-group flex w-full flex-col gap-7 data-[slot=checkbox-group]:gap-3 [&>[data-slot=field-group]]:gap-4",
|
|
41888
41888
|
className
|
|
41889
41889
|
),
|
|
41890
41890
|
...props
|
|
@@ -42435,6 +42435,22 @@ function InputField(props) {
|
|
|
42435
42435
|
}),
|
|
42436
42436
|
[layout, sublabel, description, helpText, visualError, tagsContent]
|
|
42437
42437
|
);
|
|
42438
|
+
const hasLabelSlotsAt = (placement) => {
|
|
42439
|
+
let found = false;
|
|
42440
|
+
graph.getSlotsFor("label", placement).render((slots) => {
|
|
42441
|
+
if (slots.length > 0) {
|
|
42442
|
+
found = true;
|
|
42443
|
+
}
|
|
42444
|
+
return null;
|
|
42445
|
+
});
|
|
42446
|
+
return found;
|
|
42447
|
+
};
|
|
42448
|
+
const hasLabelLeftSlots = hasLabelSlotsAt("left");
|
|
42449
|
+
const hasLabelRightSlots = hasLabelSlotsAt("right");
|
|
42450
|
+
const hasLabelAboveSlots = hasLabelSlotsAt("above");
|
|
42451
|
+
const hasLabelBelowSlots = hasLabelSlotsAt("below");
|
|
42452
|
+
const hasAnyLabelBlockContent = !!label || hasLabelLeftSlots || hasLabelRightSlots || hasLabelAboveSlots || hasLabelBelowSlots;
|
|
42453
|
+
const hasLabelRowContent = !!label || hasLabelLeftSlots || hasLabelRightSlots;
|
|
42438
42454
|
const inlineLabelSide = lp === "right" ? "right" : lp === "hidden" ? "hidden" : "left";
|
|
42439
42455
|
const inlineInputColClass = [
|
|
42440
42456
|
isCompactInline ? "flex-none" : "flex-1 min-w-0",
|
|
@@ -42482,7 +42498,7 @@ function InputField(props) {
|
|
|
42482
42498
|
)
|
|
42483
42499
|
)
|
|
42484
42500
|
] });
|
|
42485
|
-
const inlineLabelColumn = inlineLabelSide === "hidden" ? null : /* @__PURE__ */ jsxs(
|
|
42501
|
+
const inlineLabelColumn = inlineLabelSide === "hidden" || !hasAnyLabelBlockContent ? null : /* @__PURE__ */ jsxs(
|
|
42486
42502
|
"div",
|
|
42487
42503
|
{
|
|
42488
42504
|
className: ["flex flex-col gap-0", inlineLabelColClass].filter(Boolean).join(" "),
|
|
@@ -42492,7 +42508,7 @@ function InputField(props) {
|
|
|
42492
42508
|
(slot) => renderHelperSlot("label", slot, classes)
|
|
42493
42509
|
)
|
|
42494
42510
|
),
|
|
42495
|
-
/* @__PURE__ */ jsxs(
|
|
42511
|
+
hasLabelRowContent && /* @__PURE__ */ jsxs(
|
|
42496
42512
|
"div",
|
|
42497
42513
|
{
|
|
42498
42514
|
className: [
|
|
@@ -42519,7 +42535,16 @@ function InputField(props) {
|
|
|
42519
42535
|
children: /* @__PURE__ */ jsxs(FieldTitle, { children: [
|
|
42520
42536
|
label,
|
|
42521
42537
|
" ",
|
|
42522
|
-
required ? /* @__PURE__ */ jsx(
|
|
42538
|
+
required ? /* @__PURE__ */ jsx(
|
|
42539
|
+
"span",
|
|
42540
|
+
{
|
|
42541
|
+
className: cn(
|
|
42542
|
+
"text-destructive",
|
|
42543
|
+
classes == null ? void 0 : classes.required
|
|
42544
|
+
),
|
|
42545
|
+
children: "*"
|
|
42546
|
+
}
|
|
42547
|
+
) : ""
|
|
42523
42548
|
] })
|
|
42524
42549
|
}
|
|
42525
42550
|
),
|
|
@@ -42545,7 +42570,11 @@ function InputField(props) {
|
|
|
42545
42570
|
"flex items-start gap-2",
|
|
42546
42571
|
classes == null ? void 0 : classes.inlineRow
|
|
42547
42572
|
].filter(Boolean).join(" ");
|
|
42548
|
-
const
|
|
42573
|
+
const hasStackedLabelBlock = lp !== "hidden" && hasAnyLabelBlockContent;
|
|
42574
|
+
const stackedGroupClassName = [
|
|
42575
|
+
hasStackedLabelBlock && hasLabelRowContent ? "mt-1" : null,
|
|
42576
|
+
classes == null ? void 0 : classes.group
|
|
42577
|
+
].filter(Boolean).join(" ");
|
|
42549
42578
|
const Element2 = contain ? "div" : React54.Fragment;
|
|
42550
42579
|
const attrs = (a = "l") => contain ? a === "l" ? { className: "p-4 border-b border-input" } : { className: "px-4 pt-2 pb-4" } : {};
|
|
42551
42580
|
return /* @__PURE__ */ jsx(
|
|
@@ -42581,7 +42610,7 @@ function InputField(props) {
|
|
|
42581
42610
|
) : (
|
|
42582
42611
|
// STACKED MODE
|
|
42583
42612
|
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
42584
|
-
|
|
42613
|
+
hasStackedLabelBlock && /* @__PURE__ */ jsxs(Element2, { ...attrs(), children: [
|
|
42585
42614
|
graph.getSlotsFor("label", "above").render(
|
|
42586
42615
|
(slots) => slots.map(
|
|
42587
42616
|
(slot) => renderHelperSlot(
|
|
@@ -42591,7 +42620,7 @@ function InputField(props) {
|
|
|
42591
42620
|
)
|
|
42592
42621
|
)
|
|
42593
42622
|
),
|
|
42594
|
-
/* @__PURE__ */ jsxs(
|
|
42623
|
+
hasLabelRowContent && /* @__PURE__ */ jsxs(
|
|
42595
42624
|
"div",
|
|
42596
42625
|
{
|
|
42597
42626
|
className: [
|
|
@@ -42618,7 +42647,16 @@ function InputField(props) {
|
|
|
42618
42647
|
children: /* @__PURE__ */ jsxs(FieldTitle, { children: [
|
|
42619
42648
|
label,
|
|
42620
42649
|
" ",
|
|
42621
|
-
required ? /* @__PURE__ */ jsx(
|
|
42650
|
+
required ? /* @__PURE__ */ jsx(
|
|
42651
|
+
"span",
|
|
42652
|
+
{
|
|
42653
|
+
className: cn(
|
|
42654
|
+
"text-destructive",
|
|
42655
|
+
classes == null ? void 0 : classes.required
|
|
42656
|
+
),
|
|
42657
|
+
children: "*"
|
|
42658
|
+
}
|
|
42659
|
+
) : ""
|
|
42622
42660
|
] })
|
|
42623
42661
|
}
|
|
42624
42662
|
),
|