@akinon/akifilter 0.5.4 → 1.0.1

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.
Files changed (160) hide show
  1. package/README.md +44 -0
  2. package/dist/cjs/akifilter.d.ts +53 -0
  3. package/dist/cjs/akifilter.d.ts.map +1 -0
  4. package/dist/cjs/akifilter.js +360 -0
  5. package/dist/cjs/common/storage.d.ts +10 -0
  6. package/dist/cjs/common/storage.d.ts.map +1 -0
  7. package/dist/cjs/common/storage.js +124 -0
  8. package/dist/cjs/common/theme-overrides.d.ts +3 -0
  9. package/dist/cjs/common/theme-overrides.d.ts.map +1 -0
  10. package/dist/cjs/common/theme-overrides.js +6 -0
  11. package/dist/cjs/components/applied-filters.d.ts +14 -0
  12. package/dist/cjs/components/applied-filters.d.ts.map +1 -0
  13. package/dist/cjs/components/applied-filters.js +26 -0
  14. package/dist/cjs/components/filter-toolbar.d.ts +11 -0
  15. package/dist/cjs/components/filter-toolbar.d.ts.map +1 -0
  16. package/dist/cjs/components/filter-toolbar.js +17 -0
  17. package/dist/cjs/components/visibility-modal.d.ts +19 -0
  18. package/dist/cjs/components/visibility-modal.d.ts.map +1 -0
  19. package/dist/cjs/components/visibility-modal.js +30 -0
  20. package/dist/cjs/constants.d.ts +4 -0
  21. package/dist/cjs/constants.d.ts.map +1 -0
  22. package/dist/cjs/constants.js +6 -0
  23. package/dist/cjs/hooks/use-debounced-value.d.ts +2 -0
  24. package/dist/cjs/hooks/use-debounced-value.d.ts.map +1 -0
  25. package/dist/cjs/hooks/use-debounced-value.js +17 -0
  26. package/dist/cjs/i18n/index.d.ts +2 -4
  27. package/dist/cjs/i18n/index.d.ts.map +1 -1
  28. package/dist/cjs/i18n/index.js +1 -1
  29. package/dist/cjs/i18n/translations/en.d.ts +33 -3
  30. package/dist/cjs/i18n/translations/en.d.ts.map +1 -1
  31. package/dist/cjs/i18n/translations/en.js +33 -3
  32. package/dist/cjs/i18n/translations/tr.d.ts +33 -3
  33. package/dist/cjs/i18n/translations/tr.d.ts.map +1 -1
  34. package/dist/cjs/i18n/translations/tr.js +33 -3
  35. package/dist/cjs/index.d.ts +3 -14
  36. package/dist/cjs/index.d.ts.map +1 -1
  37. package/dist/cjs/index.js +17 -32
  38. package/dist/cjs/styles.css +179 -0
  39. package/dist/cjs/types.d.ts +11 -0
  40. package/dist/cjs/types.d.ts.map +1 -0
  41. package/dist/cjs/types.js +2 -0
  42. package/dist/cjs/utils/schema.d.ts +9 -0
  43. package/dist/cjs/utils/schema.d.ts.map +1 -0
  44. package/dist/cjs/utils/schema.js +61 -0
  45. package/dist/cjs/utils/values.d.ts +5 -0
  46. package/dist/cjs/utils/values.d.ts.map +1 -0
  47. package/dist/cjs/utils/values.js +44 -0
  48. package/dist/esm/akifilter.d.ts +53 -0
  49. package/dist/esm/akifilter.d.ts.map +1 -0
  50. package/dist/esm/akifilter.js +356 -0
  51. package/dist/esm/common/storage.d.ts +10 -0
  52. package/dist/esm/common/storage.d.ts.map +1 -0
  53. package/dist/esm/common/storage.js +114 -0
  54. package/dist/esm/common/theme-overrides.d.ts +3 -0
  55. package/dist/esm/common/theme-overrides.d.ts.map +1 -0
  56. package/dist/esm/common/theme-overrides.js +3 -0
  57. package/dist/esm/components/applied-filters.d.ts +14 -0
  58. package/dist/esm/components/applied-filters.d.ts.map +1 -0
  59. package/dist/esm/components/applied-filters.js +22 -0
  60. package/dist/esm/components/filter-toolbar.d.ts +11 -0
  61. package/dist/esm/components/filter-toolbar.d.ts.map +1 -0
  62. package/dist/esm/components/filter-toolbar.js +13 -0
  63. package/dist/esm/components/visibility-modal.d.ts +19 -0
  64. package/dist/esm/components/visibility-modal.d.ts.map +1 -0
  65. package/dist/esm/components/visibility-modal.js +26 -0
  66. package/dist/esm/constants.d.ts +4 -0
  67. package/dist/esm/constants.d.ts.map +1 -0
  68. package/dist/esm/constants.js +3 -0
  69. package/dist/esm/hooks/use-debounced-value.d.ts +2 -0
  70. package/dist/esm/hooks/use-debounced-value.d.ts.map +1 -0
  71. package/dist/esm/hooks/use-debounced-value.js +13 -0
  72. package/dist/esm/i18n/index.d.ts +2 -4
  73. package/dist/esm/i18n/index.d.ts.map +1 -1
  74. package/dist/esm/i18n/index.js +5 -5
  75. package/dist/esm/i18n/translations/en.d.ts +33 -3
  76. package/dist/esm/i18n/translations/en.d.ts.map +1 -1
  77. package/dist/esm/i18n/translations/en.js +33 -3
  78. package/dist/esm/i18n/translations/tr.d.ts +33 -3
  79. package/dist/esm/i18n/translations/tr.d.ts.map +1 -1
  80. package/dist/esm/i18n/translations/tr.js +33 -3
  81. package/dist/esm/index.d.ts +3 -14
  82. package/dist/esm/index.d.ts.map +1 -1
  83. package/dist/esm/index.js +3 -30
  84. package/dist/esm/styles.css +179 -0
  85. package/dist/esm/types.d.ts +11 -0
  86. package/dist/esm/types.d.ts.map +1 -0
  87. package/dist/esm/types.js +1 -0
  88. package/dist/esm/utils/schema.d.ts +9 -0
  89. package/dist/esm/utils/schema.d.ts.map +1 -0
  90. package/dist/esm/utils/schema.js +52 -0
  91. package/dist/esm/utils/values.d.ts +5 -0
  92. package/dist/esm/utils/values.d.ts.map +1 -0
  93. package/dist/esm/utils/values.js +39 -0
  94. package/package.json +39 -33
  95. package/dist/cjs/components/AppliedFilters/AppliedFilterItem.d.ts +0 -12
  96. package/dist/cjs/components/AppliedFilters/AppliedFilterItem.d.ts.map +0 -1
  97. package/dist/cjs/components/AppliedFilters/AppliedFilterItem.js +0 -62
  98. package/dist/cjs/components/AppliedFilters/common.d.ts +0 -6
  99. package/dist/cjs/components/AppliedFilters/common.d.ts.map +0 -1
  100. package/dist/cjs/components/AppliedFilters/common.js +0 -34
  101. package/dist/cjs/components/AppliedFilters/index.d.ts +0 -4
  102. package/dist/cjs/components/AppliedFilters/index.d.ts.map +0 -1
  103. package/dist/cjs/components/AppliedFilters/index.js +0 -26
  104. package/dist/cjs/components/AppliedFilters/styles.css +0 -65
  105. package/dist/cjs/components/ConditionalFilters/index.d.ts +0 -3
  106. package/dist/cjs/components/ConditionalFilters/index.d.ts.map +0 -1
  107. package/dist/cjs/components/ConditionalFilters/index.js +0 -32
  108. package/dist/cjs/components/FilterContext/index.d.ts +0 -45
  109. package/dist/cjs/components/FilterContext/index.d.ts.map +0 -1
  110. package/dist/cjs/components/FilterContext/index.js +0 -85
  111. package/dist/cjs/components/SelectShownFilters/index.d.ts +0 -7
  112. package/dist/cjs/components/SelectShownFilters/index.d.ts.map +0 -1
  113. package/dist/cjs/components/SelectShownFilters/index.js +0 -111
  114. package/dist/cjs/components/SelectShownFilters/styles.css +0 -99
  115. package/dist/cjs/components/ShownFilters/index.d.ts +0 -3
  116. package/dist/cjs/components/ShownFilters/index.d.ts.map +0 -1
  117. package/dist/cjs/components/ShownFilters/index.js +0 -45
  118. package/dist/cjs/components/index.d.ts +0 -6
  119. package/dist/cjs/components/index.d.ts.map +0 -1
  120. package/dist/cjs/components/index.js +0 -21
  121. package/dist/cjs/constants/index.d.ts +0 -56
  122. package/dist/cjs/constants/index.d.ts.map +0 -1
  123. package/dist/cjs/constants/index.js +0 -58
  124. package/dist/cjs/index.css +0 -67
  125. package/dist/cjs/utils/index.d.ts +0 -25
  126. package/dist/cjs/utils/index.d.ts.map +0 -1
  127. package/dist/cjs/utils/index.js +0 -40
  128. package/dist/esm/components/AppliedFilters/AppliedFilterItem.d.ts +0 -12
  129. package/dist/esm/components/AppliedFilters/AppliedFilterItem.d.ts.map +0 -1
  130. package/dist/esm/components/AppliedFilters/AppliedFilterItem.js +0 -58
  131. package/dist/esm/components/AppliedFilters/common.d.ts +0 -6
  132. package/dist/esm/components/AppliedFilters/common.d.ts.map +0 -1
  133. package/dist/esm/components/AppliedFilters/common.js +0 -29
  134. package/dist/esm/components/AppliedFilters/index.d.ts +0 -4
  135. package/dist/esm/components/AppliedFilters/index.d.ts.map +0 -1
  136. package/dist/esm/components/AppliedFilters/index.js +0 -22
  137. package/dist/esm/components/AppliedFilters/styles.css +0 -65
  138. package/dist/esm/components/ConditionalFilters/index.d.ts +0 -3
  139. package/dist/esm/components/ConditionalFilters/index.d.ts.map +0 -1
  140. package/dist/esm/components/ConditionalFilters/index.js +0 -28
  141. package/dist/esm/components/FilterContext/index.d.ts +0 -45
  142. package/dist/esm/components/FilterContext/index.d.ts.map +0 -1
  143. package/dist/esm/components/FilterContext/index.js +0 -80
  144. package/dist/esm/components/SelectShownFilters/index.d.ts +0 -7
  145. package/dist/esm/components/SelectShownFilters/index.d.ts.map +0 -1
  146. package/dist/esm/components/SelectShownFilters/index.js +0 -107
  147. package/dist/esm/components/SelectShownFilters/styles.css +0 -99
  148. package/dist/esm/components/ShownFilters/index.d.ts +0 -3
  149. package/dist/esm/components/ShownFilters/index.d.ts.map +0 -1
  150. package/dist/esm/components/ShownFilters/index.js +0 -41
  151. package/dist/esm/components/index.d.ts +0 -6
  152. package/dist/esm/components/index.d.ts.map +0 -1
  153. package/dist/esm/components/index.js +0 -5
  154. package/dist/esm/constants/index.d.ts +0 -56
  155. package/dist/esm/constants/index.d.ts.map +0 -1
  156. package/dist/esm/constants/index.js +0 -55
  157. package/dist/esm/index.css +0 -67
  158. package/dist/esm/utils/index.d.ts +0 -25
  159. package/dist/esm/utils/index.d.ts.map +0 -1
  160. package/dist/esm/utils/index.js +0 -35
