@timeax/form-palette 0.1.28 → 0.1.29
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/{core-BS2fNt2O.d.mts → core-74nd0n1e.d.mts} +13 -2
- package/dist/{core-CtnF6uJt.d.ts → core-B8Htm7S-.d.ts} +13 -2
- package/dist/extra.d.mts +2 -2
- package/dist/extra.d.ts +2 -2
- package/dist/extra.js +108 -36
- package/dist/extra.js.map +1 -1
- package/dist/extra.mjs +108 -36
- package/dist/extra.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +112 -39
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +112 -39
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9259,7 +9259,9 @@ function CoreProvider(props) {
|
|
|
9259
9259
|
return anyField.onSubmit(value);
|
|
9260
9260
|
}
|
|
9261
9261
|
if (formatFileValue && item.variant == "file") {
|
|
9262
|
-
return toArray(value).map(
|
|
9262
|
+
return toArray(value).map(
|
|
9263
|
+
formatFileValue
|
|
9264
|
+
);
|
|
9263
9265
|
}
|
|
9264
9266
|
return value;
|
|
9265
9267
|
};
|
|
@@ -9347,8 +9349,7 @@ function CoreProvider(props) {
|
|
|
9347
9349
|
const finish = () => {
|
|
9348
9350
|
if (finished) return;
|
|
9349
9351
|
finished = true;
|
|
9350
|
-
if (uncaughtRef.current.length)
|
|
9351
|
-
setHasUncaughtErrors(hasUncaughtErrors + 1);
|
|
9352
|
+
if (uncaughtRef.current.length) setHasUncaughtErrors((e4) => e4 + 1);
|
|
9352
9353
|
setButtonLoading(false);
|
|
9353
9354
|
};
|
|
9354
9355
|
if (!ignoreForm) {
|
|
@@ -20624,17 +20625,21 @@ function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
|
|
|
20624
20625
|
label: mappers.getLabel(item, index),
|
|
20625
20626
|
description: mappers.getDescription ? mappers.getDescription(item, index) : void 0,
|
|
20626
20627
|
disabled: mappers.isDisabled ? mappers.isDisabled(item, index) : false,
|
|
20627
|
-
key: mappers.getKey ? mappers.getKey(item, index) : index
|
|
20628
|
+
key: mappers.getKey ? mappers.getKey(item, index) : index,
|
|
20629
|
+
raw: item
|
|
20628
20630
|
}));
|
|
20629
20631
|
}
|
|
20630
20632
|
if (optionValueKey || optionLabelKey) {
|
|
20631
20633
|
return items.map((item, index) => {
|
|
20632
|
-
return
|
|
20633
|
-
|
|
20634
|
-
|
|
20635
|
-
|
|
20636
|
-
|
|
20637
|
-
|
|
20634
|
+
return {
|
|
20635
|
+
...globalNormalizeCheckBasedOptions(
|
|
20636
|
+
item,
|
|
20637
|
+
index,
|
|
20638
|
+
optionLabelKey,
|
|
20639
|
+
optionValueKey
|
|
20640
|
+
),
|
|
20641
|
+
raw: item
|
|
20642
|
+
};
|
|
20638
20643
|
});
|
|
20639
20644
|
}
|
|
20640
20645
|
return items.map((item, index) => {
|
|
@@ -20645,7 +20650,8 @@ function normalizeItems(items, mappers, optionValueKey, optionLabelKey) {
|
|
|
20645
20650
|
label: String(item),
|
|
20646
20651
|
description: void 0,
|
|
20647
20652
|
disabled: false,
|
|
20648
|
-
key: index
|
|
20653
|
+
key: index,
|
|
20654
|
+
raw: item
|
|
20649
20655
|
};
|
|
20650
20656
|
}
|
|
20651
20657
|
return item;
|
|
@@ -20708,11 +20714,12 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
20708
20714
|
return found ? String(found.value) : void 0;
|
|
20709
20715
|
}, [normalized, value]);
|
|
20710
20716
|
const handleSelect = React66.useCallback(
|
|
20711
|
-
(next) => {
|
|
20717
|
+
(next, selectedRaw) => {
|
|
20712
20718
|
if (!onValue || disabled) return;
|
|
20713
20719
|
const detail = {
|
|
20714
20720
|
source: "variant",
|
|
20715
|
-
raw: next,
|
|
20721
|
+
raw: selectedRaw != null ? selectedRaw : next,
|
|
20722
|
+
selectedOptions: [selectedRaw != null ? selectedRaw : next],
|
|
20716
20723
|
nativeEvent: void 0,
|
|
20717
20724
|
meta: void 0
|
|
20718
20725
|
};
|
|
@@ -20722,9 +20729,10 @@ var InnerShadcnRadioVariant = (props, ref) => {
|
|
|
20722
20729
|
);
|
|
20723
20730
|
const handleRadioChange = React66.useCallback(
|
|
20724
20731
|
(raw) => {
|
|
20732
|
+
var _a;
|
|
20725
20733
|
const found = normalized.find((item) => String(item.value) === raw);
|
|
20726
20734
|
if (!found) return;
|
|
20727
|
-
handleSelect(found.value);
|
|
20735
|
+
handleSelect(found.value, (_a = found.raw) != null ? _a : found.value);
|
|
20728
20736
|
},
|
|
20729
20737
|
[normalized, handleSelect]
|
|
20730
20738
|
);
|
|
@@ -20970,7 +20978,8 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
|
|
|
20970
20978
|
description: mappers.getDescription ? mappers.getDescription(item, index) : void 0,
|
|
20971
20979
|
disabled: mappers.isDisabled ? mappers.isDisabled(item, index) : false,
|
|
20972
20980
|
key: mappers.getKey ? mappers.getKey(item, index) : index,
|
|
20973
|
-
tristate: mappers.getTristate ? mappers.getTristate(item, index) : void 0
|
|
20981
|
+
tristate: mappers.getTristate ? mappers.getTristate(item, index) : void 0,
|
|
20982
|
+
raw: item
|
|
20974
20983
|
}));
|
|
20975
20984
|
}
|
|
20976
20985
|
if (optionValueKey || optionLabelKey) {
|
|
@@ -20985,7 +20994,8 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
|
|
|
20985
20994
|
const tristate = anyItem.tristate;
|
|
20986
20995
|
return {
|
|
20987
20996
|
...normalised,
|
|
20988
|
-
tristate
|
|
20997
|
+
tristate,
|
|
20998
|
+
raw: item
|
|
20989
20999
|
};
|
|
20990
21000
|
});
|
|
20991
21001
|
}
|
|
@@ -20998,7 +21008,8 @@ function normalizeItems2(items, mappers, optionValueKey, optionLabelKey) {
|
|
|
20998
21008
|
description: void 0,
|
|
20999
21009
|
disabled: false,
|
|
21000
21010
|
key: index,
|
|
21001
|
-
tristate: void 0
|
|
21011
|
+
tristate: void 0,
|
|
21012
|
+
raw: item
|
|
21002
21013
|
};
|
|
21003
21014
|
}
|
|
21004
21015
|
return item;
|
|
@@ -21009,7 +21020,17 @@ function isEqualValue2(a3, b2) {
|
|
|
21009
21020
|
}
|
|
21010
21021
|
function asGroupValue(value) {
|
|
21011
21022
|
if (!value) return void 0;
|
|
21012
|
-
if (Array.isArray(value))
|
|
21023
|
+
if (Array.isArray(value)) {
|
|
21024
|
+
if (value.length === 0) return void 0;
|
|
21025
|
+
const first = value[0];
|
|
21026
|
+
if (first && typeof first === "object" && "value" in first && "state" in first) {
|
|
21027
|
+
return value;
|
|
21028
|
+
}
|
|
21029
|
+
return value.map((item) => ({
|
|
21030
|
+
value: item,
|
|
21031
|
+
state: true
|
|
21032
|
+
}));
|
|
21033
|
+
}
|
|
21013
21034
|
if (typeof value == "object")
|
|
21014
21035
|
return Object.keys(value).map(
|
|
21015
21036
|
(key) => ({
|
|
@@ -21065,11 +21086,21 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21065
21086
|
} = props;
|
|
21066
21087
|
const hasError = !!error;
|
|
21067
21088
|
const isSingle = !!single;
|
|
21089
|
+
const normalized = React66.useMemo(
|
|
21090
|
+
() => normalizeItems2(
|
|
21091
|
+
items != null ? items : options,
|
|
21092
|
+
mappers,
|
|
21093
|
+
optionValue,
|
|
21094
|
+
optionLabel
|
|
21095
|
+
),
|
|
21096
|
+
[items, options, mappers, optionValue, optionLabel]
|
|
21097
|
+
);
|
|
21068
21098
|
if (isSingle) {
|
|
21069
21099
|
const singleVal = asSingleValue(value);
|
|
21070
21100
|
const effectiveTristate = !!tristateDefault;
|
|
21071
21101
|
const internalState = effectiveTristate ? singleVal != null ? singleVal : "none" : !!singleVal;
|
|
21072
21102
|
const handleSingleChange = (next) => {
|
|
21103
|
+
var _a;
|
|
21073
21104
|
if (!onValue || disabled) return;
|
|
21074
21105
|
let nextPublic;
|
|
21075
21106
|
if (effectiveTristate) {
|
|
@@ -21080,6 +21111,7 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21080
21111
|
const detail = {
|
|
21081
21112
|
source: "variant",
|
|
21082
21113
|
raw: nextPublic,
|
|
21114
|
+
selectedOptions: nextPublic === true ? normalized[0] ? [(_a = normalized[0].raw) != null ? _a : normalized[0].value] : [] : [],
|
|
21083
21115
|
nativeEvent: void 0,
|
|
21084
21116
|
meta: void 0
|
|
21085
21117
|
};
|
|
@@ -21138,15 +21170,6 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21138
21170
|
);
|
|
21139
21171
|
}
|
|
21140
21172
|
const groupValue = asGroupValue(value);
|
|
21141
|
-
const normalized = React66.useMemo(
|
|
21142
|
-
() => normalizeItems2(
|
|
21143
|
-
items != null ? items : options,
|
|
21144
|
-
mappers,
|
|
21145
|
-
optionValue,
|
|
21146
|
-
optionLabel
|
|
21147
|
-
),
|
|
21148
|
-
[items, options, mappers, optionValue, optionLabel]
|
|
21149
|
-
);
|
|
21150
21173
|
const {
|
|
21151
21174
|
groupStyle,
|
|
21152
21175
|
groupClasses,
|
|
@@ -21166,6 +21189,13 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21166
21189
|
labelTextSizeClass: labelTextSize2(size),
|
|
21167
21190
|
descriptionTextSizeClass: descriptionTextSize2(size)
|
|
21168
21191
|
});
|
|
21192
|
+
const hasAnyTristate = React66.useMemo(
|
|
21193
|
+
() => normalized.some((item) => {
|
|
21194
|
+
var _a, _b;
|
|
21195
|
+
return (_b = (_a = item.tristate) != null ? _a : tristateDefault) != null ? _b : false;
|
|
21196
|
+
}),
|
|
21197
|
+
[normalized, tristateDefault]
|
|
21198
|
+
);
|
|
21169
21199
|
const findEntryIndex = React66.useCallback(
|
|
21170
21200
|
(val) => {
|
|
21171
21201
|
if (!groupValue) return -1;
|
|
@@ -21238,14 +21268,28 @@ var InnerShadcnCheckboxVariant = (props, ref) => {
|
|
|
21238
21268
|
const detail = {
|
|
21239
21269
|
source: "variant",
|
|
21240
21270
|
raw: nextList,
|
|
21271
|
+
selectedOptions: nextList.map(
|
|
21272
|
+
(entry) => {
|
|
21273
|
+
var _a, _b;
|
|
21274
|
+
return (_b = (_a = normalized.find(
|
|
21275
|
+
(item) => isEqualValue2(item.value, entry.value)
|
|
21276
|
+
)) == null ? void 0 : _a.raw) != null ? _b : entry.value;
|
|
21277
|
+
}
|
|
21278
|
+
),
|
|
21241
21279
|
nativeEvent: void 0,
|
|
21242
21280
|
meta: void 0
|
|
21243
21281
|
};
|
|
21244
|
-
|
|
21245
|
-
|
|
21246
|
-
|
|
21282
|
+
if (hasAnyTristate) {
|
|
21283
|
+
const value2 = {};
|
|
21284
|
+
nextList.forEach(
|
|
21285
|
+
(item) => value2[item.value] = item.state
|
|
21286
|
+
);
|
|
21287
|
+
onValue(value2, detail);
|
|
21288
|
+
return;
|
|
21289
|
+
}
|
|
21290
|
+
onValue(nextList.map((item) => item.value), detail);
|
|
21247
21291
|
},
|
|
21248
|
-
[onValue, disabled, groupValue]
|
|
21292
|
+
[onValue, disabled, groupValue, normalized, hasAnyTristate]
|
|
21249
21293
|
);
|
|
21250
21294
|
return /* @__PURE__ */ jsx(
|
|
21251
21295
|
"div",
|
|
@@ -21521,13 +21565,14 @@ var ShadcnSelectVariant = React66.forwardRef(function ShadcnSelectVariant2(props
|
|
|
21521
21565
|
);
|
|
21522
21566
|
const handleChange = React66.useCallback(
|
|
21523
21567
|
(rawKey) => {
|
|
21524
|
-
var _a2, _b2, _c;
|
|
21568
|
+
var _a2, _b2, _c, _d;
|
|
21525
21569
|
if (!onValue || rawKey === "") return;
|
|
21526
21570
|
const primitive = (_a2 = valueMap.get(rawKey)) != null ? _a2 : rawKey;
|
|
21527
21571
|
const item = (_b2 = items.find((it) => String(it.value) === String(primitive))) != null ? _b2 : null;
|
|
21528
21572
|
const detail = {
|
|
21529
21573
|
source: "variant",
|
|
21530
21574
|
raw: (_c = item == null ? void 0 : item.raw) != null ? _c : primitive,
|
|
21575
|
+
selectedOptions: [(_d = item == null ? void 0 : item.raw) != null ? _d : primitive],
|
|
21531
21576
|
nativeEvent: void 0,
|
|
21532
21577
|
meta: void 0
|
|
21533
21578
|
};
|
|
@@ -21629,6 +21674,7 @@ var ShadcnSelectVariant = React66.forwardRef(function ShadcnSelectVariant2(props
|
|
|
21629
21674
|
const detail = {
|
|
21630
21675
|
source: "variant",
|
|
21631
21676
|
raw: void 0,
|
|
21677
|
+
selectedOptions: [],
|
|
21632
21678
|
nativeEvent: void 0,
|
|
21633
21679
|
meta: { action: "clear" }
|
|
21634
21680
|
};
|
|
@@ -22263,7 +22309,12 @@ var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVari
|
|
|
22263
22309
|
next = [...current, primitive];
|
|
22264
22310
|
}
|
|
22265
22311
|
const final = next.length ? next : void 0;
|
|
22266
|
-
const values = next == null ? void 0 : next.map(
|
|
22312
|
+
const values = next == null ? void 0 : next.map(
|
|
22313
|
+
(item) => {
|
|
22314
|
+
var _a2, _b;
|
|
22315
|
+
return (_b = (_a2 = keyedItems[item]) == null ? void 0 : _a2.raw) != null ? _b : item;
|
|
22316
|
+
}
|
|
22317
|
+
);
|
|
22267
22318
|
const detail = {
|
|
22268
22319
|
source: "variant",
|
|
22269
22320
|
raw: {
|
|
@@ -22272,12 +22323,13 @@ var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVari
|
|
|
22272
22323
|
next: final,
|
|
22273
22324
|
values
|
|
22274
22325
|
},
|
|
22326
|
+
selectedOptions: values != null ? values : [],
|
|
22275
22327
|
nativeEvent: void 0,
|
|
22276
22328
|
meta: void 0
|
|
22277
22329
|
};
|
|
22278
22330
|
onValue(final, detail);
|
|
22279
22331
|
},
|
|
22280
|
-
[onValue, value, disabled, readOnly]
|
|
22332
|
+
[onValue, value, disabled, readOnly, keyedItems]
|
|
22281
22333
|
);
|
|
22282
22334
|
const handleSelectAll = React66.useCallback(() => {
|
|
22283
22335
|
if (!onValue || disabled || readOnly) return;
|
|
@@ -22293,7 +22345,10 @@ var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVari
|
|
|
22293
22345
|
next = Array.from(merged);
|
|
22294
22346
|
}
|
|
22295
22347
|
const final = next.length ? next : void 0;
|
|
22296
|
-
const values = next.map((item) =>
|
|
22348
|
+
const values = next.map((item) => {
|
|
22349
|
+
var _a2, _b;
|
|
22350
|
+
return (_b = (_a2 = keyedItems[item]) == null ? void 0 : _a2.raw) != null ? _b : item;
|
|
22351
|
+
});
|
|
22297
22352
|
const detail = {
|
|
22298
22353
|
source: "variant",
|
|
22299
22354
|
raw: {
|
|
@@ -22301,6 +22356,7 @@ var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVari
|
|
|
22301
22356
|
next: final,
|
|
22302
22357
|
values
|
|
22303
22358
|
},
|
|
22359
|
+
selectedOptions: values,
|
|
22304
22360
|
nativeEvent: void 0,
|
|
22305
22361
|
meta: {
|
|
22306
22362
|
allSelected: !currentlyAllSelected
|
|
@@ -22313,7 +22369,8 @@ var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVari
|
|
|
22313
22369
|
disabled,
|
|
22314
22370
|
readOnly,
|
|
22315
22371
|
allSelectableValues,
|
|
22316
|
-
selectedValues
|
|
22372
|
+
selectedValues,
|
|
22373
|
+
keyedItems
|
|
22317
22374
|
]);
|
|
22318
22375
|
const handleClearAll = React66.useCallback(() => {
|
|
22319
22376
|
if (!onValue || disabled || readOnly) return;
|
|
@@ -22322,6 +22379,7 @@ var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVari
|
|
|
22322
22379
|
raw: {
|
|
22323
22380
|
type: "clear"
|
|
22324
22381
|
},
|
|
22382
|
+
selectedOptions: [],
|
|
22325
22383
|
nativeEvent: void 0,
|
|
22326
22384
|
meta: void 0
|
|
22327
22385
|
};
|
|
@@ -22337,9 +22395,14 @@ var ShadcnMultiSelectVariant = React66.forwardRef(function ShadcnMultiSelectVari
|
|
|
22337
22395
|
selectedValues,
|
|
22338
22396
|
item.value
|
|
22339
22397
|
);
|
|
22398
|
+
const selectedOptions = (updated != null ? updated : []).map((value2) => {
|
|
22399
|
+
var _a2, _b;
|
|
22400
|
+
return (_b = (_a2 = keyedItems[value2]) == null ? void 0 : _a2.raw) != null ? _b : value2;
|
|
22401
|
+
});
|
|
22340
22402
|
const detail = {
|
|
22341
22403
|
source: "variant",
|
|
22342
22404
|
raw: item,
|
|
22405
|
+
selectedOptions,
|
|
22343
22406
|
nativeEvent: void 0,
|
|
22344
22407
|
meta: { action: "remove", removed: value }
|
|
22345
22408
|
};
|
|
@@ -24264,9 +24327,16 @@ var ShadcnTreeSelectVariant = React66.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24264
24327
|
setOpen(false);
|
|
24265
24328
|
}
|
|
24266
24329
|
const nextSelectedValues = Array.isArray(nextValue) ? nextValue : nextValue !== void 0 && nextValue !== null ? [nextValue] : [];
|
|
24330
|
+
const nextSelectedOptions = nextSelectedValues.map(
|
|
24331
|
+
(val) => {
|
|
24332
|
+
var _a, _b;
|
|
24333
|
+
return (_b = (_a = allNodesFlat.find((node) => node.value === val)) == null ? void 0 : _a.raw) != null ? _b : val;
|
|
24334
|
+
}
|
|
24335
|
+
);
|
|
24267
24336
|
const detail = {
|
|
24268
24337
|
source: "variant",
|
|
24269
24338
|
raw: item.raw,
|
|
24339
|
+
selectedOptions: nextSelectedOptions,
|
|
24270
24340
|
nativeEvent: void 0,
|
|
24271
24341
|
meta: {
|
|
24272
24342
|
toggled: item.value,
|
|
@@ -24281,7 +24351,8 @@ var ShadcnTreeSelectVariant = React66.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24281
24351
|
multiple,
|
|
24282
24352
|
selectedValues,
|
|
24283
24353
|
onValue,
|
|
24284
|
-
toggleExpanded
|
|
24354
|
+
toggleExpanded,
|
|
24355
|
+
allNodesFlat
|
|
24285
24356
|
]
|
|
24286
24357
|
);
|
|
24287
24358
|
const handleClear = React66.useCallback(() => {
|
|
@@ -24289,6 +24360,7 @@ var ShadcnTreeSelectVariant = React66.forwardRef(function ShadcnTreeSelectVarian
|
|
|
24289
24360
|
const detail = {
|
|
24290
24361
|
source: "variant",
|
|
24291
24362
|
raw: void 0,
|
|
24363
|
+
selectedOptions: [],
|
|
24292
24364
|
nativeEvent: void 0,
|
|
24293
24365
|
meta: { action: "clear" }
|
|
24294
24366
|
};
|
|
@@ -26062,6 +26134,7 @@ var ShadcnToggleVariant3 = React66.forwardRef(function ShadcnToggleVariant4(prop
|
|
|
26062
26134
|
source: "variant",
|
|
26063
26135
|
raw: rawSelection,
|
|
26064
26136
|
// original item(s)
|
|
26137
|
+
selectedOptions: Array.isArray(rawSelection) ? rawSelection : rawSelection === void 0 ? [] : [rawSelection],
|
|
26065
26138
|
nativeEvent: void 0,
|
|
26066
26139
|
meta: { action: "toggle" }
|
|
26067
26140
|
};
|
|
@@ -32472,7 +32545,7 @@ var ShadcnIconVariant = React66.forwardRef(function ShadcnIconVariant2(props, re
|
|
|
32472
32545
|
PopoverContent,
|
|
32473
32546
|
{
|
|
32474
32547
|
className: cn(
|
|
32475
|
-
"w-(--radix-popover-trigger-width) p-0",
|
|
32548
|
+
"w-(--radix-popover-trigger-width) p-0 max-h-(--radix-popper-available-height)",
|
|
32476
32549
|
popoverClassName
|
|
32477
32550
|
),
|
|
32478
32551
|
align: "start",
|
|
@@ -33322,7 +33395,7 @@ var ShadcnImageIconVariant = React66.forwardRef(function ShadcnImageIconVariant2
|
|
|
33322
33395
|
PopoverContent,
|
|
33323
33396
|
{
|
|
33324
33397
|
className: cn(
|
|
33325
|
-
"w-(--radix-popover-trigger-width) p-0",
|
|
33398
|
+
"w-(--radix-popover-trigger-width) p-0 max-h-(--radix-popper-available-height)",
|
|
33326
33399
|
popoverClassName
|
|
33327
33400
|
),
|
|
33328
33401
|
align: "start",
|