@ztwoint/z-ui 0.1.130 → 0.1.131

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 (34) hide show
  1. package/dist/components/checkbox-filter/checkbox-filter-popover-field.d.ts +8 -0
  2. package/dist/components/checkbox-filter/checkbox-filter-popover-field.hook.d.ts +11 -0
  3. package/dist/components/checkbox-filter/checkbox-filter-popover-field.hook.js +23 -0
  4. package/dist/components/checkbox-filter/checkbox-filter-popover-field.js +44 -0
  5. package/dist/components/checkbox-filter/checkbox-filter.d.ts +2 -0
  6. package/dist/components/checkbox-filter/checkbox-filter.hook.d.ts +11 -0
  7. package/dist/components/checkbox-filter/checkbox-filter.hook.js +31 -0
  8. package/dist/components/checkbox-filter/checkbox-filter.js +64 -0
  9. package/dist/components/checkbox-filter/checkbox-filter.type.d.ts +2 -0
  10. package/dist/components/checkbox-filter/index.d.ts +7 -0
  11. package/dist/components/checkbox-filter/index.js +7 -0
  12. package/dist/components/primitives/popover-compact/index.d.ts +2 -0
  13. package/dist/components/primitives/popover-compact/popover-compact.d.ts +12 -0
  14. package/dist/components/primitives/popover-compact/popover-compact.js +30 -0
  15. package/dist/components/primitives/table-card/table-card.js +4 -3
  16. package/dist/components/table/components/cell/avatar-cell.js +4 -3
  17. package/dist/components/table/table-provider.js +2 -1
  18. package/dist/components/table-filter/filters/index.d.ts +0 -1
  19. package/dist/components/table-filter/table-filter-button.js +12 -12
  20. package/dist/components/table-filter/table-filter-column-button.js +6 -6
  21. package/dist/index.d.ts +2 -0
  22. package/dist/index.js +319 -315
  23. package/dist/types/components/checkbox-filter/checkbox-filter-popover-field.d.ts +8 -0
  24. package/dist/types/components/checkbox-filter/checkbox-filter-popover-field.hook.d.ts +11 -0
  25. package/dist/types/components/checkbox-filter/checkbox-filter.d.ts +2 -0
  26. package/dist/types/components/checkbox-filter/checkbox-filter.hook.d.ts +11 -0
  27. package/dist/types/components/checkbox-filter/checkbox-filter.type.d.ts +2 -0
  28. package/dist/types/components/checkbox-filter/index.d.ts +7 -0
  29. package/dist/types/components/primitives/popover-compact/index.d.ts +2 -0
  30. package/dist/types/components/primitives/popover-compact/popover-compact.d.ts +12 -0
  31. package/dist/types/components/table-filter/filters/index.d.ts +0 -1
  32. package/dist/types/index.d.ts +2 -0
  33. package/package.json +1 -1
  34. package/dist/components/table-filter/filters/checkbox.js +0 -70
@@ -0,0 +1,8 @@
1
+ import { CheckboxFilterProps } from './checkbox-filter.type';
2
+ interface CheckboxFilterPopoverFieldProps extends Omit<CheckboxFilterProps, 'value' | 'onChange'> {
3
+ placeholder?: string;
4
+ value?: string[];
5
+ onChange: (value: string[]) => void;
6
+ }
7
+ export declare const CheckboxFilterPopoverField: React.FC<CheckboxFilterPopoverFieldProps>;
8
+ export {};
@@ -0,0 +1,11 @@
1
+ interface UseCheckboxFilterPopoverFieldProps {
2
+ placeholder?: string;
3
+ value?: string | string[];
4
+ }
5
+ export declare const useCheckboxFilterPopoverField: ({ value, placeholder, }: UseCheckboxFilterPopoverFieldProps) => {
6
+ isOpen: boolean;
7
+ displayText: string;
8
+ handleOpenChange: (open: boolean) => void;
9
+ handleInputClick: () => void;
10
+ };
11
+ export {};
@@ -0,0 +1,2 @@
1
+ import { CheckboxFilterProps } from './checkbox-filter.type';
2
+ export declare const CheckboxFilter: React.FC<CheckboxFilterProps>;
@@ -0,0 +1,11 @@
1
+ import { FilterOption } from '../table-filter/table-filter.type';
2
+ import { CheckboxFilterProps } from './checkbox-filter.type';
3
+ export declare const useCheckboxFilter: ({ value, onChange, filterOptions }: CheckboxFilterProps) => {
4
+ selectedValues: string[];
5
+ searchValue: string;
6
+ filteredOptions: FilterOption[];
7
+ onSearchChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
8
+ handleCheckboxChange: (optionValue: string, checked: boolean) => void;
9
+ onClearSearch: () => void;
10
+ isSelected: (optionValue: string) => boolean;
11
+ };
@@ -0,0 +1,2 @@
1
+ import { FilterComponentProps } from '../table-filter/table-filter.type';
2
+ export type CheckboxFilterProps = FilterComponentProps;
@@ -0,0 +1,7 @@
1
+ import { CheckboxFilter } from './checkbox-filter';
2
+ import { CheckboxFilterPopoverField } from './checkbox-filter-popover-field';
3
+ declare const CheckboxFilterComponent: typeof CheckboxFilter & {
4
+ PopoverField: typeof CheckboxFilterPopoverField;
5
+ };
6
+ export { CheckboxFilterComponent as CheckboxFilter };
7
+ export type { CheckboxFilterProps } from './checkbox-filter.type';
@@ -0,0 +1,2 @@
1
+ export { PopoverCompact } from './popover-compact';
2
+ export type { PopoverCompactProps } from './popover-compact';
@@ -0,0 +1,12 @@
1
+ import { ReactNode } from 'react';
2
+ export interface PopoverCompactProps {
3
+ trigger: ReactNode;
4
+ children: ReactNode;
5
+ open?: boolean;
6
+ onOpenChange?: (open: boolean) => void;
7
+ contentClassName?: string;
8
+ sideOffset?: number;
9
+ align?: 'start' | 'center' | 'end';
10
+ width?: string;
11
+ }
12
+ export declare function PopoverCompact({ trigger, children, open: controlledOpen, onOpenChange: controlledOnOpenChange, contentClassName, sideOffset, align, width, }: PopoverCompactProps): import("react/jsx-runtime").JSX.Element;
@@ -1,4 +1,3 @@
1
1
  export * from './text';
