@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.js
CHANGED
|
@@ -36668,11 +36668,9 @@ var checkboxModule = {
|
|
|
36668
36668
|
tags: ["checkbox", "group", "boolean", "tri-state"]
|
|
36669
36669
|
}
|
|
36670
36670
|
};
|
|
36671
|
-
|
|
36672
|
-
|
|
36673
|
-
|
|
36674
|
-
}
|
|
36675
|
-
function normalizeOptions(opts, config3) {
|
|
36671
|
+
|
|
36672
|
+
// src/lib/normalise-selects.ts
|
|
36673
|
+
function globalNormalizeOptions(opts, config3) {
|
|
36676
36674
|
if (!opts || !opts.length) return [];
|
|
36677
36675
|
return opts.map((raw, index2) => {
|
|
36678
36676
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
@@ -36699,6 +36697,13 @@ function normalizeOptions(opts, config3) {
|
|
|
36699
36697
|
};
|
|
36700
36698
|
});
|
|
36701
36699
|
}
|
|
36700
|
+
function capitalizeFirst3(label) {
|
|
36701
|
+
if (!label) return label;
|
|
36702
|
+
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
36703
|
+
}
|
|
36704
|
+
function normalizeOptions(opts, config3) {
|
|
36705
|
+
return globalNormalizeOptions(opts, config3);
|
|
36706
|
+
}
|
|
36702
36707
|
function triggerHeight(size4) {
|
|
36703
36708
|
switch (size4) {
|
|
36704
36709
|
case "sm":
|
|
@@ -37320,36 +37325,8 @@ function removeSelectValue(current, valueToRemove) {
|
|
|
37320
37325
|
const target = String(valueToRemove);
|
|
37321
37326
|
return current.filter((v) => String(v) !== target);
|
|
37322
37327
|
}
|
|
37323
|
-
function capitalizeFirst4(label) {
|
|
37324
|
-
if (!label) return label;
|
|
37325
|
-
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
37326
|
-
}
|
|
37327
37328
|
function normalizeOptions2(opts, config3) {
|
|
37328
|
-
|
|
37329
|
-
return opts.map((raw, index2) => {
|
|
37330
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
37331
|
-
const asObj = typeof raw === "string" || typeof raw === "number" ? { label: String(raw), value: raw } : raw;
|
|
37332
|
-
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);
|
|
37333
|
-
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);
|
|
37334
|
-
if (config3.autoCap && typeof labelNode === "string") {
|
|
37335
|
-
labelNode = capitalizeFirst4(labelNode);
|
|
37336
|
-
}
|
|
37337
|
-
const labelText = typeof labelNode === "string" ? labelNode : typeof labelNode === "number" ? String(labelNode) : (_g = asObj.labelText) != null ? _g : String(value);
|
|
37338
|
-
const description = typeof config3.optionDescription === "function" ? config3.optionDescription(raw) : typeof config3.optionDescription === "string" ? asObj[config3.optionDescription] : asObj.description;
|
|
37339
|
-
const disabled = typeof config3.optionDisabled === "function" ? config3.optionDisabled(raw) : typeof config3.optionDisabled === "string" ? !!asObj[config3.optionDisabled] : !!asObj.disabled;
|
|
37340
|
-
const icon = typeof config3.optionIcon === "function" ? config3.optionIcon(raw) : typeof config3.optionIcon === "string" ? asObj[config3.optionIcon] : asObj.icon;
|
|
37341
|
-
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;
|
|
37342
|
-
return {
|
|
37343
|
-
key: String(key),
|
|
37344
|
-
value,
|
|
37345
|
-
labelNode,
|
|
37346
|
-
labelText,
|
|
37347
|
-
description,
|
|
37348
|
-
disabled,
|
|
37349
|
-
icon,
|
|
37350
|
-
raw
|
|
37351
|
-
};
|
|
37352
|
-
});
|
|
37329
|
+
return globalNormalizeOptions(opts, config3);
|
|
37353
37330
|
}
|
|
37354
37331
|
function triggerHeight2(size4) {
|
|
37355
37332
|
switch (size4) {
|
|
@@ -37453,9 +37430,7 @@ var ShadcnMultiSelectVariant = React54__namespace.forwardRef(function ShadcnMult
|
|
|
37453
37430
|
const filteredItems = React54__namespace.useMemo(() => {
|
|
37454
37431
|
if (!query) return items;
|
|
37455
37432
|
const q = query.toLowerCase();
|
|
37456
|
-
return items.filter(
|
|
37457
|
-
(it) => it.labelText.toLowerCase().includes(q)
|
|
37458
|
-
);
|
|
37433
|
+
return items.filter((it) => it.labelText.toLowerCase().includes(q));
|
|
37459
37434
|
}, [items, query]);
|
|
37460
37435
|
const selectableItems = React54__namespace.useMemo(
|
|
37461
37436
|
() => items.filter((it) => !it.disabled),
|
|
@@ -37608,7 +37583,7 @@ var ShadcnMultiSelectVariant = React54__namespace.forwardRef(function ShadcnMult
|
|
|
37608
37583
|
type: "button",
|
|
37609
37584
|
disabled: disabledTrigger,
|
|
37610
37585
|
className: cn(
|
|
37611
|
-
"flex w-full items-center justify-between rounded-md border border-input bg-
|
|
37586
|
+
"flex w-full items-center justify-between rounded-md border border-input bg-surfaces-input px-3 text-left shadow-xs",
|
|
37612
37587
|
"focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:border-ring",
|
|
37613
37588
|
"aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
|
|
37614
37589
|
heightCls,
|
|
@@ -37733,9 +37708,7 @@ var ShadcnMultiSelectVariant = React54__namespace.forwardRef(function ShadcnMult
|
|
|
37733
37708
|
}
|
|
37734
37709
|
),
|
|
37735
37710
|
filteredItems.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-2 py-1.5 text-xs text-muted-foreground", children: emptySearchText != null ? emptySearchText : "No results found" }) : filteredItems.map((item, index2) => {
|
|
37736
|
-
const selected = selectedValues.has(
|
|
37737
|
-
item.value
|
|
37738
|
-
);
|
|
37711
|
+
const selected = selectedValues.has(item.value);
|
|
37739
37712
|
const row = /* @__PURE__ */ jsxRuntime.jsxs(
|
|
37740
37713
|
"button",
|
|
37741
37714
|
{
|
|
@@ -37866,9 +37839,7 @@ var ShadcnMultiSelectVariant = React54__namespace.forwardRef(function ShadcnMult
|
|
|
37866
37839
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
37867
37840
|
"div",
|
|
37868
37841
|
{
|
|
37869
|
-
className: cn(
|
|
37870
|
-
"flex-1 min-w-0 flex items-stretch"
|
|
37871
|
-
),
|
|
37842
|
+
className: cn("flex-1 min-w-0 flex items-stretch"),
|
|
37872
37843
|
"data-slot": "select-region",
|
|
37873
37844
|
children: MultiSelectCore
|
|
37874
37845
|
}
|
|
@@ -40097,7 +40068,7 @@ function Badge({
|
|
|
40097
40068
|
}
|
|
40098
40069
|
);
|
|
40099
40070
|
}
|
|
40100
|
-
function
|
|
40071
|
+
function capitalizeFirst4(label) {
|
|
40101
40072
|
if (!label) return label;
|
|
40102
40073
|
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
40103
40074
|
}
|
|
@@ -40109,7 +40080,7 @@ function normalizeTree(opts, config3, level = 0, parentValue, path = []) {
|
|
|
40109
40080
|
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);
|
|
40110
40081
|
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);
|
|
40111
40082
|
if (config3.autoCap && typeof labelNode === "string") {
|
|
40112
|
-
labelNode =
|
|
40083
|
+
labelNode = capitalizeFirst4(labelNode);
|
|
40113
40084
|
}
|
|
40114
40085
|
const labelText = typeof labelNode === "string" ? labelNode : typeof labelNode === "number" ? String(labelNode) : (_g = asObj.labelText) != null ? _g : String(value);
|
|
40115
40086
|
const description = typeof config3.optionDescription === "function" ? config3.optionDescription(raw) : typeof config3.optionDescription === "string" ? asObj[config3.optionDescription] : asObj.description;
|
|
@@ -43163,7 +43134,7 @@ function normalizeValue(val, multiple) {
|
|
|
43163
43134
|
if (Array.isArray(val)) return val[0] || "";
|
|
43164
43135
|
return val || "";
|
|
43165
43136
|
}
|
|
43166
|
-
function
|
|
43137
|
+
function capitalizeFirst5(label) {
|
|
43167
43138
|
if (!label) return label;
|
|
43168
43139
|
return label.charAt(0).toUpperCase() + label.slice(1);
|
|
43169
43140
|
}
|
|
@@ -43189,7 +43160,7 @@ function normalizeOption(input, {
|
|
|
43189
43160
|
label2 = String(rawValue != null ? rawValue : value2);
|
|
43190
43161
|
}
|
|
43191
43162
|
if (autoCap && typeof label2 === "string") {
|
|
43192
|
-
label2 =
|
|
43163
|
+
label2 = capitalizeFirst5(label2);
|
|
43193
43164
|
}
|
|
43194
43165
|
const icon = optionIcon != null ? anyInput[optionIcon] : (_b = anyInput.icon) != null ? _b : void 0;
|
|
43195
43166
|
const disabled = optionDisabled != null ? !!anyInput[optionDisabled] : !!anyInput.disabled;
|
|
@@ -43211,7 +43182,7 @@ function normalizeOption(input, {
|
|
|
43211
43182
|
const value2 = String(input);
|
|
43212
43183
|
let label2 = value2;
|
|
43213
43184
|
if (autoCap && typeof label2 === "string") {
|
|
43214
|
-
label2 =
|
|
43185
|
+
label2 = capitalizeFirst5(label2);
|
|
43215
43186
|
}
|
|
43216
43187
|
return {
|
|
43217
43188
|
ui: {
|
|
@@ -43225,7 +43196,7 @@ function normalizeOption(input, {
|
|
|
43225
43196
|
const value = String(baseValue);
|
|
43226
43197
|
let label = anyInput.label != null ? anyInput.label : String(value);
|
|
43227
43198
|
if (autoCap && typeof label === "string") {
|
|
43228
|
-
label =
|
|
43199
|
+
label = capitalizeFirst5(label);
|
|
43229
43200
|
}
|
|
43230
43201
|
return {
|
|
43231
43202
|
ui: {
|