@@ -0,0 +1,3 @@
1
+ import { ThemeConfig } from 'antd';
2
+ export declare const themeOverrides: ThemeConfig;
3
+ //# sourceMappingURL=theme-overrides.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"theme-overrides.d.ts","sourceRoot":"","sources":["../../../src/common/theme-overrides.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAEnC,eAAO,MAAM,cAAc,EAAE,WAkB5B,CAAC"}
@@ -0,0 +1,3 @@
1
+ var _a, _b;
2
+ import { theme } from '@akinon/ui-theme';
3
+ export const themeOverrides = Object.assign(Object.assign({}, theme), { algorithm: theme.algorithm, components: Object.assign(Object.assign({}, theme.components), { Typography: Object.assign(Object.assign({}, (_a = theme.components) === null || _a === void 0 ? void 0 : _a.Typography), { colorTextHeading: theme.colors.neutral['100'], colorText: theme.colors.neutral['500'], titleMarginBottom: 0 }), Modal: Object.assign(Object.assign({}, (_b = theme.components) === null || _b === void 0 ? void 0 : _b.Modal), { headerBg: theme.colors.ebonyClay['600'], contentBg: theme.colors.ebonyClay['600'], titleColor: theme.colors.neutral['200'] }) }) });
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ type AppliedFilter = {
3
+ key: string;
4
+ label: string;
5
+ value: string;
6
+ };
7
+ type AppliedFiltersProps = {
8
+ filters: AppliedFilter[];
9
+ onRemove: (key: string) => void;
10
+ onClearAll: () => void;
11
+ };
12
+ export declare const AppliedFilters: ({ filters, onRemove, onClearAll }: AppliedFiltersProps) => React.JSX.Element;
13
+ export type { AppliedFilter };
14
+ //# sourceMappingURL=applied-filters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"applied-filters.d.ts","sourceRoot":"","sources":["../../../src/components/applied-filters.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,KAAK,aAAa,GAAG;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,QAAQ,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,UAAU,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,mCAI5B,mBAAmB,sBAoDrB,CAAC;AAEF,YAAY,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { Icon } from '@akinon/icons';
2
+ import { Button } from '@akinon/ui-button';
3
+ import { Space } from '@akinon/ui-space';
4
+ import { Text } from '@akinon/ui-typography';
5
+ import React from 'react';
6
+ import { i18n } from '../i18n';
7
+ export const AppliedFilters = ({ filters, onRemove, onClearAll }) => {
8
+ const hasFilters = filters.length > 0;
9
+ return (React.createElement("div", { className: "akinon-filter__applied", "data-testid": "akifilter-applied" },
10
+ React.createElement(Space, { className: "akinon-filter__applied-summary", size: 8 },
11
+ React.createElement(Text, { className: "akinon-filter__applied-label" }, i18n.t('applied.label')),
12
+ hasFilters ? (React.createElement(Space, { className: "akinon-filter__applied-items", size: 8, wrap: true }, filters.map(item => (React.createElement("div", { key: `${item.key}-${item.value}`, className: "akinon-filter__chip" },
13
+ React.createElement("span", { className: "akinon-filter__chip-label" },
14
+ item.label,
15
+ ":"),
16
+ React.createElement("span", { className: "akinon-filter__chip-value" }, item.value),
17
+ React.createElement("button", { type: "button", "aria-label": i18n.t('applied.clearSingle', {
18
+ field: item.label
19
+ }), className: "akinon-filter__chip-button", onClick: () => onRemove(item.key) },
20
+ React.createElement(Icon, { icon: "no", size: 16 }))))))) : (React.createElement(Text, { className: "akinon-filter__applied-empty" }, i18n.t('applied.empty')))),
21
+ React.createElement(Button, { className: "akinon-filter__clear", icon: "bin", iconSize: 16, onClick: onClearAll, size: "small", type: "icon", title: i18n.t('applied.clearAll'), "aria-label": i18n.t('applied.clearAll'), disabled: !hasFilters })));
22
+ };
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+ type FilterToolbarProps = {
3
+ onOpenModal: () => void;
4
+ enableImportCsv?: boolean;
5
+ enableImportXls?: boolean;
6
+ onImportCsv?: () => void;
7
+ onImportXls?: () => void;
8
+ };
9
+ export declare const FilterToolbar: ({ onOpenModal, enableImportCsv, enableImportXls, onImportCsv, onImportXls }: FilterToolbarProps) => React.JSX.Element;
10
+ export {};
11
+ //# sourceMappingURL=filter-toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filter-toolbar.d.ts","sourceRoot":"","sources":["../../../src/components/filter-toolbar.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,KAAK,kBAAkB,GAAG;IACxB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,6EAM3B,kBAAkB,sBAwCpB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { Button } from '@akinon/ui-button';
2
+ import { Space } from '@akinon/ui-space';
3
+ import { Title } from '@akinon/ui-typography';
4
+ import React from 'react';
5
+ import { i18n } from '../i18n';
6
+ export const FilterToolbar = ({ onOpenModal, enableImportCsv, enableImportXls, onImportCsv, onImportXls }) => {
7
+ return (React.createElement("div", { className: "akinon-filter__top" },
8
+ React.createElement(Title, { className: "akinon-filter__title", level: 4 }, i18n.t('header.title')),
9
+ React.createElement(Space, { className: "akinon-filter__toolbar", size: 6 },
10
+ enableImportCsv && onImportCsv ? (React.createElement(Button, { className: "akinon-filter__toolbar-item", onClick: onImportCsv, type: "primary" }, i18n.t('header.actions.importCsv'))) : null,
11
+ enableImportXls && onImportXls ? (React.createElement(Button, { className: "akinon-filter__toolbar-item", onClick: onImportXls, type: "primary" }, i18n.t('header.actions.importXls'))) : null,
12
+ React.createElement(Button, { className: "akinon-filter__toolbar-item", icon: "filter", iconSize: 16, onClick: onOpenModal, type: "primary", title: i18n.t('header.actions.selectFilters'), "aria-label": i18n.t('header.actions.selectFilters') }))));
13
+ };
@@ -0,0 +1,19 @@
1
+ import type { FieldValues } from '@akinon/akiform';
2
+ import React from 'react';
3
+ import type { AkifilterField } from '../types';
4
+ type VisibilityModalProps<TFieldValues extends FieldValues = FieldValues> = {
5
+ open: boolean;
6
+ searchTerm: string;
7
+ paginatedFields: AkifilterField<TFieldValues>[];
8
+ filteredCount: number;
9
+ visibleKeys: string[];
10
+ onClose: () => void;
11
+ onSearchTermChange: (value: string) => void;
12
+ onToggleVisibility: (key: string) => void;
13
+ onPaginationChange: (page: number, pageSize: number) => void;
14
+ page: number;
15
+ pageSize: number;
16
+ };
17
+ export declare const VisibilityModal: <TFieldValues extends FieldValues = FieldValues>({ open, searchTerm, paginatedFields, filteredCount, visibleKeys, onClose, onSearchTermChange, onToggleVisibility, onPaginationChange, page, pageSize }: VisibilityModalProps<TFieldValues>) => React.JSX.Element;
18
+ export {};
19
+ //# sourceMappingURL=visibility-modal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"visibility-modal.d.ts","sourceRoot":"","sources":["../../../src/components/visibility-modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAOnD,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAG/C,KAAK,oBAAoB,CAAC,YAAY,SAAS,WAAW,GAAG,WAAW,IAAI;IAC1E,IAAI,EAAE,OAAO,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,cAAc,CAAC,YAAY,CAAC,EAAE,CAAC;IAChD,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,kBAAkB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1C,kBAAkB,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7D,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,wJAYC,oBAAoB,CAAC,YAAY,CAAC,sBAmEpC,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { Icon } from '@akinon/icons';
2
+ import { Checkbox } from '@akinon/ui-checkbox';
3
+ import { Input } from '@akinon/ui-input';
4
+ import { Modal } from '@akinon/ui-modal';
5
+ import { Pagination } from '@akinon/ui-pagination';
6
+ import { Text } from '@akinon/ui-typography';
7
+ import React from 'react';
8
+ import { i18n } from '../i18n';
9
+ import { getDisplayLabel } from '../utils/schema';
10
+ export const VisibilityModal = ({ open, searchTerm, paginatedFields, filteredCount, visibleKeys, onClose, onSearchTermChange, onToggleVisibility, onPaginationChange, page, pageSize }) => {
11
+ const handleSearchChange = React.useCallback(event => {
12
+ onSearchTermChange(event.target.value);
13
+ }, [onSearchTermChange]);
14
+ return (React.createElement(Modal, { className: "akinon-filter__modal", open: open, onCancel: onClose, footer: null, width: 680, title: i18n.t('modal.title'), destroyOnClose: true },
15
+ React.createElement("div", { className: "akinon-filter__modal-toolbar" },
16
+ React.createElement(Input, { allowClear: true, prefix: React.createElement(Icon, { icon: "search", size: "16", className: "mr-2" }), placeholder: i18n.t('modal.searchPlaceholder'), value: searchTerm, onChange: event => {
17
+ handleSearchChange(event);
18
+ onPaginationChange(1, pageSize);
19
+ }, size: "large" })),
20
+ React.createElement("div", { className: "akinon-filter__modal-list" }, paginatedFields.length === 0 ? (React.createElement(Text, { type: "secondary" }, i18n.t('modal.empty'))) : (paginatedFields.map(field => {
21
+ const key = String(field.key);
22
+ return (React.createElement(Checkbox, { key: key, checked: visibleKeys.includes(key), onChange: () => onToggleVisibility(key), className: "akinon-filter__modal-checkbox" }, getDisplayLabel(field)));
23
+ }))),
24
+ filteredCount > pageSize ? (React.createElement("div", { className: "akinon-filter__modal-pagination" },
25
+ React.createElement(Pagination, { current: page, pageSize: pageSize, total: filteredCount, showSizeChanger: false, onChange: onPaginationChange }))) : null));
26
+ };
@@ -0,0 +1,4 @@
1
+ export declare const DEFAULT_VISIBLE_COUNT = 8;
2
+ export declare const DEFAULT_MODAL_PAGE_SIZE = 40;
3
+ export declare const FILTER_DEBOUNCE_DELAY = 300;
4
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,eAAO,MAAM,uBAAuB,KAAK,CAAC;AAC1C,eAAO,MAAM,qBAAqB,MAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ export const DEFAULT_VISIBLE_COUNT = 8;
2
+ export const DEFAULT_MODAL_PAGE_SIZE = 40;
3
+ export const FILTER_DEBOUNCE_DELAY = 300;
@@ -0,0 +1,2 @@
1
+ export declare const useDebouncedValue: <T>(value: T, delay: number) => T;
2
+ //# sourceMappingURL=use-debounced-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-debounced-value.d.ts","sourceRoot":"","sources":["../../../src/hooks/use-debounced-value.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,GAAI,CAAC,EAAE,OAAO,CAAC,EAAE,OAAO,MAAM,KAAG,CAc9D,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { useEffect, useState } from 'react';
2
+ export const useDebouncedValue = (value, delay) => {
3
+ const [debouncedValue, setDebouncedValue] = useState(value);
4
+ useEffect(() => {
5
+ const timer = setTimeout(() => {
6
+ setDebouncedValue(value);
7
+ }, delay);
8
+ return () => {
9
+ clearTimeout(timer);
10
+ };
11
+ }, [delay, value]);
12
+ return debouncedValue;
13
+ };
@@ -1,5 +1,3 @@
1
- export declare const i18n: {
2
- t: (key: string, options?: import("i18next").TOptions | undefined) => string;
3
- lng: string;
4
- };
1
+ import { type AkilocaleInstance } from '@akinon/akilocale';
2
+ export declare const i18n: AkilocaleInstance;
5
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/i18n/index.tsx"],"names":[],"mappings":"AAKA,eAAO,MAAM,IAAI;;;CAOf,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAKtE,eAAO,MAAM,IAAI,EAAE,iBAOjB,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import { Akilocale } from '@akinon/akilocale';
2
- import en_filter from './translations/en';
3
- import tr_filter from './translations/tr';
2
+ import en from './translations/en';
3
+ import tr from './translations/tr';
4
4
  export const i18n = Akilocale.createInstance({
5
- debug: true,
5
+ debug: false,
6
6
  fallbackLng: 'en',
7
7
  translations: {
8
- en: en_filter,
9
- tr: tr_filter
8
+ en,
9
+ tr
10
10
  }
11
11
  });
