@lateralus-ai/shipping-ui 2.0.0-dev.22 → 2.0.0-dev.24
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/domain/Filters/FilterDropdown.d.ts +33 -7
- package/dist/domain/Filters/FilterPill.d.ts +13 -3
- package/dist/domain/Filters/index.d.ts +2 -2
- package/dist/index.cjs +23 -23
- package/dist/index.esm.js +3302 -3270
- package/dist/primitives/Switch.d.ts +4 -0
- package/package.json +1 -1
- package/src/domain/Filters/FilterDropdown.tsx +540 -438
- package/src/domain/Filters/FilterPill.tsx +74 -61
- package/src/domain/Filters/FilterPills.tsx +34 -34
- package/src/domain/Filters/FilteredPill.tsx +59 -59
- package/src/domain/Filters/FiltersBar.tsx +72 -72
- package/src/domain/Filters/formatActiveFilterChipLabel.ts +23 -23
- package/src/domain/Filters/index.ts +37 -35
- package/src/primitives/Switch.tsx +16 -6
- package/src/stories/canvases/FiltersCanvas.tsx +171 -167
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ComponentType, CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import { FilterPillAppearance } from './FilterPill';
|
|
2
3
|
/** One selectable row at a leaf list. */
|
|
3
4
|
export type FilterOption = {
|
|
4
5
|
value: string;
|
|
@@ -30,14 +31,27 @@ export type FilterNestedItem = {
|
|
|
30
31
|
label: string;
|
|
31
32
|
content: FilterSubmenuContent;
|
|
32
33
|
};
|
|
33
|
-
/** Left
|
|
34
|
+
/** Left-column row that opens a (possibly nested) submenu panel. */
|
|
34
35
|
export type FilterCategorySubmenuRow = {
|
|
35
36
|
kind?: "submenu";
|
|
36
37
|
id: string;
|
|
37
38
|
label: string;
|
|
38
39
|
content: FilterSubmenuContent;
|
|
39
40
|
};
|
|
40
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Options rendered inline in the first panel (no chevron / second column).
|
|
43
|
+
* Mix with submenu rows for hybrid menus (e.g. Status submenu + Sort by flat).
|
|
44
|
+
*/
|
|
45
|
+
export type FilterCategoryInlineOptionsRow = {
|
|
46
|
+
kind: "inline-options";
|
|
47
|
+
id: string;
|
|
48
|
+
/** Small section header above the options (e.g. "Sort by"). */
|
|
49
|
+
title?: string;
|
|
50
|
+
selectionKey: string;
|
|
51
|
+
selectionMode?: FilterSelectionMode;
|
|
52
|
+
options: FilterOption[];
|
|
53
|
+
};
|
|
54
|
+
/** First-panel row: label + Switch (no right panel). */
|
|
41
55
|
export type FilterCategoryToggleRow = {
|
|
42
56
|
kind: "toggle";
|
|
43
57
|
id: string;
|
|
@@ -45,7 +59,7 @@ export type FilterCategoryToggleRow = {
|
|
|
45
59
|
checked: boolean;
|
|
46
60
|
onCheckedChange: (checked: boolean) => void;
|
|
47
61
|
};
|
|
48
|
-
export type FilterCategoryRow = FilterCategorySubmenuRow | FilterCategoryToggleRow;
|
|
62
|
+
export type FilterCategoryRow = FilterCategorySubmenuRow | FilterCategoryInlineOptionsRow | FilterCategoryToggleRow;
|
|
49
63
|
type ResolvedSubmenuView = {
|
|
50
64
|
kind: "folders";
|
|
51
65
|
items: FilterNestedItem[];
|
|
@@ -66,7 +80,10 @@ export declare function resolveSubmenuView(content: FilterSubmenuContent, path:
|
|
|
66
80
|
export type FilterDropdownProps = {
|
|
67
81
|
align?: "start" | "center" | "end";
|
|
68
82
|
sideOffset?: number;
|
|
69
|
-
/**
|
|
83
|
+
/**
|
|
84
|
+
* First panel rows — mix freely:
|
|
85
|
+
* submenu (chevron + second panel), inline-options (flat list), toggle (Switch).
|
|
86
|
+
*/
|
|
70
87
|
categoryRows: FilterCategoryRow[];
|
|
71
88
|
selectedValuesBySelectionKey: Record<string, string[] | undefined>;
|
|
72
89
|
/**
|
|
@@ -76,18 +93,27 @@ export type FilterDropdownProps = {
|
|
|
76
93
|
onSelectOption: (selectionKey: string, optionValue: string) => void;
|
|
77
94
|
onResetAll: () => void;
|
|
78
95
|
resetAllLabel?: string;
|
|
96
|
+
/** When false, hides the Reset all footer. Default true. */
|
|
97
|
+
showResetAll?: boolean;
|
|
79
98
|
activeFilterCount: number;
|
|
80
99
|
getOptionLabelStyle?: (selectionKey: string, optionValue: string) => CSSProperties | undefined;
|
|
81
100
|
zIndexClass?: string;
|
|
82
101
|
/** Replace the default FilterPill trigger. */
|
|
83
102
|
trigger?: ReactNode;
|
|
103
|
+
/** Passed to the default FilterPill when `trigger` is omitted. */
|
|
104
|
+
triggerAppearance?: FilterPillAppearance;
|
|
105
|
+
/**
|
|
106
|
+
* Which side the options panel attaches to the category column.
|
|
107
|
+
* Carets stay on the right of category rows either way.
|
|
108
|
+
*/
|
|
109
|
+
submenuSide?: "left" | "right";
|
|
84
110
|
open?: boolean;
|
|
85
111
|
onOpenChange?: (open: boolean) => void;
|
|
86
112
|
className?: string;
|
|
87
113
|
};
|
|
88
114
|
/**
|
|
89
|
-
* Filters trigger +
|
|
90
|
-
*
|
|
115
|
+
* Filters trigger + popover. First panel supports hybrid rows: submenus,
|
|
116
|
+
* inline option lists, and Switch toggles. Submenus open a second column.
|
|
91
117
|
*/
|
|
92
|
-
export declare function FilterDropdown({ align, sideOffset, categoryRows, selectedValuesBySelectionKey, onSelectOption, onResetAll, resetAllLabel, activeFilterCount, getOptionLabelStyle, zIndexClass, trigger, open: openControlled, onOpenChange, className, }: FilterDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
118
|
+
export declare function FilterDropdown({ align, sideOffset, categoryRows, selectedValuesBySelectionKey, onSelectOption, onResetAll, resetAllLabel, showResetAll, activeFilterCount, getOptionLabelStyle, zIndexClass, trigger, triggerAppearance, submenuSide, open: openControlled, onOpenChange, className, }: FilterDropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
93
119
|
export {};
|
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
export type FilterPillAppearance = "filled" | "ghost";
|
|
2
3
|
export type FilterPillProps = Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> & {
|
|
3
|
-
/** When > 0,
|
|
4
|
+
/** When > 0, shows the orange count badge. */
|
|
4
5
|
activeFilterCount?: number;
|
|
6
|
+
/**
|
|
7
|
+
* `filled` — grey idle / blue when active (Figma default).
|
|
8
|
+
* `ghost` — white idle and active; only hover changes surface color.
|
|
9
|
+
*/
|
|
10
|
+
appearance?: FilterPillAppearance;
|
|
5
11
|
};
|
|
6
12
|
/**
|
|
7
13
|
* Filter trigger — Figma Filter Pill (6154:149608 / 6154:149599).
|
|
8
|
-
* Idle: grey-100. Active: accent blue-100 + orange count badge.
|
|
9
14
|
*/
|
|
10
15
|
export declare const FilterPill: import('react').ForwardRefExoticComponent<Omit<ButtonHTMLAttributes<HTMLButtonElement>, "children"> & {
|
|
11
|
-
/** When > 0,
|
|
16
|
+
/** When > 0, shows the orange count badge. */
|
|
12
17
|
activeFilterCount?: number;
|
|
18
|
+
/**
|
|
19
|
+
* `filled` — grey idle / blue when active (Figma default).
|
|
20
|
+
* `ghost` — white idle and active; only hover changes surface color.
|
|
21
|
+
*/
|
|
22
|
+
appearance?: FilterPillAppearance;
|
|
13
23
|
} & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { FiltersBar, type FiltersBarFilters, type FiltersBarProps, type FiltersBarTabs, } from './FiltersBar';
|
|
2
2
|
export { FilteredPill, type FilteredPillProps, } from './FilteredPill';
|
|
3
|
-
export { FilterPill, type FilterPillProps, } from './FilterPill';
|
|
3
|
+
export { FilterPill, type FilterPillAppearance, type FilterPillProps, } from './FilterPill';
|
|
4
4
|
export { FilterPills, type FilterPillsItem, type FilterPillsProps, } from './FilterPills';
|
|
5
|
-
export { FilterDropdown, resolveSubmenuView, type FilterCategoryRow, type FilterCategorySubmenuRow, type FilterCategoryToggleRow, type FilterDropdownProps, type FilterNestedItem, type FilterOption, type FilterSelectionMode, type FilterSubmenuContent, } from './FilterDropdown';
|
|
5
|
+
export { FilterDropdown, resolveSubmenuView, type FilterCategoryInlineOptionsRow, type FilterCategoryRow, type FilterCategorySubmenuRow, type FilterCategoryToggleRow, type FilterDropdownProps, type FilterNestedItem, type FilterOption, type FilterSelectionMode, type FilterSubmenuContent, } from './FilterDropdown';
|
|
6
6
|
export { formatActiveFilterChipLabel } from './formatActiveFilterChipLabel';
|
|
7
7
|
/** @deprecated Use `activeFilterCount` on FilterPill instead. */
|
|
8
8
|
export type FilterPillIndicator = "on" | "off";
|