@adiba-banking-cloud/backoffice 0.2.3 → 0.2.5

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-BiOmZHuM.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-Bha3If2E.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);
@@ -12971,41 +12971,81 @@ const SearchPanel = _ref3 => {
12971
12971
  },
12972
12972
  searchText = "Search",
12973
12973
  searchState,
12974
+ searchInputValue,
12974
12975
  filterFn,
12975
12976
  searchFn,
12977
+ onPillRemove,
12976
12978
  children,
12977
12979
  ...rest
12978
12980
  } = _ref3;
12979
- const [search, setSearch] = searchState || React.useState("");
12981
+ const [searchPills] = searchState || React.useState([]);
12982
+ const [inputValue, setInputValue] = React.useState(searchInputValue || "");
12980
12983
  const form$1 = form.useForm({
12981
12984
  initialValues: {
12982
- search: search
12985
+ search: searchInputValue || ""
12983
12986
  }
12984
12987
  });
12988
+
12989
+ // Sync input value with searchInputValue prop
12990
+ React.useEffect(() => {
12991
+ if (searchInputValue !== undefined) {
12992
+ setInputValue(searchInputValue);
12993
+ form$1.setFieldValue("search", searchInputValue);
12994
+ }
12995
+ }, [searchInputValue]);
12996
+ const handleRemovePill = value => {
12997
+ if (onPillRemove) {
12998
+ onPillRemove(value);
12999
+ }
13000
+ };
13001
+ const handleSubmit = values => {
13002
+ // On submit, call searchFn with the input value (search term)
13003
+ // Don't add it as a pill - pills are for filters only
13004
+ const searchValue = inputValue.trim();
13005
+ if (searchFn) {
13006
+ searchFn({
13007
+ search: searchValue ? [searchValue] : []
13008
+ });
13009
+ }
13010
+ setInputValue("");
13011
+ form$1.setFieldValue("search", "");
13012
+ };
13013
+ const handleKeyDown = event => {
13014
+ if (event.key === "Enter" && inputValue.trim()) {
13015
+ event.preventDefault();
13016
+ // Trigger form submit which calls searchFn
13017
+ handleSubmit();
13018
+ } else if (event.key === "Backspace" && inputValue.length === 0 && searchPills.length > 0) {
13019
+ event.preventDefault();
13020
+ handleRemovePill(searchPills[searchPills.length - 1]);
13021
+ }
13022
+ };
12985
13023
  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
