@economic/taco 1.34.2 → 1.35.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/dist/components/Provider/Localization.d.ts +3 -0
- package/dist/components/Select2/Select2.d.ts +2 -2
- package/dist/components/Select2/hooks/useChildren.d.ts +3 -4
- package/dist/components/Select2/types.d.ts +3 -0
- package/dist/components/Table2/Table2.d.ts +3 -0
- package/dist/components/Table2/types.d.ts +2 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js +3 -0
- package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/Select2.js +20 -2
- package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js +2 -1
- package/dist/esm/packages/taco/src/components/Select2/components/Option.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js +2 -9
- package/dist/esm/packages/taco/src/components/Select2/hooks/useChildren.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table2/Table2.js +10 -1
- package/dist/esm/packages/taco/src/components/Table2/Table2.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table2/components/ColumnSettingsButton.js +4 -3
- package/dist/esm/packages/taco/src/components/Table2/components/ColumnSettingsButton.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table2/components/column/Header.js +4 -1
- package/dist/esm/packages/taco/src/components/Table2/components/column/Header.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table2/components/row/Row.js +4 -0
- package/dist/esm/packages/taco/src/components/Table2/components/row/Row.js.map +1 -1
- package/dist/esm/packages/taco/src/components/Table2/types.js.map +1 -1
- package/dist/taco.cjs.development.js +48 -16
- 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 +30 -3
|
@@ -3938,6 +3938,9 @@ const defaultLocalisationTexts = {
|
|
|
3938
3938
|
},
|
|
3939
3939
|
table2: {
|
|
3940
3940
|
columns: {
|
|
3941
|
+
resize: {
|
|
3942
|
+
tooltip: 'Resize column'
|
|
3943
|
+
},
|
|
3941
3944
|
actions: {
|
|
3942
3945
|
tooltip: 'Other actions'
|
|
3943
3946
|
},
|
|
@@ -9069,6 +9072,7 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
|
|
|
9069
9072
|
color,
|
|
9070
9073
|
description,
|
|
9071
9074
|
icon,
|
|
9075
|
+
className: cName,
|
|
9072
9076
|
...otherProps
|
|
9073
9077
|
} = props;
|
|
9074
9078
|
const {
|
|
@@ -9082,7 +9086,7 @@ const Option$1 = /*#__PURE__*/React__default.forwardRef(function Select2Option(p
|
|
|
9082
9086
|
tags,
|
|
9083
9087
|
value
|
|
9084
9088
|
} = useSelect2Context();
|
|
9085
|
-
const className = createOptionClassName(shouldPauseHoverState);
|
|
9089
|
+
const className = cn(createOptionClassName(shouldPauseHoverState), cName);
|
|
9086
9090
|
const hasValue = Array.isArray(value) ? !!value.length : value !== undefined;
|
|
9087
9091
|
const isTag = tags && !!color;
|
|
9088
9092
|
const handleClick = () => {
|
|
@@ -9549,17 +9553,11 @@ const useChildren = ({
|
|
|
9549
9553
|
if (isGroup(child)) {
|
|
9550
9554
|
return child.props.children;
|
|
9551
9555
|
}
|
|
9556
|
+
// Since we are filtering out groups just above, then casting child to React.ReactElement<Select2OptionProps>, to avoid type inconsistency errors.
|
|
9552
9557
|
return child;
|
|
9553
9558
|
}).flatMap(c => c)) || [];
|
|
9554
|
-
if (emptyValue !== undefined && !multiple) {
|
|
9555
|
-
return [/*#__PURE__*/React__default.createElement(Option$1, {
|
|
9556
|
-
key: "__empty",
|
|
9557
|
-
children: "",
|
|
9558
|
-
value: emptyValue
|
|
9559
|
-
}), ...initial];
|
|
9560
|
-
}
|
|
9561
9559
|
return initial;
|
|
9562
|
-
}, [initialChildren
|
|
9560
|
+
}, [initialChildren]);
|
|
9563
9561
|
// set an initial value if none is set, we have to trigger state updates for controlled components
|
|
9564
9562
|
React__default.useEffect(() => {
|
|
9565
9563
|
if (!multiple && emptyValue === undefined && value === undefined) {
|
|
@@ -9698,7 +9696,7 @@ const useIsHoverStatePaused = () => {
|
|
|
9698
9696
|
|
|
9699
9697
|
const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, ref) {
|
|
9700
9698
|
const {
|
|
9701
|
-
children:
|
|
9699
|
+
children: initChildren,
|
|
9702
9700
|
defaultValue: defaultProp,
|
|
9703
9701
|
disabled = false,
|
|
9704
9702
|
emptyValue = undefined,
|
|
@@ -9715,6 +9713,24 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
|
9715
9713
|
value: prop,
|
|
9716
9714
|
...otherProps
|
|
9717
9715
|
} = props;
|
|
9716
|
+
const emptyOption = React__default.useMemo(() => {
|
|
9717
|
+
if (emptyValue !== undefined && !multiple) {
|
|
9718
|
+
// Empty option has 0px height, because it's empty, so need to apply height manually
|
|
9719
|
+
return /*#__PURE__*/React__default.createElement(Option$1, {
|
|
9720
|
+
key: "__empty",
|
|
9721
|
+
children: "",
|
|
9722
|
+
value: emptyValue,
|
|
9723
|
+
className: "h-8"
|
|
9724
|
+
});
|
|
9725
|
+
}
|
|
9726
|
+
return;
|
|
9727
|
+
}, [emptyValue, multiple]);
|
|
9728
|
+
const initialChildren = React__default.useMemo(() => {
|
|
9729
|
+
if (emptyOption) {
|
|
9730
|
+
return [emptyOption, ...initChildren];
|
|
9731
|
+
}
|
|
9732
|
+
return initChildren;
|
|
9733
|
+
}, [emptyOption, initChildren]);
|
|
9718
9734
|
// refs
|
|
9719
9735
|
const internalRef = useMergedRef(ref);
|
|
9720
9736
|
const listboxRef = React__default.useRef(null);
|
|
@@ -9868,7 +9884,7 @@ const Select2 = /*#__PURE__*/React__default.forwardRef(function Select2(props, r
|
|
|
9868
9884
|
setValue: setValue,
|
|
9869
9885
|
tabIndex: -1,
|
|
9870
9886
|
value: value
|
|
9871
|
-
}, /*#__PURE__*/React__default.createElement(Collection$1, null, filteredChildren), onCreate ? /*#__PURE__*/React__default.createElement(Create, {
|
|
9887
|
+
}, searchQuery === '' ? /*#__PURE__*/React__default.createElement(Collection$1, null, initialChildren) : /*#__PURE__*/React__default.createElement(Collection$1, null, filteredChildren), onCreate ? /*#__PURE__*/React__default.createElement(Create, {
|
|
9872
9888
|
onCreate: onCreate,
|
|
9873
9889
|
options: flattenedChildren
|
|
9874
9890
|
}) : null))))));
|
|
@@ -12930,6 +12946,9 @@ const Header$1 = function Header(props) {
|
|
|
12930
12946
|
className: "truncate",
|
|
12931
12947
|
ref: textRef
|
|
12932
12948
|
}, reactTable$1.flexRender(header.column.columnDef.header, header.getContext()));
|
|
12949
|
+
const {
|
|
12950
|
+
texts
|
|
12951
|
+
} = useLocalization();
|
|
12933
12952
|
return /*#__PURE__*/React__default.createElement(ColumnBase, Object.assign({}, columnProps, {
|
|
12934
12953
|
// base props
|
|
12935
12954
|
column: header.column,
|
|
@@ -12966,7 +12985,7 @@ const Header$1 = function Header(props) {
|
|
|
12966
12985
|
columnIndex: index
|
|
12967
12986
|
}) : null), header.column.getCanResize() ? /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
12968
12987
|
placement: "top",
|
|
12969
|
-
title:
|
|
12988
|
+
title: texts.table2.columns.resize.tooltip
|
|
12970
12989
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
12971
12990
|
className: cn('invisible absolute right-0 top-0 flex h-full cursor-col-resize touch-none select-none rounded py-0.5 group-hover/header:visible', {
|
|
12972
12991
|
'-mr-2.5 w-5 justify-center': !isLastColumn,
|
|
@@ -13775,10 +13794,11 @@ const Column$1 = /*#__PURE__*/React__default.forwardRef(function Column(props, r
|
|
|
13775
13794
|
});
|
|
13776
13795
|
const attributes = draggable ? dragAttributes : undefined;
|
|
13777
13796
|
const text = getColumnName(column);
|
|
13797
|
+
const isVisible = column.getIsVisible();
|
|
13778
13798
|
return /*#__PURE__*/React__default.createElement("div", Object.assign({}, attributes, {
|
|
13779
13799
|
key: column.id,
|
|
13780
13800
|
className: className,
|
|
13781
|
-
onClick: () => column.toggleVisibility(),
|
|
13801
|
+
onClick: () => column.toggleVisibility(!isVisible),
|
|
13782
13802
|
ref: ref
|
|
13783
13803
|
}), draggable ? /*#__PURE__*/React__default.createElement(Icon, {
|
|
13784
13804
|
name: "drag",
|
|
@@ -13790,8 +13810,8 @@ const Column$1 = /*#__PURE__*/React__default.forwardRef(function Column(props, r
|
|
|
13790
13810
|
}, /*#__PURE__*/React__default.createElement("span", {
|
|
13791
13811
|
className: "flex-grow select-none"
|
|
13792
13812
|
}, text)), canHide ? /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
13793
|
-
checked:
|
|
13794
|
-
onChange: column.toggleVisibility
|
|
13813
|
+
checked: isVisible,
|
|
13814
|
+
onChange: () => column.toggleVisibility(!isVisible)
|
|
13795
13815
|
}) : null);
|
|
13796
13816
|
});
|
|
13797
13817
|
function ColumnSettingsButton(props) {
|
|
@@ -13972,6 +13992,7 @@ function BatchActionsMenu({
|
|
|
13972
13992
|
}
|
|
13973
13993
|
|
|
13974
13994
|
const InternalRow = ({
|
|
13995
|
+
onRowDrop,
|
|
13975
13996
|
row,
|
|
13976
13997
|
rowIndex,
|
|
13977
13998
|
table,
|
|
@@ -13983,8 +14004,10 @@ const InternalRow = ({
|
|
|
13983
14004
|
const meta = table.options.meta;
|
|
13984
14005
|
const isActiveRow = meta.activeRowIndex === rowIndex;
|
|
13985
14006
|
const isDragging = meta.dragging[row.id];
|
|
14007
|
+
const [, dropTargetProps] = useDropTarget(event => onRowDrop(event, row.original));
|
|
13986
14008
|
const attributes = {
|
|
13987
14009
|
...props,
|
|
14010
|
+
...(typeof onRowDrop === 'function' ? dropTargetProps : undefined),
|
|
13988
14011
|
'aria-current': isActiveRow ? true : undefined,
|
|
13989
14012
|
'aria-grabbed': isDragging ? true : undefined,
|
|
13990
14013
|
'data-row-index': rowIndex,
|
|
@@ -14506,7 +14529,7 @@ function Column$3(_) {
|
|
|
14506
14529
|
return null;
|
|
14507
14530
|
}
|
|
14508
14531
|
Column$3.displayName = 'Table2Column';
|
|
14509
|
-
const
|
|
14532
|
+
const BaseTable2 = /*#__PURE__*/React__default.forwardRef(function BaseTable2(props, ref) {
|
|
14510
14533
|
// dom
|
|
14511
14534
|
const {
|
|
14512
14535
|
emptyState: EmptyState,
|
|
@@ -14514,6 +14537,7 @@ const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref
|
|
|
14514
14537
|
length = props.data.length,
|
|
14515
14538
|
loadMore,
|
|
14516
14539
|
onRowClick,
|
|
14540
|
+
onRowDrop,
|
|
14517
14541
|
toolbarLeft,
|
|
14518
14542
|
toolbarRight,
|
|
14519
14543
|
_experimentalActionsForTable,
|
|
@@ -14827,6 +14851,7 @@ const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref
|
|
|
14827
14851
|
key: row.id
|
|
14828
14852
|
}, /*#__PURE__*/React__default.createElement(Row$1, {
|
|
14829
14853
|
className: "group/row contents",
|
|
14854
|
+
onRowDrop: onRowDrop,
|
|
14830
14855
|
row: row,
|
|
14831
14856
|
rowIndex: virtualRow.index,
|
|
14832
14857
|
table: table
|
|
@@ -14874,6 +14899,13 @@ const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref
|
|
|
14874
14899
|
table: table
|
|
14875
14900
|
}) : null);
|
|
14876
14901
|
});
|
|
14902
|
+
const Table2 = /*#__PURE__*/React__default.forwardRef(function Table2(props, ref) {
|
|
14903
|
+
const key = React__default.useMemo(() => String('tableKey_' + String(props.children)), [props.children]);
|
|
14904
|
+
return /*#__PURE__*/React__default.createElement(BaseTable2, Object.assign({}, props, {
|
|
14905
|
+
key: key,
|
|
14906
|
+
ref: ref
|
|
14907
|
+
}));
|
|
14908
|
+
});
|
|
14877
14909
|
Table2.Column = Column$3;
|
|
14878
14910
|
|
|
14879
14911
|
const Tabs = /*#__PURE__*/React.forwardRef(function Tabs(props, ref) {
|