@timeax/form-palette 0.0.18 → 0.0.19
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 +21 -50
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -50
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -36647,11 +36647,9 @@ var checkboxModule = {
|
|
|
36647
36647
|
tags: ["checkbox", "group", "boolean", "tri-state"]
|
|
36648
36648
|
}
|
|
36649
36649
|
};
|
|
36650
|
-
|
|
36651
|
-
|
|
36652
|
-
|
|
36653
|
-
}
|
|
36654
|
-
function normalizeOptions(opts, config3) {
|
|
36650
|
+
|
|
36651
|
+
// src/lib/normalise-selects.ts
|
|
36652
|
+
function globalNormalizeOptions(opts, config3) {
|
|
36655
36653
|
if (!opts || !opts.length) return [];
|
|
36656
36654
|
return opts.map((raw, index2) => {
|
|
36657
36655
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
@@ -36678,6 +36676,13 @@ function normalizeOptions(opts, config3) {
|
|
|
36678
36676
|
};
|
|
36679
36677
|
});
|
|
36680
36678
|
}
|
|
36679
|
+
function capitalizeFirst3(label) {
|
|
36680
|
+
if (!label) return label;
|
|
36681
|
+
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
36682
|
+
}
|
|
36683
|
+
function normalizeOptions(opts, config3) {
|
|
36684
|
+
return globalNormalizeOptions(opts, config3);
|
|
36685
|
+
}
|
|
36681
36686
|
function triggerHeight(size4) {
|
|
36682
36687
|
switch (size4) {
|
|
36683
36688
|
case "sm":
|
|
@@ -37299,36 +37304,8 @@ function removeSelectValue(current, valueToRemove) {
|
|
|
37299
37304
|
const target = String(valueToRemove);
|
|
37300
37305
|
return current.filter((v) => String(v) !== target);
|
|
37301
37306
|
}
|
|
37302
|
-
function capitalizeFirst4(label) {
|
|
37303
|
-
if (!label) return label;
|
|
37304
|
-
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
37305
|
-
}
|
|
37306
37307
|
function normalizeOptions2(opts, config3) {
|
|
37307
|
-
|
|
37308
|
-
return opts.map((raw, index2) => {
|
|
37309
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
37310
|
-
const asObj = typeof raw === "string" || typeof raw === "number" ? { label: String(raw), value: raw } : raw;
|
|
37311
|
-
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);
|
|
37312
|
-
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);
|
|
37313
|
-
if (config3.autoCap && typeof labelNode === "string") {
|
|
37314
|
-
labelNode = capitalizeFirst4(labelNode);
|
|
37315
|
-
}
|
|
37316
|
-
const labelText = typeof labelNode === "string" ? labelNode : typeof labelNode === "number" ? String(labelNode) : (_g = asObj.labelText) != null ? _g : String(value);
|
|
37317
|
-
const description = typeof config3.optionDescription === "function" ? config3.optionDescription(raw) : typeof config3.optionDescription === "string" ? asObj[config3.optionDescription] : asObj.description;
|
|
37318
|
-
const disabled = typeof config3.optionDisabled === "function" ? config3.optionDisabled(raw) : typeof config3.optionDisabled === "string" ? !!asObj[config3.optionDisabled] : !!asObj.disabled;
|
|
37319
|
-
const icon = typeof config3.optionIcon === "function" ? config3.optionIcon(raw) : typeof config3.optionIcon === "string" ? asObj[config3.optionIcon] : asObj.icon;
|
|
37320
|
-
const key = typeof config3.optionKey === "function" ? config3.optionKey(raw, index2) : typeof config3.optionKey === "string" ? (_i = (_h = asObj[config3.optionKey]) != null ? _h : value) != null ? _i : index2 : (_k = (_j = asObj.key) != null ? _j : value) != null ? _k : index2;
|
|
37321
|
-
return {
|
|
37322
|
-
key: String(key),
|
|
37323
|
-
value,
|
|
37324
|
-
labelNode,
|
|
37325
|
-
labelText,
|
|
37326
|
-
description,
|
|
37327
|
-
disabled,
|
|
37328
|
-
icon,
|
|
37329
|
-
raw
|
|
37330
|
-
};
|
|
37331
|
-
});
|
|
37308
|
+
return globalNormalizeOptions(opts, config3);
|
|
37332
37309
|
}
|
|
37333
37310
|
function triggerHeight2(size4) {
|
|
37334
37311
|
switch (size4) {
|
|
@@ -37432,9 +37409,7 @@ var ShadcnMultiSelectVariant = React54.forwardRef(function ShadcnMultiSelectVari
|
|
|
37432
37409
|
const filteredItems = React54.useMemo(() => {
|
|
37433
37410
|
if (!query) return items;
|
|
37434
37411
|
const q = query.toLowerCase();
|
|
37435
|
-
return items.filter(
|
|
37436
|
-
(it) => it.labelText.toLowerCase().includes(q)
|
|
37437
|
-
);
|
|
37412
|
+
return items.filter((it) => it.labelText.toLowerCase().includes(q));
|
|
37438
37413
|
}, [items, query]);
|
|
37439
37414
|
const selectableItems = React54.useMemo(
|
|
37440
37415
|
() => items.filter((it) => !it.disabled),
|
|
@@ -37587,7 +37562,7 @@ var ShadcnMultiSelectVariant = React54.forwardRef(function ShadcnMultiSelectVari
|
|
|
37587
37562
|
type: "button",
|
|
37588
37563
|
disabled: disabledTrigger,
|
|
37589
37564
|
className: cn(
|
|
37590
|
-
"flex w-full items-center justify-between rounded-md border border-input bg-
|
|
37565
|
+
"flex w-full items-center justify-between rounded-md border border-input bg-surfaces-input px-3 text-left shadow-xs",
|
|
37591
37566
|
"focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:border-ring",
|
|
37592
37567
|
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
37593
37568
|
heightCls,
|
|
@@ -37712,9 +37687,7 @@ var ShadcnMultiSelectVariant = React54.forwardRef(function ShadcnMultiSelectVari
|
|
|
37712
37687
|
}
|
|
37713
37688
|
),
|
|
37714
37689
|
filteredItems.length === 0 ? /* @__PURE__ */ jsx("div", { className: "px-2 py-1.5 text-xs text-muted-foreground", children: emptySearchText != null ? emptySearchText : "No results found" }) : filteredItems.map((item, index2) => {
|
|
37715
|
-
const selected = selectedValues.has(
|
|
37716
|
-
item.value
|
|
37717
|
-
);
|
|
37690
|
+
const selected = selectedValues.has(item.value);
|
|
37718
37691
|
const row = /* @__PURE__ */ jsxs(
|
|
37719
37692
|
"button",
|
|
37720
37693
|
{
|
|
@@ -37845,9 +37818,7 @@ var ShadcnMultiSelectVariant = React54.forwardRef(function ShadcnMultiSelectVari
|
|
|
37845
37818
|
/* @__PURE__ */ jsx(
|
|
37846
37819
|
"div",
|
|
37847
37820
|
{
|
|
37848
|
-
className: cn(
|
|
37849
|
-
"flex-1 min-w-0 flex items-stretch"
|
|
37850
|
-
),
|
|
37821
|
+
className: cn("flex-1 min-w-0 flex items-stretch"),
|
|
37851
37822
|
"data-slot": "select-region",
|
|
37852
37823
|
children: MultiSelectCore
|
|
37853
37824
|
}
|
|
@@ -40076,7 +40047,7 @@ function Badge({
|
|
|
40076
40047
|
}
|
|
40077
40048
|
);
|
|
40078
40049
|
}
|
|
40079
|
-
function
|
|
40050
|
+
function capitalizeFirst4(label) {
|
|
40080
40051
|
if (!label) return label;
|
|
40081
40052
|
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
40082
40053
|
}
|
|
@@ -40088,7 +40059,7 @@ function normalizeTree(opts, config3, level = 0, parentValue, path = []) {
|
|
|
40088
40059
|
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);
|
|
40089
40060
|
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);
|
|
40090
40061
|
if (config3.autoCap && typeof labelNode === "string") {
|
|
40091
|
-
labelNode =
|
|
40062
|
+
labelNode = capitalizeFirst4(labelNode);
|
|
40092
40063
|
}
|
|
40093
40064
|
const labelText = typeof labelNode === "string" ? labelNode : typeof labelNode === "number" ? String(labelNode) : (_g = asObj.labelText) != null ? _g : String(value);
|
|
40094
40065
|
const description = typeof config3.optionDescription === "function" ? config3.optionDescription(raw) : typeof config3.optionDescription === "string" ? asObj[config3.optionDescription] : asObj.description;
|
|
@@ -43142,7 +43113,7 @@ function normalizeValue(val, multiple) {
|
|
|
43142
43113
|
if (Array.isArray(val)) return val[0] || "";
|
|
43143
43114
|
return val || "";
|
|
43144
43115
|
}
|
|
43145
|
-
function
|
|
43116
|
+
function capitalizeFirst5(label) {
|
|
43146
43117
|
if (!label) return label;
|
|
43147
43118
|
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
43148
43119
|
}
|
|
@@ -43168,7 +43139,7 @@ function normalizeOption(input, {
|
|
|
43168
43139
|
label2 = String(rawValue != null ? rawValue : value2);
|
|
43169
43140
|
}
|
|
43170
43141
|
if (autoCap && typeof label2 === "string") {
|
|
43171
|
-
label2 =
|
|
43142
|
+
label2 = capitalizeFirst5(label2);
|
|
43172
43143
|
}
|
|
43173
43144
|
const icon = optionIcon != null ? anyInput[optionIcon] : (_b = anyInput.icon) != null ? _b : void 0;
|
|
43174
43145
|
const disabled = optionDisabled != null ? !!anyInput[optionDisabled] : !!anyInput.disabled;
|
|
@@ -43190,7 +43161,7 @@ function normalizeOption(input, {
|
|
|
43190
43161
|
const value2 = String(input);
|
|
43191
43162
|
let label2 = value2;
|
|
43192
43163
|
if (autoCap && typeof label2 === "string") {
|
|
43193
|
-
label2 =
|
|
43164
|
+
label2 = capitalizeFirst5(label2);
|
|
43194
43165
|
}
|
|
43195
43166
|
return {
|
|
43196
43167
|
ui: {
|
|
@@ -43204,7 +43175,7 @@ function normalizeOption(input, {
|
|
|
43204
43175
|
const value = String(baseValue);
|
|
43205
43176
|
let label = anyInput.label != null ? anyInput.label : String(value);
|
|
43206
43177
|
if (autoCap && typeof label === "string") {
|
|
43207
|
-
label =
|
|
43178
|
+
label = capitalizeFirst5(label);
|
|
43208
43179
|
}
|
|
43209
43180
|
return {
|
|
43210
43181
|
ui: {
|