@dreamtree-org/twreact-ui 1.1.73 → 1.2.0
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/README.md +4 -1
- package/dist/components/core/Table/Table.d.ts +2 -53
- package/dist/components/core/Table/Table.d.ts.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.esm.css +1 -1
- package/dist/index.esm.js +138 -60
- package/dist/index.js +138 -60
- package/mcp/catalog.snapshot.json +9 -3
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -5709,7 +5709,7 @@ function FieldInput(_ref) {
|
|
|
5709
5709
|
});
|
|
5710
5710
|
}
|
|
5711
5711
|
|
|
5712
|
-
var _excluded$x = ["data", "columns", "sortable", "filterable", "selectable", "pagination", "pageSize", "onSort", "onFilter", "onFetch", "onFilterChange", "onSelectionChange", "onRowClick", "hasDetails", "DetailsComponent", "className", "withAction", "onAction", "actions", "replaceDefaultActions", "showSerial", "cellClass", "rowClass", "globalSearch", "limitOptions", "showLimitSelector", "onLimitChange", "showReloadButton", "renderReloadButton", "onReload", "stripedRows", "theme", "responsiveBreakpoint", "serverSide", "totalRecords", "pageNumber", "onPageChange", "TheadComponent", "TfootComponent", "interactive", "onSave", "onEdit", "onRowAdd", "onRowDelete"],
|
|
5712
|
+
var _excluded$x = ["data", "columns", "sortable", "filterable", "selectable", "pagination", "pageSize", "onSort", "onFilter", "onFetch", "onFilterChange", "onSelectionChange", "onRowClick", "hasDetails", "DetailsComponent", "className", "withAction", "onAction", "actions", "replaceDefaultActions", "showSerial", "cellClass", "rowClass", "globalSearch", "limitOptions", "showLimitSelector", "onLimitChange", "showReloadButton", "renderReloadButton", "onReload", "stripedRows", "theme", "responsiveBreakpoint", "serverSide", "totalRecords", "pageNumber", "onPageChange", "TheadComponent", "TfootComponent", "interactive", "onSave", "onEdit", "onRowAdd", "onRowDelete", "editKeyBinding", "newRowPosition", "addRowRef", "onInitAddRow", "renderAddRowButton", "renderExternalAddRow"],
|
|
5713
5713
|
_excluded2$4 = ["_key", "_isNew"];
|
|
5714
5714
|
function ownKeys$B(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
5715
5715
|
function _objectSpread$B(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$B(Object(t), true).forEach(function (r) { _defineProperty$4(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$B(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -5722,7 +5722,7 @@ var DEFAULT_THEME = {
|
|
|
5722
5722
|
menuBg: "bg-white",
|
|
5723
5723
|
menuItemHover: "hover:bg-gray-50"
|
|
5724
5724
|
};
|
|
5725
|
-
var Table = function Table(_ref) {
|
|
5725
|
+
var Table = /*#__PURE__*/forwardRef(function Table(_ref, ref) {
|
|
5726
5726
|
var _validationErrors$;
|
|
5727
5727
|
var _ref$data = _ref.data,
|
|
5728
5728
|
initialData = _ref$data === void 0 ? DEFAULT_DATA : _ref$data,
|
|
@@ -5792,6 +5792,14 @@ var Table = function Table(_ref) {
|
|
|
5792
5792
|
onEdit = _ref.onEdit,
|
|
5793
5793
|
onRowAdd = _ref.onRowAdd,
|
|
5794
5794
|
onRowDelete = _ref.onRowDelete,
|
|
5795
|
+
_ref$editKeyBinding = _ref.editKeyBinding,
|
|
5796
|
+
editKeyBinding = _ref$editKeyBinding === void 0 ? "e" : _ref$editKeyBinding,
|
|
5797
|
+
_ref$newRowPosition = _ref.newRowPosition,
|
|
5798
|
+
newRowPosition = _ref$newRowPosition === void 0 ? "bottom" : _ref$newRowPosition,
|
|
5799
|
+
addRowRef = _ref.addRowRef,
|
|
5800
|
+
onInitAddRow = _ref.onInitAddRow,
|
|
5801
|
+
renderAddRowButton = _ref.renderAddRowButton,
|
|
5802
|
+
renderExternalAddRow = _ref.renderExternalAddRow,
|
|
5795
5803
|
props = _objectWithoutProperties$1(_ref, _excluded$x);
|
|
5796
5804
|
theme = _objectSpread$B(_objectSpread$B({}, DEFAULT_THEME), theme);
|
|
5797
5805
|
// State
|
|
@@ -6069,9 +6077,10 @@ var Table = function Table(_ref) {
|
|
|
6069
6077
|
return _objectSpread$B(_objectSpread$B({}, prev), {}, _defineProperty$4({}, rowKey, nextRowEdits));
|
|
6070
6078
|
});
|
|
6071
6079
|
}, [newRows, tableData, onEdit]);
|
|
6072
|
-
var
|
|
6080
|
+
var _handleAddRow = useCallback(function (positionOverride) {
|
|
6073
6081
|
var _columnsState$find, _columnsState$;
|
|
6074
|
-
var
|
|
6082
|
+
var targetPos = typeof positionOverride === "string" && (positionOverride === "top" || positionOverride === "bottom") ? positionOverride : newRowPosition || "bottom";
|
|
6083
|
+
var newKey = "new-".concat(Date.now(), "-").concat(Math.random().toString(36).substring(2, 6));
|
|
6075
6084
|
var newRowObj = {
|
|
6076
6085
|
_key: newKey,
|
|
6077
6086
|
_isNew: true
|
|
@@ -6081,23 +6090,51 @@ var Table = function Table(_ref) {
|
|
|
6081
6090
|
newRowObj[col.key] = (_col$defaultValue = col.defaultValue) !== null && _col$defaultValue !== void 0 ? _col$defaultValue : "";
|
|
6082
6091
|
});
|
|
6083
6092
|
setNewRows(function (prev) {
|
|
6093
|
+
if (targetPos === "top") {
|
|
6094
|
+
return [newRowObj].concat(_toConsumableArray$1(prev));
|
|
6095
|
+
}
|
|
6084
6096
|
return [].concat(_toConsumableArray$1(prev), [newRowObj]);
|
|
6085
6097
|
});
|
|
6086
6098
|
var firstColKey = ((_columnsState$find = columnsState.find(function (c) {
|
|
6087
6099
|
return c.isVisible !== false;
|
|
6088
6100
|
})) === null || _columnsState$find === void 0 ? void 0 : _columnsState$find.key) || ((_columnsState$ = columnsState[0]) === null || _columnsState$ === void 0 ? void 0 : _columnsState$.key);
|
|
6101
|
+
var initialRowIndex = targetPos === "top" ? 0 : tableData.length + newRows.length;
|
|
6089
6102
|
setActiveCell({
|
|
6090
6103
|
rowKey: newKey,
|
|
6091
6104
|
colKey: firstColKey,
|
|
6092
|
-
rowIndex:
|
|
6105
|
+
rowIndex: initialRowIndex
|
|
6093
6106
|
});
|
|
6094
6107
|
setEditingCell({
|
|
6095
6108
|
rowKey: newKey,
|
|
6096
6109
|
colKey: firstColKey,
|
|
6097
|
-
rowIndex:
|
|
6110
|
+
rowIndex: initialRowIndex
|
|
6111
|
+
});
|
|
6112
|
+
onRowAdd === null || onRowAdd === void 0 || onRowAdd(newRowObj, targetPos);
|
|
6113
|
+
}, [columnsState, tableData.length, newRows.length, onRowAdd, newRowPosition]);
|
|
6114
|
+
useImperativeHandle(ref, function () {
|
|
6115
|
+
return {
|
|
6116
|
+
addRow: function addRow(pos) {
|
|
6117
|
+
return _handleAddRow(pos);
|
|
6118
|
+
},
|
|
6119
|
+
addNewRow: function addNewRow(pos) {
|
|
6120
|
+
return _handleAddRow(pos);
|
|
6121
|
+
},
|
|
6122
|
+
handleAddRow: function handleAddRow(pos) {
|
|
6123
|
+
return _handleAddRow(pos);
|
|
6124
|
+
},
|
|
6125
|
+
tableContainerRef: tableContainerRef.current
|
|
6126
|
+
};
|
|
6127
|
+
}, [_handleAddRow]);
|
|
6128
|
+
useEffect(function () {
|
|
6129
|
+
if (addRowRef) {
|
|
6130
|
+
addRowRef.current = function (pos) {
|
|
6131
|
+
return _handleAddRow(pos);
|
|
6132
|
+
};
|
|
6133
|
+
}
|
|
6134
|
+
onInitAddRow === null || onInitAddRow === void 0 || onInitAddRow(function (pos) {
|
|
6135
|
+
return _handleAddRow(pos);
|
|
6098
6136
|
});
|
|
6099
|
-
|
|
6100
|
-
}, [columnsState, tableData.length, newRows.length, onRowAdd]);
|
|
6137
|
+
}, [addRowRef, onInitAddRow, _handleAddRow]);
|
|
6101
6138
|
var handleDeleteNewRow = useCallback(function (rowKey) {
|
|
6102
6139
|
setNewRows(function (prev) {
|
|
6103
6140
|
return prev.filter(function (r) {
|
|
@@ -6361,6 +6398,15 @@ var Table = function Table(_ref) {
|
|
|
6361
6398
|
};
|
|
6362
6399
|
});
|
|
6363
6400
|
}, [limitOptions]);
|
|
6401
|
+
var isEditKey = useCallback(function (key, e) {
|
|
6402
|
+
if (typeof editKeyBinding === "function") {
|
|
6403
|
+
return editKeyBinding(e);
|
|
6404
|
+
}
|
|
6405
|
+
if (typeof editKeyBinding === "string" && editKeyBinding.trim() !== "") {
|
|
6406
|
+
return key.toLowerCase() === editKeyBinding.toLowerCase();
|
|
6407
|
+
}
|
|
6408
|
+
return key.toLowerCase() === "e" || key === "Insert";
|
|
6409
|
+
}, [editKeyBinding]);
|
|
6364
6410
|
var handleTableKeyDown = useCallback(function (e) {
|
|
6365
6411
|
if (!interactive) return;
|
|
6366
6412
|
var key = e.key,
|
|
@@ -6373,24 +6419,33 @@ var Table = function Table(_ref) {
|
|
|
6373
6419
|
}
|
|
6374
6420
|
return;
|
|
6375
6421
|
}
|
|
6376
|
-
// Enter: Save changes
|
|
6377
|
-
if (key === "Enter") {
|
|
6422
|
+
// Enter: Save changes when there are modified changes (isDirty)
|
|
6423
|
+
if (key === "Enter" && isDirty) {
|
|
6378
6424
|
var _e$target;
|
|
6379
6425
|
if (((_e$target = e.target) === null || _e$target === void 0 ? void 0 : _e$target.tagName) === "TEXTAREA" && shiftKey) {
|
|
6380
6426
|
return;
|
|
6381
6427
|
}
|
|
6382
|
-
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
handleSave();
|
|
6387
|
-
}
|
|
6428
|
+
e.preventDefault();
|
|
6429
|
+
setEditingCell(null);
|
|
6430
|
+
if (isValid && !isSaving) {
|
|
6431
|
+
handleSave();
|
|
6388
6432
|
}
|
|
6389
6433
|
return;
|
|
6390
6434
|
}
|
|
6435
|
+
// Standard Edit Key ('e' or custom editKeyBinding) when focused on active cell and not editing: enter edit mode
|
|
6436
|
+
if (isEditKey(key, e) && activeCell && !editingCell) {
|
|
6437
|
+
var col = visibleColumns.find(function (c) {
|
|
6438
|
+
return c.key === activeCell.colKey;
|
|
6439
|
+
});
|
|
6440
|
+
if (col && col.editable !== false) {
|
|
6441
|
+
e.preventDefault();
|
|
6442
|
+
setEditingCell(activeCell);
|
|
6443
|
+
return;
|
|
6444
|
+
}
|
|
6445
|
+
}
|
|
6391
6446
|
var currentCell = activeCell || editingCell;
|
|
6392
6447
|
if (!currentCell) return;
|
|
6393
|
-
var allRows = [].concat(_toConsumableArray$1(paginatedData), _toConsumableArray$1(newRows));
|
|
6448
|
+
var allRows = newRowPosition === "top" ? [].concat(_toConsumableArray$1(newRows), _toConsumableArray$1(paginatedData)) : [].concat(_toConsumableArray$1(paginatedData), _toConsumableArray$1(newRows));
|
|
6394
6449
|
if (allRows.length === 0 || visibleColumns.length === 0) return;
|
|
6395
6450
|
var rIdx = allRows.findIndex(function (r, idx) {
|
|
6396
6451
|
var rKey = r._key || getRowKey(r, startIndex + idx);
|
|
@@ -6709,6 +6764,26 @@ var Table = function Table(_ref) {
|
|
|
6709
6764
|
invalidCellSet: invalidCellSet,
|
|
6710
6765
|
pendingEdits: pendingEdits
|
|
6711
6766
|
};
|
|
6767
|
+
var renderAddRowClickableRow = useCallback(function () {
|
|
6768
|
+
return jsx("tr", {
|
|
6769
|
+
onClick: function onClick() {
|
|
6770
|
+
return _handleAddRow(newRowPosition);
|
|
6771
|
+
},
|
|
6772
|
+
className: "bg-primary-50/40 hover:bg-primary-100/70 active:bg-primary-100 transition-colors border-t-2 border-b-2 border-dashed border-primary-300 cursor-pointer group",
|
|
6773
|
+
children: jsx("td", {
|
|
6774
|
+
colSpan: visibleCount,
|
|
6775
|
+
className: "px-6 py-3.5 text-left text-sm font-semibold text-primary-700 group-hover:text-primary-800",
|
|
6776
|
+
children: jsxs("div", {
|
|
6777
|
+
className: "flex items-center justify-start gap-2",
|
|
6778
|
+
children: [jsx(Plus, {
|
|
6779
|
+
className: "w-4 h-4 text-primary-600 group-hover:scale-110 transition-transform"
|
|
6780
|
+
}), jsx("span", {
|
|
6781
|
+
children: "Click here to add new record instantly...."
|
|
6782
|
+
})]
|
|
6783
|
+
})
|
|
6784
|
+
})
|
|
6785
|
+
});
|
|
6786
|
+
}, [_handleAddRow, newRowPosition, visibleCount]);
|
|
6712
6787
|
return jsxs("div", {
|
|
6713
6788
|
ref: tableContainerRef,
|
|
6714
6789
|
tabIndex: interactive ? 0 : undefined,
|
|
@@ -6753,7 +6828,14 @@ var Table = function Table(_ref) {
|
|
|
6753
6828
|
})]
|
|
6754
6829
|
}), jsxs("div", {
|
|
6755
6830
|
className: "flex flex-col sm:flex-row items-start sm:items-center gap-3 w-full md:w-auto",
|
|
6756
|
-
children: [interactive &&
|
|
6831
|
+
children: [interactive && (renderAddRowButton || renderExternalAddRow) && jsx("div", {
|
|
6832
|
+
className: "flex items-center gap-2",
|
|
6833
|
+
children: typeof (renderAddRowButton || renderExternalAddRow) === "function" ? (renderAddRowButton || renderExternalAddRow)({
|
|
6834
|
+
addRow: _handleAddRow,
|
|
6835
|
+
handleAddRow: _handleAddRow,
|
|
6836
|
+
newRowPosition: newRowPosition
|
|
6837
|
+
}) : renderAddRowButton || renderExternalAddRow
|
|
6838
|
+
}), interactive && isDirty && jsxs("div", {
|
|
6757
6839
|
className: "flex items-center gap-2 flex-wrap",
|
|
6758
6840
|
children: [jsxs("button", {
|
|
6759
6841
|
type: "button",
|
|
@@ -6949,9 +7031,9 @@ var Table = function Table(_ref) {
|
|
|
6949
7031
|
className: "pb-4"
|
|
6950
7032
|
})]
|
|
6951
7033
|
})]
|
|
6952
|
-
}),
|
|
7034
|
+
}), jsx("tbody", {
|
|
6953
7035
|
className: "divide-y divide-gray-200",
|
|
6954
|
-
children:
|
|
7036
|
+
children: loading ? jsx("tr", {
|
|
6955
7037
|
children: jsx("td", {
|
|
6956
7038
|
colSpan: visibleCount,
|
|
6957
7039
|
className: "px-6 py-8 text-center",
|
|
@@ -6965,32 +7047,43 @@ var Table = function Table(_ref) {
|
|
|
6965
7047
|
})]
|
|
6966
7048
|
})
|
|
6967
7049
|
})
|
|
6968
|
-
}) : paginatedData.length === 0 && newRows.length === 0 ?
|
|
6969
|
-
children: jsx("
|
|
6970
|
-
|
|
6971
|
-
|
|
6972
|
-
|
|
6973
|
-
|
|
6974
|
-
|
|
6975
|
-
|
|
6976
|
-
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
6980
|
-
|
|
6981
|
-
|
|
6982
|
-
|
|
7050
|
+
}) : paginatedData.length === 0 && newRows.length === 0 ? jsxs(Fragment, {
|
|
7051
|
+
children: [interactive && newRowPosition === "top" && renderAddRowClickableRow(), jsx("tr", {
|
|
7052
|
+
children: jsx("td", {
|
|
7053
|
+
colSpan: visibleCount,
|
|
7054
|
+
className: "px-6 py-8 text-center",
|
|
7055
|
+
children: jsxs("div", {
|
|
7056
|
+
className: "flex flex-col items-center gap-2",
|
|
7057
|
+
children: [jsx("div", {
|
|
7058
|
+
className: "text-primary-400",
|
|
7059
|
+
children: jsx(List, {
|
|
7060
|
+
className: "h-8 w-8"
|
|
7061
|
+
})
|
|
7062
|
+
}), jsx("span", {
|
|
7063
|
+
className: "text-sm text-primary-500",
|
|
7064
|
+
children: "No results found."
|
|
7065
|
+
})]
|
|
7066
|
+
})
|
|
6983
7067
|
})
|
|
6984
|
-
})
|
|
7068
|
+
}), interactive && newRowPosition !== "top" && renderAddRowClickableRow()]
|
|
6985
7069
|
}) : jsxs(Fragment, {
|
|
6986
|
-
children: [
|
|
7070
|
+
children: [interactive && newRowPosition === "top" && renderAddRowClickableRow(), interactive && newRowPosition === "top" && newRows.map(function (newRow, newIdx) {
|
|
7071
|
+
return jsx(TableRow, _objectSpread$B({
|
|
7072
|
+
row: newRow,
|
|
7073
|
+
rowIndexInPage: newIdx,
|
|
7074
|
+
startIndex: 0,
|
|
7075
|
+
visibleCount: visibleCount,
|
|
7076
|
+
isNewRow: true,
|
|
7077
|
+
onDeleteNewRow: handleDeleteNewRow
|
|
7078
|
+
}, rowSharedProps), newRow._key);
|
|
7079
|
+
}), paginatedData.map(function (row, rowIndexInPage) {
|
|
6987
7080
|
return jsx(TableRow, _objectSpread$B({
|
|
6988
7081
|
row: row,
|
|
6989
7082
|
rowIndexInPage: rowIndexInPage,
|
|
6990
7083
|
startIndex: startIndex,
|
|
6991
7084
|
visibleCount: visibleCount
|
|
6992
7085
|
}, rowSharedProps), getRowKey(row, startIndex + rowIndexInPage));
|
|
6993
|
-
}), interactive && newRows.map(function (newRow, newIdx) {
|
|
7086
|
+
}), interactive && newRowPosition !== "top" && newRows.map(function (newRow, newIdx) {
|
|
6994
7087
|
return jsx(TableRow, _objectSpread$B({
|
|
6995
7088
|
row: newRow,
|
|
6996
7089
|
rowIndexInPage: paginatedData.length + newIdx,
|
|
@@ -6999,23 +7092,8 @@ var Table = function Table(_ref) {
|
|
|
6999
7092
|
isNewRow: true,
|
|
7000
7093
|
onDeleteNewRow: handleDeleteNewRow
|
|
7001
7094
|
}, rowSharedProps), newRow._key);
|
|
7002
|
-
})]
|
|
7003
|
-
})
|
|
7004
|
-
onClick: handleAddRow,
|
|
7005
|
-
className: "bg-primary-50/40 hover:bg-primary-100/70 active:bg-primary-100 transition-colors border-t-2 border-dashed border-primary-300 cursor-pointer group",
|
|
7006
|
-
children: jsx("td", {
|
|
7007
|
-
colSpan: visibleCount,
|
|
7008
|
-
className: "px-6 py-3.5 text-left text-sm font-semibold text-primary-700 group-hover:text-primary-800",
|
|
7009
|
-
children: jsxs("div", {
|
|
7010
|
-
className: "flex items-center justify-start gap-2",
|
|
7011
|
-
children: [jsx(Plus, {
|
|
7012
|
-
className: "w-4 h-4 text-primary-600 group-hover:scale-110 transition-transform"
|
|
7013
|
-
}), jsx("span", {
|
|
7014
|
-
children: "Click here to add new record instantly...."
|
|
7015
|
-
})]
|
|
7016
|
-
})
|
|
7017
|
-
})
|
|
7018
|
-
})]
|
|
7095
|
+
}), interactive && newRowPosition !== "top" && renderAddRowClickableRow()]
|
|
7096
|
+
})
|
|
7019
7097
|
})]
|
|
7020
7098
|
}))
|
|
7021
7099
|
}), isMobileView && jsx("div", {
|
|
@@ -7063,7 +7141,7 @@ var Table = function Table(_ref) {
|
|
|
7063
7141
|
theme: safeTheme
|
|
7064
7142
|
})]
|
|
7065
7143
|
});
|
|
7066
|
-
};
|
|
7144
|
+
});
|
|
7067
7145
|
|
|
7068
7146
|
var isCheckBoxInput = (element) => element.type === 'checkbox';
|
|
7069
7147
|
|
|
@@ -13684,7 +13762,7 @@ var Accordion = /*#__PURE__*/forwardRef(function Accordion(_ref, ref) {
|
|
|
13684
13762
|
});
|
|
13685
13763
|
Accordion.displayName = "Accordion";
|
|
13686
13764
|
|
|
13687
|
-
var _excluded$s = ["id", "name", "label", "checked", "defaultChecked", "onChange", "disabled", "required", "className", "size", "labelPosition", "value", "ariaLabel", "variant", "indeterminate", "borderColor", "color", "iconClass", "checkedClass"];
|
|
13765
|
+
var _excluded$s = ["id", "name", "label", "checked", "defaultChecked", "onChange", "disabled", "required", "className", "size", "labelPosition", "value", "ariaLabel", "variant", "indeterminate", "borderColor", "color", "iconClass", "checkedClass", "wrapperProps"];
|
|
13688
13766
|
function ownKeys$w(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13689
13767
|
function _objectSpread$w(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$w(Object(t), true).forEach(function (r) { _defineProperty$4(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$w(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
13690
13768
|
var SIZE_CLASSES = {
|
|
@@ -13751,7 +13829,6 @@ var COLOR_PRESETS = {
|
|
|
13751
13829
|
}
|
|
13752
13830
|
};
|
|
13753
13831
|
var Checkbox = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
13754
|
-
var _props$wrapperProps;
|
|
13755
13832
|
var id = _ref.id,
|
|
13756
13833
|
name = _ref.name,
|
|
13757
13834
|
label = _ref.label,
|
|
@@ -13779,6 +13856,7 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
13779
13856
|
color = _ref$color === void 0 ? "primary" : _ref$color,
|
|
13780
13857
|
iconClass = _ref.iconClass,
|
|
13781
13858
|
checkedClass = _ref.checkedClass,
|
|
13859
|
+
wrapperProps = _ref.wrapperProps,
|
|
13782
13860
|
props = _objectWithoutProperties$1(_ref, _excluded$s);
|
|
13783
13861
|
var autoId = useId();
|
|
13784
13862
|
var inputId = id || "".concat(autoId, "-checkbox");
|
|
@@ -13819,7 +13897,7 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
13819
13897
|
} : {};
|
|
13820
13898
|
return jsxs("div", _objectSpread$w(_objectSpread$w({
|
|
13821
13899
|
className: wrapperCls
|
|
13822
|
-
},
|
|
13900
|
+
}, wrapperProps !== null && wrapperProps !== void 0 ? wrapperProps : {}), {}, {
|
|
13823
13901
|
children: [label && labelPosition === "left" && jsx("label", {
|
|
13824
13902
|
htmlFor: inputId,
|
|
13825
13903
|
className: "".concat(sizeClass.label, " select-none mr-2"),
|
|
@@ -13838,7 +13916,6 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
13838
13916
|
className: "peer absolute inset-0 m-0 p-0 opacity-0 z-10",
|
|
13839
13917
|
// ensure we set checked only from the boolean (avoid undefined)
|
|
13840
13918
|
checked: Boolean(currentChecked),
|
|
13841
|
-
defaultChecked: defaultChecked,
|
|
13842
13919
|
onChange: handleChange,
|
|
13843
13920
|
disabled: disabled,
|
|
13844
13921
|
required: required,
|
|
@@ -13865,6 +13942,7 @@ var Checkbox = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
13865
13942
|
})]
|
|
13866
13943
|
}));
|
|
13867
13944
|
});
|
|
13945
|
+
Checkbox.displayName = "Checkbox";
|
|
13868
13946
|
|
|
13869
13947
|
var _excluded$r = ["value", "defaultValue", "onChange", "swatches", "showAlpha", "size", "disabled", "className", "label", "id"];
|
|
13870
13948
|
function ownKeys$v(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|