@epilot/spark-ui 0.27.1 → 0.28.1
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/components/accordion.cjs +1 -1
- package/dist/components/accordion.cjs.map +1 -1
- package/dist/components/accordion.js +1 -1
- package/dist/components/accordion.js.map +1 -1
- package/dist/components/attachment.cjs +2 -2
- package/dist/components/attachment.cjs.map +1 -1
- package/dist/components/attachment.d.cts +1 -1
- package/dist/components/attachment.d.ts +1 -1
- package/dist/components/attachment.js +2 -2
- package/dist/components/attachment.js.map +1 -1
- package/dist/components/autocomplete.cjs +3 -5
- package/dist/components/autocomplete.cjs.map +1 -1
- package/dist/components/autocomplete.js +3 -5
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.d.cts +1 -1
- package/dist/components/avatar.d.ts +1 -1
- package/dist/components/badge.d.cts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/box.d.cts +1 -1
- package/dist/components/box.d.ts +1 -1
- package/dist/components/breadcrumbs.cjs +4 -1
- package/dist/components/breadcrumbs.cjs.map +1 -1
- package/dist/components/breadcrumbs.js +4 -1
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/bubble.cjs +1 -1
- package/dist/components/bubble.cjs.map +1 -1
- package/dist/components/bubble.d.cts +1 -1
- package/dist/components/bubble.d.ts +1 -1
- package/dist/components/bubble.js +1 -1
- package/dist/components/bubble.js.map +1 -1
- package/dist/components/button-group.cjs +2 -2
- package/dist/components/button-group.cjs.map +1 -1
- package/dist/components/button-group.d.cts +1 -1
- package/dist/components/button-group.d.ts +1 -1
- package/dist/components/button-group.js +2 -2
- package/dist/components/button-group.js.map +1 -1
- package/dist/components/button.cjs +40 -13
- package/dist/components/button.cjs.map +1 -1
- package/dist/components/button.d.cts +13 -14
- package/dist/components/button.d.ts +13 -14
- package/dist/components/button.js +41 -14
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar.cjs +3 -3
- package/dist/components/calendar.cjs.map +1 -1
- package/dist/components/calendar.js +3 -3
- package/dist/components/calendar.js.map +1 -1
- package/dist/components/card.cjs.map +1 -1
- package/dist/components/card.d.cts +2 -2
- package/dist/components/card.d.ts +2 -2
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox-group.d.cts +1 -1
- package/dist/components/checkbox-group.d.ts +1 -1
- package/dist/components/checkbox.cjs +2 -1
- package/dist/components/checkbox.cjs.map +1 -1
- package/dist/components/checkbox.d.cts +1 -1
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/checkbox.js +2 -1
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/combobox.cjs +337 -0
- package/dist/components/combobox.cjs.map +1 -0
- package/dist/components/combobox.d.cts +132 -0
- package/dist/components/combobox.d.ts +132 -0
- package/dist/components/combobox.js +312 -0
- package/dist/components/combobox.js.map +1 -0
- package/dist/components/day-of-week-picker.cjs +4 -2
- package/dist/components/day-of-week-picker.cjs.map +1 -1
- package/dist/components/day-of-week-picker.js +4 -2
- package/dist/components/day-of-week-picker.js.map +1 -1
- package/dist/components/empty-state.d.cts +1 -1
- package/dist/components/empty-state.d.ts +1 -1
- package/dist/components/entity-card.cjs +2 -1
- package/dist/components/entity-card.cjs.map +1 -1
- package/dist/components/entity-card.js +2 -1
- package/dist/components/entity-card.js.map +1 -1
- package/dist/components/field.cjs +4 -4
- package/dist/components/field.cjs.map +1 -1
- package/dist/components/field.d.cts +1 -1
- package/dist/components/field.d.ts +1 -1
- package/dist/components/field.js +4 -4
- package/dist/components/field.js.map +1 -1
- package/dist/components/info-block.d.cts +1 -1
- package/dist/components/info-block.d.ts +1 -1
- package/dist/components/input-group.cjs +11 -11
- package/dist/components/input-group.cjs.map +1 -1
- package/dist/components/input-group.js +11 -11
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input-otp.cjs +3 -2
- package/dist/components/input-otp.cjs.map +1 -1
- package/dist/components/input-otp.js +4 -3
- package/dist/components/input-otp.js.map +1 -1
- package/dist/components/input.cjs +4 -4
- package/dist/components/input.cjs.map +1 -1
- package/dist/components/input.d.cts +1 -1
- package/dist/components/input.d.ts +1 -1
- package/dist/components/input.js +5 -5
- package/dist/components/input.js.map +1 -1
- package/dist/components/list.cjs +3 -3
- package/dist/components/list.cjs.map +1 -1
- package/dist/components/list.d.cts +2 -2
- package/dist/components/list.d.ts +2 -2
- package/dist/components/list.js +3 -3
- package/dist/components/list.js.map +1 -1
- package/dist/components/marker.cjs +1 -1
- package/dist/components/marker.cjs.map +1 -1
- package/dist/components/marker.js +1 -1
- package/dist/components/marker.js.map +1 -1
- package/dist/components/message-scroller.cjs +2 -2
- package/dist/components/message-scroller.cjs.map +1 -1
- package/dist/components/message-scroller.js +2 -2
- package/dist/components/message-scroller.js.map +1 -1
- package/dist/components/pill.cjs +1 -1
- package/dist/components/pill.cjs.map +1 -1
- package/dist/components/pill.d.cts +1 -1
- package/dist/components/pill.d.ts +1 -1
- package/dist/components/pill.js +1 -1
- package/dist/components/pill.js.map +1 -1
- package/dist/components/radio-card-group.cjs +2 -1
- package/dist/components/radio-card-group.cjs.map +1 -1
- package/dist/components/radio-card-group.js +2 -1
- package/dist/components/radio-card-group.js.map +1 -1
- package/dist/components/radio.cjs +1 -1
- package/dist/components/radio.cjs.map +1 -1
- package/dist/components/radio.d.cts +1 -1
- package/dist/components/radio.d.ts +1 -1
- package/dist/components/radio.js +1 -1
- package/dist/components/radio.js.map +1 -1
- package/dist/components/rating.cjs +1 -1
- package/dist/components/rating.cjs.map +1 -1
- package/dist/components/rating.js +1 -1
- package/dist/components/rating.js.map +1 -1
- package/dist/components/schedule-list.cjs +6 -3
- package/dist/components/schedule-list.cjs.map +1 -1
- package/dist/components/schedule-list.js +6 -3
- package/dist/components/schedule-list.js.map +1 -1
- package/dist/components/scroll-area.cjs +1 -1
- package/dist/components/scroll-area.cjs.map +1 -1
- package/dist/components/scroll-area.js +1 -1
- package/dist/components/scroll-area.js.map +1 -1
- package/dist/components/segmented-control.cjs +1 -1
- package/dist/components/segmented-control.cjs.map +1 -1
- package/dist/components/segmented-control.d.cts +1 -1
- package/dist/components/segmented-control.d.ts +1 -1
- package/dist/components/segmented-control.js +1 -1
- package/dist/components/segmented-control.js.map +1 -1
- package/dist/components/select.cjs +5 -4
- package/dist/components/select.cjs.map +1 -1
- package/dist/components/select.d.cts +1 -1
- package/dist/components/select.d.ts +1 -1
- package/dist/components/select.js +5 -4
- package/dist/components/select.js.map +1 -1
- package/dist/components/series-legend.cjs +2 -1
- package/dist/components/series-legend.cjs.map +1 -1
- package/dist/components/series-legend.js +2 -1
- package/dist/components/series-legend.js.map +1 -1
- package/dist/components/slider.cjs +3 -2
- package/dist/components/slider.cjs.map +1 -1
- package/dist/components/slider.js +3 -2
- package/dist/components/slider.js.map +1 -1
- package/dist/components/stepper.cjs +3 -1
- package/dist/components/stepper.cjs.map +1 -1
- package/dist/components/stepper.js +3 -1
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch-group.d.cts +1 -1
- package/dist/components/switch-group.d.ts +1 -1
- package/dist/components/switch.cjs +1 -1
- package/dist/components/switch.cjs.map +1 -1
- package/dist/components/switch.d.cts +1 -1
- package/dist/components/switch.d.ts +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.cjs +3 -3
- package/dist/components/table.cjs.map +1 -1
- package/dist/components/table.js +3 -3
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.cjs +3 -3
- package/dist/components/tabs.cjs.map +1 -1
- package/dist/components/tabs.js +3 -3
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/textarea.cjs +4 -4
- package/dist/components/textarea.cjs.map +1 -1
- package/dist/components/textarea.d.cts +1 -1
- package/dist/components/textarea.d.ts +1 -1
- package/dist/components/textarea.js +5 -5
- package/dist/components/textarea.js.map +1 -1
- package/dist/components/theme.cjs +100 -15
- package/dist/components/theme.cjs.map +1 -1
- package/dist/components/theme.d.cts +4 -3
- package/dist/components/theme.d.ts +4 -3
- package/dist/components/theme.js +100 -16
- package/dist/components/theme.js.map +1 -1
- package/dist/components/time-picker.cjs +2 -1
- package/dist/components/time-picker.cjs.map +1 -1
- package/dist/components/time-picker.js +2 -1
- package/dist/components/time-picker.js.map +1 -1
- package/dist/components/toggle-group.d.cts +1 -1
- package/dist/components/toggle-group.d.ts +1 -1
- package/dist/components/toggle.d.cts +1 -1
- package/dist/components/toggle.d.ts +1 -1
- package/dist/components/tooltip.cjs +1 -1
- package/dist/components/tooltip.cjs.map +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/trace.cjs +2 -2
- package/dist/components/trace.cjs.map +1 -1
- package/dist/components/trace.js +2 -2
- package/dist/components/trace.js.map +1 -1
- package/dist/lib/accent-theme.d.cts +1 -1
- package/dist/lib/accent-theme.d.ts +1 -1
- package/dist/lib/container-chrome.cjs +2 -3
- package/dist/lib/container-chrome.cjs.map +1 -1
- package/dist/lib/container-chrome.d.cts +1 -1
- package/dist/lib/container-chrome.d.ts +1 -1
- package/dist/lib/container-chrome.js +2 -3
- package/dist/lib/container-chrome.js.map +1 -1
- package/dist/lib/input-box-variants.cjs +11 -9
- package/dist/lib/input-box-variants.cjs.map +1 -1
- package/dist/lib/input-box-variants.d.cts +4 -3
- package/dist/lib/input-box-variants.d.ts +4 -3
- package/dist/lib/input-box-variants.js +11 -10
- package/dist/lib/input-box-variants.js.map +1 -1
- package/dist/lib/selection-list.d.cts +1 -1
- package/dist/lib/selection-list.d.ts +1 -1
- package/dist/lib/theme-types.cjs.map +1 -1
- package/dist/lib/theme-types.d.cts +2 -2
- package/dist/lib/theme-types.d.ts +2 -2
- package/dist/lib/theme-types.js.map +1 -1
- package/dist/lib/toggle-group-context.d.cts +1 -1
- package/dist/lib/toggle-group-context.d.ts +1 -1
- package/dist/styles/spark-default.css +98 -0
- package/dist/styles/theme.css +12 -0
- package/dist/{theme-types-CKZzOmSa.d.ts → theme-types-Dlge0s3s.d.cts} +12 -6
- package/dist/{theme-types-CKZzOmSa.d.cts → theme-types-Dlge0s3s.d.ts} +12 -6
- package/package.json +1 -1
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { d as SparkInputStyle } from "../theme-types-Dlge0s3s.js";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
|
|
6
|
+
|
|
7
|
+
//#region src/components/combobox.d.ts
|
|
8
|
+
declare const Combobox: typeof Combobox$1.Root;
|
|
9
|
+
declare const ComboboxValue: typeof Combobox$1.Value;
|
|
10
|
+
declare const ComboboxCollection: typeof Combobox$1.Collection;
|
|
11
|
+
declare const useComboboxFilter: typeof Combobox$1.useFilter;
|
|
12
|
+
declare const useComboboxFilteredItems: typeof Combobox$1.useFilteredItems;
|
|
13
|
+
type ComboboxSelectedGroup<Item> = {
|
|
14
|
+
value: 'selected' | 'items';
|
|
15
|
+
label: string;
|
|
16
|
+
items: Item[]; /** Options left unpicked before the search filters them; ComboboxEmpty reads it. */
|
|
17
|
+
optionCount: number;
|
|
18
|
+
};
|
|
19
|
+
/** Splits `items` into a group with every pick, never filtered, and a group with the rest. */
|
|
20
|
+
declare function useComboboxSelectedGroups<Item>(items: readonly Item[], value: readonly Item[], {
|
|
21
|
+
selected,
|
|
22
|
+
items: itemsLabel,
|
|
23
|
+
isItemEqualToValue
|
|
24
|
+
}: {
|
|
25
|
+
selected: string;
|
|
26
|
+
items: string;
|
|
27
|
+
isItemEqualToValue?: (item: Item, value: Item) => boolean;
|
|
28
|
+
}): {
|
|
29
|
+
items: ComboboxSelectedGroup<Item>[];
|
|
30
|
+
filter: (item: Item, query: string, itemToString?: (item: Item) => string) => boolean;
|
|
31
|
+
isItemEqualToValue: (item: Item, value: Item) => boolean;
|
|
32
|
+
};
|
|
33
|
+
declare function ComboboxTriggerGroup({
|
|
34
|
+
className,
|
|
35
|
+
...props
|
|
36
|
+
}: Omit<React$1.ComponentProps<typeof Combobox$1.InputGroup>, 'render'>): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
declare function ComboboxTrigger({
|
|
38
|
+
className,
|
|
39
|
+
children,
|
|
40
|
+
variant,
|
|
41
|
+
id: idProp,
|
|
42
|
+
'aria-describedby': ariaDescribedByProp,
|
|
43
|
+
...props
|
|
44
|
+
}: React$1.ComponentProps<typeof Combobox$1.Trigger> & {
|
|
45
|
+
variant?: SparkInputStyle;
|
|
46
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
47
|
+
type ComboboxChipsProps<Item> = Omit<React$1.ComponentProps<'div'>, 'children'> & {
|
|
48
|
+
/** Renders one chip per selected value, in pick order. */children: (item: Item, index: number) => React$1.ReactNode; /** Renders at most this many chips, then a "+N" pill for the rest. */
|
|
49
|
+
max?: number;
|
|
50
|
+
overflowLabel?: (count: number) => string; /** Shown while nothing is selected: text, or a `ComboboxAddChip`. */
|
|
51
|
+
placeholder?: React$1.ReactNode;
|
|
52
|
+
};
|
|
53
|
+
declare function ComboboxChips<Item>({
|
|
54
|
+
className,
|
|
55
|
+
children,
|
|
56
|
+
max,
|
|
57
|
+
overflowLabel,
|
|
58
|
+
placeholder,
|
|
59
|
+
...props
|
|
60
|
+
}: ComboboxChipsProps<Item>): import("react/jsx-runtime").JSX.Element;
|
|
61
|
+
declare function ComboboxChip({
|
|
62
|
+
className,
|
|
63
|
+
children,
|
|
64
|
+
...props
|
|
65
|
+
}: Omit<React$1.HTMLAttributes<HTMLSpanElement>, 'onClick' | 'color'>): import("react/jsx-runtime").JSX.Element;
|
|
66
|
+
declare function ComboboxAddChip({
|
|
67
|
+
className,
|
|
68
|
+
children,
|
|
69
|
+
...props
|
|
70
|
+
}: Omit<React$1.HTMLAttributes<HTMLSpanElement>, 'onClick' | 'color'>): import("react/jsx-runtime").JSX.Element;
|
|
71
|
+
declare function ComboboxClear({
|
|
72
|
+
className,
|
|
73
|
+
children,
|
|
74
|
+
onClick,
|
|
75
|
+
...props
|
|
76
|
+
}: React$1.ComponentProps<typeof Combobox$1.Clear>): import("react/jsx-runtime").JSX.Element;
|
|
77
|
+
type ComboboxContentProps = React$1.ComponentProps<typeof Combobox$1.Popup> & Pick<Combobox$1.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'> & Pick<Combobox$1.Portal.Props, 'container'>;
|
|
78
|
+
declare function ComboboxContent({
|
|
79
|
+
className,
|
|
80
|
+
children,
|
|
81
|
+
align,
|
|
82
|
+
alignOffset,
|
|
83
|
+
side,
|
|
84
|
+
sideOffset,
|
|
85
|
+
container,
|
|
86
|
+
...props
|
|
87
|
+
}: ComboboxContentProps): import("react/jsx-runtime").JSX.Element;
|
|
88
|
+
declare function ComboboxInput({
|
|
89
|
+
className,
|
|
90
|
+
onKeyDown,
|
|
91
|
+
...props
|
|
92
|
+
}: React$1.ComponentProps<typeof Combobox$1.Input>): import("react/jsx-runtime").JSX.Element;
|
|
93
|
+
declare function ComboboxClose({
|
|
94
|
+
className,
|
|
95
|
+
onClick,
|
|
96
|
+
...props
|
|
97
|
+
}: React$1.ComponentProps<'button'>): import("react/jsx-runtime").JSX.Element;
|
|
98
|
+
declare function ComboboxList({
|
|
99
|
+
className,
|
|
100
|
+
...props
|
|
101
|
+
}: React$1.ComponentProps<typeof Combobox$1.List>): import("react/jsx-runtime").JSX.Element;
|
|
102
|
+
declare const ComboboxItem: React$1.ForwardRefExoticComponent<Omit<import("@base-ui/react").ComboboxItemProps, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
|
|
103
|
+
declare function ComboboxItemIndicator({
|
|
104
|
+
className,
|
|
105
|
+
children,
|
|
106
|
+
keepMounted,
|
|
107
|
+
...props
|
|
108
|
+
}: React$1.ComponentProps<typeof Combobox$1.ItemIndicator>): import("react/jsx-runtime").JSX.Element;
|
|
109
|
+
declare function ComboboxEmpty({
|
|
110
|
+
className,
|
|
111
|
+
children,
|
|
112
|
+
...props
|
|
113
|
+
}: React$1.ComponentProps<typeof Combobox$1.Empty>): import("react/jsx-runtime").JSX.Element;
|
|
114
|
+
declare function ComboboxStatus({
|
|
115
|
+
className,
|
|
116
|
+
...props
|
|
117
|
+
}: React$1.ComponentProps<typeof Combobox$1.Status>): import("react/jsx-runtime").JSX.Element;
|
|
118
|
+
declare function ComboboxGroup({
|
|
119
|
+
className,
|
|
120
|
+
...props
|
|
121
|
+
}: React$1.ComponentProps<typeof Combobox$1.Group>): import("react/jsx-runtime").JSX.Element;
|
|
122
|
+
declare function ComboboxGroupLabel({
|
|
123
|
+
className,
|
|
124
|
+
...props
|
|
125
|
+
}: React$1.ComponentProps<typeof Combobox$1.GroupLabel>): import("react/jsx-runtime").JSX.Element;
|
|
126
|
+
declare function ComboboxSeparator({
|
|
127
|
+
className,
|
|
128
|
+
...props
|
|
129
|
+
}: React$1.ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element;
|
|
130
|
+
//#endregion
|
|
131
|
+
export { Combobox, ComboboxAddChip, ComboboxChip, ComboboxChips, ComboboxClear, ComboboxClose, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxItemIndicator, ComboboxList, type ComboboxSelectedGroup, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxTriggerGroup, ComboboxValue, useComboboxFilter, useComboboxFilteredItems, useComboboxSelectedGroups };
|
|
132
|
+
//# sourceMappingURL=combobox.d.ts.map
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn } from "../utils/cn.js";
|
|
4
|
+
import { PortalTheme } from "./theme.js";
|
|
5
|
+
import { buttonVariants } from "./button.js";
|
|
6
|
+
import { useFieldControl } from "./field.js";
|
|
7
|
+
import { boxChrome } from "../lib/input-box-variants.js";
|
|
8
|
+
import { Pill } from "./pill.js";
|
|
9
|
+
import * as React$1 from "react";
|
|
10
|
+
import { Add, Check, Close, KeyboardArrowDown, Search } from "@epilot/spark-icons";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { Combobox as Combobox$1 } from "@base-ui/react/combobox";
|
|
13
|
+
//#region src/components/combobox.tsx
|
|
14
|
+
const Combobox = Combobox$1.Root;
|
|
15
|
+
const ComboboxValue = Combobox$1.Value;
|
|
16
|
+
const ComboboxCollection = Combobox$1.Collection;
|
|
17
|
+
const useComboboxFilter = Combobox$1.useFilter;
|
|
18
|
+
const useComboboxFilteredItems = Combobox$1.useFilteredItems;
|
|
19
|
+
/** Splits `items` into a group with every pick, never filtered, and a group with the rest. */
|
|
20
|
+
function useComboboxSelectedGroups(items, value, { selected, items: itemsLabel, isItemEqualToValue = Object.is }) {
|
|
21
|
+
const { contains } = useComboboxFilter();
|
|
22
|
+
const isPicked = (item) => value.some((picked) => isItemEqualToValue(item, picked));
|
|
23
|
+
const options = items.filter((item) => !isPicked(item));
|
|
24
|
+
const groups = [{
|
|
25
|
+
value: "selected",
|
|
26
|
+
label: selected,
|
|
27
|
+
items: [...value],
|
|
28
|
+
optionCount: options.length
|
|
29
|
+
}, {
|
|
30
|
+
value: "items",
|
|
31
|
+
label: itemsLabel,
|
|
32
|
+
items: options,
|
|
33
|
+
optionCount: options.length
|
|
34
|
+
}];
|
|
35
|
+
const filter = (item, query, itemToString) => isPicked(item) || contains(item, query, itemToString);
|
|
36
|
+
return {
|
|
37
|
+
items: groups,
|
|
38
|
+
filter,
|
|
39
|
+
isItemEqualToValue
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const CLEAR_BUTTON = "relative inline-flex size-6 min-h-[24px] min-w-[24px] shrink-0 items-center justify-center rounded-sm p-0 text-gray-light outline-hidden transition-colors hover:text-gray focus-visible:ring-2 focus-visible:ring-(--color-focus-root)! focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 before:absolute before:top-1/2 before:left-1/2 before:size-10 before:-translate-x-1/2 before:-translate-y-1/2 before:content-['']";
|
|
43
|
+
const ComboboxGroupStateContext = React$1.createContext({
|
|
44
|
+
disabled: false,
|
|
45
|
+
readOnly: false
|
|
46
|
+
});
|
|
47
|
+
function ComboboxTriggerGroup({ className, ...props }) {
|
|
48
|
+
return /* @__PURE__ */ jsx(Combobox$1.InputGroup, {
|
|
49
|
+
"data-slot": "combobox-trigger-group",
|
|
50
|
+
className: cn("relative flex w-full items-center has-[[data-slot=combobox-clear]:not([hidden])]:[&_[data-slot=combobox-trigger]]:pr-15", className),
|
|
51
|
+
...props,
|
|
52
|
+
render: ({ role: _group, ...groupProps }, state) => /* @__PURE__ */ jsx(ComboboxGroupStateContext.Provider, {
|
|
53
|
+
value: {
|
|
54
|
+
disabled: state.disabled,
|
|
55
|
+
readOnly: state.readOnly
|
|
56
|
+
},
|
|
57
|
+
children: /* @__PURE__ */ jsx("div", { ...groupProps })
|
|
58
|
+
})
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function ComboboxTrigger({ className, children, variant, id: idProp, "aria-describedby": ariaDescribedByProp, ...props }) {
|
|
62
|
+
const { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor } = useFieldControl({
|
|
63
|
+
id: idProp,
|
|
64
|
+
ariaDescribedBy: ariaDescribedByProp,
|
|
65
|
+
variant
|
|
66
|
+
});
|
|
67
|
+
const inset = !variant && field?.labelPosition === "inset";
|
|
68
|
+
const isGhost = inputStyle === "ghost" || inset;
|
|
69
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Trigger, {
|
|
70
|
+
"data-slot": "combobox-trigger",
|
|
71
|
+
id,
|
|
72
|
+
className: cn("relative flex w-full min-w-0 items-center gap-1.5 rounded-md px-3 text-left text-base text-gray transition-colors select-none disabled:cursor-not-allowed disabled:text-gray-disabled motion-reduce:transition-none", !isGhost && "h-11 min-h-[2.75rem]", boxChrome[isGhost ? "ghost" : inputStyle][inputColor], "pr-8", inset && "focus-visible:outline-hidden", className),
|
|
73
|
+
"aria-invalid": ariaInvalid,
|
|
74
|
+
...props,
|
|
75
|
+
"aria-describedby": ariaDescribedBy,
|
|
76
|
+
children: [children, /* @__PURE__ */ jsx(KeyboardArrowDown, {
|
|
77
|
+
"aria-hidden": true,
|
|
78
|
+
"data-slot": "combobox-chevron",
|
|
79
|
+
className: cn("pointer-events-none absolute shrink-0 text-gray-light transition-transform [--spark-icon-size:14px] in-data-popup-open:rotate-180 motion-reduce:transition-none", isGhost ? "right-1" : "right-3")
|
|
80
|
+
})]
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
function ComboboxChips({ className, children, max, overflowLabel = (count) => `${count} more selected`, placeholder, ...props }) {
|
|
84
|
+
return /* @__PURE__ */ jsx("div", {
|
|
85
|
+
"data-slot": "combobox-chips",
|
|
86
|
+
className: cn("flex min-w-0 flex-1 flex-nowrap items-center gap-1 overflow-hidden", className),
|
|
87
|
+
...props,
|
|
88
|
+
children: /* @__PURE__ */ jsx(Combobox$1.Value, { children: (value) => {
|
|
89
|
+
if (value.length === 0) return typeof placeholder === "string" ? /* @__PURE__ */ jsx("span", {
|
|
90
|
+
className: "truncate text-gray-placeholder in-data-disabled:text-gray-disabled",
|
|
91
|
+
children: placeholder
|
|
92
|
+
}) : placeholder;
|
|
93
|
+
const shown = max === void 0 ? value : value.slice(0, max);
|
|
94
|
+
const hidden = value.length - shown.length;
|
|
95
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [shown.map(children), hidden > 0 && /* @__PURE__ */ jsxs(Pill, {
|
|
96
|
+
"data-slot": "combobox-chips-overflow",
|
|
97
|
+
className: "shrink-0 in-data-disabled:opacity-50",
|
|
98
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
99
|
+
"aria-hidden": "true",
|
|
100
|
+
children: ["+", hidden]
|
|
101
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
102
|
+
className: "sr-only",
|
|
103
|
+
children: overflowLabel(hidden)
|
|
104
|
+
})]
|
|
105
|
+
})] });
|
|
106
|
+
} })
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function ComboboxChip({ className, children, ...props }) {
|
|
110
|
+
return /* @__PURE__ */ jsx(Pill, {
|
|
111
|
+
"data-slot": "combobox-chip",
|
|
112
|
+
className: cn("min-w-0 shrink in-data-disabled:opacity-50", className),
|
|
113
|
+
...props,
|
|
114
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
115
|
+
className: "truncate",
|
|
116
|
+
children
|
|
117
|
+
})
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function ComboboxAddChip({ className, children, ...props }) {
|
|
121
|
+
return /* @__PURE__ */ jsxs(Pill, {
|
|
122
|
+
"data-slot": "combobox-add-chip",
|
|
123
|
+
className: cn("shrink-0 border border-dashed border-spark-a6 bg-transparent pl-1.5 text-spark-a11 in-data-disabled:opacity-50", className),
|
|
124
|
+
...props,
|
|
125
|
+
children: [/* @__PURE__ */ jsx(Add, {
|
|
126
|
+
"aria-hidden": true,
|
|
127
|
+
className: "[--spark-icon-size:14px]"
|
|
128
|
+
}), children]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function ComboboxClear({ className, children, onClick, ...props }) {
|
|
132
|
+
const group = React$1.useContext(ComboboxGroupStateContext);
|
|
133
|
+
return /* @__PURE__ */ jsx(Combobox$1.Clear, {
|
|
134
|
+
"data-slot": "combobox-clear",
|
|
135
|
+
render: (buttonProps, state) => /* @__PURE__ */ jsx("button", {
|
|
136
|
+
...buttonProps,
|
|
137
|
+
hidden: state.disabled || buttonProps.hidden
|
|
138
|
+
}),
|
|
139
|
+
className: cn(CLEAR_BUTTON, "absolute right-8", className),
|
|
140
|
+
onClick: (event) => {
|
|
141
|
+
onClick?.(event);
|
|
142
|
+
event.currentTarget.closest("[data-slot=\"combobox-trigger-group\"]")?.querySelector("[data-slot=\"combobox-trigger\"]")?.focus();
|
|
143
|
+
},
|
|
144
|
+
...props,
|
|
145
|
+
hidden: group.disabled || group.readOnly || props.hidden,
|
|
146
|
+
children: children ?? /* @__PURE__ */ jsx(Close, {
|
|
147
|
+
"aria-hidden": true,
|
|
148
|
+
className: "[--spark-icon-size:14px]"
|
|
149
|
+
})
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
const ComboboxToggleContext = React$1.createContext(null);
|
|
153
|
+
function ComboboxContent({ className, children, align = "start", alignOffset, side, sideOffset = 4, container, ...props }) {
|
|
154
|
+
const [tracker] = React$1.useState(() => ({
|
|
155
|
+
pending: null,
|
|
156
|
+
values: /* @__PURE__ */ new WeakMap()
|
|
157
|
+
}));
|
|
158
|
+
return /* @__PURE__ */ jsx(ComboboxToggleContext.Provider, {
|
|
159
|
+
value: tracker,
|
|
160
|
+
children: /* @__PURE__ */ jsx(Combobox$1.Portal, {
|
|
161
|
+
container,
|
|
162
|
+
children: /* @__PURE__ */ jsxs(PortalTheme, { children: [/* @__PURE__ */ jsx(Combobox$1.Backdrop, {
|
|
163
|
+
"data-slot": "combobox-backdrop",
|
|
164
|
+
className: "fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none sm:hidden"
|
|
165
|
+
}), /* @__PURE__ */ jsx(Combobox$1.Positioner, {
|
|
166
|
+
align,
|
|
167
|
+
alignOffset,
|
|
168
|
+
side,
|
|
169
|
+
sideOffset,
|
|
170
|
+
className: "z-50 max-sm:fixed! max-sm:inset-x-0! max-sm:top-auto! max-sm:bottom-(--spark-viewport-bottom-offset,0)! max-sm:transform-none!",
|
|
171
|
+
children: /* @__PURE__ */ jsx(Combobox$1.Popup, {
|
|
172
|
+
"data-slot": "combobox-content",
|
|
173
|
+
className: cn("relative isolate z-50 flex max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) flex-col overflow-hidden rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11", "transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none", "sm:data-[side=bottom]:data-starting-style:-translate-y-2 sm:data-[side=left]:data-starting-style:translate-x-2 sm:data-[side=right]:data-starting-style:-translate-x-2 sm:data-[side=top]:data-starting-style:translate-y-2", "max-sm:max-h-[80dvh] max-sm:w-full max-sm:max-w-none max-sm:rounded-b-none max-sm:border-x-0 max-sm:border-b-0 max-sm:px-4 max-sm:pt-3 max-sm:pb-[calc(env(safe-area-inset-bottom)+var(--spacing)*4)] max-sm:data-ending-style:translate-y-full max-sm:data-ending-style:scale-100 max-sm:data-ending-style:opacity-100 max-sm:data-starting-style:translate-y-full max-sm:data-starting-style:scale-100 max-sm:data-starting-style:opacity-100", className),
|
|
174
|
+
...props,
|
|
175
|
+
children
|
|
176
|
+
})
|
|
177
|
+
})] })
|
|
178
|
+
})
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function ComboboxInput({ className, onKeyDown, ...props }) {
|
|
182
|
+
const tracker = React$1.useContext(ComboboxToggleContext);
|
|
183
|
+
return /* @__PURE__ */ jsxs(Combobox$1.Chips, {
|
|
184
|
+
"data-slot": "combobox-search",
|
|
185
|
+
render: ({ role: _toolbar, ...chipsProps }) => /* @__PURE__ */ jsx("div", { ...chipsProps }),
|
|
186
|
+
className: "-mx-1 -mt-1 mb-1 flex shrink-0 items-center gap-1.5 border-b border-gray-a4 px-2.5 text-gray-light max-sm:mx-0 max-sm:mt-0 max-sm:mb-2 max-sm:rounded-md max-sm:border-b-0 max-sm:bg-gray-a3",
|
|
187
|
+
children: [/* @__PURE__ */ jsx(Search, {
|
|
188
|
+
"aria-hidden": true,
|
|
189
|
+
className: "shrink-0 [--spark-icon-size:16px]"
|
|
190
|
+
}), /* @__PURE__ */ jsx(Combobox$1.Input, {
|
|
191
|
+
"data-slot": "combobox-input",
|
|
192
|
+
className: cn("h-10 w-full min-w-0 bg-transparent text-base text-gray outline-hidden placeholder:text-gray-placeholder", className),
|
|
193
|
+
onKeyDown: (event) => {
|
|
194
|
+
onKeyDown?.(event);
|
|
195
|
+
if (!tracker || event.key !== "Enter") return;
|
|
196
|
+
const highlighted = event.currentTarget.closest("[data-slot=\"combobox-content\"]")?.querySelector("[data-slot=\"combobox-item\"][data-highlighted]");
|
|
197
|
+
if (!highlighted) return;
|
|
198
|
+
tracker.pending = { value: tracker.values.get(highlighted) };
|
|
199
|
+
setTimeout(() => {
|
|
200
|
+
tracker.pending = null;
|
|
201
|
+
});
|
|
202
|
+
},
|
|
203
|
+
...props
|
|
204
|
+
})]
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function ComboboxClose({ className, onClick, ...props }) {
|
|
208
|
+
return /* @__PURE__ */ jsx("button", {
|
|
209
|
+
"data-slot": "combobox-close",
|
|
210
|
+
type: "button",
|
|
211
|
+
className: cn(buttonVariants({ variant: "primary" }), "mt-3 w-full shrink-0 sm:hidden", className),
|
|
212
|
+
onClick: (event) => {
|
|
213
|
+
onClick?.(event);
|
|
214
|
+
event.currentTarget.dispatchEvent(new KeyboardEvent("keydown", {
|
|
215
|
+
key: "Escape",
|
|
216
|
+
bubbles: true
|
|
217
|
+
}));
|
|
218
|
+
},
|
|
219
|
+
...props
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
function ComboboxList({ className, ...props }) {
|
|
223
|
+
return /* @__PURE__ */ jsx(Combobox$1.List, {
|
|
224
|
+
"data-slot": "combobox-list",
|
|
225
|
+
className: cn("min-h-0 flex-1 overflow-y-auto overscroll-contain outline-hidden data-empty:p-0", className),
|
|
226
|
+
...props
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
const ComboboxItem = React$1.forwardRef(function ComboboxItem({ className, value, ...props }, refProp) {
|
|
230
|
+
const tracker = React$1.useContext(ComboboxToggleContext);
|
|
231
|
+
const ref = React$1.useRef(null);
|
|
232
|
+
React$1.useEffect(() => {
|
|
233
|
+
const node = ref.current;
|
|
234
|
+
if (!tracker || !node) return;
|
|
235
|
+
tracker.values.set(node, value);
|
|
236
|
+
if (!tracker.pending || !Object.is(tracker.pending.value, value)) return;
|
|
237
|
+
tracker.pending = null;
|
|
238
|
+
const timer = setTimeout(() => node.dispatchEvent(new MouseEvent("mousemove", { bubbles: true })));
|
|
239
|
+
return () => clearTimeout(timer);
|
|
240
|
+
}, [tracker, value]);
|
|
241
|
+
return /* @__PURE__ */ jsx(Combobox$1.Item, {
|
|
242
|
+
ref: (node) => {
|
|
243
|
+
ref.current = node;
|
|
244
|
+
if (typeof refProp === "function") refProp(node);
|
|
245
|
+
else if (refProp) refProp.current = node;
|
|
246
|
+
},
|
|
247
|
+
value,
|
|
248
|
+
"data-slot": "combobox-item",
|
|
249
|
+
className: cn("relative flex w-full cursor-default items-center gap-1.5 rounded-sm px-1.5 py-1.5 text-sm text-gray outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 motion-reduce:transition-none max-sm:gap-3 max-sm:text-base", className),
|
|
250
|
+
...props
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
function ComboboxItemIndicator({ className, children, keepMounted = true, ...props }) {
|
|
254
|
+
return /* @__PURE__ */ jsx(Combobox$1.ItemIndicator, {
|
|
255
|
+
"data-slot": "combobox-item-indicator",
|
|
256
|
+
keepMounted,
|
|
257
|
+
className: cn("flex size-3.5 shrink-0 items-center justify-center [[data-slot=combobox-item]:not([data-selected])_&_svg]:invisible", "max-sm:size-5 max-sm:rounded-sm max-sm:border-2 max-sm:border-(--color-accent-ui) max-sm:bg-base-accent-soft max-sm:[[data-selected]_&]:border-(--color-primary) max-sm:[[data-selected]_&]:bg-(--color-primary) max-sm:[[data-selected]_&]:text-(--spark-on-solid)", className),
|
|
258
|
+
...props,
|
|
259
|
+
children: children ?? /* @__PURE__ */ jsx(Check, {
|
|
260
|
+
"aria-hidden": true,
|
|
261
|
+
className: "[--spark-icon-size:11px]"
|
|
262
|
+
})
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
const isSelectedGroup = (group) => typeof group === "object" && group !== null && "optionCount" in group;
|
|
266
|
+
function ComboboxEmpty({ className, children, ...props }) {
|
|
267
|
+
const filtered = useComboboxFilteredItems();
|
|
268
|
+
const groups = filtered.filter(isSelectedGroup);
|
|
269
|
+
const noOptionMatches = groups.some((group) => group.optionCount > 0) && !groups.some((group) => group.value === "items");
|
|
270
|
+
return /* @__PURE__ */ jsx(Combobox$1.Empty, {
|
|
271
|
+
"data-slot": "combobox-empty",
|
|
272
|
+
className: cn("px-1.5 py-1.5 text-sm text-gray-light empty:p-0", className),
|
|
273
|
+
...props,
|
|
274
|
+
render: ({ children: _baseChildren, ...emptyProps }) => /* @__PURE__ */ jsx("div", {
|
|
275
|
+
...emptyProps,
|
|
276
|
+
children: filtered.length === 0 || noOptionMatches ? children : null
|
|
277
|
+
})
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
function ComboboxStatus({ className, ...props }) {
|
|
281
|
+
return /* @__PURE__ */ jsx(Combobox$1.Status, {
|
|
282
|
+
"data-slot": "combobox-status",
|
|
283
|
+
className: cn("px-1.5 py-1.5 text-sm text-gray-light empty:p-0", className),
|
|
284
|
+
...props
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
function ComboboxGroup({ className, ...props }) {
|
|
288
|
+
return /* @__PURE__ */ jsx(Combobox$1.Group, {
|
|
289
|
+
"data-slot": "combobox-group",
|
|
290
|
+
className: cn("scroll-my-1 [&+&]:mt-1 [&+&]:border-t [&+&]:border-gray-a4 [&+&]:pt-1", className),
|
|
291
|
+
...props
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
function ComboboxGroupLabel({ className, ...props }) {
|
|
295
|
+
return /* @__PURE__ */ jsx(Combobox$1.GroupLabel, {
|
|
296
|
+
"data-slot": "combobox-group-label",
|
|
297
|
+
className: cn("px-1.5 py-1 text-xs font-medium text-gray-light [[data-high-contrast]_&]:text-gray-a12", className),
|
|
298
|
+
...props
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
function ComboboxSeparator({ className, ...props }) {
|
|
302
|
+
return /* @__PURE__ */ jsx("div", {
|
|
303
|
+
"aria-hidden": "true",
|
|
304
|
+
"data-slot": "combobox-separator",
|
|
305
|
+
className: cn("pointer-events-none -mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6", className),
|
|
306
|
+
...props
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
//#endregion
|
|
310
|
+
export { Combobox, ComboboxAddChip, ComboboxChip, ComboboxChips, ComboboxClear, ComboboxClose, ComboboxCollection, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxItemIndicator, ComboboxList, ComboboxSeparator, ComboboxStatus, ComboboxTrigger, ComboboxTriggerGroup, ComboboxValue, useComboboxFilter, useComboboxFilteredItems, useComboboxSelectedGroups };
|
|
311
|
+
|
|
312
|
+
//# sourceMappingURL=combobox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"combobox.js","names":["ComboboxPrimitive","React"],"sources":["../../src/components/combobox.tsx"],"sourcesContent":["'use client'\n\nimport { Combobox as ComboboxPrimitive } from '@base-ui/react/combobox'\nimport {\n Add,\n Check,\n Close,\n KeyboardArrowDown,\n Search,\n} from '@epilot/spark-icons'\nimport * as React from 'react'\nimport { boxChrome } from '../lib/input-box-variants'\nimport type { SparkInputStyle } from '../lib/theme-types'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\nimport { useFieldControl } from './field'\nimport { Pill } from './pill'\nimport { PortalTheme } from './theme'\n\nconst Combobox = ComboboxPrimitive.Root\nconst ComboboxValue = ComboboxPrimitive.Value\nconst ComboboxCollection = ComboboxPrimitive.Collection\nconst useComboboxFilter = ComboboxPrimitive.useFilter\nconst useComboboxFilteredItems = ComboboxPrimitive.useFilteredItems\n\ntype ComboboxSelectedGroup<Item> = {\n value: 'selected' | 'items'\n label: string\n items: Item[]\n /** Options left unpicked before the search filters them; ComboboxEmpty reads it. */\n optionCount: number\n}\n\n/** Splits `items` into a group with every pick, never filtered, and a group with the rest. */\nfunction useComboboxSelectedGroups<Item>(\n items: readonly Item[],\n value: readonly Item[],\n {\n selected,\n items: itemsLabel,\n isItemEqualToValue = Object.is,\n }: {\n selected: string\n items: string\n isItemEqualToValue?: (item: Item, value: Item) => boolean\n },\n) {\n const { contains } = useComboboxFilter()\n const isPicked = (item: Item) =>\n value.some((picked) => isItemEqualToValue(item, picked))\n const options = items.filter((item) => !isPicked(item))\n const groups: ComboboxSelectedGroup<Item>[] = [\n {\n value: 'selected',\n label: selected,\n items: [...value],\n optionCount: options.length,\n },\n {\n value: 'items',\n label: itemsLabel,\n items: options,\n optionCount: options.length,\n },\n ]\n const filter = (\n item: Item,\n query: string,\n itemToString?: (item: Item) => string,\n ) => isPicked(item) || contains(item, query, itemToString)\n return { items: groups, filter, isItemEqualToValue }\n}\n\nconst CLEAR_BUTTON =\n \"relative inline-flex size-6 min-h-[24px] min-w-[24px] shrink-0 items-center justify-center rounded-sm p-0 text-gray-light outline-hidden transition-colors hover:text-gray focus-visible:ring-2 focus-visible:ring-(--color-focus-root)! focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50 motion-reduce:transition-none [&_svg]:pointer-events-none [&_svg]:shrink-0 before:absolute before:top-1/2 before:left-1/2 before:size-10 before:-translate-x-1/2 before:-translate-y-1/2 before:content-['']\"\n\nconst ComboboxGroupStateContext = React.createContext({\n disabled: false,\n readOnly: false,\n})\n\n// the trigger is a native <button>, so ComboboxClear sits beside it, not inside it;\n// Base UI's InputGroup is the only part whose state carries readOnly, so its render stays ours\nfunction ComboboxTriggerGroup({\n className,\n ...props\n}: Omit<React.ComponentProps<typeof ComboboxPrimitive.InputGroup>, 'render'>) {\n return (\n <ComboboxPrimitive.InputGroup\n data-slot=\"combobox-trigger-group\"\n className={cn(\n 'relative flex w-full items-center has-[[data-slot=combobox-clear]:not([hidden])]:[&_[data-slot=combobox-trigger]]:pr-15',\n className,\n )}\n {...props}\n render={({ role: _group, ...groupProps }, state) => (\n <ComboboxGroupStateContext.Provider\n value={{ disabled: state.disabled, readOnly: state.readOnly }}\n >\n <div {...groupProps} />\n </ComboboxGroupStateContext.Provider>\n )}\n />\n )\n}\n\nfunction ComboboxTrigger({\n className,\n children,\n variant,\n id: idProp,\n 'aria-describedby': ariaDescribedByProp,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Trigger> & {\n // input-style override; falls back to Field / <Theme>, then soft (like Input)\n variant?: SparkInputStyle\n}) {\n const { field, id, ariaDescribedBy, ariaInvalid, inputStyle, inputColor } =\n useFieldControl({\n id: idProp,\n ariaDescribedBy: ariaDescribedByProp,\n variant,\n })\n const inset = !variant && field?.labelPosition === 'inset'\n const isGhost = inputStyle === 'ghost' || inset\n return (\n <ComboboxPrimitive.Trigger\n data-slot=\"combobox-trigger\"\n id={id}\n className={cn(\n 'relative flex w-full min-w-0 items-center gap-1.5 rounded-md px-3 text-left text-base text-gray transition-colors select-none disabled:cursor-not-allowed disabled:text-gray-disabled motion-reduce:transition-none',\n !isGhost && 'h-11 min-h-[2.75rem]',\n boxChrome[isGhost ? 'ghost' : inputStyle][inputColor],\n 'pr-8',\n // the inset Field shell draws the outline (field.tsx)\n inset && 'focus-visible:outline-hidden',\n className,\n )}\n aria-invalid={ariaInvalid}\n {...props}\n aria-describedby={ariaDescribedBy}\n >\n {children}\n <KeyboardArrowDown\n aria-hidden\n data-slot=\"combobox-chevron\"\n className={cn(\n 'pointer-events-none absolute shrink-0 text-gray-light transition-transform [--spark-icon-size:14px] in-data-popup-open:rotate-180 motion-reduce:transition-none',\n isGhost ? 'right-1' : 'right-3',\n )}\n />\n </ComboboxPrimitive.Trigger>\n )\n}\n\ntype ComboboxChipsProps<Item> = Omit<\n React.ComponentProps<'div'>,\n 'children'\n> & {\n /** Renders one chip per selected value, in pick order. */\n children: (item: Item, index: number) => React.ReactNode\n /** Renders at most this many chips, then a \"+N\" pill for the rest. */\n max?: number\n overflowLabel?: (count: number) => string\n /** Shown while nothing is selected: text, or a `ComboboxAddChip`. */\n placeholder?: React.ReactNode\n}\n\n// one row that never wraps: chips past the row's width are clipped, `max` folds them into \"+N\"\nfunction ComboboxChips<Item>({\n className,\n children,\n max,\n overflowLabel = (count) => `${count} more selected`,\n placeholder,\n ...props\n}: ComboboxChipsProps<Item>) {\n return (\n <div\n data-slot=\"combobox-chips\"\n className={cn(\n 'flex min-w-0 flex-1 flex-nowrap items-center gap-1 overflow-hidden',\n className,\n )}\n {...props}\n >\n <ComboboxPrimitive.Value>\n {(value: Item[]) => {\n if (value.length === 0) {\n return typeof placeholder === 'string' ? (\n <span className=\"truncate text-gray-placeholder in-data-disabled:text-gray-disabled\">\n {placeholder}\n </span>\n ) : (\n placeholder\n )\n }\n const shown = max === undefined ? value : value.slice(0, max)\n const hidden = value.length - shown.length\n return (\n <>\n {shown.map(children)}\n {hidden > 0 && (\n <Pill\n data-slot=\"combobox-chips-overflow\"\n className=\"shrink-0 in-data-disabled:opacity-50\"\n >\n <span aria-hidden=\"true\">+{hidden}</span>\n <span className=\"sr-only\">{overflowLabel(hidden)}</span>\n </Pill>\n )}\n </>\n )\n }}\n </ComboboxPrimitive.Value>\n </div>\n )\n}\n\n// display-only: chips sit inside the trigger button, so nothing in them may be interactive\nfunction ComboboxChip({\n className,\n children,\n ...props\n}: Omit<React.HTMLAttributes<HTMLSpanElement>, 'onClick' | 'color'>) {\n return (\n <Pill\n data-slot=\"combobox-chip\"\n className={cn('min-w-0 shrink in-data-disabled:opacity-50', className)}\n {...props}\n >\n <span className=\"truncate\">{children}</span>\n </Pill>\n )\n}\n\nfunction ComboboxAddChip({\n className,\n children,\n ...props\n}: Omit<React.HTMLAttributes<HTMLSpanElement>, 'onClick' | 'color'>) {\n return (\n <Pill\n data-slot=\"combobox-add-chip\"\n className={cn(\n 'shrink-0 border border-dashed border-spark-a6 bg-transparent pl-1.5 text-spark-a11 in-data-disabled:opacity-50',\n className,\n )}\n {...props}\n >\n <Add aria-hidden className=\"[--spark-icon-size:14px]\" />\n {children}\n </Pill>\n )\n}\n\nfunction ComboboxClear({\n className,\n children,\n onClick,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Clear>) {\n const group = React.useContext(ComboboxGroupStateContext)\n return (\n <ComboboxPrimitive.Clear\n data-slot=\"combobox-clear\"\n render={(buttonProps, state) => (\n <button\n {...buttonProps}\n hidden={state.disabled || buttonProps.hidden}\n />\n )}\n className={cn(CLEAR_BUTTON, 'absolute right-8', className)}\n onClick={(event) => {\n onClick?.(event)\n // Base UI refocuses the search input, which is unmounted while the popup is closed\n event.currentTarget\n .closest('[data-slot=\"combobox-trigger-group\"]')\n ?.querySelector<HTMLElement>('[data-slot=\"combobox-trigger\"]')\n ?.focus()\n }}\n {...props}\n hidden={group.disabled || group.readOnly || props.hidden}\n >\n {children ?? <Close aria-hidden className=\"[--spark-icon-size:14px]\" />}\n </ComboboxPrimitive.Clear>\n )\n}\n\ntype ComboboxContentProps = React.ComponentProps<\n typeof ComboboxPrimitive.Popup\n> &\n Pick<\n ComboboxPrimitive.Positioner.Props,\n 'align' | 'alignOffset' | 'side' | 'sideOffset'\n > &\n Pick<ComboboxPrimitive.Portal.Props, 'container'>\n\n// a toggled item changes group and so its index; Enter records it so the remounted\n// item can take the highlight back (Base UI only highlights on hover or arrow keys)\ntype ComboboxToggleTracker = {\n pending: { value: unknown } | null\n values: WeakMap<Element, unknown>\n}\nconst ComboboxToggleContext = React.createContext<ComboboxToggleTracker | null>(\n null,\n)\n\n// below `sm` the popup is a bottom sheet; `!` beats the positioner's inline position styles\nfunction ComboboxContent({\n className,\n children,\n align = 'start',\n alignOffset,\n side,\n sideOffset = 4,\n container,\n ...props\n}: ComboboxContentProps) {\n const [tracker] = React.useState<ComboboxToggleTracker>(() => ({\n pending: null,\n values: new WeakMap(),\n }))\n return (\n <ComboboxToggleContext.Provider value={tracker}>\n <ComboboxPrimitive.Portal container={container}>\n <PortalTheme>\n <ComboboxPrimitive.Backdrop\n data-slot=\"combobox-backdrop\"\n className=\"fixed top-(--spark-viewport-top,0) right-0 left-0 z-50 h-(--spark-viewport-height,100%) bg-(--color-overlay) transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none sm:hidden\"\n />\n <ComboboxPrimitive.Positioner\n align={align}\n alignOffset={alignOffset}\n side={side}\n sideOffset={sideOffset}\n className=\"z-50 max-sm:fixed! max-sm:inset-x-0! max-sm:top-auto! max-sm:bottom-(--spark-viewport-bottom-offset,0)! max-sm:transform-none!\"\n >\n <ComboboxPrimitive.Popup\n data-slot=\"combobox-content\"\n className={cn(\n 'relative isolate z-50 flex max-h-(--available-height) w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) flex-col overflow-hidden rounded-lg border border-gray-a1 bg-gray-1 p-1 text-gray-a12 shadow-lg dark:bg-gray-3 [[data-high-contrast]_&]:border-gray-a11',\n 'transition-[opacity,scale,translate] duration-100 data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none',\n 'sm:data-[side=bottom]:data-starting-style:-translate-y-2 sm:data-[side=left]:data-starting-style:translate-x-2 sm:data-[side=right]:data-starting-style:-translate-x-2 sm:data-[side=top]:data-starting-style:translate-y-2',\n 'max-sm:max-h-[80dvh] max-sm:w-full max-sm:max-w-none max-sm:rounded-b-none max-sm:border-x-0 max-sm:border-b-0 max-sm:px-4 max-sm:pt-3 max-sm:pb-[calc(env(safe-area-inset-bottom)+var(--spacing)*4)] max-sm:data-ending-style:translate-y-full max-sm:data-ending-style:scale-100 max-sm:data-ending-style:opacity-100 max-sm:data-starting-style:translate-y-full max-sm:data-starting-style:scale-100 max-sm:data-starting-style:opacity-100',\n className,\n )}\n {...props}\n >\n {children}\n </ComboboxPrimitive.Popup>\n </ComboboxPrimitive.Positioner>\n </PortalTheme>\n </ComboboxPrimitive.Portal>\n </ComboboxToggleContext.Provider>\n )\n}\n\n// Base UI removes the last pick on Backspace in the empty input only inside Chips\nfunction ComboboxInput({\n className,\n onKeyDown,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Input>) {\n const tracker = React.useContext(ComboboxToggleContext)\n return (\n <ComboboxPrimitive.Chips\n data-slot=\"combobox-search\"\n // Chips adds role=\"toolbar\" for arrow keys between chips; this row holds none\n render={({ role: _toolbar, ...chipsProps }) => <div {...chipsProps} />}\n className=\"-mx-1 -mt-1 mb-1 flex shrink-0 items-center gap-1.5 border-b border-gray-a4 px-2.5 text-gray-light max-sm:mx-0 max-sm:mt-0 max-sm:mb-2 max-sm:rounded-md max-sm:border-b-0 max-sm:bg-gray-a3\"\n >\n <Search aria-hidden className=\"shrink-0 [--spark-icon-size:16px]\" />\n <ComboboxPrimitive.Input\n data-slot=\"combobox-input\"\n className={cn(\n 'h-10 w-full min-w-0 bg-transparent text-base text-gray outline-hidden placeholder:text-gray-placeholder',\n className,\n )}\n onKeyDown={(event) => {\n onKeyDown?.(event)\n if (!tracker || event.key !== 'Enter') return\n const highlighted = event.currentTarget\n .closest('[data-slot=\"combobox-content\"]')\n ?.querySelector('[data-slot=\"combobox-item\"][data-highlighted]')\n if (!highlighted) return\n tracker.pending = { value: tracker.values.get(highlighted) }\n setTimeout(() => {\n tracker.pending = null\n })\n }}\n {...props}\n />\n </ComboboxPrimitive.Chips>\n )\n}\n\n// the bottom sheet's \"Done\"; hidden from `sm` up, where the popup closes on outside press\nfunction ComboboxClose({\n className,\n onClick,\n ...props\n}: React.ComponentProps<'button'>) {\n return (\n <button\n data-slot=\"combobox-close\"\n type=\"button\"\n className={cn(\n buttonVariants({ variant: 'primary' }),\n 'mt-3 w-full shrink-0 sm:hidden',\n className,\n )}\n onClick={(event) => {\n onClick?.(event)\n // Combobox has no Close part; Escape is the key Base UI closes on\n event.currentTarget.dispatchEvent(\n new KeyboardEvent('keydown', { key: 'Escape', bubbles: true }),\n )\n }}\n {...props}\n />\n )\n}\n\nfunction ComboboxList({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.List>) {\n return (\n <ComboboxPrimitive.List\n data-slot=\"combobox-list\"\n className={cn(\n 'min-h-0 flex-1 overflow-y-auto overscroll-contain outline-hidden data-empty:p-0',\n className,\n )}\n {...props}\n />\n )\n}\n\n// forwardRef keeps refs working for React 18 consumers (ref-as-prop is 19-only)\nconst ComboboxItem = React.forwardRef<\n HTMLDivElement,\n ComboboxPrimitive.Item.Props\n>(function ComboboxItem({ className, value, ...props }, refProp) {\n const tracker = React.useContext(ComboboxToggleContext)\n const ref = React.useRef<HTMLDivElement | null>(null)\n React.useEffect(() => {\n const node = ref.current\n if (!tracker || !node) return\n tracker.values.set(node, value)\n if (!tracker.pending || !Object.is(tracker.pending.value, value)) return\n tracker.pending = null\n // after Base UI has registered the remounted item's new index\n const timer = setTimeout(() =>\n node.dispatchEvent(new MouseEvent('mousemove', { bubbles: true })),\n )\n return () => clearTimeout(timer)\n }, [tracker, value])\n return (\n <ComboboxPrimitive.Item\n ref={(node: HTMLDivElement | null) => {\n ref.current = node\n if (typeof refProp === 'function') refProp(node)\n else if (refProp) refProp.current = node\n }}\n value={value}\n data-slot=\"combobox-item\"\n className={cn(\n 'relative flex w-full cursor-default items-center gap-1.5 rounded-sm px-1.5 py-1.5 text-sm text-gray outline-hidden transition-colors select-none touch-target-row data-disabled:pointer-events-none data-disabled:opacity-50 data-highlighted:bg-gray-a3 motion-reduce:transition-none max-sm:gap-3 max-sm:text-base',\n className,\n )}\n {...props}\n />\n )\n})\n\n// kept mounted so the bottom sheet draws an empty checkbox for unpicked items\nfunction ComboboxItemIndicator({\n className,\n children,\n keepMounted = true,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.ItemIndicator>) {\n return (\n <ComboboxPrimitive.ItemIndicator\n data-slot=\"combobox-item-indicator\"\n keepMounted={keepMounted}\n className={cn(\n 'flex size-3.5 shrink-0 items-center justify-center [[data-slot=combobox-item]:not([data-selected])_&_svg]:invisible',\n 'max-sm:size-5 max-sm:rounded-sm max-sm:border-2 max-sm:border-(--color-accent-ui) max-sm:bg-base-accent-soft max-sm:[[data-selected]_&]:border-(--color-primary) max-sm:[[data-selected]_&]:bg-(--color-primary) max-sm:[[data-selected]_&]:text-(--spark-on-solid)',\n className,\n )}\n {...props}\n >\n {children ?? <Check aria-hidden className=\"[--spark-icon-size:11px]\" />}\n </ComboboxPrimitive.ItemIndicator>\n )\n}\n\nconst isSelectedGroup = (\n group: unknown,\n): group is ComboboxSelectedGroup<unknown> =>\n typeof group === 'object' && group !== null && 'optionCount' in group\n\n// with useComboboxSelectedGroups the picks never filter out, so Base UI alone would never\n// see an empty list; \"no matches\" is the options group gone while it had options\nfunction ComboboxEmpty({\n className,\n children,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Empty>) {\n const filtered: readonly unknown[] = useComboboxFilteredItems()\n const groups = filtered.filter(isSelectedGroup)\n const noOptionMatches =\n groups.some((group) => group.optionCount > 0) &&\n !groups.some((group) => group.value === 'items')\n return (\n <ComboboxPrimitive.Empty\n data-slot=\"combobox-empty\"\n className={cn(\n 'px-1.5 py-1.5 text-sm text-gray-light empty:p-0',\n className,\n )}\n {...props}\n render={({ children: _baseChildren, ...emptyProps }) => (\n <div {...emptyProps}>\n {filtered.length === 0 || noOptionMatches ? children : null}\n </div>\n )}\n />\n )\n}\n\nfunction ComboboxStatus({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Status>) {\n return (\n <ComboboxPrimitive.Status\n data-slot=\"combobox-status\"\n className={cn(\n 'px-1.5 py-1.5 text-sm text-gray-light empty:p-0',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxGroup({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.Group>) {\n return (\n <ComboboxPrimitive.Group\n data-slot=\"combobox-group\"\n className={cn(\n 'scroll-my-1 [&+&]:mt-1 [&+&]:border-t [&+&]:border-gray-a4 [&+&]:pt-1',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxGroupLabel({\n className,\n ...props\n}: React.ComponentProps<typeof ComboboxPrimitive.GroupLabel>) {\n return (\n <ComboboxPrimitive.GroupLabel\n data-slot=\"combobox-group-label\"\n className={cn(\n 'px-1.5 py-1 text-xs font-medium text-gray-light [[data-high-contrast]_&]:text-gray-a12',\n className,\n )}\n {...props}\n />\n )\n}\n\nfunction ComboboxSeparator({\n className,\n ...props\n}: React.ComponentProps<'div'>) {\n return (\n <div\n aria-hidden=\"true\"\n data-slot=\"combobox-separator\"\n className={cn(\n 'pointer-events-none -mx-1 my-1 h-px bg-gray-a3 [[data-high-contrast]_&]:bg-gray-a6',\n className,\n )}\n {...props}\n />\n )\n}\n\nexport {\n Combobox,\n ComboboxAddChip,\n ComboboxChip,\n ComboboxChips,\n ComboboxClear,\n ComboboxClose,\n ComboboxCollection,\n ComboboxContent,\n ComboboxEmpty,\n ComboboxGroup,\n ComboboxGroupLabel,\n ComboboxInput,\n ComboboxItem,\n ComboboxItemIndicator,\n ComboboxList,\n ComboboxSeparator,\n ComboboxStatus,\n ComboboxTrigger,\n ComboboxTriggerGroup,\n ComboboxValue,\n useComboboxFilter,\n useComboboxFilteredItems,\n useComboboxSelectedGroups,\n}\nexport type { ComboboxSelectedGroup }\n"],"mappings":";;;;;;;;;;;;;AAmBA,MAAM,WAAWA,WAAkB;AACnC,MAAM,gBAAgBA,WAAkB;AACxC,MAAM,qBAAqBA,WAAkB;AAC7C,MAAM,oBAAoBA,WAAkB;AAC5C,MAAM,2BAA2BA,WAAkB;;AAWnD,SAAS,0BACP,OACA,OACA,EACE,UACA,OAAO,YACP,qBAAqB,OAAO,MAM9B;CACA,MAAM,EAAE,aAAa,kBAAkB;CACvC,MAAM,YAAY,SAChB,MAAM,MAAM,WAAW,mBAAmB,MAAM,MAAM,CAAC;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A;CAER,CAAA;AAEL;AAEA,SAAS,eAAe,EACtB,WACA,GAAG,SACqD;CACxD,OACE,oBAACA,WAAkB,QAAnB;EACE,aAAU;EACV,WAAW,GACT,mDACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,cAAc,EACrB,WACA,GAAG,SACoD;CACvD,OACE,oBAACA,WAAkB,OAAnB;EACE,aAAU;EACV,WAAW,GACT,yEACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,mBAAmB,EAC1B,WACA,GAAG,SACyD;CAC5D,OACE,oBAACA,WAAkB,YAAnB;EACE,aAAU;EACV,WAAW,GACT,0FACA,SACF;EACA,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,kBAAkB,EACzB,WACA,GAAG,SAC2B;CAC9B,OACE,oBAAC,OAAD;EACE,eAAY;EACZ,aAAU;EACV,WAAW,GACT,sFACA,SACF;EACA,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -74,11 +74,12 @@ const DayOfWeekPicker = react.forwardRef(function DayOfWeekPicker(props, ref) {
|
|
|
74
74
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
75
75
|
type: "button",
|
|
76
76
|
role: "checkbox",
|
|
77
|
+
"data-slot": "day-of-week-picker-day",
|
|
77
78
|
"aria-checked": checked,
|
|
78
79
|
"aria-label": dayAriaLabels?.[day] ?? label,
|
|
79
80
|
disabled,
|
|
80
81
|
onClick: () => toggle(day),
|
|
81
|
-
className: (0, cn.cn)("touch-target inline-flex h-9 flex-1 items-center justify-center rounded-full text-xs font-medium transition-colors
|
|
82
|
+
className: (0, cn.cn)("touch-target inline-flex h-9 flex-1 items-center justify-center rounded-full text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none", checked ? "bg-base-accent-solid text-accent-contrast hover:bg-spark-9" : "bg-base-gray-soft text-gray-light hover:bg-gray-a4"),
|
|
82
83
|
children: label
|
|
83
84
|
}, day);
|
|
84
85
|
})
|
|
@@ -89,10 +90,11 @@ DayOfWeekPicker.displayName = "DayOfWeekPicker";
|
|
|
89
90
|
function PresetButton({ active, children, disabled, onClick }) {
|
|
90
91
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
91
92
|
type: "button",
|
|
93
|
+
"data-slot": "day-of-week-picker-preset",
|
|
92
94
|
onClick,
|
|
93
95
|
disabled,
|
|
94
96
|
"aria-pressed": active,
|
|
95
|
-
className: (0, cn.cn)("touch-target inline-flex h-7 items-center justify-center rounded-full px-3 text-xs font-medium transition-colors
|
|
97
|
+
className: (0, cn.cn)("touch-target inline-flex h-7 items-center justify-center rounded-full px-3 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none", active ? "bg-base-accent-soft text-accent" : "bg-transparent text-gray-light hover:bg-gray-a3"),
|
|
96
98
|
children
|
|
97
99
|
});
|
|
98
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"day-of-week-picker.cjs","names":["React"],"sources":["../../src/components/day-of-week-picker.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cn } from '../utils/cn'\n\nexport type WeekDay =\n | 'monday'\n | 'tuesday'\n | 'wednesday'\n | 'thursday'\n | 'friday'\n | 'saturday'\n | 'sunday'\n\nexport const WEEK_DAYS: readonly WeekDay[] = [\n 'monday',\n 'tuesday',\n 'wednesday',\n 'thursday',\n 'friday',\n 'saturday',\n 'sunday',\n] as const\n\nconst WEEKDAYS_ONLY: WeekDay[] = [\n 'monday',\n 'tuesday',\n 'wednesday',\n 'thursday',\n 'friday',\n]\nconst WEEKEND_ONLY: WeekDay[] = ['saturday', 'sunday']\nconst ALL_DAYS: WeekDay[] = [...WEEK_DAYS]\n\ntype DayOfWeekPickerBaseProps = {\n value: WeekDay[]\n onValueChange: (next: WeekDay[]) => void\n disabled?: boolean\n className?: string\n dayLabels: Record<WeekDay, string>\n dayAriaLabels?: Partial<Record<WeekDay, string>>\n daysAriaLabel: string\n}\n\ntype DayOfWeekPickerWithPresets = DayOfWeekPickerBaseProps & {\n showPresets: true\n presetLabels: {\n weekdays: React.ReactNode\n weekend: React.ReactNode\n everyDay: React.ReactNode\n }\n presetsAriaLabel: string\n}\n\ntype DayOfWeekPickerWithoutPresets = DayOfWeekPickerBaseProps & {\n showPresets?: false\n presetLabels?: never\n presetsAriaLabel?: never\n}\n\ntype DayOfWeekPickerProps =\n | DayOfWeekPickerWithPresets\n | DayOfWeekPickerWithoutPresets\n\nconst DayOfWeekPicker = React.forwardRef<HTMLDivElement, DayOfWeekPickerProps>(\n function DayOfWeekPicker(props, ref) {\n const {\n className,\n disabled,\n onValueChange,\n showPresets = false,\n value,\n dayLabels,\n dayAriaLabels,\n daysAriaLabel,\n } = props\n\n const selected = React.useMemo(() => new Set(value), [value])\n\n const toggle = (day: WeekDay) => {\n const next = new Set(selected)\n if (next.has(day)) {\n next.delete(day)\n } else {\n next.add(day)\n }\n onValueChange(ALL_DAYS.filter((d) => next.has(d)))\n }\n\n const matches = (preset: WeekDay[]) =>\n selected.size === preset.length && preset.every((d) => selected.has(d))\n\n const setPreset = (preset: WeekDay[]) => {\n onValueChange(preset)\n }\n\n return (\n <div ref={ref} className={cn('flex flex-col gap-2', className)}>\n {showPresets && props.showPresets ? (\n <div\n role=\"group\"\n aria-label={props.presetsAriaLabel}\n className=\"flex flex-wrap gap-1.5\"\n >\n <PresetButton\n active={matches(WEEKDAYS_ONLY)}\n disabled={disabled}\n onClick={() => setPreset(WEEKDAYS_ONLY)}\n >\n {props.presetLabels.weekdays}\n </PresetButton>\n <PresetButton\n active={matches(WEEKEND_ONLY)}\n disabled={disabled}\n onClick={() => setPreset(WEEKEND_ONLY)}\n >\n {props.presetLabels.weekend}\n </PresetButton>\n <PresetButton\n active={matches(ALL_DAYS)}\n disabled={disabled}\n onClick={() => setPreset(ALL_DAYS)}\n >\n {props.presetLabels.everyDay}\n </PresetButton>\n </div>\n ) : null}\n <div role=\"group\" aria-label={daysAriaLabel} className=\"flex gap-1\">\n {WEEK_DAYS.map((day) => {\n const checked = selected.has(day)\n const label = dayLabels[day]\n const ariaLabel = dayAriaLabels?.[day] ?? label\n return (\n <button\n key={day}\n type=\"button\"\n role=\"checkbox\"\n aria-checked={checked}\n aria-label={ariaLabel}\n disabled={disabled}\n onClick={() => toggle(day)}\n className={cn(\n 'touch-target inline-flex h-9 flex-1 items-center justify-center rounded-full text-xs font-medium transition-colors
|
|
1
|
+
{"version":3,"file":"day-of-week-picker.cjs","names":["React"],"sources":["../../src/components/day-of-week-picker.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cn } from '../utils/cn'\n\nexport type WeekDay =\n | 'monday'\n | 'tuesday'\n | 'wednesday'\n | 'thursday'\n | 'friday'\n | 'saturday'\n | 'sunday'\n\nexport const WEEK_DAYS: readonly WeekDay[] = [\n 'monday',\n 'tuesday',\n 'wednesday',\n 'thursday',\n 'friday',\n 'saturday',\n 'sunday',\n] as const\n\nconst WEEKDAYS_ONLY: WeekDay[] = [\n 'monday',\n 'tuesday',\n 'wednesday',\n 'thursday',\n 'friday',\n]\nconst WEEKEND_ONLY: WeekDay[] = ['saturday', 'sunday']\nconst ALL_DAYS: WeekDay[] = [...WEEK_DAYS]\n\ntype DayOfWeekPickerBaseProps = {\n value: WeekDay[]\n onValueChange: (next: WeekDay[]) => void\n disabled?: boolean\n className?: string\n dayLabels: Record<WeekDay, string>\n dayAriaLabels?: Partial<Record<WeekDay, string>>\n daysAriaLabel: string\n}\n\ntype DayOfWeekPickerWithPresets = DayOfWeekPickerBaseProps & {\n showPresets: true\n presetLabels: {\n weekdays: React.ReactNode\n weekend: React.ReactNode\n everyDay: React.ReactNode\n }\n presetsAriaLabel: string\n}\n\ntype DayOfWeekPickerWithoutPresets = DayOfWeekPickerBaseProps & {\n showPresets?: false\n presetLabels?: never\n presetsAriaLabel?: never\n}\n\ntype DayOfWeekPickerProps =\n | DayOfWeekPickerWithPresets\n | DayOfWeekPickerWithoutPresets\n\nconst DayOfWeekPicker = React.forwardRef<HTMLDivElement, DayOfWeekPickerProps>(\n function DayOfWeekPicker(props, ref) {\n const {\n className,\n disabled,\n onValueChange,\n showPresets = false,\n value,\n dayLabels,\n dayAriaLabels,\n daysAriaLabel,\n } = props\n\n const selected = React.useMemo(() => new Set(value), [value])\n\n const toggle = (day: WeekDay) => {\n const next = new Set(selected)\n if (next.has(day)) {\n next.delete(day)\n } else {\n next.add(day)\n }\n onValueChange(ALL_DAYS.filter((d) => next.has(d)))\n }\n\n const matches = (preset: WeekDay[]) =>\n selected.size === preset.length && preset.every((d) => selected.has(d))\n\n const setPreset = (preset: WeekDay[]) => {\n onValueChange(preset)\n }\n\n return (\n <div ref={ref} className={cn('flex flex-col gap-2', className)}>\n {showPresets && props.showPresets ? (\n <div\n role=\"group\"\n aria-label={props.presetsAriaLabel}\n className=\"flex flex-wrap gap-1.5\"\n >\n <PresetButton\n active={matches(WEEKDAYS_ONLY)}\n disabled={disabled}\n onClick={() => setPreset(WEEKDAYS_ONLY)}\n >\n {props.presetLabels.weekdays}\n </PresetButton>\n <PresetButton\n active={matches(WEEKEND_ONLY)}\n disabled={disabled}\n onClick={() => setPreset(WEEKEND_ONLY)}\n >\n {props.presetLabels.weekend}\n </PresetButton>\n <PresetButton\n active={matches(ALL_DAYS)}\n disabled={disabled}\n onClick={() => setPreset(ALL_DAYS)}\n >\n {props.presetLabels.everyDay}\n </PresetButton>\n </div>\n ) : null}\n <div role=\"group\" aria-label={daysAriaLabel} className=\"flex gap-1\">\n {WEEK_DAYS.map((day) => {\n const checked = selected.has(day)\n const label = dayLabels[day]\n const ariaLabel = dayAriaLabels?.[day] ?? label\n return (\n <button\n key={day}\n type=\"button\"\n role=\"checkbox\"\n data-slot=\"day-of-week-picker-day\"\n aria-checked={checked}\n aria-label={ariaLabel}\n disabled={disabled}\n onClick={() => toggle(day)}\n className={cn(\n 'touch-target inline-flex h-9 flex-1 items-center justify-center rounded-full text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none',\n checked\n ? 'bg-base-accent-solid text-accent-contrast hover:bg-spark-9'\n : 'bg-base-gray-soft text-gray-light hover:bg-gray-a4',\n )}\n >\n {label}\n </button>\n )\n })}\n </div>\n </div>\n )\n },\n)\n\nDayOfWeekPicker.displayName = 'DayOfWeekPicker'\n\ninterface PresetButtonProps {\n active: boolean\n disabled?: boolean\n onClick: () => void\n children: React.ReactNode\n}\n\nfunction PresetButton({\n active,\n children,\n disabled,\n onClick,\n}: PresetButtonProps) {\n return (\n <button\n type=\"button\"\n data-slot=\"day-of-week-picker-preset\"\n onClick={onClick}\n disabled={disabled}\n aria-pressed={active}\n className={cn(\n 'touch-target inline-flex h-7 items-center justify-center rounded-full px-3 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none',\n active\n ? 'bg-base-accent-soft text-accent'\n : 'bg-transparent text-gray-light hover:bg-gray-a3',\n )}\n >\n {children}\n </button>\n )\n}\n\nexport { DayOfWeekPicker }\n"],"mappings":";;;;;;;;AAYA,MAAa,YAAgC;CAC3C;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAM,gBAA2B;CAC/B;CACA;CACA;CACA;CACA;AACF;AACA,MAAM,eAA0B,CAAC,YAAY,QAAQ;AACrD,MAAM,WAAsB,CAAC,GAAG,SAAS;AAgCzC,MAAM,kBAAkBA,MAAM,WAC5B,SAAS,gBAAgB,OAAO,KAAK;CACnC,MAAM,EACJ,WACA,UACA,eACA,cAAc,OACd,OACA,WACA,eACA,kBACE;CAEJ,MAAM,WAAWA,MAAM,cAAc,IAAI,IAAI,KAAK,GAAG,CAAC,KAAK,CAAC;CAE5D,MAAM,UAAU,QAAiB;EAC/B,MAAM,OAAO,IAAI,IAAI,QAAQ;EAC7B,IAAI,KAAK,IAAI,GAAG,GACd,KAAK,OAAO,GAAG;OAEf,KAAK,IAAI,GAAG;EAEd,cAAc,SAAS,QAAQ,MAAM,KAAK,IAAI,CAAC,C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E,iBAAA,GAAA,kBAAA,KAAC,UAAD;EACE,MAAK;EACL,aAAU;EACD;EACC;EACV,gBAAc;EACd,YAAA,GAAA,GAAA,IACE,kMACA,SACI,oCACA,iDACN;EAEC;CACK,CAAA;AAEZ"}
|
|
@@ -71,11 +71,12 @@ const DayOfWeekPicker = React$1.forwardRef(function DayOfWeekPicker(props, ref)
|
|
|
71
71
|
return /* @__PURE__ */ jsx("button", {
|
|
72
72
|
type: "button",
|
|
73
73
|
role: "checkbox",
|
|
74
|
+
"data-slot": "day-of-week-picker-day",
|
|
74
75
|
"aria-checked": checked,
|
|
75
76
|
"aria-label": dayAriaLabels?.[day] ?? label,
|
|
76
77
|
disabled,
|
|
77
78
|
onClick: () => toggle(day),
|
|
78
|
-
className: cn("touch-target inline-flex h-9 flex-1 items-center justify-center rounded-full text-xs font-medium transition-colors
|
|
79
|
+
className: cn("touch-target inline-flex h-9 flex-1 items-center justify-center rounded-full text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none", checked ? "bg-base-accent-solid text-accent-contrast hover:bg-spark-9" : "bg-base-gray-soft text-gray-light hover:bg-gray-a4"),
|
|
79
80
|
children: label
|
|
80
81
|
}, day);
|
|
81
82
|
})
|
|
@@ -86,10 +87,11 @@ DayOfWeekPicker.displayName = "DayOfWeekPicker";
|
|
|
86
87
|
function PresetButton({ active, children, disabled, onClick }) {
|
|
87
88
|
return /* @__PURE__ */ jsx("button", {
|
|
88
89
|
type: "button",
|
|
90
|
+
"data-slot": "day-of-week-picker-preset",
|
|
89
91
|
onClick,
|
|
90
92
|
disabled,
|
|
91
93
|
"aria-pressed": active,
|
|
92
|
-
className: cn("touch-target inline-flex h-7 items-center justify-center rounded-full px-3 text-xs font-medium transition-colors
|
|
94
|
+
className: cn("touch-target inline-flex h-7 items-center justify-center rounded-full px-3 text-xs font-medium transition-colors disabled:cursor-not-allowed disabled:opacity-50 motion-reduce:transition-none", active ? "bg-base-accent-soft text-accent" : "bg-transparent text-gray-light hover:bg-gray-a3"),
|
|
93
95
|
children
|
|
94
96
|
});
|
|
95
97
|
}
|