@konstructio/ui 0.1.0-alpha.8 → 0.1.0-alpha.9

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,41 +1,42 @@
1
- import { jsxs as t, jsx as e } from "react/jsx-runtime";
2
- import { Badge as c } from "../../../Badge/Badge.js";
3
- import { Button as s } from "../../../Button/Button.js";
4
- import { Checkbox as x } from "../../../Checkbox/Checkbox.js";
5
- import { cn as o } from "../../../../utils/index.js";
6
- import { filterButtonIconVariants as C, filterButtonVariants as y } from "../../Filter.variants.js";
7
- import { useBadgeMultiSelect as N } from "./BadgeMultiSelect.hook.js";
8
- import { C as B } from "../../../../chevron-down-UW8ts6wI.js";
9
- const V = ({
10
- options: n,
11
- label: m,
12
- onApply: p
1
+ import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
+ import { Badge as o } from "../../../Badge/Badge.js";
3
+ import { Button as m } from "../../../Button/Button.js";
4
+ import { Checkbox as C } from "../../../Checkbox/Checkbox.js";
5
+ import { cn as n } from "../../../../utils/index.js";
6
+ import { filterButtonIconVariants as y, filterButtonVariants as N } from "../../Filter.variants.js";
7
+ import { useBadgeMultiSelect as B } from "./BadgeMultiSelect.hook.js";
8
+ import { C as O } from "../../../../chevron-down-UW8ts6wI.js";
9
+ const $ = ({
10
+ options: i,
11
+ label: p,
12
+ position: d = "left",
13
+ onApply: f
13
14
  }) => {
14
15
  const {
15
- wrapperRef: f,
16
+ wrapperRef: h,
16
17
  isOpen: l,
17
- selectedOptions: h,
18
- selectedCount: i,
19
- handleOpen: u,
20
- handleResetOptions: g,
21
- handleApplyOptions: b,
22
- handleSelectOption: v
23
- } = N({ onApply: p });
24
- return n.length === 0 ? null : /* @__PURE__ */ t("div", { ref: f, className: "relative", children: [
25
- /* @__PURE__ */ t(
18
+ selectedOptions: u,
19
+ selectedCount: c,
20
+ handleOpen: g,
21
+ handleResetOptions: b,
22
+ handleApplyOptions: v,
23
+ handleSelectOption: x
24
+ } = B({ onApply: f });
25
+ return i.length === 0 ? null : /* @__PURE__ */ a("div", { ref: h, className: "relative", children: [
26
+ /* @__PURE__ */ a(
26
27
  "button",
27
28
  {
28
- className: o(y(), {
29
+ className: n(N(), {
29
30
  "text-slate-700": l
30
31
  }),
31
- onClick: u,
32
+ onClick: g,
32
33
  children: [
33
- m,
34
- i.length > 0 && /* @__PURE__ */ e(c, { label: i.length.toString() }),
34
+ p,
35
+ c.length > 0 && /* @__PURE__ */ e(o, { label: c.length.toString() }),
35
36
  /* @__PURE__ */ e(
36
- B,
37
+ O,
37
38
  {
38
- className: o(C(), {
39
+ className: n(y(), {
39
40
  "rotate-180": l,
40
41
  "text-blue-600": l
41
42
  })
@@ -44,39 +45,51 @@ const V = ({
44
45
  ]
45
46
  }
46
47
  ),
47
- l && /* @__PURE__ */ t("div", { className: "absolute top-full mt-1 left-0 bg-white rounded-md shadow-md animate-in fade-in-0 z-10 border border-gray-200", children: [
48
- /* @__PURE__ */ e("div", { className: "py-4", children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: n.map((a) => {
49
- const d = !!h.find(
50
- (r) => r.id === a.id
51
- );
52
- return /* @__PURE__ */ t("div", { className: "flex gap-4 px-6", children: [
53
- /* @__PURE__ */ e(
54
- x,
55
- {
56
- defaultChecked: d,
57
- "data-label": a.id,
58
- onChange: (r) => v(a, r)
59
- },
60
- `${a.id}-${d}`
61
- ),
62
- /* @__PURE__ */ e(c, { label: a.label, variant: a.variant })
63
- ] }, a.id);
64
- }) }) }),
65
- /* @__PURE__ */ t("div", { className: "flex justify-center items-center gap-4 py-4 border-t border-gray-200", children: [
66
- /* @__PURE__ */ e(
67
- s,
48
+ l && /* @__PURE__ */ a(
49
+ "div",
50
+ {
51
+ className: n(
52
+ "absolute top-full mt-1 bg-white rounded-md shadow-md animate-in fade-in-0 z-10 border border-gray-200",
68
53
  {
69
- variant: "secondary",
70
- appearance: "compact",
71
- onClick: g,
72
- children: "Reset"
54
+ "left-0": d === "left",
55
+ "right-0": d === "right"
73
56
  }
74
57
  ),
75
- /* @__PURE__ */ e(s, { appearance: "compact", onClick: b, children: "Apply" })
76
- ] })
77
- ] })
58
+ children: [
59
+ /* @__PURE__ */ e("div", { className: "py-4", children: /* @__PURE__ */ e("div", { className: "flex flex-col gap-2", children: i.map((t) => {
60
+ const s = !!u.find(
61
+ (r) => r.id === t.id
62
+ );
63
+ return /* @__PURE__ */ a("div", { className: "flex gap-4 px-6", children: [
64
+ /* @__PURE__ */ e(
65
+ C,
66
+ {
67
+ defaultChecked: s,
68
+ "data-label": t.id,
69
+ onChange: (r) => x(t, r)
70
+ },
71
+ `${t.id}-${s}`
72
+ ),
73
+ /* @__PURE__ */ e(o, { label: t.label, variant: t.variant })
74
+ ] }, t.id);
75
+ }) }) }),
76
+ /* @__PURE__ */ a("div", { className: "flex justify-center items-center gap-4 py-4 border-t border-gray-200", children: [
77
+ /* @__PURE__ */ e(
78
+ m,
79
+ {
80
+ variant: "secondary",
81
+ appearance: "compact",
82
+ onClick: b,
83
+ children: "Reset"
84
+ }
85
+ ),
86
+ /* @__PURE__ */ e(m, { appearance: "compact", onClick: v, children: "Apply" })
87
+ ] })
88
+ ]
89
+ }
90
+ )
78
91
  ] });
79
92
  };
80
93
  export {
81
- V as BadgeMultiSelect
94
+ $ as BadgeMultiSelect
82
95
  };
@@ -1,41 +1,42 @@
1
1
  import { jsxs as r, jsx as t } from "react/jsx-runtime";
2
- import { Badge as u } from "../../../Badge/Badge.js";
3
- import { Button as n } from "../../../Button/Button.js";
2
+ import { Badge as g } from "../../../Badge/Badge.js";
3
+ import { Button as i } from "../../../Button/Button.js";
4
4
  import { DatePicker as w } from "../../../Datepicker/DatePicker.js";
5
- import { cn as l } from "../../../../utils/index.js";
5
+ import { cn as o } from "../../../../utils/index.js";
6
6
  import { filterButtonIconVariants as x, filterButtonVariants as N } from "../../Filter.variants.js";
7
7
  import { useDateFilterDropdown as b } from "./DateFilterDropdown.hook.js";
8
- import { C as g } from "../../../../chevron-down-UW8ts6wI.js";
9
- const O = ({
10
- label: i,
11
- onApply: p
8
+ import { C as y } from "../../../../chevron-down-UW8ts6wI.js";
9
+ const R = ({
10
+ label: p,
11
+ position: l = "left",
12
+ onApply: s
12
13
  }) => {
13
14
  const {
14
- id: s,
15
- appliedDay: o,
15
+ id: m,
16
+ appliedDay: n,
16
17
  isOpen: a,
17
18
  selectedDay: e,
18
- wrapperRef: m,
19
- handleApply: c,
20
- handleOpen: d,
21
- handleSelect: f,
22
- handleReset: h
23
- } = b({ onApply: p });
24
- return /* @__PURE__ */ r("div", { ref: m, className: "relative", children: [
19
+ wrapperRef: c,
20
+ handleApply: d,
21
+ handleOpen: f,
22
+ handleSelect: h,
23
+ handleReset: u
24
+ } = b({ onApply: s });
25
+ return /* @__PURE__ */ r("div", { ref: c, className: "relative", children: [
25
26
  /* @__PURE__ */ r(
26
27
  "button",
27
28
  {
28
- className: l(N(), {
29
+ className: o(N(), {
29
30
  "text-slate-700": a
30
31
  }),
31
- onClick: d,
32
+ onClick: f,
32
33
  children: [
33
- i,
34
- o && /* @__PURE__ */ t(u, { label: o }),
34
+ p,
35
+ n && /* @__PURE__ */ t(g, { label: n }),
35
36
  /* @__PURE__ */ t(
36
- g,
37
+ y,
37
38
  {
38
- className: l(x(), {
39
+ className: o(x(), {
39
40
  "rotate-180": a,
40
41
  "text-blue-600": a
41
42
  })
@@ -44,34 +45,46 @@ const O = ({
44
45
  ]
45
46
  }
46
47
  ),
47
- a && /* @__PURE__ */ r("div", { className: "absolute top-full mt-1 left-0 bg-white rounded-md shadow-md animate-in fade-in-0 z-10 border border-gray-200 flex flex-col gap-4 py-4 px-6", children: [
48
- /* @__PURE__ */ t(
49
- w,
50
- {
51
- className: "p-0",
52
- arrowClassName: "-top-1 right-0",
53
- monthsClassName: "shadow-none p-0 w-auto",
54
- defaultSelected: e,
55
- defaultMonth: e,
56
- onSelect: f
57
- },
58
- (e == null ? void 0 : e.toISOString()) ?? s
59
- ),
60
- /* @__PURE__ */ r("div", { className: "flex justify-end items-center gap-4 py-2", children: [
61
- /* @__PURE__ */ t(
62
- n,
48
+ a && /* @__PURE__ */ r(
49
+ "div",
50
+ {
51
+ className: o(
52
+ "absolute top-full mt-1 bg-white rounded-md shadow-md animate-in fade-in-0 z-10 border border-gray-200 flex flex-col gap-4 py-4 px-6",
63
53
  {
64
- variant: "secondary",
65
- appearance: "compact",
66
- onClick: h,
67
- children: "Reset"
54
+ "left-0": l === "left",
55
+ "right-0": l === "right"
68
56
  }
69
57
  ),
70
- /* @__PURE__ */ t(n, { appearance: "compact", onClick: c, children: "Apply" })
71
- ] })
72
- ] })
58
+ children: [
59
+ /* @__PURE__ */ t(
60
+ w,
61
+ {
62
+ className: "p-0",
63
+ arrowClassName: "-top-1 right-0",
64
+ monthsClassName: "shadow-none p-0 w-auto",
65
+ defaultSelected: e,
66
+ defaultMonth: e,
67
+ onSelect: h
68
+ },
69
+ (e == null ? void 0 : e.toISOString()) ?? m
70
+ ),
71
+ /* @__PURE__ */ r("div", { className: "flex justify-end items-center gap-4 py-2", children: [
72
+ /* @__PURE__ */ t(
73
+ i,
74
+ {
75
+ variant: "secondary",
76
+ appearance: "compact",
77
+ onClick: u,
78
+ children: "Reset"
79
+ }
80
+ ),
81
+ /* @__PURE__ */ t(i, { appearance: "compact", onClick: d, children: "Apply" })
82
+ ] })
83
+ ]
84
+ }
85
+ )
73
86
  ] });
74
87
  };
75
88
  export {
76
- O as DateFilterDropdown
89
+ R as DateFilterDropdown
77
90
  };
package/dist/index.d.ts CHANGED
@@ -74,6 +74,7 @@ export declare const BadgeMultiSelect: FC<BadgeMultiSelectProps>;
74
74
  declare type BadgeMultiSelectProps = {
75
75
  label: string;
76
76
  options: Option_4[];
77
+ position?: 'left' | 'right';
77
78
  onApply?: (selectedOptions: Option_4[]) => void;
78
79
  };
79
80
 
@@ -170,6 +171,7 @@ export declare const DateFilterDropdown: FC<DateFilterDropdownProps>;
170
171
 
171
172
  declare type DateFilterDropdownProps = {
172
173
  label: string;
174
+ position?: 'left' | 'right';
173
175
  onApply?: (date?: Date) => void;
174
176
  };
175
177
 
package/dist/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@konstructio/ui",
3
3
  "description": "A set of reusable and customizable React components built for konstruct.io",
4
4
  "private": false,
5
- "version": "0.1.0-alpha.7",
5
+ "version": "0.1.0-alpha.8",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@konstructio/ui",
3
3
  "description": "A set of reusable and customizable React components built for konstruct.io",
4
4
  "private": false,
5
- "version": "0.1.0-alpha.8",
5
+ "version": "0.1.0-alpha.9",
6
6
  "type": "module",
7
7
  "license": "MIT",
8
8
  "main": "dist/index.js",