@economic/taco 2.11.2 → 2.12.1
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/components/Icon/components/EditSimple.d.ts +3 -0
- package/dist/components/Icon/components/index.d.ts +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Menu/components/Item.d.ts +1 -1
- package/dist/components/Menu/components/Link.d.ts +1 -1
- package/dist/components/ModeSwitch/ModeSwitch.d.ts +17 -0
- package/dist/components/Navigation2/components/Link.d.ts +1 -1
- package/dist/components/Provider/Localization.d.ts +0 -1
- package/dist/components/Select2/components/Option.d.ts +1 -1
- package/dist/components/Select2/components/Search.d.ts +1 -1
- package/dist/components/Table3/hooks/features/useCurrentRow.d.ts +1 -0
- package/dist/components/Table3/hooks/useCssGrid.d.ts +1 -1
- package/dist/components/Table3/types.d.ts +0 -1
- package/dist/components/Tag/Tag.d.ts +1 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +4 -1
- package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Icon/components/EditSimple.js +19 -0
- package/dist/esm/packages/taco/src/components/Icon/components/EditSimple.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js +2 -0
- package/dist/esm/packages/taco/src/components/Icon/components/index.js.map +1 -1
- package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +30 -0
- package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +1 -2
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/Table3.js +10 -5
- package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/columns/header/Menu.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/EditButton.js +9 -16
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/EditButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js +1 -0
- package/dist/esm/packages/taco/src/components/Table3/components/toolbar/PrintButton/PrintIFrame.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js +18 -3
- package/dist/esm/packages/taco/src/components/Table3/hooks/features/useCurrentRow.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js +3 -2
- package/dist/esm/packages/taco/src/components/Table3/hooks/useCssGrid.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table3/types.js.map +1 -1
- package/dist/esm/packages/taco/src/index.js +1 -0
- package/dist/esm/packages/taco/src/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/taco.cjs.development.js +84 -27
- package/dist/taco.cjs.development.js.map +1 -1
- package/dist/taco.cjs.production.min.js +1 -1
- package/dist/taco.cjs.production.min.js.map +1 -1
- package/package.json +2 -2
- package/types.json +13366 -11141
|
@@ -1287,6 +1287,21 @@ function IconESignature(props, svgRef) {
|
|
|
1287
1287
|
}
|
|
1288
1288
|
var ESignature = /*#__PURE__*/React.forwardRef(IconESignature);
|
|
1289
1289
|
|
|
1290
|
+
function IconEditSimple(props, svgRef) {
|
|
1291
|
+
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
1292
|
+
fill: "none",
|
|
1293
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1294
|
+
viewBox: "0 0 24 24",
|
|
1295
|
+
ref: svgRef
|
|
1296
|
+
}, props), /*#__PURE__*/React.createElement("path", {
|
|
1297
|
+
fillRule: "evenodd",
|
|
1298
|
+
clipRule: "evenodd",
|
|
1299
|
+
d: "M16.013 4.513a1.75 1.75 0 012.35-.114l.124.114 1.586 1.585a1.75 1.75 0 01.114 2.35l-.114.125L8.061 20.586H4v-4.06L16.013 4.512zm-1.514 3.633l-8.999 9v1.94h1.938l9-9.001-1.939-1.939zm2.928-2.573a.25.25 0 00-.3-.04l-.054.04-1.513 1.512 1.939 1.939 1.514-1.511a.25.25 0 00.065-.24l-.025-.06-.04-.054-1.586-1.586z",
|
|
1300
|
+
fill: "currentColor"
|
|
1301
|
+
}));
|
|
1302
|
+
}
|
|
1303
|
+
var EditSimple = /*#__PURE__*/React.forwardRef(IconEditSimple);
|
|
1304
|
+
|
|
1290
1305
|
function IconEdit(props, svgRef) {
|
|
1291
1306
|
return /*#__PURE__*/React.createElement("svg", Object.assign({
|
|
1292
1307
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3349,6 +3364,7 @@ const icons = {
|
|
|
3349
3364
|
drag: Drag,
|
|
3350
3365
|
'e-copedia': ECopedia,
|
|
3351
3366
|
'e-signature': ESignature,
|
|
3367
|
+
'edit-simple': EditSimple,
|
|
3352
3368
|
edit: Edit,
|
|
3353
3369
|
'ellipsis-horizontal': EllipsisHorizontal,
|
|
3354
3370
|
'ellipsis-vertical': EllipsisVertical,
|
|
@@ -4358,8 +4374,7 @@ const defaultLocalisationTexts = {
|
|
|
4358
4374
|
},
|
|
4359
4375
|
buttons: {
|
|
4360
4376
|
edit: {
|
|
4361
|
-
|
|
4362
|
-
tooltip: 'Edit'
|
|
4377
|
+
tooltip: 'Edit table'
|
|
4363
4378
|
}
|
|
4364
4379
|
},
|
|
4365
4380
|
rowIndicator: {
|
|
@@ -6725,7 +6740,10 @@ const DrawerContent = /*#__PURE__*/React__default.forwardRef(function Content(pr
|
|
|
6725
6740
|
}, dragHandleProps, {
|
|
6726
6741
|
"data-testid": "resize-handler",
|
|
6727
6742
|
ref: dragHandlerRef
|
|
6728
|
-
})
|
|
6743
|
+
}), dragging ? /*#__PURE__*/React__default.createElement("div", {
|
|
6744
|
+
"data-testid": "resize-hit-area",
|
|
6745
|
+
className: "fixed bottom-0 left-0 right-0 top-0"
|
|
6746
|
+
}) : null), showCloseButton ? /*#__PURE__*/React__default.createElement(Close$3, null, /*#__PURE__*/React__default.createElement(IconButton, {
|
|
6729
6747
|
appearance: "discrete",
|
|
6730
6748
|
"aria-label": texts.drawer.close,
|
|
6731
6749
|
className: "absolute right-0 top-0 mr-2 mt-4",
|
|
@@ -7943,6 +7961,29 @@ Menu$1.Header = Header;
|
|
|
7943
7961
|
Menu$1.RadioGroup = RadioGroup$1;
|
|
7944
7962
|
Menu$1.SubMenu = SubMenu;
|
|
7945
7963
|
|
|
7964
|
+
const ModeSwitch = /*#__PURE__*/React.forwardRef(function ModeSwitch(props, ref) {
|
|
7965
|
+
const {
|
|
7966
|
+
onChange,
|
|
7967
|
+
...otherProps
|
|
7968
|
+
} = props;
|
|
7969
|
+
const className = cn('group w-14 h-8 flex flex-shrink-0 rounded-full inline-flex focus-visible:yt-focus p-1', {
|
|
7970
|
+
'bg-grey-500 hover:bg-grey-700 aria-checked:bg-blue-500 aria-checked:hover:bg-blue-700': !props.disabled,
|
|
7971
|
+
'bg-grey-500 aria-checked:bg-blue-500 cursor-not-allowed opacity-50': props.disabled
|
|
7972
|
+
}, props.className);
|
|
7973
|
+
return /*#__PURE__*/React.createElement(PrimitiveSwitch.Root, Object.assign({}, otherProps, {
|
|
7974
|
+
className: className,
|
|
7975
|
+
"data-taco": "mode",
|
|
7976
|
+
onCheckedChange: onChange,
|
|
7977
|
+
ref: ref
|
|
7978
|
+
}), /*#__PURE__*/React.createElement(PrimitiveSwitch.Thumb, {
|
|
7979
|
+
className: "'will-change-transform flex h-6 w-6 items-center justify-center rounded-full bg-white transition-transform group-disabled:opacity-50 group-aria-checked:translate-x-[100%]"
|
|
7980
|
+
}, /*#__PURE__*/React.createElement(Icon, {
|
|
7981
|
+
name: "edit-simple",
|
|
7982
|
+
className: "!h-5 !w-5"
|
|
7983
|
+
})));
|
|
7984
|
+
});
|
|
7985
|
+
ModeSwitch.displayName = 'ModeSwitch';
|
|
7986
|
+
|
|
7946
7987
|
const TreeviewItem = /*#__PURE__*/React__default.forwardRef(function TreeviewItem(props, ref) {
|
|
7947
7988
|
return /*#__PURE__*/React__default.createElement("a", Object.assign({}, props, {
|
|
7948
7989
|
ref: ref
|
|
@@ -16009,7 +16050,7 @@ function Menu$3(props) {
|
|
|
16009
16050
|
// we do this in the next tick, otherwise the menu closes and react throws a "state update on unmounted component" error
|
|
16010
16051
|
const handleClick = event => setTimeout(() => handleHide(event), 1);
|
|
16011
16052
|
menuItems.push( /*#__PURE__*/React__default.createElement(Menu$1.Item, {
|
|
16012
|
-
icon: "
|
|
16053
|
+
icon: "eye-off",
|
|
16013
16054
|
onClick: handleClick
|
|
16014
16055
|
}, texts.table3.columns.menu.hideColumn));
|
|
16015
16056
|
}
|
|
@@ -16656,7 +16697,7 @@ const getInputAppearanceClassnames = () => {
|
|
|
16656
16697
|
return cn('[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none');
|
|
16657
16698
|
};
|
|
16658
16699
|
|
|
16659
|
-
const useCssGrid = (table, isPrintTable = false) => {
|
|
16700
|
+
const useCssGrid = (table, isPrintTable = false, actionsForRowLength = 0) => {
|
|
16660
16701
|
const allVisibleColumns = table.getVisibleLeafColumns();
|
|
16661
16702
|
const columnSizing = table.getState().columnSizing;
|
|
16662
16703
|
const rowsLength = table.getRowModel().rows.length;
|
|
@@ -16675,7 +16716,8 @@ const useCssGrid = (table, isPrintTable = false) => {
|
|
|
16675
16716
|
size = `minmax(${PRINT_MIN_COLUMN_SIZE}px, ${maxWidth})`;
|
|
16676
16717
|
} else if (isColumnInternal) {
|
|
16677
16718
|
if (column.id === COLUMN_ID) {
|
|
16678
|
-
|
|
16719
|
+
const minWidth = actionsForRowLength * 32 + 8 /* button margins l+r */ + 8; /* cell padding l+r */
|
|
16720
|
+
size = `minmax(${minWidth}px, auto)`;
|
|
16679
16721
|
} else {
|
|
16680
16722
|
// getSize method is used instead of columnSizing state because columnSizing state doesn't have
|
|
16681
16723
|
// sizes of internal columns.
|
|
@@ -16768,16 +16810,31 @@ function useCurrentRow(defaultCurrentRowIndex) {
|
|
|
16768
16810
|
// do it in the next tick, otherwise it prevents internal focus from working
|
|
16769
16811
|
// meaning you have to tab twice to get to the first focusable element
|
|
16770
16812
|
setTimeout(() => {
|
|
16771
|
-
setCurrentRowIndex(
|
|
16772
|
-
|
|
16813
|
+
setCurrentRowIndex(index => {
|
|
16814
|
+
if (index === undefined) {
|
|
16815
|
+
scrollToIndex(0);
|
|
16816
|
+
return 0;
|
|
16817
|
+
}
|
|
16818
|
+
return index;
|
|
16819
|
+
});
|
|
16773
16820
|
}, 1);
|
|
16774
16821
|
}
|
|
16775
16822
|
}, [currentRowIndex, length]);
|
|
16823
|
+
const onMouseCapture = React__default.useCallback((event, length) => {
|
|
16824
|
+
if (event.isDefaultPrevented()) {
|
|
16825
|
+
return;
|
|
16826
|
+
}
|
|
16827
|
+
if (currentRowIndex === undefined && length > 0) {
|
|
16828
|
+
event.preventDefault();
|
|
16829
|
+
event.stopPropagation();
|
|
16830
|
+
}
|
|
16831
|
+
}, [currentRowIndex, length]);
|
|
16776
16832
|
return {
|
|
16777
16833
|
currentRowIndex,
|
|
16778
16834
|
setCurrentRowIndex,
|
|
16779
16835
|
handleFocus: onFocus,
|
|
16780
|
-
handleKeyDown: onKeyDown
|
|
16836
|
+
handleKeyDown: onKeyDown,
|
|
16837
|
+
handleMouseCapture: onMouseCapture
|
|
16781
16838
|
};
|
|
16782
16839
|
}
|
|
16783
16840
|
const getNextIndex$2 = (direction, currentIndex, length) => {
|
|
@@ -20145,15 +20202,8 @@ function EditButton(props) {
|
|
|
20145
20202
|
texts
|
|
20146
20203
|
} = useLocalization();
|
|
20147
20204
|
const tableMeta = props.table.options.meta;
|
|
20148
|
-
|
|
20149
|
-
|
|
20150
|
-
});
|
|
20151
|
-
const handleClick = () => tableMeta.editing.toggleEditing(!tableMeta.editing.isEditing);
|
|
20152
|
-
return /*#__PURE__*/React__default.createElement(Button$1, {
|
|
20153
|
-
"aria-pressed": tableMeta.editing.isEditing,
|
|
20154
|
-
className: className,
|
|
20155
|
-
onClick: handleClick,
|
|
20156
|
-
tooltip: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.editing.buttons.edit.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
|
|
20205
|
+
return /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
20206
|
+
title: /*#__PURE__*/React__default.createElement(React__default.Fragment, null, texts.table3.editing.buttons.edit.tooltip, /*#__PURE__*/React__default.createElement(Shortcut, {
|
|
20157
20207
|
className: "ml-2",
|
|
20158
20208
|
keys: {
|
|
20159
20209
|
key: 'e',
|
|
@@ -20161,10 +20211,11 @@ function EditButton(props) {
|
|
|
20161
20211
|
shift: false
|
|
20162
20212
|
}
|
|
20163
20213
|
}))
|
|
20164
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
20165
|
-
"aria-
|
|
20166
|
-
|
|
20167
|
-
|
|
20214
|
+
}, /*#__PURE__*/React__default.createElement(ModeSwitch, {
|
|
20215
|
+
"aria-pressed": tableMeta.editing.isEditing,
|
|
20216
|
+
checked: tableMeta.editing.isEditing,
|
|
20217
|
+
onChange: tableMeta.editing.toggleEditing
|
|
20218
|
+
}));
|
|
20168
20219
|
}
|
|
20169
20220
|
|
|
20170
20221
|
const PRINT_STYLES = `
|
|
@@ -21185,12 +21236,16 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
|
21185
21236
|
// scrollToIndex function changes when row count changes, so it is important to update handlers with new
|
|
21186
21237
|
// scrollToIndex function.
|
|
21187
21238
|
[scrollToIndex, tableMeta.editing.isEditing, internalRef.current]);
|
|
21188
|
-
const handleBlur = event => {
|
|
21239
|
+
const handleBlur = tableMeta.editing.isEnabled ? event => {
|
|
21189
21240
|
tableMeta.editing.handleBlur(event);
|
|
21190
|
-
};
|
|
21191
|
-
const handleFocus = event => {
|
|
21241
|
+
} : undefined;
|
|
21242
|
+
const handleFocus = tableMeta.currentRow.currentRowIndex === undefined ? event => {
|
|
21192
21243
|
tableMeta.currentRow.handleFocus(event, table.getRowModel().rows.length, scrollToIndex);
|
|
21193
|
-
};
|
|
21244
|
+
} : undefined;
|
|
21245
|
+
// mouse capture fires before focus, so we can prevent propagation and stop double setting of the active row
|
|
21246
|
+
const handleMouseCapture = tableMeta.currentRow.currentRowIndex === undefined ? event => {
|
|
21247
|
+
tableMeta.currentRow.handleMouseCapture(event, table.getRowModel().rows.length);
|
|
21248
|
+
} : undefined;
|
|
21194
21249
|
const handleScroll = function (event) {
|
|
21195
21250
|
try {
|
|
21196
21251
|
tableMeta.columnFreezing.handleScroll(event);
|
|
@@ -21208,7 +21263,7 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
|
21208
21263
|
// if the table is a print table or not.
|
|
21209
21264
|
const {
|
|
21210
21265
|
style: cssGridStyle
|
|
21211
|
-
} = useCssGrid(table, tableMeta.isPrinting);
|
|
21266
|
+
} = useCssGrid(table, tableMeta.isPrinting, tableMeta.rowActions.actionsForRowLength);
|
|
21212
21267
|
const {
|
|
21213
21268
|
style: cssVars
|
|
21214
21269
|
} = useCssVars(tableMeta.rowHeight.height, tableMeta.fontSize.size);
|
|
@@ -21263,6 +21318,7 @@ const Table$1 = /*#__PURE__*/fixedForwardRef(function Table3(props, ref) {
|
|
|
21263
21318
|
})))))), table.getRowModel().rows.length ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(focus.FocusScope, {
|
|
21264
21319
|
autoFocus: tableMeta.editing.isEditing
|
|
21265
21320
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
21321
|
+
onMouseDownCapture: handleMouseCapture,
|
|
21266
21322
|
className: "group/body contents",
|
|
21267
21323
|
"data-taco": "table2-body",
|
|
21268
21324
|
role: "rowgroup",
|
|
@@ -22268,6 +22324,7 @@ exports.Listbox = Listbox;
|
|
|
22268
22324
|
exports.LocalizationContext = LocalizationContext;
|
|
22269
22325
|
exports.LocalizationProvider = LocalizationProvider;
|
|
22270
22326
|
exports.Menu = Menu$1;
|
|
22327
|
+
exports.ModeSwitch = ModeSwitch;
|
|
22271
22328
|
exports.MultiListbox = MultiListbox;
|
|
22272
22329
|
exports.Navigation = Navigation;
|
|
22273
22330
|
exports.Navigation2 = Navigation2;
|