kiban-design-system 1.1.2-hotfix.0 → 1.1.4-hotfix.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/index.js CHANGED
@@ -30038,12 +30038,14 @@ const Cell = ({ children }) => jsx("td", { children: children }, void 0);
30038
30038
  * @param {string} TableProps.id - Id to table
30039
30039
  * @param {Array} TableProps.headings - Headings of the table
30040
30040
  * @param {Array} TableProps.headingsTypes - Determines the positioning of the text
30041
+ * @param {function} TableProps.onSelectAllRows - Function to select all rows
30042
+ * @param {Boolean} TableProps.areAllRowsSelected - Determines if all rows are selected
30041
30043
  * in the columns, respects the order of the array, It only
30042
30044
  * accepts text or numeric, if it is numeric the text is aligned
30043
30045
  * to the right, if not it is aligned to the left
30044
30046
  * @returns {symbol} - Element Table
30045
30047
  */
30046
- const Table = ({ headings, headingsTypes, children, id }) => {
30048
+ const Table = ({ headings, headingsTypes, children, id, onSelectAllRows, areAllRowsSelected, }) => {
30047
30049
  useEffect(() => {
30048
30050
  var _a;
30049
30051
  if (headingsTypes) {
@@ -30060,9 +30062,15 @@ const Table = ({ headings, headingsTypes, children, id }) => {
30060
30062
  }
30061
30063
  }
30062
30064
  }, [headingsTypes]);
30063
- return (jsxs("table", Object.assign({ className: 'Table', id: id }, { children: [jsx("thead", { children: jsx("tr", { children: headings === null || headings === void 0 ? void 0 : headings.map((head, i) => (jsx("th", Object.assign({ className: headingsTypes && headingsTypes[i] === 'numeric'
30064
- ? 'Table__text-right'
30065
- : '' }, { children: head }), i))) }, void 0) }, void 0), jsx("tbody", Object.assign({ id: 'tbody' }, { children: children }), void 0)] }), void 0));
30065
+ const handleOnChangeAllSelected = () => {
30066
+ if (onSelectAllRows) {
30067
+ onSelectAllRows(!areAllRowsSelected);
30068
+ }
30069
+ };
30070
+ const checkboxSelectAllRowsMarkup = onSelectAllRows ? (jsx("th", { children: jsx(Checkbox, { onChange: handleOnChangeAllSelected, isChecked: areAllRowsSelected, value: 'all', id: 'allSelected' }, void 0) }, void 0)) : null;
30071
+ return (jsxs("table", Object.assign({ className: 'Table', id: id }, { children: [jsx("thead", { children: jsxs("tr", { children: [checkboxSelectAllRowsMarkup, headings === null || headings === void 0 ? void 0 : headings.map((head, i) => (jsx("th", Object.assign({ className: headingsTypes && headingsTypes[i] === 'numeric'
30072
+ ? 'Table__text-right'
30073
+ : '' }, { children: head }), i)))] }, void 0) }, void 0), jsx("tbody", Object.assign({ id: 'tbody' }, { children: children }), void 0)] }), void 0));
30066
30074
  };
30067
30075
  Table.Row = Row;
30068
30076
  Table.Cell = Cell;
@@ -30091,7 +30099,7 @@ const Tile = ({ isSelected, media, onClick, title, value, subtitle = '', mediaSi
30091
30099
  const renderTags = (tag, index) => (jsx("div", Object.assign({ className: 'Tile__Tag' }, { children: tag }), `tag-historic-${index}`));
30092
30100
  const clasessTags = cssClassName('Tile__TagsWrapper', mediaSize && `is-${mediaSize}`);
30093
30101
  const tagsMarkup = tags ? (jsx("div", Object.assign({ className: clasessTags }, { children: jsx("div", Object.assign({ className: 'Tile__Tags' }, { children: tags.map(renderTags) }), void 0) }), void 0)) : null;
30094
- return (jsxs("div", Object.assign({ className: classes, onClick: handleOnClick }, { children: [jsxs("div", Object.assign({ className: 'Tile__Wrapper' }, { children: [jsxs("div", Object.assign({ className: 'Tile__TitleWrapper' }, { children: [jsx("div", Object.assign({ className: 'Tile__Media' }, { children: jsx(Media, { icon: media, size: mediaSize, appearance: 'info' }, void 0) }), void 0), jsxs("div", { children: [jsx("div", Object.assign({ className: 'Tile__Title' }, { children: title }), void 0), subtitle !== '' && (jsx("div", Object.assign({ className: 'Tile__Subtitle' }, { children: subtitle }), void 0))] }, void 0)] }), void 0), jsx("div", Object.assign({ className: 'Tile__RightMediaWrapper' }, { children: rightMedia !== null && rightMedia }), void 0)] }), void 0), tagsMarkup] }), void 0));
30102
+ return (jsxs("div", Object.assign({ className: classes, onClick: handleOnClick }, { children: [jsxs("div", Object.assign({ className: 'Tile__Wrapper' }, { children: [jsxs("div", Object.assign({ className: 'Tile__TitleWrapper' }, { children: [jsx("div", Object.assign({ className: 'Tile__Media' }, { children: jsx(Media, { icon: media, size: mediaSize, appearance: 'info' }, void 0) }), void 0), jsxs("div", { children: [jsx("div", Object.assign({ className: 'Tile__Title' }, { children: title }), void 0), subtitle ? jsx("div", Object.assign({ className: 'Tile__Subtitle' }, { children: subtitle }), void 0) : null] }, void 0)] }), void 0), jsx("div", Object.assign({ className: 'Tile__RightMediaWrapper' }, { children: rightMedia !== null && rightMedia }), void 0)] }), void 0), tagsMarkup] }), void 0));
30095
30103
  };
30096
30104
 
30097
30105
  const COMPONENT_NAME$6 = 'Totalizer';
@@ -30316,7 +30324,7 @@ const FilterField = ({ label, isRequired = false, field, onRemove, name, }) => {
30316
30324
  };
30317
30325
 
30318
30326
  const COMPONENT_NAME$1 = 'Filters';
30319
- const Filters = ({ filters = [], onApplyFilters, onRemoveFilter, appliedFilters, onCleanFilters, onAddFilter, addFilterButtonIcon, addFilterButtonLabel, clearButtonLabel, searchButtonLabel, selectedFilters = [], }) => {
30327
+ const Filters = ({ filters = [], onApplyFilters, onRemoveFilter, appliedFilters, onCleanFilters, onAddFilter, addFilterButtonIcon, addFilterButtonLabel, clearButtonLabel, searchButtonLabel, extraActions, selectedFilters = [], }) => {
30320
30328
  const [isPopoverOpen, setIsPopoverOpen] = useState(false);
30321
30329
  const mainContainerRef = useRef(null);
30322
30330
  const handleSelectFilter = (selected) => {
@@ -30336,8 +30344,11 @@ const Filters = ({ filters = [], onApplyFilters, onRemoveFilter, appliedFilters,
30336
30344
  label: filter.label,
30337
30345
  }));
30338
30346
  const availableFiltersPopoverMarkup = filters ? (jsx(Popover$1, Object.assign({ activator: addFilterButtonMarkup, isActive: isPopoverOpen, onClose: () => setIsPopoverOpen(false) }, { children: jsx(OptionList, { selected: [], items: optionListItems, onChange: handleSelectFilter }, void 0) }), void 0)) : null;
30347
+ const extraActionsMarkup = extraActions
30348
+ ? extraActions.map((extraAction, index) => (createElement(AlphaButton, Object.assign({}, extraAction, { key: `extra-action-${index}` }), extraAction.label)))
30349
+ : null;
30339
30350
  const secondaryActionsMarkup = (jsx("div", Object.assign({ className: `${COMPONENT_NAME$1}__SecondaryActionsWrapper` }, { children: availableFiltersPopoverMarkup }), void 0));
30340
- const mainActionsMarkup = (jsxs("div", Object.assign({ className: `${COMPONENT_NAME$1}__MainActionsWrapper` }, { children: [jsx(AlphaButton, Object.assign({ onClick: onCleanFilters, isDisabled: !appliedFilters.length && !selectedFilters.length }, { children: clearButtonLabel }), void 0), jsx(AlphaButton, Object.assign({ isDisabled: !appliedFilters.length && !selectedFilters.length, isPrimary: true, onClick: onApplyFilters }, { children: searchButtonLabel }), void 0)] }), void 0));
30351
+ const mainActionsMarkup = (jsxs("div", Object.assign({ className: `${COMPONENT_NAME$1}__MainActionsWrapper` }, { children: [extraActionsMarkup, jsx(AlphaButton, Object.assign({ onClick: onCleanFilters, isDisabled: !appliedFilters.length && !selectedFilters.length }, { children: clearButtonLabel }), void 0), jsx(AlphaButton, Object.assign({ isDisabled: !appliedFilters.length && !selectedFilters.length, isPrimary: true, onClick: onApplyFilters }, { children: searchButtonLabel }), void 0)] }), void 0));
30341
30352
  const handleRemoveFilter = (filter) => {
30342
30353
  onRemoveFilter === null || onRemoveFilter === void 0 ? void 0 : onRemoveFilter(filter);
30343
30354
  };