@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
|
@@ -8,74 +8,80 @@ import { CardBody as a } from "./CardBody.js";
|
|
|
8
8
|
import o from "clsx";
|
|
9
9
|
import { forwardRef as s, useId as c, useState as l } from "react";
|
|
10
10
|
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
|
+
import { Collapsible as p } from "@base-ui/react/collapsible";
|
|
11
12
|
//#region src/components/card/Card.tsx
|
|
12
|
-
var
|
|
13
|
-
let
|
|
13
|
+
var m = s(function({ children: s, headerConfig: m, footerConfig: h, disclosureConfig: g, elevation: _ = "raised", padding: v = "default", scrollConfig: y, className: b, ...x }, S) {
|
|
14
|
+
let [C, w] = l(!1), T = c(), E = c(), [D, O] = l(g?.defaultValue ?? !0), k = g?.value ?? D, A = {
|
|
14
15
|
2: "h2",
|
|
15
16
|
3: "h3",
|
|
16
17
|
4: "h4",
|
|
17
18
|
5: "h5",
|
|
18
19
|
6: "h6"
|
|
19
|
-
}[
|
|
20
|
-
return /* @__PURE__ */ f(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
}[m?.headingLevel ?? 3];
|
|
21
|
+
return /* @__PURE__ */ f(p.Root, {
|
|
22
|
+
open: k,
|
|
23
|
+
"data-motion": C ? "pointer" : void 0,
|
|
24
|
+
...x,
|
|
25
|
+
ref: S,
|
|
26
|
+
className: o(i, "pf:group/card pf:flex pf:flex-col", _ === "raised" && "pf:shadow-raised", b),
|
|
27
|
+
children: [(m || g) && /* @__PURE__ */ d(u, { children: /* @__PURE__ */ f("div", {
|
|
25
28
|
className: "pf:flex pf:items-center pf:gap-md pf:ps-xl pf:pe-lg pf:py-lg",
|
|
26
29
|
children: [
|
|
27
30
|
/* @__PURE__ */ f("div", {
|
|
28
31
|
className: "pf:flex pf:flex-col pf:gap-xxs pf:flex-1 pf:min-w-0",
|
|
29
|
-
children: [/* @__PURE__ */ d(
|
|
30
|
-
id:
|
|
32
|
+
children: [/* @__PURE__ */ d(A, {
|
|
33
|
+
id: T,
|
|
31
34
|
className: "pf:m-0 pf:font-body pf:text-label-13-strong pf:wrap-anywhere",
|
|
32
|
-
children:
|
|
33
|
-
}),
|
|
35
|
+
children: m?.title ?? g?.label ?? "Details"
|
|
36
|
+
}), m?.description && /* @__PURE__ */ d("p", {
|
|
34
37
|
className: "pf:m-0 pf:text-copy-12 pf:text-soft-pearl-800 pf:wrap-anywhere",
|
|
35
|
-
children:
|
|
38
|
+
children: m.description
|
|
36
39
|
})]
|
|
37
40
|
}),
|
|
38
|
-
|
|
41
|
+
m?.actionConfig && /* @__PURE__ */ d("span", {
|
|
39
42
|
className: "pf:min-w-0 pf:max-w-[45%]",
|
|
40
43
|
children: /* @__PURE__ */ d(t, {
|
|
41
|
-
action:
|
|
44
|
+
action: m.actionConfig,
|
|
42
45
|
variant: "link"
|
|
43
46
|
})
|
|
44
47
|
}),
|
|
45
|
-
|
|
48
|
+
g && /* @__PURE__ */ d(e, {
|
|
46
49
|
size: "xs",
|
|
47
|
-
label: `${
|
|
48
|
-
"aria-expanded":
|
|
49
|
-
"aria-controls":
|
|
50
|
-
onClick: () => {
|
|
51
|
-
|
|
50
|
+
label: `${k ? "Collapse" : "Expand"} ${g.label ?? m?.title ?? "details"}`,
|
|
51
|
+
"aria-expanded": k,
|
|
52
|
+
"aria-controls": E,
|
|
53
|
+
onClick: (e) => {
|
|
54
|
+
w(e.detail > 0), O(!k), g.onValueChange?.(!k);
|
|
52
55
|
},
|
|
53
56
|
children: /* @__PURE__ */ d(r, {
|
|
54
57
|
size: 16,
|
|
55
|
-
className:
|
|
58
|
+
className: o("pf:transition-none pf:motion-safe:group-data-[motion=pointer]/card:transition-transform pf:duration-200 pf:ease-[cubic-bezier(0.23,1,0.32,1)]", k && "pf:rotate-180")
|
|
56
59
|
})
|
|
57
60
|
})
|
|
58
61
|
]
|
|
59
|
-
})
|
|
60
|
-
id:
|
|
61
|
-
|
|
62
|
-
className:
|
|
63
|
-
children: [/* @__PURE__ */ d(
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
children: [
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
62
|
+
}) }), /* @__PURE__ */ f(p.Panel, {
|
|
63
|
+
id: E,
|
|
64
|
+
keepMounted: !0,
|
|
65
|
+
className: o("pf:min-h-0 pf:h-(--collapsible-panel-height) pf:overflow-hidden pf:transition-none pf:motion-safe:group-data-[motion=pointer]/card:transition-[height] pf:duration-200 pf:ease-[cubic-bezier(0.23,1,0.32,1)] pf:data-starting-style:h-0 pf:data-ending-style:h-0", k && "pf:flex-1"),
|
|
66
|
+
children: [(m || g) && /* @__PURE__ */ d(n, {}), /* @__PURE__ */ f("div", {
|
|
67
|
+
className: "pf:flex pf:min-h-0 pf:flex-col",
|
|
68
|
+
children: [/* @__PURE__ */ d(a, {
|
|
69
|
+
padding: v,
|
|
70
|
+
scrollConfig: y,
|
|
71
|
+
children: s
|
|
72
|
+
}), h && /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(n, {}), /* @__PURE__ */ f("div", {
|
|
73
|
+
className: "pf:flex pf:flex-wrap pf:justify-end pf:items-center pf:gap-md pf:ps-xl pf:pe-lg pf:py-lg",
|
|
74
|
+
children: [h.secondaryAction && /* @__PURE__ */ d(t, {
|
|
75
|
+
action: h.secondaryAction,
|
|
76
|
+
variant: "secondary"
|
|
77
|
+
}), h.primaryAction && /* @__PURE__ */ d(t, {
|
|
78
|
+
action: h.primaryAction,
|
|
79
|
+
variant: "primary"
|
|
80
|
+
})]
|
|
81
|
+
})] })]
|
|
82
|
+
})]
|
|
77
83
|
})]
|
|
78
84
|
});
|
|
79
85
|
});
|
|
80
86
|
//#endregion
|
|
81
|
-
export {
|
|
87
|
+
export { m as Card };
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { ChoiceLeading as
|
|
5
|
-
import { ChoiceText as
|
|
6
|
-
import { MinusIcon as a } from "../icons/MinusIcon.js";
|
|
2
|
+
import { getChoiceClassNames as e, getChoiceMarkClassNames as t } from "../choices/choice-class-names.js";
|
|
3
|
+
import { choiceMotionProps as n, choicePressClass as r } from "../choices/choice-motion.js";
|
|
4
|
+
import { ChoiceLeading as i } from "../choices/ChoiceLeading.js";
|
|
5
|
+
import { ChoiceText as a } from "../choices/ChoiceText.js";
|
|
7
6
|
import o from "clsx";
|
|
8
7
|
import { forwardRef as s, useId as c } from "react";
|
|
9
8
|
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
@@ -13,6 +12,12 @@ var f = s(function({ label: s, hideLabel: f, description: p, disabledReason: m,
|
|
|
13
12
|
let T = c(), E = h ? m : void 0;
|
|
14
13
|
return /* @__PURE__ */ u(d.Root, {
|
|
15
14
|
...C,
|
|
15
|
+
onPointerDownCapture: (e) => {
|
|
16
|
+
n.onPointerDownCapture(e), C.onPointerDownCapture?.(e);
|
|
17
|
+
},
|
|
18
|
+
onKeyDownCapture: (e) => {
|
|
19
|
+
n.onKeyDownCapture(e), C.onKeyDownCapture?.(e);
|
|
20
|
+
},
|
|
16
21
|
ref: w,
|
|
17
22
|
disabled: h,
|
|
18
23
|
indeterminate: y,
|
|
@@ -20,21 +25,34 @@ var f = s(function({ label: s, hideLabel: f, description: p, disabledReason: m,
|
|
|
20
25
|
"aria-label": s,
|
|
21
26
|
"aria-describedby": [S, p || E || _?.length ? T : void 0].filter(Boolean).join(" ") || void 0,
|
|
22
27
|
"data-variant": g,
|
|
23
|
-
className: o("pf-choice pf-checkbox",
|
|
28
|
+
className: o("pf-choice pf-checkbox", e(g), b),
|
|
24
29
|
children: [
|
|
25
30
|
/* @__PURE__ */ l("span", {
|
|
26
|
-
className: o("pf-choice-mark",
|
|
31
|
+
className: o("pf-choice-mark", t(g), r),
|
|
27
32
|
"aria-hidden": "true",
|
|
28
33
|
children: /* @__PURE__ */ l(d.Indicator, {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
keepMounted: !0,
|
|
35
|
+
className: "pf-checkbox-indicator pf:flex pf:data-unchecked:opacity-0 pf:transition-none pf:motion-safe:group-data-[motion=pointer]/choice:transition-opacity pf:duration-150",
|
|
36
|
+
children: /* @__PURE__ */ l("svg", {
|
|
37
|
+
width: "12",
|
|
38
|
+
height: "12",
|
|
39
|
+
viewBox: "0 0 12 12",
|
|
40
|
+
fill: "none",
|
|
41
|
+
"aria-hidden": "true",
|
|
42
|
+
children: /* @__PURE__ */ l("path", {
|
|
43
|
+
d: y ? "M2.5 6H9.5" : "M2.5 6L5 8.5L9.5 3.5",
|
|
44
|
+
pathLength: "1",
|
|
45
|
+
stroke: "currentColor",
|
|
46
|
+
strokeWidth: "1.5",
|
|
47
|
+
strokeLinecap: "round",
|
|
48
|
+
strokeLinejoin: "round",
|
|
49
|
+
className: "pf:[stroke-dasharray:1] pf:[stroke-dashoffset:1] pf:group-data-checked/choice:[stroke-dashoffset:0] pf:group-data-indeterminate/choice:[stroke-dashoffset:0] pf:transition-none pf:motion-safe:group-data-[motion=pointer]/choice:transition-[stroke-dashoffset] pf:duration-180 pf:ease-[cubic-bezier(0.23,1,0.32,1)]"
|
|
50
|
+
})
|
|
33
51
|
})
|
|
34
52
|
})
|
|
35
53
|
}),
|
|
36
|
-
/* @__PURE__ */ l(
|
|
37
|
-
/* @__PURE__ */ l(
|
|
54
|
+
/* @__PURE__ */ l(i, { children: v }),
|
|
55
|
+
/* @__PURE__ */ l(a, {
|
|
38
56
|
label: s,
|
|
39
57
|
hideLabel: f,
|
|
40
58
|
description: p,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { KeyboardEvent, PointerEvent } from 'react';
|
|
2
|
+
/** Pointer feedback is decorative; keyboard changes stay immediate. */
|
|
3
|
+
export declare const choiceMotionProps: {
|
|
4
|
+
onPointerDownCapture: (event: PointerEvent<HTMLElement>) => void;
|
|
5
|
+
onKeyDownCapture: (event: KeyboardEvent<HTMLElement>) => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const choicePressClass = "pf:transition-none pf:motion-safe:group-data-[motion=pointer]/choice:transition-transform pf:motion-safe:group-data-[motion=pointer]/choice:duration-100 pf:motion-safe:group-data-[motion=pointer]/choice:group-active/choice:duration-150 pf:ease-[cubic-bezier(0.23,1,0.32,1)] pf:motion-safe:group-data-[motion=pointer]/choice:group-not-data-disabled/choice:group-not-data-readonly/choice:group-active/choice:scale-[0.9]";
|
|
8
|
+
/** Composite options own interaction while their checkboxes only mirror selection. */
|
|
9
|
+
export declare const choiceIndicatorMotionProps: {
|
|
10
|
+
onPointerDownCapture: (event: PointerEvent<HTMLElement>) => void;
|
|
11
|
+
onKeyDownCapture: (event: KeyboardEvent<HTMLElement>) => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
//#region src/components/choices/choice-motion.ts
|
|
2
|
+
var e = {
|
|
3
|
+
onPointerDownCapture: (e) => {
|
|
4
|
+
e.currentTarget.setAttribute("data-motion", "pointer");
|
|
5
|
+
},
|
|
6
|
+
onKeyDownCapture: (e) => {
|
|
7
|
+
e.currentTarget.removeAttribute("data-motion");
|
|
8
|
+
}
|
|
9
|
+
}, t = "pf:transition-none pf:motion-safe:group-data-[motion=pointer]/choice:transition-transform pf:motion-safe:group-data-[motion=pointer]/choice:duration-100 pf:motion-safe:group-data-[motion=pointer]/choice:group-active/choice:duration-150 pf:ease-[cubic-bezier(0.23,1,0.32,1)] pf:motion-safe:group-data-[motion=pointer]/choice:group-not-data-disabled/choice:group-not-data-readonly/choice:group-active/choice:scale-[0.9]", n = {
|
|
10
|
+
onPointerDownCapture: (e) => {
|
|
11
|
+
e.currentTarget.querySelectorAll(".pf-checkbox").forEach((e) => {
|
|
12
|
+
e.setAttribute("data-motion", "pointer");
|
|
13
|
+
});
|
|
14
|
+
},
|
|
15
|
+
onKeyDownCapture: (e) => {
|
|
16
|
+
e.currentTarget.querySelectorAll(".pf-checkbox").forEach((e) => {
|
|
17
|
+
e.removeAttribute("data-motion");
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { n as choiceIndicatorMotionProps, e as choiceMotionProps, t as choicePressClass };
|
|
@@ -42,13 +42,14 @@ var c = ({ code: c, language: l = "text", filename: u, variant: d = "code", line
|
|
|
42
42
|
})] }), /* @__PURE__ */ o("span", {
|
|
43
43
|
className: "pf:truncate pf:text-soft-pearl-800",
|
|
44
44
|
title: l,
|
|
45
|
-
children: l
|
|
45
|
+
children: l.toUpperCase()
|
|
46
46
|
})]
|
|
47
47
|
}), m?.enabled !== !1 && /* @__PURE__ */ o("span", {
|
|
48
48
|
className: "pf:shrink-0",
|
|
49
49
|
children: /* @__PURE__ */ o(e, {
|
|
50
50
|
text: c,
|
|
51
|
-
config: m
|
|
51
|
+
config: m,
|
|
52
|
+
size: "sm"
|
|
52
53
|
})
|
|
53
54
|
})]
|
|
54
55
|
}), /* @__PURE__ */ o("div", {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export declare const controlPressClassNames = "pf:motion-safe:transition-[background-color,border-color,color,scale]! pf:motion-safe:duration-150! pf:motion-safe:ease-[cubic-bezier(0.23,1,0.32,1)] pf:motion-safe:not-focus-visible:not-data-disabled:active:scale-[0.98] pf:motion-safe:active:duration-100! pf:focus-visible:transition-none!";
|
|
1
2
|
export declare const controlFocusClassNames: string;
|
|
2
3
|
declare const sizeClassNames: {
|
|
3
4
|
xs: string;
|
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
import e from "clsx";
|
|
2
2
|
//#region src/components/controls/control-class-names.ts
|
|
3
|
-
var t = e("pf:focus-visible:outline-2 pf:focus-visible:outline-solid pf:focus-visible:outline-blue-700", "pf:focus-visible:outline-offset-2 pf:focus-visible:shadow-[0_0_0_2px_var(--pf-color-background)]"),
|
|
3
|
+
var t = "pf:motion-safe:transition-[background-color,border-color,color,scale]! pf:motion-safe:duration-150! pf:motion-safe:ease-[cubic-bezier(0.23,1,0.32,1)] pf:motion-safe:not-focus-visible:not-data-disabled:active:scale-[0.98] pf:motion-safe:active:duration-100! pf:focus-visible:transition-none!", n = e("pf:focus-visible:outline-2 pf:focus-visible:outline-solid pf:focus-visible:outline-blue-700", "pf:focus-visible:outline-offset-2 pf:focus-visible:shadow-[0_0_0_2px_var(--pf-color-background)]"), r = e("pf:box-border pf:relative pf:inline-flex pf:items-center pf:justify-center pf:min-w-0 pf:max-w-full", "pf:border-solid pf:font-body pf:font-medium pf:no-underline pf:cursor-pointer pf:align-middle", "pf:[-webkit-tap-highlight-color:transparent] pf:transition-[background-color,border-color,color]", "pf:duration-(--pf-duration-instant) pf:motion-reduce:transition-none"), i = {
|
|
4
4
|
xs: "pf:min-h-[24px] pf:gap-sm pf:px-lg pf:py-xs pf:text-label-13-strong",
|
|
5
5
|
sm: "pf:min-h-[28px] pf:gap-xs pf:px-md pf:py-xs pf:text-label-13-strong",
|
|
6
6
|
md: "pf:min-h-[32px] pf:gap-sm pf:px-lg pf:py-xs pf:text-label-13-strong",
|
|
7
7
|
lg: "pf:min-h-[36px] pf:gap-sm pf:px-lg pf:py-xs pf:text-label-15-strong"
|
|
8
|
-
},
|
|
8
|
+
}, a = {
|
|
9
9
|
primary: e("pf:border-0 pf:rounded-md pf:text-background pf:bg-blue-700 pf:not-data-disabled:hover:bg-blue-800", "pf:not-data-disabled:active:bg-blue-800 pf:data-popup-open:bg-blue-800 pf:aria-expanded:bg-blue-800"),
|
|
10
10
|
secondary: e("pf:border pf:rounded-md pf:border-soft-pearl-400 pf:text-soft-pearl-1000 pf:bg-background", "pf:not-data-disabled:hover:bg-soft-pearl-200 pf:not-data-disabled:hover:border-soft-pearl-500", "pf:not-data-disabled:active:bg-soft-pearl-300 pf:data-popup-open:bg-soft-pearl-200", "pf:aria-expanded:bg-soft-pearl-200"),
|
|
11
11
|
tertiary: e("pf:border-0 pf:rounded-md pf:bg-transparent pf:not-data-disabled:hover:bg-soft-pearl-200", "pf:not-data-disabled:active:bg-soft-pearl-300 pf:data-popup-open:bg-soft-pearl-200", "pf:aria-expanded:bg-soft-pearl-200"),
|
|
12
12
|
plain: "pf:border-0 pf:rounded-md pf:bg-transparent pf:text-soft-pearl-800 pf:not-data-disabled:hover:text-soft-pearl-1000",
|
|
13
13
|
link: "pf:border-0 pf:rounded-xs pf:bg-transparent pf:text-blue-700 pf:not-data-disabled:hover:text-blue-800 pf:not-data-disabled:hover:underline",
|
|
14
14
|
"link-subtle": e("pf:border-0 pf:rounded-xs pf:bg-transparent pf:text-soft-pearl-1000 pf:font-normal pf:underline", "pf:decoration-soft-pearl-500 pf:underline-offset-2 pf:not-data-disabled:hover:decoration-current")
|
|
15
|
-
},
|
|
15
|
+
}, o = {
|
|
16
16
|
primary: "pf:border-0 pf:rounded-md pf:bg-red-700 pf:text-background pf:not-data-disabled:hover:bg-red-800 pf:not-data-disabled:active:bg-red-800",
|
|
17
17
|
secondary: e("pf:border pf:rounded-md pf:border-red-400 pf:bg-background pf:text-red-700", "pf:not-data-disabled:hover:bg-red-100 pf:not-data-disabled:hover:border-red-500", "pf:not-data-disabled:active:bg-red-200 pf:not-data-disabled:active:text-red-800"),
|
|
18
18
|
tertiary: "pf:border-0 pf:rounded-md pf:bg-transparent pf:text-red-700 pf:not-data-disabled:hover:bg-red-100 pf:not-data-disabled:active:bg-red-200 pf:not-data-disabled:active:text-red-800"
|
|
19
|
-
},
|
|
20
|
-
let f =
|
|
21
|
-
return e(
|
|
19
|
+
}, s = ({ variant: t, size: s, destructive: c, disabled: l, loading: u, iconOnly: d }) => {
|
|
20
|
+
let f = t === "link" || t === "link-subtle", p = c && (t === "primary" || t === "secondary" || t === "tertiary") ? o[t] : void 0;
|
|
21
|
+
return e(r, n, f ? e("pf:min-h-0 pf:p-0 pf:gap-sm", s === "lg" ? "pf:text-label-15-strong" : "pf:text-label-13-strong") : i[s], l ? e("pf:text-soft-pearl-600 pf:cursor-not-allowed", f ? "pf:rounded-xs" : "pf:rounded-md", t === "link-subtle" && "pf:font-normal pf:underline pf:decoration-soft-pearl-500 pf:underline-offset-2", t === "primary" || t === "secondary" ? "pf:bg-soft-pearl-100 pf:border pf:border-soft-pearl-300" : "pf:bg-transparent pf:border-0") : p ?? a[t], u && "pf:cursor-progress", d && "pf:p-0! pf:shrink-0", d && {
|
|
22
22
|
xs: "pf:size-[24px]",
|
|
23
23
|
sm: "pf:size-[28px]",
|
|
24
24
|
md: "pf:size-[32px]",
|
|
25
25
|
lg: "pf:size-[36px]"
|
|
26
|
-
}[s],
|
|
26
|
+
}[s], t === "tertiary" && !l && !c && (d ? "pf:text-soft-pearl-800" : "pf:text-soft-pearl-1000"));
|
|
27
27
|
};
|
|
28
28
|
//#endregion
|
|
29
|
-
export {
|
|
29
|
+
export { n as controlFocusClassNames, t as controlPressClassNames, s as getControlClassNames };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type PointerEvent } from 'react';
|
|
2
|
+
/** One decorative highlight; primitives retain focus, selection and activation. */
|
|
3
|
+
export declare const useHoverHighlight: () => {
|
|
4
|
+
props: {
|
|
5
|
+
onPointerMove: (event: PointerEvent<HTMLElement>) => void;
|
|
6
|
+
onPointerLeave: () => void;
|
|
7
|
+
onKeyDownCapture: () => void;
|
|
8
|
+
onScrollCapture: () => void;
|
|
9
|
+
};
|
|
10
|
+
highlight: import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
};
|
|
12
|
+
export declare const hoverHighlightClass = "pf:relative pf:[&[data-pointer-highlight]_[data-highlighted]]:bg-transparent!";
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect as e, useRef as t } from "react";
|
|
3
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/controls/useHoverHighlight.tsx
|
|
5
|
+
var r = () => {
|
|
6
|
+
let r = t(null), i = t(null), a = t(null), o = t(null), s = () => {
|
|
7
|
+
o.current?.cancel(), i.current?.removeAttribute("data-pointer-highlight"), r.current && (r.current.hidden = !0), a.current = null;
|
|
8
|
+
};
|
|
9
|
+
return e(() => () => {
|
|
10
|
+
o.current?.cancel();
|
|
11
|
+
}, []), {
|
|
12
|
+
props: {
|
|
13
|
+
onPointerMove: (e) => {
|
|
14
|
+
if (e.pointerType !== "mouse" || typeof matchMedia != "function" || !matchMedia("(hover: hover) and (pointer: fine)").matches) return;
|
|
15
|
+
let t = e.currentTarget, n = e.target.closest("[role=\"menuitem\"], [role=\"option\"]"), c = r.current;
|
|
16
|
+
if (!n || !t.contains(n) || n.getAttribute("aria-disabled") === "true") {
|
|
17
|
+
(n || !e.target.closest("[role=\"listbox\"], [role=\"menu\"]")) && s();
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (!c || n === a.current) return;
|
|
21
|
+
let l = t.getBoundingClientRect(), u = n.getBoundingClientRect(), d = a.current && !c.hidden ? c.getBoundingClientRect() : null, f = l.width / t.offsetWidth || 1;
|
|
22
|
+
o.current?.cancel(), i.current = t, a.current = n, c.hidden = !1, t.setAttribute("data-pointer-highlight", ""), c.toggleAttribute("data-destructive", n.hasAttribute("data-destructive")), Object.assign(c.style, {
|
|
23
|
+
left: `${String((u.left - l.left) / f + t.scrollLeft - t.clientLeft)}px`,
|
|
24
|
+
top: `${String((u.top - l.top) / f + t.scrollTop - t.clientTop)}px`,
|
|
25
|
+
width: `${String(u.width / f)}px`,
|
|
26
|
+
height: `${String(u.height / f)}px`
|
|
27
|
+
}), !(matchMedia("(prefers-reduced-motion: reduce)").matches || typeof c.animate != "function") && (o.current = c.animate([{
|
|
28
|
+
transform: d ? `translate(${String((d.left - u.left) / f)}px, ${String((d.top - u.top) / f)}px) scale(${String(d.width / u.width)}, ${String(d.height / u.height)})` : "none",
|
|
29
|
+
opacity: +!!d
|
|
30
|
+
}, {
|
|
31
|
+
transform: "none",
|
|
32
|
+
opacity: 1
|
|
33
|
+
}], {
|
|
34
|
+
duration: 180,
|
|
35
|
+
easing: "cubic-bezier(0.23, 1, 0.32, 1)"
|
|
36
|
+
}));
|
|
37
|
+
},
|
|
38
|
+
onPointerLeave: s,
|
|
39
|
+
onKeyDownCapture: s,
|
|
40
|
+
onScrollCapture: s
|
|
41
|
+
},
|
|
42
|
+
highlight: /* @__PURE__ */ n("div", {
|
|
43
|
+
ref: r,
|
|
44
|
+
hidden: !0,
|
|
45
|
+
"aria-hidden": "true",
|
|
46
|
+
className: "pf:absolute pf:pointer-events-none pf:origin-top-left pf:rounded-sm pf:bg-soft-pearl-200 pf:data-destructive:bg-red-100"
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
}, i = "pf:relative pf:[&[data-pointer-highlight]_[data-highlighted]]:bg-transparent!";
|
|
50
|
+
//#endregion
|
|
51
|
+
export { i as hoverHighlightClass, r as useHoverHighlight };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare function useSelectionIndicator(): {
|
|
1
|
+
/** A single moving surface; only transform animates, including unequal segment widths. */
|
|
2
|
+
export declare function useSelectionIndicator(activeAttribute?: string, itemSelector?: string): {
|
|
4
3
|
rootRef: import("react").RefObject<HTMLDivElement>;
|
|
5
|
-
|
|
4
|
+
indicatorRef: import("react").RefObject<HTMLSpanElement>;
|
|
6
5
|
};
|
|
@@ -1,41 +1,56 @@
|
|
|
1
|
-
import { useLayoutEffect as e, useRef as t
|
|
1
|
+
import { useLayoutEffect as e, useRef as t } from "react";
|
|
2
2
|
//#region src/components/controls/useSelectionIndicator.ts
|
|
3
|
-
function r
|
|
4
|
-
let
|
|
3
|
+
function n(n = "data-checked", r = "[role=\"radio\"]") {
|
|
4
|
+
let i = t(null), a = t(null);
|
|
5
5
|
return e(() => {
|
|
6
|
-
let e =
|
|
7
|
-
if (!e) return;
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
if (!
|
|
11
|
-
|
|
6
|
+
let e = i.current, t = a.current;
|
|
7
|
+
if (!e || !t) return;
|
|
8
|
+
let o = !1, s, c = null, l = "", u = (r = !1) => {
|
|
9
|
+
let i = e.querySelector(`[${n}]`);
|
|
10
|
+
if (!i) {
|
|
11
|
+
s?.cancel(), l = "", t.hidden = !0, e.removeAttribute("data-indicator"), c = null;
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
14
|
+
let a = e.getBoundingClientRect(), u = i.getBoundingClientRect(), d = a.width / e.offsetWidth || 1, f = (u.left - a.left) / d - e.clientLeft + e.scrollLeft, p = (u.top - a.top) / d - e.clientTop + e.scrollTop, m = u.width / d, h = u.height / d, g = `${String(f)},${String(p)},${String(m)},${String(h)}`;
|
|
15
|
+
if (l === g) return;
|
|
16
|
+
let _ = t.hidden ? null : t.getBoundingClientRect(), v = r && c !== i && o && _ && typeof matchMedia == "function" && !matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
17
|
+
s?.cancel(), c = i, l = g, o = !1;
|
|
18
|
+
let y = `translate(${String(f)}px, ${String(p)}px)`;
|
|
19
|
+
Object.assign(t.style, {
|
|
20
|
+
width: `${String(m)}px`,
|
|
21
|
+
height: `${String(h)}px`,
|
|
22
|
+
transform: y
|
|
23
|
+
}), t.hidden = !1, e.setAttribute("data-indicator", ""), v && typeof t.animate == "function" && (s = t.animate([{ transform: `translate(${String(f + (_.left - u.left) / d)}px, ${String(p + (_.top - u.top) / d)}px) scale(${String(_.width / u.width)}, ${String(_.height / u.height)})` }, { transform: y }], {
|
|
24
|
+
duration: 200,
|
|
25
|
+
easing: "cubic-bezier(0.23, 1, 0.32, 1)"
|
|
26
|
+
}));
|
|
27
|
+
}, d = () => {
|
|
28
|
+
o = !0;
|
|
29
|
+
}, f = () => {
|
|
30
|
+
o = !1, s?.cancel();
|
|
31
|
+
}, p = () => {
|
|
32
|
+
u();
|
|
20
33
|
};
|
|
21
|
-
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
for (let t of e.querySelectorAll(
|
|
25
|
-
let
|
|
26
|
-
|
|
34
|
+
u();
|
|
35
|
+
let m = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver(p);
|
|
36
|
+
m?.observe(e);
|
|
37
|
+
for (let t of e.querySelectorAll(r)) m?.observe(t);
|
|
38
|
+
let h = new MutationObserver(() => {
|
|
39
|
+
u(!0);
|
|
40
|
+
});
|
|
41
|
+
return h.observe(e, {
|
|
27
42
|
subtree: !0,
|
|
28
43
|
attributes: !0,
|
|
29
|
-
attributeFilter: [
|
|
44
|
+
attributeFilter: [n],
|
|
30
45
|
childList: !0,
|
|
31
46
|
characterData: !0
|
|
32
|
-
}), e.addEventListener("scroll",
|
|
33
|
-
|
|
47
|
+
}), e.addEventListener("pointerdown", d, !0), e.addEventListener("keydown", f, !0), e.addEventListener("scroll", p, { passive: !0 }), () => {
|
|
48
|
+
s?.cancel(), m?.disconnect(), h.disconnect(), e.removeEventListener("pointerdown", d, !0), e.removeEventListener("keydown", f, !0), e.removeEventListener("scroll", p);
|
|
34
49
|
};
|
|
35
|
-
}, []), {
|
|
36
|
-
rootRef:
|
|
37
|
-
|
|
50
|
+
}, [n, r]), {
|
|
51
|
+
rootRef: i,
|
|
52
|
+
indicatorRef: a
|
|
38
53
|
};
|
|
39
54
|
}
|
|
40
55
|
//#endregion
|
|
41
|
-
export {
|
|
56
|
+
export { n as useSelectionIndicator };
|
|
@@ -5,8 +5,8 @@ import { Skeleton as n } from "../skeleton/Skeleton.js";
|
|
|
5
5
|
import { EmptyState as r } from "../empty-state/EmptyState.js";
|
|
6
6
|
import { ChevronDownIcon as i } from "../icons/ChevronDownIcon.js";
|
|
7
7
|
import { tabularAlignment as a, tabularClassNames as o } from "../tabular/tabular-class-names.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { useTabularPinning as s } from "../tabular/useTabularPinning.js";
|
|
9
|
+
import { TableEditCell as c } from "../tabular/TableEditCell.js";
|
|
10
10
|
import { DataGridHeaders as l } from "./DataGridHeaders.js";
|
|
11
11
|
import { DataGridToolbar as u } from "./DataGridToolbar.js";
|
|
12
12
|
import { GridModel as d } from "./grid-model.js";
|
|
@@ -17,18 +17,18 @@ import { useId as h, useState as g } from "react";
|
|
|
17
17
|
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
18
18
|
//#region src/components/data-grid/DataGrid.tsx
|
|
19
19
|
function y(y) {
|
|
20
|
-
let [b, x] = g(y.expansionConfig?.defaultValue ?? []), S = y.expansionConfig?.value ?? b, [C, w] = g(null), T = h(), E = d.columns(y.columns), { ref: D, canPin: O } =
|
|
20
|
+
let [b, x] = g(y.expansionConfig?.defaultValue ?? []), S = y.expansionConfig?.value ?? b, [C, w] = g(null), T = h(), E = d.columns(y.columns), { ref: D, canPin: O } = s((y.rowHeaderConfig.width ?? 240) + Math.min(...E.leaves.map((e) => e.width ?? 128), 240)), k = f(y), A = d.rows(y, S, k.visibleIds), j = A.some((e) => e.kind === "record"), M = p(A.map((e) => e.id), ["", ...E.leaves.map((e) => e.id)]), N = y.stateConfig?.isLoading, P = y.stateConfig?.error, F = (y.rowHeaderConfig.width ?? 240) + E.leaves.reduce((e, t) => e + (t.width ?? 128), 0), I = (e) => {
|
|
21
21
|
if (k.filtered) return;
|
|
22
22
|
let t = y.rowConfig.getId(e), n = S.includes(t) ? S.filter((e) => e !== t) : [...S, t];
|
|
23
23
|
x(n), y.expansionConfig?.onValueChange?.(n);
|
|
24
24
|
}, L = (n) => {
|
|
25
|
-
let r = n.label ?? y.rowHeaderConfig.getLabel(n.row),
|
|
25
|
+
let r = n.label ?? y.rowHeaderConfig.getLabel(n.row), s = n.kind === "total", l = n.kind === "subtotal", u = s || l ? "pf:bg-soft-pearl-100" : "pf:bg-background";
|
|
26
26
|
return /* @__PURE__ */ v("tr", { children: [/* @__PURE__ */ _("th", {
|
|
27
27
|
scope: "row",
|
|
28
28
|
role: "rowheader",
|
|
29
29
|
"aria-expanded": n.hasChildren ? n.expanded : void 0,
|
|
30
30
|
...M.cell(n.id, ""),
|
|
31
|
-
className: m(o.cell, o.activeCell, "pf:h-[40px] pf:border-e-[0.5px] pf:text-start", O && "pf:sticky pf:start-0 pf:z-10", u, (n.hasChildren ||
|
|
31
|
+
className: m(o.cell, o.activeCell, "pf:h-[40px] pf:border-e-[0.5px] pf:text-start", O && "pf:sticky pf:start-0 pf:z-10", O && o.pinnedEdge, u, (n.hasChildren || s || l) && "pf:font-medium", s && "pf:sticky pf:bottom-0 pf:z-20 pf:shadow-[0_-0.5px_0_var(--pf-color-soft-pearl-400)]"),
|
|
32
32
|
children: /* @__PURE__ */ v("span", {
|
|
33
33
|
className: "pf:flex pf:items-center pf:gap-md",
|
|
34
34
|
style: { paddingInlineStart: n.depth * 16 },
|
|
@@ -58,8 +58,8 @@ function y(y) {
|
|
|
58
58
|
...M.cell(n.id, t.id),
|
|
59
59
|
"aria-invalid": !!g || void 0,
|
|
60
60
|
"aria-label": g ? `${r}, ${t.header}: ${String(p ?? "")}. ${g}` : void 0,
|
|
61
|
-
className: m(f ? o.editableCell : o.cell, o.activeCell, "pf:h-[40px] pf:border-e-[0.5px]", u, a[t.align ?? "end"], (
|
|
62
|
-
children: n.hasChildren && n.expanded ? null : f ? /* @__PURE__ */ _(
|
|
61
|
+
className: m(f ? o.editableCell : o.cell, o.activeCell, "pf:h-[40px] pf:border-e-[0.5px]", u, a[t.align ?? "end"], (s || l) && "pf:font-medium", s && "pf:sticky pf:bottom-0 pf:z-10 pf:shadow-[0_-0.5px_0_var(--pf-color-soft-pearl-400)]", g && "pf:text-red-800"),
|
|
62
|
+
children: n.hasChildren && n.expanded ? null : f ? /* @__PURE__ */ _(c, {
|
|
63
63
|
label: `${r}, ${t.header}`,
|
|
64
64
|
value: d.getValue(n.row),
|
|
65
65
|
display: h,
|
|
@@ -6,7 +6,7 @@ function a({ headers: a, label: o, alignment: s, pinned: c }) {
|
|
|
6
6
|
return /* @__PURE__ */ r("thead", { children: a.map((l, u) => /* @__PURE__ */ i("tr", { children: [u === 0 && /* @__PURE__ */ r("th", {
|
|
7
7
|
scope: "col",
|
|
8
8
|
rowSpan: a.length,
|
|
9
|
-
className: n(t.header, "pf:sticky pf:top-0 pf:z-30 pf:bg-soft-pearl-100 pf:text-start pf:align-bottom pf:border-e-[0.5px]", c && "pf:start-0"),
|
|
9
|
+
className: n(t.header, "pf:sticky pf:top-0 pf:z-30 pf:bg-soft-pearl-100 pf:text-start pf:align-bottom pf:border-e-[0.5px]", c && "pf:start-0", c && t.pinnedEdge),
|
|
10
10
|
children: o
|
|
11
11
|
}), l.map((i) => /* @__PURE__ */ r("th", {
|
|
12
12
|
scope: i.leaf ? "col" : "colgroup",
|
|
@@ -32,9 +32,9 @@ var m = {
|
|
|
32
32
|
outside: "pf:text-soft-pearl-800",
|
|
33
33
|
disabled: "pf:text-soft-pearl-600",
|
|
34
34
|
hidden: "pf:invisible",
|
|
35
|
-
range_middle: "pf-date-range-middle pf:bg-blue-
|
|
36
|
-
range_start: "pf:before:absolute pf:before:inset-y-0 pf:before:start-1/2 pf:before:end-0 pf:before:bg-blue-
|
|
37
|
-
range_end: "pf:before:absolute pf:before:inset-y-0 pf:before:start-0 pf:before:end-1/2 pf:before:bg-blue-
|
|
35
|
+
range_middle: "pf-date-range-middle pf:bg-blue-200 pf:[&.pf-date-range-middle>button:hover]:bg-blue-200 pf:[&.pf-date-range-middle>button]:bg-blue-200 pf:[&.pf-date-range-middle>button]:text-blue-900 pf:[&.pf-date-range-middle>button]:rounded-none pf:[&.pf-date-range-middle>button]:font-normal",
|
|
36
|
+
range_start: "pf:before:absolute pf:before:inset-y-0 pf:before:start-1/2 pf:before:end-0 pf:before:bg-blue-200",
|
|
37
|
+
range_end: "pf:before:absolute pf:before:inset-y-0 pf:before:start-0 pf:before:end-1/2 pf:before:bg-blue-200"
|
|
38
38
|
};
|
|
39
39
|
function h({ config: t, value: n, onChange: u }) {
|
|
40
40
|
let [d, f] = a(!1);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { XCloseIcon as e } from "../icons/XCloseIcon.js";
|
|
3
3
|
import { FieldFrame as t, fieldShellClass as n } from "../fields/FieldFrame.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
4
|
+
import { DateValueHelper as r } from "./date-value-helper.js";
|
|
5
|
+
import { DateCalendar as i } from "./DateCalendar.js";
|
|
6
|
+
import { useCompositeField as a } from "../fields/useCompositeField.js";
|
|
7
|
+
import { CalendarIcon as o } from "../icons/CalendarIcon.js";
|
|
8
8
|
import { DateField as s } from "./field/DateField.js";
|
|
9
9
|
import c from "clsx";
|
|
10
10
|
import { forwardRef as l, useCallback as u, useRef as d, useState as f } from "react";
|
|
@@ -17,10 +17,10 @@ var _ = {
|
|
|
17
17
|
}, v = l(function(l, v) {
|
|
18
18
|
let y = (e) => {
|
|
19
19
|
l.mode === "range" ? e && typeof e == "object" && l.onValueChange?.(e) : (typeof e == "string" || e === null) && l.onValueChange?.(e);
|
|
20
|
-
}, b =
|
|
20
|
+
}, b = a({
|
|
21
21
|
...l,
|
|
22
22
|
onValueChange: y
|
|
23
|
-
}, l.mode === "range" ? _ : null), [x, S] = f(!1), [C, w] = f(), [T, E] = f(), [D, O] = f(0), k = d(null), A = b.value && typeof b.value == "object" ? b.value : _, j = typeof b.value == "string" ? b.value : null, M = (e) => l.mode === "month" ?
|
|
23
|
+
}, l.mode === "range" ? _ : null), [x, S] = f(!1), [C, w] = f(), [T, E] = f(), [D, O] = f(0), k = d(null), A = b.value && typeof b.value == "object" ? b.value : _, j = typeof b.value == "string" ? b.value : null, M = (e) => l.mode === "month" ? r.monthError(e, l.constraintConfig) : r.dateError(e, l.constraintConfig), N = l.mode === "range" ? r.rangeError(A, l.constraintConfig) : M(j), P = C || T || N, F = b.error || P, I = l.label ?? l["aria-label"], L = l.disableConfig?.isDisabled, R = L || l.readOnly, z = [b.describedBy, P ? b.supportId : void 0].filter(Boolean).join(" ") || void 0, B = (e) => {
|
|
24
24
|
b.change(e);
|
|
25
25
|
}, V = u((e) => {
|
|
26
26
|
w(e);
|
|
@@ -57,7 +57,7 @@ var _ = {
|
|
|
57
57
|
disabled: R,
|
|
58
58
|
"aria-label": `Choose ${I.toLowerCase()}`,
|
|
59
59
|
className: U,
|
|
60
|
-
children: /* @__PURE__ */ m(
|
|
60
|
+
children: /* @__PURE__ */ m(o, { size: 16 })
|
|
61
61
|
}),
|
|
62
62
|
/* @__PURE__ */ h("div", {
|
|
63
63
|
className: "pf:flex pf:flex-1 pf:min-w-0 pf:flex-wrap pf:items-center pf:gap-md",
|
|
@@ -74,7 +74,7 @@ var _ = {
|
|
|
74
74
|
describedBy: z,
|
|
75
75
|
invalid: !!b.error,
|
|
76
76
|
onDraftError: V,
|
|
77
|
-
validate: (e) => l.mode === "range" ?
|
|
77
|
+
validate: (e) => l.mode === "range" ? r.rangeError({
|
|
78
78
|
...A,
|
|
79
79
|
start: e
|
|
80
80
|
}, l.constraintConfig) : M(e),
|
|
@@ -99,7 +99,7 @@ var _ = {
|
|
|
99
99
|
describedBy: z,
|
|
100
100
|
invalid: !!b.error,
|
|
101
101
|
onDraftError: H,
|
|
102
|
-
validate: (e) =>
|
|
102
|
+
validate: (e) => r.rangeError({
|
|
103
103
|
...A,
|
|
104
104
|
end: e
|
|
105
105
|
}, l.constraintConfig),
|
|
@@ -129,7 +129,7 @@ var _ = {
|
|
|
129
129
|
children: /* @__PURE__ */ m(g.Popup, {
|
|
130
130
|
"aria-label": `${I} calendar`,
|
|
131
131
|
className: "pf:box-border pf:max-w-[calc(100vw-24px)] pf:overflow-auto pf:rounded-lg pf:border-[0.5px] pf:border-solid pf:border-soft-pearl-300 pf:bg-background pf:shadow-menu pf:font-body pf:text-soft-pearl-1000",
|
|
132
|
-
children: /* @__PURE__ */ m(
|
|
132
|
+
children: /* @__PURE__ */ m(i, {
|
|
133
133
|
config: l,
|
|
134
134
|
value: b.value,
|
|
135
135
|
onChange: (e) => {
|
|
@@ -69,7 +69,7 @@ function h({ id: h, form: g, label: _, value: v, onChange: y, format: b, monthOn
|
|
|
69
69
|
placeholder: n[e].placeholder,
|
|
70
70
|
maxLength: n[e].maxLength,
|
|
71
71
|
value: A[e],
|
|
72
|
-
className: o("pf:box-border pf:shrink-0 pf:min-w-0 pf:border-0 pf:bg-transparent pf:font-body pf:text-label-13 pf:text-soft-pearl-1000 pf:p-0 pf:h-[24px] pf:text-center pf:rounded-[
|
|
72
|
+
className: o("pf:box-border pf:shrink-0 pf:min-w-0 pf:border-0 pf:bg-transparent pf:font-body pf:text-label-13 pf:text-soft-pearl-1000 pf:p-0 pf:h-[24px] pf:text-center pf:rounded-[4px] pf:outline-none pf:focus:not-disabled:bg-blue-100 pf:focus:not-disabled:text-blue-900 pf:placeholder:text-soft-pearl-700 pf:selection:bg-transparent pf:selection:text-soft-pearl-1000", e === "year" ? "pf:w-[40px]" : "pf:w-[28px]"),
|
|
73
73
|
onFocus: (e) => {
|
|
74
74
|
e.currentTarget.select();
|
|
75
75
|
},
|