ar-design 0.2.27 → 0.2.28

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,5 +1,5 @@
1
1
  .ar-chip {
2
- display: flex;
2
+ display: inline-flex;
3
3
  justify-content: center;
4
4
  align-items: center;
5
5
  gap: 0 0.5rem;
@@ -170,7 +170,7 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
170
170
  };
171
171
  const getData = useMemo(() => {
172
172
  let _data = [...data];
173
- if (searchedText) {
173
+ if (searchedText && Object.keys(searchedText).length > 0) {
174
174
  _data = _data.filter((item) => deepSearch(item, searchedText));
175
175
  setTotalRecords(_data.length);
176
176
  }
@@ -225,9 +225,6 @@ const Table = forwardRef(({ children, title, description, data, columns, actions
225
225
  setSelectAll(_checkboxItems.current.every((item) => item?.checked === true));
226
226
  }
227
227
  }, [selectionItems, currentPage]);
228
- useEffect(() => {
229
- console.log("Table component re-rendered!", actions);
230
- });
231
228
  return (React.createElement("div", { ref: _tableWrapper, className: _tableClassName.map((c) => c).join(" ") },
232
229
  (title || description || actions || React.Children.count(children) > 0) && (React.createElement("div", { className: "header" },
233
230
  React.createElement("div", { className: "title" },
@@ -40,7 +40,9 @@ const Pagination = ({ defaultCurrent = 1, currentPage, totalRecords, perPage, on
40
40
  setPages(liItems);
41
41
  onChange(_currentPage);
42
42
  }, [totalRecords, _currentPage]);
43
- useEffect(() => setCurrentPage(currentPage), [currentPage]);
43
+ useEffect(() => {
44
+ setCurrentPage(currentPage);
45
+ }, [currentPage]);
44
46
  return (React.createElement("div", { className: "ar-pagination" },
45
47
  React.createElement("ul", null,
46
48
  React.createElement("li", { className: _currentPage === 1 ? "passive" : "", onClick: () => {
@@ -1,5 +1,6 @@
1
1
  import { Status } from "../contexts/Notification";
2
2
  import { ValidationProperties } from "../../../types";
3
+ import { INotificationLocale } from "../locales";
3
4
  export declare const useLayout: () => {
4
5
  config: {
5
6
  layout: {
@@ -37,10 +38,10 @@ export declare const useLoading: () => {
37
38
  setIsLoading: import("react").Dispatch<import("react").SetStateAction<boolean>>;
38
39
  };
39
40
  export declare const useLanguage: () => string | undefined;
40
- export declare const useTranslation: <TBaseLocale>(currentLanguage: string | undefined, translations: {
41
+ export declare const useTranslation: <TBaseLocale>(currentLanguage: string | undefined, translations?: {
41
42
  [key: string]: any;
42
43
  }) => {
43
- t: (key: keyof TBaseLocale, ...args: any[]) => string;
44
+ t: (key: keyof TBaseLocale & keyof INotificationLocale, ...args: any[]) => string;
44
45
  currentLanguage: string | undefined;
45
46
  };
46
47
  export declare const useNotification: () => {
@@ -4,6 +4,7 @@ import { NotificationContext } from "../contexts/Notification";
4
4
  import Utils from "../../../infrastructure/shared/Utils";
5
5
  import { LanguageContext } from "../contexts/Language";
6
6
  import { LoadingContext } from "../contexts/Loading";
7
+ import { NotificationTR, NotificationEN } from "../locales";
7
8
  export const useLayout = () => {
8
9
  const context = useContext(ConfigContext);
9
10
  if (!context)
@@ -13,8 +14,12 @@ export const useLayout = () => {
13
14
  export const useLoading = () => useContext(LoadingContext);
14
15
  export const useLanguage = () => useContext(LanguageContext);
15
16
  export const useTranslation = function (currentLanguage, translations) {
17
+ const merged = {
18
+ tr: { ...translations?.tr, ...NotificationTR },
19
+ en: { ...translations?.en, ...NotificationEN },
20
+ };
16
21
  const t = (key, ...args) => {
17
- return Utils.StringFormat(translations[currentLanguage ?? "tr"][key], args) ?? "";
22
+ return Utils.StringFormat(merged[currentLanguage ?? "tr"][key], args) ?? "";
18
23
  };
19
24
  return { t, currentLanguage };
20
25
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.2.27",
3
+ "version": "0.2.28",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",