@boyernick/standard-ui-react 0.1.1-canary.2 → 0.1.1-canary.22
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/package.json +5 -3
- package/src/accordion.tsx +1 -1
- package/src/alert-dialog.tsx +1 -1
- package/src/autocomplete.tsx +12 -11
- package/src/badge.tsx +73 -9
- package/src/brand.tsx +2 -2
- package/src/breadcrumb.tsx +38 -20
- package/src/button.tsx +2 -2
- package/src/calendar.tsx +22 -11
- package/src/card.tsx +57 -14
- package/src/carousel.tsx +163 -6
- package/src/checkbox.tsx +35 -13
- package/src/collapsible.tsx +4 -2
- package/src/combobox.tsx +13 -12
- package/src/command.tsx +38 -14
- package/src/context-menu.tsx +6 -3
- package/src/date-picker.tsx +174 -0
- package/src/dialog.tsx +33 -10
- package/src/drawer.tsx +1 -1
- package/src/empty.tsx +4 -4
- package/src/field.tsx +1 -1
- package/src/filter-group.tsx +139 -0
- package/src/icons.tsx +39 -0
- package/src/illustrations.tsx +219 -141
- package/src/image-modal.tsx +440 -49
- package/src/index.ts +188 -0
- package/src/input.tsx +1 -1
- package/src/kbd.tsx +49 -0
- package/src/lib/motion.ts +128 -18
- package/src/lib/popup.ts +45 -0
- package/src/menu.tsx +7 -4
- package/src/menubar.tsx +5 -0
- package/src/meter.tsx +1 -1
- package/src/minimap.tsx +267 -0
- package/src/navigation-menu.tsx +336 -67
- package/src/number-field.tsx +327 -61
- package/src/pagination.tsx +258 -42
- package/src/popover.tsx +3 -1
- package/src/preview-card.tsx +3 -1
- package/src/progress.tsx +6 -1
- package/src/questionnaire.tsx +279 -0
- package/src/scroll-area.tsx +1 -1
- package/src/select.tsx +8 -6
- package/src/sidebar.tsx +109 -28
- package/src/slider.tsx +64 -6
- package/src/sounds.tsx +6 -10
- package/src/spinner.tsx +105 -32
- package/src/switch.tsx +2 -2
- package/src/table.tsx +82 -15
- package/src/tabs.tsx +184 -38
- package/src/text-animate.tsx +71 -28
- package/src/textarea.tsx +1 -1
- package/src/timeline.tsx +321 -0
- package/src/toast.tsx +156 -23
- package/src/tooltip.tsx +43 -3
- package/src/video-player.tsx +296 -120
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useState, type ReactNode } from "react"
|
|
4
|
+
import type { DateRange, PropsBase } from "react-day-picker"
|
|
5
|
+
import { Button } from "./button"
|
|
6
|
+
import { Calendar } from "./calendar"
|
|
7
|
+
import { IconCalendar1 } from "./icons"
|
|
8
|
+
import { cn } from "./lib/cn"
|
|
9
|
+
import {
|
|
10
|
+
Popover,
|
|
11
|
+
PopoverPopup,
|
|
12
|
+
PopoverPortal,
|
|
13
|
+
PopoverPositioner,
|
|
14
|
+
PopoverTrigger,
|
|
15
|
+
} from "./popover"
|
|
16
|
+
|
|
17
|
+
const dateFormatter = new Intl.DateTimeFormat("en-US", {
|
|
18
|
+
month: "short",
|
|
19
|
+
day: "numeric",
|
|
20
|
+
year: "numeric",
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
const formatDate = (date: Date) => dateFormatter.format(date)
|
|
24
|
+
|
|
25
|
+
type DatePickerBaseProps = {
|
|
26
|
+
/** Options forwarded to Calendar, excluding its selection mode. */
|
|
27
|
+
calendarProps?: Omit<PropsBase, "mode" | "required">
|
|
28
|
+
/** Classes applied to the trigger button. */
|
|
29
|
+
className?: string
|
|
30
|
+
/** Disables the trigger button. */
|
|
31
|
+
disabled?: boolean
|
|
32
|
+
/** Placeholder shown when no date is selected. */
|
|
33
|
+
placeholder?: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type DatePickerSingleProps = DatePickerBaseProps & {
|
|
37
|
+
mode?: "single"
|
|
38
|
+
selected?: Date
|
|
39
|
+
onSelect?: (date: Date | undefined) => void
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export type DatePickerRangeProps = DatePickerBaseProps & {
|
|
43
|
+
mode: "range"
|
|
44
|
+
selected?: DateRange
|
|
45
|
+
onSelect?: (range: DateRange | undefined) => void
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type DatePickerProps = DatePickerSingleProps | DatePickerRangeProps
|
|
49
|
+
|
|
50
|
+
const DatePickerTrigger = ({
|
|
51
|
+
className,
|
|
52
|
+
disabled,
|
|
53
|
+
empty,
|
|
54
|
+
label,
|
|
55
|
+
}: {
|
|
56
|
+
className?: string
|
|
57
|
+
disabled?: boolean
|
|
58
|
+
empty: boolean
|
|
59
|
+
label: string
|
|
60
|
+
}) => (
|
|
61
|
+
<PopoverTrigger
|
|
62
|
+
render={
|
|
63
|
+
<Button
|
|
64
|
+
type="button"
|
|
65
|
+
// Default md height, so the trigger lines up with every other field
|
|
66
|
+
// in a form rather than sitting 4px short of them.
|
|
67
|
+
size="md"
|
|
68
|
+
variant="outline"
|
|
69
|
+
disabled={disabled}
|
|
70
|
+
prefix={<IconCalendar1 aria-hidden />}
|
|
71
|
+
// The outline button fills on hover, which is right for a button and
|
|
72
|
+
// wrong here: this reads as a field, and fields in the system keep
|
|
73
|
+
// their surface. The border and the popover carry the state.
|
|
74
|
+
className={cn("w-56 justify-start hover:bg-surface", className)}
|
|
75
|
+
/>
|
|
76
|
+
}
|
|
77
|
+
>
|
|
78
|
+
<span
|
|
79
|
+
className={cn(
|
|
80
|
+
"min-w-0 flex-1 truncate text-left",
|
|
81
|
+
empty && "text-fg-tertiary",
|
|
82
|
+
)}
|
|
83
|
+
>
|
|
84
|
+
{label}
|
|
85
|
+
</span>
|
|
86
|
+
</PopoverTrigger>
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
const DatePickerPopup = ({ children }: { children: ReactNode }) => (
|
|
90
|
+
<PopoverPortal>
|
|
91
|
+
<PopoverPositioner align="start" sideOffset={6}>
|
|
92
|
+
<PopoverPopup className="w-auto gap-0 p-0">{children}</PopoverPopup>
|
|
93
|
+
</PopoverPositioner>
|
|
94
|
+
</PopoverPortal>
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
const SingleDatePicker = ({
|
|
98
|
+
calendarProps,
|
|
99
|
+
className,
|
|
100
|
+
disabled,
|
|
101
|
+
onSelect,
|
|
102
|
+
placeholder = "Pick a date",
|
|
103
|
+
selected,
|
|
104
|
+
}: DatePickerSingleProps) => {
|
|
105
|
+
const [open, setOpen] = useState(false)
|
|
106
|
+
|
|
107
|
+
const handleSelect = (date: Date | undefined) => {
|
|
108
|
+
onSelect?.(date)
|
|
109
|
+
if (date) setOpen(false)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return (
|
|
113
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
114
|
+
<DatePickerTrigger
|
|
115
|
+
className={className}
|
|
116
|
+
disabled={disabled}
|
|
117
|
+
empty={!selected}
|
|
118
|
+
label={selected ? formatDate(selected) : placeholder}
|
|
119
|
+
/>
|
|
120
|
+
<DatePickerPopup>
|
|
121
|
+
<Calendar
|
|
122
|
+
{...calendarProps}
|
|
123
|
+
className={cn("border-0", calendarProps?.className)}
|
|
124
|
+
mode="single"
|
|
125
|
+
selected={selected}
|
|
126
|
+
onSelect={handleSelect}
|
|
127
|
+
/>
|
|
128
|
+
</DatePickerPopup>
|
|
129
|
+
</Popover>
|
|
130
|
+
)
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
const RangeDatePicker = ({
|
|
134
|
+
calendarProps,
|
|
135
|
+
className,
|
|
136
|
+
disabled,
|
|
137
|
+
onSelect,
|
|
138
|
+
placeholder = "Pick a date range",
|
|
139
|
+
selected,
|
|
140
|
+
}: DatePickerRangeProps) => {
|
|
141
|
+
const [open, setOpen] = useState(false)
|
|
142
|
+
const label = selected?.from
|
|
143
|
+
? selected.to
|
|
144
|
+
? `${formatDate(selected.from)} – ${formatDate(selected.to)}`
|
|
145
|
+
: `${formatDate(selected.from)} – Select end date`
|
|
146
|
+
: placeholder
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<Popover open={open} onOpenChange={setOpen}>
|
|
150
|
+
<DatePickerTrigger
|
|
151
|
+
className={className}
|
|
152
|
+
disabled={disabled}
|
|
153
|
+
empty={!selected?.from}
|
|
154
|
+
label={label}
|
|
155
|
+
/>
|
|
156
|
+
<DatePickerPopup>
|
|
157
|
+
<Calendar
|
|
158
|
+
{...calendarProps}
|
|
159
|
+
className={cn("border-0", calendarProps?.className)}
|
|
160
|
+
mode="range"
|
|
161
|
+
selected={selected}
|
|
162
|
+
onSelect={onSelect}
|
|
163
|
+
/>
|
|
164
|
+
</DatePickerPopup>
|
|
165
|
+
</Popover>
|
|
166
|
+
)
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export const DatePicker = (props: DatePickerProps) =>
|
|
170
|
+
props.mode === "range" ? (
|
|
171
|
+
<RangeDatePicker {...props} />
|
|
172
|
+
) : (
|
|
173
|
+
<SingleDatePicker {...props} />
|
|
174
|
+
)
|
package/src/dialog.tsx
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { Dialog as BaseDialog } from "@base-ui/react/dialog"
|
|
4
4
|
import type { ComponentProps, HTMLAttributes } from "react"
|
|
5
|
+
import { useRef } from "react"
|
|
5
6
|
import { cn } from "./lib/cn"
|
|
6
7
|
import { motion } from "./lib/motion"
|
|
7
8
|
|
|
@@ -41,16 +42,38 @@ export const DialogBackdrop = ({
|
|
|
41
42
|
/>
|
|
42
43
|
)
|
|
43
44
|
|
|
44
|
-
export const DialogPopup = ({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
45
|
+
export const DialogPopup = ({
|
|
46
|
+
className,
|
|
47
|
+
initialFocus,
|
|
48
|
+
ref,
|
|
49
|
+
...props
|
|
50
|
+
}: DialogPopupProps) => {
|
|
51
|
+
const popupRef = useRef<HTMLDivElement | null>(null)
|
|
52
|
+
|
|
53
|
+
const setRef = (node: HTMLDivElement | null) => {
|
|
54
|
+
popupRef.current = node
|
|
55
|
+
if (typeof ref === "function") ref(node)
|
|
56
|
+
else if (ref) ref.current = node
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<BaseDialog.Popup
|
|
61
|
+
ref={setRef}
|
|
62
|
+
// Base UI focuses the first tabbable element by default. In a dialog long
|
|
63
|
+
// enough to scroll that is usually the action at the bottom, and focusing
|
|
64
|
+
// it scrolls the body to the end before the reader has seen the start —
|
|
65
|
+
// so the popup takes focus itself, which is what its `tabindex="-1"` is
|
|
66
|
+
// for. Callers can still name their own target.
|
|
67
|
+
initialFocus={initialFocus ?? popupRef}
|
|
68
|
+
className={cn(
|
|
69
|
+
"fixed top-1/2 left-1/2 z-50 flex w-full max-w-md -translate-x-1/2 -translate-y-1/2 flex-col gap-6 rounded-xl border border-border-primary bg-surface-raised p-5 shadow-md outline-none max-h-[calc(100dvh-2rem)] overflow-y-auto max-sm:max-w-[calc(100vw-2rem)]",
|
|
70
|
+
motion.popupCenter,
|
|
71
|
+
className,
|
|
72
|
+
)}
|
|
73
|
+
{...props}
|
|
74
|
+
/>
|
|
75
|
+
)
|
|
76
|
+
}
|
|
54
77
|
|
|
55
78
|
export const DialogTitle = ({ className, ...props }: DialogTitleProps) => (
|
|
56
79
|
<BaseDialog.Title
|
package/src/drawer.tsx
CHANGED
|
@@ -69,7 +69,7 @@ export const DrawerPopup = ({ className, ...props }: DrawerPopupProps) => (
|
|
|
69
69
|
<BaseDrawer.Popup
|
|
70
70
|
className={cn(
|
|
71
71
|
"fixed z-50 flex flex-col border-border-primary bg-surface shadow-md outline-none",
|
|
72
|
-
"transition-[transform,opacity] duration-
|
|
72
|
+
"transition-[transform,opacity] duration-[var(--duration-lg)] ease-move motion-reduce:transition-none",
|
|
73
73
|
"data-swiping:duration-0",
|
|
74
74
|
// Right panel (swipeDirection="right")
|
|
75
75
|
"data-[swipe-direction=right]:top-0 data-[swipe-direction=right]:right-0 data-[swipe-direction=right]:h-full data-[swipe-direction=right]:w-full data-[swipe-direction=right]:max-w-sm data-[swipe-direction=right]:border-l",
|
package/src/empty.tsx
CHANGED
|
@@ -10,7 +10,7 @@ export type EmptyActionsProps = ComponentProps<"div">;
|
|
|
10
10
|
export const Empty = ({ className, ...props }: EmptyProps) => (
|
|
11
11
|
<div
|
|
12
12
|
className={cn(
|
|
13
|
-
"flex min-h-48 flex-col items-center justify-center
|
|
13
|
+
"flex min-h-48 flex-col items-center justify-center rounded-xl border border-dashed border-border-primary bg-surface p-8 text-center",
|
|
14
14
|
className,
|
|
15
15
|
)}
|
|
16
16
|
{...props}
|
|
@@ -20,7 +20,7 @@ export const Empty = ({ className, ...props }: EmptyProps) => (
|
|
|
20
20
|
export const EmptyIcon = ({ className, ...props }: EmptyIconProps) => (
|
|
21
21
|
<div
|
|
22
22
|
className={cn(
|
|
23
|
-
"flex size-10 items-center justify-center rounded-lg bg-background-tertiary text-fg-secondary [&_svg]:size-5",
|
|
23
|
+
"mb-4 flex size-10 items-center justify-center rounded-lg bg-background-tertiary text-fg-secondary [&_svg]:size-5",
|
|
24
24
|
className,
|
|
25
25
|
)}
|
|
26
26
|
{...props}
|
|
@@ -36,7 +36,7 @@ export const EmptyDescription = ({
|
|
|
36
36
|
...props
|
|
37
37
|
}: EmptyDescriptionProps) => (
|
|
38
38
|
<p
|
|
39
|
-
className={cn("max-w-sm text-sm text-fg-secondary", className)}
|
|
39
|
+
className={cn("mt-1 max-w-sm text-sm text-fg-secondary", className)}
|
|
40
40
|
{...props}
|
|
41
41
|
/>
|
|
42
42
|
);
|
|
@@ -44,7 +44,7 @@ export const EmptyDescription = ({
|
|
|
44
44
|
export const EmptyActions = ({ className, ...props }: EmptyActionsProps) => (
|
|
45
45
|
<div
|
|
46
46
|
className={cn(
|
|
47
|
-
"mt-
|
|
47
|
+
"mt-4 flex flex-wrap items-center justify-center gap-2",
|
|
48
48
|
className,
|
|
49
49
|
)}
|
|
50
50
|
{...props}
|
package/src/field.tsx
CHANGED
|
@@ -49,7 +49,7 @@ export const FieldError = ({ className, ...props }: FieldErrorProps) => (
|
|
|
49
49
|
export const FieldControl = ({ className, ...props }: FieldControlProps) => (
|
|
50
50
|
<BaseField.Control
|
|
51
51
|
className={cn(
|
|
52
|
-
"text-sm flex h-9 w-full cursor-text rounded-md border border-border-secondary bg-surface px-3 text-fg-primary inset-shadow-outline-top outline-none transition-[color,box-shadow] duration-
|
|
52
|
+
"text-sm flex h-9 w-full cursor-text rounded-md border border-border-secondary bg-surface px-3 text-fg-primary inset-shadow-outline-top outline-none transition-[color,box-shadow] duration-[var(--duration-sm)] ease-enter placeholder:text-fg-quaternary",
|
|
53
53
|
"focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-offset-1 focus-visible:ring-offset-background-primary focus-visible:ring-ring/20",
|
|
54
54
|
"data-invalid:border-destructive data-invalid:focus-visible:border-destructive data-invalid:focus-visible:ring-destructive/20",
|
|
55
55
|
"aria-invalid:border-destructive aria-invalid:focus-visible:border-destructive aria-invalid:focus-visible:ring-destructive/20",
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { Toggle as BaseToggle } from "@base-ui/react/toggle"
|
|
4
|
+
import { ToggleGroup as BaseToggleGroup } from "@base-ui/react/toggle-group"
|
|
5
|
+
import { cva, type VariantProps } from "class-variance-authority"
|
|
6
|
+
import { createContext, type ComponentProps, useContext } from "react"
|
|
7
|
+
import { cn } from "./lib/cn"
|
|
8
|
+
import { motion } from "./lib/motion"
|
|
9
|
+
|
|
10
|
+
const filterGroupVariants = cva("flex w-fit items-center", {
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
pill: "flex-wrap gap-1",
|
|
14
|
+
segmented: "gap-0.5 rounded-lg bg-background-tertiary p-0.5",
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
defaultVariants: {
|
|
18
|
+
variant: "pill",
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
const filterItemVariants = cva(
|
|
23
|
+
"group/filter-item inline-flex shrink-0 cursor-pointer items-center justify-center gap-1.5 whitespace-nowrap border border-transparent text-fg-tertiary outline-none hover:text-fg-primary focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-offset-1 focus-visible:ring-offset-background-primary focus-visible:ring-ring/20 data-disabled:cursor-not-allowed data-disabled:opacity-50 data-pressed:text-fg-primary",
|
|
24
|
+
{
|
|
25
|
+
variants: {
|
|
26
|
+
variant: {
|
|
27
|
+
pill: "rounded-full hover:bg-background-tertiary data-pressed:bg-background-tertiary",
|
|
28
|
+
segmented:
|
|
29
|
+
"rounded-md hover:bg-background-quaternary data-pressed:bg-surface-raised data-pressed:shadow-hairline",
|
|
30
|
+
},
|
|
31
|
+
size: {
|
|
32
|
+
sm: "text-xs",
|
|
33
|
+
md: "text-sm",
|
|
34
|
+
lg: "text-sm",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
compoundVariants: [
|
|
38
|
+
{ variant: "pill", size: "sm", class: "h-8 px-3" },
|
|
39
|
+
{ variant: "pill", size: "md", class: "h-9 px-4" },
|
|
40
|
+
{ variant: "pill", size: "lg", class: "h-10 px-5" },
|
|
41
|
+
{ variant: "segmented", size: "sm", class: "h-7 px-2.5" },
|
|
42
|
+
{ variant: "segmented", size: "md", class: "h-8 px-3" },
|
|
43
|
+
{ variant: "segmented", size: "lg", class: "h-9 px-3.5" },
|
|
44
|
+
],
|
|
45
|
+
defaultVariants: {
|
|
46
|
+
variant: "pill",
|
|
47
|
+
size: "md",
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
export type FilterGroupVariant = NonNullable<
|
|
53
|
+
VariantProps<typeof filterGroupVariants>["variant"]
|
|
54
|
+
>
|
|
55
|
+
export type FilterGroupSize = NonNullable<
|
|
56
|
+
VariantProps<typeof filterItemVariants>["size"]
|
|
57
|
+
>
|
|
58
|
+
|
|
59
|
+
type FilterGroupStyleContextValue = {
|
|
60
|
+
variant: FilterGroupVariant
|
|
61
|
+
size: FilterGroupSize
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const FilterGroupStyleContext = createContext<FilterGroupStyleContextValue>({
|
|
65
|
+
variant: "pill",
|
|
66
|
+
size: "md",
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
export type FilterGroupProps = ComponentProps<typeof BaseToggleGroup> &
|
|
70
|
+
VariantProps<typeof filterGroupVariants> & {
|
|
71
|
+
/** Whether pressing the active item can clear a single-select group. */
|
|
72
|
+
allowEmpty?: boolean
|
|
73
|
+
size?: FilterGroupSize
|
|
74
|
+
}
|
|
75
|
+
export type FilterItemProps = ComponentProps<typeof BaseToggle> &
|
|
76
|
+
VariantProps<typeof filterItemVariants>
|
|
77
|
+
export type FilterCountProps = ComponentProps<"span">
|
|
78
|
+
|
|
79
|
+
export const FilterGroup = ({
|
|
80
|
+
className,
|
|
81
|
+
variant = "pill",
|
|
82
|
+
size = "md",
|
|
83
|
+
allowEmpty = false,
|
|
84
|
+
multiple = false,
|
|
85
|
+
onValueChange,
|
|
86
|
+
...props
|
|
87
|
+
}: FilterGroupProps) => (
|
|
88
|
+
<FilterGroupStyleContext.Provider value={{ variant: variant ?? "pill", size }}>
|
|
89
|
+
<BaseToggleGroup
|
|
90
|
+
className={cn(filterGroupVariants({ variant }), className)}
|
|
91
|
+
multiple={multiple}
|
|
92
|
+
onValueChange={(value, eventDetails) => {
|
|
93
|
+
if (!multiple && !allowEmpty && value.length === 0) {
|
|
94
|
+
eventDetails.cancel()
|
|
95
|
+
return
|
|
96
|
+
}
|
|
97
|
+
onValueChange?.(value, eventDetails)
|
|
98
|
+
}}
|
|
99
|
+
{...props}
|
|
100
|
+
/>
|
|
101
|
+
</FilterGroupStyleContext.Provider>
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
export const FilterItem = ({
|
|
105
|
+
className,
|
|
106
|
+
variant,
|
|
107
|
+
size,
|
|
108
|
+
type = "button",
|
|
109
|
+
...props
|
|
110
|
+
}: FilterItemProps) => {
|
|
111
|
+
const styles = useContext(FilterGroupStyleContext)
|
|
112
|
+
|
|
113
|
+
return (
|
|
114
|
+
<BaseToggle
|
|
115
|
+
type={type}
|
|
116
|
+
className={cn(
|
|
117
|
+
filterItemVariants({
|
|
118
|
+
variant: variant ?? styles.variant,
|
|
119
|
+
size: size ?? styles.size,
|
|
120
|
+
}),
|
|
121
|
+
motion.colors,
|
|
122
|
+
className,
|
|
123
|
+
)}
|
|
124
|
+
{...props}
|
|
125
|
+
/>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export const FilterCount = ({ className, ...props }: FilterCountProps) => (
|
|
130
|
+
<span
|
|
131
|
+
className={cn(
|
|
132
|
+
"text-2xs-strong inline-flex min-w-4 items-center justify-center rounded-full bg-background-quaternary px-1 py-0.5 text-fg-secondary tabular-nums group-data-pressed/filter-item:bg-surface",
|
|
133
|
+
className,
|
|
134
|
+
)}
|
|
135
|
+
{...props}
|
|
136
|
+
/>
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
export { filterGroupVariants, filterItemVariants }
|
package/src/icons.tsx
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import type { CentralIconBaseProps } from "@central-icons-react/round-outlined-radius-2-stroke-2/CentralIconBase"
|
|
4
|
+
import { IconArrowDown as IconArrowDownBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconArrowDown"
|
|
4
5
|
import { IconBell as IconBellBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconBell"
|
|
6
|
+
import { IconCalendar1 as IconCalendar1Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconCalendar1"
|
|
5
7
|
import { IconChainLink1 as IconChainLink1Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconChainLink1"
|
|
6
8
|
import { IconCheckmark1 as IconCheckmark1Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconCheckmark1"
|
|
7
9
|
import { IconChevronBottom as IconChevronBottomBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconChevronBottom"
|
|
8
10
|
import { IconChevronDownSmall as IconChevronDownSmallBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconChevronDownSmall"
|
|
9
11
|
import { IconChevronRightSmall as IconChevronRightSmallBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconChevronRightSmall"
|
|
12
|
+
import { IconCircleCheck as IconCircleCheckBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconCircleCheck"
|
|
13
|
+
import { IconCircleInfo as IconCircleInfoBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconCircleInfo"
|
|
10
14
|
import { IconClipboard as IconClipboardBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconClipboard"
|
|
11
15
|
import { IconCrossSmall as IconCrossSmallBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconCrossSmall"
|
|
16
|
+
import { IconDotGrid1x3Horizontal as IconDotGrid1x3HorizontalBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconDotGrid1x3Horizontal"
|
|
17
|
+
import { IconExclamationCircle as IconExclamationCircleBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconExclamationCircle"
|
|
18
|
+
import { IconExclamationTriangle as IconExclamationTriangleBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconExclamationTriangle"
|
|
12
19
|
import { IconHome as IconHomeBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconHome"
|
|
20
|
+
import { IconFullScreen as IconFullScreenBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconFullScreen"
|
|
13
21
|
import { IconMagnifyingGlass as IconMagnifyingGlassBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconMagnifyingGlass"
|
|
14
22
|
import { IconMinusMedium as IconMinusBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconMinusMedium"
|
|
23
|
+
import { IconPause as IconPauseBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconPause"
|
|
15
24
|
import { IconMoon as IconMoonBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconMoon"
|
|
16
25
|
import { IconPeople as IconPeopleBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconPeople"
|
|
26
|
+
import { IconPlay as IconPlayBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconPlay"
|
|
17
27
|
import { IconPlusMedium as IconPlusBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconPlusMedium"
|
|
18
28
|
import { IconSettingsGear1 as IconSettingsGear1Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconSettingsGear1"
|
|
19
29
|
import { IconSquareBehindSquare6 as IconSquareBehindSquare6Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconSquareBehindSquare6"
|
|
30
|
+
import { IconStar as IconStarBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconStar"
|
|
20
31
|
import { IconSun as IconSunBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconSun"
|
|
32
|
+
import { IconVolumeFull as IconVolumeFullBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconVolumeFull"
|
|
33
|
+
import { IconVolumeOff as IconVolumeOffBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconVolumeOff"
|
|
21
34
|
import { IconX as IconXBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconX"
|
|
22
35
|
import type { ComponentType } from "react"
|
|
23
36
|
|
|
@@ -42,7 +55,9 @@ export const withCentralIconDefaults = (
|
|
|
42
55
|
return CentralIcon
|
|
43
56
|
}
|
|
44
57
|
|
|
58
|
+
export const IconArrowDown = withCentralIconDefaults(IconArrowDownBase)
|
|
45
59
|
export const IconBell = withCentralIconDefaults(IconBellBase)
|
|
60
|
+
export const IconCalendar1 = withCentralIconDefaults(IconCalendar1Base)
|
|
46
61
|
export const IconChainLink1 = withCentralIconDefaults(IconChainLink1Base)
|
|
47
62
|
export const IconCheckmark1 = withCentralIconDefaults(IconCheckmark1Base)
|
|
48
63
|
export const IconChevronBottom = withCentralIconDefaults(IconChevronBottomBase)
|
|
@@ -52,25 +67,43 @@ export const IconChevronDownSmall = withCentralIconDefaults(
|
|
|
52
67
|
export const IconChevronRightSmall = withCentralIconDefaults(
|
|
53
68
|
IconChevronRightSmallBase,
|
|
54
69
|
)
|
|
70
|
+
export const IconCircleCheck = withCentralIconDefaults(IconCircleCheckBase)
|
|
71
|
+
export const IconCircleInfo = withCentralIconDefaults(IconCircleInfoBase)
|
|
55
72
|
export const IconClipboard = withCentralIconDefaults(IconClipboardBase)
|
|
56
73
|
export const IconCrossSmall = withCentralIconDefaults(IconCrossSmallBase)
|
|
74
|
+
export const IconDotGrid1x3Horizontal = withCentralIconDefaults(
|
|
75
|
+
IconDotGrid1x3HorizontalBase,
|
|
76
|
+
)
|
|
77
|
+
export const IconExclamationCircle = withCentralIconDefaults(
|
|
78
|
+
IconExclamationCircleBase,
|
|
79
|
+
)
|
|
80
|
+
export const IconExclamationTriangle = withCentralIconDefaults(
|
|
81
|
+
IconExclamationTriangleBase,
|
|
82
|
+
)
|
|
83
|
+
export const IconFullScreen = withCentralIconDefaults(IconFullScreenBase)
|
|
57
84
|
export const IconHome = withCentralIconDefaults(IconHomeBase)
|
|
58
85
|
export const IconMagnifyingGlass = withCentralIconDefaults(
|
|
59
86
|
IconMagnifyingGlassBase,
|
|
60
87
|
)
|
|
61
88
|
export const IconMinus = withCentralIconDefaults(IconMinusBase)
|
|
89
|
+
export const IconPause = withCentralIconDefaults(IconPauseBase)
|
|
62
90
|
export const IconMoon = withCentralIconDefaults(IconMoonBase)
|
|
63
91
|
export const IconPeople = withCentralIconDefaults(IconPeopleBase)
|
|
92
|
+
export const IconPlay = withCentralIconDefaults(IconPlayBase)
|
|
64
93
|
export const IconPlus = withCentralIconDefaults(IconPlusBase)
|
|
65
94
|
export const IconSettingsGear1 = withCentralIconDefaults(IconSettingsGear1Base)
|
|
66
95
|
export const IconSquareBehindSquare6 = withCentralIconDefaults(
|
|
67
96
|
IconSquareBehindSquare6Base,
|
|
68
97
|
)
|
|
98
|
+
export const IconStar = withCentralIconDefaults(IconStarBase)
|
|
69
99
|
export const IconSun = withCentralIconDefaults(IconSunBase)
|
|
100
|
+
export const IconVolumeFull = withCentralIconDefaults(IconVolumeFullBase)
|
|
101
|
+
export const IconVolumeOff = withCentralIconDefaults(IconVolumeOffBase)
|
|
70
102
|
export const IconX = withCentralIconDefaults(IconXBase)
|
|
71
103
|
|
|
72
104
|
export const iconGallery = [
|
|
73
105
|
{ name: "IconHome", Icon: IconHome },
|
|
106
|
+
{ name: "IconCalendar1", Icon: IconCalendar1 },
|
|
74
107
|
{ name: "IconMagnifyingGlass", Icon: IconMagnifyingGlass },
|
|
75
108
|
{ name: "IconSettingsGear1", Icon: IconSettingsGear1 },
|
|
76
109
|
{ name: "IconBell", Icon: IconBell },
|
|
@@ -85,7 +118,13 @@ export const iconGallery = [
|
|
|
85
118
|
{ name: "IconChevronBottom", Icon: IconChevronBottom },
|
|
86
119
|
{ name: "IconChevronDownSmall", Icon: IconChevronDownSmall },
|
|
87
120
|
{ name: "IconChevronRightSmall", Icon: IconChevronRightSmall },
|
|
121
|
+
{ name: "IconCircleCheck", Icon: IconCircleCheck },
|
|
122
|
+
{ name: "IconCircleInfo", Icon: IconCircleInfo },
|
|
88
123
|
{ name: "IconClipboard", Icon: IconClipboard },
|
|
124
|
+
{ name: "IconDotGrid1x3Horizontal", Icon: IconDotGrid1x3Horizontal },
|
|
89
125
|
{ name: "IconSquareBehindSquare6", Icon: IconSquareBehindSquare6 },
|
|
90
126
|
{ name: "IconChainLink1", Icon: IconChainLink1 },
|
|
127
|
+
{ name: "IconExclamationCircle", Icon: IconExclamationCircle },
|
|
128
|
+
{ name: "IconExclamationTriangle", Icon: IconExclamationTriangle },
|
|
129
|
+
{ name: "IconStar", Icon: IconStar },
|
|
91
130
|
] as const
|