2
2
  export * from './boolean';
3
3
  export * from './number';
4
- export * from './checkbox';
@@ -4,6 +4,7 @@ export * from './components/button/button';
4
4
  export * from './components/collapsible-side-nav-bar';
5
5
  export * from './components/country-flags/country-flags';
6
6
  export * from './components/checkbox/checkbox';
7
+ export * from './components/checkbox-filter';
7
8
  export * from './components/dialog/dialog';
8
9
  export * from './components/dropdown/z2-dropdown';
9
10
  export * from './components/dropdown-menu/z2-dropdown-menu';
@@ -12,6 +13,7 @@ export * from './components/input/input';
12
13
  export * from './components/nav-header';
13
14
  export * from './components/select/z2-select';
14
15
  export * from './components/primitives/select-compact/select-compact';
16
+ export * from './components/primitives/popover-compact';
15
17
  export * from './components/stepper';
16
18
  export * from './components/stepper-item/stepper-item';
17
19
  export * from './components/tab/tab';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztwoint/z-ui",
3
- "version": "0.1.130",
3
+ "version": "0.1.131",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -1,70 +0,0 @@
1
- import { jsx as t, jsxs as s } from "react/jsx-runtime";
2
- import { useState as d, useEffect as h } from "react";
3
- import { Virtuoso as k } from "react-virtuoso";
4
- import { MagnifierIcon as y } from "../../assets/icons/magnifier-icon.js";
5
- import S from "../../assets/icons/x.js";
6
- import { Z2Checkbox as w } from "../../checkbox/checkbox.js";
7
- const E = ({ value: n, onChange: f, filterOptions: r = [] }) => {
8
- const [c, o] = d([]), [m, u] = d(""), [x, i] = d(r), p = (l) => {
9
- u(l.target.value);
10
- const e = r.filter(
11
- (a) => a.label.toLowerCase().includes(l.target.value.toLowerCase())
12
- );
13
- i(e);
14
- };
15
- h(() => {
16
- n && Array.isArray(n.value) ? o(n.value.filter(Boolean) ?? []) : o([]);
17
- }, [n]), h(() => {
18
- i(r);
19
- }, [r]);
20
- const b = (l, e) => {
21
- let a;
22
- e ? a = [...c, l] : a = c.filter((N) => N !== l), o(a), f({ value: a });
23
- }, C = () => {
24
- u(""), i(r);
25
- }, g = (l) => c.includes(l), v = (l, e) => /* @__PURE__ */ s("div", { className: "flex justify-between items-center py-2 px-3", children: [
26
- /* @__PURE__ */ s("label", { className: "flex items-center space-x-2 cursor-pointer", children: [
27
- /* @__PURE__ */ t(
28
- w,
29
- {
30
- checked: g(e.value),
31
- onCheckedChange: (a) => b(e.value, a === !0)
32
- }
33
- ),
34
- /* @__PURE__ */ t("span", { className: "text-text-neutral-primary leading-none-medium-sm", children: e.label })
35
- ] }),
36
- e.total && /* @__PURE__ */ s("span", { className: "text-text-neutral-muted text-sm", children: [
37
- "[",
38
- e.total,
39
- "]"
40
- ] })
41
- ] });
42
- return r.length === 0 ? /* @__PURE__ */ t("div", { className: "text-text-neutral-muted text-sm p-4", children: "No filter options available for this column" }) : /* @__PURE__ */ s("div", { className: "flex flex-col h-full", children: [
43
- /* @__PURE__ */ s("div", { className: "relative border-b border-stroke-solid-medium", children: [
44
- /* @__PURE__ */ t(y, { className: "absolute left-3 top-3.5 text-text-neutral-muted" }),
45
- /* @__PURE__ */ t(
46
- "input",
47
- {
48
- placeholder: "Search options",
49
- value: m,
50
- onChange: p,
51
- className: "border-none outline-none bg-surface-neutral-default text-text-neutral-primary rounded p-3 pl-8 leading-none-medium-sm w-full"
52
- }
53
- ),
54
- m && /* @__PURE__ */ t("span", { className: "absolute right-3 top-3.5", onClick: C, children: /* @__PURE__ */ t(S, {}) })
55
- ] }),
56
- /* @__PURE__ */ t("div", { className: "flex-1", children: /* @__PURE__ */ t(
57
- k,
58
- {
59
- data: x,
60
- itemContent: v,
61
- className: "h-full min-h-60",
62
- style: { height: "100%" },
63
- overscan: 5
64
- }
65
- ) })
66
- ] });
67
- };
68
- export {
69
- E as default
70
- };