@synerise/ds-mapping 1.1.34 → 1.1.36

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.1.36](https://github.com/Synerise/synerise-design/compare/@synerise/ds-mapping@1.1.35...@synerise/ds-mapping@1.1.36) (2026-04-01)
7
+
8
+ **Note:** Version bump only for package @synerise/ds-mapping
9
+
10
+ ## [1.1.35](https://github.com/Synerise/synerise-design/compare/@synerise/ds-mapping@1.1.34...@synerise/ds-mapping@1.1.35) (2026-03-24)
11
+
12
+ **Note:** Version bump only for package @synerise/ds-mapping
13
+
6
14
  ## [1.1.34](https://github.com/Synerise/synerise-design/compare/@synerise/ds-mapping@1.1.33...@synerise/ds-mapping@1.1.34) (2026-03-20)
7
15
 
8
16
  **Note:** Version bump only for package @synerise/ds-mapping
package/dist/Mapping.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
2
- import type { BaseItemType, MappingProps } from './Mapping.types';
1
+ import { default as React } from 'react';
2
+ import { BaseItemType, MappingProps } from './Mapping.types';
3
3
  declare const Mapping: <ItemType extends BaseItemType>({ batchSelection, dataSource, leftTitle, leftTitleTooltip, rightTitle, rightTitleTooltip, leftComponent, rightComponent, centerComponent, texts, ...htmlAttributes }: MappingProps<ItemType>) => React.JSX.Element;
4
4
  export default Mapping;
package/dist/Mapping.js CHANGED
@@ -1,106 +1,88 @@
1
- var _excluded = ["batchSelection", "dataSource", "leftTitle", "leftTitleTooltip", "rightTitle", "rightTitleTooltip", "leftComponent", "rightComponent", "centerComponent", "texts"];
2
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
- function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
4
- import React, { useCallback, useEffect, useMemo, useState } from 'react';
5
- import Button from '@synerise/ds-button';
6
- import Icon, { HideM, TaskCheckM } from '@synerise/ds-icon';
7
- import * as S from './Mapping.styles';
8
- import { BatchSelectionHeader, RowSelection, TitleRow } from './components';
9
- import { useBatchSelection } from './hooks/useBatchSelection';
10
- import { useTexts } from './hooks/useTexts';
11
- import { renderCounter as defaultRenderCounter } from './utils/counter';
12
- var Mapping = function Mapping(_ref) {
13
- var batchSelection = _ref.batchSelection,
14
- dataSource = _ref.dataSource,
15
- leftTitle = _ref.leftTitle,
16
- leftTitleTooltip = _ref.leftTitleTooltip,
17
- rightTitle = _ref.rightTitle,
18
- rightTitleTooltip = _ref.rightTitleTooltip,
19
- leftComponent = _ref.leftComponent,
20
- rightComponent = _ref.rightComponent,
21
- centerComponent = _ref.centerComponent,
22
- texts = _ref.texts,
23
- htmlAttributes = _objectWithoutPropertiesLoose(_ref, _excluded);
24
- var hasCenterComponent = !!centerComponent;
25
- var hasSelection = !!batchSelection;
26
- var isCompact = dataSource.length === 1;
27
- var _useState = useState(false),
28
- selectionEnabled = _useState[0],
29
- setSelectionEnabled = _useState[1];
30
- var allTexts = useTexts(texts);
31
- var _useBatchSelection = useBatchSelection(dataSource, hasSelection),
32
- selectedItemIds = _useBatchSelection.selectedItemIds,
33
- setSelectedItemIds = _useBatchSelection.setSelectedItemIds,
34
- handleBatchCheckboxChange = _useBatchSelection.handleBatchCheckboxChange,
35
- batchSelectionCheckboxState = _useBatchSelection.batchSelectionCheckboxState;
36
- var _ref2 = batchSelection || {},
37
- actionButtons = _ref2.actionButtons,
38
- onSelectionChange = _ref2.onSelectionChange,
39
- _ref2$renderCounter = _ref2.renderCounter,
40
- renderCounter = _ref2$renderCounter === void 0 ? defaultRenderCounter : _ref2$renderCounter;
41
- var handleItemSelection = function handleItemSelection(checked, id) {
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
+ import { useState, useCallback, useMemo, useEffect } from "react";
3
+ import Button from "@synerise/ds-button";
4
+ import Icon, { HideM, TaskCheckM } from "@synerise/ds-icon";
5
+ import { MappingWrapper, MappingRow, MappingRowLeft, MappingRowCenter, MappingRowRight } from "./Mapping.styles.js";
6
+ import { BatchSelectionHeader } from "./components/BatchSelectionHeader/BatchSelectionHeader.js";
7
+ import { RowSelection } from "./components/RowSelection/RowSelection.js";
8
+ import { TitleRow } from "./components/TitleRow/TitleRow.js";
9
+ import { useBatchSelection } from "./hooks/useBatchSelection.js";
10
+ import { useTexts } from "./hooks/useTexts.js";
11
+ import { renderCounter } from "./utils/counter.js";
12
+ const Mapping = ({
13
+ batchSelection,
14
+ dataSource,
15
+ leftTitle,
16
+ leftTitleTooltip,
17
+ rightTitle,
18
+ rightTitleTooltip,
19
+ leftComponent,
20
+ rightComponent,
21
+ centerComponent,
22
+ texts,
23
+ ...htmlAttributes
24
+ }) => {
25
+ const hasCenterComponent = !!centerComponent;
26
+ const hasSelection = !!batchSelection;
27
+ const isCompact = dataSource.length === 1;
28
+ const [selectionEnabled, setSelectionEnabled] = useState(false);
29
+ const allTexts = useTexts(texts);
30
+ const {
31
+ selectedItemIds,
32
+ setSelectedItemIds,
33
+ handleBatchCheckboxChange,
34
+ batchSelectionCheckboxState
35
+ } = useBatchSelection(dataSource, hasSelection);
36
+ const {
37
+ actionButtons,
38
+ onSelectionChange,
39
+ renderCounter: renderCounter$1 = renderCounter
40
+ } = batchSelection || {};
41
+ const handleItemSelection = (checked, id) => {
42
42
  if (checked) {
43
- setSelectedItemIds([].concat(selectedItemIds, [id]));
43
+ setSelectedItemIds([...selectedItemIds, id]);
44
44
  } else {
45
- setSelectedItemIds(selectedItemIds.filter(function (itemId) {
46
- return itemId !== id;
47
- }));
45
+ setSelectedItemIds(selectedItemIds.filter((itemId) => itemId !== id));
48
46
  }
49
47
  };
50
- var toggleBatchButton = useCallback(function (newState) {
48
+ const toggleBatchButton = useCallback((newState) => {
51
49
  setSelectionEnabled(newState);
52
50
  setSelectedItemIds([]);
53
51
  }, [setSelectedItemIds]);
54
- var batchButton = useMemo(function () {
55
- return /*#__PURE__*/React.createElement(Button, {
56
- "data-testid": "toggle-bulk-actions",
57
- type: "ghost",
58
- mode: "icon-label",
59
- onClick: function onClick() {
60
- return toggleBatchButton(!selectionEnabled);
61
- }
62
- }, selectionEnabled ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, {
63
- component: /*#__PURE__*/React.createElement(HideM, null)
64
- }), " ", allTexts.disableBatchSelection) : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Icon, {
65
- component: /*#__PURE__*/React.createElement(TaskCheckM, null)
66
- }), " ", allTexts.enableBatchSelection));
52
+ const batchButton = useMemo(() => {
53
+ return /* @__PURE__ */ jsx(Button, { "data-testid": "toggle-bulk-actions", type: "ghost", mode: "icon-label", onClick: () => toggleBatchButton(!selectionEnabled), children: selectionEnabled ? /* @__PURE__ */ jsxs(Fragment, { children: [
54
+ /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(HideM, {}) }),
55
+ " ",
56
+ allTexts.disableBatchSelection
57
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
58
+ /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(TaskCheckM, {}) }),
59
+ " ",
60
+ allTexts.enableBatchSelection
61
+ ] }) });
67
62
  }, [allTexts.disableBatchSelection, allTexts.enableBatchSelection, selectionEnabled, toggleBatchButton]);