- })
13024
+ onSubmit: form$1.onSubmit(handleSubmit)
12989
13025
  }, /*#__PURE__*/React.createElement(core.Group, {
12990
13026
  gap: "xs"
12991
- }, /*#__PURE__*/React.createElement(core.TextInput, {
12992
- fw: 300,
12993
- name: "search",
13027
+ }, /*#__PURE__*/React.createElement(core.PillsInput, {
12994
13028
  size: "md",
12995
13029
  radius: "md",
12996
13030
  flex: 1,
12997
- value: search,
12998
- placeholder: placeholder,
12999
13031
  leftSection: /*#__PURE__*/React.createElement(Icons, searchIcon),
13000
13032
  rightSection: typeof filterFn == "function" ? /*#__PURE__*/React.createElement(core.ActionIcon, {
13001
13033
  variant: "transparent",
13002
13034
  onClick: filterFn
13003
- }, /*#__PURE__*/React.createElement(Icons, filterIcon)) : /*#__PURE__*/React.createElement(React.Fragment, null),
13035
+ }, /*#__PURE__*/React.createElement(Icons, filterIcon)) : undefined
13036
+ }, /*#__PURE__*/React.createElement(core.Pill.Group, null, searchPills.map((pill, index) => /*#__PURE__*/React.createElement(core.Pill, {
13037
+ key: `${pill}-${index}`,
13038
+ withRemoveButton: true,
13039
+ onRemove: () => handleRemovePill(pill)
13040
+ }, pill)), /*#__PURE__*/React.createElement(core.PillsInput.Field, {
13041
+ placeholder: placeholder,
13042
+ value: inputValue,
13004
13043
  onChange: e => {
13005
- setSearch(e.currentTarget.value);
13044
+ setInputValue(e.currentTarget.value);
13006
13045
  form$1.setFieldValue("search", e.currentTarget.value);
13007
- }
13008
- }), /*#__PURE__*/React.createElement(core.Button, {
13046
+ },
13047
+ onKeyDown: handleKeyDown
13048
+ }))), /*#__PURE__*/React.createElement(core.Button, {
13009
13049
  variant: "light",
13010
13050
  size: "md",
13011
13051
  fw: 300,
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BHsXwqJB.js');
3
+ var index = require('./index-BiOmZHuM.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-BmuCIg-s.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-Dva-F8qJ.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);
@@ -12950,41 +12950,81 @@ const SearchPanel = _ref3 => {
12950
12950
  },
12951
12951
  searchText = "Search",
12952
12952
  searchState,
12953
+ searchInputValue,
12953
12954
  filterFn,
12954
12955
  searchFn,
12956
+ onPillRemove,
12955
12957
  children,
12956
12958
  ...rest
12957
12959
  } = _ref3;
12958
- const [search, setSearch] = searchState || useState("");
12960
+ const [searchPills] = searchState || useState([]);
12961
+ const [inputValue, setInputValue] = useState(searchInputValue || "");
12959
12962
  const form = useForm({
12960
12963
  initialValues: {
12961
- search: search
12964
+ search: searchInputValue || ""
12962
12965
  }
12963
12966
  });
12967
+
12968
+ // Sync input value with searchInputValue prop
12969
+ React__default.useEffect(() => {
12970
+ if (searchInputValue !== undefined) {
12971
+ setInputValue(searchInputValue);
12972
+ form.setFieldValue("search", searchInputValue);
12973
+ }
12974
+ }, [searchInputValue]);
12975
+ const handleRemovePill = value => {
12976
+ if (onPillRemove) {
12977
+ onPillRemove(value);
12978
+ }
12979
+ };
12980
+ const handleSubmit = values => {
12981
+ // On submit, call searchFn with the input value (search term)
12982
+ // Don't add it as a pill - pills are for filters only
12983
+ const searchValue = inputValue.trim();
12984
+ if (searchFn) {
12985
+ searchFn({
12986
+ search: searchValue ? [searchValue] : []
12987
+ });
12988
+ }
12989
+ setInputValue("");
12990
+ form.setFieldValue("search", "");
12991
+ };
12992
+ const handleKeyDown = event => {
12993
+ if (event.key === "Enter" && inputValue.trim()) {
12994
+ event.preventDefault();
12995
+ // Trigger form submit which calls searchFn
12996
+ handleSubmit();
12997
+ } else if (event.key === "Backspace" && inputValue.length === 0 && searchPills.length > 0) {
12998
+ event.preventDefault();
12999
+ handleRemovePill(searchPills[searchPills.length - 1]);
13000
+ }
13001
+ };
12964
13002
  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
- })
13003
+ onSubmit: form.onSubmit(handleSubmit)
12968
13004
  }, /*#__PURE__*/React__default.createElement(Group, {
12969
13005
  gap: "xs"
12970
- }, /*#__PURE__*/React__default.createElement(TextInput, {
12971
- fw: 300,
12972
- name: "search",
13006
+ }, /*#__PURE__*/React__default.createElement(PillsInput, {
12973
13007
  size: "md",
12974
13008
  radius: "md",
12975
13009
  flex: 1,
12976
- value: search,
12977
- placeholder: placeholder,
12978
13010
  leftSection: /*#__PURE__*/React__default.createElement(Icons, searchIcon),
12979
13011
  rightSection: typeof filterFn == "function" ? /*#__PURE__*/React__default.createElement(ActionIcon, {
12980
13012
  variant: "transparent",
12981
13013
  onClick: filterFn
12982
- }, /*#__PURE__*/React__default.createElement(Icons, filterIcon)) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null),
13014
+ }, /*#__PURE__*/React__default.createElement(Icons, filterIcon)) : undefined
13015
+ }, /*#__PURE__*/React__default.createElement(Pill.Group, null, searchPills.map((pill, index) => /*#__PURE__*/React__default.createElement(Pill, {
13016
+ key: `${pill}-${index}`,
13017
+ withRemoveButton: true,
13018
+ onRemove: () => handleRemovePill(pill)
13019
+ }, pill)), /*#__PURE__*/React__default.createElement(PillsInput.Field, {
13020
+ placeholder: placeholder,
13021
+ value: inputValue,
12983
13022
  onChange: e => {
12984
- setSearch(e.currentTarget.value);
13023
+ setInputValue(e.currentTarget.value);
12985
13024
  form.setFieldValue("search", e.currentTarget.value);
12986
- }
12987
- }), /*#__PURE__*/React__default.createElement(Button, {
13025
+ },
13026
+ onKeyDown: handleKeyDown
13027
+ }))), /*#__PURE__*/React__default.createElement(Button, {
12988
13028
  variant: "light",
12989
13029
  size: "md",
12990
13030
  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-BmuCIg-s.js';
2
2
  import '@mantine/modals';
3
3
  import 'react';
4
4
  import '@mantine/core';
@@ -20,7 +20,9 @@ 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
+ searchInputValue?: string;
24
25
  searchFn?: (value: Record<string, any>) => void;
25
26
  filterFn?: () => void;
27
+ onPillRemove?: (value: string) => void;
26
28
  }
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.5",
5
5
  "description": "An ADIBA component library for backoffice and dashboard applications",
6
6
  "license": "ISC",
7
7
  "main": "build/index.cjs.js",