@brightlocal/ui-components 3.0.0 → 3.2.0
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/README.md +7 -1
- package/component-meta.json +749 -53
- package/deprecations.json +114 -4
- package/dist/accordion.cjs +1 -1
- package/dist/accordion.d.ts +36 -0
- package/dist/accordion.d.ts.map +1 -1
- package/dist/accordion.js +74 -61
- package/dist/alert-dialog.cjs +1 -1
- package/dist/alert-dialog.d.ts +32 -3
- package/dist/alert-dialog.d.ts.map +1 -1
- package/dist/alert-dialog.js +61 -58
- package/dist/alert.cjs +1 -1
- package/dist/alert.d.ts.map +1 -1
- package/dist/alert.js +58 -57
- package/dist/badge.cjs +1 -1
- package/dist/badge.d.ts +9 -0
- package/dist/badge.d.ts.map +1 -1
- package/dist/badge.js +50 -30
- package/dist/banner.cjs +1 -0
- package/dist/banner.d.ts +81 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +176 -0
- package/dist/blocks/empty-state.cjs +1 -1
- package/dist/blocks/empty-state.d.ts +4 -3
- package/dist/blocks/empty-state.d.ts.map +1 -1
- package/dist/blocks/empty-state.js +50 -57
- package/dist/blocks/progress-state.d.ts +2 -2
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +17 -0
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +8 -2
- package/dist/brand-illustration-motif.d.ts +1 -1
- package/dist/button-group.cjs +1 -0
- package/dist/button-group.d.ts +36 -0
- package/dist/button-group.d.ts.map +1 -0
- package/dist/button-group.js +47 -0
- package/dist/button.cjs +1 -1
- package/dist/button.js +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.d.ts +105 -7
- package/dist/card.d.ts.map +1 -1
- package/dist/card.js +198 -101
- package/dist/chart.cjs +3 -3
- package/dist/chart.d.ts +270 -24
- package/dist/chart.d.ts.map +1 -1
- package/dist/chart.js +497 -322
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.d.ts +1 -1
- package/dist/checkbox.d.ts.map +1 -1
- package/dist/checkbox.js +2 -1
- package/dist/chip.cjs +1 -1
- package/dist/chip.d.ts +38 -4
- package/dist/chip.d.ts.map +1 -1
- package/dist/chip.js +95 -81
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.js +2 -2
- package/dist/command.cjs +1 -1
- package/dist/command.d.ts +23 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +251 -225
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.d.ts +201 -23
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +712 -568
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.d.ts +13 -5
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +54 -53
- package/dist/field.cjs +1 -1
- package/dist/field.d.ts +8 -1
- package/dist/field.d.ts.map +1 -1
- package/dist/field.js +79 -52
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +105 -13
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +146 -129
- package/dist/grid.d.ts +26 -3
- package/dist/grid.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.cjs +1 -1
- package/dist/hooks/use-breakpoint.d.ts +1 -1
- package/dist/hooks/use-breakpoint.d.ts.map +1 -1
- package/dist/hooks/use-breakpoint.js +1 -0
- package/dist/hooks/use-mobile.cjs +1 -0
- package/dist/hooks/use-mobile.js +8 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +594 -553
- package/dist/info-tooltip.cjs +1 -0
- package/dist/info-tooltip.d.ts +39 -0
- package/dist/info-tooltip.d.ts.map +1 -0
- package/dist/info-tooltip.js +41 -0
- package/dist/input-chip.cjs +1 -1
- package/dist/input-chip.js +1 -1
- package/dist/input-group.cjs +1 -1
- package/dist/input-group.d.ts +33 -2
- package/dist/input-group.d.ts.map +1 -1
- package/dist/input-group.js +167 -54
- package/dist/input-otp.cjs +1 -1
- package/dist/input-otp.js +9 -9
- package/dist/input-password.cjs +1 -1
- package/dist/input-password.d.ts +45 -15
- package/dist/input-password.d.ts.map +1 -1
- package/dist/input-password.js +31 -30
- package/dist/input.cjs +1 -1
- package/dist/input.js +10 -10
- package/dist/lib/block-illustration.cjs +1 -1
- package/dist/lib/block-illustration.d.ts +4 -1
- package/dist/lib/block-illustration.d.ts.map +1 -1
- package/dist/lib/block-illustration.js +12 -11
- package/dist/lib/empty-chip.cjs +1 -0
- package/dist/lib/empty-chip.d.ts +4 -0
- package/dist/lib/empty-chip.d.ts.map +1 -0
- package/dist/lib/empty-chip.js +13 -0
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +4 -3
- package/dist/list.cjs +1 -1
- package/dist/list.js +1 -1
- package/dist/multi-select-filter.cjs +1 -0
- package/dist/multi-select-filter.d.ts +178 -0
- package/dist/multi-select-filter.d.ts.map +1 -0
- package/dist/multi-select-filter.js +463 -0
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +3 -0
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +57 -57
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +123 -16
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +89 -75
- package/dist/rating.cjs +1 -1
- package/dist/rating.js +18 -18
- package/dist/relative-date.cjs +1 -0
- package/dist/relative-date.d.ts +65 -0
- package/dist/relative-date.d.ts.map +1 -0
- package/dist/relative-date.js +128 -0
- package/dist/scroll-area.cjs +1 -1
- package/dist/scroll-area.d.ts +15 -6
- package/dist/scroll-area.d.ts.map +1 -1
- package/dist/scroll-area.js +38 -36
- package/dist/select.cjs +2 -2
- package/dist/select.d.ts +24 -3
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +130 -110
- package/dist/sheet.cjs +1 -1
- package/dist/sheet.d.ts +78 -2
- package/dist/sheet.d.ts.map +1 -1
- package/dist/sheet.js +192 -85
- package/dist/single-select-filter.cjs +1 -0
- package/dist/single-select-filter.d.ts +81 -0
- package/dist/single-select-filter.d.ts.map +1 -0
- package/dist/single-select-filter.js +226 -0
- package/dist/sonner.cjs +1 -1
- package/dist/sonner.d.ts.map +1 -1
- package/dist/sonner.js +22 -22
- package/dist/split-layout.cjs +1 -1
- package/dist/split-layout.d.ts +1 -1
- package/dist/split-layout.js +13 -13
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +45 -4
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +90 -73
- package/dist/tabs.cjs +1 -1
- package/dist/tabs.d.ts +12 -1
- package/dist/tabs.d.ts.map +1 -1
- package/dist/tabs.js +148 -126
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.js +1 -1
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts +38 -36
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +262 -73
- package/dist/typography-heading.cjs +1 -1
- package/dist/typography-heading.d.ts +13 -0
- package/dist/typography-heading.d.ts.map +1 -1
- package/dist/typography-heading.js +32 -21
- package/dist/typography-text.cjs +1 -1
- package/dist/typography-text.d.ts +15 -2
- package/dist/typography-text.d.ts.map +1 -1
- package/dist/typography-text.js +35 -24
- package/dist/typography.d.ts +1 -1
- package/package.json +5 -6
- package/src/blocks/empty-state.tsx +17 -24
- package/src/blocks/progress-state.tsx +2 -2
- package/src/blocks/sidebar.tsx +26 -2
- package/src/components/accordion.tsx +82 -27
- package/src/components/alert-dialog.tsx +50 -5
- package/src/components/alert.tsx +16 -8
- package/src/components/badge.tsx +40 -3
- package/src/components/banner.tsx +288 -0
- package/src/components/brand-illustration-motif.tsx +1 -1
- package/src/components/button-group.tsx +112 -0
- package/src/components/button.tsx +1 -1
- package/src/components/card.tsx +249 -27
- package/src/components/chart.tsx +586 -53
- package/src/components/checkbox.tsx +1 -1
- package/src/components/chip.tsx +83 -10
- package/src/components/combobox.tsx +2 -2
- package/src/components/command.tsx +56 -4
- package/src/components/data-table.tsx +842 -199
- package/src/components/date-picker.tsx +18 -7
- package/src/components/field.tsx +81 -12
- package/src/components/global-layout.tsx +176 -38
- package/src/components/grid.tsx +34 -3
- package/src/components/info-tooltip.tsx +94 -0
- package/src/components/input-chip.tsx +1 -1
- package/src/components/input-group.tsx +246 -11
- package/src/components/input-otp.tsx +1 -1
- package/src/components/input-password.tsx +56 -22
- package/src/components/input.tsx +1 -1
- package/src/components/list.tsx +1 -1
- package/src/components/multi-select-filter.tsx +912 -0
- package/src/components/pagination.tsx +10 -3
- package/src/components/progress.tsx +190 -31
- package/src/components/rating.tsx +1 -1
- package/src/components/relative-date.tsx +230 -0
- package/src/components/scroll-area.tsx +23 -10
- package/src/components/select.tsx +65 -11
- package/src/components/sheet.tsx +240 -4
- package/src/components/single-select-filter.tsx +443 -0
- package/src/components/sonner.tsx +16 -5
- package/src/components/split-layout.tsx +2 -2
- package/src/components/table.tsx +71 -11
- package/src/components/tabs.tsx +93 -46
- package/src/components/textarea.tsx +1 -1
- package/src/components/tooltip.tsx +440 -68
- package/src/components/typography-heading.tsx +24 -0
- package/src/components/typography-text.tsx +27 -3
- package/src/components/typography.tsx +1 -1
- package/src/hooks/use-breakpoint.ts +2 -1
- package/src/index.ts +6 -0
- package/src/lib/block-illustration.tsx +5 -1
- package/src/lib/empty-chip.ts +24 -0
- package/src/lib/utils.ts +1 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { VariantProps } from 'class-variance-authority';
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
declare const multiSelectFilterTriggerVariants: (props?: ({
|
|
4
|
+
size?: "default" | "sm" | null | undefined;
|
|
5
|
+
} & import('class-variance-authority/types').ClassProp) | undefined) => string;
|
|
6
|
+
/** One selectable option of a multi-select filter. */
|
|
7
|
+
interface MultiSelectFilterOption {
|
|
8
|
+
/** Unique value of the option. */
|
|
9
|
+
value: string;
|
|
10
|
+
/** Visible label of the option. */
|
|
11
|
+
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* Result count for this option, shown beside the label in the menu (the
|
|
14
|
+
* drawer's two-column rows carry only the All total). A count of 0
|
|
15
|
+
* disables the option in both — disabled, never hidden, so the dimension
|
|
16
|
+
* keeps its full shape.
|
|
17
|
+
*/
|
|
18
|
+
count?: number;
|
|
19
|
+
/** Disables the option explicitly. */
|
|
20
|
+
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* The option's own glyph (a search-engine logo, a rating star), 16px.
|
|
23
|
+
* Shown before the label in the menu and the drawer; the trigger shows the
|
|
24
|
+
* first pick's glyph when no `icon` is set.
|
|
25
|
+
*/
|
|
26
|
+
icon?: React.ReactNode;
|
|
27
|
+
}
|
|
28
|
+
interface MultiSelectFilterProps extends Omit<React.ComponentPropsWithoutRef<"button">, "value" | "defaultValue" | "onChange" | "children">, VariantProps<typeof multiSelectFilterTriggerVariants> {
|
|
29
|
+
/**
|
|
30
|
+
* Data hook for automated testing (REQUIRED). Every part of the menu
|
|
31
|
+
* derives its own hook from it (`-popover`, `-search`, `-option-all`,
|
|
32
|
+
* `-option-<value>`, `-clear`, `-summary`, `-icon`).
|
|
33
|
+
* @example "locations-status-filter"
|
|
34
|
+
*/
|
|
35
|
+
dataHook: string;
|
|
36
|
+
/**
|
|
37
|
+
* The dimension's name — use the product's words ("Status", "Source"),
|
|
38
|
+
* never an internal field name. Always the start of the accessible name;
|
|
39
|
+
* also the trigger's muted placeholder at zero when there is no `allLabel`.
|
|
40
|
+
*/
|
|
41
|
+
label: string;
|
|
42
|
+
/** The selectable options, in the dimension's own order. */
|
|
43
|
+
options: readonly MultiSelectFilterOption[];
|
|
44
|
+
/** Controlled selected values. Values combine as OR. */
|
|
45
|
+
value?: readonly string[];
|
|
46
|
+
/**
|
|
47
|
+
* Initial selection for uncontrolled mode.
|
|
48
|
+
* @default []
|
|
49
|
+
*/
|
|
50
|
+
defaultValue?: readonly string[];
|
|
51
|
+
/**
|
|
52
|
+
* Callback on every pick (the per-filter commit model: reflect
|
|
53
|
+
* immediately on client data; defer expensive refetches to
|
|
54
|
+
* `onOpenChange(false)`).
|
|
55
|
+
* @param value - The full selection after the pick
|
|
56
|
+
*/
|
|
57
|
+
onValueChange?: (value: string[]) => void;
|
|
58
|
+
/** Controlled open state of the menu. */
|
|
59
|
+
open?: boolean;
|
|
60
|
+
/**
|
|
61
|
+
* Callback when the menu opens or closes — `false` is the moment to run
|
|
62
|
+
* an expensive refetch for everything picked while it was open.
|
|
63
|
+
*/
|
|
64
|
+
onOpenChange?: (open: boolean) => void;
|
|
65
|
+
/**
|
|
66
|
+
* Fixed glyph leading the trigger — the dimension's own icon (a funnel, a
|
|
67
|
+
* calendar), 16px. Without it the trigger follows the selection: `allIcon`
|
|
68
|
+
* at zero, then the first pick's `option.icon`. Hidden from assistive
|
|
69
|
+
* tech; the accessible name comes from `label` and the picks.
|
|
70
|
+
*/
|
|
71
|
+
icon?: React.ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* How many picked labels to spell out before collapsing into
|
|
74
|
+
* `summaryLabel` ("Google +2" at 1, "London, Brighton +1" at 2). Values
|
|
75
|
+
* below 1 are treated as 1.
|
|
76
|
+
* @default 1
|
|
77
|
+
*/
|
|
78
|
+
maxVisibleLabels?: number;
|
|
79
|
+
/**
|
|
80
|
+
* Label of the leading reset row, e.g. "All sources". Omit to hide the
|
|
81
|
+
* row. Checked when nothing is picked; picking it clears the selection.
|
|
82
|
+
* Also the trigger's text at zero.
|
|
83
|
+
*/
|
|
84
|
+
allLabel?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Glyph of the All row, and of the trigger while nothing is picked (when
|
|
87
|
+
* no `icon` is set) — the dimension's "everything" mark, e.g. a globe.
|
|
88
|
+
*/
|
|
89
|
+
allIcon?: React.ReactNode;
|
|
90
|
+
/**
|
|
91
|
+
* Total beside the All row. Defaults to the sum of the options' counts
|
|
92
|
+
* when every option has one — per-option counts leave out their own
|
|
93
|
+
* filter, so together they are the unfiltered total.
|
|
94
|
+
*/
|
|
95
|
+
allCount?: number;
|
|
96
|
+
/**
|
|
97
|
+
* Show a search input inside the menu once the option list grows past
|
|
98
|
+
* this many options. Scanning stops working past ~10–15.
|
|
99
|
+
* @default 10
|
|
100
|
+
*/
|
|
101
|
+
searchThreshold?: number;
|
|
102
|
+
/** Force the search input on or off, overriding `searchThreshold`. */
|
|
103
|
+
searchable?: boolean;
|
|
104
|
+
/**
|
|
105
|
+
* When a pick completes the set — every option that can be picked (not
|
|
106
|
+
* disabled, count not 0) is ticked — the selection collapses to `[]`,
|
|
107
|
+
* i.e. "All": the same records, read as no filter instead of "Google +3".
|
|
108
|
+
* @default true
|
|
109
|
+
*/
|
|
110
|
+
collapseFullSelection?: boolean;
|
|
111
|
+
/** Disables the trigger. */
|
|
112
|
+
disabled?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Label of the clear action inside the menu.
|
|
115
|
+
* @default "Clear filters"
|
|
116
|
+
*/
|
|
117
|
+
clearLabel?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Trigger summary once more values are picked than `maxVisibleLabels`.
|
|
120
|
+
* Placeholders: `{labels}` — the first `maxVisibleLabels` labels,
|
|
121
|
+
* `{rest}` — the picks beyond them, `{count}` — every pick.
|
|
122
|
+
* `"{count} selected"` reads "3 selected" instead.
|
|
123
|
+
* @default "{labels} +{rest}"
|
|
124
|
+
*/
|
|
125
|
+
summaryLabel?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Placeholder of the search input inside the menu.
|
|
128
|
+
* @default "Search options..."
|
|
129
|
+
*/
|
|
130
|
+
searchPlaceholder?: string;
|
|
131
|
+
/**
|
|
132
|
+
* Message when the search matches no options.
|
|
133
|
+
* @default "No options found."
|
|
134
|
+
*/
|
|
135
|
+
emptyLabel?: string;
|
|
136
|
+
/**
|
|
137
|
+
* The quiet hint under the no-match message.
|
|
138
|
+
* @default "Try another search."
|
|
139
|
+
*/
|
|
140
|
+
emptyDescription?: string;
|
|
141
|
+
/**
|
|
142
|
+
* Accessible label of the menu search input's clear button (the drawer's
|
|
143
|
+
* search field is a plain Input without one).
|
|
144
|
+
* @default "Clear search"
|
|
145
|
+
*/
|
|
146
|
+
clearSearchAriaLabel?: string;
|
|
147
|
+
/**
|
|
148
|
+
* How the options open: the Popover + Command `menu`, a bottom `drawer`
|
|
149
|
+
* (the phone form: Checkbox rows in two columns, Clear, Done), or `auto`
|
|
150
|
+
* — the menu from the `md` breakpoint up and the drawer below it.
|
|
151
|
+
* @default "menu"
|
|
152
|
+
*/
|
|
153
|
+
presentation?: "menu" | "drawer" | "auto";
|
|
154
|
+
/**
|
|
155
|
+
* Label of the drawer's Done button — it only closes; picks apply at once.
|
|
156
|
+
* @default "Done"
|
|
157
|
+
*/
|
|
158
|
+
doneLabel?: string;
|
|
159
|
+
/**
|
|
160
|
+
* Screen-reader description of the drawer (the Drawer contract needs a
|
|
161
|
+
* title and a description; the title is `label`).
|
|
162
|
+
* @default "Picks apply as you make them."
|
|
163
|
+
*/
|
|
164
|
+
drawerDescription?: string;
|
|
165
|
+
/** Analytics element identifier. @default "multi-select-filter" */
|
|
166
|
+
trackingEl?: string;
|
|
167
|
+
/** Analytics label */
|
|
168
|
+
trackingLabel?: string;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Multi-select filter for one dimension: a field-look trigger that reads its
|
|
172
|
+
* picks, over a Popover + Command menu that stays open across picks. Values
|
|
173
|
+
* combine as OR.
|
|
174
|
+
*/
|
|
175
|
+
declare const MultiSelectFilter: React.ForwardRefExoticComponent<MultiSelectFilterProps & React.RefAttributes<HTMLButtonElement>>;
|
|
176
|
+
export { MultiSelectFilter, multiSelectFilterTriggerVariants };
|
|
177
|
+
export type { MultiSelectFilterOption, MultiSelectFilterProps };
|
|
178
|
+
//# sourceMappingURL=multi-select-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"multi-select-filter.d.ts","sourceRoot":"","sources":["../../src/components/multi-select-filter.tsx"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
import { jsxs as l, jsx as t, Fragment as we } from "react/jsx-runtime";
|
|
2
|
+
import * as i from "react";
|
|
3
|
+
import { cva as Se } from "class-variance-authority";
|
|
4
|
+
import { ChevronDown as Ne, SearchX as ae, Check as $e } from "@brightlocal/icons";
|
|
5
|
+
import { Button as le } from "@brightlocal/ui-components/button";
|
|
6
|
+
import { Checkbox as se, checkboxVariants as ye } from "@brightlocal/ui-components/checkbox";
|
|
7
|
+
import { Command as Oe, CommandInput as _e, CommandList as De, CommandEmpty as Fe, CommandGroup as ie, CommandItem as G } from "@brightlocal/ui-components/command";
|
|
8
|
+
import { Drawer as ze, DrawerTrigger as Me, DrawerContent as je, DrawerHeader as Ae, DrawerTitle as Re, DrawerDescription as Te, DrawerBody as ce, DrawerFooter as Ve, DrawerClose as Le } from "@brightlocal/ui-components/drawer";
|
|
9
|
+
import { useIsBelowBreakpoint as Be } from "@brightlocal/ui-components/hooks/use-breakpoint";
|
|
10
|
+
import { Input as Ee } from "@brightlocal/ui-components/input";
|
|
11
|
+
import { Label as oe } from "@brightlocal/ui-components/label";
|
|
12
|
+
import { cn as M } from "@brightlocal/ui-components/lib/utils";
|
|
13
|
+
import { Popover as Pe, PopoverTrigger as Ie, PopoverContent as Ue } from "@brightlocal/ui-components/popover";
|
|
14
|
+
import { emptyChipStyles as Qe } from "./lib/empty-chip.js";
|
|
15
|
+
const We = Se(
|
|
16
|
+
[
|
|
17
|
+
// Base layout
|
|
18
|
+
"relative inline-flex items-center justify-between gap-2 py-2",
|
|
19
|
+
// Base appearance — the Figma Select's surface: background (input/30 in
|
|
20
|
+
// dark) fill and the input border
|
|
21
|
+
"border border-input rounded-sm outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out",
|
|
22
|
+
"bg-background dark:bg-input/30",
|
|
23
|
+
"text-foreground",
|
|
24
|
+
// Focus state (keyboard navigation only — not on click)
|
|
25
|
+
"focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background",
|
|
26
|
+
"focus-visible:shadow-default",
|
|
27
|
+
// Open state — the surface this trigger owns is showing
|
|
28
|
+
"data-[state=open]:border-ring",
|
|
29
|
+
// Disabled state
|
|
30
|
+
"disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50",
|
|
31
|
+
// Icon styles (chevron and leading icons)
|
|
32
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
33
|
+
],
|
|
34
|
+
{
|
|
35
|
+
variants: {
|
|
36
|
+
size: {
|
|
37
|
+
/* A filter trigger is a field-like control holding a value, so it
|
|
38
|
+
wears the field's type role, exactly like SelectTrigger (DS-992):
|
|
39
|
+
14px/20 on desktop, 16px/24 on touch devices so it never differs
|
|
40
|
+
from the Select beside it in a toolbar. */
|
|
41
|
+
default: "h-9 px-3 text-field",
|
|
42
|
+
/* The DS Button's `sm` height (h-8) with text-label (14px everywhere),
|
|
43
|
+
so the same trigger sits in a phone card header without the desktop
|
|
44
|
+
height or the touch bump crowding the row. Icons stay 16px unless
|
|
45
|
+
the consumer's glyph sizes itself. */
|
|
46
|
+
sm: "h-8 px-2.5 text-label [&_svg:not([class*='size-'])]:size-4"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
defaultVariants: {
|
|
50
|
+
size: "default"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
function qe({
|
|
55
|
+
value: d,
|
|
56
|
+
defaultValue: r,
|
|
57
|
+
onValueChange: h,
|
|
58
|
+
open: c,
|
|
59
|
+
onOpenChange: j,
|
|
60
|
+
options: g,
|
|
61
|
+
collapseFullSelection: A
|
|
62
|
+
}) {
|
|
63
|
+
const [R, T] = i.useState(r), S = d !== void 0, u = S ? d : R, N = i.useMemo(() => new Set(u), [u]), [o, m] = i.useState(!1), $ = c !== void 0, f = $ ? c : o, [k, V] = i.useState(/* @__PURE__ */ new Set()), y = i.useRef(f);
|
|
64
|
+
i.useEffect(() => {
|
|
65
|
+
f && !y.current && V(new Set(u)), y.current = f;
|
|
66
|
+
}, [f, u]);
|
|
67
|
+
const p = (s) => {
|
|
68
|
+
S || T(s), h?.(s);
|
|
69
|
+
}, L = (s) => {
|
|
70
|
+
if (N.has(s)) {
|
|
71
|
+
p(u.filter((v) => v !== s));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const _ = [...u, s];
|
|
75
|
+
if (A) {
|
|
76
|
+
const v = g.filter(
|
|
77
|
+
(b) => !b.disabled && b.count !== 0
|
|
78
|
+
), B = new Set(_);
|
|
79
|
+
if (v.length > 0 && v.every((b) => B.has(b.value))) {
|
|
80
|
+
p([]);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
p(_);
|
|
85
|
+
}, w = (s) => {
|
|
86
|
+
$ || m(s), j?.(s);
|
|
87
|
+
}, O = i.useMemo(
|
|
88
|
+
() => [
|
|
89
|
+
...g.filter((s) => k.has(s.value)),
|
|
90
|
+
...g.filter((s) => !k.has(s.value))
|
|
91
|
+
],
|
|
92
|
+
[g, k]
|
|
93
|
+
);
|
|
94
|
+
return {
|
|
95
|
+
clear: () => p([]),
|
|
96
|
+
onOpenChange: w,
|
|
97
|
+
open: f,
|
|
98
|
+
orderedOptions: O,
|
|
99
|
+
selectedSet: N,
|
|
100
|
+
toggleOption: L,
|
|
101
|
+
value: u
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function de({ checked: d }) {
|
|
105
|
+
return /* @__PURE__ */ t(
|
|
106
|
+
"span",
|
|
107
|
+
{
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
className: M(
|
|
110
|
+
ye(),
|
|
111
|
+
"mt-0 flex items-center justify-center self-center"
|
|
112
|
+
),
|
|
113
|
+
"data-state": d ? "checked" : "unchecked",
|
|
114
|
+
children: d ? /* @__PURE__ */ t($e, {}) : null
|
|
115
|
+
}
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
function X({ count: d }) {
|
|
119
|
+
return /* @__PURE__ */ t("span", { className: "text-muted-foreground text-label-sm ml-auto tabular-nums", children: d });
|
|
120
|
+
}
|
|
121
|
+
const Ge = "__all__", Xe = "__clear__", Je = i.forwardRef(
|
|
122
|
+
({
|
|
123
|
+
className: d,
|
|
124
|
+
dataHook: r,
|
|
125
|
+
label: h,
|
|
126
|
+
options: c,
|
|
127
|
+
value: j,
|
|
128
|
+
defaultValue: g = [],
|
|
129
|
+
onValueChange: A,
|
|
130
|
+
open: R,
|
|
131
|
+
onOpenChange: T,
|
|
132
|
+
size: S = "default",
|
|
133
|
+
icon: u,
|
|
134
|
+
maxVisibleLabels: N = 1,
|
|
135
|
+
allLabel: o,
|
|
136
|
+
allIcon: m,
|
|
137
|
+
allCount: $,
|
|
138
|
+
searchThreshold: f = 10,
|
|
139
|
+
searchable: k,
|
|
140
|
+
collapseFullSelection: V = !0,
|
|
141
|
+
disabled: y = !1,
|
|
142
|
+
clearLabel: p,
|
|
143
|
+
summaryLabel: L,
|
|
144
|
+
searchPlaceholder: w,
|
|
145
|
+
emptyLabel: O,
|
|
146
|
+
emptyDescription: s,
|
|
147
|
+
clearSearchAriaLabel: _,
|
|
148
|
+
presentation: v = "menu",
|
|
149
|
+
doneLabel: B,
|
|
150
|
+
drawerDescription: b,
|
|
151
|
+
trackingEl: ue,
|
|
152
|
+
trackingLabel: he,
|
|
153
|
+
"aria-label": me,
|
|
154
|
+
...fe
|
|
155
|
+
}, pe) => {
|
|
156
|
+
const a = qe({
|
|
157
|
+
collapseFullSelection: V,
|
|
158
|
+
defaultValue: g,
|
|
159
|
+
onOpenChange: T,
|
|
160
|
+
onValueChange: A,
|
|
161
|
+
open: R,
|
|
162
|
+
options: c,
|
|
163
|
+
value: j
|
|
164
|
+
}), ve = Be("md"), ge = v === "drawer" || v === "auto" && ve, J = i.useId(), [K, E] = i.useState(""), P = K.trim().toLowerCase(), C = P.length > 0, I = C ? a.orderedOptions.filter(
|
|
165
|
+
(e) => e.label.toLowerCase().includes(P) || e.value.toLowerCase().includes(P)
|
|
166
|
+
) : a.orderedOptions, Y = i.useRef(null), U = k ?? c.length > f, be = new Map(
|
|
167
|
+
c.map((e) => [e.value, e.label])
|
|
168
|
+
), D = a.value.flatMap((e) => {
|
|
169
|
+
const n = be.get(e);
|
|
170
|
+
return n === void 0 ? [] : [n];
|
|
171
|
+
}), x = D.length, Q = a.value.length === 0, F = $ ?? (c.length > 0 && c.every((e) => e.count !== void 0) ? c.reduce((e, n) => e + (n.count ?? 0), 0) : void 0), W = Math.max(1, N);
|
|
172
|
+
let z, Z = !1;
|
|
173
|
+
if (x === 0)
|
|
174
|
+
z = o ?? h, Z = o === void 0;
|
|
175
|
+
else if (x <= W)
|
|
176
|
+
z = D.join(", ");
|
|
177
|
+
else {
|
|
178
|
+
const e = {
|
|
179
|
+
"{count}": String(x),
|
|
180
|
+
"{labels}": D.slice(0, W).join(", "),
|
|
181
|
+
"{rest}": String(x - W)
|
|
182
|
+
};
|
|
183
|
+
z = (L ?? "{labels} +{rest}").replace(
|
|
184
|
+
/\{(count|labels|rest)\}/g,
|
|
185
|
+
(n) => e[n] ?? n
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
const Ce = x > 0 ? `${h}: ${D.join(", ")}` : o !== void 0 ? `${h}: ${o}` : h, xe = a.value.map((e) => c.find((n) => n.value === e)).find((e) => e !== void 0), H = u ?? (x > 0 ? xe?.icon : m) ?? void 0, ee = (e) => {
|
|
189
|
+
e || E(""), a.onOpenChange(e);
|
|
190
|
+
}, te = /* @__PURE__ */ l(
|
|
191
|
+
"button",
|
|
192
|
+
{
|
|
193
|
+
ref: pe,
|
|
194
|
+
"aria-label": me ?? Ce,
|
|
195
|
+
className: M(We({ size: S }), d),
|
|
196
|
+
"data-hook": r,
|
|
197
|
+
"data-slot": "multi-select-filter",
|
|
198
|
+
"data-tracking-el": ue ?? "multi-select-filter",
|
|
199
|
+
"data-tracking-label": he,
|
|
200
|
+
disabled: y,
|
|
201
|
+
type: "button",
|
|
202
|
+
...fe,
|
|
203
|
+
children: [
|
|
204
|
+
H ? /* @__PURE__ */ t(
|
|
205
|
+
"span",
|
|
206
|
+
{
|
|
207
|
+
"aria-hidden": "true",
|
|
208
|
+
className: "flex shrink-0 items-center",
|
|
209
|
+
"data-hook": `${r}-icon`,
|
|
210
|
+
children: H
|
|
211
|
+
}
|
|
212
|
+
) : null,
|
|
213
|
+
/* @__PURE__ */ t(
|
|
214
|
+
"span",
|
|
215
|
+
{
|
|
216
|
+
className: M(Z && "text-muted-foreground"),
|
|
217
|
+
"data-hook": `${r}-summary`,
|
|
218
|
+
children: z
|
|
219
|
+
}
|
|
220
|
+
),
|
|
221
|
+
/* @__PURE__ */ t(Ne, { "aria-hidden": "true", className: "text-muted-foreground" })
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
);
|
|
225
|
+
if (ge) {
|
|
226
|
+
const e = `${J}-all`;
|
|
227
|
+
return /* @__PURE__ */ l(ze, { open: a.open, onOpenChange: ee, children: [
|
|
228
|
+
/* @__PURE__ */ t(Me, { asChild: !0, children: te }),
|
|
229
|
+
/* @__PURE__ */ l(je, { dataHook: `${r}-drawer`, children: [
|
|
230
|
+
/* @__PURE__ */ l(Ae, { children: [
|
|
231
|
+
/* @__PURE__ */ t(Re, { children: h }),
|
|
232
|
+
/* @__PURE__ */ t(Te, { className: "sr-only", children: b ?? "Picks apply as you make them." })
|
|
233
|
+
] }),
|
|
234
|
+
U ? /* @__PURE__ */ t(ce, { className: "shrink-0 pb-4", children: /* @__PURE__ */ t(
|
|
235
|
+
Ee,
|
|
236
|
+
{
|
|
237
|
+
"aria-label": w ?? "Search options...",
|
|
238
|
+
dataHook: `${r}-search`,
|
|
239
|
+
placeholder: w ?? "Search options...",
|
|
240
|
+
type: "search",
|
|
241
|
+
value: K,
|
|
242
|
+
onChange: (n) => E(n.target.value)
|
|
243
|
+
}
|
|
244
|
+
) }) : null,
|
|
245
|
+
/* @__PURE__ */ l(ce, { className: "flex min-h-0 flex-1 flex-col gap-4 overflow-y-auto pt-1 pb-2", children: [
|
|
246
|
+
C && I.length === 0 ? (
|
|
247
|
+
/* The compact no-match form of Patterns → Empty States: the
|
|
248
|
+
muted chip, the message line, one quiet hint — the same
|
|
249
|
+
form CommandEmpty draws in the menu. */
|
|
250
|
+
/* @__PURE__ */ l(
|
|
251
|
+
"div",
|
|
252
|
+
{
|
|
253
|
+
className: "text-body-sm flex flex-col items-center gap-1 py-6 text-center",
|
|
254
|
+
"data-hook": `${r}-empty`,
|
|
255
|
+
children: [
|
|
256
|
+
/* @__PURE__ */ t(
|
|
257
|
+
"span",
|
|
258
|
+
{
|
|
259
|
+
"aria-hidden": "true",
|
|
260
|
+
className: M(Qe(), "mb-1"),
|
|
261
|
+
children: /* @__PURE__ */ t(ae, {})
|
|
262
|
+
}
|
|
263
|
+
),
|
|
264
|
+
/* @__PURE__ */ t("p", { children: O ?? "No options found." }),
|
|
265
|
+
/* @__PURE__ */ t("p", { className: "text-muted-foreground", children: s ?? "Try another search." })
|
|
266
|
+
]
|
|
267
|
+
}
|
|
268
|
+
)
|
|
269
|
+
) : /* @__PURE__ */ l(we, { children: [
|
|
270
|
+
o !== void 0 && !C ? /* @__PURE__ */ l("div", { className: "flex items-center gap-2", children: [
|
|
271
|
+
/* @__PURE__ */ t(
|
|
272
|
+
se,
|
|
273
|
+
{
|
|
274
|
+
checked: Q,
|
|
275
|
+
dataHook: `${r}-option-all`,
|
|
276
|
+
id: e,
|
|
277
|
+
onCheckedChange: a.clear
|
|
278
|
+
}
|
|
279
|
+
),
|
|
280
|
+
/* @__PURE__ */ l(oe, { className: "flex-1 gap-2", htmlFor: e, children: [
|
|
281
|
+
m ? /* @__PURE__ */ t(
|
|
282
|
+
"span",
|
|
283
|
+
{
|
|
284
|
+
"aria-hidden": "true",
|
|
285
|
+
className: "flex shrink-0 items-center [&_svg]:size-4",
|
|
286
|
+
children: m
|
|
287
|
+
}
|
|
288
|
+
) : null,
|
|
289
|
+
o
|
|
290
|
+
] }),
|
|
291
|
+
F !== void 0 ? /* @__PURE__ */ t(X, { count: F }) : null
|
|
292
|
+
] }) : null,
|
|
293
|
+
/* @__PURE__ */ t("div", { className: "grid grid-cols-2 gap-x-4 gap-y-3", children: I.map((n, q) => {
|
|
294
|
+
const ne = a.selectedSet.has(n.value), ke = n.disabled || n.count === 0 && !ne, re = `${J}-${q}`;
|
|
295
|
+
return /* @__PURE__ */ l(
|
|
296
|
+
"div",
|
|
297
|
+
{
|
|
298
|
+
className: "flex items-center gap-2",
|
|
299
|
+
children: [
|
|
300
|
+
/* @__PURE__ */ t(
|
|
301
|
+
se,
|
|
302
|
+
{
|
|
303
|
+
checked: ne,
|
|
304
|
+
dataHook: `${r}-option-${n.value}`,
|
|
305
|
+
disabled: ke,
|
|
306
|
+
id: re,
|
|
307
|
+
onCheckedChange: () => a.toggleOption(n.value)
|
|
308
|
+
}
|
|
309
|
+
),
|
|
310
|
+
/* @__PURE__ */ l(oe, { className: "flex-1 gap-2", htmlFor: re, children: [
|
|
311
|
+
n.icon ? /* @__PURE__ */ t(
|
|
312
|
+
"span",
|
|
313
|
+
{
|
|
314
|
+
"aria-hidden": "true",
|
|
315
|
+
className: "flex shrink-0 items-center [&_svg]:size-4",
|
|
316
|
+
"data-hook": `${r}-option-${n.value}-icon`,
|
|
317
|
+
children: n.icon
|
|
318
|
+
}
|
|
319
|
+
) : null,
|
|
320
|
+
n.label
|
|
321
|
+
] })
|
|
322
|
+
]
|
|
323
|
+
},
|
|
324
|
+
n.value
|
|
325
|
+
);
|
|
326
|
+
}) })
|
|
327
|
+
] }),
|
|
328
|
+
a.value.length > 0 && !C ? /* @__PURE__ */ t(
|
|
329
|
+
le,
|
|
330
|
+
{
|
|
331
|
+
dataHook: `${r}-clear`,
|
|
332
|
+
variant: "ghost",
|
|
333
|
+
onClick: a.clear,
|
|
334
|
+
children: p ?? "Clear filters"
|
|
335
|
+
}
|
|
336
|
+
) : null
|
|
337
|
+
] }),
|
|
338
|
+
/* @__PURE__ */ t(Ve, { children: /* @__PURE__ */ t(Le, { asChild: !0, children: /* @__PURE__ */ t(le, { dataHook: `${r}-done`, children: B ?? "Done" }) }) })
|
|
339
|
+
] })
|
|
340
|
+
] });
|
|
341
|
+
}
|
|
342
|
+
return /* @__PURE__ */ l(Pe, { open: a.open, onOpenChange: ee, children: [
|
|
343
|
+
/* @__PURE__ */ t(Ie, { asChild: !0, children: te }),
|
|
344
|
+
/* @__PURE__ */ t(
|
|
345
|
+
Ue,
|
|
346
|
+
{
|
|
347
|
+
align: "start",
|
|
348
|
+
"aria-label": h,
|
|
349
|
+
className: "w-max max-w-80 min-w-60 p-0",
|
|
350
|
+
dataHook: `${r}-popover`,
|
|
351
|
+
onOpenAutoFocus: (e) => {
|
|
352
|
+
U || (e.preventDefault(), Y.current?.focus());
|
|
353
|
+
},
|
|
354
|
+
children: /* @__PURE__ */ l(
|
|
355
|
+
Oe,
|
|
356
|
+
{
|
|
357
|
+
ref: Y,
|
|
358
|
+
dataHook: `${r}-command`,
|
|
359
|
+
shouldFilter: !1,
|
|
360
|
+
children: [
|
|
361
|
+
U ? (
|
|
362
|
+
/* Autofocused on open — the person came to type, not scroll;
|
|
363
|
+
focus moves into a menu they deliberately opened. */
|
|
364
|
+
/* @__PURE__ */ t(
|
|
365
|
+
_e,
|
|
366
|
+
{
|
|
367
|
+
autoFocus: !0,
|
|
368
|
+
clearSearchAriaLabel: _ ?? "Clear search",
|
|
369
|
+
dataHook: `${r}-search`,
|
|
370
|
+
placeholder: w ?? "Search options...",
|
|
371
|
+
onValueChange: E
|
|
372
|
+
}
|
|
373
|
+
)
|
|
374
|
+
) : null,
|
|
375
|
+
/* @__PURE__ */ l(De, { "aria-multiselectable": "true", children: [
|
|
376
|
+
/* @__PURE__ */ t(
|
|
377
|
+
Fe,
|
|
378
|
+
{
|
|
379
|
+
description: s ?? "Try another search.",
|
|
380
|
+
icon: /* @__PURE__ */ t(ae, {}),
|
|
381
|
+
children: O ?? "No options found."
|
|
382
|
+
}
|
|
383
|
+
),
|
|
384
|
+
/* @__PURE__ */ l(ie, { children: [
|
|
385
|
+
o !== void 0 && !C ? /* @__PURE__ */ l(
|
|
386
|
+
G,
|
|
387
|
+
{
|
|
388
|
+
"aria-checked": Q,
|
|
389
|
+
dataHook: `${r}-option-all`,
|
|
390
|
+
value: Ge,
|
|
391
|
+
onSelect: a.clear,
|
|
392
|
+
children: [
|
|
393
|
+
/* @__PURE__ */ t(de, { checked: Q }),
|
|
394
|
+
m ? /* @__PURE__ */ t(
|
|
395
|
+
"span",
|
|
396
|
+
{
|
|
397
|
+
"aria-hidden": "true",
|
|
398
|
+
className: "flex shrink-0 items-center [&_svg]:size-4",
|
|
399
|
+
children: m
|
|
400
|
+
}
|
|
401
|
+
) : null,
|
|
402
|
+
o,
|
|
403
|
+
F !== void 0 ? /* @__PURE__ */ t(X, { count: F }) : null
|
|
404
|
+
]
|
|
405
|
+
}
|
|
406
|
+
) : null,
|
|
407
|
+
I.map((e) => {
|
|
408
|
+
const n = a.selectedSet.has(e.value), q = e.disabled || e.count === 0 && !n;
|
|
409
|
+
return /* @__PURE__ */ l(
|
|
410
|
+
G,
|
|
411
|
+
{
|
|
412
|
+
"aria-checked": n,
|
|
413
|
+
dataHook: `${r}-option-${e.value}`,
|
|
414
|
+
disabled: q,
|
|
415
|
+
value: e.value,
|
|
416
|
+
onSelect: () => a.toggleOption(e.value),
|
|
417
|
+
children: [
|
|
418
|
+
/* @__PURE__ */ t(de, { checked: n }),
|
|
419
|
+
e.icon ? /* @__PURE__ */ t(
|
|
420
|
+
"span",
|
|
421
|
+
{
|
|
422
|
+
"aria-hidden": "true",
|
|
423
|
+
className: "flex shrink-0 items-center [&_svg]:size-4",
|
|
424
|
+
"data-hook": `${r}-option-${e.value}-icon`,
|
|
425
|
+
children: e.icon
|
|
426
|
+
}
|
|
427
|
+
) : null,
|
|
428
|
+
e.label,
|
|
429
|
+
e.count !== void 0 ? /* @__PURE__ */ t(X, { count: e.count }) : null
|
|
430
|
+
]
|
|
431
|
+
},
|
|
432
|
+
e.value
|
|
433
|
+
);
|
|
434
|
+
})
|
|
435
|
+
] }),
|
|
436
|
+
a.value.length > 0 && !C ? (
|
|
437
|
+
/* A bordered group, not CommandSeparator — role="separator"
|
|
438
|
+
is not a permitted child of the cmdk listbox. */
|
|
439
|
+
/* @__PURE__ */ t(ie, { className: "border-border border-t", children: /* @__PURE__ */ t(
|
|
440
|
+
G,
|
|
441
|
+
{
|
|
442
|
+
className: "justify-center",
|
|
443
|
+
dataHook: `${r}-clear`,
|
|
444
|
+
value: Xe,
|
|
445
|
+
onSelect: a.clear,
|
|
446
|
+
children: p ?? "Clear filters"
|
|
447
|
+
}
|
|
448
|
+
) })
|
|
449
|
+
) : null
|
|
450
|
+
] })
|
|
451
|
+
]
|
|
452
|
+
}
|
|
453
|
+
)
|
|
454
|
+
}
|
|
455
|
+
)
|
|
456
|
+
] });
|
|
457
|
+
}
|
|
458
|
+
);
|
|
459
|
+
Je.displayName = "MultiSelectFilter";
|
|
460
|
+
export {
|
|
461
|
+
Je as MultiSelectFilter,
|
|
462
|
+
We as multiSelectFilterTriggerVariants
|
|
463
|
+
};
|
package/dist/pagination.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),A=require("react"),m=require("@brightlocal/icons"),H=require("class-variance-authority"),d=require("@brightlocal/ui-components/lib/utils"),R=require("@brightlocal/ui-components/hooks/use-breakpoint");function S(i){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const e in i)if(e!=="default"){const r=Object.getOwnPropertyDescriptor(i,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:()=>i[e]})}}return n.default=i,Object.freeze(n)}const f=S(A);function B({page:i,totalPages:n}){const r=R.useIsBelowBreakpoint("sm")?5:7;return f.useMemo(()=>{const t=Math.max(5,r),o=[];if(o.push("previous"),n<=t)for(let u=1;u<=n;u++)o.push(u);else{const u=Math.floor((t-5)/2),h=t-3,v=n-h;if(i<=h){for(let l=1;l<=t-2;l++)o.push(l);o.push("ellipsis",n)}else if(i>=v){o.push(1,"ellipsis");for(let l=n-(t-3);l<=n;l++)o.push(l)}else{o.push(1,"ellipsis");for(let l=i-u;l<=i+u;l++)o.push(l);o.push("ellipsis",n)}}return o.push("next"),o},[i,n,r])}const C=H.cva(["inline-flex items-center justify-center","h-9 w-9","rounded-full","text-label","transition-colors duration-fast ease-out","focus-visible:outline-none focus-visible:shadow-default"],{variants:{variant:{previous:["text-foreground","hover:bg-accent","aria-disabled:opacity-50 aria-disabled:cursor-default aria-disabled:pointer-events-none"],next:["text-foreground","hover:bg-accent","aria-disabled:opacity-50 aria-disabled:cursor-default aria-disabled:pointer-events-none"],link:["text-foreground","hover:bg-accent hover:text-accent-foreground","aria-[current=page]:bg-background aria-[current=page]:border aria-[current=page]:border-input","dark:aria-[current=page]:bg-input/30","aria-[current=page]:hover:bg-accent","aria-[current=page]:focus-visible:border-ring","aria-disabled:opacity-50 aria-disabled:cursor-default aria-disabled:pointer-events-none"],ellipsis:["relative","cursor-default","text-foreground","pointer-events-none"]}},defaultVariants:{variant:"link"}});function j({className:i,dataHook:n,trackingEl:e,trackingLabel:r,ariaLabel:s,...t}){return a.jsx("nav",{"aria-label":s??"Pagination",className:d.cn("mx-auto flex w-full justify-center",i),"data-hook":n,"data-slot":"pagination","data-tracking-el":e||"pagination","data-tracking-label":r,role:"navigation",...t})}j.displayName="Pagination";function L({className:i,...n}){return a.jsx("ul",{className:d.cn("flex flex-row items-center gap-2",i),"data-slot":"pagination-content",...n})}function x(i){return a.jsx("li",{"data-slot":"pagination-item",...i})}const b=f.forwardRef(({className:i,variant:n,isActive:e,children:r,...s},t)=>a.jsx("button",{ref:t,"aria-current":e?"page":void 0,className:d.cn(C({variant:n}),i),"data-active":e,"data-slot":"pagination-button",type:"button",...s,children:r}));b.displayName="PaginationButton";const y=f.forwardRef(({className:i,disabled:n,ariaLabel:e,...r},s)=>a.jsx(b,{ref:s,"aria-disabled":n,"aria-label":e??"Go to previous page",className:i,disabled:n,variant:"previous",...r,children:a.jsx(m.ChevronLeft,{})}));y.displayName="PaginationPrevious";const P=f.forwardRef(({className:i,disabled:n,ariaLabel:e,...r},s)=>a.jsx(b,{ref:s,"aria-disabled":n,"aria-label":e??"Go to next page",className:i,disabled:n,variant:"next",...r,children:a.jsx(m.ChevronRight,{})}));P.displayName="PaginationNext";const k=f.forwardRef(({className:i,page:n,isActive:e,ariaLabel:r,...s},t)=>a.jsx(b,{ref:t,"aria-label":r?r.replace("{page}",String(n)):`Go to page ${n}`,className:i,isActive:e,variant:"link",...s,children:n}));k.displayName="PaginationLink";function q({className:i,srLabel:n="More pages",...e}){return a.jsxs("span",{"aria-hidden":"true",className:d.cn(C({variant:"ellipsis"}),i),"data-slot":"pagination-ellipsis",...e,children:[a.jsx(m.MoreHorizontal,{}),a.jsx("span",{className:"sr-only",children:n})]})}const O=f.forwardRef(({className:i,page:n,totalPages:e,onPageChange:r,dataHook:s,totalItems:t,pageSize:o,renderCaption:u,ariaLabel:h,prevAriaLabel:v,nextAriaLabel:l,pageAriaLabel:$,ellipsisSrLabel:T,trackingEl:V,trackingLabel:G,..._},D)=>{const E=B({page:n,totalPages:e}),F=R.useIsBelowBreakpoint("sm"),p=(()=>{if(F||u===null||t===void 0||o===void 0||!Number.isFinite(o)||o<=0||!Number.isFinite(t)||t<0)return null;const c=Math.max(1,Math.ceil(t/o)),g=Math.min(Math.max(1,Math.floor(n)||1),c),N=t===0?0:(g-1)*o+1,M=Math.min(g*o,t);return u?u({page:g,totalPages:e,from:N,to:M,total:t}):t===0?null:`Showing ${N} to ${M} of ${t} results`})(),w=e>1;return p==null&&!w?null:a.jsxs("div",{ref:D,className:d.cn("flex min-h-9 w-full flex-wrap items-center gap-x-4 gap-y-2",p==null?"justify-center":"justify-between",i),"data-hook":s,"data-slot":"pagination-controls","data-tracking-el":V||"pagination-controls","data-tracking-label":G,..._,children:[p!=null&&a.jsx("span",{className:"text-body-sm text-muted-foreground whitespace-nowrap","data-slot":"pagination-caption",children:p}),w&&a.jsx(j,{ariaLabel:h,className:d.cn(p!=null&&"mx-0 w-auto grow justify-end"),dataHook:`${s}-nav`,children:a.jsx(L,{children:E.map((c,g)=>c==="previous"?a.jsx(x,{children:a.jsx(y,{ariaLabel:v,disabled:n<=1,onClick:()=>r(n-1)})},"previous"):c==="next"?a.jsx(x,{children:a.jsx(P,{ariaLabel:l,disabled:n>=e,onClick:()=>r(n+1)})},"next"):c==="ellipsis"?a.jsx(x,{children:a.jsx(q,{srLabel:T})},`ellipsis-${g}`):a.jsx(x,{children:a.jsx(k,{ariaLabel:$,isActive:c===n,page:c,onClick:()=>r(c)})},c))})})]})});O.displayName="PaginationControls";exports.Pagination=j;exports.PaginationButton=b;exports.PaginationContent=L;exports.PaginationControls=O;exports.PaginationEllipsis=q;exports.PaginationItem=x;exports.PaginationLink=k;exports.PaginationNext=P;exports.PaginationPrevious=y;exports.usePagination=B;
|