@@ -1,5 +1,35 @@
1
- declare const filter: {
2
- readonly title: "Filters";
1
+ declare const translations: {
2
+ readonly header: {
3
+ readonly title: "Filters";
4
+ readonly actions: {
5
+ readonly selectFilters: "Select filters";
6
+ readonly importCsv: "Import CSV";
7
+ readonly importXls: "Import XLS/XLSX";
8
+ };
9
+ };
10
+ readonly applied: {
11
+ readonly label: "Active filters:";
12
+ readonly empty: "No filters applied yet.";
13
+ readonly clearAll: "Clear all";
14
+ readonly clearSingle: "Remove {{field}}";
15
+ };
16
+ readonly form: {
17
+ readonly noVisibleFields: "Select at least one filter to get started.";
18
+ readonly unsupportedField: "Field type \"{{field}}\" is not supported yet.";
19
+ };
20
+ readonly modal: {
21
+ readonly title: "Select visible filters";
22
+ readonly searchPlaceholder: "Search filters by name…";
23
+ readonly empty: "No filters match your search.";
24
+ };
25
+ readonly emptyState: {
26
+ readonly message: "Provide a filter schema to render the Akifilter component.";
27
+ };
28
+ readonly errors: {
29
+ readonly title: "Akifilter failed to load";
30
+ readonly description: "An unexpected error occurred while rendering the filters. Try again or refresh the page.";
31
+ readonly retry: "Try again";
32
+ };
3
33
  };
4
- export default filter;
34
+ export default translations;
5
35
  //# sourceMappingURL=en.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/i18n/translations/en.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM;;CAEF,CAAC;AAEX,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"en.d.ts","sourceRoot":"","sources":["../../../../src/i18n/translations/en.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCR,CAAC;AAEX,eAAe,YAAY,CAAC"}
@@ -1,4 +1,34 @@
1
- const filter = {
2
- title: 'Filters'
1
+ const translations = {
2
+ header: {
3
+ title: 'Filters',
4
+ actions: {
5
+ selectFilters: 'Select filters',
6
+ importCsv: 'Import CSV',
7
+ importXls: 'Import XLS/XLSX'
8
+ }
9
+ },
10
+ applied: {
11
+ label: 'Active filters:',
12
+ empty: 'No filters applied yet.',
13
+ clearAll: 'Clear all',
14
+ clearSingle: 'Remove {{field}}'
15
+ },
16
+ form: {
17
+ noVisibleFields: 'Select at least one filter to get started.',
18
+ unsupportedField: 'Field type "{{field}}" is not supported yet.'
19
+ },
20
+ modal: {
21
+ title: 'Select visible filters',
22
+ searchPlaceholder: 'Search filters by name…',
23
+ empty: 'No filters match your search.'
24
+ },
25
+ emptyState: {
26
+ message: 'Provide a filter schema to render the Akifilter component.'
27
+ },
28
+ errors: {
29
+ title: 'Akifilter failed to load',
30
+ description: 'An unexpected error occurred while rendering the filters. Try again or refresh the page.',
31
+ retry: 'Try again'
32
+ }
3
33
  };
4
- export default filter;
34
+ export default translations;
@@ -1,5 +1,35 @@
1
- declare const filter: {
2
- readonly title: "Filtreler";
1
+ declare const translations: {
2
+ readonly header: {
3
+ readonly title: "Filtreler";
4
+ readonly actions: {
5
+ readonly selectFilters: "Filtreleri seç";
6
+ readonly importCsv: "CSV içe aktar";
7
+ readonly importXls: "XLS/XLSX içe aktar";
8
+ };
9
+ };
10
+ readonly applied: {
11
+ readonly label: "Aktif filtreler:";
12
+ readonly empty: "Henüz filtre uygulanmadı.";
13
+ readonly clearAll: "Tümünü temizle";
14
+ readonly clearSingle: "{{field}} filtresini kaldır";
15
+ };
16
+ readonly form: {
17
+ readonly noVisibleFields: "Başlamak için en az bir filtre seçin.";
18
+ readonly unsupportedField: "\"{{field}}\" alan tipi henüz desteklenmiyor.";
19
+ };
20
+ readonly modal: {
21
+ readonly title: "Görünen filtreleri seçin";
22
+ readonly searchPlaceholder: "Filtrelerde ara…";
23
+ readonly empty: "Aramanızla eşleşen filtre bulunamadı.";
24
+ };
25
+ readonly emptyState: {
26
+ readonly message: "Akifilter bileşenini göstermek için bir filtre şeması belirtin.";
27
+ };
28
+ readonly errors: {
29
+ readonly title: "Akifilter yüklenemedi";
30
+ readonly description: "Filtreler render edilirken beklenmeyen bir hata oluştu. Lütfen tekrar deneyin veya sayfayı yenileyin.";
31
+ readonly retry: "Tekrar dene";
32
+ };
3
33
  };
4
- export default filter;
34
+ export default translations;
5
35
  //# sourceMappingURL=tr.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tr.d.ts","sourceRoot":"","sources":["../../../../src/i18n/translations/tr.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,MAAM;;CAEF,CAAC;AAEX,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"tr.d.ts","sourceRoot":"","sources":["../../../../src/i18n/translations/tr.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCR,CAAC;AAEX,eAAe,YAAY,CAAC"}
@@ -1,4 +1,34 @@
1
- const filter = {
2
- title: 'Filtreler'
1
+ const translations = {
2
+ header: {
3
+ title: 'Filtreler',
4
+ actions: {
5
+ selectFilters: 'Filtreleri seç',
6
+ importCsv: 'CSV içe aktar',
7
+ importXls: 'XLS/XLSX içe aktar'
8
+ }
9
+ },
10
+ applied: {
11
+ label: 'Aktif filtreler:',
12
+ empty: 'Henüz filtre uygulanmadı.',
13
+ clearAll: 'Tümünü temizle',
14
+ clearSingle: '{{field}} filtresini kaldır'
15
+ },
16
+ form: {
17
+ noVisibleFields: 'Başlamak için en az bir filtre seçin.',
18
+ unsupportedField: '"{{field}}" alan tipi henüz desteklenmiyor.'
19
+ },
20
+ modal: {
21
+ title: 'Görünen filtreleri seçin',
22
+ searchPlaceholder: 'Filtrelerde ara…',
23
+ empty: 'Aramanızla eşleşen filtre bulunamadı.'
24
+ },
25
+ emptyState: {
26
+ message: 'Akifilter bileşenini göstermek için bir filtre şeması belirtin.'
27
+ },
28
+ errors: {
29
+ title: 'Akifilter yüklenemedi',
30
+ description: 'Filtreler render edilirken beklenmeyen bir hata oluştu. Lütfen tekrar deneyin veya sayfayı yenileyin.',
31
+ retry: 'Tekrar dene'
32
+ }
3
33
  };
4
- export default filter;
34
+ export default translations;
@@ -1,15 +1,4 @@
1
- import './index.css';
2
- import type { FormField } from '@akinon/akiform-builder';
3
- import React from 'react';
4
- import type { FilterState } from './components/FilterContext';
5
- export type FilterProps = {
6
- filterSchema: FormField[];
7
- useAppliedFilters: [
8
- FilterState['appliedFilters'],
9
- React.Dispatch<React.SetStateAction<FilterState['appliedFilters']>>
10
- ];
11
- conditionalFiltersSchema?: FormField[];
12
- customMainPath?: string;
13
- };
14
- export declare const Akifilter: ({ filterSchema, useAppliedFilters, customMainPath, conditionalFiltersSchema }: FilterProps) => React.JSX.Element;
1
+ export * from './akifilter';
2
+ export * from './i18n';
3
+ export * from './types';
15
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,aAAa,CAAC;AAErB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAWzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAS1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAY9D,MAAM,MAAM,WAAW,GAAG;IAExB,YAAY,EAAE,SAAS,EAAE,CAAC;IAG1B,iBAAiB,EAAE;QACjB,WAAW,CAAC,gBAAgB,CAAC;QAC7B,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAC;KACpE,CAAC;IAOF,wBAAwB,CAAC,EAAE,SAAS,EAAE,CAAC;IAEvC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,eAAO,MAAM,SAAS,kFAKnB,WAAW,sBAsBb,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
package/dist/esm/index.js CHANGED
@@ -1,30 +1,3 @@
1
- import './index.css';
2
- import { Title } from '@akinon/ui-typography';
3
- import dayjs from 'dayjs';
4
- import advancedFormat from 'dayjs/plugin/advancedFormat';
5
- import customParseFormat from 'dayjs/plugin/customParseFormat';
6
- import localeData from 'dayjs/plugin/localeData';
7
- import weekday from 'dayjs/plugin/weekday';
8
- import weekOfYear from 'dayjs/plugin/weekOfYear';
9
- import weekYear from 'dayjs/plugin/weekYear';
10
- import React from 'react';
11
- import { AppliedFilters, ConditionalFilters, FilterContextProvider, SelectShownFilters, ShownFilters } from './components';
12
- import { i18n } from './i18n';
13
- // TODO: Whats this dayjs block doing here?
14
- // extend dayjs with plugins so datepicker value can be set outside
15
- dayjs.extend(customParseFormat);
16
- dayjs.extend(advancedFormat);
17
- dayjs.extend(weekday);
18
- dayjs.extend(localeData);
19
- dayjs.extend(weekOfYear);
20
- dayjs.extend(weekYear);
21
- export const Akifilter = ({ filterSchema, useAppliedFilters, customMainPath, conditionalFiltersSchema }) => {
22
- return (React.createElement("div", { className: "akinon-filter" },
23
- React.createElement(FilterContextProvider, { filterSchema: filterSchema, customMainPath: customMainPath, useAppliedFilters: useAppliedFilters, conditionalFiltersSchema: conditionalFiltersSchema },
24
- React.createElement("div", { className: "akinon-filter__top" },
25
- React.createElement(Title, { className: "akinon-filter__title", level: 4 }, i18n.t('title')),
26
- React.createElement(SelectShownFilters, null)),
27
- React.createElement(AppliedFilters, null),
28
- React.createElement(ShownFilters, null),
29
- React.createElement(ConditionalFilters, null))));
30
- };
1
+ export * from './akifilter';
2
+ export * from './i18n';
3
+ export * from './types';
@@ -0,0 +1,179 @@
1
+ .akinon-filter {
2
+ }
3
+
4
+ .akinon-filter__top {
5
+ display: flex;
6
+ align-items: center;
7
+ justify-content: space-between;
8
+ gap: 1rem;
9
+ margin-bottom: 0.5rem;
10
+ }
11
+
12
+ .akinon-filter__title {
13
+ margin: 0;
14
+ font-weight: 600;
15
+ }
16
+
17
+ .akinon-filter__toolbar-item {
18
+ padding: 0;
19
+ margin: 0;
20
+ display: flex;
21
+ align-items: center;
22
+ height: 36px;
23
+ }
24
+
25
+ .akinon-filter__applied {
26
+ display: flex;
27
+ align-items: center;
28
+ padding: 6px;
29
+ background-color: var(--color-ebonyClay-500);
30
+ border-radius: 6px;
31
+ box-shadow: inset 0 1px 4px 0 rgba(0, 0, 0, 0.2);
32
+ margin-bottom: 1rem;
33
+ }
34
+
35
+ .akinon-filter__applied-summary {
36
+ background-color: var(--color-ebonyClay-900);
37
+ flex: 1;
38
+ display: flex;
39
+ align-items: center;
40
+ border-radius: 5px;
41
+ padding: 6px 8px;
42
+ margin-right: 6px;
43
+ height: 36px;
44
+ }
45
+
46
+ .akinon-filter__applied-label {
47
+ color: var(--color-white);
48
+ font-weight: 600;
49
+ font-size: 13px;
50
+ position: relative;
51
+ top: 1px;
52
+ }
53
+
54
+ .akinon-filter__form-grid {
55
+ display: grid;
56
+ grid-template-columns: repeat(4, minmax(0, 1fr));
57
+ gap: 8px;
58
+ }
59
+
60
+ .akinon-filter__form-grid > .akinon-form-item {
61
+ width: 100%;
62
+ }
63
+
64
+ .akinon-filter__form-grid > .akinon-form-item .akinon-form-item-control {
65
+ width: 100%;
66
+ }
67
+
68
+ @media (max-width: 1024px) {
69
+ .akinon-filter__form-grid {
70
+ grid-template-columns: repeat(2, minmax(0, 1fr));
71
+ }
72
+ }
73
+
74
+ @media (max-width: 640px) {
75
+ .akinon-filter__form-grid {
76
+ grid-template-columns: minmax(0, 1fr);
77
+ }
78
+ }
79
+
80
+ .akinon-filter__applied-items {
81
+ display: flex;
82
+ flex-wrap: wrap;
83
+ gap: 8px;
84
+ }
85
+
86
+ .akinon-filter__chip {
87
+ display: inline-flex;
88
+ align-items: center;
89
+ justify-content: center;
90
+ gap: 2px;
91
+ padding: 0 6px;
92
+ border-radius: 4px;
93
+ background-color: var(--color-neutral-100);
94
+ height: 24px;
95
+ }
96
+
97
+ .akinon-filter__chip-label {
98
+ font-weight: 600;
99
+ color: var(--color-ebonyClay-300);
100
+ }
101
+
102
+ .akinon-filter__chip-value {
103
+ font-weight: 700;
104
+ color: var(--color-ebonyClay-400);
105
+ }
106
+
107
+ .akinon-filter__chip-button {
108
+ margin: 0 0 0 0.25rem;
109
+ padding: 0;
110
+ line-height: 1;
111
+ border: none;
112
+ outline: none;
113
+ cursor: pointer;
114
+ color: var(--color-blue-500);
115
+ position: relative;
116
+ top: 1px;
117
+ }
118
+
119
+ .akinon-filter__applied-empty {
120
+ color: color(--color-ebonyClay-500);
121
+ font-size: 12px;
122
+ position: relative;
123
+ top: 1px;
124
+ }
125
+
126
+ .akinon-filter__modal-list {
127
+ display: grid;
128
+ grid-template-columns: repeat(3, minmax(0, 1fr));
129
+ gap: 12px;
130
+ margin-top: 16px;
131
+ }
132
+
133
+ .akinon-filter__modal-checkbox {
134
+ width: 100%;
135
+ }
136
+
137
+ .akinon-filter__modal-pagination {
138
+ margin-top: 1rem;
139
+ display: flex;
140
+ justify-content: flex-end;
141
+ }
142
+
143
+ @media (max-width: 1024px) {
144
+ .akinon-filter__modal-list {
145
+ grid-template-columns: repeat(2, minmax(0, 1fr));
146
+ }
147
+ }
148
+
149
+ @media (max-width: 640px) {
150
+ .akinon-filter__modal-list {
151
+ grid-template-columns: minmax(0, 1fr);
152
+ }
153
+ }
154
+
155
+ .akinon-filter__empty-state,
156
+ .akinon-filter__error-state {
157
+ min-height: 160px;
158
+ display: flex;
159
+ flex-direction: column;
160
+ align-items: center;
161
+ justify-content: center;
162
+ gap: 12px;
163
+ padding: 24px;
164
+ text-align: center;
165
+ }
166
+
167
+ .akinon-filter__error-title {
168
+ margin: 0;
169
+ }
170
+
171
+ .akinon-filter__error-description {
172
+ max-width: 360px;
173
+ }
174
+
175
+ /* Modal window. */
176
+
177
+ .akinon-filter__modal-toolbar {
178
+ margin-bottom: 1rem;
179
+ }
@@ -0,0 +1,11 @@
1
+ import type { FieldValues, Path } from '@akinon/akiform';
2
+ import type { FormField } from '@akinon/akiform-builder';
3
+ export type AkifilterField<TFieldValues extends FieldValues = FieldValues> = FormField<TFieldValues> & {
4
+ /**
5
+ * Controls whether the field is shown in the main filter form by default.
6
+ */
7
+ isVisible?: boolean;
8
+ };
9
+ export type AkifilterFieldKey<TFieldValues extends FieldValues = FieldValues> = Path<TFieldValues>;
10
+ export type AkifilterSchema<TFieldValues extends FieldValues = FieldValues> = AkifilterField<TFieldValues>[];
11
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD,MAAM,MAAM,cAAc,CAAC,YAAY,SAAS,WAAW,GAAG,WAAW,IACvE,SAAS,CAAC,YAAY,CAAC,GAAG;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEJ,MAAM,MAAM,iBAAiB,CAAC,YAAY,SAAS,WAAW,GAAG,WAAW,IAC1E,IAAI,CAAC,YAAY,CAAC,CAAC;AAErB,MAAM,MAAM,eAAe,CAAC,YAAY,SAAS,WAAW,GAAG,WAAW,IACxE,cAAc,CAAC,YAAY,CAAC,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,9 @@
1
+ import type { FieldValues } from '@akinon/akiform';
2
+ import type { AkifilterField, AkifilterSchema } from '../types';
3
+ export declare const getDisplayLabel: <TFieldValues extends FieldValues = FieldValues>(field: AkifilterField<TFieldValues>) => string;
4
+ export declare const getFieldAriaLabel: <TFieldValues extends FieldValues = FieldValues>(field: AkifilterField<TFieldValues>) => string;
5
+ export declare const ensureSchemaOrder: <TFieldValues extends FieldValues = FieldValues>(schema: AkifilterSchema<TFieldValues>, keys: string[]) => string[];
6
+ export declare const deriveDefaultVisibleKeys: <TFieldValues extends FieldValues = FieldValues>(schema: AkifilterSchema<TFieldValues>) => string[];
7
+ export declare const extractDefaultValues: <TFieldValues extends FieldValues = FieldValues>(schema: AkifilterSchema<TFieldValues>) => Partial<TFieldValues>;
8
+ export declare const normaliseValuesBySchema: <TFieldValues extends FieldValues = FieldValues>(schema: AkifilterSchema<TFieldValues>, values?: Partial<TFieldValues>) => Partial<TFieldValues>;
9
+ //# sourceMappingURL=schema.d.ts.map