@adiba-banking-cloud/backoffice 0.2.3 → 0.2.4

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.
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BHsXwqJB.js');
3
+ var index = require('./index-Clg3JrJr.js');
4
4
 
5
5
  function _mergeNamespaces(n, m) {
6
6
  m.forEach(function (e) {
@@ -12172,7 +12172,7 @@ const initChart$1 = props => {
12172
12172
  }
12173
12173
 
12174
12174
  // Fallback: use dynamic import (async, but will work in Vite/Storybook)
12175
- Promise.resolve().then(function () { return require('./heatmap-QyWScAOZ.js'); }).then(function (n) { return n.heatmap; }).then(heatmapModule => {
12175
+ Promise.resolve().then(function () { return require('./heatmap-BqY-ayOh.js'); }).then(function (n) { return n.heatmap; }).then(heatmapModule => {
12176
12176
  const moduleFn = typeof heatmapModule === "function" ? heatmapModule : heatmapModule?.default || heatmapModule;
12177
12177
  if (typeof moduleFn === "function") {
12178
12178
  moduleFn(Highcharts);
@@ -12973,39 +12973,78 @@ const SearchPanel = _ref3 => {
12973
12973
  searchState,
12974
12974
  filterFn,
12975
12975
  searchFn,
12976
+ onPillRemove,
12976
12977
  children,
12977
12978
  ...rest
12978
12979
  } = _ref3;
12979
- const [search, setSearch] = searchState || React.useState("");
12980
+ const [searchPills, setSearchPills] = searchState || React.useState([]);
12981
+ const [inputValue, setInputValue] = React.useState("");
12980
12982
  const form$1 = form.useForm({
12981
12983
  initialValues: {
12982
- search: search
12984
+ search: ""
12983
12985
  }
12984
12986
  });
12987
+ const handleAddPill = value => {
12988
+ const trimmedValue = value.trim();
12989
+ if (trimmedValue && !searchPills.includes(trimmedValue)) {
12990
+ const newPills = [...searchPills, trimmedValue];
12991
+ setSearchPills(newPills);
12992
+ setInputValue("");
12993
+ form$1.setFieldValue("search", "");
12994
+ }
12995
+ };
12996
+ const handleRemovePill = value => {
12997
+ const newPills = searchPills.filter(pill => pill !== value);
12998
+ setSearchPills(newPills);
12999
+ if (onPillRemove) {
13000
+ onPillRemove(value);
13001
+ }
13002
+ };
13003
+ const handleSubmit = values => {
13004
+ if (inputValue.trim()) {
13005
+ handleAddPill(inputValue);
13006
+ }
13007
+ if (searchFn) {
13008
+ searchFn({
13009
+ search: searchPills
13010
+ });
13011
+ }
13012
+ };
13013
+ const handleKeyDown = event => {
13014
+ if (event.key === "Enter" && inputValue.trim()) {
13015
+ event.preventDefault();
13016
+ handleAddPill(inputValue);
13017
+ } else if (event.key === "Backspace" && inputValue.length === 0 && searchPills.length > 0) {
13018
+ event.preventDefault();
13019
+ handleRemovePill(searchPills[searchPills.length - 1]);
13020
+ }
13021
+ };
12985
13022
  return /*#__PURE__*/React.createElement(SimplePanel, rest, /*#__PURE__*/React.createElement(core.Stack, null, /*#__PURE__*/React.createElement("form", {
12986
- onSubmit: form$1.onSubmit(values => {
12987
- searchFn ? searchFn(values) : void 0;
12988
- })
13023
+ onSubmit: form$1.onSubmit(handleSubmit)
12989
13024
  }, /*#__PURE__*/React.createElement(core.Group, {
12990
13025
  gap: "xs"
12991
- }, /*#__PURE__*/React.createElement(core.TextInput, {
12992
- fw: 300,
12993
- name: "search",
13026
+ }, /*#__PURE__*/React.createElement(core.PillsInput, {
12994
13027
  size: "md",
12995
13028
  radius: "md",
12996
13029
  flex: 1,
12997
- value: search,
12998
- placeholder: placeholder,
12999
13030
  leftSection: /*#__PURE__*/React.createElement(Icons, searchIcon),
13000
13031
  rightSection: typeof filterFn == "function" ? /*#__PURE__*/React.createElement(core.ActionIcon, {
13001
13032
  variant: "transparent",
13002
13033
  onClick: filterFn
13003
- }, /*#__PURE__*/React.createElement(Icons, filterIcon)) : /*#__PURE__*/React.createElement(React.Fragment, null),
13034
+ }, /*#__PURE__*/React.createElement(Icons, filterIcon)) : undefined
13035
+ }, /*#__PURE__*/React.createElement(core.Pill.Group, null, searchPills.map((pill, index) => /*#__PURE__*/React.createElement(core.Pill, {
13036
+ key: `${pill}-${index}`,
13037
+ withRemoveButton: true,
13038
+ onRemove: () => handleRemovePill(pill)
13039
+ }, pill)), /*#__PURE__*/React.createElement(core.PillsInput.Field, {
13040
+ placeholder: placeholder,
13041
+ value: inputValue,
13004
13042
  onChange: e => {
13005
- setSearch(e.currentTarget.value);
13043
+ setInputValue(e.currentTarget.value);
13006
13044
  form$1.setFieldValue("search", e.currentTarget.value);
13007
- }
13008
- }), /*#__PURE__*/React.createElement(core.Button, {
13045
+ },
13046
+ onKeyDown: handleKeyDown
13047
+ }))), /*#__PURE__*/React.createElement(core.Button, {
13009
13048
  variant: "light",
13010
13049
  size: "md",
13011
13050
  fw: 300,
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BHsXwqJB.js');
3
+ var index = require('./index-Clg3JrJr.js');
4
4
  require('@mantine/modals');
5
5
  require('react');
6
6
  require('@mantine/core');
@@ -1,4 +1,4 @@
1
- import { g as getDefaultExportFromCjs } from './index-BlLQ1b_6.js';
1
+ import { g as getDefaultExportFromCjs } from './index-rnjdI3M1.js';
2
2
 
3
3
  function _mergeNamespaces(n, m) {
4
4
  m.forEach(function (e) {
@@ -1,7 +1,7 @@
1
1
  import { modals } from '@mantine/modals';
2
2
  import * as React from 'react';
3
3
  import React__default, { useRef, useMemo, useEffect, useState } from 'react';
4
- import { Center, Image, Space, Popover, Button, Stack, Divider, Group, Text, Menu, Avatar, Badge, NavLink, Card, TextInput, ActionIcon, Box, Title, SegmentedControl, Breadcrumbs, Anchor, ColorSwatch, AspectRatio, Overlay, rem, SimpleGrid, Indicator, Table, createTheme, PinInput, Drawer as Drawer$1, ScrollArea, NumberInput, PasswordInput, Textarea, Grid, MantineProvider } from '@mantine/core';
4
+ import { Center, Image, Space, Popover, Button, Stack, Divider, Group, Text, Menu, Avatar, Badge, NavLink, Card, PillsInput, ActionIcon, Pill, Box, Title, SegmentedControl, Breadcrumbs, Anchor, ColorSwatch, AspectRatio, Overlay, rem, SimpleGrid, Indicator, Table, createTheme, PinInput, Drawer as Drawer$1, ScrollArea, NumberInput, PasswordInput, TextInput, Textarea, Grid, MantineProvider } from '@mantine/core';
5
5
  import { DotLottieReact } from '@lottiefiles/dotlottie-react';
6
6
  import _extends from '@babel/runtime/helpers/extends';
7
7
  import HighchartsReact from 'highcharts-react-official';
@@ -12151,7 +12151,7 @@ const initChart$1 = props => {
12151
12151
  }
12152
12152
 
12153
12153
  // Fallback: use dynamic import (async, but will work in Vite/Storybook)
12154
- import('./heatmap-CZ2o0bqY.js').then(function (n) { return n.h; }).then(heatmapModule => {
12154
+ import('./heatmap-D3ePhBTg.js').then(function (n) { return n.h; }).then(heatmapModule => {
12155
12155
  const moduleFn = typeof heatmapModule === "function" ? heatmapModule : heatmapModule?.default || heatmapModule;
12156
12156
  if (typeof moduleFn === "function") {
12157
12157
  moduleFn(Highcharts);
@@ -12952,39 +12952,78 @@ const SearchPanel = _ref3 => {
12952
12952
  searchState,
12953
12953
  filterFn,
12954
12954
  searchFn,
12955
+ onPillRemove,
12955
12956
  children,
12956
12957
  ...rest
12957
12958
  } = _ref3;
12958
- const [search, setSearch] = searchState || useState("");
12959
+ const [searchPills, setSearchPills] = searchState || useState([]);
12960
+ const [inputValue, setInputValue] = useState("");
12959
12961
  const form = useForm({
12960
12962
  initialValues: {
12961
- search: search
12963
+ search: ""
12962
12964
  }
12963
12965
  });
12966
+ const handleAddPill = value => {
12967
+ const trimmedValue = value.trim();
12968
+ if (trimmedValue && !searchPills.includes(trimmedValue)) {
12969
+ const newPills = [...searchPills, trimmedValue];
12970
+ setSearchPills(newPills);
12971
+ setInputValue("");
12972
+ form.setFieldValue("search", "");
12973
+ }
12974
+ };
12975
+ const handleRemovePill = value => {
12976
+ const newPills = searchPills.filter(pill => pill !== value);
12977
+ setSearchPills(newPills);
12978
+ if (onPillRemove) {
12979
+ onPillRemove(value);
12980
+ }
12981
+ };
12982
+ const handleSubmit = values => {
12983
+ if (inputValue.trim()) {
12984
+ handleAddPill(inputValue);
12985
+ }
12986
+ if (searchFn) {
12987
+ searchFn({
12988
+ search: searchPills
12989
+ });
12990
+ }
12991
+ };
12992
+ const handleKeyDown = event => {
12993
+ if (event.key === "Enter" && inputValue.trim()) {
12994
+ event.preventDefault();
12995
+ handleAddPill(inputValue);
12996
+ } else if (event.key === "Backspace" && inputValue.length === 0 && searchPills.length > 0) {
12997
+ event.preventDefault();
12998
+ handleRemovePill(searchPills[searchPills.length - 1]);
12999
+ }
13000
+ };
12964
13001
  return /*#__PURE__*/React__default.createElement(SimplePanel, rest, /*#__PURE__*/React__default.createElement(Stack, null, /*#__PURE__*/React__default.createElement("form", {
12965
- onSubmit: form.onSubmit(values => {
12966
- searchFn ? searchFn(values) : void 0;
12967
- })
13002
+ onSubmit: form.onSubmit(handleSubmit)
12968
13003
  }, /*#__PURE__*/React__default.createElement(Group, {
12969
13004
  gap: "xs"
12970
- }, /*#__PURE__*/React__default.createElement(TextInput, {
12971
- fw: 300,
12972
- name: "search",
13005
+ }, /*#__PURE__*/React__default.createElement(PillsInput, {
12973
13006
  size: "md",
12974
13007
  radius: "md",
12975
13008
  flex: 1,
12976
- value: search,
12977
- placeholder: placeholder,
12978
13009
  leftSection: /*#__PURE__*/React__default.createElement(Icons, searchIcon),
12979
13010
  rightSection: typeof filterFn == "function" ? /*#__PURE__*/React__default.createElement(ActionIcon, {
12980
13011
  variant: "transparent",
12981
13012
  onClick: filterFn
12982
- }, /*#__PURE__*/React__default.createElement(Icons, filterIcon)) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null),
13013
+ }, /*#__PURE__*/React__default.createElement(Icons, filterIcon)) : undefined
13014
+ }, /*#__PURE__*/React__default.createElement(Pill.Group, null, searchPills.map((pill, index) => /*#__PURE__*/React__default.createElement(Pill, {
13015
+ key: `${pill}-${index}`,
13016
+ withRemoveButton: true,
13017
+ onRemove: () => handleRemovePill(pill)
13018
+ }, pill)), /*#__PURE__*/React__default.createElement(PillsInput.Field, {
13019
+ placeholder: placeholder,
13020
+ value: inputValue,
12983
13021
  onChange: e => {
12984
- setSearch(e.currentTarget.value);
13022
+ setInputValue(e.currentTarget.value);
12985
13023
  form.setFieldValue("search", e.currentTarget.value);
12986
- }
12987
- }), /*#__PURE__*/React__default.createElement(Button, {
13024
+ },
13025
+ onKeyDown: handleKeyDown
13026
+ }))), /*#__PURE__*/React__default.createElement(Button, {
12988
13027
  variant: "light",
12989
13028
  size: "md",
12990
13029
  fw: 300,
@@ -1,4 +1,4 @@
1
- export { A as ApplicationMenu, o as ApplicationPanel, k as AvatarLabelPanel, B as BasicHeatmap, C as CalendarHeatmap, n as ConnectionPanel, V as DEFAULT_API_TIMEOUT, Q as DEFAULT_PAGE_SIZE, D as DonutChart, z as Drawer, e as DynamicLogo, f as DynamicShigaLogo, E as EqualizerColumn, u as ErrorModal, F as File, d as Icons, v as InfoModal, I as InterpolatedHeatmap, L as LabelPanel, R as MAX_PAGE_SIZE, H as MaskedTilePanel, Y as ModalContentWrapper, M as MultiAxisArea, P as PageTitle, q as PaymentMethod, r as PaymentMethodAdd, j as SearchPanel, h as SideMenu, b as SimpleArea, S as SimpleColumn, G as SimpleForm, w as SimpleModal, i as SimplePanel, s as SimpleTable, l as SimpleText, c as StackedArea, a as StackedColumn, p as SubscriptionPlans, x as SuccessModal, J as TilePanel, m as TitleWithIndex, T as TitledPanel, y as TwoFactorModal, U as UserMenu, X as apiClient, W as createApiClient, _ as extractBetweenBraces, $ as extractOutsideBraces, t as theme, N as useManagedModals, K as useModal, O as useUrlFilters, Z as withProviders } from './index-BlLQ1b_6.js';
1
+ export { A as ApplicationMenu, o as ApplicationPanel, k as AvatarLabelPanel, B as BasicHeatmap, C as CalendarHeatmap, n as ConnectionPanel, V as DEFAULT_API_TIMEOUT, Q as DEFAULT_PAGE_SIZE, D as DonutChart, z as Drawer, e as DynamicLogo, f as DynamicShigaLogo, E as EqualizerColumn, u as ErrorModal, F as File, d as Icons, v as InfoModal, I as InterpolatedHeatmap, L as LabelPanel, R as MAX_PAGE_SIZE, H as MaskedTilePanel, Y as ModalContentWrapper, M as MultiAxisArea, P as PageTitle, q as PaymentMethod, r as PaymentMethodAdd, j as SearchPanel, h as SideMenu, b as SimpleArea, S as SimpleColumn, G as SimpleForm, w as SimpleModal, i as SimplePanel, s as SimpleTable, l as SimpleText, c as StackedArea, a as StackedColumn, p as SubscriptionPlans, x as SuccessModal, J as TilePanel, m as TitleWithIndex, T as TitledPanel, y as TwoFactorModal, U as UserMenu, X as apiClient, W as createApiClient, _ as extractBetweenBraces, $ as extractOutsideBraces, t as theme, N as useManagedModals, K as useModal, O as useUrlFilters, Z as withProviders } from './index-rnjdI3M1.js';
2
2
  import '@mantine/modals';
3
3
  import 'react';
4
4
  import '@mantine/core';
@@ -20,7 +20,8 @@ export interface SearchPanelProps extends PanelProps {
20
20
  searchIcon?: IconsProps;
21
21
  filterIcon?: IconsProps;
22
22
  searchText?: string;
23
- searchState?: [string, (value: string) => void];
23
+ searchState?: [string[], (value: string[]) => void];
24
24
  searchFn?: (value: Record<string, any>) => void;
25
25
  filterFn?: () => void;
26
+ onPillRemove?: (value: string) => void;
26
27
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@adiba-banking-cloud/backoffice",
3
3
  "author": "TUROG Technologies",
4
- "version": "0.2.3",
4
+ "version": "0.2.4",
5
5
  "description": "An ADIBA component library for backoffice and dashboard applications",
6
6
  "license": "ISC",
7
7
  "main": "build/index.cjs.js",