@commenda/pathfinder 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/components/accordion/AccordionSection.js +9 -3
- package/dist/components/address-input/AddressInput.js +1 -1
- package/dist/components/artifact-card/ArtifactCard.js +1 -1
- package/dist/components/artifact-panel/ArtifactPanel.js +81 -55
- package/dist/components/attachment/Attachment.d.ts +2 -6
- package/dist/components/attachment/Attachment.js +59 -36
- package/dist/components/attachment/AttachmentCard.d.ts +1 -1
- package/dist/components/attachment/AttachmentCard.js +56 -43
- package/dist/components/attachment/attachment-class-names.d.ts +1 -1
- package/dist/components/attachment/attachment-class-names.js +1 -1
- package/dist/components/attachment-group/AttachmentGroup.js +1 -1
- package/dist/components/avatar/avatar-helper.d.ts +1 -1
- package/dist/components/banner/Banner.js +5 -2
- package/dist/components/button/Button.js +1 -1
- package/dist/components/calendar/CalendarAgenda.js +1 -1
- package/dist/components/calendar/CalendarArtwork.js +16 -22
- package/dist/components/calendar/CalendarEventContent.js +2 -2
- package/dist/components/calendar/CalendarPopup.js +102 -82
- package/dist/components/calendar/CalendarToolbar.js +10 -10
- package/dist/components/card/Card.js +47 -41
- package/dist/components/checkbox/Checkbox.js +31 -13
- package/dist/components/choices/choice-motion.d.ts +12 -0
- package/dist/components/choices/choice-motion.js +22 -0
- package/dist/components/code-block/CodeBlock.js +3 -2
- package/dist/components/controls/control-class-names.d.ts +1 -0
- package/dist/components/controls/control-class-names.js +8 -8
- package/dist/components/controls/useHoverHighlight.d.ts +12 -0
- package/dist/components/controls/useHoverHighlight.js +51 -0
- package/dist/components/controls/useSelectionIndicator.d.ts +3 -4
- package/dist/components/controls/useSelectionIndicator.js +43 -28
- package/dist/components/data-grid/DataGrid.js +7 -7
- package/dist/components/data-grid/DataGridHeaders.js +1 -1
- package/dist/components/date-picker/DateCalendar.js +3 -3
- package/dist/components/date-picker/DatePicker.js +10 -10
- package/dist/components/date-picker/field/DateField.js +1 -1
- package/dist/components/description-list/DescriptionList.js +2 -2
- package/dist/components/dialog/ConfirmDialog.js +1 -1
- package/dist/components/dialog/Dialog.js +1 -1
- package/dist/components/distribution-bar/DistributionBar.js +45 -35
- package/dist/components/drag-handle/DragHandle.d.ts +1 -1
- package/dist/components/dropdown/Dropdown.js +27 -26
- package/dist/components/dropdown/MenuContent.js +100 -69
- package/dist/components/dropdown/dropdown-types.d.ts +1 -0
- package/dist/components/dropdown/menu-motion.d.ts +2 -0
- package/dist/components/dropdown/menu-motion.js +4 -0
- package/dist/components/feedback/FeedbackIcon.d.ts +2 -1
- package/dist/components/feedback/FeedbackIcon.js +4 -4
- package/dist/components/feedback/FeedbackSurface.d.ts +3 -3
- package/dist/components/feedback/FeedbackSurface.js +49 -21
- package/dist/components/fields/FieldAction.d.ts +1 -0
- package/dist/components/fields/FieldAction.js +2 -2
- package/dist/components/icon-button/IconButton.js +37 -37
- package/dist/components/icons/index.js +776 -776
- package/dist/components/inline-reference/InlineReference.js +1 -8
- package/dist/components/list/List.js +2 -2
- package/dist/components/list/ListGroup.js +35 -30
- package/dist/components/list/ListTask.js +1 -1
- package/dist/components/list/SettingRow.js +1 -1
- package/dist/components/markdown/Markdown.js +11 -10
- package/dist/components/markdown/MarkdownTable.d.ts +1 -1
- package/dist/components/markdown/MarkdownTable.js +71 -54
- package/dist/components/otp/OTP.js +44 -43
- package/dist/components/output-sections/OutputRow.js +2 -3
- package/dist/components/overlays/OverlayFrame.js +2 -2
- package/dist/components/overlays/overlay-class-names.d.ts +3 -3
- package/dist/components/overlays/overlay-class-names.js +1 -1
- package/dist/components/phone-input/CountryPicker.js +11 -8
- package/dist/components/popover/Popover.js +2 -2
- package/dist/components/question-card/QuestionOptions.js +3 -3
- package/dist/components/radio-group/RadioGroup.js +59 -50
- package/dist/components/search/Search.js +51 -47
- package/dist/components/segmented-control/SegmentedControl.js +7 -6
- package/dist/components/selection/ChoiceField.js +1 -1
- package/dist/components/selection/ChoiceList.js +2 -1
- package/dist/components/selection/SearchableChoice.js +129 -114
- package/dist/components/selection/SelectedTags.js +1 -1
- package/dist/components/selection/SimpleChoice.js +95 -77
- package/dist/components/selection/choice-styles.d.ts +2 -2
- package/dist/components/selection/choice-styles.js +1 -1
- package/dist/components/sheet/Sheet.js +7 -7
- package/dist/components/side-nav/SideNav.d.ts +2 -5
- package/dist/components/side-nav/SideNav.js +98 -56
- package/dist/components/side-nav/SideNavItemView.d.ts +1 -1
- package/dist/components/side-nav/SideNavItemView.js +83 -98
- package/dist/components/side-nav/index.d.ts +2 -0
- package/dist/components/side-nav/index.js +1 -1
- package/dist/components/split-button/SplitButton.js +3 -2
- package/dist/components/stepper/StepMarker.js +32 -28
- package/dist/components/stepper/Stepper.js +30 -22
- package/dist/components/suggested-prompt/SuggestedPrompt.js +1 -1
- package/dist/components/switch/Switch.d.ts +1 -1
- package/dist/components/switch/Switch.js +38 -28
- package/dist/components/table/Table.js +134 -110
- package/dist/components/table/TableColumnHeader.js +20 -2
- package/dist/components/table/TableColumnResize.js +1 -1
- package/dist/components/table/TableColumnsMenu.js +1 -0
- package/dist/components/table/TableFilterChip.js +1 -1
- package/dist/components/table/TableFilterEditor.js +6 -6
- package/dist/components/table/TableFilters.js +1 -0
- package/dist/components/table/TableOptionMenu.d.ts +1 -1
- package/dist/components/table/TableOptionMenu.js +16 -17
- package/dist/components/table/TablePagination.js +1 -0
- package/dist/components/table/TableSelectionBar.js +4 -1
- package/dist/components/table/index.js +6 -6
- package/dist/components/table/table-column-style.js +0 -1
- package/dist/components/table/table-types.d.ts +5 -0
- package/dist/components/table/useTableData.js +2 -2
- package/dist/components/tabs/Tabs.js +61 -53
- package/dist/components/tabs/tab-class-names.d.ts +1 -1
- package/dist/components/tabs/tab-class-names.js +1 -1
- package/dist/components/tabular/TableEditCell.js +3 -1
- package/dist/components/tabular/tabular-class-names.d.ts +1 -0
- package/dist/components/tabular/tabular-class-names.js +1 -0
- package/dist/components/tabular/useCellEdit.js +1 -1
- package/dist/components/tabular/useTabularPinning.js +7 -6
- package/dist/components/tag/Tag.js +1 -1
- package/dist/components/tag-input/TagInput.js +64 -53
- package/dist/components/tag-input/useTagMotion.d.ts +6 -0
- package/dist/components/tag-input/useTagMotion.js +36 -0
- package/dist/components/text-area/TextArea.js +2 -1
- package/dist/components/thread/ThreadReply.js +10 -7
- package/dist/components/tool-call/ToolCall.js +2 -2
- package/dist/components/tree/TreeItemView.js +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/index.js +37 -37
- package/dist/styles.css +1 -1
- package/package.json +5 -1
- package/dist/_virtual/_rolldown/runtime.js +0 -11
- package/dist/components/date-picker/date-values.d.ts +0 -23
- package/dist/components/date-picker/date-values.js +0 -52
- package/dist/components/table/TableHeaderPin.d.ts +0 -6
- package/dist/components/table/TableHeaderPin.js +0 -66
|
@@ -1,168 +1,183 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
2
|
+
import { hoverHighlightClass as e, useHoverHighlight as t } from "../controls/useHoverHighlight.js";
|
|
3
|
+
import { SearchMdIcon as n } from "../icons/SearchMdIcon.js";
|
|
4
|
+
import { choiceIndicatorMotionProps as r } from "../choices/choice-motion.js";
|
|
5
|
+
import { Checkbox as i } from "../checkbox/Checkbox.js";
|
|
6
|
+
import { choicePopupClass as a } from "./choice-styles.js";
|
|
7
|
+
import { ChoiceField as o } from "./ChoiceField.js";
|
|
8
|
+
import { ChoiceList as s } from "./ChoiceList.js";
|
|
9
|
+
import c from "clsx";
|
|
10
|
+
import { useMemo as l, useRef as u, useState as d } from "react";
|
|
11
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
12
|
+
import { Combobox as h } from "@base-ui/react/combobox";
|
|
10
13
|
//#region src/components/selection/SearchableChoice.tsx
|
|
11
|
-
function
|
|
12
|
-
let [
|
|
13
|
-
...
|
|
14
|
-
...
|
|
15
|
-
...
|
|
16
|
-
].map((e) => [e.value, e])),
|
|
14
|
+
function g({ config: g, multiple: _, values: v, onChange: y, forwardedRef: b, field: x }) {
|
|
15
|
+
let S = t(), [C, w] = d(!1), T = u(null), [E, D] = d(""), [O, k] = d(), [A, j] = d([]), M = g.searchConfig?.mode === "remote" ? g.searchConfig : void 0, N = M?.query ?? E, P = l(() => g.options ?? g.groups.flatMap((e) => e.options), [g.options, g.groups]), F = new Set(v), I = new Map([
|
|
16
|
+
...A,
|
|
17
|
+
...g.selectedOptions ?? [],
|
|
18
|
+
...P
|
|
19
|
+
].map((e) => [e.value, e])), L = v.map((e) => I.get(e) ?? {
|
|
17
20
|
value: e,
|
|
18
21
|
label: "Selected value unavailable"
|
|
19
|
-
}),
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
]),
|
|
25
|
-
if (
|
|
26
|
-
let t =
|
|
27
|
-
|
|
28
|
-
let t =
|
|
22
|
+
}), R = !!M && (M.isLoading || N !== M.resultsQuery), z = l(() => R || M?.error ? [] : M ? P : P.filter((e) => `${e.label} ${e.keywords?.join(" ") ?? ""}`.toLocaleLowerCase().includes(N.toLocaleLowerCase())), [
|
|
23
|
+
R,
|
|
24
|
+
M,
|
|
25
|
+
P,
|
|
26
|
+
N
|
|
27
|
+
]), B = g.selectionLimitConfig?.max, V = B !== void 0 && v.length >= B, H = (e) => {
|
|
28
|
+
if (g.disableConfig?.isDisabled) return;
|
|
29
|
+
let t = v.filter((e) => I.get(e)?.disableConfig?.isDisabled), n = [.../* @__PURE__ */ new Set([...e, ...t])];
|
|
30
|
+
B !== void 0 && n.length > B && n.length > v.length || (j(n.flatMap((e) => {
|
|
31
|
+
let t = I.get(e);
|
|
29
32
|
return t ? [t] : [];
|
|
30
|
-
})),
|
|
31
|
-
},
|
|
32
|
-
let e =
|
|
33
|
-
!e || !e.hasMore || e.isLoadingMore || e.error ||
|
|
34
|
-
},
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
multiple:
|
|
37
|
-
items:
|
|
38
|
-
value:
|
|
33
|
+
})), y(n));
|
|
34
|
+
}, U = u(null), W = `${M?.resultsQuery ?? ""}:${String(P.length)}`, G = () => {
|
|
35
|
+
let e = g.paginationConfig;
|
|
36
|
+
!e || !e.hasMore || e.isLoadingMore || e.error || R || M?.error || U.current === W || (U.current = W, e.onLoadMore());
|
|
37
|
+
}, K = z.filter((e) => !e.disableConfig?.isDisabled).map((e) => e.value), q = K.length > 0 && K.every((e) => F.has(e)), J = [.../* @__PURE__ */ new Set([...v, ...K])], Y = !q && B !== void 0 && J.length > B;
|
|
38
|
+
return /* @__PURE__ */ m(h.Root, {
|
|
39
|
+
multiple: _,
|
|
40
|
+
items: z.map((e) => e.value),
|
|
41
|
+
value: _ ? v : v[0] ?? null,
|
|
39
42
|
onValueChange: (e) => {
|
|
40
|
-
|
|
43
|
+
H(Array.isArray(e) ? e : e === null ? [] : [e]);
|
|
41
44
|
},
|
|
42
|
-
itemToStringLabel: (e) =>
|
|
45
|
+
itemToStringLabel: (e) => I.get(e)?.label ?? "Selected value unavailable",
|
|
43
46
|
filter: null,
|
|
44
|
-
inputValue:
|
|
47
|
+
inputValue: N,
|
|
45
48
|
onInputValueChange: (e, t) => {
|
|
46
|
-
e !==
|
|
49
|
+
e !== N && t.reason !== "item-press" && t.reason !== "input-clear" && (M ? M.onQueryChange(e) : D(e));
|
|
47
50
|
},
|
|
48
|
-
open:
|
|
51
|
+
open: C,
|
|
49
52
|
onOpenChange: (e) => {
|
|
50
|
-
|
|
53
|
+
w(e), e || (x.blur(), M || D(""));
|
|
51
54
|
},
|
|
52
|
-
disabled:
|
|
53
|
-
autoComplete:
|
|
54
|
-
name:
|
|
55
|
-
form:
|
|
56
|
-
required:
|
|
57
|
-
virtualized:
|
|
55
|
+
disabled: g.disableConfig?.isDisabled,
|
|
56
|
+
autoComplete: g.autoComplete,
|
|
57
|
+
name: g.name,
|
|
58
|
+
form: g.form,
|
|
59
|
+
required: g.required,
|
|
60
|
+
virtualized: g.listConfig?.virtualized,
|
|
58
61
|
onItemHighlighted: (e) => {
|
|
59
|
-
|
|
62
|
+
k(e);
|
|
60
63
|
},
|
|
61
|
-
children: [/* @__PURE__ */
|
|
62
|
-
config:
|
|
63
|
-
field:
|
|
64
|
-
multiple:
|
|
65
|
-
resolved:
|
|
66
|
-
open:
|
|
67
|
-
anchorRef:
|
|
64
|
+
children: [/* @__PURE__ */ p(o, {
|
|
65
|
+
config: g,
|
|
66
|
+
field: x,
|
|
67
|
+
multiple: _,
|
|
68
|
+
resolved: L,
|
|
69
|
+
open: C,
|
|
70
|
+
anchorRef: T,
|
|
68
71
|
onRemove: (e) => {
|
|
69
|
-
|
|
72
|
+
H(v.filter((t) => t !== e));
|
|
70
73
|
},
|
|
71
74
|
onClear: () => {
|
|
72
|
-
|
|
75
|
+
H([]);
|
|
73
76
|
},
|
|
74
|
-
trigger: /* @__PURE__ */
|
|
75
|
-
id:
|
|
76
|
-
form:
|
|
77
|
-
ref:
|
|
78
|
-
"aria-label":
|
|
79
|
-
"aria-describedby":
|
|
80
|
-
"aria-invalid": !!
|
|
77
|
+
trigger: /* @__PURE__ */ p(h.Trigger, {
|
|
78
|
+
id: x.id,
|
|
79
|
+
form: g.form,
|
|
80
|
+
ref: b,
|
|
81
|
+
"aria-label": g.label ?? g["aria-label"],
|
|
82
|
+
"aria-describedby": x.describedBy,
|
|
83
|
+
"aria-invalid": !!x.error,
|
|
81
84
|
onBlur: (e) => {
|
|
82
|
-
|
|
85
|
+
C || x.blur(), g.onBlur?.(e);
|
|
83
86
|
},
|
|
84
|
-
onFocus:
|
|
87
|
+
onFocus: g.onFocus
|
|
85
88
|
})
|
|
86
|
-
}), /* @__PURE__ */
|
|
87
|
-
anchor:
|
|
89
|
+
}), /* @__PURE__ */ p(h.Portal, { children: /* @__PURE__ */ p(h.Positioner, {
|
|
90
|
+
anchor: T,
|
|
88
91
|
align: "start",
|
|
89
92
|
sideOffset: 4,
|
|
90
93
|
className: "pf:z-[60]",
|
|
91
|
-
children: /* @__PURE__ */
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
children: /* @__PURE__ */ m(h.Popup, {
|
|
95
|
+
...S.props,
|
|
96
|
+
onPointerDownCapture: r.onPointerDownCapture,
|
|
97
|
+
onKeyDownCapture: (e) => {
|
|
98
|
+
S.props.onKeyDownCapture(), r.onKeyDownCapture(e);
|
|
99
|
+
},
|
|
100
|
+
className: c(a, e),
|
|
101
|
+
"aria-label": g.label ?? g["aria-label"],
|
|
94
102
|
children: [
|
|
95
|
-
|
|
103
|
+
S.highlight,
|
|
104
|
+
/* @__PURE__ */ m("div", {
|
|
96
105
|
className: "pf:box-border pf:flex pf:h-[36px] pf:items-center pf:gap-md pf:px-lg pf:border-b-[0.5px] pf:border-solid pf:border-soft-pearl-300",
|
|
97
|
-
children: [/* @__PURE__ */
|
|
106
|
+
children: [/* @__PURE__ */ p("span", {
|
|
98
107
|
"aria-hidden": "true",
|
|
99
108
|
className: "pf:flex pf:size-[16px] pf:shrink-0 pf:items-center pf:justify-center pf:text-soft-pearl-800",
|
|
100
|
-
children: /* @__PURE__ */
|
|
109
|
+
children: /* @__PURE__ */ p(n, {
|
|
101
110
|
size: 16,
|
|
102
111
|
tone: "inherit"
|
|
103
112
|
})
|
|
104
|
-
}), /* @__PURE__ */
|
|
105
|
-
"aria-label": `Search ${
|
|
106
|
-
placeholder:
|
|
113
|
+
}), /* @__PURE__ */ p(h.Input, {
|
|
114
|
+
"aria-label": `Search ${g.label ?? g["aria-label"]}`,
|
|
115
|
+
placeholder: g.searchConfig?.placeholder ?? "Search options",
|
|
107
116
|
className: "pf:box-border pf:w-full pf:min-w-0 pf:h-full pf:border-0 pf:bg-transparent pf:p-0 pf:font-body pf:text-label-13 pf:font-normal pf:text-soft-pearl-1000 pf:placeholder:text-soft-pearl-800 pf:outline-none"
|
|
108
117
|
})]
|
|
109
118
|
}),
|
|
110
|
-
|
|
111
|
-
checked:
|
|
112
|
-
indeterminate: !
|
|
113
|
-
className: "pf:mx-sm pf:mt-sm pf:mb-xxs pf:px-md pf:py-sm pf:min-h-[32px] pf:w-[calc(100%_-_12px)] pf:[&.pf-choice]:items-center pf:[&.pf-choice]:gap-sm pf:[&_.pf-choice-label]:font-medium pf:[&_.pf-choice-label]:leading-[20px] pf:rounded-sm pf:hover:bg-soft-pearl-200",
|
|
114
|
-
disabled: !
|
|
115
|
-
title:
|
|
119
|
+
_ && g.selectAllConfig && /* @__PURE__ */ p(i, {
|
|
120
|
+
checked: q,
|
|
121
|
+
indeterminate: !q && K.some((e) => F.has(e)),
|
|
122
|
+
className: "pf:select-none pf:mx-sm pf:mt-sm pf:mb-xxs pf:px-md pf:py-sm pf:min-h-[32px] pf:w-[calc(100%_-_12px)] pf:[&.pf-choice]:items-center pf:[&.pf-choice]:gap-sm pf:[&_.pf-choice-label]:font-medium pf:[&_.pf-choice-label]:leading-[20px] pf:rounded-sm pf:hover:bg-soft-pearl-200",
|
|
123
|
+
disabled: !K.length || Y,
|
|
124
|
+
title: Y ? "Selection limit would be exceeded" : void 0,
|
|
116
125
|
onCheckedChange: () => {
|
|
117
|
-
|
|
126
|
+
H(q ? v.filter((e) => !K.includes(e)) : J);
|
|
118
127
|
},
|
|
119
|
-
label:
|
|
128
|
+
label: q ? "Clear selection" : g.selectAllConfig.label ?? "Select all"
|
|
120
129
|
}),
|
|
121
|
-
/* @__PURE__ */
|
|
122
|
-
multiple:
|
|
123
|
-
options:
|
|
124
|
-
selected:
|
|
125
|
-
config:
|
|
126
|
-
highlighted:
|
|
127
|
-
atLimit:
|
|
128
|
-
onLoadMore:
|
|
129
|
-
},
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
className: "pf:text-copy-12 pf:text-soft-pearl-800 pf:px-md",
|
|
132
|
-
children:
|
|
130
|
+
/* @__PURE__ */ p(s, {
|
|
131
|
+
multiple: _,
|
|
132
|
+
options: z,
|
|
133
|
+
selected: F,
|
|
134
|
+
config: g,
|
|
135
|
+
highlighted: O,
|
|
136
|
+
atLimit: V,
|
|
137
|
+
onLoadMore: G
|
|
138
|
+
}, M?.resultsQuery ?? N),
|
|
139
|
+
/* @__PURE__ */ p(h.Status, {
|
|
140
|
+
className: c("pf:text-copy-12 pf:text-soft-pearl-800", !R && !M?.error && !z.length ? "pf:px-lg pf:py-xl pf:text-center pf:wrap-anywhere" : "pf:px-md"),
|
|
141
|
+
children: R ? "Searching…" : M?.error ?? (z.length ? V ? g.selectionLimitConfig?.message ?? `Select up to ${String(B)} options.` : "" : /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("span", {
|
|
142
|
+
className: "pf:block pf:text-label-13 pf:font-medium pf:text-soft-pearl-1000",
|
|
143
|
+
children: g.emptyLabel ?? (N.trim() ? `No matches for “${N.trim()}”` : "No options available")
|
|
144
|
+
}), N.trim() && /* @__PURE__ */ p("span", {
|
|
145
|
+
className: "pf:block pf:mt-xs",
|
|
146
|
+
children: "Try a different search."
|
|
147
|
+
})] }))
|
|
133
148
|
}),
|
|
134
|
-
|
|
149
|
+
M?.error && M.onRetry && /* @__PURE__ */ p("button", {
|
|
135
150
|
type: "button",
|
|
136
|
-
className: "pf:box-border pf:w-full pf:text-start pf:px-md pf:py-sm pf:border-0 pf:bg-transparent pf:text-label-13 pf:text-blue-700 pf:font-body pf:rounded-xs pf:hover:bg-soft-pearl-200 pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:text-soft-pearl-700",
|
|
137
|
-
onClick:
|
|
151
|
+
className: "pf:cursor-pointer pf:disabled:cursor-default pf:select-none pf:box-border pf:w-full pf:text-start pf:px-md pf:py-sm pf:border-0 pf:bg-transparent pf:text-label-13 pf:text-blue-700 pf:font-body pf:rounded-xs pf:hover:bg-soft-pearl-200 pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:text-soft-pearl-700",
|
|
152
|
+
onClick: M.onRetry,
|
|
138
153
|
children: "Retry search"
|
|
139
154
|
}),
|
|
140
|
-
|
|
155
|
+
g.paginationConfig && !R && !M?.error && /* @__PURE__ */ p("div", { children: g.paginationConfig.error ? /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("span", {
|
|
141
156
|
role: "status",
|
|
142
157
|
className: "pf:text-copy-12 pf:text-red-700",
|
|
143
|
-
children:
|
|
144
|
-
}), /* @__PURE__ */
|
|
158
|
+
children: g.paginationConfig.error
|
|
159
|
+
}), /* @__PURE__ */ p("button", {
|
|
145
160
|
type: "button",
|
|
146
|
-
className: "pf:box-border pf:w-full pf:text-start pf:px-md pf:py-sm pf:border-0 pf:bg-transparent pf:text-label-13 pf:text-blue-700 pf:font-body pf:rounded-xs pf:hover:bg-soft-pearl-200 pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:text-soft-pearl-700",
|
|
161
|
+
className: "pf:cursor-pointer pf:disabled:cursor-default pf:select-none pf:box-border pf:w-full pf:text-start pf:px-md pf:py-sm pf:border-0 pf:bg-transparent pf:text-label-13 pf:text-blue-700 pf:font-body pf:rounded-xs pf:hover:bg-soft-pearl-200 pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:text-soft-pearl-700",
|
|
147
162
|
onClick: () => {
|
|
148
|
-
|
|
163
|
+
U.current = null, g.paginationConfig?.onRetry?.();
|
|
149
164
|
},
|
|
150
165
|
children: "Retry loading more"
|
|
151
|
-
})] }) :
|
|
166
|
+
})] }) : g.paginationConfig.hasMore && /* @__PURE__ */ p("button", {
|
|
152
167
|
type: "button",
|
|
153
|
-
className: "pf:box-border pf:w-full pf:text-start pf:px-md pf:py-sm pf:border-0 pf:bg-transparent pf:text-label-13 pf:text-blue-700 pf:font-body pf:rounded-xs pf:hover:bg-soft-pearl-200 pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:text-soft-pearl-700",
|
|
154
|
-
disabled:
|
|
155
|
-
onClick:
|
|
156
|
-
children:
|
|
168
|
+
className: "pf:cursor-pointer pf:disabled:cursor-default pf:select-none pf:box-border pf:w-full pf:text-start pf:px-md pf:py-sm pf:border-0 pf:bg-transparent pf:text-label-13 pf:text-blue-700 pf:font-body pf:rounded-xs pf:hover:bg-soft-pearl-200 pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:text-soft-pearl-700",
|
|
169
|
+
disabled: g.paginationConfig.isLoadingMore,
|
|
170
|
+
onClick: G,
|
|
171
|
+
children: g.paginationConfig.isLoadingMore ? "Loading more…" : "Load more"
|
|
157
172
|
}) }),
|
|
158
|
-
|
|
173
|
+
g.addItemConfig && /* @__PURE__ */ p("button", {
|
|
159
174
|
type: "button",
|
|
160
|
-
className: "pf:box-border pf:w-full pf:text-start pf:px-md pf:py-sm pf:border-0 pf:bg-transparent pf:text-label-13 pf:text-blue-700 pf:font-body pf:rounded-xs pf:hover:bg-soft-pearl-200 pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:text-soft-pearl-700",
|
|
161
|
-
disabled:
|
|
175
|
+
className: "pf:cursor-pointer pf:disabled:cursor-default pf:select-none pf:box-border pf:w-full pf:text-start pf:px-md pf:py-sm pf:border-0 pf:bg-transparent pf:text-label-13 pf:text-blue-700 pf:font-body pf:rounded-xs pf:hover:bg-soft-pearl-200 pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:text-soft-pearl-700",
|
|
176
|
+
disabled: g.addItemConfig.isDisabled,
|
|
162
177
|
onClick: () => {
|
|
163
|
-
|
|
178
|
+
g.addItemConfig?.onAddItem(N), w(!1);
|
|
164
179
|
},
|
|
165
|
-
children:
|
|
180
|
+
children: g.addItemConfig.label
|
|
166
181
|
})
|
|
167
182
|
]
|
|
168
183
|
})
|
|
@@ -170,4 +185,4 @@ function f({ config: f, multiple: p, values: m, onChange: h, forwardedRef: g, fi
|
|
|
170
185
|
});
|
|
171
186
|
}
|
|
172
187
|
//#endregion
|
|
173
|
-
export {
|
|
188
|
+
export { g as SearchableChoice };
|
|
@@ -59,7 +59,7 @@ function u({ options: u, disabled: d, onRemove: f, onOpen: p }) {
|
|
|
59
59
|
onClick: () => {
|
|
60
60
|
f(n.value);
|
|
61
61
|
},
|
|
62
|
-
className: "pf:pointer-events-auto pf:shrink-0 pf:flex pf:size-[12px] pf:items-center pf:justify-center pf:border-0 pf:bg-transparent pf:p-0 pf:text-soft-pearl-800 pf:rounded-xs pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:opacity-50",
|
|
62
|
+
className: "pf:pointer-events-auto pf:shrink-0 pf:flex pf:size-[12px] pf:items-center pf:justify-center pf:border-0 pf:bg-transparent pf:p-0 pf:text-soft-pearl-800 pf:rounded-xs pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:opacity-50 pf:cursor-pointer pf:disabled:cursor-default",
|
|
63
63
|
children: /* @__PURE__ */ c(t, {
|
|
64
64
|
size: 12,
|
|
65
65
|
tone: "inherit"
|
|
@@ -1,122 +1,140 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
2
|
+
import { hoverHighlightClass as e, useHoverHighlight as t } from "../controls/useHoverHighlight.js";
|
|
3
|
+
import { choiceIndicatorMotionProps as n } from "../choices/choice-motion.js";
|
|
4
|
+
import { Checkbox as r } from "../checkbox/Checkbox.js";
|
|
5
|
+
import { choiceItemClass as i, choicePopupClass as a } from "./choice-styles.js";
|
|
6
|
+
import { ChoiceField as o } from "./ChoiceField.js";
|
|
7
|
+
import { ChoiceIndicator as s } from "./ChoiceIndicator.js";
|
|
8
|
+
import { OptionContent as c } from "./OptionContent.js";
|
|
9
|
+
import l from "clsx";
|
|
10
|
+
import { useRef as u, useState as d } from "react";
|
|
11
|
+
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
12
|
+
import { Select as m } from "@base-ui/react/select";
|
|
10
13
|
//#region src/components/selection/SimpleChoice.tsx
|
|
11
|
-
function
|
|
12
|
-
let
|
|
14
|
+
function h({ config: h, multiple: g, values: _, onChange: v, forwardedRef: y, field: b }) {
|
|
15
|
+
let x = t(), S = u(null), [C, w] = d(!1), T = h.options ?? h.groups.flatMap((e) => e.options), E = new Map(T.map((e) => [e.value, e])), D = new Set(_), O = _.map((e) => E.get(e) ?? {
|
|
13
16
|
value: e,
|
|
14
17
|
label: "Selected value unavailable"
|
|
15
|
-
}),
|
|
16
|
-
let t =
|
|
17
|
-
|
|
18
|
-
},
|
|
18
|
+
}), k = h.selectionLimitConfig?.max, A = (e) => {
|
|
19
|
+
let t = _.filter((e) => E.get(e)?.disableConfig?.isDisabled), n = [.../* @__PURE__ */ new Set([...e, ...t])];
|
|
20
|
+
k !== void 0 && n.length > k && n.length > _.length || v(n);
|
|
21
|
+
}, j = T.filter((e) => !e.disableConfig?.isDisabled).map((e) => e.value), M = j.length > 0 && j.every((e) => D.has(e)), N = [.../* @__PURE__ */ new Set([..._, ...j])], P = (e) => e.map((e) => /* @__PURE__ */ p(m.Item, {
|
|
19
22
|
value: e.value,
|
|
20
|
-
disabled: e.disableConfig?.isDisabled ||
|
|
21
|
-
className:
|
|
23
|
+
disabled: e.disableConfig?.isDisabled || k !== void 0 && _.length >= k && !D.has(e.value),
|
|
24
|
+
className: i,
|
|
22
25
|
children: [
|
|
23
|
-
|
|
26
|
+
g && /* @__PURE__ */ f(s, {
|
|
24
27
|
multiple: !0,
|
|
25
|
-
selected:
|
|
26
|
-
disabled: e.disableConfig?.isDisabled ||
|
|
28
|
+
selected: D.has(e.value),
|
|
29
|
+
disabled: e.disableConfig?.isDisabled || k !== void 0 && _.length >= k && !D.has(e.value)
|
|
27
30
|
}),
|
|
28
|
-
/* @__PURE__ */
|
|
31
|
+
/* @__PURE__ */ f(m.ItemText, {
|
|
29
32
|
className: "pf:flex pf:flex-1 pf:min-w-0 pf:items-center pf:gap-sm",
|
|
30
|
-
children:
|
|
33
|
+
children: h.renderConfig?.optionContent?.(e, { isSelected: D.has(e.value) }) ?? /* @__PURE__ */ f(c, { option: e })
|
|
31
34
|
}),
|
|
32
|
-
!
|
|
35
|
+
!g && /* @__PURE__ */ f(s, { selected: D.has(e.value) })
|
|
33
36
|
]
|
|
34
37
|
}, e.value));
|
|
35
|
-
return /* @__PURE__ */
|
|
36
|
-
multiple:
|
|
37
|
-
open:
|
|
38
|
+
return /* @__PURE__ */ p(m.Root, {
|
|
39
|
+
multiple: g,
|
|
40
|
+
open: C,
|
|
38
41
|
onOpenChange: (e) => {
|
|
39
|
-
|
|
42
|
+
w(e), e || b.blur();
|
|
40
43
|
},
|
|
41
|
-
items:
|
|
44
|
+
items: T.map(({ value: e, label: t }) => ({
|
|
42
45
|
value: e,
|
|
43
46
|
label: t
|
|
44
47
|
})),
|
|
45
|
-
value:
|
|
48
|
+
value: g ? _ : _[0] ?? null,
|
|
46
49
|
onValueChange: (e) => {
|
|
47
|
-
|
|
50
|
+
A(Array.isArray(e) ? e : e === null ? [] : [e]);
|
|
48
51
|
},
|
|
49
|
-
disabled:
|
|
50
|
-
autoComplete:
|
|
51
|
-
name:
|
|
52
|
-
form:
|
|
53
|
-
required:
|
|
54
|
-
children: [/* @__PURE__ */
|
|
55
|
-
config:
|
|
56
|
-
field:
|
|
57
|
-
multiple:
|
|
58
|
-
resolved:
|
|
59
|
-
open:
|
|
60
|
-
anchorRef:
|
|
52
|
+
disabled: h.disableConfig?.isDisabled,
|
|
53
|
+
autoComplete: h.autoComplete,
|
|
54
|
+
name: h.name,
|
|
55
|
+
form: h.form,
|
|
56
|
+
required: h.required,
|
|
57
|
+
children: [/* @__PURE__ */ f(o, {
|
|
58
|
+
config: h,
|
|
59
|
+
field: b,
|
|
60
|
+
multiple: g,
|
|
61
|
+
resolved: O,
|
|
62
|
+
open: C,
|
|
63
|
+
anchorRef: S,
|
|
61
64
|
onRemove: (e) => {
|
|
62
|
-
|
|
65
|
+
A(_.filter((t) => t !== e));
|
|
63
66
|
},
|
|
64
67
|
onClear: () => {
|
|
65
|
-
|
|
68
|
+
A([]);
|
|
66
69
|
},
|
|
67
|
-
trigger: /* @__PURE__ */
|
|
68
|
-
id:
|
|
69
|
-
form:
|
|
70
|
-
ref:
|
|
71
|
-
"aria-label":
|
|
72
|
-
"aria-describedby":
|
|
73
|
-
"aria-invalid": !!
|
|
70
|
+
trigger: /* @__PURE__ */ f(m.Trigger, {
|
|
71
|
+
id: b.id,
|
|
72
|
+
form: h.form,
|
|
73
|
+
ref: y,
|
|
74
|
+
"aria-label": h.label ?? h["aria-label"],
|
|
75
|
+
"aria-describedby": b.describedBy,
|
|
76
|
+
"aria-invalid": !!b.error,
|
|
74
77
|
onBlur: (e) => {
|
|
75
|
-
|
|
78
|
+
C || b.blur(), h.onBlur?.(e);
|
|
76
79
|
},
|
|
77
|
-
onFocus:
|
|
80
|
+
onFocus: h.onFocus
|
|
78
81
|
})
|
|
79
|
-
}), /* @__PURE__ */
|
|
80
|
-
anchor:
|
|
82
|
+
}), /* @__PURE__ */ f(m.Portal, { children: /* @__PURE__ */ f(m.Positioner, {
|
|
83
|
+
anchor: S,
|
|
81
84
|
align: "start",
|
|
82
85
|
sideOffset: 4,
|
|
83
86
|
className: "pf:z-[60]",
|
|
84
87
|
alignItemWithTrigger: !1,
|
|
85
|
-
children: /* @__PURE__ */
|
|
86
|
-
|
|
88
|
+
children: /* @__PURE__ */ p(m.Popup, {
|
|
89
|
+
...x.props,
|
|
90
|
+
onPointerDownCapture: n.onPointerDownCapture,
|
|
91
|
+
onKeyDownCapture: (e) => {
|
|
92
|
+
if (x.props.onKeyDownCapture(), n.onKeyDownCapture(e), ![
|
|
93
|
+
"ArrowDown",
|
|
94
|
+
"ArrowUp",
|
|
95
|
+
"Home",
|
|
96
|
+
"End"
|
|
97
|
+
].includes(e.key) || e.target.closest("button, [role=\"checkbox\"]")) return;
|
|
98
|
+
let t = Array.from(e.currentTarget.querySelectorAll("[role=\"option\"]:not([aria-disabled=\"true\"])"));
|
|
99
|
+
if (!t.length) return;
|
|
100
|
+
let r = t.findIndex((e) => e === document.activeElement || e.hasAttribute("data-highlighted")), i = e.key === "Home" ? 0 : e.key === "End" ? t.length - 1 : e.key === "ArrowDown" ? (r + 1) % t.length : (r <= 0 ? t.length : r) - 1;
|
|
101
|
+
e.preventDefault(), e.stopPropagation(), t[i].focus();
|
|
102
|
+
},
|
|
103
|
+
className: l(a, e),
|
|
87
104
|
children: [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
105
|
+
x.highlight,
|
|
106
|
+
g && h.selectAllConfig && /* @__PURE__ */ f(r, {
|
|
107
|
+
checked: M,
|
|
108
|
+
indeterminate: !M && j.some((e) => D.has(e)),
|
|
109
|
+
className: "pf:select-none pf:mx-sm pf:mt-sm pf:mb-xxs pf:px-md pf:py-sm pf:min-h-[32px] pf:w-[calc(100%_-_12px)] pf:[&.pf-choice]:items-center pf:[&.pf-choice]:gap-sm pf:[&_.pf-choice-label]:font-medium pf:[&_.pf-choice-label]:leading-[20px] pf:rounded-sm pf:hover:bg-soft-pearl-200",
|
|
110
|
+
disabled: !j.length || !M && k !== void 0 && N.length > k,
|
|
93
111
|
onCheckedChange: () => {
|
|
94
|
-
|
|
112
|
+
A(M ? _.filter((e) => !j.includes(e)) : N);
|
|
95
113
|
},
|
|
96
|
-
label:
|
|
114
|
+
label: M ? "Clear selection" : h.selectAllConfig.label ?? "Select all"
|
|
97
115
|
}),
|
|
98
|
-
/* @__PURE__ */
|
|
99
|
-
style: { maxHeight:
|
|
116
|
+
/* @__PURE__ */ p(m.List, {
|
|
117
|
+
style: { maxHeight: h.listConfig?.maxHeight ?? 320 },
|
|
100
118
|
className: "pf:overflow-y-auto pf:flex pf:flex-col pf:gap-xxs pf:p-sm",
|
|
101
|
-
children: [
|
|
119
|
+
children: [h.groups ? h.groups.map((e) => /* @__PURE__ */ p(m.Group, {
|
|
102
120
|
className: "pf:flex pf:flex-col pf:gap-xxs",
|
|
103
|
-
children: [/* @__PURE__ */
|
|
121
|
+
children: [/* @__PURE__ */ f(m.GroupLabel, {
|
|
104
122
|
className: "pf:px-md pf:py-xs pf:text-copy-12 pf:text-soft-pearl-800",
|
|
105
123
|
children: e.label
|
|
106
|
-
}),
|
|
107
|
-
}, e.id)) :
|
|
108
|
-
className: "pf:
|
|
109
|
-
children:
|
|
124
|
+
}), P(e.options)]
|
|
125
|
+
}, e.id)) : P(T), !T.length && /* @__PURE__ */ f("div", {
|
|
126
|
+
className: "pf:px-lg pf:py-xl pf:text-copy-13 pf:text-soft-pearl-800",
|
|
127
|
+
children: h.emptyLabel ?? "No options available."
|
|
110
128
|
})]
|
|
111
129
|
}),
|
|
112
|
-
|
|
130
|
+
h.addItemConfig && /* @__PURE__ */ f("button", {
|
|
113
131
|
type: "button",
|
|
114
|
-
disabled:
|
|
115
|
-
className: "pf:box-border pf:w-full pf:text-start pf:px-md pf:py-sm pf:border-0 pf:bg-transparent pf:text-label-13 pf:text-blue-700 pf:font-body pf:rounded-xs pf:hover:bg-soft-pearl-200 pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:text-soft-pearl-700",
|
|
132
|
+
disabled: h.addItemConfig.isDisabled,
|
|
133
|
+
className: "pf:cursor-pointer pf:disabled:cursor-default pf:select-none pf:box-border pf:w-full pf:text-start pf:px-md pf:py-sm pf:border-0 pf:bg-transparent pf:text-label-13 pf:text-blue-700 pf:font-body pf:rounded-xs pf:hover:bg-soft-pearl-200 pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:text-soft-pearl-700",
|
|
116
134
|
onClick: () => {
|
|
117
|
-
|
|
135
|
+
h.addItemConfig?.onAddItem("");
|
|
118
136
|
},
|
|
119
|
-
children:
|
|
137
|
+
children: h.addItemConfig.label
|
|
120
138
|
})
|
|
121
139
|
]
|
|
122
140
|
})
|
|
@@ -124,4 +142,4 @@ function d({ config: d, multiple: f, values: p, onChange: m, forwardedRef: h, fi
|
|
|
124
142
|
});
|
|
125
143
|
}
|
|
126
144
|
//#endregion
|
|
127
|
-
export {
|
|
145
|
+
export { h as SimpleChoice };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const choicePopupClass = "pf:box-border pf:w-[var(--anchor-width)] pf:min-w-[min(200px,calc(100vw-24px))] pf:max-w-[calc(100vw-24px)] pf:rounded-lg pf:border-[0.5px] pf:border-solid pf:border-soft-pearl-300 pf:bg-background pf:p-0 pf:shadow-[0_1px_2px_#12121205,0_4px_20px_#12121214] pf:font-body pf:text-label-13 pf:leading-[20px] pf:font-medium pf:text-soft-pearl-1000 pf:outline-none";
|
|
2
|
-
export declare const choiceItemClass = "pf:box-border pf:flex pf:items-center pf:gap-sm pf:min-h-[32px] pf:ps-md pf:pe-lg pf:py-sm pf:rounded-sm pf:cursor-default pf:outline-none pf:data-highlighted:bg-soft-pearl-200 pf:data-disabled:text-soft-pearl-700 pf:data-disabled:cursor-
|
|
3
|
-
export declare const choiceActionClass = "pf:box-border pf:w-full pf:text-start pf:px-md pf:py-sm pf:border-0 pf:bg-transparent pf:text-label-13 pf:text-blue-700 pf:font-body pf:rounded-xs pf:hover:bg-soft-pearl-200 pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:text-soft-pearl-700";
|
|
2
|
+
export declare const choiceItemClass = "pf:relative pf:select-none pf:box-border pf:flex pf:items-center pf:gap-sm pf:min-h-[32px] pf:ps-md pf:pe-lg pf:py-sm pf:rounded-sm pf:cursor-default pf:outline-none pf:data-highlighted:not-data-disabled:bg-soft-pearl-200 pf:data-disabled:text-soft-pearl-700 pf:data-disabled:cursor-default";
|
|
3
|
+
export declare const choiceActionClass = "pf:cursor-pointer pf:disabled:cursor-default pf:select-none pf:box-border pf:w-full pf:text-start pf:px-md pf:py-sm pf:border-0 pf:bg-transparent pf:text-label-13 pf:text-blue-700 pf:font-body pf:rounded-xs pf:hover:bg-soft-pearl-200 pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:text-soft-pearl-700";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/components/selection/choice-styles.ts
|
|
2
|
-
var e = "pf:box-border pf:w-[var(--anchor-width)] pf:min-w-[min(200px,calc(100vw-24px))] pf:max-w-[calc(100vw-24px)] pf:rounded-lg pf:border-[0.5px] pf:border-solid pf:border-soft-pearl-300 pf:bg-background pf:p-0 pf:shadow-[0_1px_2px_#12121205,0_4px_20px_#12121214] pf:font-body pf:text-label-13 pf:leading-[20px] pf:font-medium pf:text-soft-pearl-1000 pf:outline-none", t = "pf:box-border pf:flex pf:items-center pf:gap-sm pf:min-h-[32px] pf:ps-md pf:pe-lg pf:py-sm pf:rounded-sm pf:cursor-default pf:outline-none pf:data-highlighted:bg-soft-pearl-200 pf:data-disabled:text-soft-pearl-700 pf:data-disabled:cursor-
|
|
2
|
+
var e = "pf:box-border pf:w-[var(--anchor-width)] pf:min-w-[min(200px,calc(100vw-24px))] pf:max-w-[calc(100vw-24px)] pf:rounded-lg pf:border-[0.5px] pf:border-solid pf:border-soft-pearl-300 pf:bg-background pf:p-0 pf:shadow-[0_1px_2px_#12121205,0_4px_20px_#12121214] pf:font-body pf:text-label-13 pf:leading-[20px] pf:font-medium pf:text-soft-pearl-1000 pf:outline-none", t = "pf:relative pf:select-none pf:box-border pf:flex pf:items-center pf:gap-sm pf:min-h-[32px] pf:ps-md pf:pe-lg pf:py-sm pf:rounded-sm pf:cursor-default pf:outline-none pf:data-highlighted:not-data-disabled:bg-soft-pearl-200 pf:data-disabled:text-soft-pearl-700 pf:data-disabled:cursor-default", n = "pf:cursor-pointer pf:disabled:cursor-default pf:select-none pf:box-border pf:w-full pf:text-start pf:px-md pf:py-sm pf:border-0 pf:bg-transparent pf:text-label-13 pf:text-blue-700 pf:font-body pf:rounded-xs pf:hover:bg-soft-pearl-200 pf:focus-visible:outline-2 pf:focus-visible:outline-blue-700 pf:disabled:text-soft-pearl-700";
|
|
3
3
|
//#endregion
|
|
4
4
|
export { n as choiceActionClass, t as choiceItemClass, e as choicePopupClass };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { overlaySurfaceClassNames as e, overlayTitleClassNames as t } from "../overlays/overlay-class-names.js";
|
|
3
3
|
import { OverlayFrame as n } from "../overlays/OverlayFrame.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { useOverlayState as r } from "../overlays/useOverlayState.js";
|
|
5
|
+
import { motionRecipe as i } from "../../foundations/motion/motion-tokens.js";
|
|
6
6
|
import { useSheetDrag as a } from "./useSheetDrag.js";
|
|
7
7
|
import o from "clsx";
|
|
8
8
|
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
@@ -14,7 +14,7 @@ var u = {
|
|
|
14
14
|
lg: "pf:w-[720px]"
|
|
15
15
|
};
|
|
16
16
|
function d(d) {
|
|
17
|
-
let { trigger: f, title: p, description: m, side: h = "right", size: g = "md", modal: _ = !1, children: v, footerConfig: y, dismissConfig: b, focusConfig: x, className: S } = d, C =
|
|
17
|
+
let { trigger: f, title: p, description: m, side: h = "right", size: g = "md", modal: _ = !1, children: v, footerConfig: y, dismissConfig: b, focusConfig: x, className: S } = d, C = r(d, b), w = h === "bottom", T = w && d.dragConfig?.dismissible !== !1, { popup: E, ...D } = a(T && !C.pending, C.open, () => {
|
|
18
18
|
C.requestClose("swipe");
|
|
19
19
|
});
|
|
20
20
|
return /* @__PURE__ */ c(l.Root, {
|
|
@@ -23,15 +23,15 @@ function d(d) {
|
|
|
23
23
|
onOpenChange: C.handleOpenChange,
|
|
24
24
|
disablePointerDismissal: !_ || b?.outsidePress !== !0,
|
|
25
25
|
children: [f && /* @__PURE__ */ s(l.Trigger, { render: f }), /* @__PURE__ */ c(l.Portal, { children: [_ && /* @__PURE__ */ s(l.Backdrop, {
|
|
26
|
-
className: o("pf:fixed pf:inset-0 pf:z-40 pf:bg-soft-pearl-1000/10 pf:transition-opacity pf:duration-
|
|
27
|
-
style: { transitionTimingFunction:
|
|
26
|
+
className: o("pf:fixed pf:inset-0 pf:z-40 pf:bg-soft-pearl-1000/10 pf:transition-opacity pf:duration-180 pf:data-[ending-style]:duration-120 pf:ease-[cubic-bezier(0.23,1,0.32,1)] pf:motion-reduce:transition-none pf:data-[starting-style]:opacity-0 pf:data-[ending-style]:opacity-0", "pf:duration-250", !w && "pf:data-[ending-style]:duration-180", !C.animate && "pf:transition-none"),
|
|
27
|
+
style: { transitionTimingFunction: i.sheetEasing }
|
|
28
28
|
}), /* @__PURE__ */ c(l.Popup, {
|
|
29
29
|
ref: E,
|
|
30
30
|
initialFocus: x?.initialFocusRef ?? (() => E.current?.querySelector("[data-overlay-body] input:not(:disabled), [data-overlay-body] textarea:not(:disabled), [data-overlay-body] button:not(:disabled), [data-overlay-body] a[href]") ?? E.current),
|
|
31
31
|
finalFocus: x?.returnFocusRef,
|
|
32
32
|
"aria-busy": C.pending || void 0,
|
|
33
|
-
className: o(e, "pf:fixed pf:z-50", w ? "pf:bottom-0 pf:inset-x-0 pf:max-h-[96dvh] pf:rounded-b-none pf:bg-soft-pearl-100 pf:pb-[env(safe-area-inset-bottom)]" : `pf:top-xl pf:right-xl pf:h-[calc(100dvh-32px)] pf:max-w-[calc(100vw-32px)] ${u[g]}`, C.animate && "pf:transition-transform pf:motion-reduce:transition-none", C.animate && (w ? "pf:duration-
|
|
34
|
-
style: { transitionTimingFunction:
|
|
33
|
+
className: o(e, "pf:fixed pf:z-50", w ? "pf:bottom-0 pf:inset-x-0 pf:max-h-[96dvh] pf:rounded-b-none pf:bg-soft-pearl-100 pf:pb-[env(safe-area-inset-bottom)]" : `pf:top-xl pf:right-xl pf:h-[calc(100dvh-32px)] pf:max-w-[calc(100vw-32px)] ${u[g]}`, C.animate && "pf:transition-transform pf:motion-reduce:transition-none", C.animate && (w ? "pf:duration-250 pf:data-[ending-style]:duration-180 pf:motion-safe:data-[starting-style]:[transform:translateY(100%)] pf:motion-safe:data-[ending-style]:[transform:translateY(100%)]" : "pf:duration-250 pf:data-[ending-style]:duration-180 pf:motion-safe:data-[starting-style]:[transform:translateX(calc(100%+16px))] pf:motion-safe:data-[ending-style]:[transform:translateX(calc(100%+16px))]"), S),
|
|
34
|
+
style: { transitionTimingFunction: i.sheetEasing },
|
|
35
35
|
children: [w && /* @__PURE__ */ s("button", {
|
|
36
36
|
type: "button",
|
|
37
37
|
disabled: !T || C.pending,
|