@polastack/design-system 0.1.34 → 0.1.35
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.
- package/dist/index.js +59 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2869,14 +2869,14 @@ DataTableColumnHeader.displayName = "DataTableColumnHeader";
|
|
|
2869
2869
|
// src/components/filter-bar/filter-bar.tsx
|
|
2870
2870
|
import * as React34 from "react";
|
|
2871
2871
|
import { cva as cva15 } from "class-variance-authority";
|
|
2872
|
-
import { X as X2 } from "lucide-react";
|
|
2872
|
+
import { X as X2, ListFilter } from "lucide-react";
|
|
2873
2873
|
import { jsx as jsx35, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
2874
2874
|
var FilterBar = React34.forwardRef(({ className, ...props }, ref) => /* @__PURE__ */ jsx35(
|
|
2875
2875
|
"div",
|
|
2876
2876
|
{
|
|
2877
2877
|
ref,
|
|
2878
2878
|
className: cn(
|
|
2879
|
-
"flex flex-wrap items-center gap-2 rounded-lg border border-[var(--color-
|
|
2879
|
+
"flex flex-wrap items-center gap-2 rounded-lg border border-[var(--color-on-surface)] bg-[var(--color-surface-sunken)] p-3",
|
|
2880
2880
|
className
|
|
2881
2881
|
),
|
|
2882
2882
|
role: "toolbar",
|
|
@@ -2965,6 +2965,63 @@ var FilterBarActions = React34.forwardRef(({ className, ...props }, ref) => /* @
|
|
|
2965
2965
|
}
|
|
2966
2966
|
));
|
|
2967
2967
|
FilterBarActions.displayName = "FilterBarActions";
|
|
2968
|
+
function FilterSelector({
|
|
2969
|
+
options,
|
|
2970
|
+
selected,
|
|
2971
|
+
onToggle,
|
|
2972
|
+
label = "Filters",
|
|
2973
|
+
className
|
|
2974
|
+
}) {
|
|
2975
|
+
const [open, setOpen] = React34.useState(false);
|
|
2976
|
+
const menuRef = React34.useRef(null);
|
|
2977
|
+
React34.useEffect(() => {
|
|
2978
|
+
function handleClickOutside(event) {
|
|
2979
|
+
if (menuRef.current && !menuRef.current.contains(event.target)) {
|
|
2980
|
+
setOpen(false);
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2983
|
+
if (open) {
|
|
2984
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
2985
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
2986
|
+
}
|
|
2987
|
+
}, [open]);
|
|
2988
|
+
return /* @__PURE__ */ jsxs16("div", { className: cn("relative", className), ref: menuRef, children: [
|
|
2989
|
+
/* @__PURE__ */ jsxs16(
|
|
2990
|
+
"button",
|
|
2991
|
+
{
|
|
2992
|
+
type: "button",
|
|
2993
|
+
className: "inline-flex items-center gap-1 rounded-md border border-[var(--color-border-input)] bg-[var(--color-surface-raised)] px-3 py-1.5 text-sm transition-colors hover:bg-[var(--color-surface-muted)]",
|
|
2994
|
+
onClick: () => setOpen(!open),
|
|
2995
|
+
"aria-label": label,
|
|
2996
|
+
"aria-expanded": open,
|
|
2997
|
+
children: [
|
|
2998
|
+
/* @__PURE__ */ jsx35(ListFilter, { className: "h-3.5 w-3.5" }),
|
|
2999
|
+
label
|
|
3000
|
+
]
|
|
3001
|
+
}
|
|
3002
|
+
),
|
|
3003
|
+
open && /* @__PURE__ */ jsx35("div", { className: "absolute left-0 top-full z-popover mt-1 min-w-[10rem] rounded-md border border-[var(--color-border)] bg-[var(--color-surface-raised)] p-2 shadow-md", children: options.map((opt) => /* @__PURE__ */ jsxs16(
|
|
3004
|
+
"label",
|
|
3005
|
+
{
|
|
3006
|
+
className: "flex items-center gap-2 rounded px-2 py-1 text-sm hover:bg-[var(--color-surface-sunken)] cursor-pointer",
|
|
3007
|
+
children: [
|
|
3008
|
+
/* @__PURE__ */ jsx35(
|
|
3009
|
+
"input",
|
|
3010
|
+
{
|
|
3011
|
+
type: "checkbox",
|
|
3012
|
+
checked: selected.includes(opt.id),
|
|
3013
|
+
onChange: (e) => onToggle(opt.id, e.target.checked),
|
|
3014
|
+
className: "h-4 w-4"
|
|
3015
|
+
}
|
|
3016
|
+
),
|
|
3017
|
+
opt.label
|
|
3018
|
+
]
|
|
3019
|
+
},
|
|
3020
|
+
opt.id
|
|
3021
|
+
)) })
|
|
3022
|
+
] });
|
|
3023
|
+
}
|
|
3024
|
+
FilterSelector.displayName = "FilterSelector";
|
|
2968
3025
|
|
|
2969
3026
|
// src/components/popover/popover.tsx
|
|
2970
3027
|
import * as React35 from "react";
|