@timeax/form-palette 0.0.13 → 0.0.14
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 +11 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +68 -16
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -35439,6 +35439,10 @@ function descriptionTextSize(size4) {
|
|
|
35439
35439
|
return "text-xs";
|
|
35440
35440
|
}
|
|
35441
35441
|
}
|
|
35442
|
+
function capitalizeFirst(label) {
|
|
35443
|
+
if (!label) return label;
|
|
35444
|
+
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
35445
|
+
}
|
|
35442
35446
|
function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
|
|
35443
35447
|
if (mappers) {
|
|
35444
35448
|
return items.map((item, index2) => ({
|
|
@@ -35468,7 +35472,19 @@ function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
|
|
|
35468
35472
|
};
|
|
35469
35473
|
});
|
|
35470
35474
|
}
|
|
35471
|
-
return items
|
|
35475
|
+
return items.map((item, index2) => {
|
|
35476
|
+
if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") {
|
|
35477
|
+
const v = item;
|
|
35478
|
+
return {
|
|
35479
|
+
value: v,
|
|
35480
|
+
label: String(item),
|
|
35481
|
+
description: void 0,
|
|
35482
|
+
disabled: false,
|
|
35483
|
+
key: index2
|
|
35484
|
+
};
|
|
35485
|
+
}
|
|
35486
|
+
return item;
|
|
35487
|
+
});
|
|
35472
35488
|
}
|
|
35473
35489
|
function isEqualValue(a, b) {
|
|
35474
35490
|
return Object.is(a, b);
|
|
@@ -35492,6 +35508,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
35492
35508
|
itemGapPx,
|
|
35493
35509
|
size: size4 = "md",
|
|
35494
35510
|
density = "comfortable",
|
|
35511
|
+
autoCap = false,
|
|
35495
35512
|
"aria-label": ariaLabel,
|
|
35496
35513
|
"aria-labelledby": ariaLabelledBy,
|
|
35497
35514
|
"aria-describedby": ariaDescribedBy,
|
|
@@ -35611,6 +35628,13 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
35611
35628
|
const optionDisabled = !!disabled || !!item.disabled;
|
|
35612
35629
|
const optionKey = (_a = item.key) != null ? _a : index2;
|
|
35613
35630
|
const optionId = id ? `${id}-option-${optionKey}` : void 0;
|
|
35631
|
+
let displayItem = item;
|
|
35632
|
+
if (autoCap && typeof item.label === "string") {
|
|
35633
|
+
displayItem = {
|
|
35634
|
+
...item,
|
|
35635
|
+
label: capitalizeFirst(item.label)
|
|
35636
|
+
};
|
|
35637
|
+
}
|
|
35614
35638
|
const radioNode = /* @__PURE__ */ jsx(
|
|
35615
35639
|
RadioGroupItem2,
|
|
35616
35640
|
{
|
|
@@ -35629,7 +35653,7 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
35629
35653
|
"data-disabled": optionDisabled ? "true" : "false",
|
|
35630
35654
|
className: baseOptionClass,
|
|
35631
35655
|
children: renderOption({
|
|
35632
|
-
item,
|
|
35656
|
+
item: displayItem,
|
|
35633
35657
|
index: index2,
|
|
35634
35658
|
selected,
|
|
35635
35659
|
disabled: optionDisabled,
|
|
@@ -35657,8 +35681,8 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
35657
35681
|
children: [
|
|
35658
35682
|
radioNode,
|
|
35659
35683
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col min-w-0", children: [
|
|
35660
|
-
/* @__PURE__ */ jsx("span", { className: labelClassesBase, children:
|
|
35661
|
-
|
|
35684
|
+
/* @__PURE__ */ jsx("span", { className: labelClassesBase, children: displayItem.label }),
|
|
35685
|
+
displayItem.description != null && /* @__PURE__ */ jsx("span", { className: descriptionClassesBase, children: displayItem.description })
|
|
35662
35686
|
] })
|
|
35663
35687
|
]
|
|
35664
35688
|
}
|
|
@@ -36154,6 +36178,10 @@ function descriptionTextSize2(size4) {
|
|
|
36154
36178
|
return "text-xs";
|
|
36155
36179
|
}
|
|
36156
36180
|
}
|
|
36181
|
+
function capitalizeFirst2(label) {
|
|
36182
|
+
if (!label) return label;
|
|
36183
|
+
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
36184
|
+
}
|
|
36157
36185
|
function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
|
|
36158
36186
|
if (!items || !items.length) return [];
|
|
36159
36187
|
if (mappers) {
|
|
@@ -36187,7 +36215,20 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
|
|
|
36187
36215
|
};
|
|
36188
36216
|
});
|
|
36189
36217
|
}
|
|
36190
|
-
return items
|
|
36218
|
+
return items.map((item, index2) => {
|
|
36219
|
+
if (typeof item === "string" || typeof item === "number" || typeof item === "boolean") {
|
|
36220
|
+
const v = item;
|
|
36221
|
+
return {
|
|
36222
|
+
value: v,
|
|
36223
|
+
label: String(item),
|
|
36224
|
+
description: void 0,
|
|
36225
|
+
disabled: false,
|
|
36226
|
+
key: index2,
|
|
36227
|
+
tristate: void 0
|
|
36228
|
+
};
|
|
36229
|
+
}
|
|
36230
|
+
return item;
|
|
36231
|
+
});
|
|
36191
36232
|
}
|
|
36192
36233
|
function isEqualValue2(a, b) {
|
|
36193
36234
|
return Object.is(a, b);
|
|
@@ -36223,6 +36264,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
36223
36264
|
itemGapPx,
|
|
36224
36265
|
size: size4 = "md",
|
|
36225
36266
|
density = "comfortable",
|
|
36267
|
+
autoCap = false,
|
|
36226
36268
|
"aria-label": ariaLabel,
|
|
36227
36269
|
"aria-labelledby": ariaLabelledBy,
|
|
36228
36270
|
"aria-describedby": ariaDescribedBy,
|
|
@@ -36260,7 +36302,10 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
36260
36302
|
};
|
|
36261
36303
|
onValue(nextPublic, detail);
|
|
36262
36304
|
};
|
|
36263
|
-
|
|
36305
|
+
let labelText = singleLabel != null ? singleLabel : void 0;
|
|
36306
|
+
if (autoCap && typeof labelText === "string") {
|
|
36307
|
+
labelText = capitalizeFirst2(labelText);
|
|
36308
|
+
}
|
|
36264
36309
|
const descriptionText = singleDescription != null ? singleDescription : void 0;
|
|
36265
36310
|
const labelCls = cn(
|
|
36266
36311
|
"text-foreground",
|
|
@@ -36458,6 +36503,13 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
36458
36503
|
const optionDisabled = !!disabled || !!item.disabled;
|
|
36459
36504
|
const optionKey = (_c = item.key) != null ? _c : index2;
|
|
36460
36505
|
const checkboxId = id ? `${id}-option-${optionKey}` : void 0;
|
|
36506
|
+
let displayItem = item;
|
|
36507
|
+
if (autoCap && typeof item.label === "string") {
|
|
36508
|
+
displayItem = {
|
|
36509
|
+
...item,
|
|
36510
|
+
label: capitalizeFirst2(item.label)
|
|
36511
|
+
};
|
|
36512
|
+
}
|
|
36461
36513
|
const checkboxNode = /* @__PURE__ */ jsx(
|
|
36462
36514
|
Checkbox2,
|
|
36463
36515
|
{
|
|
@@ -36491,7 +36543,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
36491
36543
|
className: baseOptionClass,
|
|
36492
36544
|
children: [
|
|
36493
36545
|
renderOption({
|
|
36494
|
-
item,
|
|
36546
|
+
item: displayItem,
|
|
36495
36547
|
index: index2,
|
|
36496
36548
|
state: internalState,
|
|
36497
36549
|
effectiveTristate,
|
|
@@ -36522,12 +36574,12 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
36522
36574
|
children: [
|
|
36523
36575
|
checkboxNode,
|
|
36524
36576
|
/* @__PURE__ */ jsxs("div", { className: "flex min-w-0 flex-col", children: [
|
|
36525
|
-
/* @__PURE__ */ jsx("span", { className: labelClassesBase, children:
|
|
36526
|
-
|
|
36577
|
+
/* @__PURE__ */ jsx("span", { className: labelClassesBase, children: displayItem.label }),
|
|
36578
|
+
displayItem.description != null && /* @__PURE__ */ jsx(
|
|
36527
36579
|
"span",
|
|
36528
36580
|
{
|
|
36529
36581
|
className: descriptionClassesBase,
|
|
36530
|
-
children:
|
|
36582
|
+
children: displayItem.description
|
|
36531
36583
|
}
|
|
36532
36584
|
)
|
|
36533
36585
|
] })
|
|
@@ -36564,7 +36616,7 @@ var checkboxModule = {
|
|
|
36564
36616
|
tags: ["checkbox", "group", "boolean", "tri-state"]
|
|
36565
36617
|
}
|
|
36566
36618
|
};
|
|
36567
|
-
function
|
|
36619
|
+
function capitalizeFirst3(label) {
|
|
36568
36620
|
if (!label) return label;
|
|
36569
36621
|
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
36570
36622
|
}
|
|
@@ -36576,7 +36628,7 @@ function normalizeOptions(opts, config3) {
|
|
|
36576
36628
|
const value = typeof config3.optionValue === "function" ? config3.optionValue(raw) : typeof config3.optionValue === "string" ? asObj[config3.optionValue] : (_c = (_b = (_a = asObj.value) != null ? _a : asObj.id) != null ? _b : asObj.key) != null ? _c : String(index2);
|
|
36577
36629
|
let labelNode = typeof config3.optionLabel === "function" ? config3.optionLabel(raw) : typeof config3.optionLabel === "string" ? (_e = (_d = asObj[config3.optionLabel]) != null ? _d : asObj.label) != null ? _e : String(value) : (_f = asObj.label) != null ? _f : String(value);
|
|
36578
36630
|
if (config3.autoCap && typeof labelNode === "string") {
|
|
36579
|
-
labelNode =
|
|
36631
|
+
labelNode = capitalizeFirst3(labelNode);
|
|
36580
36632
|
}
|
|
36581
36633
|
const labelText = typeof labelNode === "string" ? labelNode : typeof labelNode === "number" ? String(labelNode) : (_g = asObj.labelText) != null ? _g : String(value);
|
|
36582
36634
|
const description = typeof config3.optionDescription === "function" ? config3.optionDescription(raw) : typeof config3.optionDescription === "string" ? asObj[config3.optionDescription] : asObj.description;
|
|
@@ -37210,7 +37262,7 @@ function removeSelectValue(current, valueToRemove) {
|
|
|
37210
37262
|
const target = String(valueToRemove);
|
|
37211
37263
|
return current.filter((v) => String(v) !== target);
|
|
37212
37264
|
}
|
|
37213
|
-
function
|
|
37265
|
+
function capitalizeFirst4(label) {
|
|
37214
37266
|
if (!label) return label;
|
|
37215
37267
|
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
37216
37268
|
}
|
|
@@ -37222,7 +37274,7 @@ function normalizeOptions2(opts, config3) {
|
|
|
37222
37274
|
const value = typeof config3.optionValue === "function" ? config3.optionValue(raw) : typeof config3.optionValue === "string" ? asObj[config3.optionValue] : (_c = (_b = (_a = asObj.value) != null ? _a : asObj.id) != null ? _b : asObj.key) != null ? _c : String(index2);
|
|
37223
37275
|
let labelNode = typeof config3.optionLabel === "function" ? config3.optionLabel(raw) : typeof config3.optionLabel === "string" ? (_e = (_d = asObj[config3.optionLabel]) != null ? _d : asObj.label) != null ? _e : String(value) : (_f = asObj.label) != null ? _f : String(value);
|
|
37224
37276
|
if (config3.autoCap && typeof labelNode === "string") {
|
|
37225
|
-
labelNode =
|
|
37277
|
+
labelNode = capitalizeFirst4(labelNode);
|
|
37226
37278
|
}
|
|
37227
37279
|
const labelText = typeof labelNode === "string" ? labelNode : typeof labelNode === "number" ? String(labelNode) : (_g = asObj.labelText) != null ? _g : String(value);
|
|
37228
37280
|
const description = typeof config3.optionDescription === "function" ? config3.optionDescription(raw) : typeof config3.optionDescription === "string" ? asObj[config3.optionDescription] : asObj.description;
|
|
@@ -39983,7 +40035,7 @@ function Badge({
|
|
|
39983
40035
|
}
|
|
39984
40036
|
);
|
|
39985
40037
|
}
|
|
39986
|
-
function
|
|
40038
|
+
function capitalizeFirst5(label) {
|
|
39987
40039
|
if (!label) return label;
|
|
39988
40040
|
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
39989
40041
|
}
|
|
@@ -39995,7 +40047,7 @@ function normalizeTree(opts, config3, level = 0, parentValue, path = []) {
|
|
|
39995
40047
|
const value = typeof config3.optionValue === "function" ? config3.optionValue(raw) : typeof config3.optionValue === "string" ? asObj[config3.optionValue] : (_c = (_b = (_a = asObj.value) != null ? _a : asObj.id) != null ? _b : asObj.key) != null ? _c : String(index2);
|
|
39996
40048
|
let labelNode = typeof config3.optionLabel === "function" ? config3.optionLabel(raw) : typeof config3.optionLabel === "string" ? (_e = (_d = asObj[config3.optionLabel]) != null ? _d : asObj.label) != null ? _e : String(value) : (_f = asObj.label) != null ? _f : String(value);
|
|
39997
40049
|
if (config3.autoCap && typeof labelNode === "string") {
|
|
39998
|
-
labelNode =
|
|
40050
|
+
labelNode = capitalizeFirst5(labelNode);
|
|
39999
40051
|
}
|
|
40000
40052
|
const labelText = typeof labelNode === "string" ? labelNode : typeof labelNode === "number" ? String(labelNode) : (_g = asObj.labelText) != null ? _g : String(value);
|
|
40001
40053
|
const description = typeof config3.optionDescription === "function" ? config3.optionDescription(raw) : typeof config3.optionDescription === "string" ? asObj[config3.optionDescription] : asObj.description;
|