68
- useEffect(function () {
63
+ useEffect(() => {
69
64
  onSelectionChange && onSelectionChange(selectedItemIds);
70
65
  }, [onSelectionChange, selectedItemIds]);
71
- return /*#__PURE__*/React.createElement(S.MappingWrapper, _extends({
72
- isCompact: isCompact
73
- }, htmlAttributes), batchSelection && /*#__PURE__*/React.createElement(BatchSelectionHeader, {
74
- checkboxState: batchSelectionCheckboxState,
75
- onChange: handleBatchCheckboxChange,
76
- actionButtons: actionButtons,
77
- batchButton: batchButton,
78
- enabled: selectionEnabled,
79
- counter: renderCounter(selectedItemIds.length, dataSource.length)
80
- }), (leftTitle || rightTitle) && /*#__PURE__*/React.createElement(TitleRow, {
81
- leftTitle: leftTitle,
82
- rightTitle: rightTitle,
83
- leftTitleTooltip: leftTitleTooltip,
84
- rightTitleTooltip: rightTitleTooltip,
85
- hasCenterComponent: hasCenterComponent,
86
- hasSelection: hasSelection && selectionEnabled
87
- }), dataSource.map(function (item, index) {
88
- return /*#__PURE__*/React.createElement(S.MappingRow, {
89
- key: item.id
90
- }, hasSelection && selectionEnabled && /*#__PURE__*/React.createElement(RowSelection, {
91
- checkboxState: selectedItemIds.includes(item.id),
92
- itemId: item.id,
93
- onChange: handleItemSelection
94
- }), /*#__PURE__*/React.createElement(S.MappingRowLeft, null, leftComponent({
95
- item: item,
96
- index: index
97
- })), hasCenterComponent && /*#__PURE__*/React.createElement(S.MappingRowCenter, null, centerComponent({
98
- item: item,
99
- index: index
100
- })), /*#__PURE__*/React.createElement(S.MappingRowRight, null, rightComponent({
101
- item: item,
102
- index: index
103
- })));
104
- }));
66
+ return /* @__PURE__ */ jsxs(MappingWrapper, { isCompact, ...htmlAttributes, children: [
67
+ batchSelection && /* @__PURE__ */ jsx(BatchSelectionHeader, { checkboxState: batchSelectionCheckboxState, onChange: handleBatchCheckboxChange, actionButtons, batchButton, enabled: selectionEnabled, counter: renderCounter$1(selectedItemIds.length, dataSource.length) }),
68
+ (leftTitle || rightTitle) && /* @__PURE__ */ jsx(TitleRow, { leftTitle, rightTitle, leftTitleTooltip, rightTitleTooltip, hasCenterComponent, hasSelection: hasSelection && selectionEnabled }),
69
+ dataSource.map((item, index) => /* @__PURE__ */ jsxs(MappingRow, { children: [
70
+ hasSelection && selectionEnabled && /* @__PURE__ */ jsx(RowSelection, { checkboxState: selectedItemIds.includes(item.id), itemId: item.id, onChange: handleItemSelection }),
71
+ /* @__PURE__ */ jsx(MappingRowLeft, { children: leftComponent({
72
+ item,
73
+ index
74
+ }) }),
75
+ hasCenterComponent && /* @__PURE__ */ jsx(MappingRowCenter, { children: centerComponent({
76
+ item,
77
+ index
78
+ }) }),
79
+ /* @__PURE__ */ jsx(MappingRowRight, { children: rightComponent({
80
+ item,
81
+ index
82
+ }) })
83
+ ] }, item.id))
84
+ ] });
85
+ };
86
+ export {
87
+ Mapping as default
105
88
  };
106
- export default Mapping;
@@ -1,14 +1,14 @@
1
- export declare const MappingWrapper: import("styled-components").StyledComponent<"div", any, {
1
+ export declare const MappingWrapper: import('styled-components').StyledComponent<"div", any, {
2
2
  isCompact: boolean;
3
3
  }, never>;
4
- export declare const MappingRow: import("styled-components").StyledComponent<"div", any, {}, never>;
5
- export declare const MappingRowLeft: import("styled-components").StyledComponent<"div", any, {}, never>;
6
- export declare const MappingRowRight: import("styled-components").StyledComponent<"div", any, {}, never>;
7
- export declare const MappingRowCenter: import("styled-components").StyledComponent<"div", any, {}, never>;
8
- export declare const RowSelectionWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
9
- export declare const ColumnTitle: import("styled-components").StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import("@synerise/ds-typography/dist/Title.types").Props) => React.JSX.Element, any, {}, never>;
10
- export declare const BatchSelectionWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
11
- export declare const BatchActionButtons: import("styled-components").StyledComponent<"div", any, {}, never>;
12
- export declare const BatchCounter: import("styled-components").StyledComponent<"div", any, {}, never>;
13
- export declare const BatchSelectionInner: import("styled-components").StyledComponent<"div", any, {}, never>;
14
- export declare const BatchToggleButton: import("styled-components").StyledComponent<"div", any, {}, never>;
4
+ export declare const MappingRow: import('styled-components').StyledComponent<"div", any, {}, never>;
5
+ export declare const MappingRowLeft: import('styled-components').StyledComponent<"div", any, {}, never>;
6
+ export declare const MappingRowRight: import('styled-components').StyledComponent<"div", any, {}, never>;
7
+ export declare const MappingRowCenter: import('styled-components').StyledComponent<"div", any, {}, never>;
8
+ export declare const RowSelectionWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
9
+ export declare const ColumnTitle: import('styled-components').StyledComponent<({ level, withoutMargin, children, className, ellipsis, ...antdProps }: import('@synerise/ds-typography/dist/Title.types').Props) => React.JSX.Element, any, {}, never>;
10
+ export declare const BatchSelectionWrapper: import('styled-components').StyledComponent<"div", any, {}, never>;
11
+ export declare const BatchActionButtons: import('styled-components').StyledComponent<"div", any, {}, never>;
12
+ export declare const BatchCounter: import('styled-components').StyledComponent<"div", any, {}, never>;
13
+ export declare const BatchSelectionInner: import('styled-components').StyledComponent<"div", any, {}, never>;
14
+ export declare const BatchToggleButton: import('styled-components').StyledComponent<"div", any, {}, never>;
@@ -1,54 +1,64 @@
1
- import styled from 'styled-components';
2
- import { Title } from '@synerise/ds-typography';
3
- export var MappingWrapper = styled.div.withConfig({
1
+ import styled from "styled-components";
2
+ import { Title } from "@synerise/ds-typography";
3
+ const MappingWrapper = /* @__PURE__ */ styled.div.withConfig({
4
4
  displayName: "Mappingstyles__MappingWrapper",
5
5
  componentId: "sc-1f47eqt-0"
6
- })(["display:flex;flex-direction:column;", ";"], function (props) {
7
- return !props.isCompact && "gap: 16px";
8
- });
9
- export var MappingRow = styled.div.withConfig({
6
+ })(["display:flex;flex-direction:column;", ";"], (props) => !props.isCompact && `gap: 16px`);
7
+ const MappingRow = /* @__PURE__ */ styled.div.withConfig({
10
8
  displayName: "Mappingstyles__MappingRow",
11
9
  componentId: "sc-1f47eqt-1"
12
10
  })(["display:flex;gap:14px;align-items:center;"]);
13
- export var MappingRowLeft = styled.div.withConfig({
11
+ const MappingRowLeft = /* @__PURE__ */ styled.div.withConfig({
14
12
  displayName: "Mappingstyles__MappingRowLeft",
15
13
  componentId: "sc-1f47eqt-2"
16
14
  })(["flex:1 1 50%;"]);
17
- export var MappingRowRight = styled.div.withConfig({
15
+ const MappingRowRight = /* @__PURE__ */ styled.div.withConfig({
18
16
  displayName: "Mappingstyles__MappingRowRight",
19
17
  componentId: "sc-1f47eqt-3"
20
18
  })(["flex:1 1 50%;"]);
21
- export var MappingRowCenter = styled.div.withConfig({
19
+ const MappingRowCenter = /* @__PURE__ */ styled.div.withConfig({
22
20
  displayName: "Mappingstyles__MappingRowCenter",
23
21
  componentId: "sc-1f47eqt-4"
24
22
  })(["flex:0 0 32px;display:flex;justify-content:center;"]);
25
- export var RowSelectionWrapper = styled.div.withConfig({
23
+ const RowSelectionWrapper = /* @__PURE__ */ styled.div.withConfig({
26
24
  displayName: "Mappingstyles__RowSelectionWrapper",
27
25
  componentId: "sc-1f47eqt-5"
28
26
  })(["flex:0 0 32px;"]);
29
- export var ColumnTitle = styled(Title).withConfig({
27
+ const ColumnTitle = /* @__PURE__ */ styled(Title).withConfig({
30
28
  displayName: "Mappingstyles__ColumnTitle",
31
29
  componentId: "sc-1f47eqt-6"
32
30
  })([""]);
33
- export var BatchSelectionWrapper = styled.div.withConfig({
31
+ const BatchSelectionWrapper = /* @__PURE__ */ styled.div.withConfig({
34
32
  displayName: "Mappingstyles__BatchSelectionWrapper",
35
33
  componentId: "sc-1f47eqt-7"
36
- })(["display:flex;align-items:center;justify-content:space-between;gap:14px;border-bottom:solid 1px ", ";height:64px;"], function (props) {
37
- return props.theme.palette['grey-300'];
38
- });
39
- export var BatchActionButtons = styled.div.withConfig({
34
+ })(["display:flex;align-items:center;justify-content:space-between;gap:14px;border-bottom:solid 1px ", ";height:64px;"], (props) => props.theme.palette["grey-300"]);
35
+ const BatchActionButtons = /* @__PURE__ */ styled.div.withConfig({
40
36
  displayName: "Mappingstyles__BatchActionButtons",
41
37
  componentId: "sc-1f47eqt-8"
42
38
  })(["display:flex;gap:8px;"]);
43
- export var BatchCounter = styled.div.withConfig({
39
+ const BatchCounter = /* @__PURE__ */ styled.div.withConfig({
44
40
  displayName: "Mappingstyles__BatchCounter",
45
41
  componentId: "sc-1f47eqt-9"
46
42
  })(["white-space:nowrap;"]);
47
- export var BatchSelectionInner = styled.div.withConfig({
43
+ const BatchSelectionInner = /* @__PURE__ */ styled.div.withConfig({
48
44
  displayName: "Mappingstyles__BatchSelectionInner",
49
45
  componentId: "sc-1f47eqt-10"
50
46
  })(["display:flex;flex-grow:1;align-items:center;gap:24px;"]);
51
- export var BatchToggleButton = styled.div.withConfig({
47
+ const BatchToggleButton = /* @__PURE__ */ styled.div.withConfig({
52
48
  displayName: "Mappingstyles__BatchToggleButton",
53
49
  componentId: "sc-1f47eqt-11"
54
- })([""]);
50
+ })([""]);
51
+ export {
52
+ BatchActionButtons,
53
+ BatchCounter,
54
+ BatchSelectionInner,
55
+ BatchSelectionWrapper,
56
+ BatchToggleButton,
57
+ ColumnTitle,
58
+ MappingRow,
59
+ MappingRowCenter,
60
+ MappingRowLeft,
61
+ MappingRowRight,
62
+ MappingWrapper,
63
+ RowSelectionWrapper
64
+ };
@@ -1,7 +1,7 @@
1
- import { type ReactNode } from 'react';
2
- import { type CheckboxProps, type CheckboxTristateProps } from '@synerise/ds-checkbox';
3
- import { type TooltipProps } from '@synerise/ds-tooltip';
4
- import { type WithHTMLAttributes } from '@synerise/ds-utils';
1
+ import { ReactNode } from 'react';
2
+ import { CheckboxProps, CheckboxTristateProps } from '@synerise/ds-checkbox';
3
+ import { TooltipProps } from '@synerise/ds-tooltip';
4
+ import { WithHTMLAttributes } from '@synerise/ds-utils';
5
5
  export type BaseItemType = {
6
6
  id: string | number;
7
7
  };
@@ -1 +1 @@
1
- export {};
1
+
@@ -1,3 +1,3 @@
1
- import React from 'react';
2
- import { type BatchSelectionProps } from '../../Mapping.types';
1
+ import { default as React } from 'react';
2
+ import { BatchSelectionProps } from '../../Mapping.types';
3
3
  export declare const BatchSelectionHeader: ({ counter, checkboxState, onChange, actionButtons, batchButton, enabled, }: BatchSelectionProps) => React.JSX.Element;
@@ -1,24 +1,30 @@
1
- import React from 'react';
2
- import Checkbox from '@synerise/ds-checkbox';
3
- import * as S from '../../Mapping.styles';
4
- export var BatchSelectionHeader = function BatchSelectionHeader(_ref) {
5
- var counter = _ref.counter,
6
- checkboxState = _ref.checkboxState,
7
- onChange = _ref.onChange,
8
- actionButtons = _ref.actionButtons,
9
- batchButton = _ref.batchButton,
10
- enabled = _ref.enabled;
11
- var handleChange = function handleChange() {
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import Checkbox from "@synerise/ds-checkbox";
3
+ import { BatchSelectionWrapper, RowSelectionWrapper, BatchSelectionInner, BatchCounter, BatchActionButtons, BatchToggleButton } from "../../Mapping.styles.js";
4
+ const BatchSelectionHeader = ({
5
+ counter,
6
+ checkboxState,
7
+ onChange,
8
+ actionButtons,
9
+ batchButton,
10
+ enabled
11
+ }) => {
12
+ const handleChange = () => {
12
13
  if (checkboxState !== true) {
13
14
  onChange(true);
14
15
  } else {
15
16
  onChange(false);
16
17
  }
17
18
  };
18
- return /*#__PURE__*/React.createElement(S.BatchSelectionWrapper, null, enabled && /*#__PURE__*/React.createElement(S.RowSelectionWrapper, null, /*#__PURE__*/React.createElement(Checkbox, {
19
- tristate: true,
20
- withoutPadding: true,
21
- checked: checkboxState,
22
- onChange: handleChange
23
- })), /*#__PURE__*/React.createElement(S.BatchSelectionInner, null, /*#__PURE__*/React.createElement(S.BatchCounter, null, counter), enabled && checkboxState !== false && /*#__PURE__*/React.createElement(S.BatchActionButtons, null, actionButtons)), /*#__PURE__*/React.createElement(S.BatchToggleButton, null, batchButton));
24
- };
19
+ return /* @__PURE__ */ jsxs(BatchSelectionWrapper, { children: [
20
+ enabled && /* @__PURE__ */ jsx(RowSelectionWrapper, { children: /* @__PURE__ */ jsx(Checkbox, { tristate: true, withoutPadding: true, checked: checkboxState, onChange: handleChange }) }),
21
+ /* @__PURE__ */ jsxs(BatchSelectionInner, { children: [
22
+ /* @__PURE__ */ jsx(BatchCounter, { children: counter }),
23
+ enabled && checkboxState !== false && /* @__PURE__ */ jsx(BatchActionButtons, { children: actionButtons })
24
+ ] }),
25
+ /* @__PURE__ */ jsx(BatchToggleButton, { children: batchButton })
26
+ ] });
27
+ };
28
+ export {
29
+ BatchSelectionHeader
30
+ };
@@ -1,3 +1,3 @@
1
- import React from 'react';
2
- import type { BaseItemType, RowSelectionProps } from '../../Mapping.types';
1
+ import { default as React } from 'react';
2
+ import { BaseItemType, RowSelectionProps } from '../../Mapping.types';
3
3
  export declare const RowSelection: <T extends BaseItemType>({ itemId, checkboxState, onChange, }: RowSelectionProps<T>) => React.JSX.Element;
@@ -1,15 +1,13 @@
1
- import React from 'react';
2
- import Checkbox from '@synerise/ds-checkbox';
3
- import * as S from '../../Mapping.styles';
4
- export var RowSelection = function RowSelection(_ref) {
5
- var itemId = _ref.itemId,
6
- checkboxState = _ref.checkboxState,
7
- _onChange = _ref.onChange;
8
- return /*#__PURE__*/React.createElement(S.RowSelectionWrapper, null, /*#__PURE__*/React.createElement(Checkbox, {
9
- withoutPadding: true,
10
- checked: checkboxState,
11
- onChange: function onChange(event) {
12
- return _onChange(event.target.checked, itemId);
13
- }
14
- }));
15
- };
1
+ import { jsx } from "react/jsx-runtime";
2
+ import Checkbox from "@synerise/ds-checkbox";
3
+ import { RowSelectionWrapper } from "../../Mapping.styles.js";
4
+ const RowSelection = ({
5
+ itemId,
6
+ checkboxState,
7
+ onChange
8
+ }) => {
9
+ return /* @__PURE__ */ jsx(RowSelectionWrapper, { children: /* @__PURE__ */ jsx(Checkbox, { withoutPadding: true, checked: checkboxState, onChange: (event) => onChange(event.target.checked, itemId) }) });
10
+ };
11
+ export {
12
+ RowSelection
13
+ };
@@ -1,3 +1,3 @@
1
- import React from 'react';
2
- import type { TitleRowProps } from '../../Mapping.types';
1
+ import { default as React } from 'react';
2
+ import { TitleRowProps } from '../../Mapping.types';
3
3
  export declare const TitleRow: ({ leftTitle, leftTitleTooltip, rightTitle, rightTitleTooltip, hasCenterComponent, hasSelection, }: TitleRowProps) => React.JSX.Element;
@@ -1,24 +1,31 @@
1
- import React from 'react';
2
- import { theme } from '@synerise/ds-core';
3
- import Icon, { InfoFillS } from '@synerise/ds-icon';
4
- import Tooltip from '@synerise/ds-tooltip';
5
- import * as S from '../../Mapping.styles';
6
- export var TitleRow = function TitleRow(_ref) {
7
- var leftTitle = _ref.leftTitle,
8
- leftTitleTooltip = _ref.leftTitleTooltip,
9
- rightTitle = _ref.rightTitle,
10
- rightTitleTooltip = _ref.rightTitleTooltip,
11
- hasCenterComponent = _ref.hasCenterComponent,
12
- hasSelection = _ref.hasSelection;
13
- return /*#__PURE__*/React.createElement(S.MappingRow, null, hasSelection && /*#__PURE__*/React.createElement(S.RowSelectionWrapper, null), /*#__PURE__*/React.createElement(S.MappingRowLeft, null, /*#__PURE__*/React.createElement(S.ColumnTitle, {
14
- level: 6
15
- }, leftTitle, ' ', leftTitleTooltip && /*#__PURE__*/React.createElement(Tooltip, leftTitleTooltip, /*#__PURE__*/React.createElement(Icon, {
16
- component: /*#__PURE__*/React.createElement(InfoFillS, null),
17
- color: theme.palette['grey-400']
18
- })))), hasCenterComponent && /*#__PURE__*/React.createElement(S.MappingRowCenter, null), /*#__PURE__*/React.createElement(S.MappingRowLeft, null, /*#__PURE__*/React.createElement(S.ColumnTitle, {
19
- level: 6
20
- }, rightTitle, ' ', rightTitleTooltip && /*#__PURE__*/React.createElement(Tooltip, rightTitleTooltip, /*#__PURE__*/React.createElement(Icon, {
21
- component: /*#__PURE__*/React.createElement(InfoFillS, null),
22
- color: theme.palette['grey-400']
23
- })))));
24
- };
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { theme } from "@synerise/ds-core";
3
+ import Icon, { InfoFillS } from "@synerise/ds-icon";
4
+ import Tooltip from "@synerise/ds-tooltip";
5
+ import { MappingRow, RowSelectionWrapper, MappingRowLeft, ColumnTitle, MappingRowCenter } from "../../Mapping.styles.js";
6
+ const TitleRow = ({
7
+ leftTitle,
8
+ leftTitleTooltip,
9
+ rightTitle,
10
+ rightTitleTooltip,
11
+ hasCenterComponent,
12
+ hasSelection
13
+ }) => {
14
+ return /* @__PURE__ */ jsxs(MappingRow, { children: [
15
+ hasSelection && /* @__PURE__ */ jsx(RowSelectionWrapper, {}),
16
+ /* @__PURE__ */ jsx(MappingRowLeft, { children: /* @__PURE__ */ jsxs(ColumnTitle, { level: 6, children: [
17
+ leftTitle,
18
+ " ",
19
+ leftTitleTooltip && /* @__PURE__ */ jsx(Tooltip, { ...leftTitleTooltip, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(InfoFillS, {}), color: theme.palette["grey-400"] }) })
20
+ ] }) }),
21
+ hasCenterComponent && /* @__PURE__ */ jsx(MappingRowCenter, {}),
22
+ /* @__PURE__ */ jsx(MappingRowLeft, { children: /* @__PURE__ */ jsxs(ColumnTitle, { level: 6, children: [
23
+ rightTitle,
24
+ " ",
25
+ rightTitleTooltip && /* @__PURE__ */ jsx(Tooltip, { ...rightTitleTooltip, children: /* @__PURE__ */ jsx(Icon, { component: /* @__PURE__ */ jsx(InfoFillS, {}), color: theme.palette["grey-400"] }) })
26
+ ] }) })
27
+ ] });
28
+ };
29
+ export {
30
+ TitleRow
31
+ };
@@ -1,3 +1,8 @@
1
- export * from './BatchSelectionHeader/BatchSelectionHeader';
2
- export * from './RowSelection/RowSelection';
3
- export * from './TitleRow/TitleRow';
1
+ import { BatchSelectionHeader } from "./BatchSelectionHeader/BatchSelectionHeader.js";
2
+ import { RowSelection } from "./RowSelection/RowSelection.js";
3
+ import { TitleRow } from "./TitleRow/TitleRow.js";
4
+ export {
5
+ BatchSelectionHeader,
6
+ RowSelection,
7
+ TitleRow
8
+ };
@@ -1,7 +1,7 @@
1
- import type { BaseItemType } from '../Mapping.types';
1
+ import { BaseItemType } from '../Mapping.types';
2
2
  export declare const useBatchSelection: <ItemType extends BaseItemType>(dataSource: Array<ItemType>, hasBatchSelection?: boolean) => {
3
3
  selectedItemIds: ItemType["id"][];
4
4
  batchSelectionCheckboxState: boolean | undefined;
5
- setSelectedItemIds: import("react").Dispatch<import("react").SetStateAction<ItemType["id"][]>>;
5
+ setSelectedItemIds: import('react').Dispatch<import('react').SetStateAction<ItemType["id"][]>>;
6
6
  handleBatchCheckboxChange: (newVal: boolean | undefined) => void;
7
7
  };
@@ -1,20 +1,16 @@
1
- import { useMemo, useState } from 'react';
2
- export var useBatchSelection = function useBatchSelection(dataSource, hasBatchSelection) {
3
- var _useState = useState([]),
4
- selectedItemIds = _useState[0],
5
- setSelectedItemIds = _useState[1];
6
- var handleBatchCheckboxChange = function handleBatchCheckboxChange(newVal) {
1
+ import { useState, useMemo } from "react";
2
+ const useBatchSelection = (dataSource, hasBatchSelection) => {
3
+ const [selectedItemIds, setSelectedItemIds] = useState([]);
4
+ const handleBatchCheckboxChange = (newVal) => {
7
5
  if (newVal === true) {
8
- setSelectedItemIds(dataSource.map(function (item) {
9
- return item.id;
10
- }));
6
+ setSelectedItemIds(dataSource.map((item) => item.id));
11
7
  return;
12
8
  }
13
9
  if (newVal === false) {
14
10
  setSelectedItemIds([]);
15
11
  }
16
12
  };
17
- var batchSelectionCheckboxState = useMemo(function () {
13
+ const batchSelectionCheckboxState = useMemo(() => {
18
14
  if (hasBatchSelection) {
19
15
  switch (dataSource.length - selectedItemIds.length) {
20
16
  case 0:
@@ -22,15 +18,18 @@ export var useBatchSelection = function useBatchSelection(dataSource, hasBatchSe
22
18
  case dataSource.length:
23
19
  return false;
24
20
  default:
25
- return undefined;
21
+ return void 0;
26
22
  }
27
23
  }
28
- return undefined;
24
+ return void 0;
29
25
  }, [dataSource, selectedItemIds, hasBatchSelection]);
30
26
  return {
31
- selectedItemIds: selectedItemIds,
32
- batchSelectionCheckboxState: batchSelectionCheckboxState,
33
- setSelectedItemIds: setSelectedItemIds,
34
- handleBatchCheckboxChange: handleBatchCheckboxChange
27
+ selectedItemIds,
28
+ batchSelectionCheckboxState,
29
+ setSelectedItemIds,
30
+ handleBatchCheckboxChange
35
31
  };
36
- };
32
+ };
33
+ export {
34
+ useBatchSelection
35
+ };
@@ -1,2 +1,2 @@
1
- import type { MappingTexts } from '../Mapping.types';
1
+ import { MappingTexts } from '../Mapping.types';
2
2
  export declare const useTexts: (defaultTexts?: Partial<MappingTexts>) => MappingTexts;
@@ -1,20 +1,22 @@
1
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
2
- import { useMemo } from 'react';
3
- import { useIntl } from 'react-intl';
4
- export var useTexts = function useTexts(defaultTexts) {
5
- var _useIntl = useIntl(),
6
- formatMessage = _useIntl.formatMessage;
7
- var texts = useMemo(function () {
8
- return _extends({
9
- enableBatchSelection: formatMessage({
10
- id: 'DS.MAPPING.BULK_ACTIONS_ENABLE',
11
- defaultMessage: 'Bulk actions'
12
- }),
13
- disableBatchSelection: formatMessage({
14
- id: 'DS.MAPPING.BULK_ACTIONS_DISABLE',
15
- defaultMessage: 'Hide actions'
16
- })
17
- }, defaultTexts);
18
- }, [defaultTexts, formatMessage]);
1
+ import { useMemo } from "react";
2
+ import { useIntl } from "react-intl";
3
+ const useTexts = (defaultTexts) => {
4
+ const {
5
+ formatMessage
6
+ } = useIntl();
7
+ const texts = useMemo(() => ({
8
+ enableBatchSelection: formatMessage({
9
+ id: "DS.MAPPING.BULK_ACTIONS_ENABLE",
10
+ defaultMessage: "Bulk actions"
11
+ }),
12
+ disableBatchSelection: formatMessage({
13
+ id: "DS.MAPPING.BULK_ACTIONS_DISABLE",
14
+ defaultMessage: "Hide actions"
15
+ }),
16
+ ...defaultTexts
17
+ }), [defaultTexts, formatMessage]);
19
18
  return texts;
20
- };
19
+ };
20
+ export {
21
+ useTexts
22
+ };
package/dist/index.js CHANGED
@@ -1 +1,4 @@
1
- export { default } from './Mapping';
1
+ import { default as default2 } from "./Mapping.js";
2
+ export {
3
+ default2 as default
4
+ };
package/dist/modules.d.js CHANGED
@@ -1 +1 @@
1
- import '@testing-library/jest-dom';
1
+ import "@testing-library/jest-dom";
File without changes
@@ -1,2 +1,2 @@
1
- import React from 'react';
1
+ import { default as React } from 'react';
2
2
  export declare const renderCounter: (selected: number, total: number) => React.JSX.Element;
@@ -1,7 +1,16 @@
1
- import React from 'react';
2
- export var renderCounter = function renderCounter(selected, total) {
1
+ import { jsxs, Fragment } from "react/jsx-runtime";
2
+ const renderCounter = (selected, total) => {
3
3
  if (selected === 0) {
4
- return /*#__PURE__*/React.createElement(React.Fragment, null, total, " Items");
4
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
5
+ total,
6
+ " Items"
7
+ ] });
5
8
  }
6
- return /*#__PURE__*/React.createElement(React.Fragment, null, selected, " Selected");
7
- };
9
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
10
+ selected,
11
+ " Selected"
12
+ ] });
13
+ };
14
+ export {
15
+ renderCounter
16
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synerise/ds-mapping",
3
- "version": "1.1.34",
3
+ "version": "1.1.36",
4
4
  "description": "Mapping UI Component for the Synerise Design System",
5
5
  "license": "ISC",
6
6
  "repository": "Synerise/synerise-design",
@@ -16,10 +16,10 @@
16
16
  "access": "public"
17
17
  },
18
18
  "scripts": {
19
- "build": "pnpm run build:js && pnpm run build:css && pnpm run defs",
19
+ "build": "vite build",
20
20
  "build:css": "node ../../../scripts/style/less.js",
21
21
  "build:js": "babel --delete-dir-on-start --root-mode upward src --out-dir dist --extensions '.js,.ts,.tsx'",
22
- "build:watch": "pnpm run build:js -- --watch",
22
+ "build:watch": "vite build --watch",
23
23
  "defs": "tsc --declaration --outDir dist/ --emitDeclarationOnly",
24
24
  "pack:ci": "pnpm pack --pack-destination ../../storybook/storybook-static/static",
25
25
  "prepublish": "pnpm run build",
@@ -35,12 +35,12 @@
35
35
  ],
36
36
  "types": "dist/index.d.ts",
37
37
  "dependencies": {
38
- "@synerise/ds-button": "^1.5.17",
39
- "@synerise/ds-checkbox": "^1.2.20",
40
- "@synerise/ds-icon": "^1.15.0",
41
- "@synerise/ds-tooltip": "^1.4.9",
42
- "@synerise/ds-typography": "^1.1.12",
43
- "@synerise/ds-utils": "^1.7.0"
38
+ "@synerise/ds-button": "^1.5.19",
39
+ "@synerise/ds-checkbox": "^1.2.22",
40
+ "@synerise/ds-icon": "^1.15.2",
41
+ "@synerise/ds-tooltip": "^1.4.11",
42
+ "@synerise/ds-typography": "^1.1.14",
43
+ "@synerise/ds-utils": "^1.7.1"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "@synerise/ds-core": "*",
@@ -49,5 +49,5 @@
49
49
  "react-intl": ">=3.12.0 <= 6.8",
50
50
  "styled-components": "^5.3.3"
51
51
  },
52
- "gitHead": "8efc031fa688c0b87c7b3915bae93546bb63bcac"
52
+ "gitHead": "c2384982c3533a31eb5e5e0408f8dcecb2b0f399"
53
53
  }